Patchwork [google] Hide all uses of __float128 from Clang (issue6195066)

login
register
mail settings
Submitter Simon Baldwin
Date May 9, 2012, 3:19 p.m.
Message ID <20120509151900.495742BDDD@hpbd-ubiq34.eem.corp.google.com>
Download mbox | patch
Permalink /patch/157994/
State New
Headers show

Comments

Simon Baldwin - May 9, 2012, 3:19 p.m.
Hide all uses of __float128 from Clang.

Brackets _GLIBCXX_USE_FLOAT128 with #ifndef __clang__.  Clang does not
currently support the __float128 builtin, and so will fail to process
libstdc++ headers that use it.

Tested for full bootstrap and dejagnu testsuite.

Okay for google/integration and google/gcc-4_7-integration branches?

Thanks.


2012-05-09   Simon Baldwin  <simonb@google.com>

	* libstdc++-v3/acinclude.m4: Bracket _GLIBCXX_USE_FLOAT128
	definition with	ifndef __clang__.
	* libstdc++-v3/config.h.in: Rebuild.


--
This patch is available for review at http://codereview.appspot.com/6195066
Diego Novillo - May 9, 2012, 3:28 p.m.
On 12-05-09 08:19 , Simon Baldwin wrote:

> 2012-05-09   Simon Baldwin<simonb@google.com>
>
> 	* libstdc++-v3/acinclude.m4: Bracket _GLIBCXX_USE_FLOAT128
> 	definition with	ifndef __clang__.
> 	* libstdc++-v3/config.h.in: Rebuild.

OK.


Diego.
Ollie Wild - May 9, 2012, 3:33 p.m.
On Wed, May 9, 2012 at 8:19 AM, Simon Baldwin <simonb@google.com> wrote:
>
> Hide all uses of __float128 from Clang.
>
> Brackets _GLIBCXX_USE_FLOAT128 with #ifndef __clang__.  Clang does not
> currently support the __float128 builtin, and so will fail to process
> libstdc++ headers that use it.
>
> Tested for full bootstrap and dejagnu testsuite.
>
> Okay for google/integration and google/gcc-4_7-integration branches?

Please check this into google/gcc-4_7 as well.

Ollie
Duncan Sands - May 9, 2012, 4:08 p.m.
Hi Simon,

> Hide all uses of __float128 from Clang.
>
> Brackets _GLIBCXX_USE_FLOAT128 with #ifndef __clang__.  Clang does not
> currently support the __float128 builtin, and so will fail to process
> libstdc++ headers that use it.

if one day clang gets support for this type, won't this still turn everything
off?  Is it possible to test the compiler on some small program using
__float128, and turn off use of __float128 if the compiler barfs?

Ciao, Duncan.
Steven Bosscher - May 9, 2012, 4:12 p.m.
On Wed, May 9, 2012 at 6:08 PM, Duncan Sands <baldrick@free.fr> wrote:
> Hi Simon,
>
>> Hide all uses of __float128 from Clang.
>>
>> Brackets _GLIBCXX_USE_FLOAT128 with #ifndef __clang__.  Clang does not
>> currently support the __float128 builtin, and so will fail to process
>> libstdc++ headers that use it.
>
>
> if one day clang gets support for this type, won't this still turn
> everything
> off?  Is it possible to test the compiler on some small program using
> __float128, and turn off use of __float128 if the compiler barfs?

Does it matter? This is for Google-internal branches only.

Ciao!
Steven

Patch

Index: libstdc++-v3/config.h.in
===================================================================
--- libstdc++-v3/config.h.in	(revision 187148)
+++ libstdc++-v3/config.h.in	(working copy)
@@ -799,8 +799,11 @@ 
    this host. */
 #undef _GLIBCXX_USE_DECIMAL_FLOAT
 
-/* Define if __float128 is supported on this host. */
+/* Define if __float128 is supported on this host.
+   Hide all uses of __float128 from Clang.  Google ref b/6422845  */
+#ifndef __clang__
 #undef _GLIBCXX_USE_FLOAT128
+#endif
 
 /* Defined if gettimeofday is available. */
 #undef _GLIBCXX_USE_GETTIMEOFDAY
Index: libstdc++-v3/acinclude.m4
===================================================================
--- libstdc++-v3/acinclude.m4	(revision 187148)
+++ libstdc++-v3/acinclude.m4	(working copy)
@@ -2529,10 +2529,16 @@  int main()
 }
 EOF
 
+    AH_VERBATIM([_GLIBCXX_USE_FLOAT128,],
+                [/* Define if __float128 is supported on this host.
+   Hide all uses of __float128 from Clang.  Google ref b/6422845  */
+#ifndef __clang__
+#undef _GLIBCXX_USE_FLOAT128
+#endif])
+
     AC_MSG_CHECKING([for __float128])
     if AC_TRY_EVAL(ac_compile); then
-      AC_DEFINE(_GLIBCXX_USE_FLOAT128, 1,
-      [Define if __float128 is supported on this host.])
+      AC_DEFINE(_GLIBCXX_USE_FLOAT128, 1)
       enable_float128=yes
     else
       enable_float128=no