]> Savannah Git Hosting - gnulib.git/commitdiff
Port _Noreturn to older Clang
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 3 Feb 2020 21:20:09 +0000 (13:20 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 4 Feb 2020 19:40:44 +0000 (11:40 -0800)
Problem reported by Jeffery Walton in:
https://lists.gnu.org/r/bug-gnulib/2020-02/msg00013.html
* lib/_Noreturn.h (_Noreturn):
* m4/gnulib-common.m4 (gl_COMMON_BODY):
Assume _Noreturn works in Clang 3.5 and later.
It is documented to work in Clang 3.5:
http://releases.llvm.org/3.5.0/tools/clang/docs/AttributeReference.html
and is not documented in Clang 3.4:
https://releases.llvm.org/3.4/tools/clang/docs/LanguageExtensions.html
Apple sets __clang_version__ to a different value, so use
__apple_build_version__ there.  See:
https://lists.gnu.org/r/bug-gnulib/2020-02/msg00017.html

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

index 4cfa7a9e3f345cce524839577999fff0aba583ed..e44dcb9a17dbd0b0e3dca9473fafa9b722e0e76b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2020-02-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Port _Noreturn to older Clang
+       Problem reported by Jeffery Walton in:
+       https://lists.gnu.org/r/bug-gnulib/2020-02/msg00013.html
+       * lib/_Noreturn.h (_Noreturn):
+       * m4/gnulib-common.m4 (gl_COMMON_BODY):
+       Assume _Noreturn works in Clang 3.5 and later.
+       It is documented to work in Clang 3.5:
+       http://releases.llvm.org/3.5.0/tools/clang/docs/AttributeReference.html
+       and is not documented in Clang 3.4:
+       https://releases.llvm.org/3.4/tools/clang/docs/LanguageExtensions.html
+       Apple sets __clang_version__ to a different value, so use
+       __apple_build_version__ there.  See:
+       https://lists.gnu.org/r/bug-gnulib/2020-02/msg00017.html
+
 2020-02-04  Pádraig Brady  <P@draigBrady.com>
 
        test-canonicalize: avoid unused function warning
index 74ee9ad414ceb5b75601eb5dd3655ebcbd82fe67..606e92f525c48e582ace06075726d7c5a4b4589f 100644 (file)
 #  define _Noreturn [[noreturn]]
 # elif ((!defined __cplusplus || defined __clang__)                     \
         && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0)  \
-            || 4 < __GNUC__ + (7 <= __GNUC_MINOR__)))
+            || 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
 #  define _Noreturn __attribute__ ((__noreturn__))
index 276ed1affa5f506408056ac10bb678628f4ad109..b4795c18aeb1beb4cf086e149920ddd349b4497d 100644 (file)
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 47
+# gnulib-common.m4 serial 48
 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -31,7 +31,10 @@ AC_DEFUN([gl_COMMON_BODY], [
 #  define _Noreturn [[noreturn]]
 # elif ((!defined __cplusplus || defined __clang__) \
         && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0)  \
-            || 4 < __GNUC__ + (7 <= __GNUC_MINOR__)))
+            || 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
 #  define _Noreturn __attribute__ ((__noreturn__))