From ac4b301ae15223c98b51cd5a0eda2e2cf57c817b Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 30 May 2024 16:33:55 +0200 Subject: [PATCH] attribute: Try harder to avoid syntax errors. * m4/gnulib-common.m4 (gl_COMMON_BODY): Define _GL_ATTRIBUTE_REPRODUCIBLE and _GL_ATTRIBUTE_UNSEQUENCED to empty if _GL_BRACKET_BEFORE_ATTRIBUTE is defined. --- ChangeLog | 7 +++++++ m4/gnulib-common.m4 | 24 +++++++++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ea227c411..2d96de1066 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-05-30 Bruno Haible + + attribute: Try harder to avoid syntax errors. + * m4/gnulib-common.m4 (gl_COMMON_BODY): Define + _GL_ATTRIBUTE_REPRODUCIBLE and _GL_ATTRIBUTE_UNSEQUENCED to empty if + _GL_BRACKET_BEFORE_ATTRIBUTE is defined. + 2024-05-30 Bruno Haible attribute: Improve comments. diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index fba5158ced..b34b4534bf 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -1,5 +1,5 @@ # gnulib-common.m4 -# serial 94 +# serial 95 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -556,9 +556,14 @@ AC_DEFUN([gl_COMMON_BODY], [ . */ /* Applies to: functions, pointer to functions, function types. */ #ifndef _GL_ATTRIBUTE_REPRODUCIBLE -# if _GL_HAS_ATTRIBUTE (reproducible) -# define _GL_ATTRIBUTE_REPRODUCIBLE [[reproducible]] -# else +/* This may be revisited when gcc and clang support [[reproducible]] or possibly + __attribute__ ((__reproducible__)). */ +# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE +# if _GL_HAS_ATTRIBUTE (reproducible) +# define _GL_ATTRIBUTE_REPRODUCIBLE [[reproducible]] +# endif +# endif +# ifndef _GL_ATTRIBUTE_REPRODUCIBLE # define _GL_ATTRIBUTE_REPRODUCIBLE # endif #endif @@ -602,9 +607,14 @@ AC_DEFUN([gl_COMMON_BODY], [ . */ /* Applies to: functions, pointer to functions, function types. */ #ifndef _GL_ATTRIBUTE_UNSEQUENCED -# if _GL_HAS_ATTRIBUTE (unsequenced) -# define _GL_ATTRIBUTE_UNSEQUENCED [[unsequenced]] -# else +/* This may be revisited when gcc and clang support [[unsequenced]] or possibly + __attribute__ ((__unsequenced__)). */ +# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE +# if _GL_HAS_ATTRIBUTE (unsequenced) +# define _GL_ATTRIBUTE_UNSEQUENCED [[unsequenced]] +# endif +# endif +# ifndef _GL_ATTRIBUTE_UNSEQUENCED # define _GL_ATTRIBUTE_UNSEQUENCED # endif #endif -- 2.39.5