On 13/01/2008, Jonathan Wakely wrote: > > I think all others should change to permerrors.
I only meant all others in cp/decl.c of course - here are the remaining files. Again I've only listed the ones that should remain as pedwarns and other special cases - most change to permerrors. In cp/error.c we have /* Warn about the use of variadic templates when appropriate. */ void maybe_warn_variadic_templates (void) { if ((cxx_dialect == cxx98) && !in_system_header) /* We really want to suppress this warning in system headers, because libstdc++ uses variadic templates even when we aren't in C++0x mode. */ pedwarn ("ISO C++ does not include variadic templates"); } Another interesting one. Variadic templates work in C++98 mode and are used internally, but currently you have to say -fpermissive to use them in user code. That flag is *usually* needed for backward-compatibility, not enabling *future* extensions. If this becomes a permerror that behaviour will be preserved, if it stays as a pedwarn then users will only get a warning for variadic-templates in C++98. So is support for variadic templates in -std=gnu98 mode an official extension, or a detail not-for-public-consumption? the pedwarns in except.c, friend.c and init.c should be permerrors at name-lookup.c:728 we have: if (pedantic && ! DECL_IN_SYSTEM_HEADER (x)) pedwarn ("redeclaration of %<wchar_t%> as %qT", TREE_TYPE (x)); guarded by pedantic, so leave as pedwarn and later at line 1177 pedwarn ("name lookup of %qD changed for new ISO %<for%> scoping", DECL_NAME (decl)); pedwarn (" using obsolete binding at %q+D", decl); This is currently inaccurate, it says "using obsolete binding" but because pedantic-errors is on it doesn't use it - you get a fatal error. Leaving this as a pedwarn would make the diagnostic accurate, but personally I think it's right that this is a fatal error, so it should change to permerror and the second line should be changed to "(if you use -fpermissive G++ will accept your code)" as used in lex.c and parser.c The others in cp/name-lookup.c should be pedwarns. In cp/parser.c your patch already changes one pedwarn. I think all others should change unless guarded by if (pedantic), as this allow GNU extensions like long long. There are a couple of exceptions... There's this oddity on line 13685 if (!parser->default_arg_ok_p) { if (!flag_pedantic_errors) warning (0, "deprecated use of default argument for parameter of non-function"); else { error ("default arguments are only permitted for function parameters"); default_argument = NULL_TREE; } } I think for consistency with the new proposed behaviour it should check flag_permissive, instead of !flag_pedantic_errors, do you agree? on line 14511: if (scope == nested_name_specifier) { pedwarn ("extra qualification ignored"); nested_name_specifier = NULL_TREE; num_templates = 0; } how confusing - a fatal error that says the problem was ignored :-) I think this should be a permerror, but maybe the text should say "extra qualification not allowed" The other pedwarns in cp/parser.c that are not guarded by pedantic should be permerrors. In cp/pt.c all pedwarns except these should be permerrors: line 14284 if (pedantic && !in_system_header) pedwarn ("ISO C++ forbids the use of %<extern%> on explicit " "instantiations"); This is a GNU extension, leave as pedwarn line 14370 if (pedantic && !in_system_header) pedwarn("ISO C++ forbids the use of %qE on explicit instantiations", storage); GNU extension, leave as pedwarn The others in cp/pt.c should be permerrors. The pedwarn in cp/semantics.c should be a permerror In cp/typeck2.c I think cxx_incomplete_type_diagnostic should continue to use pedwarn on line 347, but line 697 should be a permerror. In cp/typeck.c the pedwarns guarded by pedantic should stay as pedwarns. on line 5356 there is: if (pedantic) /* Only issue a warning, as we have always supported this where possible, and it is necessary in some cases. DR 195 addresses this issue, but as of 2004/10/26 is still in drafting. */ warning (0, "ISO C++ forbids casting between pointer-to-function and pointer-to-object"); This could switch to a pedwarn, since that will still be a warning under the permerror proposal. That would mean it can be turned into a fatal error with -pedantic-errors instead of -Werror, which would be consistent with other warnings that are only enabled by -pedantic. I'm not sure how "conditionally-supported behaviour" should interact with -pedantic-errors so let's leave as a warning for now. The others (including the one in build_x_compound_expr_from_list) should change to permerrors Is that all of them? Would you prefer a patch to make the changes or are you going to go through them yourself anyway? Jon