postypes.h: Reinstate inclusion of <stdint.h>; also define the __STDC_* macros.
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 4 Aug 2008 12:05:41 +0000 (12:05 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 4 Aug 2008 12:05:41 +0000 (12:05 +0000)
2008-08-04  Paolo Carlini  <paolo.carlini@oracle.com>

* include/bits/postypes.h: Reinstate inclusion of <stdint.h>;
also define the __STDC_* macros.
(streamoff): Adjust.

* include/tr1_impl/cstdint: Check that the __STDC_* macros are
not defined before defining.

From-SVN: r138608

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/postypes.h
libstdc++-v3/include/tr1_impl/cstdint

index be834051e0df8298006e56515434ab03c5277be9..9e8a6e6700f5f51e9b0ef1ddd1c1400c0bdb3e89 100644 (file)
@@ -1,3 +1,12 @@
+2008-08-04  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * include/bits/postypes.h: Reinstate inclusion of <stdint.h>;
+       also define the __STDC_* macros.
+       (streamoff): Adjust.
+
+       * include/tr1_impl/cstdint: Check that the __STDC_* macros are
+       not defined before defining.
+
 2008-08-01  Paolo Bonzini  <bonzini@gnu.org>
            Chris Fairles  <chris.fairles@gmail.com>
 
index 5ead488fa48fb331c5391c1701b21618d250d2df..cdcafe2051f9c1c9404adf6317babde240c2a7d9 100644 (file)
 
 #include <cwchar> // For mbstate_t
 
+// XXX If <stdint.h> is really needed, make sure to define the macros,
+// in order not to break <tr1/cstdint> (and <cstdint> in C++0x).
+// Reconsider all this as soon as possible...
+#ifdef _GLIBCXX_HAVE_INT64_T
+#ifndef __STDC_LIMIT_MACROS
+# define __STDC_LIMIT_MACROS
+#endif
+#ifndef __STDC_CONSTANT_MACROS
+# define __STDC_CONSTANT_MACROS
+#endif
+#include <stdint.h> // For int64_t
+#endif
+
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
   // The types streamoff, streampos and wstreampos and the class
@@ -64,11 +77,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  was typedef long.
   */  
 #ifdef _GLIBCXX_HAVE_INT64_T
-# if (__CHAR_BIT__ * __SIZEOF_LONG__ == 64)
-  typedef long          streamoff;
-# else
-  typedef long long     streamoff;
-# endif
+  typedef int64_t       streamoff;
 #else
   typedef long long     streamoff;
 #endif
index 6df74c761cb74480d2efd3ddf0b66a6e07eceb14..93edf7c4fcdff5cf690e772f168380dd2f54d423 100644 (file)
@@ -1,6 +1,6 @@
 // TR1 cstdint -*- C++ -*-
 
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
 
 #if _GLIBCXX_USE_C99_STDINT_TR1
 
-// For 8.22.1/1 (see C99, Notes 219, 220, 222) 
-#define __STDC_LIMIT_MACROS
-#define __STDC_CONSTANT_MACROS
+// For 8.22.1/1 (see C99, Notes 219, 220, 222)
+#ifndef __STDC_LIMIT_MACROS
+# define __STDC_LIMIT_MACROS
+#endif
+#ifndef __STDC_CONSTANT_MACROS
+# define __STDC_CONSTANT_MACROS
+#endif
 #include_next <stdint.h>
 
 namespace std