This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] Fix the _GLIBCXX_ASSERT lossage
- From: Paolo Carlini <pcarlini at suse dot de>
- To: "'gcc-patches at gcc dot gnu dot org'" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 05 Mar 2004 00:33:43 +0100
- Subject: [v3] Fix the _GLIBCXX_ASSERT lossage
Hi,
tested x86-linux.
Paolo.
///////////////
2004-03-04 Paolo Carlini <pcarlini@suse.de>
* scripts/testsuite_flags.in: Add "-D_GLIBCXX_ASSERT" to
CXXFLAGS_save.
* testsuite/lib/libstdc++.exp: Don't add it conditionally to
DEFAULT_CXXFLAGS.
* testsuite/18_support/numeric_limits.cc: Remove "-D_GLIBCXX_ASSERT"
from the dg-options.
* testsuite/23_containers/vector/invalidation/1.cc: Likewise.
* testsuite/23_containers/vector/invalidation/2.cc: Likewise.
* testsuite/23_containers/vector/invalidation/3.cc: Likewise.
* testsuite/23_containers/vector/invalidation/4.cc: Likewise.
* testsuite/23_containers/vector/resize/1.cc: Likewise.
* testsuite/26_numerics/complex_value.cc: Likewise.
* testsuite/27_io/ios_base/storage/1.cc: Likewise.
* testsuite/27_io/ios_base/storage/2.cc: Likewise.
* testsuite/27_io/ios_base/storage/3.cc: Likewise.
* testsuite/27_io/manipulators/standard/char/2.cc: Likewise.
* testsuite/27_io/objects/char/5.cc: Likewise.
* testsuite/27_io/objects/wchar_t/5.cc: Likewise.
* testsuite/backward/11460.cc: Likewise.
* testsuite/thread/pthread7-rope.cc: Likewise.
* testsuite/21_strings/basic_string/compare/char/1.cc: Add
missing test variable.
* testsuite/21_strings/basic_string/compare/wchar_t/1.cc: Add
missing test variable.
diff -urN libstdc++-v3-orig/scripts/testsuite_flags.in libstdc++-v3/scripts/testsuite_flags.in
--- libstdc++-v3-orig/scripts/testsuite_flags.in 2003-12-22 21:09:22.000000000 +0100
+++ libstdc++-v3/scripts/testsuite_flags.in 2004-03-04 20:34:19.000000000 +0100
@@ -47,7 +47,7 @@
echo ${CXX}
;;
--cxxflags)
- CXXFLAGS_save="-g -O2"
+ CXXFLAGS_save="-g -O2 -D_GLIBCXX_ASSERT"
CXXFLAGS_config='@SECTION_FLAGS@ @SECTION_LDFLAGS@ -fmessage-length=0
@EXTRA_CXX_FLAGS@ -DLOCALEDIR="@glibcxx_localedir@" '
echo ${CXXFLAGS_save} ${CXXFLAGS_config}
diff -urN libstdc++-v3-orig/testsuite/18_support/numeric_limits.cc libstdc++-v3/testsuite/18_support/numeric_limits.cc
--- libstdc++-v3-orig/testsuite/18_support/numeric_limits.cc 2003-12-22 22:05:21.000000000 +0100
+++ libstdc++-v3/testsuite/18_support/numeric_limits.cc 2004-03-04 20:31:39.000000000 +0100
@@ -1,8 +1,8 @@
-// { dg-options "-D_GLIBCXX_ASSERT -mieee" { target alpha*-*-* } }
+// { dg-options "-mieee" { target alpha*-*-* } }
// 1999-08-23 bkoz
-// Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation
+// Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation
//
// 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
diff -urN libstdc++-v3-orig/testsuite/21_strings/basic_string/compare/char/1.cc libstdc++-v3/testsuite/21_strings/basic_string/compare/char/1.cc
--- libstdc++-v3-orig/testsuite/21_strings/basic_string/compare/char/1.cc 2003-07-28 19:12:09.000000000 +0200
+++ libstdc++-v3/testsuite/21_strings/basic_string/compare/char/1.cc 2004-03-04 21:12:50.000000000 +0100
@@ -1,6 +1,6 @@
// 980930 bkoz work with libstdc++v3
-// Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
+// Copyright (C) 1998, 1999, 2003, 2004 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
@@ -41,6 +41,7 @@
int
test_value(int result, want_value expected)
{
+ bool test __attribute__((unused)) = true;
bool pass = false;
switch (expected) {
diff -urN libstdc++-v3-orig/testsuite/21_strings/basic_string/compare/wchar_t/1.cc libstdc++-v3/testsuite/21_strings/basic_string/compare/wchar_t/1.cc
--- libstdc++-v3-orig/testsuite/21_strings/basic_string/compare/wchar_t/1.cc 2003-07-28 19:12:09.000000000 +0200
+++ libstdc++-v3/testsuite/21_strings/basic_string/compare/wchar_t/1.cc 2004-03-04 21:13:09.000000000 +0100
@@ -1,6 +1,6 @@
// 980930 bkoz work with libstdc++v3
-// Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
+// Copyright (C) 1998, 1999, 2003, 2004 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
@@ -41,6 +41,7 @@
int
test_value(int result, want_value expected)
{
+ bool test __attribute__((unused)) = true;
bool pass = false;
switch (expected) {
diff -urN libstdc++-v3-orig/testsuite/23_containers/vector/invalidation/1.cc libstdc++-v3/testsuite/23_containers/vector/invalidation/1.cc
--- libstdc++-v3-orig/testsuite/23_containers/vector/invalidation/1.cc 2004-03-04 19:58:38.000000000 +0100
+++ libstdc++-v3/testsuite/23_containers/vector/invalidation/1.cc 2004-03-04 20:30:32.000000000 +0100
@@ -1,6 +1,6 @@
// Vector iterator invalidation tests
-// Copyright (C) 2003 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004 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
@@ -19,7 +19,7 @@
// USA.
// We need to be pedantic about reallocations for this testcase to be correct.
-// { dg-options "-D_GLIBCXX_ASSERT -D_GLIBCXX_DEBUG_PEDANTIC" }
+// { dg-options "-D_GLIBCXX_DEBUG_PEDANTIC" }
#ifndef _GLIBCXX_DEBUG_PEDANTIC
# define _GLIBCXX_DEBUG_PEDANTIC 1
diff -urN libstdc++-v3-orig/testsuite/23_containers/vector/invalidation/2.cc libstdc++-v3/testsuite/23_containers/vector/invalidation/2.cc
--- libstdc++-v3-orig/testsuite/23_containers/vector/invalidation/2.cc 2004-03-04 19:58:38.000000000 +0100
+++ libstdc++-v3/testsuite/23_containers/vector/invalidation/2.cc 2004-03-04 20:30:40.000000000 +0100
@@ -1,6 +1,6 @@
// Vector iterator invalidation tests
-// Copyright (C) 2003 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004 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
@@ -19,7 +19,7 @@
// USA.
// We need to be pedantic about reallocations for this testcase to be correct.
-// { dg-options "-D_GLIBCXX_ASSERT -D_GLIBCXX_DEBUG_PEDANTIC" }
+// { dg-options "-D_GLIBCXX_DEBUG_PEDANTIC" }
#ifndef _GLIBCXX_DEBUG_PEDANTIC
# define _GLIBCXX_DEBUG_PEDANTIC 1
diff -urN libstdc++-v3-orig/testsuite/23_containers/vector/invalidation/3.cc libstdc++-v3/testsuite/23_containers/vector/invalidation/3.cc
--- libstdc++-v3-orig/testsuite/23_containers/vector/invalidation/3.cc 2004-03-04 19:58:38.000000000 +0100
+++ libstdc++-v3/testsuite/23_containers/vector/invalidation/3.cc 2004-03-04 20:30:47.000000000 +0100
@@ -1,6 +1,6 @@
// Vector iterator invalidation tests
-// Copyright (C) 2003 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004 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
@@ -19,7 +19,7 @@
// USA.
// We need to be pedantic about reallocations for this testcase to be correct.
-// { dg-options "-D_GLIBCXX_ASSERT -D_GLIBCXX_DEBUG_PEDANTIC" }
+// { dg-options "-D_GLIBCXX_DEBUG_PEDANTIC" }
#ifndef _GLIBCXX_DEBUG_PEDANTIC
# define _GLIBCXX_DEBUG_PEDANTIC 1
diff -urN libstdc++-v3-orig/testsuite/23_containers/vector/invalidation/4.cc libstdc++-v3/testsuite/23_containers/vector/invalidation/4.cc
--- libstdc++-v3-orig/testsuite/23_containers/vector/invalidation/4.cc 2004-03-04 19:58:38.000000000 +0100
+++ libstdc++-v3/testsuite/23_containers/vector/invalidation/4.cc 2004-03-04 20:30:53.000000000 +0100
@@ -1,6 +1,6 @@
// Vector iterator invalidation tests
-// Copyright (C) 2003 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004 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
@@ -19,7 +19,7 @@
// USA.
// We need to be pedantic about reallocations for this testcase to be correct.
-// { dg-options "-D_GLIBCXX_ASSERT -D_GLIBCXX_DEBUG_PEDANTIC" }
+// { dg-options "-D_GLIBCXX_DEBUG_PEDANTIC" }
#ifndef _GLIBCXX_DEBUG_PEDANTIC
# define _GLIBCXX_DEBUG_PEDANTIC 1
diff -urN libstdc++-v3-orig/testsuite/23_containers/vector/resize/1.cc libstdc++-v3/testsuite/23_containers/vector/resize/1.cc
--- libstdc++-v3-orig/testsuite/23_containers/vector/resize/1.cc 2004-03-04 19:58:38.000000000 +0100
+++ libstdc++-v3/testsuite/23_containers/vector/resize/1.cc 2004-03-04 20:31:06.000000000 +0100
@@ -24,7 +24,7 @@
// XXX This test will not work for irix6 because of bug(s) in libc malloc
// XXX for very large allocations. However -lmalloc seems to work.
// See http://gcc.gnu.org/ml/libstdc++/2002-12/msg00131.html
-// { dg-options "-D_GLIBCXX_ASSERT -lmalloc" { target mips*-*-irix6* } }
+// { dg-options "-lmalloc" { target mips*-*-irix6* } }
#include <vector>
#include <stdexcept>
diff -urN libstdc++-v3-orig/testsuite/26_numerics/complex_value.cc libstdc++-v3/testsuite/26_numerics/complex_value.cc
--- libstdc++-v3-orig/testsuite/26_numerics/complex_value.cc 2003-12-22 22:05:21.000000000 +0100
+++ libstdc++-v3/testsuite/26_numerics/complex_value.cc 2004-03-04 20:30:06.000000000 +0100
@@ -1,8 +1,8 @@
-// { dg-options "-D_GLIBCXX_ASSERT -O0" }
+// { dg-options "-O0" }
// 2000-11-20
// Benjamin Kosnik bkoz@redhat.com
-// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2003, 2004 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
diff -urN libstdc++-v3-orig/testsuite/27_io/ios_base/storage/1.cc libstdc++-v3/testsuite/27_io/ios_base/storage/1.cc
--- libstdc++-v3-orig/testsuite/27_io/ios_base/storage/1.cc 2003-12-22 22:05:22.000000000 +0100
+++ libstdc++-v3/testsuite/27_io/ios_base/storage/1.cc 2004-03-04 20:29:25.000000000 +0100
@@ -1,6 +1,6 @@
// 2000-12-19 bkoz
-// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+// Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation
//
// 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
@@ -24,7 +24,7 @@
// XXX bug(s) in libc malloc for very large allocations. However
// XXX -lmalloc seems to work.
// See http://gcc.gnu.org/ml/gcc/2002-05/msg01012.html
-// { dg-options "-D_GLIBCXX_ASSERT -lmalloc" { target mips*-*-irix6* } }
+// { dg-options "-lmalloc" { target mips*-*-irix6* } }
#include <sstream>
#include <iostream>
diff -urN libstdc++-v3-orig/testsuite/27_io/ios_base/storage/2.cc libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc
--- libstdc++-v3-orig/testsuite/27_io/ios_base/storage/2.cc 2003-12-22 22:05:22.000000000 +0100
+++ libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc 2004-03-04 20:29:33.000000000 +0100
@@ -1,6 +1,6 @@
// 2000-12-19 bkoz
-// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+// Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation
//
// 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
@@ -24,7 +24,7 @@
// XXX bug(s) in libc malloc for very large allocations. However
// XXX -lmalloc seems to work.
// See http://gcc.gnu.org/ml/gcc/2002-05/msg01012.html
-// { dg-options "-D_GLIBCXX_ASSERT -lmalloc" { target mips*-*-irix6* } }
+// { dg-options "-lmalloc" { target mips*-*-irix6* } }
#include <sstream>
#include <iostream>
diff -urN libstdc++-v3-orig/testsuite/27_io/ios_base/storage/3.cc libstdc++-v3/testsuite/27_io/ios_base/storage/3.cc
--- libstdc++-v3-orig/testsuite/27_io/ios_base/storage/3.cc 2003-12-22 22:05:22.000000000 +0100
+++ libstdc++-v3/testsuite/27_io/ios_base/storage/3.cc 2004-03-04 20:29:41.000000000 +0100
@@ -1,6 +1,6 @@
// 2000-12-19 bkoz
-// Copyright (C) 2000, 2002, 2003 Free Software Foundation
+// Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation
//
// 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
@@ -24,7 +24,7 @@
// XXX bug(s) in libc malloc for very large allocations. However
// XXX -lmalloc seems to work.
// See http://gcc.gnu.org/ml/gcc/2002-05/msg01012.html
-// { dg-options "-D_GLIBCXX_ASSERT -lmalloc" { target mips*-*-irix6* } }
+// { dg-options "-lmalloc" { target mips*-*-irix6* } }
#include <sstream>
#include <iostream>
diff -urN libstdc++-v3-orig/testsuite/27_io/manipulators/standard/char/2.cc libstdc++-v3/testsuite/27_io/manipulators/standard/char/2.cc
--- libstdc++-v3-orig/testsuite/27_io/manipulators/standard/char/2.cc 2003-12-22 22:05:22.000000000 +0100
+++ libstdc++-v3/testsuite/27_io/manipulators/standard/char/2.cc 2004-03-04 20:29:03.000000000 +0100
@@ -1,6 +1,6 @@
-// { dg-options "-D_GLIBCXX_ASSERT -fno-implicit-templates" }
+// { dg-options "-fno-implicit-templates" }
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2004 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
diff -urN libstdc++-v3-orig/testsuite/27_io/objects/char/5.cc libstdc++-v3/testsuite/27_io/objects/char/5.cc
--- libstdc++-v3-orig/testsuite/27_io/objects/char/5.cc 2003-12-22 21:09:22.000000000 +0100
+++ libstdc++-v3/testsuite/27_io/objects/char/5.cc 2004-03-04 20:13:47.000000000 +0100
@@ -1,7 +1,6 @@
-// { dg-options "-D_GLIBCXX_ASSERT" { target *-*-* } }
// 2003-04-26 Petur Runolfsson <peturr02@ru.is>
-// Copyright (C) 2003 Free Software Foundation
+// Copyright (C) 2003, 2004 Free Software Foundation
//
// 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
diff -urN libstdc++-v3-orig/testsuite/27_io/objects/wchar_t/5.cc libstdc++-v3/testsuite/27_io/objects/wchar_t/5.cc
--- libstdc++-v3-orig/testsuite/27_io/objects/wchar_t/5.cc 2003-12-22 21:09:23.000000000 +0100
+++ libstdc++-v3/testsuite/27_io/objects/wchar_t/5.cc 2004-03-04 20:13:58.000000000 +0100
@@ -1,7 +1,6 @@
-// { dg-options "-D_GLIBCXX_ASSERT" { target *-*-* } }
// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
-// Copyright (C) 2003 Free Software Foundation
+// Copyright (C) 2003, 2004 Free Software Foundation
//
// 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
diff -urN libstdc++-v3-orig/testsuite/backward/11460.cc libstdc++-v3/testsuite/backward/11460.cc
--- libstdc++-v3-orig/testsuite/backward/11460.cc 2003-12-22 22:05:22.000000000 +0100
+++ libstdc++-v3/testsuite/backward/11460.cc 2004-03-04 20:13:30.000000000 +0100
@@ -1,5 +1,5 @@
-// { dg-options "-Wno-deprecated -D_GLIBCXX_ASSERT" }
-// Copyright (C) 2003 Free Software Foundation, Inc.
+// { dg-options "-Wno-deprecated" }
+// Copyright (C) 2003, 2004 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
diff -urN libstdc++-v3-orig/testsuite/lib/libstdc++.exp libstdc++-v3/testsuite/lib/libstdc++.exp
--- libstdc++-v3-orig/testsuite/lib/libstdc++.exp 2004-03-01 11:27:24.000000000 +0100
+++ libstdc++-v3/testsuite/lib/libstdc++.exp 2004-03-04 20:56:06.000000000 +0100
@@ -96,15 +96,13 @@
# headers, or without assertions.
global DEFAULT_CXXFLAGS
if ![info exists DEFAULT_CXXFLAGS] then {
- set DEFAULT_CXXFLAGS "-D_GLIBCXX_ASSERT"
-
# Set up includes for stdc++.h.gch, the precompiled header file.
if { [file exists $flags_file] } {
set cxxpchflags [exec sh $flags_file --cxxpchflags]
} else {
set cxxpchflags ""
}
- append DEFAULT_CXXFLAGS " ${cxxpchflags}"
+ set DEFAULT_CXXFLAGS " ${cxxpchflags}"
# Host specific goo here.
if { [string match "powerpc-*-darwin*" $target_triplet] } {
@@ -195,7 +193,7 @@
return "untested"
}
set cxx [transform "g++"]
- set cxxflags "-ggdb3 -D_GLIBCXX_ASSERT"
+ set cxxflags "-ggdb3"
set includes "-I./"
} else {
# If we find a testsuite_flags file, we're testing in the build dir.
@@ -205,7 +203,7 @@
set includes [exec sh $flags_file --build-includes]
} else {
set cxx [transform "g++"]
- set cxxflags "-ggdb3 -D_GLIBCXX_ASSERT"
+ set cxxflags "-ggdb3"
set includes "-I${srcdir}"
}
}
diff -urN libstdc++-v3-orig/testsuite/thread/pthread7-rope.cc libstdc++-v3/testsuite/thread/pthread7-rope.cc
--- libstdc++-v3-orig/testsuite/thread/pthread7-rope.cc 2004-03-04 19:58:39.000000000 +0100
+++ libstdc++-v3/testsuite/thread/pthread7-rope.cc 2004-03-04 20:08:05.000000000 +0100
@@ -19,8 +19,8 @@
// USA.
// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
-// { dg-options "-D_GLIBCXX_ASSERT -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* } }
-// { dg-options "-D_GLIBCXX_ASSERT -pthreads" { target *-*-solaris* } }
+// { dg-options "-pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* } }
+// { dg-options "-pthreads" { target *-*-solaris* } }
#include <ext/rope>
#include <cstring>