summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-10-17 11:28:38 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-10-17 11:51:20 -0700
commit83c9051a64e70b07904a0f6abe7988f75e59884e (patch)
treef1e940f1104fbf71e7e9a79675dea16ec00b3fb2 /data
parent7a557ee7fe7d18400a161c696a8ad32d374caf5e (diff)
downloadbison-83c9051a64e70b07904a0f6abe7988f75e59884e.tar.gz
c: port YY_ATTRIBUTE_UNUSED to Sun C 5.12
Sun C 5.12 defines __SUNPRO_C to 0x5120 but diagnoses ‘__attribute__ ((__unused__))’. Change the ifdefs to use the same method as Gnulib in this area. * data/skeletons/c.m4 (YY_ATTRIBUTE): Remove, since not all attributes were added in the same compiler version. (YY_ATTRIBUTE_PURE, YY_ATTRIBUTE_UNUSED): Use specific GCC version for each attribute. Pay no attention to __SUNPRO_C. * tests/headers.at (Several parsers): Tighten tests accordingly.
Diffstat (limited to 'data')
-rw-r--r--data/skeletons/c.m420
1 files changed, 9 insertions, 11 deletions
diff --git a/data/skeletons/c.m4 b/data/skeletons/c.m4
index 4580fd75..a1d55d47 100644
--- a/data/skeletons/c.m4
+++ b/data/skeletons/c.m4
@@ -282,22 +282,20 @@ m4_define([b4_table_value_equals],
# Provide portable compiler "attributes". If "noreturn" is passed, define
# _Noreturn.
m4_define([b4_attribute_define],
-[[#ifndef YY_ATTRIBUTE
-# if (defined __GNUC__ \
- && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
- || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
-# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+[[#ifndef YY_ATTRIBUTE_PURE
+# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
+# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
# else
-# define YY_ATTRIBUTE(Spec) /* empty */
+# define YY_ATTRIBUTE_PURE
# endif
#endif
-#ifndef YY_ATTRIBUTE_PURE
-# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
-#endif
-
#ifndef YY_ATTRIBUTE_UNUSED
-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
+# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+# else
+# define YY_ATTRIBUTE_UNUSED
+# endif
#endif
]m4_bmatch([$1], [\bnoreturn\b], [[/* The _Noreturn keyword of C11. */