This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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] fixups for traits testsuite



Adds in _GLIBCXX_USE_WCHAR_T guards for the new type_traits. In general, it's better to separate out wchar_t testing via inclusion of "wchar_t" in the file or directory name, which results in the test of wchar_t being marked as "unsupported" for targets that don't support wchar_t, instead of being #ifdefd out.


However, current locale, numerics, and tr1 traits testing do use the ifdef approach, and it seems useful to continue this approach when not dealing with explicit wchar_t specializations. I've corrected the one case where _GLIBCXX_USE_WCHAR_T was being used with the naming convention.

In addition, I am going to add in a function to the configure checks for -ffunction-sections in the hopes that this will fix the current issues with this on AIX/cygwin.

I also re-arranged the last of the requirements testscases.

I've just noticed I have the wrong dates on the ChangeLog entry. I'll fix this.

tested x86/linux

-benjamin
2007-05-16  Benjamin Kosnik  <bkoz@redhat.com>

	* acinclude.m4 (GLIBCXX_CHECK_COMPILER_FEATURES): Add a function
	to the test code compiled with -ffunction-sections -fdata-sections.
	* configure: Regenerate.

	* testsuite/22_locale/ctype/scan/wchar_t/1.cc: Remove
	_GLIBCXX_USE_WCHAR_T guards as superfluous.
	
	* testsuite/20_util/make_signed/requirements/typedefs-1.cc: Add
	_GLIBCXX_USE_WCHAR_T guards.	
	* testsuite/20_util/make_signed/requirements/typedefs-2.cc: Same.
	* testsuite/20_util/make_unsigned/requirements/typedefs-1.cc: Same.
	* testsuite/20_util/make_unsigned/requirements/typedefs-2.cc: Same.

	* testsuite/21_strings/char_traits/requirements/wchar_t/typedefs.cc: 
	Add.
	* testsuite/21_strings/char_traits/typedefs/char/1.cc: Move...
	* testsuite/21_strings/char_traits/requirements/char/typedefs.cc: 
	...here.
	* testsuite/21_strings/char_traits/typedefs: Remove.
	* testsuite/21_strings/char_traits/typedefs/char: Remove.

Index: testsuite/21_strings/char_traits/requirements/wchar_t/typedefs.cc
===================================================================
--- testsuite/21_strings/char_traits/requirements/wchar_t/typedefs.cc	(revision 0)
+++ testsuite/21_strings/char_traits/requirements/wchar_t/typedefs.cc	(revision 0)
@@ -0,0 +1,43 @@
+// dg-do compile
+// dg-options -ansi -pedantic-err
+// 2001-02-11 gdr
+// Origin: Craig Rodrigues <rodrigc@mediaone.net>
+
+// Copyright (C) 2001, 2003, 2007 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 21.1.2: char_traits typedefs
+
+#include <string>
+
+int main()
+{
+  // Check for required typedefs.
+  typedef std::char_traits<wchar_t> test_type;
+  typedef test_type::char_type char_type;
+  typedef test_type::int_type int_type;
+  typedef test_type::off_type off_type;
+  typedef test_type::pos_type pos_type;
+  typedef test_type::state_type state_type;
+
+  // 21.1.3: char_traits<wchar_t>::int_type == wint_t
+  test_type::int_type* p = 0;
+  wint_t* q __attribute__((unused)) = p;                   
+
+  return 0;
+}
Index: testsuite/21_strings/char_traits/requirements/char/typedefs.cc
===================================================================
--- testsuite/21_strings/char_traits/requirements/char/typedefs.cc	(revision 124766)
+++ testsuite/21_strings/char_traits/requirements/char/typedefs.cc	(working copy)
@@ -1,7 +1,9 @@
+// dg-do compile
+// dg-options -ansi -pedantic-err
 // 2001-02-11 gdr
 // Origin: Craig Rodrigues <rodrigc@mediaone.net>
 
-// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2003, 2007 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
@@ -25,10 +27,17 @@
 
 int main()
 {
+  // Check for required typedefs.
+  typedef std::char_traits<char> test_type;
+  typedef test_type::char_type char_type;
+  typedef test_type::int_type int_type;
+  typedef test_type::off_type off_type;
+  typedef test_type::pos_type pos_type;
+  typedef test_type::state_type state_type;
+
   // 21.1.3: char_traits<char>::int_type == int
-  // dg-options -ansi -pedantic-err
-  std::char_traits<char>::int_type* p = 0;
-  int* q __attribute__((unused)) = p;                   // dg-do compile
+  test_type::int_type* p = 0;
+  int* q __attribute__((unused)) = p;                   
 
   return 0;
 }
Index: testsuite/21_strings/char_traits/typedefs/char/1.cc
===================================================================
--- testsuite/21_strings/char_traits/typedefs/char/1.cc	(revision 124766)
+++ testsuite/21_strings/char_traits/typedefs/char/1.cc	(working copy)
@@ -1,34 +0,0 @@
-// 2001-02-11 gdr
-// Origin: Craig Rodrigues <rodrigc@mediaone.net>
-
-// Copyright (C) 2001, 2003 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-// USA.
-
-// 21.1.2: char_traits typedefs
-
-#include <string>
-
-int main()
-{
-  // 21.1.3: char_traits<char>::int_type == int
-  // dg-options -ansi -pedantic-err
-  std::char_traits<char>::int_type* p = 0;
-  int* q __attribute__((unused)) = p;                   // dg-do compile
-
-  return 0;
-}
Index: testsuite/22_locale/ctype/scan/wchar_t/1.cc
===================================================================
--- testsuite/22_locale/ctype/scan/wchar_t/1.cc	(revision 124766)
+++ testsuite/22_locale/ctype/scan/wchar_t/1.cc	(working copy)
@@ -1,6 +1,6 @@
 // 2002-05-10 ghazi
 
