[v3] -pedantic-errors vs. extern template
Gabriel Dos Reis
gdr@codesourcery.com
Sun Feb 17 01:25:00 GMT 2002
Benjamin Kosnik <bkoz@redhat.com> writes:
| Ok, well the tuning patch fallout continues: there are a substantial
| number of new failures in the g++ testsuite because of the use of
| 'extern template' in header files when -pedantic-errors is used.
|
| An example:
|
| FAIL: g++.benjamin/15071.C (test for excess errors)
|
| /mnt/hd/ahimsa/bld-x86-gcc/i686-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:947: ISO
| C++ forbids the use of `extern' on explicit instantiations
|
| The way this is worked around for a similar issue (long long) it so
| put '#pragma GCC system_header' in the header files that use these
| non-standard constructs.
|
| So, I did that for this case too: the problem is that it doesn't
| really work at the moment for the 'extern template' construct. Jason,
| should it? It would be nice to keep the tuning bits in.
IIRC, that extension was (informally) considered on the -core list, in
conjunction with problems like those raised by your tuning effort.
There were no rationale given for forbidding the "extern template"
construct; John H. Spicer agreed that extension is a reasonable way to
solve those problems, so I think we should permit that extension, at
least for V3.
What about the below? Jason, Mark?
-- Gaby
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/ChangeLog,v
retrieving revision 1.2675
diff -p -r1.2675 ChangeLog
*** ChangeLog 2002/02/16 12:13:32 1.2675
--- ChangeLog 2002/02/17 08:27:57
***************
*** 1,3 ****
--- 1,8 ----
+ 2002-02-17 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
+
+ * pt.c (do_decl_instantiation): Allow 'extern template' extension
+ in system headers.
+
2002-02-15 Nathan Sidwell <nathan@codesourcery.com>
* decl.c (grokdeclarator): Set typedef_decl for all TYPE_DECLs,
Index: pt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/pt.c,v
retrieving revision 1.576
diff -p -r1.576 pt.c
*** pt.c 2002/02/07 20:51:15 1.576
--- pt.c 2002/02/17 08:28:02
*************** do_decl_instantiation (declspecs, declar
*** 9502,9508 ****
;
else if (storage == ridpointers[(int) RID_EXTERN])
{
! if (pedantic)
pedwarn ("ISO C++ forbids the use of `extern' on explicit instantiations");
extern_p = 1;
}
--- 9502,9508 ----
;
else if (storage == ridpointers[(int) RID_EXTERN])
{
! if (pedantic && !DECL_IN_SYSTEM_HEADER (result))
pedwarn ("ISO C++ forbids the use of `extern' on explicit instantiations");
extern_p = 1;
}
More information about the Gcc-patches
mailing list