bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Akim Demaille <akim@lrde.epita.fr>
To: Bruno Haible <bruno@clisp.org>
Cc: bug-gnulib@gnu.org
Subject: Re: undefined behaviour findings in bitset
Date: Sun, 17 Mar 2019 19:36:09 +0100	[thread overview]
Message-ID: <C844D129-E52A-4452-8795-8FC8D80DB4B5@lrde.epita.fr> (raw)
In-Reply-To: <952453D5-A0AA-4057-83C0-46A300F0872B@lrde.epita.fr>

Le 17 mars 2019 à 08:39, Akim Demaille <akim@lrde.epita.fr> a écrit :
> 
> commit 4d9813bf6bbf6489c1de4ad9d48943b961976bce
> Author: Akim Demaille <akim.demaille@gmail.com>
> 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 <akim.demaille@gmail.com>
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  <akim@lrde.epita.fr>
+
+	_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  <akim@lrde.epita.fr>
 
 	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	other threads:[~2019-03-17 18:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-09 19:33 undefined behaviour findings Bruno Haible
2019-03-09 19:37 ` undefined behaviour findings in bitset Bruno Haible
2019-03-16 16:38   ` Akim Demaille
2019-03-16 16:42     ` Akim Demaille
2019-03-16 19:53     ` Bruno Haible
2019-03-17  7:39       ` Akim Demaille
2019-03-17 18:36         ` Akim Demaille [this message]
2019-03-17 18:56           ` Paul Eggert
2019-03-17 19:27           ` Bruno Haible
2019-03-18  8:16             ` Akim Demaille
2019-03-18 21:03               ` Bruno Haible
2019-03-19  6:07                 ` Akim Demaille
2019-03-22 16:00                   ` Akim Demaille
2019-03-23 18:54                     ` Bruno Haible
2019-03-20  3:39               ` Bruno Haible
2019-03-20 17:04                 ` Akim Demaille
2019-03-09 21:22 ` undefined behaviour findings Bruno Haible

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C844D129-E52A-4452-8795-8FC8D80DB4B5@lrde.epita.fr \
    --to=akim@lrde.epita.fr \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).