+2021-01-09 Paul Eggert <eggert@cs.ucla.edu>
+
+ 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.
+
2021-01-09 Darshit Shah <darnir@gnu.org>
Allow setting CVS username for gnu-web-doc-update.
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
@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
AIX system header files and several gnulib header files use precisely
this syntax with 'extern'. */
# define _Noreturn [[noreturn]]
-# elif ((!defined __cplusplus || defined __clang__) \
- && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
- || 4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
- || (defined __apple_build_version__ \
- ? 6000000 <= __apple_build_version__ \
- : 3 < __clang_major__ + (5 <= __clang_minor__))))
+# elif ((!defined __cplusplus || defined __clang__) \
+ && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
+ || (!defined __STRICT_ANSI__ \
+ && (__4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
+ || (defined __apple_build_version__ \
+ ? 6000000 <= __apple_build_version__ \
+ : 3 < __clang_major__ + (5 <= __clang_minor__))))))
/* _Noreturn works as-is. */
-# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C
+# elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \
+ || 0x5110 <= __SUNPRO_C)
# define _Noreturn __attribute__ ((__noreturn__))
# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
# define _Noreturn __declspec (noreturn)
this syntax with 'extern'. */
# define _Noreturn [[noreturn]]
# elif ((!defined __cplusplus || defined __clang__) \
- && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
- || _GL_GNUC_PREREQ (4, 7) \
- || (defined __apple_build_version__ \
- ? 6000000 <= __apple_build_version__ \
- : 3 < __clang_major__ + (5 <= __clang_minor__))))
+ && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
+ || (!defined __STRICT_ANSI__ \
+ && (_GL_GNUC_PREREQ (4, 7) \
+ || (defined __apple_build_version__ \
+ ? 6000000 <= __apple_build_version__ \
+ : 3 < __clang_major__ + (5 <= __clang_minor__))))))
/* _Noreturn works as-is. */
# elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C
# define _Noreturn __attribute__ ((__noreturn__))