aboutsummaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4')
-rw-r--r--m4/ChangeLog4
-rw-r--r--m4/noreturn.m438
2 files changed, 42 insertions, 0 deletions
diff --git a/m4/ChangeLog b/m4/ChangeLog
index d684afe9..9e6800ad 100644
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,7 @@
+2012-03-30 Arnold D. Robbins <arnold@skeeve.com>
+
+ * noreturn.m4: New file.
+
2012-03-28 Arnold D. Robbins <arnold@skeeve.com>
* 4.0.1: Release tar ball made.
diff --git a/m4/noreturn.m4 b/m4/noreturn.m4
new file mode 100644
index 00000000..7fa7d377
--- /dev/null
+++ b/m4/noreturn.m4
@@ -0,0 +1,38 @@
+dnl Date: Sun, 26 Feb 2012 11:31:50 -0800
+dnl From: Paul Eggert <eggert@cs.ucla.edu>
+dnl To: arnold@skeeve.com
+dnl CC: bug-grep@gnu.org
+dnl Subject: Re: avoid gcc 4.6.2 'may be used before set' warnings in dfa.c
+dnl
+dnl On 02/26/2012 01:18 AM, arnold@skeeve.com wrote:
+dnl > It looks like I can just use the code as it is now in grep. I have asked
+dnl > for compile failures and haven't gotten any.
+dnl
+dnl Sure, but the gnulib support for this is better
+dnl than what's in the dfa code. It could be that
+dnl your correspondents aren't using the less-common hosts
+dnl or compiler warning options that gnulib is ported to.
+dnl
+dnl In the long run stdnoreturn.h or _Noreturn is the way to go,
+dnl since they're part of the C standard.
+dnl
+dnl If you'd rather not create a separate file, how about if
+dnl we change the dfa code to use _Noreturn instead of
+dnl <stdnoreturn.h> and noreturn, and you can put the
+dnl following into your configure.ac so that config.h
+dnl defines _Noreturn the same way gnulib does:
+
+AC_DEFUN([GAWK_AC_NORETURN],[
+AH_VERBATIM([_Noreturn],
+[/* The _Noreturn keyword of C11. */
+#ifndef _Noreturn
+# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
+ || 0x5110 <= __SUNPRO_C)
+# define _Noreturn __attribute__ ((__noreturn__))
+# elif defined _MSC_VER && 1200 <= _MSC_VER
+# define _Noreturn __declspec (noreturn)
+# else
+# define _Noreturn
+# endif
+#endif
+])])