diff mbox

[Bug,bootstrap/51705,4.7,Regression] FreeBSD uses unsupported C++11 features when __cplusplus == 201103L

Message ID 4F0D9D18.6060703@gnu.org
State New
Headers show

Commit Message

Bruce Korb Jan. 11, 2012, 2:30 p.m. UTC
To eliminate any possible ambiguity, the patch is "approved"

On 01/10/12 23:49, andreast at gcc dot gnu.org wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51705
>
> Andreas Tobler<andreast at gcc dot gnu.org>  changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>               Status|NEW                         |ASSIGNED
>
> --- Comment #46 from Andreas Tobler<andreast at gcc dot gnu.org>  2012-01-11 07:49:41 UTC ---
> I'm going to apply the patch from comment #45 this evening.
>
> Bootstraped several times, make check in fixincludes successful.
>
> This is the CL I prepared:
>
> 2012-01-11  Bruce Korb<bkorb@gnu.org>
>          Steven G. Kargl<kargl@gcc.gnu.org>
>          Andreas Tobler<andreast@fgznet.ch>
>
>      PR bootstrap/57105
>      PR preprocessor/51776
>      * inclhack.def (cdef_cplusplus): Add a replacement for [[noreturn]].
>      * fixincl.x: Regenerate.
>      * tests/base/sys/cdefs.h: Update.
>
>      * genfixes: Remove the 'Ver.' from the version check.
>
diff mbox

Patch

Index: inclhack.def
===================================================================
--- inclhack.def	(revision 183089)
+++ inclhack.def	(working copy)
@@ -20,6 +20,7 @@ 
  FIXINC_DEBUG = yes;
  #endif

+
  /* On AIX when _LARGE_FILES is defined stdio.h defines fopen to
   * fopen64 etc. and this causes problems when building with g++
   * because cstdio udefs everything from stdio.h, leaving us with
@@ -1028,6 +1029,22 @@ 
      test_text = '#define  vfscanf	__svfscanf';
  };

+/*
+ * 'g++ -std=c++11' defines __cplusplus to 201103L, which suggests
+ * that it conforms to ISO/IEC 14882:2011.  Until G++ fully conforms,
+ * it should not set __cplusplus to that value.  It currently does
+ * not support the [[noreturn]] procedure attribute.
+ * When it does, this hack should be removed.
+ * SEE:  gcc.gnu.org/bugzilla/show_bug.cgi?id=51776
+ */
+fix = {
+    hackname  = cdef_cplusplus;
+    files     = sys/cdefs.h;
+    select    = '\[\[noreturn\]\]';
+    c_fix     = format;
+    c_fix_arg = '__attribute__((__noreturn__))';
+    test_text = "#define _Noreturn	[[noreturn]]";
+};

  /*
   *  Fix various macros used to define ioctl numbers.
Index: tests/base/sys/cdefs.h
===================================================================
--- tests/base/sys/cdefs.h	(revision 183089)
+++ tests/base/sys/cdefs.h	(working copy)
@@ -9,6 +9,11 @@ 



+#if defined( CDEF_CPLUSPLUS_CHECK )
+#define _Noreturn	__attribute__((__noreturn__))
+#endif  /* CDEF_CPLUSPLUS_CHECK */
+
+
  #if defined( FREEBSD_GCC3_BREAKAGE_CHECK )
  #if __GNUC__ == 2 && __GNUC_MINOR__ >= 7
  #endif  /* FREEBSD_GCC3_BREAKAGE_CHECK */
Index: genfixes
===================================================================
--- genfixes	(revision 183089)
+++ genfixes	(working copy)
@@ -62,7 +62,7 @@ 
  AG="autogen $AG"
  set -e

-if [ -z "`${AG} -v | fgrep 'Ver. 5.'`" ]
+if [ -z "`${AG} -v | fgrep ' 5.'`" ]
  then
    echo "AutoGen appears to be out of date or not correctly installed."
    echo "Please download and install:"