bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: undefined behaviour findings in bitset


From: Akim Demaille
Subject: Re: undefined behaviour findings in bitset
Date: Sun, 17 Mar 2019 19:36:09 +0100

Le 17 mars 2019 à 08:39, Akim Demaille <address@hidden> a écrit :
> 
> commit 4d9813bf6bbf6489c1de4ad9d48943b961976bce
> Author: Akim Demaille <address@hidden>
> Date:   Sun Mar 17 08:34:22 2019 +0100
> 
>    bitset, timevar: Depend on c99
> 
>    Reported by Bruno Haible.
>    * modules/bitset, modules/timevar (Depends-on): Add c99.

Since that change, Bison's CI fails on GCC 4.7.  That's because the c99 module 
also plays tricks with the C++ compiler, which is now set to use -std=gnu++11 
if supported.  But GCC 4.7 does not support [[noreturn]] yet, even in gnu++11 
mode.

I need something like the following changes.

Wouldn't it be useful to have a file that defines macros such as GL_GCC_VERSION 
(that is defined on GCC only, not clang, nor icc), GL_ICC_VERSION, etc.?  
Defined as integer versions easy to compare (say major * 1e6 + minor * 1e3 + 
patchlevel, or just major&minor if deemed sufficient).

commit 896548de03f6490b57e9aca1f3d4ac8efba0f085
Author: Akim Demaille <address@hidden>
Date:   Sun Mar 17 19:27:20 2019 +0100

    _Noreturn: GCC 4.7 does not support [[noreturn]] in C++11 mode
    
    * lib/_Noreturn.h, m4/gnulib-common.m4: Don't use [[noreturn]] before
    GCC 4.8.

diff --git a/ChangeLog b/ChangeLog
index 9ce4bf24c..4735bf65b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-03-17  Akim Demaille  <address@hidden>
+
+       _Noreturn: GCC 4.7 does not support [[noreturn]] in C++11 mode
+       * lib/_Noreturn.h, m4/gnulib-common.m4: Don't use [[noreturn]] before
+       GCC 4.8.
+
 2019-03-17  Akim Demaille  <address@hidden>
 
        bitset, timevar: Depend on c99.
diff --git a/lib/_Noreturn.h b/lib/_Noreturn.h
index 94fdfaf02..ed8f6dbbf 100644
--- a/lib/_Noreturn.h
+++ b/lib/_Noreturn.h
@@ -1,5 +1,6 @@
 #ifndef _Noreturn
-# if 201103 <= (defined __cplusplus ? __cplusplus : 0)
+# if (201103 <= (defined __cplusplus ? __cplusplus : 0) \
+      && 4 < __GNUC__ + (8 <= __GNUC_MINOR__))
 #  define _Noreturn [[noreturn]]
 # elif (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
         || 4 < __GNUC__ + (7 <= __GNUC_MINOR__))
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 7c0e3e8fa..378470a36 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 41
+# gnulib-common.m4 serial 42
 dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -17,7 +17,8 @@ AC_DEFUN([gl_COMMON_BODY], [
   AH_VERBATIM([_Noreturn],
 [/* The _Noreturn keyword of C11.  */
 #ifndef _Noreturn
-# if 201103 <= (defined __cplusplus ? __cplusplus : 0)
+# if (201103 <= (defined __cplusplus ? __cplusplus : 0) \
+      && 4 < __GNUC__ + (8 <= __GNUC_MINOR__))
 #  define _Noreturn [[noreturn]]
 # elif (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
         || 4 < __GNUC__ + (7 <= __GNUC_MINOR__))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]