diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2012-02-29 01:48:18 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2012-02-29 01:49:25 -0800 |
commit | 37fee00c15dd7de127bbfb0d2bd2e9e2a240729d (patch) | |
tree | cd5ab81299eeb8779186788e6b95d1ff45d2e48a /lib/stdnoreturn.in.h | |
parent | 75ca5935f84fedf0eb6611245cc28555036d2090 (diff) | |
download | gnulib-37fee00c15dd7de127bbfb0d2bd2e9e2a240729d.tar.gz |
stdnoreturn: port to MSVC better
MSVC standard headers use __declspec(noreturn), so #define noreturn
to empty on that platform. Reported by Bruno Haible in
<http://lists.gnu.org/archive/html/bug-gnulib/2012-02/msg00152.html>.
* lib/stdnoreturn.in.h (noreturn): Define to empty on MSVC.
* doc/posix-headers/stdnoreturn.texi (stdnoreturn.h): Document this.
Diffstat (limited to 'lib/stdnoreturn.in.h')
-rw-r--r-- | lib/stdnoreturn.in.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/stdnoreturn.in.h b/lib/stdnoreturn.in.h index 5ca30631fe..ab9202ed13 100644 --- a/lib/stdnoreturn.in.h +++ b/lib/stdnoreturn.in.h @@ -28,7 +28,19 @@ /* The definition of _Noreturn is copied here. */ -#define noreturn _Noreturn +#if 1200 <= _MSC_VER +/* Standard include files on this platform contain declarations like + "__declspec (noreturn) void abort (void);". "#define noreturn + _Noreturn" would cause this declaration to be rewritten to the + invalid "__declspec (__declspec (noreturn)) void abort (void);". + Instead, define noreturn to empty, so that such declarations are + rewritten to "__declspec () void abort (void);", which is + equivalent to "void abort (void);"; this gives up on noreturn's + advice to the compiler but at least it is valid code. */ +# define noreturn /*empty*/ +#else +# define noreturn _Noreturn +#endif /* Did he ever return? No he never returned |