bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] Port _GL_HAS_C_ATTRIBUTE to pedantic gcc -std=c99


From: Paul Eggert
Subject: [PATCH 2/2] Port _GL_HAS_C_ATTRIBUTE to pedantic gcc -std=c99
Date: Tue, 19 Apr 2022 18:24:45 -0700

* m4/gnulib-common.m4 (_GL_HAS_C_ATTRIBUTE):
Disable -Wpedantic if using __has_c_attribute and this is not C2x.
---
 ChangeLog           | 4 ++++
 m4/gnulib-common.m4 | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index c2509b8387..fee51331c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2022-04-19  Paul Eggert  <eggert@cs.ucla.edu>
 
+       Port _GL_HAS_C_ATTRIBUTE to pedantic gcc -std=c99
+       * m4/gnulib-common.m4 (_GL_HAS_C_ATTRIBUTE):
+       Disable -Wpedantic if using __has_c_attribute and this is not C2x.
+
        verify: port to pedantic gcc -std=c99
        * lib/verify.h (_GL_VERIFY): If we lack both _Static_assert and
        static_assert, suppress -Wnexted-externs.
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index c5ced04f18..30911d1581 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 72
+# gnulib-common.m4 serial 73
 dnl Copyright (C) 2007-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -106,6 +106,10 @@ AC_DEFUN([gl_COMMON_BODY], [
 #endif
 
 #ifdef __has_c_attribute
+# if ((defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) <= 201710 \
+      && _GL_GNUC_PREREQ (4, 6))
+#  pragma GCC diagnostic ignored "-Wpedantic"
+# endif
 # define _GL_HAS_C_ATTRIBUTE(attr) __has_c_attribute (__##attr##__)
 #else
 # define _GL_HAS_C_ATTRIBUTE(attr) 0
-- 
2.35.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]