[v3] concept check macros, excess-errors
Benjamin Kosnik
bkoz@redhat.com
Tue Apr 17 18:03:00 GMT 2001
This patch finally kills the FAILs for the XFAILS in 23_containers
that have been driving me mad for weeks.
Two things made it possible:
1) adding dg-excess-errors, which is style-wise uncool WRT dejagnu and
the dg framework. I don't care.
2) re-organizing the concept-checking macro, and re-implementing a
c++config.h bit for toggeling it on and off.
There was previously no way to universally turn off concept
checking, except for passing _GLIBCPP_NO_CONCEPT_CHECKS on the
compile line. There needs to be a way to do this.
Now, _GLIBCPP_CONCEPT_CHECKS means the concept checking code will
be exercised. Having it undefined means it's not active. This
avoids double negatives (!(no_concept_checks)) == concept
checks. This also is consistent with the rest of the library. In
addition, compatibility with the old STL macros has been removed
(since the STL code that it was based on has also been
removed.). Let's try to keep this code separate and a bit more
tightly focused.
In addition, concept checking code in the Makefiles (!) was
removed.
Phil if you'd like to write configure bits to turn on/off the macro
(and have it off by default), I think this is a good idea.
Let's try to fix all the FAILs in the libstdc++-v3 testsuite this week....
tested x86/linux:
FAIL: 21_strings/append.cc (execution test), static
FAIL: 21_strings/ctor_copy_dtor.cc (execution test), static
FAIL: 21_strings/insert.cc (execution test), static
FAIL: 21_strings/insert.cc (execution test), shared
FAIL: 22_locale/ctor_copy_dtor.cc (execution test), static
FAIL: 22_locale/ctor_copy_dtor.cc (execution test), shared
FAIL: 26_numerics/c99_macros.cc (test for excess errors), static
FAIL: 26_numerics/c99_macros.cc (test for excess errors), shared
FAIL: 27_io/istream_seeks.cc (execution test), static
FAIL: 27_io/istream_seeks.cc (execution test), shared
=== libstdc++ Summary ===
# of expected passes 400
# of unexpected failures 10
# of expected failures 12
-benjamin
2001-04-17 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map_operators.cc: Add dg-excess-errors.
* testsuite/23_containers/set_operators.cc: Same.
* include/bits/c++config: Add _GLIBCPP_CONCEPT_CHECKS. Disable by
default.
(__GLIBCPP__): Bump from value of last release.
* include/bits/concept_check.h: Default to off, edit comments.
* src/stl-inst.cc: Use _GLIBCPP_CONCEPT_CHECKS.
* src/Makefile.am (AM_CXXFLAGS): Remove _GLIBCPP_NO_CONCEPT_CHECKS.
* src/Makefile.in: Regenerate.
Index: include/bits/c++config
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/c++config,v
retrieving revision 1.19
diff -c -p -r1.19 c++config
*** c++config 2001/04/06 01:47:11 1.19
--- c++config 2001/04/18 00:49:12
***************
*** 34,40 ****
#include <bits/os_defines.h>
// The current version of the C++ library in compressed ISO date format.
! #define __GLIBCPP__ 20010406
// This is necessary until GCC supports separate template
// compilation.
--- 34,40 ----
#include <bits/os_defines.h>
// The current version of the C++ library in compressed ISO date format.
! #define __GLIBCPP__ 20010417
// This is necessary until GCC supports separate template
// compilation.
***************
*** 55,60 ****
--- 55,63 ----
// Use corrected code from the committee library group's issues list.
#define _GLIBCPP_RESOLVE_LIB_DEFECTS 1
+ // Enable concept checking code from the boost libraries.
+ //#define _GLIBCPP_CONCEPT_CHECKS 1
+
// From SGI's stl_config.h; generic settings and user hooks (_NOTHREADS).
#if defined(_PTHREADS) && !defined(_NOTHREADS)
# define __STL_PTHREADS
***************
*** 63,71 ****
# define __STL_UITHREADS
#endif
- // Concept-checking hooks and related config are now in bits/concept_check.h.
-
-
// This is also a user hook, but via -f[no-]exceptions, not direct #defines.
#ifdef __EXCEPTIONS
# define __STL_USE_EXCEPTIONS
--- 66,71 ----
***************
*** 142,146 ****
// End of prewritten config; the discovered settings follow.
-
-
--- 142,144 ----
Index: include/bits/concept_check.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/concept_check.h,v
retrieving revision 1.2
diff -c -p -r1.2 concept_check.h
*** concept_check.h 2001/04/13 09:03:18 1.2
--- concept_check.h 2001/04/18 00:49:12
***************
*** 31,59 ****
#define _GLIBCPP_CONCEPT_CHECK 1
#pragma GCC system_header
- #include <bits/c++config.h>
-
! // Concept-checking code is on by default unless users turn it off via any
! // of these methods:
! // - _GLIBCPP_NO_CONCEPT_CHECKS is a user hook; defining it disables the
! // checks.
! // - _STL_NO_CONCEPT_CHECKS is a user hook from the old STL implementation
! // specifically for this purpose; defining it disables the checks, in
! // case the user is expecting the old version.
! // - NDEBUG is the usual macro that kills assert(). Defining it will also
! // disable the checks, by the reasoning that if the user doesn't want
! // any runtime assertion code, then no space penalty for the checks
! // is desired either.
// All places in libstdc++-v3 where these are used, or /might/ be used, or
// don't need to be used, or perhaps /should/ be used, are commented with
// "concept requirements" (and maybe some more text). So grep like crazy
// if you're looking for additional places to use these.
! #if defined(_GLIBCPP_NO_CONCEPT_CHECKS) || defined(_STL_NO_CONCEPT_CHECKS) \
! || defined(NDEBUG)
#define __glibcpp_function_requires(...)
#define __glibcpp_class_requires(_a,_b)
--- 31,48 ----
#define _GLIBCPP_CONCEPT_CHECK 1
#pragma GCC system_header
! #include <bits/c++config.h>
// All places in libstdc++-v3 where these are used, or /might/ be used, or
// don't need to be used, or perhaps /should/ be used, are commented with
// "concept requirements" (and maybe some more text). So grep like crazy
// if you're looking for additional places to use these.
+ // Concept-checking code is off by default unless users turn it on via
+ // configure options or editing c++config.h.
! #ifndef _GLIBCPP_CONCEPT_CHECKS
#define __glibcpp_function_requires(...)
#define __glibcpp_class_requires(_a,_b)
***************
*** 90,93 ****
#endif // enable/disable
#endif // _GLIBCPP_CONCEPT_CHECK
-
--- 79,81 ----
Index: src/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/Makefile.am,v
retrieving revision 1.83
diff -c -p -r1.83 Makefile.am
*** Makefile.am 2001/04/11 18:52:31 1.83
--- Makefile.am 2001/04/18 00:49:14
*************** tmp-libstdc++.INC: Makefile
*** 306,312 ****
# the concept-checking symbols. So we must disable the checks while
# actually building the library.
AM_CXXFLAGS = \
! -fno-implicit-templates -D_GLIBCPP_NO_CONCEPT_CHECKS \
$(LIBSUPCXX_CXXFLAGS) \
$(WARN_CXXFLAGS) \
$(OPTIMIZE_CXXFLAGS) \
--- 306,312 ----
# the concept-checking symbols. So we must disable the checks while
# actually building the library.
AM_CXXFLAGS = \
! -fno-implicit-templates \
$(LIBSUPCXX_CXXFLAGS) \
$(WARN_CXXFLAGS) \
$(OPTIMIZE_CXXFLAGS) \
Index: src/stl-inst.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/stl-inst.cc,v
retrieving revision 1.6
diff -c -p -r1.6 stl-inst.cc
*** stl-inst.cc 2001/03/23 20:02:03 1.6
--- stl-inst.cc 2001/04/18 00:49:16
*************** namespace std
*** 50,56 ****
vector<unsigned int>::
_M_insert_aux(vector<unsigned int>::iterator, unsigned int const &);
! #ifdef __STL_USE_CONCEPT_CHECKS
template
void __sink_unused_warning<unsigned int>(unsigned int);
--- 50,56 ----
vector<unsigned int>::
_M_insert_aux(vector<unsigned int>::iterator, unsigned int const &);
! #ifdef _GLIBCPP_CONCEPT_CHECKS
template
void __sink_unused_warning<unsigned int>(unsigned int);
Index: testsuite/23_containers/map_operators.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/23_containers/map_operators.cc,v
retrieving revision 1.5
diff -c -p -r1.5 map_operators.cc
*** map_operators.cc 2001/04/13 02:14:11 1.5
--- map_operators.cc 2001/04/18 00:49:16
***************
*** 24,36 ****
#include <string>
#include <iostream>
- // map and set
- // libstdc++/86: map & set iterator comparisons are not type-safe
- // XXX this is XFAIL for the time being, ie this should not compile
-
- // Just try to compile
// { dg-do compile }
void test01()
{
bool test = true;
--- 24,33 ----
#include <string>
#include <iostream>
// { dg-do compile }
+ // { dg-excess-errors "" }
+ // libstdc++/86: map & set iterator comparisons are not type-safe
void test01()
{
bool test = true;
*************** void test01()
*** 43,50 ****
std::map<unsigned, int>::iterator itr(mapByIndex.begin());
// NB: notice, it's not mapByIndex!!
! test &= itr != mapByName.end(); // { dg-error ".*" "" { xfail *-*-* } }
! test &= itr == mapByName.end(); // { dg-error ".*" "" { xfail *-*-* } }
}
// http://gcc.gnu.org/ml/libstdc++/2000-11/msg00093.html
--- 40,47 ----
std::map<unsigned, int>::iterator itr(mapByIndex.begin());
// NB: notice, it's not mapByIndex!!
! test &= itr != mapByName.end(); // { dg-error "match" "" { xfail *-*-* } }
! test &= itr == mapByName.end(); // { dg-error "match" "" { xfail *-*-* } }
}
// http://gcc.gnu.org/ml/libstdc++/2000-11/msg00093.html
*************** int main()
*** 71,73 ****
--- 68,74 ----
return 0;
}
Index: testsuite/23_containers/set_operators.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/23_containers/set_operators.cc,v
retrieving revision 1.3
diff -c -p -r1.3 set_operators.cc
*** set_operators.cc 2001/04/13 02:14:11 1.3
--- set_operators.cc 2001/04/18 00:49:17
***************
*** 22,33 ****
#include <set>
#include <string>
!
! // map and set
! // libstdc++/86: map & set iterator comparisons are not type-safe
!
// { dg-do compile }
int main(void)
{
bool test = true;
--- 22,32 ----
#include <set>
#include <string>
! make
// { dg-do compile }
+ // { dg-excess-errors "" }
+ // libstdc++/86: map & set iterator comparisons are not type-safe
int main(void)
{
bool test = true;
*************** int main(void)
*** 37,45 ****
std::set<unsigned int>::iterator itr(setByIndex.begin());
- // NB: it's not setByIndex!!
- test &= itr != setByName.end(); // { dg-error ".*" "" { xfail *-*-* } }
- test &= itr == setByName.end(); // { dg-error ".*" "" { xfail *-*-* } }
return 0;
}
--- 36,46 ----
std::set<unsigned int>::iterator itr(setByIndex.begin());
+ // NB: it's not setByIndex!!
+ test &= itr != setByName.end();
+ // { dg-error "no match for" "" { xfail *-*-* } 41 }
+ test &= itr == setByName.end();
+ // { dg-error "no match for" "" { xfail *-*-* } 43 }
return 0;
}
More information about the Gcc-patches
mailing list