This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[v3] Restore __STDC_*_MACROs


Hi,

noticed this nit while looking into something else... Tested x86_64-linux, committed to mainline.

Paolo.

//////////////////
2008-09-09  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/tr1_impl/cinttypes: Restore __STDC_FORMAT_MACRO after
	inclusion of <inttypes.h>.
	* include/tr1_impl/cstdint: Likewise for __STDC_LIMIT_MACROS and
	__STDC_CONSTANT_MACROS after <stdint.h>.
	* include/bits/postypes.h: Likewise.
Index: include/tr1_impl/cinttypes
===================================================================
*** include/tr1_impl/cinttypes	(revision 140172)
--- include/tr1_impl/cinttypes	(working copy)
***************
*** 36,44 ****
  
  #if _GLIBCXX_USE_C99_INTTYPES_TR1
  
! // For 8.11.1/1 (see C99, Note 184) 
! #define __STDC_FORMAT_MACROS
  #include_next <inttypes.h>
  
  namespace std
  {
--- 36,51 ----
  
  #if _GLIBCXX_USE_C99_INTTYPES_TR1
  
! // For 8.11.1/1 (see C99, Note 184)
! #ifndef __STDC_FORMAT_MACROS
! # define _UNDEF__STDC_FORMAT_MACROS
! # define __STDC_FORMAT_MACROS
! #endif
  #include_next <inttypes.h>
+ #ifdef _UNDEF__STDC_FORMAT_MACROS
+ # undef __STDC_FORMAT_MACROS
+ # undef _UNDEF__STDC_FORMAT_MACROS
+ #endif
  
  namespace std
  {
Index: include/tr1_impl/cstdint
===================================================================
*** include/tr1_impl/cstdint	(revision 140172)
--- include/tr1_impl/cstdint	(working copy)
***************
*** 38,49 ****
--- 38,59 ----
  
  // For 8.22.1/1 (see C99, Notes 219, 220, 222)
  #ifndef __STDC_LIMIT_MACROS
+ # define _UNDEF__STDC_LIMIT_MACROS
  # define __STDC_LIMIT_MACROS
  #endif
  #ifndef __STDC_CONSTANT_MACROS
+ # define _UNDEF__STDC_CONSTANT_MACROS
  # define __STDC_CONSTANT_MACROS
  #endif
  #include_next <stdint.h>
+ #ifdef _UNDEF__STDC_LIMIT_MACROS
+ # undef __STDC_LIMIT_MACROS
+ # undef _UNDEF__STDC_LIMIT_MACROS
+ #endif
+ #ifdef _UNDEF__STDC_CONSTANT_MACROS
+ # undef __STDC_CONSTANT_MACROS
+ # undef _UNDEF__STDC_CONSTANT_MACROS
+ #endif
  
  namespace std
  {
Index: include/bits/postypes.h
===================================================================
*** include/bits/postypes.h	(revision 140172)
--- include/bits/postypes.h	(working copy)
***************
*** 46,63 ****
  
  #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...
  #if (defined(_GLIBCXX_HAVE_INT64_T) && !defined(_GLIBCXX_HAVE_INT64_T_LONG) \
       && !defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG))
  #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)
--- 46,75 ----
  
  #include <cwchar> // For mbstate_t
  
! // XXX If <stdint.h> is really needed, make sure to define the macros
! // before including it, in order not to break <tr1/cstdint> (and <cstdint>
! // in C++0x).  Reconsider all this as soon as possible...
  #if (defined(_GLIBCXX_HAVE_INT64_T) && !defined(_GLIBCXX_HAVE_INT64_T_LONG) \
       && !defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG))
+ 
  #ifndef __STDC_LIMIT_MACROS
+ # define _UNDEF__STDC_LIMIT_MACROS
  # define __STDC_LIMIT_MACROS
  #endif
  #ifndef __STDC_CONSTANT_MACROS
+ # define _UNDEF__STDC_CONSTANT_MACROS
  # define __STDC_CONSTANT_MACROS
  #endif
  #include <stdint.h> // For int64_t
+ #ifdef _UNDEF__STDC_LIMIT_MACROS
+ # undef __STDC_LIMIT_MACROS
+ # undef _UNDEF__STDC_LIMIT_MACROS
+ #endif
+ #ifdef _UNDEF__STDC_CONSTANT_MACROS
+ # undef __STDC_CONSTANT_MACROS
+ # undef _UNDEF__STDC_CONSTANT_MACROS
+ #endif
+ 
  #endif
  
  _GLIBCXX_BEGIN_NAMESPACE(std)

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