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] libstdc++/65473 Make <ciso646> define libstdc++ version macros.


On 03/09/15 13:22 -0600, Martin Sebor wrote:
On 09/03/2015 04:58 AM, Jonathan Wakely wrote:
This change would allow including <ciso646> to be used to check for
__GLIBCXX__ and detect whether youre using libstdc++ or not. Howard
Hinnant recommends including that header for libc++ because it has no
other effects in C++.

We could make every <cxxx> header include <bits/c++config.h> so that
any of them can be used, but I can't be bothered doing that change!
This makes it work for the one header that is recommended to be used,
but of course that doesn't help people using older versions of
libstdc++, who still need to include some other header.

Is this worth doing?

I'd say it's worth doing consistently, in every header. Users are
told by others (e.g., on various discussion forums) to expect to
be able to check what C++ library implementation they're using by
including any C++ standard header and testing the known version
macros.

OK, here's a patch to add <bits/c++config.h> to all the <cxxx> headers
that don't have it.

Tested powerpc64le-linux, committed to trunk.

I must admit I don't understand why many of the <cxxx> headers
include the <xxx.h> header and <bits/c++config.h> outside the include
guard ... AFAIK it's only needed for <assert.h>, and will lead to
<cxxx> headers being unnecessarily re-opened if included twice, but
I'm not going to change that.


<cuchar> <stdin>:1:18: fatal error: cuchar: No such file or directory
compilation terminated.
0

Ed sent a patch to add <cuchar> which I'm going to tidy up and commit.

commit a4a655dacdcfadfac3f90777e574e14acfdbc973
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Sep 4 10:02:43 2015 +0100

    Make all <cxxx> headers include <bits/c++config.h>
    
    	PR libstdc++/65473
    	* include/c/cassert: Include <bits/c++config.h>.
    	* include/c/cerrno: Likewise.
    	* include/c/cfloat: Likewise.
    	* include/c/ciso646: Likewise.
    	* include/c/climits: Likewise.
    	* include/c_global/cassert: Likewise.
    	* include/c_global/cerrno: Likewise.
    	* include/c_global/cfloat: Likewise.
    	* include/c_global/ciso646: Likewise.
    	* include/c_global/climits: Likewise.
    	* include/c_std/cassert: Likewise.
    	* include/c_std/cerrno: Likewise.
    	* include/c_std/cfloat: Likewise.
    	* include/c_std/ciso646: Likewise.
    	* include/c_std/climits: Likewise.

diff --git a/libstdc++-v3/include/c/cassert b/libstdc++-v3/include/c/cassert
index 46e4172..3965d16 100644
--- a/libstdc++-v3/include/c/cassert
+++ b/libstdc++-v3/include/c/cassert
@@ -30,4 +30,5 @@
 
 #pragma GCC system_header
 
+#include <bits/c++config.h>
 #include_next <assert.h>
diff --git a/libstdc++-v3/include/c/cerrno b/libstdc++-v3/include/c/cerrno
index 1d56cb4..6ea1d4c 100644
--- a/libstdc++-v3/include/c/cerrno
+++ b/libstdc++-v3/include/c/cerrno
@@ -40,6 +40,7 @@
 
 #pragma GCC system_header
 
+#include <bits/c++config.h>
 #include_next <errno.h>
 
 // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
diff --git a/libstdc++-v3/include/c/cfloat b/libstdc++-v3/include/c/cfloat
index 25cfa64..282eb31 100644
--- a/libstdc++-v3/include/c/cfloat
+++ b/libstdc++-v3/include/c/cfloat
@@ -31,6 +31,7 @@
 
 #pragma GCC system_header
 
+#include <bits/c++config.h>
 #include_next <float.h>
 
 #endif
diff --git a/libstdc++-v3/include/c/ciso646 b/libstdc++-v3/include/c/ciso646
index 125f166..6eca274 100644
--- a/libstdc++-v3/include/c/ciso646
+++ b/libstdc++-v3/include/c/ciso646
@@ -27,6 +27,12 @@
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c iso646.h,
- *  and its contents are (mostly) the same as that header, but are all
- *  contained in the namespace @c std.
+ *  which is empty in C++.
  */
+#ifndef _GLIBCXX_CISO646
+#define _GLIBCXX_CISO646
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#endif
diff --git a/libstdc++-v3/include/c/climits b/libstdc++-v3/include/c/climits
index f8b19d5..5333af9 100644
--- a/libstdc++-v3/include/c/climits
+++ b/libstdc++-v3/include/c/climits
@@ -31,6 +31,7 @@
 
 #pragma GCC system_header
 
+#include <bits/c++config.h>
 #include_next <limits.h>
 
 #endif
