[PATCH] Optionally use -mlong-double-128 by default on {powerpc{,64},s390{,x},sparc,alpha}-linux (take 3)

Jakub Jelinek jakub@redhat.com
Tue Feb 7 08:36:00 GMT 2006


On Mon, Feb 06, 2006 at 11:28:55PM -0600, Benjamin Kosnik wrote:
> 
> Here is the patch I tested with. 

Does it really work with the localefwd.h -> c++config change you made?

I know you wanted that kind of change, but when I was trying that, I ran
into a problem.
#define _GLIBCXX_LONG_DOUBLE_COMPAT 1
resp.
#undef _GLIBCXX_LONG_DOUBLE_COMPAT
comes from the config.h generated by configure.
But bits/c++config is created essentially by copying
libstdc++-v3/include/bits/c++config and appending filtered config.h to it.
So, if you want to do it this way, some Makefile.am changes will be needed
to special case this define.

I'll work on some patch for this.

> I think this looks good. I'd be up for putting it into gcc mainline and
> the branch. I'm running in to a minor snag with the abi checking, in
> that now
> 
> acosl@GLIBCXX_3.4.3
> 
> instead of 
> 
> acosl@@GLIBCXX_3.4.3
> 
> This should be fine. I can fix up the testsuites in a bit, when I get on a system where I can debug.

There are actually 2 changes to testsuite/testsuite_abi.cc that would be
desirable:
1) accept @@ -> @ symver changes (or perhaps better, @->@@ changes, from
what is stored in regenerated abi *.txt files)
2) treat *_LDBL* symvers specially, in that we put abi *.txt files with
the *_LDBL* symvers into SVN, but if the libstdc++.so being checked
doesn't have any *_LDBL* symbol versions at all, they aren't reported
as failure.

For clarity, here is distilled incremental diff against the patch I posted.

--- libstdc++-v3/include/bits/c++config	2005-12-27 17:31:47.000000000 +0100
+++ libstdc++-v3/include/bits/c++config	2006-02-07 09:15:59.000000000 +0100
@@ -1,6 +1,6 @@
 // Predefined symbols and macros -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -129,6 +129,22 @@ namespace std
 #endif
 #endif
 
+// XXX GLIBCXX_ABI Deprecated
+// Namespace associations for long double 128 mode.
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+# define _GLIBCXX_LDBL_NAMESPACE __gnu_cxx_ldbl128::
+# define _GLIBCXX_BEGIN_LDBL_NAMESPACE namespace __gnu_cxx_ldbl128 {
+# define _GLIBCXX_END_LDBL_NAMESPACE }
+  namespace __gnu_cxx_ldbl128 { }
+  using namespace __gnu_cxx_ldbl128 __attribute__((__strong__));
+#else
+# define _GLIBCXX_LDBL_NAMESPACE
+# define _GLIBCXX_BEGIN_LDBL_NAMESPACE
+# define _GLIBCXX_END_LDBL_NAMESPACE
+#endif
+_GLIBCXX_END_NAMESPACE
 
 // Allow use of "export template." This is currently not a feature
 // that g++ supports.
--- libstdc++-v3/include/bits/localefwd.h	2006-02-07 09:15:44.000000000 +0100
+++ libstdc++-v3/include/bits/localefwd.h	2006-02-07 09:15:59.000000000 +0100
@@ -49,21 +49,6 @@
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
-#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
-# define _GLIBCXX_LDBL_NAMESPACE __gnu_cxx_ldbl128::
-# define _GLIBCXX_BEGIN_LDBL_NAMESPACE namespace __gnu_cxx_ldbl128 {
-# define _GLIBCXX_END_LDBL_NAMESPACE }
-  namespace __gnu_cxx_ldbl128
-    {
-      using namespace ::std;
-    }
-  using namespace __gnu_cxx_ldbl128 __attribute__((__strong__));
-#else
-# define _GLIBCXX_LDBL_NAMESPACE
-# define _GLIBCXX_BEGIN_LDBL_NAMESPACE
-# define _GLIBCXX_END_LDBL_NAMESPACE
-#endif
-
   // 22.1.1 Locale
   class locale;
 
--- libstdc++-v3/src/locale.cc	2006-02-07 09:15:44.000000000 +0100
+++ libstdc++-v3/src/locale.cc	2006-02-07 09:15:59.000000000 +0100
@@ -41,6 +41,7 @@ namespace __gnu_internal
   static __glibcxx_mutex_define_initialized(locale_cache_mutex);
 }
 
+// XXX GLIBCXX_ABI Deprecated
 #ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
 # define _GLIBCXX_LOC_ID(mangled) extern std::locale::id mangled
 _GLIBCXX_LOC_ID (_ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE);
@@ -413,6 +414,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   {
     if (!_M_index)
       {
+	// XXX GLIBCXX_ABI Deprecated
 #ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
 	locale::id *f = 0;
 # define _GLIBCXX_SYNC_ID(facet, mangled) \
--- libstdc++-v3/testsuite/testsuite_abi.cc	2006-02-07 09:14:42.000000000 +0100
+++ libstdc++-v3/testsuite/testsuite_abi.cc	2006-02-07 09:15:59.000000000 +0100
@@ -1,6 +1,6 @@
 // -*- C++ -*-
 
-// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
 
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -186,8 +186,11 @@ check_version(symbol& test, bool added)
       known_versions.push_back("GLIBCXX_3.4.5");
       known_versions.push_back("GLIBCXX_3.4.6");
       known_versions.push_back("GLIBCXX_3.4.7");
+      known_versions.push_back("GLIBCXX_LDBL_3.4");
+      known_versions.push_back("GLIBCXX_LDBL_3.4.7");
       known_versions.push_back("CXXABI_1.3");
       known_versions.push_back("CXXABI_1.3.1");
+      known_versions.push_back("CXXABI_LDBL_1.3");
     }
   compat_list::iterator begin = known_versions.begin();
   compat_list::iterator end = known_versions.end();
@@ -223,9 +226,7 @@ check_version(symbol& test, bool added)
 	  // New version labels are ok. The rest are not.
 	  compat_list::iterator it2 = find(begin, end, test.name);
 	  if (it2 != end)
-	    {
-	      test.version_status = symbol::compatible;
-	    }
+	    test.version_status = symbol::compatible;
 	  else
 	    test.version_status = symbol::incompatible;
 	}
@@ -369,7 +370,7 @@ compare_symbols(const char* baseline_fil
 	  added_names.erase(it);
 	}
       else
-	  missing_names.push_back(what);
+	missing_names.push_back(what);
     }
 
   // Check missing names for compatibility.


	Jakub



More information about the Libstdc++ mailing list