aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2004-09-23 21:27:25 +0000
committerZack Weinberg <zack@gcc.gnu.org>2004-09-23 21:27:25 +0000
commit2cfe82fe43c3c6880be8e25877bb77c550097099 (patch)
tree7c8b072e4a0dd5d53355cf9e4fe5a56ff9c7a5c6 /gcc
parent31d66fa9381f5a21a80f6e9b828525da34235054 (diff)
downloadgcc-2cfe82fe43c3c6880be8e25877bb77c550097099.zip
gcc-2cfe82fe43c3c6880be8e25877bb77c550097099.tar.gz
gcc-2cfe82fe43c3c6880be8e25877bb77c550097099.tar.bz2
decl.c (grokfndecl): If ::main is found not to return int, correct it after issuing a diagnostic.
gcc/cp: * decl.c (grokfndecl): If ::main is found not to return int, correct it after issuing a diagnostic. (grokdeclarator): If the incoming type was error_mark_node, do not complain about declaring something with no type. (start_function): Change check for ::main not returning int to an assertion, as grokfndecl now catches this when the user did it. * init.c (perform_member_init, sort_mem_initializers) (emit_mem_initializers): Make most diagnostics be issued on the line of current_function_decl, not whatever the current input line is. * parser.c (cp_lexer_peek_token_emit_debug_info): Surround definition and declaration with #ifdef ENABLE_CHECKING. Avoid unnecessary use of fprintf. (cp_lexer_print_token, cp_lexer_debug_stream): Adjust stub definitions to avoid warnings. (cp_lexer_new_main): Add assertion that first token is not a padding token. (cp_lexer_new_from_token_array): Fold into ... (cp_lexer_new_from_tokens): ... here. Add assertion that first token is not a padding token. (cp_lexer_set_source_position_from_token): Move nearer to callers. Remove unused lexer argument. (cp_lexer_peek_token): Just print debugging report (if enabled) and return lexer->next_token. (cp_lexer_skip_purged_tokens): Delete. (cp_lexer_next_token_is, cp_lexer_next_token_is_not): Make inline, simplify bodies. (cp_lexer_peek_nth_token): Add debugging report a la cp_lexer_peek_token. (cp_lexer_consume_token): Correct commentary. Advance over purged tokens here. Set current source position here, from token to be returned. Avoid unnecessary use of fprintf. (cp_lexer_purge_token): Advance next_token pointer over this and subsequent purged tokens. (cp_parser_error): Adjust source position to that of the peeked token. (cp_parser_push_lexer_for_tokens, cp_parser_pop_lexer): New functions. (cp_parser_string_literal): Remove some excessive cleverness. (cp_parser_enum_specifier): Call start_enum before consuming the opening brace. (cp_parser_member_declaration): Make the "extra semicolon" diagnostic consistently-worded with the other place this is diagnosed. Explicitly set the diagnostic location to the location of the offending semicolon. (cp_parser_enclosed_template_argument_list): Use %</%> quoting in diagnostics. Do not use cp_parser_require. Set location of diagnostics about improper use of '>>' to location of offending token. (cp_parser_late_parsing_for_member): Use cp_parser_push_lexer_for_tokens and cp_parser_pop_lexer. (cp_parser_late_parsing_default_args): Likewise. Manually move some logic outside the loop. gcc/testsuite: * g++.dg/ext/complit1.C * g++.dg/other/error2.C * g++.dg/other/nontype-1.C * g++.dg/parse/crash11.C * g++.dg/parse/crash12.C * g++.dg/parse/error15.C * g++.dg/parse/error4.C * g++.dg/parse/tmpl-outside1.C * g++.dg/parse/too-many-tmpl-args1.C * g++.dg/template/dependent-expr3.C * g++.dg/template/error10.C * g++.dg/template/instantiate1.C * g++.dg/template/vtable2.C * g++.dg/warn/Wshadow-1.C * g++.dg/warn/weak1.C * g++.old-deja/g++.brendan/crash16.C * g++.old-deja/g++.brendan/crash18.C * g++.old-deja/g++.brendan/crash48.C * g++.old-deja/g++.brendan/crash49.C * g++.old-deja/g++.brendan/crash55.C * g++.old-deja/g++.brendan/crash56.C * g++.old-deja/g++.brendan/crash8.C * g++.old-deja/g++.brendan/enum11.C * g++.old-deja/g++.brendan/enum8.C * g++.old-deja/g++.brendan/enum9.C * g++.old-deja/g++.brendan/friend3.C * g++.old-deja/g++.brendan/misc14.C * g++.old-deja/g++.bugs/900402_02.C * g++.old-deja/g++.bugs/900404_03.C * g++.old-deja/g++.bugs/900404_04.C * g++.old-deja/g++.bugs/900428_03.C * g++.old-deja/g++.jason/crash4.C * g++.old-deja/g++.jason/overload21.C * g++.old-deja/g++.jason/redecl1.C * g++.old-deja/g++.jason/report.C * g++.old-deja/g++.jason/rfg10.C * g++.old-deja/g++.jason/template30.C * g++.old-deja/g++.law/arm12.C * g++.old-deja/g++.law/ctors5.C * g++.old-deja/g++.law/cvt20.C * g++.old-deja/g++.law/init10.C * g++.old-deja/g++.law/init8.C * g++.old-deja/g++.law/visibility17.C * g++.old-deja/g++.law/visibility7.C * g++.old-deja/g++.mike/net8.C * g++.old-deja/g++.mike/p646.C * g++.old-deja/g++.mike/p700.C * g++.old-deja/g++.mike/p701.C * g++.old-deja/g++.mike/p811.C * g++.old-deja/g++.ns/template13.C * g++.old-deja/g++.other/array3.C * g++.old-deja/g++.other/crash25.C * g++.old-deja/g++.other/dtor3.C * g++.old-deja/g++.other/dtor4.C * g++.old-deja/g++.other/main1.C * g++.old-deja/g++.other/warn7.C * g++.old-deja/g++.pt/crash11.C * g++.old-deja/g++.pt/crash36.C * g++.old-deja/g++.pt/spec22.C * g++.old-deja/g++.pt/spec9.C * g++.old-deja/g++.pt/ttp52.C * g++.old-deja/g++.robertl/eb103.C * g++.old-deja/g++.robertl/eb121.C * g++.old-deja/g++.robertl/eb22.C * g++.old-deja/g++.robertl/eb8.C: Update locations and/or regexps of dg-error markers. Remove markers for some bogus messages that are no longer issued. libstdc++-v3: * testsuite/20_util/memory/auto_ptr/assign_neg.cc * testsuite/23_containers/map/operators/1_neg.cc * testsuite/23_containers/set/operators/1_neg.cc: Update locations and/or regexps of dg-error markers. From-SVN: r87985
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog57
-rw-r--r--gcc/cp/decl.c29
-rw-r--r--gcc/cp/init.c38
-rw-r--r--gcc/cp/parser.c333
-rw-r--r--gcc/testsuite/ChangeLog150
-rw-r--r--gcc/testsuite/g++.dg/ext/complit1.C4
-rw-r--r--gcc/testsuite/g++.dg/other/error2.C4
-rw-r--r--gcc/testsuite/g++.dg/other/nontype-1.C2
-rw-r--r--gcc/testsuite/g++.dg/parse/crash11.C4
-rw-r--r--gcc/testsuite/g++.dg/parse/crash12.C4
-rw-r--r--gcc/testsuite/g++.dg/parse/error15.C2
-rw-r--r--gcc/testsuite/g++.dg/parse/error4.C2
-rw-r--r--gcc/testsuite/g++.dg/parse/tmpl-outside1.C1
-rw-r--r--gcc/testsuite/g++.dg/parse/too-many-tmpl-args1.C4
-rw-r--r--gcc/testsuite/g++.dg/template/dependent-expr3.C2
-rw-r--r--gcc/testsuite/g++.dg/template/error10.C8
-rw-r--r--gcc/testsuite/g++.dg/template/instantiate1.C4
-rw-r--r--gcc/testsuite/g++.dg/template/vtable2.C4
-rw-r--r--gcc/testsuite/g++.dg/warn/Wshadow-1.C4
-rw-r--r--gcc/testsuite/g++.dg/warn/weak1.C3
-rw-r--r--gcc/testsuite/g++.old-deja/g++.brendan/crash16.C8
-rw-r--r--gcc/testsuite/g++.old-deja/g++.brendan/crash18.C13
-rw-r--r--gcc/testsuite/g++.old-deja/g++.brendan/crash48.C14
-rw-r--r--gcc/testsuite/g++.old-deja/g++.brendan/crash49.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.brendan/crash55.C10
-rw-r--r--gcc/testsuite/g++.old-deja/g++.brendan/crash56.C16
-rw-r--r--gcc/testsuite/g++.old-deja/g++.brendan/crash8.C10
-rw-r--r--gcc/testsuite/g++.old-deja/g++.brendan/enum11.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.brendan/enum8.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.brendan/enum9.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.brendan/friend3.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.brendan/misc14.C7
-rw-r--r--gcc/testsuite/g++.old-deja/g++.bugs/900402_02.C10
-rw-r--r--gcc/testsuite/g++.old-deja/g++.bugs/900404_03.C10
-rw-r--r--gcc/testsuite/g++.old-deja/g++.bugs/900404_04.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.bugs/900428_03.C13
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/crash4.C8
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/overload21.C12
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/redecl1.C6
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/report.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/rfg10.C5
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/template30.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/arm12.C8
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/ctors5.C10
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/cvt20.C6
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/init10.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/init8.C6
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/visibility17.C16
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/visibility7.C12
-rw-r--r--gcc/testsuite/g++.old-deja/g++.mike/net8.C12
-rw-r--r--gcc/testsuite/g++.old-deja/g++.mike/p646.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.mike/p700.C8
-rw-r--r--gcc/testsuite/g++.old-deja/g++.mike/p701.C6
-rw-r--r--gcc/testsuite/g++.old-deja/g++.mike/p811.C14
-rw-r--r--gcc/testsuite/g++.old-deja/g++.ns/template13.C14
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/array3.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/crash25.C6
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/dtor3.C8
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/dtor4.C8
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/main1.C11
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/warn7.C12
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/crash11.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/crash36.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/spec22.C6
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/spec9.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/ttp52.C6
-rw-r--r--gcc/testsuite/g++.old-deja/g++.robertl/eb103.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.robertl/eb121.C6
-rw-r--r--gcc/testsuite/g++.old-deja/g++.robertl/eb22.C8
-rw-r--r--gcc/testsuite/g++.old-deja/g++.robertl/eb8.C4
70 files changed, 593 insertions, 451 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b9d2bff..9ea3fe3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,58 @@
+2004-09-23 Zack Weinberg <zack@codesourcery.com>
+
+ * decl.c (grokfndecl): If ::main is found not to return int,
+ correct it after issuing a diagnostic.
+ (grokdeclarator): If the incoming type was error_mark_node, do
+ not complain about declaring something with no type.
+ (start_function): Change check for ::main not returning int to
+ an assertion, as grokfndecl now catches this when the user did it.
+ * init.c (perform_member_init, sort_mem_initializers)
+ (emit_mem_initializers): Make most diagnostics be issued on
+ the line of current_function_decl, not whatever the current
+ input line is.
+ * parser.c (cp_lexer_peek_token_emit_debug_info): Surround
+ definition and declaration with #ifdef ENABLE_CHECKING.
+ Avoid unnecessary use of fprintf.
+ (cp_lexer_print_token, cp_lexer_debug_stream): Adjust stub
+ definitions to avoid warnings.
+ (cp_lexer_new_main): Add assertion that first token is not a
+ padding token.
+ (cp_lexer_new_from_token_array): Fold into ...
+ (cp_lexer_new_from_tokens): ... here. Add assertion that
+ first token is not a padding token.
+ (cp_lexer_set_source_position_from_token): Move nearer to callers.
+ Remove unused lexer argument.
+ (cp_lexer_peek_token): Just print debugging report (if enabled)
+ and return lexer->next_token.
+ (cp_lexer_skip_purged_tokens): Delete.
+ (cp_lexer_next_token_is, cp_lexer_next_token_is_not): Make
+ inline, simplify bodies.
+ (cp_lexer_peek_nth_token): Add debugging report a la
+ cp_lexer_peek_token.
+ (cp_lexer_consume_token): Correct commentary. Advance over
+ purged tokens here. Set current source position here, from
+ token to be returned. Avoid unnecessary use of fprintf.
+ (cp_lexer_purge_token): Advance next_token pointer over this and
+ subsequent purged tokens.
+ (cp_parser_error): Adjust source position to that of the
+ peeked token.
+ (cp_parser_push_lexer_for_tokens, cp_parser_pop_lexer): New functions.
+ (cp_parser_string_literal): Remove some excessive cleverness.
+ (cp_parser_enum_specifier): Call start_enum before consuming
+ the opening brace.
+ (cp_parser_member_declaration): Make the "extra semicolon"
+ diagnostic consistently-worded with the other place this is
+ diagnosed. Explicitly set the diagnostic location to the
+ location of the offending semicolon.
+ (cp_parser_enclosed_template_argument_list): Use %</%> quoting
+ in diagnostics. Do not use cp_parser_require. Set location
+ of diagnostics about improper use of '>>' to location of
+ offending token.
+ (cp_parser_late_parsing_for_member):
+ Use cp_parser_push_lexer_for_tokens and cp_parser_pop_lexer.
+ (cp_parser_late_parsing_default_args): Likewise. Manually
+ move some logic outside the loop.
+
2004-09-23 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/17618
@@ -68,7 +123,7 @@
class_hint_flags): Remove.
(get_pseudo_ti_init): Use CLASSTYPE_REPEATED_BASE_P and
CLASSTYPE_DIAMOND_SHAPED_P.
-
+
2004-09-21 Ziemowit Laski <zlaski@apple.com>
* cp-lang.c (LANG_HOOKS_FOLD_OBJ_TYPE_REF): Moved here from
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index b3cdd69..d3a0c8d 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5590,7 +5590,10 @@ grokfndecl (tree ctype,
error ("cannot declare `::main' to be static");
if (!same_type_p (TREE_TYPE (TREE_TYPE (decl)),
integer_type_node))
- error ("`main' must return `int'");
+ {
+ error ("`::main' must return `int'");
+ TREE_TYPE (TREE_TYPE (decl)) = integer_type_node;
+ }
inlinep = 0;
publicp = 1;
}
@@ -6465,6 +6468,7 @@ grokdeclarator (const cp_declarator *declarator,
cp_decl_spec ds;
cp_storage_class storage_class;
bool unsigned_p, signed_p, short_p, long_p, thread_p;
+ bool type_was_error_mark_node = false;
signed_p = declspecs->specs[(int)ds_signed];
unsigned_p = declspecs->specs[(int)ds_unsigned];
@@ -6665,7 +6669,10 @@ grokdeclarator (const cp_declarator *declarator,
/* Extract the basic type from the decl-specifier-seq. */
type = declspecs->type;
if (type == error_mark_node)
- type = NULL_TREE;
+ {
+ type = NULL_TREE;
+ type_was_error_mark_node = true;
+ }
/* If the entire declaration is itself tagged as deprecated then
suppress reports of deprecated items. */
if (type && TREE_DEPRECATED (type)
@@ -6756,7 +6763,9 @@ grokdeclarator (const cp_declarator *declarator,
&& in_namespace == NULL_TREE
&& current_namespace == global_namespace);
- if (in_system_header || flag_ms_extensions)
+ if (type_was_error_mark_node)
+ /* We've already issued an error, don't complain more. */;
+ else if (in_system_header || flag_ms_extensions)
/* Allow it, sigh. */;
else if (pedantic || ! is_main)
pedwarn ("ISO C++ forbids declaration of `%s' with no type",
@@ -10101,16 +10110,10 @@ start_function (cp_decl_specifier_seq *declspecs,
maybe_apply_pragma_weak (decl1);
if (DECL_MAIN_P (decl1))
- {
- /* If this doesn't return integer_type, or a typedef to
- integer_type, complain. */
- if (!same_type_p (TREE_TYPE (TREE_TYPE (decl1)), integer_type_node))
- {
- if (pedantic || warn_return_type)
- pedwarn ("return type for `main' changed to `int'");
- TREE_TYPE (decl1) = default_function_type;
- }
- }
+ /* main must return int. grokfndecl should have corrected it
+ (and issued a diagnostic) if the user got it wrong. */
+ gcc_assert (same_type_p (TREE_TYPE (TREE_TYPE (decl1)),
+ integer_type_node));
start_preparsed_function (decl1, attrs, /*flags=*/SF_DEFAULT);
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 58dac96..b820e9e 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -315,9 +315,8 @@ perform_member_init (tree member, tree init)
/* Effective C++ rule 12 requires that all data members be
initialized. */
if (warn_ecpp && !explicit && TREE_CODE (type) != ARRAY_TYPE)
- warning ("`%D' should be initialized in the member initialization "
- "list",
- member);
+ warning ("%J%qD should be initialized in the member initialization "
+ "list", current_function_decl, member);
if (init == void_type_node)
init = NULL_TREE;
@@ -363,16 +362,17 @@ perform_member_init (tree member, tree init)
{
init = build_default_init (type, /*nelts=*/NULL_TREE);
if (TREE_CODE (type) == REFERENCE_TYPE)
- warning
- ("default-initialization of `%#D', which has reference type",
- member);
+ warning ("%Jdefault-initialization of %q#D, "
+ "which has reference type",
+ current_function_decl, member);
}
/* member traversal: note it leaves init NULL */
else if (TREE_CODE (type) == REFERENCE_TYPE)
- pedwarn ("uninitialized reference member `%D'", member);
+ pedwarn ("%Juninitialized reference member %qD",
+ current_function_decl, member);
else if (CP_TYPE_CONST_P (type))
- pedwarn ("uninitialized member `%D' with `const' type `%T'",
- member, type);
+ pedwarn ("%Juninitialized member %qD with %<const%> type %qT",
+ current_function_decl, member, type);
}
else if (TREE_CODE (init) == TREE_LIST)
/* There was an explicit member initialization. Do some work
@@ -509,7 +509,8 @@ sort_mem_initializers (tree t, tree mem_inits)
break;
/* Issue a warning if the explicit initializer order does not
- match that which will actually occur. */
+ match that which will actually occur.
+ ??? Are all these on the correct lines? */
if (warn_reorder && !subobject_init)
{
if (TREE_CODE (TREE_PURPOSE (next_subobject)) == FIELD_DECL)
@@ -522,7 +523,7 @@ sort_mem_initializers (tree t, tree mem_inits)
cp_warning_at (" `%#D'", subobject);
else
warning (" base `%T'", subobject);
- warning (" when initialized here");
+ warning ("%J when initialized here", current_function_decl);
}
/* Look again, from the beginning of the list. */
@@ -538,10 +539,11 @@ sort_mem_initializers (tree t, tree mem_inits)
if (TREE_VALUE (subobject_init))
{
if (TREE_CODE (subobject) == FIELD_DECL)
- error ("multiple initializations given for `%D'", subobject);
+ error ("%Jmultiple initializations given for %qD",
+ current_function_decl, subobject);
else
- error ("multiple initializations given for base `%T'",
- subobject);
+ error ("%Jmultiple initializations given for base %qT",
+ current_function_decl, subobject);
}
/* Record the initialization. */
@@ -607,8 +609,8 @@ sort_mem_initializers (tree t, tree mem_inits)
if (same_type_p (last_field_type, field_type))
{
if (TREE_CODE (field_type) == UNION_TYPE)
- error ("initializations for multiple members of `%T'",
- last_field_type);
+ error ("%Jinitializations for multiple members of %qT",
+ current_function_decl, last_field_type);
done = 1;
break;
}
@@ -664,9 +666,9 @@ emit_mem_initializers (tree mem_inits)
if (extra_warnings && !arguments
&& DECL_COPY_CONSTRUCTOR_P (current_function_decl)
&& TYPE_NEEDS_CONSTRUCTING (BINFO_TYPE (subobject)))
- warning ("base class `%#T' should be explicitly initialized in the "
+ warning ("%Jbase class `%#T' should be explicitly initialized in the "
"copy constructor",
- BINFO_TYPE (subobject));
+ current_function_decl, BINFO_TYPE (subobject));
/* If an explicit -- but empty -- initializer list was present,
treat it just like default initialization at this point. */
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index db779a2..49d0237 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -113,8 +113,6 @@ typedef struct cp_token_cache GTY(())
static cp_lexer *cp_lexer_new_main
(void);
-static cp_lexer *cp_lexer_new_from_token_array
- (cp_token *, cp_token *);
static cp_lexer *cp_lexer_new_from_tokens
(cp_token_cache *tokens);
static void cp_lexer_destroy
@@ -133,10 +131,6 @@ static void cp_lexer_get_preprocessor_token
(cp_lexer *, cp_token *);
static inline cp_token *cp_lexer_peek_token
(cp_lexer *);
-static void cp_lexer_peek_token_emit_debug_info
- (cp_lexer *, cp_token *);
-static void cp_lexer_skip_purged_tokens
- (cp_lexer *);
static cp_token *cp_lexer_peek_nth_token
(cp_lexer *, size_t);
static inline bool cp_lexer_next_token_is
@@ -159,8 +153,6 @@ static void cp_lexer_commit_tokens
(cp_lexer *);
static void cp_lexer_rollback_tokens
(cp_lexer *);
-static inline void cp_lexer_set_source_position_from_token
- (cp_lexer *, const cp_token *);
#ifdef ENABLE_CHECKING
static void cp_lexer_print_token
(FILE *, cp_token *);
@@ -170,10 +162,17 @@ static void cp_lexer_start_debugging
(cp_lexer *) ATTRIBUTE_UNUSED;
static void cp_lexer_stop_debugging
(cp_lexer *) ATTRIBUTE_UNUSED;
+static void cp_lexer_peek_token_emit_debug_info
+ (cp_lexer *, cp_token *);
#else
-#define cp_lexer_debug_stream NULL
-#define cp_lexer_print_token(str, tok)
+/* If we define cp_lexer_debug_stream to NULL it will provoke warnings
+ about passing NULL to functions that require non-NULL arguments
+ (fputs, fprintf). It will never be used, so all we need is a value
+ of the right type that's guaranteed not to be NULL. */
+#define cp_lexer_debug_stream stdout
+#define cp_lexer_print_token(str, tok) (void) 0
#define cp_lexer_debugging_p(lexer) 0
+#define cp_lexer_peek_token_emit_debug_info(lexer, tok) (void) 0
#endif /* ENABLE_CHECKING */
static cp_token_cache *cp_token_cache_new
@@ -269,16 +268,18 @@ cp_lexer_new_main (void)
string constant concatenation. */
c_lex_return_raw_strings = false;
+ gcc_assert (lexer->next_token->type != CPP_PURGED);
return lexer;
}
/* Create a new lexer whose token stream is primed with the tokens in
- the range [FIRST, LAST). When these tokens are exhausted, no new
- tokens will be read. */
+ CACHE. When these tokens are exhausted, no new tokens will be read. */
static cp_lexer *
-cp_lexer_new_from_token_array (cp_token *first, cp_token *last)
+cp_lexer_new_from_tokens (cp_token_cache *cache)
{
+ cp_token *first = cache->first;
+ cp_token *last = cache->last;
cp_lexer *lexer = GGC_CNEW (cp_lexer);
cp_token *eof;
@@ -305,16 +306,9 @@ cp_lexer_new_from_token_array (cp_token *first, cp_token *last)
/* Initially we are not debugging. */
lexer->debugging_p = false;
#endif
- return lexer;
-}
-/* Create a new lexer whose token stream is primed with the tokens in
- CACHE. When these tokens are exhausted, no new tokens will be read. */
-
-static cp_lexer *
-cp_lexer_new_from_tokens (cp_token_cache *cache)
-{
- return cp_lexer_new_from_token_array (cache->first, cache->last);
+ gcc_assert (lexer->next_token->type != CPP_PURGED);
+ return lexer;
}
/* Frees all resources associated with LEXER. */
@@ -338,24 +332,6 @@ cp_lexer_debugging_p (cp_lexer *lexer)
#endif /* ENABLE_CHECKING */
-/* Set the current source position from the information stored in
- TOKEN. */
-
-static inline void
-cp_lexer_set_source_position_from_token (cp_lexer *lexer ATTRIBUTE_UNUSED ,
- const cp_token *token)
-{
- /* Ideally, the source position information would not be a global
- variable, but it is. */
-
- /* Update the line number and system header flag. */
- if (token->type != CPP_EOF)
- {
- input_location = token->location;
- in_system_header = token->in_system_header;
- }
-}
-
/* TOKEN points into the circular token buffer. Return a pointer to
the next token in the buffer. */
@@ -487,28 +463,29 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer ATTRIBUTE_UNUSED ,
token->keyword = RID_MAX;
}
+/* Update the globals input_location and in_system_header from TOKEN. */
+static inline void
+cp_lexer_set_source_position_from_token (cp_token *token)
+{
+ if (token->type != CPP_EOF)
+ {
+ input_location = token->location;
+ in_system_header = token->in_system_header;
+ }
+}
+
/* Return a pointer to the next token in the token stream, but do not
consume it. */
static inline cp_token *
cp_lexer_peek_token (cp_lexer *lexer)
{
- cp_token *token;
-
- /* Skip over purged tokens if necessary. */
- if (lexer->next_token->type == CPP_PURGED)
- cp_lexer_skip_purged_tokens (lexer);
-
- token = lexer->next_token;
-
- /* Provide debugging output. */
if (cp_lexer_debugging_p (lexer))
- cp_lexer_peek_token_emit_debug_info (lexer, token);
-
- cp_lexer_set_source_position_from_token (lexer, token);
- return token;
+ cp_lexer_peek_token_emit_debug_info (lexer, lexer->next_token);
+ return lexer->next_token;
}
+#ifdef ENABLE_CHECKING
/* Emit debug output for cp_lexer_peek_token. Split out into a
separate function so that cp_lexer_peek_token can be small and
inlinable. */
@@ -517,35 +494,23 @@ static void
cp_lexer_peek_token_emit_debug_info (cp_lexer *lexer ATTRIBUTE_UNUSED,
cp_token *token ATTRIBUTE_UNUSED)
{
- fprintf (cp_lexer_debug_stream, "cp_lexer: peeking at token: ");
+ fputs ("cp_lexer: peeking at token: ", cp_lexer_debug_stream);
cp_lexer_print_token (cp_lexer_debug_stream, token);
- fprintf (cp_lexer_debug_stream, "\n");
-}
-
-/* Skip all tokens whose type is CPP_PURGED. */
-
-static void cp_lexer_skip_purged_tokens (cp_lexer *lexer)
-{
- while (lexer->next_token->type == CPP_PURGED)
- ++lexer->next_token;
+ putc ('\n', cp_lexer_debug_stream);
}
+#endif
/* Return true if the next token has the indicated TYPE. */
-static bool
+static inline bool
cp_lexer_next_token_is (cp_lexer* lexer, enum cpp_ttype type)
{
- cp_token *token;
-
- /* Peek at the next token. */
- token = cp_lexer_peek_token (lexer);
- /* Check to see if it has the indicated TYPE. */
- return token->type == type;
+ return cp_lexer_peek_token (lexer)->type == type;
}
/* Return true if the next token does not have the indicated TYPE. */
-static bool
+static inline bool
cp_lexer_next_token_is_not (cp_lexer* lexer, enum cpp_ttype type)
{
return !cp_lexer_next_token_is (lexer, type);
@@ -553,7 +518,7 @@ cp_lexer_next_token_is_not (cp_lexer* lexer, enum cpp_ttype type)
/* Return true if the next token is the indicated KEYWORD. */
-static bool
+static inline bool
cp_lexer_next_token_is_keyword (cp_lexer* lexer, enum rid keyword)
{
cp_token *token;
@@ -565,7 +530,10 @@ cp_lexer_next_token_is_keyword (cp_lexer* lexer, enum rid keyword)
}
/* Return a pointer to the Nth token in the token stream. If N is 1,
- then this is precisely equivalent to cp_lexer_peek_token. */
+ then this is precisely equivalent to cp_lexer_peek_token (except
+ that it is not inline). One would like to disallow that case, but
+ there is one case (cp_parser_nth_token_starts_template_id) where
+ the caller passes a variable for N and it might be 1. */
static cp_token *
cp_lexer_peek_nth_token (cp_lexer* lexer, size_t n)
@@ -575,6 +543,10 @@ cp_lexer_peek_nth_token (cp_lexer* lexer, size_t n)
/* N is 1-based, not zero-based. */
gcc_assert (n > 0);
+ if (cp_lexer_debugging_p (lexer))
+ fprintf (cp_lexer_debug_stream,
+ "cp_lexer: peeking ahead %ld at token: ", (long)n);
+
--n;
token = lexer->next_token;
while (n != 0)
@@ -584,39 +556,43 @@ cp_lexer_peek_nth_token (cp_lexer* lexer, size_t n)
--n;
}
+ if (cp_lexer_debugging_p (lexer))
+ {
+ cp_lexer_print_token (cp_lexer_debug_stream, token);
+ putc ('\n', cp_lexer_debug_stream);
+ }
+
return token;
}
-/* Consume the next token. The pointer returned is valid only until
- another token is read. Callers should preserve copy the token
- explicitly if they will need its value for a longer period of
- time. */
+/* Return the next token, and advance the lexer's next_token pointer
+ to point to the next non-purged token. */
static cp_token *
cp_lexer_consume_token (cp_lexer* lexer)
{
- cp_token *token;
+ cp_token *token = lexer->next_token;
- /* Skip over purged tokens if necessary. */
- if (lexer->next_token->type == CPP_PURGED)
- cp_lexer_skip_purged_tokens (lexer);
+ do
+ ++lexer->next_token;
+ while (lexer->next_token->type == CPP_PURGED);
- token = lexer->next_token++;
+ cp_lexer_set_source_position_from_token (token);
/* Provide debugging output. */
if (cp_lexer_debugging_p (lexer))
{
- fprintf (cp_lexer_debug_stream, "cp_lexer: consuming token: ");
+ fputs ("cp_lexer: consuming token: ", cp_lexer_debug_stream);
cp_lexer_print_token (cp_lexer_debug_stream, token);
- fprintf (cp_lexer_debug_stream, "\n");
+ putc ('\n', cp_lexer_debug_stream);
}
return token;
}
-/* Permanently remove the next token from the token stream. There
- must be a valid next token already; this token never reads
- additional tokens from the preprocessor. */
+/* Permanently remove the next token from the token stream, and
+ advance the next_token pointer to refer to the next non-purged
+ token. */
static void
cp_lexer_purge_token (cp_lexer *lexer)
@@ -626,6 +602,10 @@ cp_lexer_purge_token (cp_lexer *lexer)
tok->location = UNKNOWN_LOCATION;
tok->value = NULL_TREE;
tok->keyword = RID_MAX;
+
+ do
+ ++lexer->next_token;
+ while (lexer->next_token->type == CPP_PURGED);
}
/* Permanently remove all tokens after TOK, up to, but not
@@ -661,7 +641,6 @@ cp_lexer_handle_pragma (cp_lexer *lexer)
s.len = TREE_STRING_LENGTH (token->value);
s.text = (const unsigned char *) TREE_STRING_POINTER (token->value);
- cp_lexer_set_source_position_from_token (lexer, token);
cpp_handle_deferred_pragma (parse_in, &s);
/* Clearing token->value here means that we will get an ICE if we
@@ -1836,16 +1815,21 @@ cp_parser_is_keyword (cp_token* token, enum rid keyword)
return token->keyword == keyword;
}
-/* Issue the indicated error MESSAGE. */
+/* If not parsing tentatively, issue a diagnostic of the form
+ FILE:LINE: MESSAGE before TOKEN
+ where TOKEN is the next token in the input stream. MESSAGE
+ (specified by the caller) is usually of the form "expected
+ OTHER-TOKEN". */
static void
cp_parser_error (cp_parser* parser, const char* message)
{
- /* Output the MESSAGE -- unless we're parsing tentatively. */
if (!cp_parser_simulate_error (parser))
{
- cp_token *token;
- token = cp_lexer_peek_token (parser->lexer);
+ cp_token *token = cp_lexer_peek_token (parser->lexer);
+ /* This diagnostic makes more sense if it is tagged to the line
+ of the token we just peeked at. */
+ cp_lexer_set_source_position_from_token (token);
c_parse_error (message,
/* Because c_parser_error does not understand
CPP_KEYWORD, keywords are treated like
@@ -2453,6 +2437,36 @@ cp_parser_new (void)
return parser;
}
+/* Create a cp_lexer structure which will emit the tokens in CACHE
+ and push it onto the parser's lexer stack. This is used for delayed
+ parsing of in-class method bodies and default arguments, and should
+ not be confused with tentative parsing. */
+static void
+cp_parser_push_lexer_for_tokens (cp_parser *parser, cp_token_cache *cache)
+{
+ cp_lexer *lexer = cp_lexer_new_from_tokens (cache);
+ lexer->next = parser->lexer;
+ parser->lexer = lexer;
+
+ /* Move the current source position to that of the first token in the
+ new lexer. */
+ cp_lexer_set_source_position_from_token (lexer->next_token);
+}
+
+/* Pop the top lexer off the parser stack. This is never used for the
+ "main" lexer, only for those pushed by cp_parser_push_lexer_for_tokens. */
+static void
+cp_parser_pop_lexer (cp_parser *parser)
+{
+ cp_lexer *lexer = parser->lexer;
+ parser->lexer = lexer->next;
+ cp_lexer_destroy (lexer);
+
+ /* Put the current source position back where it was before this
+ lexer was pushed. */
+ cp_lexer_set_source_position_from_token (parser->lexer->next_token);
+}
+
/* Lexical conventions [gram.lex] */
/* Parse an identifier. Returns an IDENTIFIER_NODE representing the
@@ -2502,14 +2516,16 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok)
/* Try to avoid the overhead of creating and destroying an obstack
for the common case of just one string. */
- if (!cp_parser_is_string_literal (cp_lexer_peek_nth_token (parser->lexer, 2)))
+ if (!cp_parser_is_string_literal
+ (cp_lexer_peek_nth_token (parser->lexer, 2)))
{
+ cp_lexer_consume_token (parser->lexer);
+
str.text = (const unsigned char *)TREE_STRING_POINTER (tok->value);
str.len = TREE_STRING_LENGTH (tok->value);
count = 1;
if (tok->type == CPP_WSTRING)
wide = true;
- cp_lexer_consume_token (parser->lexer);
strs = &str;
}
@@ -2520,6 +2536,7 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok)
do
{
+ cp_lexer_consume_token (parser->lexer);
count++;
str.text = (unsigned char *)TREE_STRING_POINTER (tok->value);
str.len = TREE_STRING_LENGTH (tok->value);
@@ -2528,11 +2545,7 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok)
obstack_grow (&str_ob, &str, sizeof (cpp_string));
- /* We do it this way so that, if we have to issue semantic
- errors on this string literal, the source position will
- be that of the first token of the string. */
- tok = cp_lexer_peek_nth_token (parser->lexer, 2);
- cp_lexer_consume_token (parser->lexer);
+ tok = cp_lexer_peek_token (parser->lexer);
}
while (cp_parser_is_string_literal (tok));
@@ -6610,9 +6623,9 @@ cp_parser_declaration_seq_opt (cp_parser* parser)
{
/* A declaration consisting of a single semicolon is
invalid. Allow it unless we're being pedantic. */
- if (pedantic && !in_system_header)
- pedwarn ("extra `;'");
cp_lexer_consume_token (parser->lexer);
+ if (pedantic && !in_system_header)
+ pedwarn ("extra %<;%>");
continue;
}
@@ -8344,7 +8357,7 @@ cp_parser_template_id (cp_parser *parser,
/* If we find the sequence `[:' after a template-name, it's probably
a digraph-typo for `< ::'. Substitute the tokens and check if we can
parse correctly the argument list. */
- next_token = cp_lexer_peek_nth_token (parser->lexer, 1);
+ next_token = cp_lexer_peek_token (parser->lexer);
next_token_2 = cp_lexer_peek_nth_token (parser->lexer, 2);
if (next_token->type == CPP_OPEN_SQUARE
&& next_token->flags & DIGRAPH
@@ -9808,14 +9821,17 @@ cp_parser_enum_specifier (cp_parser* parser)
else
identifier = make_anon_name ();
- cp_lexer_consume_token (parser->lexer);
-
/* Issue an error message if type-definitions are forbidden here. */
cp_parser_check_type_definition (parser);
- /* Create the new type. */
+ /* Create the new type. We do this before consuming the opening brace
+ so the enum will be recorded as being on the line of its tag (or the
+ 'enum' keyword, if there is no tag). */
type = start_enum (identifier);
+ /* Consume the opening brace. */
+ cp_lexer_consume_token (parser->lexer);
+
/* If the next token is not '}', then there are some enumerators. */
if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_BRACE))
cp_parser_enumerator_list (parser, type);
@@ -12880,8 +12896,9 @@ cp_parser_member_declaration (cp_parser* parser)
name of the class. */
if (!decl_specifiers.any_specifiers_p)
{
- if (pedantic)
- pedwarn ("extra semicolon");
+ cp_token *token = cp_lexer_peek_token (parser->lexer);
+ if (pedantic && !token->in_system_header)
+ pedwarn ("%Hextra %<;%>", &token->location);
}
else
{
@@ -14979,25 +14996,37 @@ cp_parser_enclosed_template_argument_list (cp_parser* parser)
{
if (!saved_greater_than_is_operator_p)
{
- /* If we're in a nested template argument list, the '>>' has to be
- a typo for '> >'. We emit the error message, but we continue
- parsing and we push a '>' as next token, so that the argument
- list will be parsed correctly.. */
- cp_token* token;
- error ("`>>' should be `> >' within a nested template argument list");
- token = cp_lexer_peek_token (parser->lexer);
+ /* If we're in a nested template argument list, the '>>' has
+ to be a typo for '> >'. We emit the error message, but we
+ continue parsing and we push a '>' as next token, so that
+ the argument list will be parsed correctly. Note that the
+ global source location is still on the token before the
+ '>>', so we need to say explicitly where we want it. */
+ cp_token *token = cp_lexer_peek_token (parser->lexer);
+ error ("%H%<>>%> should be %<> >%> "
+ "within a nested template argument list",
+ &token->location);
+
+ /* ??? Proper recovery should terminate two levels of
+ template argument list here. */
token->type = CPP_GREATER;
}
else
{
- /* If this is not a nested template argument list, the '>>' is
- a typo for '>'. Emit an error message and continue. */
- error ("spurious `>>', use `>' to terminate a template argument list");
+ /* If this is not a nested template argument list, the '>>'
+ is a typo for '>'. Emit an error message and continue.
+ Same deal about the token location, but here we can get it
+ right by consuming the '>>' before issuing the diagnostic. */
cp_lexer_consume_token (parser->lexer);
+ error ("spurious %<>>%>, use %<>%> to terminate "
+ "a template argument list");
}
}
- else if (!cp_parser_require (parser, CPP_GREATER, "`>'"))
- error ("missing `>' to terminate the template argument list");
+ else if (!cp_lexer_next_token_is (parser->lexer, CPP_GREATER))
+ error ("missing %<>%> to terminate the template argument list");
+ else
+ /* It's what we want, a '>'; consume it. */
+ cp_lexer_consume_token (parser->lexer);
/* The `>' token might be a greater-than operator again now. */
parser->greater_than_is_operator_p
= saved_greater_than_is_operator_p;
@@ -15016,8 +15045,6 @@ cp_parser_enclosed_template_argument_list (cp_parser* parser)
static void
cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function)
{
- cp_lexer *saved_lexer;
-
/* If this member is a template, get the underlying
FUNCTION_DECL. */
if (DECL_FUNCTION_TEMPLATE_P (member_function))
@@ -15054,15 +15081,8 @@ cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function)
if (function_scope)
push_function_context_to (function_scope);
- /* Save away the current lexer. */
- saved_lexer = parser->lexer;
- /* Make a new lexer to feed us the tokens saved for this function. */
- parser->lexer = cp_lexer_new_from_tokens (tokens);
- parser->lexer->next = saved_lexer;
-
- /* Set the current source position to be the location of the first
- token in the saved inline body. */
- cp_lexer_peek_token (parser->lexer);
+ /* Push the body of the function onto the lexer stack. */
+ cp_parser_push_lexer_for_tokens (parser, tokens);
/* Let the front end know that we going to be defining this
function. */
@@ -15076,8 +15096,7 @@ cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function)
/* Leave the scope of the containing function. */
if (function_scope)
pop_function_context_from (function_scope);
- /* Restore the lexer. */
- parser->lexer = saved_lexer;
+ cp_parser_pop_lexer (parser);
}
/* Remove any template parameters from the symbol table. */
@@ -15117,10 +15136,8 @@ cp_parser_save_default_args (cp_parser* parser, tree decl)
static void
cp_parser_late_parsing_default_args (cp_parser *parser, tree fn)
{
- cp_lexer *saved_lexer;
- cp_token_cache *tokens;
bool saved_local_variables_forbidden_p;
- tree parameters;
+ tree parm;
/* While we're parsing the default args, we might (due to the
statement expression extension) encounter more classes. We want
@@ -15129,30 +15146,28 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn)
parser->unparsed_functions_queues
= tree_cons (NULL_TREE, NULL_TREE, parser->unparsed_functions_queues);
- for (parameters = TYPE_ARG_TYPES (TREE_TYPE (fn));
- parameters;
- parameters = TREE_CHAIN (parameters))
+ /* Local variable names (and the `this' keyword) may not appear
+ in a default argument. */
+ saved_local_variables_forbidden_p = parser->local_variables_forbidden_p;
+ parser->local_variables_forbidden_p = true;
+
+ for (parm = TYPE_ARG_TYPES (TREE_TYPE (fn));
+ parm;
+ parm = TREE_CHAIN (parm))
{
- if (!TREE_PURPOSE (parameters)
- || TREE_CODE (TREE_PURPOSE (parameters)) != DEFAULT_ARG)
- continue;
+ cp_token_cache *tokens;
- /* Save away the current lexer. */
- saved_lexer = parser->lexer;
- /* Create a new one, using the tokens we have saved. */
- tokens = DEFARG_TOKENS (TREE_PURPOSE (parameters));
- parser->lexer = cp_lexer_new_from_tokens (tokens);
+ if (!TREE_PURPOSE (parm)
+ || TREE_CODE (TREE_PURPOSE (parm)) != DEFAULT_ARG)
+ continue;
- /* Set the current source position to be the location of the
- first token in the default argument. */
- cp_lexer_peek_token (parser->lexer);
+ /* Push the saved tokens for the default argument onto the parser's
+ lexer stack. */
+ tokens = DEFARG_TOKENS (TREE_PURPOSE (parm));
+ cp_parser_push_lexer_for_tokens (parser, tokens);
- /* Local variable names (and the `this' keyword) may not appear
- in a default argument. */
- saved_local_variables_forbidden_p = parser->local_variables_forbidden_p;
- parser->local_variables_forbidden_p = true;
- /* Parse the assignment-expression. */
- TREE_PURPOSE (parameters) = cp_parser_assignment_expression (parser);
+ /* Parse the assignment-expression. */
+ TREE_PURPOSE (parm) = cp_parser_assignment_expression (parser);
/* If the token stream has not been completely used up, then
there was extra junk after the end of the default
@@ -15160,11 +15175,13 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn)
if (!cp_lexer_next_token_is (parser->lexer, CPP_EOF))
cp_parser_error (parser, "expected `,'");
- /* Restore saved state. */
- parser->lexer = saved_lexer;
- parser->local_variables_forbidden_p = saved_local_variables_forbidden_p;
+ /* Revert to the main lexer. */
+ cp_parser_pop_lexer (parser);
}
+ /* Restore the state of local_variables_forbidden_p. */
+ parser->local_variables_forbidden_p = saved_local_variables_forbidden_p;
+
/* Restore the queue. */
parser->unparsed_functions_queues
= TREE_CHAIN (parser->unparsed_functions_queues);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index dd233c1..b6f1ca1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,73 @@
+2004-09-23 Zack Weinberg <zack@codesourcery.com>
+
+ * g++.dg/ext/complit1.C
+ * g++.dg/other/error2.C
+ * g++.dg/other/nontype-1.C
+ * g++.dg/parse/crash11.C
+ * g++.dg/parse/crash12.C
+ * g++.dg/parse/error15.C
+ * g++.dg/parse/error4.C
+ * g++.dg/parse/tmpl-outside1.C
+ * g++.dg/parse/too-many-tmpl-args1.C
+ * g++.dg/template/dependent-expr3.C
+ * g++.dg/template/error10.C
+ * g++.dg/template/instantiate1.C
+ * g++.dg/template/vtable2.C
+ * g++.dg/warn/Wshadow-1.C
+ * g++.dg/warn/weak1.C
+ * g++.old-deja/g++.brendan/crash16.C
+ * g++.old-deja/g++.brendan/crash18.C
+ * g++.old-deja/g++.brendan/crash48.C
+ * g++.old-deja/g++.brendan/crash49.C
+ * g++.old-deja/g++.brendan/crash55.C
+ * g++.old-deja/g++.brendan/crash56.C
+ * g++.old-deja/g++.brendan/crash8.C
+ * g++.old-deja/g++.brendan/enum11.C
+ * g++.old-deja/g++.brendan/enum8.C
+ * g++.old-deja/g++.brendan/enum9.C
+ * g++.old-deja/g++.brendan/friend3.C
+ * g++.old-deja/g++.brendan/misc14.C
+ * g++.old-deja/g++.bugs/900402_02.C
+ * g++.old-deja/g++.bugs/900404_03.C
+ * g++.old-deja/g++.bugs/900404_04.C
+ * g++.old-deja/g++.bugs/900428_03.C
+ * g++.old-deja/g++.jason/crash4.C
+ * g++.old-deja/g++.jason/overload21.C
+ * g++.old-deja/g++.jason/redecl1.C
+ * g++.old-deja/g++.jason/report.C
+ * g++.old-deja/g++.jason/rfg10.C
+ * g++.old-deja/g++.jason/template30.C
+ * g++.old-deja/g++.law/arm12.C
+ * g++.old-deja/g++.law/ctors5.C
+ * g++.old-deja/g++.law/cvt20.C
+ * g++.old-deja/g++.law/init10.C
+ * g++.old-deja/g++.law/init8.C
+ * g++.old-deja/g++.law/visibility17.C
+ * g++.old-deja/g++.law/visibility7.C
+ * g++.old-deja/g++.mike/net8.C
+ * g++.old-deja/g++.mike/p646.C
+ * g++.old-deja/g++.mike/p700.C
+ * g++.old-deja/g++.mike/p701.C
+ * g++.old-deja/g++.mike/p811.C
+ * g++.old-deja/g++.ns/template13.C
+ * g++.old-deja/g++.other/array3.C
+ * g++.old-deja/g++.other/crash25.C
+ * g++.old-deja/g++.other/dtor3.C
+ * g++.old-deja/g++.other/dtor4.C
+ * g++.old-deja/g++.other/main1.C
+ * g++.old-deja/g++.other/warn7.C
+ * g++.old-deja/g++.pt/crash11.C
+ * g++.old-deja/g++.pt/crash36.C
+ * g++.old-deja/g++.pt/spec22.C
+ * g++.old-deja/g++.pt/spec9.C
+ * g++.old-deja/g++.pt/ttp52.C
+ * g++.old-deja/g++.robertl/eb103.C
+ * g++.old-deja/g++.robertl/eb121.C
+ * g++.old-deja/g++.robertl/eb22.C
+ * g++.old-deja/g++.robertl/eb8.C:
+ Update locations and/or regexps of dg-error markers.
+ Remove markers for some bogus messages that are no longer issued.
+
2004-09-23 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/execute/builtins/strcpy-2.c: New test.
@@ -10,38 +80,38 @@
2004-09-23 Dorit Naishlos <dorit@il.ibm.com>
- * gcc.dg/vect/vect-27.c: Now vectorized on altivec.
- * gcc.dg/vect/vect-29.c: Now vectorized on altivec.
- * gcc.dg/vect/vect-48.c: Now vectorized on altivec.
- * gcc.dg/vect/vect-56.c: Now vectorized on altivec.
- * gcc.dg/vect/vect-72.c: New test for altivec and sse2.
- * gcc.dg/vect/vect-77.c: Now vectorized on altivec.
-
- * gcc.dg/vect/vect-27a.c: New test for altivec and mmx.
- * gcc.dg/vect/vect-29a.c: New test for altivec and mmx.
- * gcc.dg/vect/vect-48a.c: New test for altivec and mmx.
- * gcc.dg/vect/vect-56a.c: New test for altivec and mmx.
- * gcc.dg/vect/vect-72a.c: New test for altivec and mmx.
- * gcc.dg/vect/vect-77a.c: New test for altivec and mmx.
-
- * gcc.dg/vect/vect-13.c: Change to run test instead of compile.
-
- * gcc.dg/vect/vect-44.c: Check additional cases.
- * gcc.dg/vect/vect-48.c: Check additional cases.
-
- * gcc.dg/vect/vect-26.c: Use sse2 instead of sse.
- * gcc.dg/vect/vect-27.c: Use sse2 instead of sse.
- * gcc.dg/vect/vect-28.c: Use sse2 instead of sse.
- * gcc.dg/vect/vect-29.c: Use sse2 instead of sse.
- * gcc.dg/vect/vect-4?.c: Use sse2 instead of sse.
- * gcc.dg/vect/vect-75.c: Use sse2 instead of sse.
- * gcc.dg/vect/vect-76.c: Use sse2 instead of sse.
- * gcc.dg/vect/vect-77.c: Use sse2 instead of sse.
- * gcc.dg/vect/vect-78.c: Use sse2 instead of sse.
-
- * gcc.dg/vect/vect-5?.c: Use sse2 instead of sse. Add return 0.
- * gcc.dg/vect/vect-60.c: Use sse2 instead of sse. Add return 0.
- * gcc.dg/vect/vect-61.c: Use sse2 instead of sse. Add return 0.
+ * gcc.dg/vect/vect-27.c: Now vectorized on altivec.
+ * gcc.dg/vect/vect-29.c: Now vectorized on altivec.
+ * gcc.dg/vect/vect-48.c: Now vectorized on altivec.
+ * gcc.dg/vect/vect-56.c: Now vectorized on altivec.
+ * gcc.dg/vect/vect-72.c: New test for altivec and sse2.
+ * gcc.dg/vect/vect-77.c: Now vectorized on altivec.
+
+ * gcc.dg/vect/vect-27a.c: New test for altivec and mmx.
+ * gcc.dg/vect/vect-29a.c: New test for altivec and mmx.
+ * gcc.dg/vect/vect-48a.c: New test for altivec and mmx.
+ * gcc.dg/vect/vect-56a.c: New test for altivec and mmx.
+ * gcc.dg/vect/vect-72a.c: New test for altivec and mmx.
+ * gcc.dg/vect/vect-77a.c: New test for altivec and mmx.
+
+ * gcc.dg/vect/vect-13.c: Change to run test instead of compile.
+
+ * gcc.dg/vect/vect-44.c: Check additional cases.
+ * gcc.dg/vect/vect-48.c: Check additional cases.
+
+ * gcc.dg/vect/vect-26.c: Use sse2 instead of sse.
+ * gcc.dg/vect/vect-27.c: Use sse2 instead of sse.
+ * gcc.dg/vect/vect-28.c: Use sse2 instead of sse.
+ * gcc.dg/vect/vect-29.c: Use sse2 instead of sse.
+ * gcc.dg/vect/vect-4?.c: Use sse2 instead of sse.
+ * gcc.dg/vect/vect-75.c: Use sse2 instead of sse.
+ * gcc.dg/vect/vect-76.c: Use sse2 instead of sse.
+ * gcc.dg/vect/vect-77.c: Use sse2 instead of sse.
+ * gcc.dg/vect/vect-78.c: Use sse2 instead of sse.
+
+ * gcc.dg/vect/vect-5?.c: Use sse2 instead of sse. Add return 0.
+ * gcc.dg/vect/vect-60.c: Use sse2 instead of sse. Add return 0.
+ * gcc.dg/vect/vect-61.c: Use sse2 instead of sse. Add return 0.
2004-09-23 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
@@ -93,7 +163,7 @@
PR c++/15049
* g++.dg/other/anon3.C: New.
-
+
2004-09-21 Roger Sayle <roger@eyesopen.com>
PR c++/7503
@@ -115,7 +185,7 @@
2004-09-20 Andrew Pinski <pinskia@physics.uc.edu>
- PR tree-opt/17558
+ PR tree-opt/17558
* gcc.c-torture/compile/pr17558.c: New test.
2004-09-20 Richard Sandiford <rsandifo@redhat.com>
@@ -138,7 +208,7 @@
2004-09-20 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/15750
- * gfortran.fortran-torture/execute/iolength_2.f90: New test.
+ * gfortran.fortran-torture/execute/iolength_2.f90: New test.
2004-09-20 Ira Rosen <irar@il.ibm.com>
@@ -200,7 +270,7 @@
2004-09-17 Devang Patel <dpatel@apple.com>
* gcc.dg/20040813-1.c: New test.
-
+
2004-09-17 Diego Novillo <dnovillo@redhat.com>
PR tree-optimization/17273
@@ -225,7 +295,7 @@
PR c++/16002
* g++.dg/template/error18.C: New test.
-
+
PR c++/16029
* g++.dg/warn/Wunused-8.C: New test.
@@ -320,7 +390,7 @@
* gcc.dg/declspec-12.c: New test.
2004-09-14 Bud Davis <bdavis9659@comcast.net>
-
+
* gfortran.dg/pr17090.f90: Add directives to test.
2004-09-14 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
@@ -331,7 +401,7 @@
PR c++/16162
* g++.dg/template/decl2.C: New test.
-
+
2004-09-13 Bud Davis <bdavis9659@comcast.net>
PR fortran/17090
@@ -345,7 +415,7 @@
PR c++/16716
* g++.dg/parse/crash17.C: New test.
-
+
PR c++/17327
* g++.dg/template/enum3.C: New test.
diff --git a/gcc/testsuite/g++.dg/ext/complit1.C b/gcc/testsuite/g++.dg/ext/complit1.C
index bcca8ac..ab2b038 100644
--- a/gcc/testsuite/g++.dg/ext/complit1.C
+++ b/gcc/testsuite/g++.dg/ext/complit1.C
@@ -11,6 +11,6 @@ public:
};
Foo::Foo(int v0, int v1)
- : val_((int[]) {v0, v1})
-{ // { dg-error "" "" }
+ : val_((int[]) {v0, v1}) // { dg-error "" "" }
+{
}
diff --git a/gcc/testsuite/g++.dg/other/error2.C b/gcc/testsuite/g++.dg/other/error2.C
index ea6c520..36089e4 100644
--- a/gcc/testsuite/g++.dg/other/error2.C
+++ b/gcc/testsuite/g++.dg/other/error2.C
@@ -10,5 +10,5 @@ namespace N
class B { friend void operator>>(int, class B); };
class N { friend void operator>>(int,class N); };
}
-void N::operator>>(int, N::B) // { dg-error "N::N::B" }
-{ } // { dg-error "" "" }
+void N::operator>>(int, N::B) // { dg-error "N::N::B|N::operator>>" }
+{ }
diff --git a/gcc/testsuite/g++.dg/other/nontype-1.C b/gcc/testsuite/g++.dg/other/nontype-1.C
index 5a1fcd9..11bbfb8 100644
--- a/gcc/testsuite/g++.dg/other/nontype-1.C
+++ b/gcc/testsuite/g++.dg/other/nontype-1.C
@@ -2,6 +2,6 @@ template <class Op>
bool asfun(Op f,
Op::first_argument_type a, // { dg-error "not a type" }
Op::second_argument_type b) // { dg-error "not a type" }
-{ // { dg-error "no type" }
+{
return Op(a, b);
}
diff --git a/gcc/testsuite/g++.dg/parse/crash11.C b/gcc/testsuite/g++.dg/parse/crash11.C
index e6db364..4fa7ff2 100644
--- a/gcc/testsuite/g++.dg/parse/crash11.C
+++ b/gcc/testsuite/g++.dg/parse/crash11.C
@@ -19,8 +19,8 @@ struct B
template <typename T>
struct Template
{
- typedef typename A<A<TP>::Template>
- ::template Template<T>::Type Type; // { dg-error "mismatch|class template|unqualified-id" }
+ typedef typename A<A<TP>::Template> // { dg-error "mismatch|class template" }
+ ::template Template<T>::Type Type; // { dg-error "unqualified-id" }
};
};
template <typename T>
diff --git a/gcc/testsuite/g++.dg/parse/crash12.C b/gcc/testsuite/g++.dg/parse/crash12.C
index cf947b2..a936e8c 100644
--- a/gcc/testsuite/g++.dg/parse/crash12.C
+++ b/gcc/testsuite/g++.dg/parse/crash12.C
@@ -14,8 +14,8 @@ public:
};
template <class _Tp>
-inline counted_ptr<_Tp>::counted_ptr(class auto_ptr& __a) // { dg-error "required" }
-{ // { dg-error "no type|not match|template" }
+inline counted_ptr<_Tp>::counted_ptr(class auto_ptr& __a) // { dg-error "required|not match|template" }
+{
}
template <class _Tp>
diff --git a/gcc/testsuite/g++.dg/parse/error15.C b/gcc/testsuite/g++.dg/parse/error15.C
index fd70382..e49e2114 100644
--- a/gcc/testsuite/g++.dg/parse/error15.C
+++ b/gcc/testsuite/g++.dg/parse/error15.C
@@ -35,5 +35,3 @@ struct C
};
// { dg-bogus "" "bogus excess errors in declaration" { xfail *-*-* } 16 }
-// { dg-bogus "" "bogus excess errors in declaration" { xfail *-*-* } 24 }
-// { dg-bogus "" "bogus excess errors in declaration" { xfail *-*-* } 34 }
diff --git a/gcc/testsuite/g++.dg/parse/error4.C b/gcc/testsuite/g++.dg/parse/error4.C
index 511209d..aa1bfad 100644
--- a/gcc/testsuite/g++.dg/parse/error4.C
+++ b/gcc/testsuite/g++.dg/parse/error4.C
@@ -3,5 +3,5 @@
struct X {
virtual void f(int,
itn, // { dg-error "declared" }
- int); // { dg-error "" }
+ int);
};
diff --git a/gcc/testsuite/g++.dg/parse/tmpl-outside1.C b/gcc/testsuite/g++.dg/parse/tmpl-outside1.C
index 07c89e2..4b8bb72 100644
--- a/gcc/testsuite/g++.dg/parse/tmpl-outside1.C
+++ b/gcc/testsuite/g++.dg/parse/tmpl-outside1.C
@@ -8,3 +8,4 @@ struct X
};
typedef X::template Y<0> y; // { dg-error "template" }
+// { dg-bogus "with no type" "" { xfail *-*-* } 10 }
diff --git a/gcc/testsuite/g++.dg/parse/too-many-tmpl-args1.C b/gcc/testsuite/g++.dg/parse/too-many-tmpl-args1.C
index 30c2952..4d98e75 100644
--- a/gcc/testsuite/g++.dg/parse/too-many-tmpl-args1.C
+++ b/gcc/testsuite/g++.dg/parse/too-many-tmpl-args1.C
@@ -2,8 +2,8 @@
// Origin: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
// { dg-do compile }
-template <typename T> class A
-{ // { dg-error "" }
+template <typename T> class A // { dg-error "" }
+{
struct B;
template <typename U> friend typename A<U,void>::B foo(); // { dg-error "" }
};
diff --git a/gcc/testsuite/g++.dg/template/dependent-expr3.C b/gcc/testsuite/g++.dg/template/dependent-expr3.C
index 2e8b805..97fddbd 100644
--- a/gcc/testsuite/g++.dg/template/dependent-expr3.C
+++ b/gcc/testsuite/g++.dg/template/dependent-expr3.C
@@ -10,5 +10,5 @@ template <typename K> struct Y : K {
template <class T> struct Z {
S< (bool)(&static_cast<Y<T> *>(0)->x == 0) > // { dg-error "" }
- s; // { dg-error "" }
+ s;
};
diff --git a/gcc/testsuite/g++.dg/template/error10.C b/gcc/testsuite/g++.dg/template/error10.C
index a25c4bb..ccb577d 100644
--- a/gcc/testsuite/g++.dg/template/error10.C
+++ b/gcc/testsuite/g++.dg/template/error10.C
@@ -9,8 +9,8 @@
template <class T>
class A {};
-A<A<int>> blah; // { dg-error "should be `> >' within" }
-A<int>> blah2; // { dg-error "spurious `>>'" }
+A<A<int>> blah; // { dg-error "should be '> >' within" }
+A<int>> blah2; // { dg-error "spurious '>>'" }
/*
@@ -66,5 +66,5 @@ struct K {};
void KFunc(void);
-A<K<&KFunc>> k1; // { dg-error "should be `> >' within" }
-K<&KFunc>> k2; // { dg-error "spurious `>>'" }
+A<K<&KFunc>> k1; // { dg-error "should be '> >' within" }
+K<&KFunc>> k2; // { dg-error "spurious '>>'" }
diff --git a/gcc/testsuite/g++.dg/template/instantiate1.C b/gcc/testsuite/g++.dg/template/instantiate1.C
index e4e7bc9..311344d 100644
--- a/gcc/testsuite/g++.dg/template/instantiate1.C
+++ b/gcc/testsuite/g++.dg/template/instantiate1.C
@@ -16,6 +16,6 @@ template <class T> struct Z { // { dg-error "declaration" }
Y<Z<T> > y; // { dg-error "instantiated" }
};
-struct ZZ : Z<int>
-{ // { dg-error "instantiated" }
+struct ZZ : Z<int> // { dg-error "instantiated" }
+{
};
diff --git a/gcc/testsuite/g++.dg/template/vtable2.C b/gcc/testsuite/g++.dg/template/vtable2.C
index 9f2bf0b..3bcc1ac 100644
--- a/gcc/testsuite/g++.dg/template/vtable2.C
+++ b/gcc/testsuite/g++.dg/template/vtable2.C
@@ -11,8 +11,8 @@
template <class T> struct inner {};
template <class T> struct parent {
- virtual void f()
- { parent<inner<T> > p; }; // { dg-error "instantiation depth" }
+ virtual void f() // { dg-error "instantiation depth" }
+ { parent<inner<T> > p; };
};
template struct parent<int>;
diff --git a/gcc/testsuite/g++.dg/warn/Wshadow-1.C b/gcc/testsuite/g++.dg/warn/Wshadow-1.C
index 2ea076e..1647a01 100644
--- a/gcc/testsuite/g++.dg/warn/Wshadow-1.C
+++ b/gcc/testsuite/g++.dg/warn/Wshadow-1.C
@@ -21,8 +21,8 @@ struct status // { dg-bogus "shadowed declaration" }
int decl1; // { dg-warning "shadowed declaration" }
int decl2; // { dg-warning "shadowed declaration" }
void foo (struct status &status,// { dg-bogus "shadows a global decl" }
- double decl1)
-{ // { dg-warning "shadows a global decl" }
+ double decl1) // { dg-warning "shadows a global decl" }
+{
}
void foo1 (int d)
diff --git a/gcc/testsuite/g++.dg/warn/weak1.C b/gcc/testsuite/g++.dg/warn/weak1.C
index dbc0dff..84d08fb 100644
--- a/gcc/testsuite/g++.dg/warn/weak1.C
+++ b/gcc/testsuite/g++.dg/warn/weak1.C
@@ -1,6 +1,5 @@
// { dg-do run }
-// { dg-do compile { target *-*-coff i?86-pc-cygwin } }
-// { dg-warning "weak declaration" "COFF format does not support weak" { target *-*-coff i?86-pc-cygwin powerpc-ibm-aix4* rs6000-ibm-aix4* } 5 }
+// { dg-require-weak "" }
extern void foo (void) __attribute__ ((weak));
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash16.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash16.C
index 1c81d19..8b91e6b 100644
--- a/gcc/testsuite/g++.old-deja/g++.brendan/crash16.C
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash16.C
@@ -1,12 +1,12 @@
-// { dg-do assemble { xfail *-*-* } }
+// { dg-do compile }
// GROUPS passed old-abort
class Graph {
public:
unsigned char N;
- Graph(void) {}; // { dg-error "" } previously defined here
+ Graph(void) {}; // { dg-error "previously defined here" }
}
-Graph::Graph(void)
-{ N = 10;// { dg-error "" } return type.*
+Graph::Graph(void) // { dg-error "return type|redefinition" }
+{ N = 10;
}
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash18.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash18.C
index 6691081..119ba46 100644
--- a/gcc/testsuite/g++.old-deja/g++.brendan/crash18.C
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash18.C
@@ -1,4 +1,4 @@
-// { dg-do assemble }
+// { dg-do compile }
// GROUPS passed old-abort
typedef int element;
class Pix {
@@ -7,11 +7,12 @@ public:
Pix(const Pix&);
// Friend functions so that v == x works as does x == v works
- friend int operator==(void *v, const Pix& x)
- { return v == index; }// { dg-error "" } .*
- friend int operator==(void *v, const Pix& x)
- { return v != index; }// { dg-error "" } .*
+ friend int operator==(void *v, const Pix& x) // { dg-error "previously" }
+ { return v == index; } // { dg-error "from this location" }
+ // ??? should be operator!=
+ friend int operator==(void *v, const Pix& x) // { dg-error "redefinition" }
+ { return v != index; }
private:
// friend class List<T>;
- element *index; // { dg-error "" } invalid use of member
+ element *index; // { dg-error "invalid use of non-static data member" }
};
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash48.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash48.C
index b3972bd..bdb522a 100644
--- a/gcc/testsuite/g++.old-deja/g++.brendan/crash48.C
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash48.C
@@ -1,22 +1,22 @@
-// { dg-do assemble }
+// { dg-do compile }
// GROUPS passed old-abort
-class internal { // { dg-error "" } candidates are
+class internal { // { dg-error "internal::internal" }
int field;
int anotherfield;
};
-class bug { // { dg-error "" } several errors
+class bug { // { dg-error "bug::bug" }
internal* numbers;
bug(int size);
};
-bug::bug(int size)
-{ // { dg-error "" } candidates
- numbers = new internal(size * size);// { dg-error "" } no match.*
+bug::bug(int size) // { dg-error "bug::bug" }
+{
+ numbers = new internal(size * size);// { dg-error "no match" }
}
int
main()
{
- bug test;// { dg-error "" } no match
+ bug test; // { dg-error "no match" }
}
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash49.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash49.C
index 95b57dc..e0664da 100644
--- a/gcc/testsuite/g++.old-deja/g++.brendan/crash49.C
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash49.C
@@ -5,8 +5,8 @@
const int keys = 10;
const int key[keys] = {6, key[1], 2, keys, 1, 7, 6, key[2], key[8]};
-void main()
-{ // { dg-error "" } return type for main
+void main() // { dg-error "must return .int" }
+{
for(int i = 0; i < keys;) std::cout << key[i++] << " ";
std::endl(std::cout);
}
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash55.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash55.C
index 29533bc..cd952af 100644
--- a/gcc/testsuite/g++.old-deja/g++.brendan/crash55.C
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash55.C
@@ -1,10 +1,10 @@
-// { dg-do assemble }
+// { dg-do compile }
// GROUPS passed old-abort
- extern f(int);// { dg-error "" } ambiguates.*
+ extern int f(int); // { dg-error "ambiguates" }
- int& f(int x)
- {// { dg-error "" } new declaration.*
- int local;// { dg-error "" } warning
+ int& f(int x) // { dg-error "new declaration" }
+ {
+ int local; // { dg-error "reference to local" }
local = x+2;
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C
index 243a2b6..57c7c11 100644
--- a/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C
@@ -20,16 +20,16 @@ public:
class Vix {
public:
Vix();
- friend int operator==(void *v, const Vix& x)
- { return v == x.item; }// { dg-error "" } list of candidates
- friend int operator==(const Vix& x, void *v)
- { return v == x.item; }// { dg-error "" } candidate for call
+ friend int operator==(void *v, const Vix& x) // { dg-error "operator==" }
+ { return v == x.item; }
+ friend int operator==(const Vix& x, void *v) // { dg-error "operator==" }
+ { return v == x.item; }
friend int operator!=(void *v, const Vix& x)
{ return v != x.item; }
friend int operator!=(const Vix& x, void *v)
{ return v != x.item; }
- friend int operator==(const Vix& x1, const Vix& x2)
- { return x1.owner == x2.owner && x1.item == x2.item; }// { dg-error "" } candidate for call
+ friend int operator==(const Vix& x1, const Vix& x2) // { dg-error "operator==" }
+ { return x1.owner == x2.owner && x1.item == x2.item; }
friend int operator!=(const Vix& x1, const Vix& x2)
{ return x1.owner != x2.owner || x1.item != x2.item; }
bool first;
@@ -343,8 +343,8 @@ operator>=(const SetLD<T>& a, const SetLD<T>& b)
class String { };
class IcaseString: public String { };
template <> class SetLD< IcaseString >: public SetLD< String > { public: SetLD (): SetLD< String >() { }; SetLD (const ListD< IcaseString >& other): SetLD< String >() { ListD< IcaseString >::Vix x; for (other.first(x); 0 != x; other.next(x)) add(other(x)); }; SetLD (const SetLD & other): SetLD< String >(other) { }; const IcaseString & operator()(const Vix& x) const { return ( IcaseString &) SetLD< String >::operator()(x); } }; typedef SetLD< String > SetLD_String_IcaseString_old_tmp99; typedef SetLD< IcaseString > SetLD_String_IcaseString_new_tmp99;
-inline int operator== (const SetLD_String_IcaseString_new_tmp99& a, const SetLD_String_IcaseString_new_tmp99& b)
-{// { dg-error "" } candidate for call
+inline int operator== (const SetLD_String_IcaseString_new_tmp99& a, const SetLD_String_IcaseString_new_tmp99& b) // { dg-error "operator==" }
+{
const SetLD_String_IcaseString_old_tmp99& oa = a;
const SetLD_String_IcaseString_old_tmp99& ob = b;
return operator== (oa, ob); }
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash8.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash8.C
index 06bde56..4872083 100644
--- a/gcc/testsuite/g++.old-deja/g++.brendan/crash8.C
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash8.C
@@ -1,12 +1,12 @@
-// { dg-do assemble }
+// { dg-do compile }
// GROUPS passed old-abort
template<int a, int b>
-class Elvis
-{ // { dg-error "" } in template.*
+class Elvis // { dg-error "class Elvis" }
+{
} ;
template<int a>
-class Elvis<0>
-{ // { dg-error "" } incorrect number of parameters
+class Elvis<0> // { dg-error "wrong number of template arguments" }
+{
int geta() { return a ; }
} ;
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/enum11.C b/gcc/testsuite/g++.old-deja/g++.brendan/enum11.C
index 233c387..009333a 100644
--- a/gcc/testsuite/g++.old-deja/g++.brendan/enum11.C
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/enum11.C
@@ -6,8 +6,8 @@ class X
{
oneMask = 0x0000FFFF,
twoMask = 0x000F0000,
- thiMask = 0xFFF00000,
- }; // { dg-error "" } comma
+ thiMask = 0xFFF00000, // { dg-error "comma at end" }
+ };
unsigned int foo;
public:
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/enum8.C b/gcc/testsuite/g++.old-deja/g++.brendan/enum8.C
index e9e6907..ecf6fbf 100644
--- a/gcc/testsuite/g++.old-deja/g++.brendan/enum8.C
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/enum8.C
@@ -6,8 +6,8 @@ class foo1
enum foo1_enum
{
ENUM1,
- ENUM2,
- }; // { dg-error "" } comma
+ ENUM2, // { dg-error "comma at end" }
+ };
};
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/enum9.C b/gcc/testsuite/g++.old-deja/g++.brendan/enum9.C
index 43420cf..88ecc73 100644
--- a/gcc/testsuite/g++.old-deja/g++.brendan/enum9.C
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/enum9.C
@@ -2,8 +2,8 @@
// GROUPS passed enums
enum fig {
figgy,
- pudding,
-}; // { dg-error "" } comma
+ pudding, // { dg-error "comma at end" }
+};
class X {
public:
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/friend3.C b/gcc/testsuite/g++.old-deja/g++.brendan/friend3.C
index 0df4498..ecd85b4 100644
--- a/gcc/testsuite/g++.old-deja/g++.brendan/friend3.C
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/friend3.C
@@ -5,8 +5,8 @@ class B {
friend class A;
enum {
- bEnum = 1,
- }; // { dg-error "" } comma
+ bEnum = 1, // { dg-error "comma at end" }
+ };
int bArray[ bEnum ];
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/misc14.C b/gcc/testsuite/g++.old-deja/g++.brendan/misc14.C
index d14d32b..09242a4 100644
--- a/gcc/testsuite/g++.old-deja/g++.brendan/misc14.C
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/misc14.C
@@ -3,10 +3,11 @@
class X {
public:
enum e {
- New,// { dg-error "" } conflicts with other.*
- }; // { dg-error "" } comma
+ New // { dg-error "conflicts with previous" }
+ , // { dg-error "comma at end" }
+ };
- static int New(int);// { dg-error "" } declaration.*
+ static int New(int); // { dg-error "declaration of" }
};
int main() {}
diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900402_02.C b/gcc/testsuite/g++.old-deja/g++.bugs/900402_02.C
index e1740b1..d3cf5ad 100644
--- a/gcc/testsuite/g++.old-deja/g++.bugs/900402_02.C
+++ b/gcc/testsuite/g++.old-deja/g++.bugs/900402_02.C
@@ -6,17 +6,17 @@
// keywords: arrays, array bound, zero length
-typedef int array_type[0]; // { dg-error "" } gets warning only
+typedef int array_type[0]; // { dg-error "zero-size array" }
-int array_object_1[0]; // { dg-error "" } gets warning only
+int array_object_1[0]; // { dg-error "zero-size array" }
-void function_0 (int formal_array[0])
-{ // { dg-error "" } gets warning only
+void function_0 (int formal_array[0]) // { dg-error "zero-size array" }
+{
}
void function_2 ()
{
- int local_object_array_0[0]; // { dg-error "" } gets warning only
+ int local_object_array_0[0]; // { dg-error "zero-size array" }
}
int main () { return 0; }
diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900404_03.C b/gcc/testsuite/g++.old-deja/g++.bugs/900404_03.C
index be258fc..726f9ef 100644
--- a/gcc/testsuite/g++.old-deja/g++.bugs/900404_03.C
+++ b/gcc/testsuite/g++.old-deja/g++.bugs/900404_03.C
@@ -8,13 +8,13 @@
// keywords: overloading, ambiguity, resolution
-void function0 (int i, char c)
-{ // { dg-error "" }
+void function0 (int i, char c) // { dg-error "function0" }
+{
i = c;
}
-void function0 (char c, int i)
-{ // { dg-error "" }
+void function0 (char c, int i) // { dg-error "function0" }
+{
i = c;
}
@@ -22,7 +22,7 @@ char c;
void test ()
{
- function0 (c,c); // { dg-error "" } missed
+ function0 (c,c); // { dg-error "ambiguous" }
}
int main () { return 0; }
diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900404_04.C b/gcc/testsuite/g++.old-deja/g++.bugs/900404_04.C
index 09f5b2a..04ff669 100644
--- a/gcc/testsuite/g++.old-deja/g++.bugs/900404_04.C
+++ b/gcc/testsuite/g++.old-deja/g++.bugs/900404_04.C
@@ -13,6 +13,6 @@
int i;
-; // { dg-error "" }
+; // { dg-error "extra ';'" }
int main () { return 0; }
diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900428_03.C b/gcc/testsuite/g++.old-deja/g++.bugs/900428_03.C
index 722de9b..d0625c4 100644
--- a/gcc/testsuite/g++.old-deja/g++.bugs/900428_03.C
+++ b/gcc/testsuite/g++.old-deja/g++.bugs/900428_03.C
@@ -18,15 +18,15 @@ public:
};
struct_0::struct_0 (int i) { }
-struct_0::struct_0 (int, int) { } // { dg-error "" } xref from below
+struct_0::struct_0 (int, int) { } // { dg-error "is private" }
struct struct_1 : public struct_0 {
struct_1 ();
};
-struct_1::struct_1 () : struct_0 (8,9)
-{ // { dg-error "" }
+struct_1::struct_1 () : struct_0 (8,9) // { dg-error "within this context" }
+{
}
struct struct_2 {
@@ -35,11 +35,8 @@ struct struct_2 {
struct_2 ();
};
-// g++ catches the following error (but does so only at the line with the
-// closing curly brace).
-
-struct_2::struct_2 () : struct_2_data_member (8,9)
-{ // { dg-error "" } should be up one line
+struct_2::struct_2 () : struct_2_data_member (8,9) // { dg-error "within this context" }
+{
}
int main () { return 0; }
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/crash4.C b/gcc/testsuite/g++.old-deja/g++.jason/crash4.C
index 70f054b..00ba0cc 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/crash4.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/crash4.C
@@ -16,8 +16,8 @@ public:
};
template <class T>
-const ccObjectInfo& cc_Array<T>::repInvariant(int) const
-{ return *this /* *this is required here */; } // { dg-error "" } redefined
+const ccObjectInfo& cc_Array<T>::repInvariant(int) const // { dg-error "previously declared" }
+{ return *this /* *this is required here */; }
template <class T>
class ccArray :public ccObjectInfo
@@ -32,7 +32,7 @@ class ccObjArray : public ccArray<T>
};
template <class T>
-const ccObjectInfo& cc_Array<T>::repInvariant(int) const
-{ return 0; } // { dg-error "" } causes compiler segfault
+const ccObjectInfo& cc_Array<T>::repInvariant(int) const // { dg-error "redefinition" }
+{ return 0; }
typedef ccObjArray< double> ccROIRuns;
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload21.C b/gcc/testsuite/g++.old-deja/g++.jason/overload21.C
index 52c3589..229be93 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/overload21.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/overload21.C
@@ -1,13 +1,13 @@
// { dg-do assemble }
struct X {
- void f (int = 4, char = 'r'); // { dg-error "" }
- void g (int = 4, char = 'r'); // { dg-error "" }
+ void f (int = 4, char = 'r'); // { dg-error "previous specification" }
+ void g (int = 4, char = 'r'); // { dg-error "previous specification" }
};
void
-X::f (int i = 4, char x = 'r')
-{ } // { dg-error "" } duplicate default args
+X::f (int i = 4, char x = 'r') // { dg-error "default argument" }
+{ }
void
-X::g (int i = 9, char x = 's')
-{ } // { dg-error "" } duplicate default args
+X::g (int i = 9, char x = 's') // { dg-error "default argument" }
+{ }
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/redecl1.C b/gcc/testsuite/g++.old-deja/g++.jason/redecl1.C
index 0cc528a..6fda9d2 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/redecl1.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/redecl1.C
@@ -3,11 +3,11 @@ class A
{
public:
A (const A& ccref);
- friend A const re (const A& v1); // { dg-error "" }
+ friend A const re (const A& v1); // { dg-error "ambiguates" }
};
A // const
-re (const A& ref)
-{ // { dg-error "" } mismatched decls
+re (const A& ref) // { dg-error "new declaration" }
+{
return A (ref);
}
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/report.C b/gcc/testsuite/g++.old-deja/g++.jason/report.C
index 0149129..c1b9a57 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/report.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/report.C
@@ -50,8 +50,8 @@ typedef int const * bart ();
typedef bart const * const * bar2;
typedef bart volatile * const * bar2v;
-bar2 baz (X::Y y)
-{ // { dg-error "" } in this context
+bar2 baz (X::Y y) // { dg-error "" } in this context
+{
X::Y f; // { dg-error "" } in this context
bar2 wa [5];
wa[0] = baz(f);
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg10.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg10.C
index e53baf6..f6d5af3 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/rfg10.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg10.C
@@ -6,5 +6,6 @@
enum COLOR
{
red,
- green = ULONG_MAX, blue
-}; // { dg-error "" } enum overflow
+ green = ULONG_MAX,
+ blue // { dg-error "overflow in enumeration" }
+};
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template30.C b/gcc/testsuite/g++.old-deja/g++.jason/template30.C
index 4eca03d..370bb18 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/template30.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/template30.C
@@ -3,8 +3,8 @@ template <class T, class U>
int func(U, T); // { dg-error "" } ref below
template <class T, class U>
-int func(T, U)
-{ // { dg-error "" } ref below
+int func(T, U) // { dg-error "" } ref below
+{
return 2;
}
diff --git a/gcc/testsuite/g++.old-deja/g++.law/arm12.C b/gcc/testsuite/g++.old-deja/g++.law/arm12.C
index b098c22..c0332d3 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/arm12.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/arm12.C
@@ -22,8 +22,8 @@ public:
Y();
};
-X::X()
-{// { dg-error "" } .*
+X::X() // { dg-error "is private" }
+{
std::cout << "X::X()" << std::endl;
}
@@ -32,8 +32,8 @@ void X::f()
std::cout << "X::f()" << std::endl;
}
-Y::Y()
-{// { dg-error "" } within this
+Y::Y() // { dg-error "within this context" }
+{
std::cout << "Y::Y()" << std::endl;
}
diff --git a/gcc/testsuite/g++.old-deja/g++.law/ctors5.C b/gcc/testsuite/g++.old-deja/g++.law/ctors5.C
index 7078013..d08805a 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/ctors5.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/ctors5.C
@@ -5,7 +5,7 @@
// Date: Tue, 1 Sep 92 10:38:44 EDT
class X
-{ // { dg-error "" } candidate
+{ // { dg-error "X::X" } implicit constructor
private:
int x;
public:
@@ -20,14 +20,14 @@ class Y
public:
Y();
}
-X::X( int xi )
-{// { dg-error "" } return.*
+X::X( int xi ) // { dg-error "return type|X::X" }
+{
x = xi;
}
const X X::x0( 0 );
-Y::Y()
-{// { dg-error "" } no mat
+Y::Y() // { dg-error "no match" }
+{
xx = X::x0;
}
diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt20.C b/gcc/testsuite/g++.old-deja/g++.law/cvt20.C
index 9235fb5..5d699d7 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/cvt20.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/cvt20.C
@@ -9,12 +9,12 @@
// Compiles fine with Sun CC 2.1
-void f(char *& x)
-{// { dg-error "" } location of error
+void f(char *& x) // { dg-error "passing argument" }
+{
x++;
}
int main()
{
- f ("foo");// { dg-error "" } init of non-const ref from char*
+ f ("foo"); // { dg-error "invalid initialization" }
}
diff --git a/gcc/testsuite/g++.old-deja/g++.law/init10.C b/gcc/testsuite/g++.old-deja/g++.law/init10.C
index 4298bb9..4d567fe 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/init10.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/init10.C
@@ -20,7 +20,7 @@ public:
b();
};
-b::b() : three(this)
-{ // { dg-error "" } bad array initializer
+b::b() : three(this) // { dg-error "bad array initializer" }
+{
}
diff --git a/gcc/testsuite/g++.old-deja/g++.law/init8.C b/gcc/testsuite/g++.old-deja/g++.law/init8.C
index 0ccf451..ba8dde2 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/init8.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/init8.C
@@ -8,15 +8,15 @@
const int ic = 1;
-void f(int& arg)
-{ // { dg-error "" } argument 1
+void f(int& arg) // { dg-error "passing argument 1" }
+{
if (arg) ;
}
const int& icr = ic;
int main(void)
{
- f(icr); // g++ does not give error here// { dg-error "" } .*
+ f(icr); // { dg-error "invalid initialization" }
return 0;
}
diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility17.C b/gcc/testsuite/g++.old-deja/g++.law/visibility17.C
index 0afb04b..67ef892 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/visibility17.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/visibility17.C
@@ -31,24 +31,24 @@ private:
int num_;
};
-Base::Base()
-{ // { dg-error "" } private
+Base::Base() // { dg-error "is private" }
+{
name_ = std::strcpy(new char[std::strlen(" ") + 1], " ");
}
-Base::Base(char* str)
-{ // { dg-error "" } private
+Base::Base(char* str) // { dg-error "is private" }
+{
if(str != NULL)
name_ = std::strcpy(new char[std::strlen(str) + 1], str);
}
-Derived::Derived(int n, char* str) : Base(str)
-{// { dg-error "" } .*
+Derived::Derived(int n, char* str) : Base(str) // { dg-error "within this context" }
+{
num_ = n;
}
-Derived::Derived(int n) : Base()
-{// { dg-error "" } .*
+Derived::Derived(int n) : Base() // { dg-error "within this context" }
+{
num_ = n;
}
diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility7.C b/gcc/testsuite/g++.old-deja/g++.law/visibility7.C
index f271fbc..ed37f5f 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/visibility7.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/visibility7.C
@@ -15,10 +15,10 @@ class A {
{}
virtual ~A()
{}
- virtual void Number(int c)
- { number = c; } // { dg-error "" } private
- virtual int Number()
- { return number; } // { dg-error "" } private
+ virtual void Number(int c) // { dg-error "inaccessible" }
+ { number = c; }
+ virtual int Number() // { dg-error "inaccessible" }
+ { return number; }
};
class B : private A {
@@ -53,9 +53,9 @@ class C {
// and they should not be able to do so
//
virtual void setBValue(int i)
- { if (bobject) bobject->Number(i); }// { dg-error "" } .*
+ { if (bobject) bobject->Number(i); } // { dg-error "this context|accessible base" }
virtual int getBValue()
- { if (bobject) { return bobject->Number(); } return 0; }// { dg-error "" } .*
+ { if (bobject) { return bobject->Number(); } return 0; } // { dg-error "this context|accessible base" }
};
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/net8.C b/gcc/testsuite/g++.old-deja/g++.mike/net8.C
index 09dfe1a..09f9c30 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/net8.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/net8.C
@@ -11,22 +11,22 @@ public:
int bar;
};
-void func(Base&); // { dg-error "" }
+void func(Base&); // { dg-error "passing argument 1" }
void func2(const Derived& d) {
- func(d); // { dg-error "" } this is bad
+ func(d); // { dg-error "invalid initialization" }
}
void
-foo (int& a)
-{ // { dg-error "" }
+foo (int& a) // { dg-error "in passing argument 1" }
+{
}
int main ()
{
int b;
const int*const a = &b;
- *a = 10; // { dg-error "" } it's const
- foo (*a); // { dg-error "" } it's const
+ *a = 10; // { dg-error "read-only location" }
+ foo (*a); // { dg-error "invalid initialization" }
return 0;
}
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p646.C b/gcc/testsuite/g++.old-deja/g++.mike/p646.C
index 6d5abcd..3fdcd41 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/p646.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/p646.C
@@ -132,8 +132,8 @@ warn_foo_parm_returns_foo (foo f)
f;
} // { dg-warning "" } control reaches end
-main ()
-{ // { dg-warning "" } no type
+main () // { dg-warning "" } no type
+{
int ii = return_1 ();
if (ii != 1)
abort_because ("wrong value returned");
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p700.C b/gcc/testsuite/g++.old-deja/g++.mike/p700.C
index 5f52751..106a497 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/p700.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/p700.C
@@ -223,8 +223,8 @@ inline void Int::operator >>=(const int b)
{ rep >>= b; ; }
-inline int& operator = (int& a, const Int & b)
-{ a = b.Int::val(); return a;} // { dg-warning "" }
+inline int& operator = (int& a, const Int & b) // { dg-warning "" }
+{ a = b.Int::val(); return a;}
inline int& operator += (int& a, const Int & b)
{ a += b.Int::val(); return a; }
inline int& operator -= (int& a, const Int & b)
@@ -562,8 +562,8 @@ inline void Char::operator >>=(const char b)
{ rep >>= b; ; }
-inline char& operator = (char& a, const Char & b)
-{ a = b.Char::val(); return a;} // { dg-warning "" }
+inline char& operator = (char& a, const Char & b) // { dg-warning "" }
+{ a = b.Char::val(); return a;}
inline char& operator += (char& a, const Char & b)
{ a += b.Char::val(); return a; }
inline char& operator -= (char& a, const Char & b)
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p701.C b/gcc/testsuite/g++.old-deja/g++.mike/p701.C
index 2c23ddc..6a52591 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/p701.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/p701.C
@@ -7,8 +7,8 @@ extern "C"
}
-void Munge(int& x)
-{ // { dg-error "" } referenced below
+void Munge(int& x) // { dg-error "passing argument 1" }
+{
x = 2;
}
@@ -24,7 +24,7 @@ class A
void
A::Safe() const
{
- Munge(i); // { dg-error "" } should not be able to modify a const object
+ Munge(i); // { dg-error "invalid initialization" }
}
int main()
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p811.C b/gcc/testsuite/g++.old-deja/g++.mike/p811.C
index ba6c629..7d15e9e 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/p811.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/p811.C
@@ -512,25 +512,25 @@ class Y {
public:
Y() {}
virtual const char *stringify() = 0;
- virtual char *stringify2() const = 0; // { dg-error "" }
+ virtual char *stringify2() const = 0; // { dg-error "overriding" }
};
class X: public Y {
public:
X(): Y() {}
- char *stringify(); // { dg-error "" } ok
- const char *stringify2() const; // { dg-error "" } ok
+ char *stringify(); // { dg-error "candidate" }
+ const char *stringify2() const; // { dg-error "candidate|conflicting return type" }
};
char *
-X::stringify() const
-{ // { dg-error "" } ok
+X::stringify() const // { dg-error "does not match" }
+{
return "stringify";
}
const char *
-X::stringify2()
-{ // { dg-error "" } ok
+X::stringify2() // { dg-error "does not match" }
+{
return "stringify2";
}
diff --git a/gcc/testsuite/g++.old-deja/g++.ns/template13.C b/gcc/testsuite/g++.old-deja/g++.ns/template13.C
index 058d7b9..4655538 100644
--- a/gcc/testsuite/g++.old-deja/g++.ns/template13.C
+++ b/gcc/testsuite/g++.old-deja/g++.ns/template13.C
@@ -1,23 +1,23 @@
-// { dg-do assemble { xfail *-*-* } }
+// { dg-do compile }
// Templates defined outside must be declared inside
namespace bar
{
// trick it to provide some prior declaration
template<class T>
void foo(); // { dg-error "definition" }
- template<class T>class X; // { dg-error "" } previous declaration
+ template<class T>class X; // { dg-error "previous declaration" }
}
template <typename T>
T const
-bar::foo(T const &a)
-{ // { dg-error "" "" { xfail *-*-* } } not declared in bar -
+bar::foo(T const &a) // { dg-error "" "" { xfail *-*-* } } not declared in bar -
+{
return a;
}
-template<> void bar::foo<int>()
-{ // { dg-error "" }
+template<> void bar::foo<int>() // { dg-error "different namespace" }
+{
}
template<class T,class U>
-class bar::X{}; // { dg-error "" } does not match declaration
+class bar::X{}; // { dg-error "1 template parameter" }
diff --git a/gcc/testsuite/g++.old-deja/g++.other/array3.C b/gcc/testsuite/g++.old-deja/g++.other/array3.C
index 7d930b5..fc37c9b 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/array3.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/array3.C
@@ -20,6 +20,6 @@ class B
};
B::B (const A a[])
- : ary(a)
-{ // { dg-error "" } bad array initializer
+ : ary(a) // { dg-error "bad array initializer" }
+{
}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/crash25.C b/gcc/testsuite/g++.old-deja/g++.other/crash25.C
index f3c7c25..b18d99b 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/crash25.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/crash25.C
@@ -7,10 +7,10 @@ public:
virtual ~X();
}
-X::x()
-{ // { dg-error "" }
+X::x() // { dg-error "return type|member function" }
+{
}
-X::~x() // { dg-error "" }
+X::~x() // { dg-error "expected class-name" }
{
}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/dtor3.C b/gcc/testsuite/g++.old-deja/g++.other/dtor3.C
index 3fc4dc9..f5a00ed 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/dtor3.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/dtor3.C
@@ -31,8 +31,8 @@ struct S5
~S5();
};
-S5::~S5(float)
-{ // { dg-error "" } destructors may not have parameters
+S5::~S5(float) // { dg-error "" } destructors may not have parameters
+{
}
@@ -43,8 +43,8 @@ struct S6
};
template <class T>
-S6<T>::~S6(float)
-{ // { dg-error "" } destructors may not have parameters
+S6<T>::~S6(float) // { dg-error "" } destructors may not have parameters
+{
}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/dtor4.C b/gcc/testsuite/g++.old-deja/g++.other/dtor4.C
index be04965..a4db38b 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/dtor4.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/dtor4.C
@@ -4,8 +4,8 @@ struct S1 {
~S1(); // { dg-error "" } candidate
};
-S1::~S1() const
-{ // { dg-error "" } prototype does not match
+S1::~S1() const // { dg-error "" } prototype does not match
+{
}
@@ -20,8 +20,8 @@ struct S3 {
};
template <class T>
-S3<T>::~S3() volatile
-{ // { dg-error "" } prototype does not match
+S3<T>::~S3() volatile // { dg-error "" } prototype does not match
+{
}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/main1.C b/gcc/testsuite/g++.old-deja/g++.other/main1.C
index 0501a74..c5cfe8b 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/main1.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/main1.C
@@ -1,13 +1,12 @@
-// { dg-do assemble }
-// Build don't linK:
+// { dg-do compile }
-int main()
-{ // { dg-error "" } invalid redeclaration of
+int main() // { dg-error "previous declaration" }
+{
return 0;
}
-int main(int, const char**)
-{ // { dg-error "" } as
+int main(int, const char**) // { dg-error "conflicts" }
+{
return 0;
}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/warn7.C b/gcc/testsuite/g++.old-deja/g++.other/warn7.C
index 4e764502..c7684d1 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/warn7.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/warn7.C
@@ -34,12 +34,12 @@ struct Y
};
void bar (int);
-Y::Y(int i)
-{ // { dg-warning "" } unused parameter
+Y::Y(int i) // { dg-warning "unused parameter" }
+{
}
-void Y::bar (int i)
-{ // { dg-warning "" } unused parameter
+void Y::bar (int i) // { dg-warning "unused parameter" }
+{
}
-void bar (int i)
-{ // { dg-warning "" } unused parameter
+void bar (int i) // { dg-warning "unused parameter" }
+{
}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash11.C b/gcc/testsuite/g++.old-deja/g++.pt/crash11.C
index bbf08bb..be83f5a 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/crash11.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/crash11.C
@@ -8,6 +8,6 @@ class A
};
-template <class j> class A::A_impl
-{ // { dg-error "" } does not declare a template
+template <class j> class A::A_impl // { dg-error "does not declare a template" }
+{
};
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash36.C b/gcc/testsuite/g++.old-deja/g++.pt/crash36.C
index 146c0b1..13695f9 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/crash36.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/crash36.C
@@ -28,7 +28,7 @@ struct list {
};
reverse_iterator<list_iterator<T> > rbegin()
- { return reverse_iterator<list_iterator<T> > // { dg-error "" } no type|instantiated here
+ { return reverse_iterator<list_iterator<T> >
(list_iterator<T>(Head->next())); } // { dg-error "" } not declared
};
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec22.C b/gcc/testsuite/g++.old-deja/g++.pt/spec22.C
index 3046455..41aab39 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/spec22.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/spec22.C
@@ -9,7 +9,7 @@ struct S
template <class T>
-template <> // { dg-error "" } enclosing classes not specialized
-void S<T>::f<int> ()
-{ // { dg-error "" } template does not match any declaration
+template <> // { dg-error "enclosing class templates|invalid explicit specialization" }
+void S<T>::f<int> () // { dg-error "does not match|invalid function declaration" }
+{
}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec9.C b/gcc/testsuite/g++.old-deja/g++.pt/spec9.C
index acb9e70..e2c5b4e 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/spec9.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/spec9.C
@@ -14,8 +14,8 @@ int main()
}
template <>
-int f(int i)
-{ // { dg-error "" } specialization of f<int>(int) after instantiation
+int f(int i) // { dg-error "specialization\[^\n\]*after instantiation" }
+{
return 1;
}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ttp52.C b/gcc/testsuite/g++.old-deja/g++.pt/ttp52.C
index 5d883fd..4a9b7ee 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/ttp52.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/ttp52.C
@@ -7,12 +7,10 @@ template<class Key,
template<class, class > class MapT>
class base
{
-
};
// specialization
template<class Key, class Value>
-class base<Key, Value, mymap<int, int > >
-{ // { dg-error "" } type/value mismatch
-
+class base<Key, Value, mymap<int, int > > // { dg-error "type/value|class template" }
+{
};
diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb103.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb103.C
index 58abd0c..c272d94 100644
--- a/gcc/testsuite/g++.old-deja/g++.robertl/eb103.C
+++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb103.C
@@ -4,8 +4,8 @@
template <int nlimb, int i>
inline unsigned f (unsigned* ptr);
template <int nlimb>
-inline unsigned f<nlimb,nlimb> (unsigned* ptr)
-{ //{ dg-error "" } partial specialization of function?
+inline unsigned f<nlimb,nlimb> (unsigned* ptr) // { dg-error "function template partial specialization" }
+{
return 1;
}
diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb121.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb121.C
index 85dc43d..e01d747 100644
--- a/gcc/testsuite/g++.old-deja/g++.robertl/eb121.C
+++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb121.C
@@ -3,12 +3,12 @@ class A {
private:
int i1_;
public:
- void f(int const i1 = 1); // { dg-error "" } previous specification
+ void f(int const i1 = 1); // { dg-error "previous specification" }
};
void
-A::f(int const i1 = 1)
-{ // { dg-error "" } duplicate default argument
+A::f(int const i1 = 1) // { dg-error "default argument given" }
+{
i1_ = i1;
}
diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb22.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb22.C
index 3d4cc03..b969d68 100644
--- a/gcc/testsuite/g++.old-deja/g++.robertl/eb22.C
+++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb22.C
@@ -11,13 +11,13 @@ public:
operator int() const {return 2;}
};
-bool operator==(const MyInt& a, const int& b)
-{ // { dg-error "" } candidate
+bool operator==(const MyInt& a, const int& b) // { dg-error "" } candidate
+{
return (int)a == b;
}
-bool operator==(const MyInt& a, const MyInt& b)
-{ // { dg-error "" } candidate
+bool operator==(const MyInt& a, const MyInt& b) // { dg-error "" } candidate
+{
return (int)a == (int)b;
}
diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb8.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb8.C
index d80414c..c660050 100644
--- a/gcc/testsuite/g++.old-deja/g++.robertl/eb8.C
+++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb8.C
@@ -6,8 +6,8 @@ public:
operator <<(char *); //{ dg-error "" } no return type
};
-void main()
-{ //{ dg-error "" } wrong return type for main
+void main() // { dg-error "must return .int" }
+{
foo f;
f << (void*)0;
}