From e97463c9905649bafe4ecf8b93da7b54e0e7486a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 19 Apr 2022 18:23:37 -0700 Subject: [PATCH] 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. --- 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 + 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.39.5