diff --git a/libstdc++-v3/include/c_global/cassert b/libstdc++-v3/include/c_global/cassert
index e555a38..f404560 100644
--- a/libstdc++-v3/include/c_global/cassert
+++ b/libstdc++-v3/include/c_global/cassert
@@ -40,4 +40,5 @@
 
 #pragma GCC system_header
 
+#include <bits/c++config.h>
 #include <assert.h>
diff --git a/libstdc++-v3/include/c_global/cerrno b/libstdc++-v3/include/c_global/cerrno
index 7060b1e..9f173c5 100644
--- a/libstdc++-v3/include/c_global/cerrno
+++ b/libstdc++-v3/include/c_global/cerrno
@@ -38,6 +38,7 @@
 
 #pragma GCC system_header
 
+#include <bits/c++config.h>
 #include <errno.h>
 
 #ifndef _GLIBCXX_CERRNO
diff --git a/libstdc++-v3/include/c_global/cfloat b/libstdc++-v3/include/c_global/cfloat
index 2c4ae28..50f7d3d 100644
--- a/libstdc++-v3/include/c_global/cfloat
+++ b/libstdc++-v3/include/c_global/cfloat
@@ -38,6 +38,7 @@
 
 #pragma GCC system_header
 
+#include <bits/c++config.h>
 #include <float.h>
 
 #ifndef _GLIBCXX_CFLOAT
diff --git a/libstdc++-v3/include/c_global/ciso646 b/libstdc++-v3/include/c_global/ciso646
index 818db67..93fded4 100644
--- a/libstdc++-v3/include/c_global/ciso646
+++ b/libstdc++-v3/include/c_global/ciso646
@@ -27,7 +27,12 @@
  *  in your programs, rather than any of the @a *.h implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c iso646.h,
- *  and its contents are (mostly) the same as that header, but are all
- *  contained in the namespace @c std (except for names which are defined
- *  as macros in C).
+ *  which is empty in C++.
  */
+#ifndef _GLIBCXX_CISO646
+#define _GLIBCXX_CISO646
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#endif
diff --git a/libstdc++-v3/include/c_global/climits b/libstdc++-v3/include/c_global/climits
index e3da66c..d6e7994 100644
--- a/libstdc++-v3/include/c_global/climits
+++ b/libstdc++-v3/include/c_global/climits
@@ -38,6 +38,7 @@
 
 #pragma GCC system_header
 
+#include <bits/c++config.h>
 #include <limits.h>
 
 #ifndef _GLIBCXX_CLIMITS
diff --git a/libstdc++-v3/include/c_std/cassert b/libstdc++-v3/include/c_std/cassert
index ea6daea..641b03a 100644
--- a/libstdc++-v3/include/c_std/cassert
+++ b/libstdc++-v3/include/c_std/cassert
@@ -40,4 +40,5 @@
 
 #pragma GCC system_header
 
+#include <bits/c++config.h>
 #include <assert.h>
diff --git a/libstdc++-v3/include/c_std/cerrno b/libstdc++-v3/include/c_std/cerrno
index 06618b9..ef298fa 100644
--- a/libstdc++-v3/include/c_std/cerrno
+++ b/libstdc++-v3/include/c_std/cerrno
@@ -41,6 +41,7 @@
 
 #pragma GCC system_header
 
+#include <bits/c++config.h>
 #include <errno.h>
 
 // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
diff --git a/libstdc++-v3/include/c_std/cfloat b/libstdc++-v3/include/c_std/cfloat
index d730af9..01f1724 100644
--- a/libstdc++-v3/include/c_std/cfloat
+++ b/libstdc++-v3/include/c_std/cfloat
@@ -41,6 +41,7 @@
 
 #pragma GCC system_header
 
+#include <bits/c++config.h>
 #include <float.h>
 
 #endif
diff --git a/libstdc++-v3/include/c_std/ciso646 b/libstdc++-v3/include/c_std/ciso646
index 08cdf24..7829d72 100644
--- a/libstdc++-v3/include/c_std/ciso646
+++ b/libstdc++-v3/include/c_std/ciso646
@@ -27,7 +27,12 @@
  *  in your programs, rather than any of the @a *.h implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c iso646.h,
- *  and its contents are (mostly) the same as that header, but are all
- *  contained in the namespace @c std (except for names which are defined
- *  as macros in C).
+ *  which is empty in C++.
  */
+#ifndef _GLIBCXX_CISO646
+#define _GLIBCXX_CISO646
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#endif
diff --git a/libstdc++-v3/include/c_std/climits b/libstdc++-v3/include/c_std/climits
index 348d4c3..bffa892 100644
--- a/libstdc++-v3/include/c_std/climits
+++ b/libstdc++-v3/include/c_std/climits
@@ -41,6 +41,7 @@
 
 #pragma GCC system_header
 
+#include <bits/c++config.h>
 #include <limits.h>
 
 #endif

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