-// Copyright (C) 2002 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2007 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
@@ -47,7 +47,6 @@
   VERIFY(gctype.scan_not((MASK), (STRING), \
 			 (STRING) + traits_type::length(STRING)) == (EXPECTED))
 
-#ifdef _GLIBCXX_USE_WCHAR_T
 // Sanity check scan_is() and scan_not().
 void test01()
 {
@@ -341,12 +340,9 @@
   VERIFY_SCAN_NOT (std::ctype_base::upper, p2, p2);
   VERIFY_SCAN_NOT (std::ctype_base::xdigit, p2, p2);
 }
-#endif
 
 int main() 
 {
-#ifdef _GLIBCXX_USE_WCHAR_T
   test01();
-#endif
   return 0;
 }
Index: testsuite/20_util/make_signed/requirements/typedefs-1.cc
===================================================================
--- testsuite/20_util/make_signed/requirements/typedefs-1.cc	(revision 124766)
+++ testsuite/20_util/make_signed/requirements/typedefs-1.cc	(working copy)
@@ -47,8 +47,10 @@
   typedef make_signed<const char>::type  	test22_type;
   VERIFY( (is_same<test22_type, const signed char>::value) );
 
+#ifdef _GLIBCXX_USE_WCHAR_T
   typedef make_signed<volatile wchar_t>::type  	test23_type;
   VERIFY( (is_same<test23_type, volatile signed wchar_t>::value) );
+#endif
 
   typedef make_signed<test_enum>::type  	test25_type;
   VERIFY( (is_same<test25_type, int>::value) );
Index: testsuite/20_util/make_signed/requirements/typedefs-2.cc
===================================================================
--- testsuite/20_util/make_signed/requirements/typedefs-2.cc	(revision 124766)
+++ testsuite/20_util/make_signed/requirements/typedefs-2.cc	(working copy)
@@ -47,8 +47,10 @@
   typedef make_signed<const char>::type  	test22_type;
   VERIFY( (is_same<test22_type, const signed char>::value) );
 
+#ifdef _GLIBCXX_USE_WCHAR_T
   typedef make_signed<volatile wchar_t>::type  	test23_type;
   VERIFY( (is_same<test23_type, volatile signed wchar_t>::value) );
+#endif
 
   typedef make_signed<test_enum>::type  	test25_type;
   VERIFY( (is_same<test25_type, short>::value) );
Index: testsuite/20_util/make_unsigned/requirements/typedefs-1.cc
===================================================================
--- testsuite/20_util/make_unsigned/requirements/typedefs-1.cc	(revision 124766)
+++ testsuite/20_util/make_unsigned/requirements/typedefs-1.cc	(working copy)
@@ -47,8 +47,10 @@
   typedef make_unsigned<const char>::type  	test22_type;
   VERIFY( (is_same<test22_type, const unsigned char>::value) );
 
+#ifdef _GLIBCXX_USE_WCHAR_T
   typedef make_unsigned<volatile wchar_t>::type  	test23_type;
   VERIFY( (is_same<test23_type, volatile unsigned wchar_t>::value) );
+#endif
 
   typedef make_unsigned<test_enum>::type  	test25_type;
   VERIFY( (is_same<test25_type, unsigned int>::value) );
Index: testsuite/20_util/make_unsigned/requirements/typedefs-2.cc
===================================================================
--- testsuite/20_util/make_unsigned/requirements/typedefs-2.cc	(revision 124766)
+++ testsuite/20_util/make_unsigned/requirements/typedefs-2.cc	(working copy)
@@ -47,8 +47,10 @@
   typedef make_unsigned<const char>::type  	test22_type;
   VERIFY( (is_same<test22_type, const unsigned char>::value) );
 
+#ifdef _GLIBCXX_USE_WCHAR_T
   typedef make_unsigned<volatile wchar_t>::type  	test23_type;
   VERIFY( (is_same<test23_type, volatile unsigned wchar_t>::value) );
+#endif
 
   typedef make_unsigned<test_enum>::type  	test25_type;
   VERIFY( (is_same<test25_type, unsigned short>::value) );
Index: acinclude.m4
===================================================================
--- acinclude.m4	(revision 124766)
+++ acinclude.m4	(working copy)
@@ -171,7 +171,7 @@
   # Check for -ffunction-sections -fdata-sections
   AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
   CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
-  AC_TRY_COMPILE(, [int foo;], [ac_fdsections=yes], [ac_fdsections=no])
+  AC_TRY_COMPILE(, [int foo; void bar() { };], [ac_fdsections=yes], [ac_fdsections=no])
   if test "$ac_test_CXXFLAGS" = set; then
     CXXFLAGS="$ac_save_CXXFLAGS"
   else

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