This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use stdint-wrap.h on *-*-netbsd[56]*


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"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]