root/maint/gnulib/lib/stdnoreturn.in.h

/* [previous][next][first][last][top][bottom][index][help] */
   1 /* A substitute for ISO C11 <stdnoreturn.h>.
   2 
   3    Copyright 2012-2021 Free Software Foundation, Inc.
   4 
   5    This file is free software: you can redistribute it and/or modify
   6    it under the terms of the GNU Lesser General Public License as
   7    published by the Free Software Foundation; either version 2.1 of the
   8    License, or (at your option) any later version.
   9 
  10    This file is distributed in the hope that it will be useful,
  11    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13    GNU Lesser General Public License for more details.
  14 
  15    You should have received a copy of the GNU Lesser General Public License
  16    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
  17 
  18 /* Written by Paul Eggert.  */
  19 
  20 #ifndef noreturn
  21 
  22 /* ISO C11 <stdnoreturn.h> for platforms that lack it.
  23 
  24    References:
  25    ISO C11 (latest free draft
  26    <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>)
  27    section 7.23 */
  28 
  29 /* The definition of _Noreturn is copied here.  */
  30 
  31 #if 1200 <= _MSC_VER || defined __CYGWIN__
  32 /* On MSVC, standard include files contain declarations like
  33      __declspec (noreturn) void abort (void);
  34    "#define noreturn _Noreturn" would cause this declaration to be rewritten
  35    to the invalid
  36      __declspec (__declspec (noreturn)) void abort (void);
  37 
  38    Similarly, on Cygwin, standard include files contain declarations like
  39      void __cdecl abort (void) __attribute__ ((noreturn));
  40    "#define noreturn _Noreturn" would cause this declaration to be rewritten
  41    to the invalid
  42      void __cdecl abort (void) __attribute__ ((__attribute__ ((__noreturn__))));
  43 
  44    Instead, define noreturn to empty, so that such declarations are rewritten to
  45      __declspec () void abort (void);
  46    or
  47      void __cdecl abort (void) __attribute__ (());
  48    respectively.  This gives up on noreturn's advice to the compiler but at
  49    least it is valid code.  */
  50 # define noreturn /*empty*/
  51 #else
  52 # define noreturn _Noreturn
  53 #endif
  54 
  55 /* Did he ever return?
  56    No he never returned
  57    And his fate is still unlearn'd ...
  58      -- Steiner J, Hawes BL.  M.T.A. (1949)  */
  59 
  60 #endif /* noreturn */

/* [previous][next][first][last][top][bottom][index][help] */