]> Savannah Git Hosting - gnulib.git/commitdiff
snippet/_Noreturn: work around Clang _Noreturn bug
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 20 Jan 2023 03:39:03 +0000 (19:39 -0800)
committerBruno Haible <bruno@clisp.org>
Fri, 20 Jan 2023 10:19:09 +0000 (11:19 +0100)
This is a bigger-hammer workaround for the clang _Noreturn issue
fix for dfa.c on 2023-01-01.  Unfortunately, it causes 270
-Wreturn-type and -Wsometimes-uninitialized warnings when building
bleeding-edge GNU Emacs from Git on Fedora 37 with plain
‘./configure && make’.  So the workaround is enabled only if you
compile with -D_GL_WORK_AROUND_LLVM_BUG_59792.
* lib/_Noreturn.h (_Noreturn):
* m4/gnulib-common.m4 (gl_COMMON_BODY):
and if _GL_WORK_AROUND_LLVM_BUG_59792 is defined.

ChangeLog
lib/_Noreturn.h
m4/gnulib-common.m4

index 2861780b9bef2b18877aed6b36868e7d4f807a9c..af1e559d94abef596561ee28baf502471ea8c3ab 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2023-01-19  Paul Eggert  <eggert@cs.ucla.edu>
+
+       snippet/_Noreturn: work around Clang _Noreturn bug
+       This is a bigger-hammer workaround for the clang _Noreturn issue
+       fix for dfa.c on 2023-01-01.  Unfortunately, it causes 270
+       -Wreturn-type and -Wsometimes-uninitialized warnings when building
+       bleeding-edge GNU Emacs from Git on Fedora 37 with plain
+       ‘./configure && make’.  So the workaround is enabled only if you
+       compile with -D_GL_WORK_AROUND_LLVM_BUG_59792.
+       * lib/_Noreturn.h (_Noreturn):
+       * m4/gnulib-common.m4 (gl_COMMON_BODY):
+       #define _Noreturn to be empty if it is Clang 15 or earlier,
+       and if _GL_WORK_AROUND_LLVM_BUG_59792 is defined.
+
 2023-01-17  Bruno Haible  <bruno@clisp.org>
 
        execute tests: Avoid test failure with GNU make 4.4.
index fa15b1b25e8ffa2b201f4bf4299c589bcacce84d..6ecea98b54abf7c9f07dddc206527d83bfd77f20 100644 (file)
        AIX system header files and several gnulib header files use precisely
        this syntax with 'extern'.  */
 #  define _Noreturn [[noreturn]]
+# elif (defined __clang__ && __clang_major__ < 16 \
+        && defined _GL_WORK_AROUND_LLVM_BUG_59792)
+   /* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around
+      that rare LLVM bug, though you may get many false-alarm warnings.  */
+#  define _Noreturn
 # elif ((!defined __cplusplus || defined __clang__) \
         && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
             || (!defined __STRICT_ANSI__ \
index fb7fed41f86eba882ea930094ee009f7dde6ec1e..35a623d8a4f76b73bea6795b80c480098f1beccc 100644 (file)
@@ -38,6 +38,11 @@ AC_DEFUN([gl_COMMON_BODY], [
        AIX system header files and several gnulib header files use precisely
        this syntax with 'extern'.  */
 #  define _Noreturn [[noreturn]]
+# elif (defined __clang__ && __clang_major__ < 16 \
+        && defined _GL_WORK_AROUND_LLVM_BUG_59792)
+   /* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around
+      that rare LLVM bug, though you may get many false-alarm warnings.  */
+#  define _Noreturn
 # elif ((!defined __cplusplus || defined __clang__) \
         && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
             || (!defined __STRICT_ANSI__ \