]> 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)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 20 Jan 2023 09:15:52 +0000 (01:15 -0800)
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.

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

index ddd9e2b1aaae4ccfc93234248b308b3b3ddf8650..5d0c8f7cd7c12a52f4813b870bb7d250b9e4a0c7 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-19  Bruno Haible  <bruno@clisp.org>
 
        Fix warnings for functions introduced in Android API level 34.
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 2db3376b01e00fd8944c0b7cd2c9d8f4093de52b..fa814222ce88e7644190e05e2eb10ce43acac4c4 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__ \