PR79862 check macro for type aliases that depend on <stdint.h>

Message ID 20170420130614.GA5490@redhat.com
State New
Headers show

Commit Message

Jonathan Wakely April 20, 2017, 1:06 p.m.
The <stdint.h> atomic types shouldn't be declared if the underlying
types aren't available.

	PR libstdc++/79862
	* include/std/atomic [!_GLIBCXX_USE_C99_STDINT_TR1] (atomic_int8_t)
	(atomic_uint8_t, atomic_int16_t, atomic_uint16_t, atomic_int32_t,
	(atomic_uint32_t, atomic_int64_t, atomic_uint64_t)
	(atomic_int_least8_t, atomic_uint_least8_t, atomic_int_least16_t)
	(atomic_uint_least16_t, atomic_int_least32_t, atomic_uint_least32_t)
	(atomic_int_least64_t, atomic_uint_least64_t, atomic_int_fast8_t)
	(atomic_uint_fast8_t, atomic_int_fast16_t, atomic_uint_fast16_t)
	(atomic_int_fast32_t, atomic_uint_fast32_t, atomic_int_fast64_t)
	(atomic_uint_fast64_t, atomic_intmax_t, atomic_uintmax_t): Don't
	define.

Tested x86_64-linux, committed to trunk.
commit 506f73f5ac492bc2e0745be303ffe946fe16758e
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Mar 7 11:55:38 2017 +0000

    PR79862 check macro for type aliases that depend on <stdint.h>
    
    	PR libstdc++/79862
    	* include/std/atomic [!_GLIBCXX_USE_C99_STDINT_TR1] (atomic_int8_t)
    	(atomic_uint8_t, atomic_int16_t, atomic_uint16_t, atomic_int32_t,
    	(atomic_uint32_t, atomic_int64_t, atomic_uint64_t)
    	(atomic_int_least8_t, atomic_uint_least8_t, atomic_int_least16_t)
    	(atomic_uint_least16_t, atomic_int_least32_t, atomic_uint_least32_t)
    	(atomic_int_least64_t, atomic_uint_least64_t, atomic_int_fast8_t)
    	(atomic_uint_fast8_t, atomic_int_fast16_t, atomic_uint_fast16_t)
    	(atomic_int_fast32_t, atomic_uint_fast32_t, atomic_int_fast64_t)
    	(atomic_uint_fast64_t, atomic_intmax_t, atomic_uintmax_t): Don't
    	define.

Patch

diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic
index 5b252a4..4b583c17 100644
--- a/libstdc++-v3/include/std/atomic
+++ b/libstdc++-v3/include/std/atomic
@@ -909,7 +909,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
   /// atomic_char32_t
   typedef atomic<char32_t>		atomic_char32_t;
 
-
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
   // _GLIBCXX_RESOLVE_LIB_DEFECTS
   // 2441. Exact-width atomic typedefs should be provided
 
@@ -986,6 +986,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /// atomic_uint_fast64_t
   typedef atomic<uint_fast64_t>		atomic_uint_fast64_t;
+#endif
 
 
   /// atomic_intptr_t
@@ -997,15 +998,16 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
   /// atomic_size_t
   typedef atomic<size_t>		atomic_size_t;
 
+  /// atomic_ptrdiff_t
+  typedef atomic<ptrdiff_t>		atomic_ptrdiff_t;
+
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
   /// atomic_intmax_t
   typedef atomic<intmax_t>		atomic_intmax_t;
 
   /// atomic_uintmax_t
   typedef atomic<uintmax_t>		atomic_uintmax_t;
-
-  /// atomic_ptrdiff_t
-  typedef atomic<ptrdiff_t>		atomic_ptrdiff_t;
-
+#endif
 
   // Function definitions, atomic_flag operations.
   inline bool