diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-03-30 14:28:10 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-03-30 14:28:10 +0300 |
commit | abde9f31440e862d4fd51605d8fade099b602cb5 (patch) | |
tree | 5cc4aaae46d8b2f76e994e4563a962eb3846c001 /m4/noreturn.m4 | |
parent | 19a22c41661c3b032c9cdcfd6913373526c025c8 (diff) | |
download | egawk-abde9f31440e862d4fd51605d8fade099b602cb5.tar.gz egawk-abde9f31440e862d4fd51605d8fade099b602cb5.tar.bz2 egawk-abde9f31440e862d4fd51605d8fade099b602cb5.zip |
Move _Noreturn handlng into a separate macro.
Diffstat (limited to 'm4/noreturn.m4')
-rw-r--r-- | m4/noreturn.m4 | 38 |
1 files changed, 38 insertions, 0 deletions
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 +])]) |