public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Use stdint-wrap.h on *-*-netbsd[56]*
@ 2015-09-18 13:07 Jonathan Wakely
  2015-09-29 12:21 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Wakely @ 2015-09-18 13:07 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++

[-- Attachment #1: Type: text/plain, Size: 954 bytes --]

This patch adjust config.gcc so that it installs <stdint.h> for NetBSD
5.x and 6.x, which is necessary for the C++ library because the host
<stdint.h> has:

#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
#include <machine/int_limits.h>
#endif

#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
#include <machine/int_const.h>
#endif

This means that contrary to the C++11 standard the stdint macros are
only defined when __STDC_CONSTANT_MACROS / __STDC_LIMIT_MACROS are
defined.

I first noted the problem earlier this year and opened
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65806 

I rediscovered the problem when I broke netbsd bootstrap by including
<ext/random> during bootstrap with https://gcc.gnu.org/r227684

That header uses UINT32_C, which is not defined without this patch.

NetBSD 7.x should be OK, because it knows about C++11 (see the link in
the PR for details).

Tested x86_64-unknown-netbsd5.1, OK for trunk?



[-- Attachment #2: netbsd.patch --]
[-- Type: text/plain, Size: 817 bytes --]

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index affc5ba..9450dcb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2015-09-16  Jonathan Wakely  <jwakely@redhat.com>
+
+	* config.gcc (*-*-netbsd[5-6]*): Set use_gcc_stdint=wrap.
+
 2015-09-15  Alan Lawrence  <alan.lawrence@arm.com>
 
 	* config/aarch64/aarch64-simd.md
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 75807f5..394ded3 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -788,6 +788,14 @@ case ${target} in
       default_use_cxa_atexit=yes
       ;;
   esac
+
+  # NetBSD 5.x and 6.x provide <stdint.h> but require
+  # __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS for C++.
+  case ${target} in
+    *-*-netbsd[5-6]* | *-*-netbsdelf[5-6]*)
+      use_gcc_stdint=wrap
+      ;;
+  esac
   ;;
 *-*-openbsd*)
   tmake_file="t-openbsd"

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Use stdint-wrap.h on *-*-netbsd[56]*
  2015-09-18 13:07 [PATCH] Use stdint-wrap.h on *-*-netbsd[56]* Jonathan Wakely
@ 2015-09-29 12:21 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2015-09-29 12:21 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Jason Thorpe, Krister Walfridsson

Ping.

On 18/09/15 13:59 +0100, Jonathan Wakely wrote:
>This patch adjust config.gcc so that it installs <stdint.h> for NetBSD
>5.x and 6.x, which is necessary for the C++ library because the host
><stdint.h> has:
>
>#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
>#include <machine/int_limits.h>
>#endif
>
>#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
>#include <machine/int_const.h>
>#endif
>
>This means that contrary to the C++11 standard the stdint macros are
>only defined when __STDC_CONSTANT_MACROS / __STDC_LIMIT_MACROS are
>defined.
>
>I first noted the problem earlier this year and opened
>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65806
>
>I rediscovered the problem when I broke netbsd bootstrap by including
><ext/random> during bootstrap with https://gcc.gnu.org/r227684
>
>That header uses UINT32_C, which is not defined without this patch.
>
>NetBSD 7.x should be OK, because it knows about C++11 (see the link in
>the PR for details).
>
>Tested x86_64-unknown-netbsd5.1, OK for trunk?
>
>

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index affc5ba..9450dcb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2015-09-16  Jonathan Wakely  <jwakely@redhat.com>
+
+	* config.gcc (*-*-netbsd[5-6]*): Set use_gcc_stdint=wrap.
+
 2015-09-15  Alan Lawrence  <alan.lawrence@arm.com>

 	* config/aarch64/aarch64-simd.md
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 75807f5..394ded3 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -788,6 +788,14 @@ case ${target} in
       default_use_cxa_atexit=yes
       ;;
   esac
+
+  # NetBSD 5.x and 6.x provide <stdint.h> but require
+  # __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS for C++.
+  case ${target} in
+    *-*-netbsd[5-6]* | *-*-netbsdelf[5-6]*)
+      use_gcc_stdint=wrap
+      ;;
+  esac
   ;;
 *-*-openbsd*)
   tmake_file="t-openbsd"

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-29 11:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-18 13:07 [PATCH] Use stdint-wrap.h on *-*-netbsd[56]* Jonathan Wakely
2015-09-29 12:21 ` Jonathan Wakely

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).