diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2021-01-09 14:17:32 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2021-01-09 14:18:07 -0800 |
commit | 077ffc1e416a6be980dd45979547201e572962f6 (patch) | |
tree | a5a43d4381d749b6eaf3b60ab6d788f9143935c8 /doc | |
parent | 22f880ff9b1cc1cef82a2924ab650c7c2bbbe46b (diff) | |
download | gnulib-077ffc1e416a6be980dd45979547201e572962f6.tar.gz |
snippet/_Noreturn: port to pedantic clang
Problem reported by Joe Nelson in:
https://lists.gnu.org/r/bug-gnulib/2021-01/msg00152.html
* doc/noreturn.texi: Improve.
* lib/_Noreturn.h (_Noreturn):
* m4/gnulib-common.m4 (gl_COMMON_BODY):
Do not assume _Noreturn works as-is when __STRICT_ANSI__ is
defined, unless __STDC_VERSION__ indicates C11 or later.
* lib/_Noreturn.h (_Noreturn): Fall back on __attribute__
((__noreturn__)) if Clang; this merges the
2020-08-10T23:53:13Zbruno@clisp.org patch to m4/gnulib-common.m4.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/noreturn.texi | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/doc/noreturn.texi b/doc/noreturn.texi index e119ff88a6..86bcc351e0 100644 --- a/doc/noreturn.texi +++ b/doc/noreturn.texi @@ -23,18 +23,15 @@ declared with a @code{void} return type. It helps the compiler's ability to emit sensible warnings, following data-flow analysis, to declare which functions are non-returning. +To decorate function declarations and function definitions, you can +use the @code{_Noreturn} keyword. No modules are needed, as Gnulib +arranges for @code{<config.h>} to define @code{_Noreturn} to an +appropriate replacement on platforms lacking it. + Gnulib has two modules that support such a declaration: @itemize @bullet @item -The @samp{stdnoreturn} module. It provides a way to put this -declaration at function declarations and function definitions, but not -in function pointer types. The identifier to use is @code{_Noreturn} -or @code{noreturn}; @code{_Noreturn} is to be preferred because -@code{noreturn} is a no-op on some platforms. The include file is -@code{<stdnoreturn.h>}. - -@item The @samp{noreturn} module. It provides a way to put this declaration at function declarations, at function definitions, and in function pointer types. The identifiers to use are: @@ -47,6 +44,13 @@ definitions. @end itemize @noindent The include file is @code{<noreturn.h>}. + +@item +The @samp{stdnoreturn} module. This can improve readability by +letting you use @code{noreturn} instead of @code{_Noreturn}; +unfortunately, @code{noreturn} is a no-op on some platforms even +though @code{_Noreturn} works on them. The include file is +@code{<stdnoreturn.h>}. @end itemize Which of the two modules to use? If the non-returning functions you |