diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b9d2bffb411c..9ea3fe3e7bd7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,58 @@ +2004-09-23 Zack Weinberg + + * 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 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 * 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 b3cdd6978bce..d3a0c8d4b21d 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 58dac9685a78..b820e9ed8377 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 % 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 db779a201b9f..49d02372d54d 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,18 +306,11 @@ cp_lexer_new_from_token_array (cp_token *first, cp_token *last) /* Initially we are not debugging. */ lexer->debugging_p = false; #endif + + gcc_assert (lexer->next_token->type != CPP_PURGED); 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); -} - /* Frees all resources associated with LEXER. */ static void @@ -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; } - 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. */ - -static cp_token * -cp_lexer_consume_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)) { - fprintf (cp_lexer_debug_stream, "cp_lexer: consuming token: "); 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. */ +/* 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 = lexer->next_token; + + do + ++lexer->next_token; + while (lexer->next_token->type == CPP_PURGED); + + cp_lexer_set_source_position_from_token (token); + + /* Provide debugging output. */ + if (cp_lexer_debugging_p (lexer)) + { + fputs ("cp_lexer: consuming token: ", cp_lexer_debug_stream); + cp_lexer_print_token (cp_lexer_debug_stream, token); + putc ('\n', cp_lexer_debug_stream); + } + + return token; +} + +/* 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) + cp_token_cache *tokens; + + if (!TREE_PURPOSE (parm) + || TREE_CODE (TREE_PURPOSE (parm)) != DEFAULT_ARG) continue; - /* 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); + /* 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); - /* Set the current source position to be the location of the - first token in the default argument. */ - cp_lexer_peek_token (parser->lexer); - - /* 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 dd233c1aff68..b6f1ca1c449b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,73 @@ +2004-09-23 Zack Weinberg + + * 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 * gcc.c-torture/execute/builtins/strcpy-2.c: New test. @@ -10,38 +80,38 @@ 2004-09-23 Dorit Naishlos - * 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-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-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-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-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-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-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 @@ -93,7 +163,7 @@ PR c++/15049 * g++.dg/other/anon3.C: New. - + 2004-09-21 Roger Sayle PR c++/7503 @@ -115,7 +185,7 @@ 2004-09-20 Andrew Pinski - PR tree-opt/17558 + PR tree-opt/17558 * gcc.c-torture/compile/pr17558.c: New test. 2004-09-20 Richard Sandiford @@ -138,7 +208,7 @@ 2004-09-20 Tobias Schlueter 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 @@ -200,7 +270,7 @@ 2004-09-17 Devang Patel * gcc.dg/20040813-1.c: New test. - + 2004-09-17 Diego Novillo 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 - + * gfortran.dg/pr17090.f90: Add directives to test. 2004-09-14 Zdenek Dvorak @@ -331,7 +401,7 @@ PR c++/16162 * g++.dg/template/decl2.C: New test. - + 2004-09-13 Bud Davis 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 bcca8ac1e22d..ab2b038fe341 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 ea6c5203ecbb..36089e4b5b5d 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 5a1fcd978215..11bbfb829685 100644 --- a/gcc/testsuite/g++.dg/other/nontype-1.C +++ b/gcc/testsuite/g++.dg/other/nontype-1.C @@ -2,6 +2,6 @@ template 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 e6db364a2478..4fa7ff23c73c 100644 --- a/gcc/testsuite/g++.dg/parse/crash11.C +++ b/gcc/testsuite/g++.dg/parse/crash11.C @@ -19,8 +19,8 @@ struct B template struct Template { - typedef typename A::Template> - ::template Template::Type Type; // { dg-error "mismatch|class template|unqualified-id" } + typedef typename A::Template> // { dg-error "mismatch|class template" } + ::template Template::Type Type; // { dg-error "unqualified-id" } }; }; template diff --git a/gcc/testsuite/g++.dg/parse/crash12.C b/gcc/testsuite/g++.dg/parse/crash12.C index cf947b277874..a936e8c30ee0 100644 --- a/gcc/testsuite/g++.dg/parse/crash12.C +++ b/gcc/testsuite/g++.dg/parse/crash12.C @@ -14,8 +14,8 @@ public: }; template -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 diff --git a/gcc/testsuite/g++.dg/parse/error15.C b/gcc/testsuite/g++.dg/parse/error15.C index fd7038247188..e49e211480ab 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 511209d9ab99..aa1bfad0dc9d 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 07c89e25ca62..4b8bb723cac7 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 30c29521e9f4..4d98e754639a 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 // { dg-do compile } -template class A -{ // { dg-error "" } +template class A // { dg-error "" } +{ struct B; template friend typename A::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 2e8b805ead80..97fddbdd8d44 100644 --- a/gcc/testsuite/g++.dg/template/dependent-expr3.C +++ b/gcc/testsuite/g++.dg/template/dependent-expr3.C @@ -10,5 +10,5 @@ template struct Y : K { template struct Z { S< (bool)(&static_cast *>(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 a25c4bbddb97..ccb577dfc736 100644 --- a/gcc/testsuite/g++.dg/template/error10.C +++ b/gcc/testsuite/g++.dg/template/error10.C @@ -9,8 +9,8 @@ template class A {}; -A> blah; // { dg-error "should be `> >' within" } -A> blah2; // { dg-error "spurious `>>'" } +A> blah; // { dg-error "should be '> >' within" } +A> blah2; // { dg-error "spurious '>>'" } /* @@ -66,5 +66,5 @@ struct K {}; void KFunc(void); -A> k1; // { dg-error "should be `> >' within" } -K<&KFunc>> k2; // { dg-error "spurious `>>'" } +A> 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 e4e7bc981785..311344d9451d 100644 --- a/gcc/testsuite/g++.dg/template/instantiate1.C +++ b/gcc/testsuite/g++.dg/template/instantiate1.C @@ -16,6 +16,6 @@ template struct Z { // { dg-error "declaration" } Y > y; // { dg-error "instantiated" } }; -struct ZZ : Z -{ // { dg-error "instantiated" } +struct ZZ : Z // { dg-error "instantiated" } +{ }; diff --git a/gcc/testsuite/g++.dg/template/vtable2.C b/gcc/testsuite/g++.dg/template/vtable2.C index 9f2bf0b2ff29..3bcc1ac3f8a6 100644 --- a/gcc/testsuite/g++.dg/template/vtable2.C +++ b/gcc/testsuite/g++.dg/template/vtable2.C @@ -11,8 +11,8 @@ template struct inner {}; template struct parent { - virtual void f() - { parent > p; }; // { dg-error "instantiation depth" } + virtual void f() // { dg-error "instantiation depth" } + { parent > p; }; }; template struct parent; diff --git a/gcc/testsuite/g++.dg/warn/Wshadow-1.C b/gcc/testsuite/g++.dg/warn/Wshadow-1.C index 2ea076e15361..1647a010d122 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 dbc0dfff71ba..84d08fbd4797 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 1c81d19d3836..8b91e6ba093d 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 6691081c68b2..119ba4605385 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; - 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 b3972bda7b8f..bdb522aeb56c 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 95b57dc78989..e0664da28dd8 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 29533bce619b..cd952af142b8 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 243a2b620fea..57c7c11480bd 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& a, const SetLD& 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 06bde5633414..487208328efc 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 -class Elvis -{ // { dg-error "" } in template.* +class Elvis // { dg-error "class Elvis" } +{ } ; template -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 233c387840e0..009333a18bea 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 e9e69073b679..ecf6fbf4eceb 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 43420cff17c6..88ecc73283d8 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 0df449873522..ecd85b44b097 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 d14d32b0e8c0..09242a46fa54 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 e1740b10c6aa..d3cf5ad9abe5 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 be258fc246cf..726f9ef933e5 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 09f5b2acb09d..04ff66905498 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 722de9be662b..d0625c4b4736 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 70f054b6eaf4..00ba0cc0644e 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 -const ccObjectInfo& cc_Array::repInvariant(int) const -{ return *this /* *this is required here */; } // { dg-error "" } redefined +const ccObjectInfo& cc_Array::repInvariant(int) const // { dg-error "previously declared" } +{ return *this /* *this is required here */; } template class ccArray :public ccObjectInfo @@ -32,7 +32,7 @@ class ccObjArray : public ccArray }; template -const ccObjectInfo& cc_Array::repInvariant(int) const -{ return 0; } // { dg-error "" } causes compiler segfault +const ccObjectInfo& cc_Array::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 52c3589d8441..229be93da7cf 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 0cc528a93078..6fda9d27ac95 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 0149129fefee..c1b9a57bbb0b 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 e53baf6b92ed..f6d5af3a8b84 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 4eca03df4d43..370bb18a561c 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 int func(U, T); // { dg-error "" } ref below template -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 b098c22d58a5..c0332d367333 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 7078013fe77f..d08805a36aad 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 9235fb5b0ea6..5d699d7f8570 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 4298bb990174..4d567fecf7d6 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 0ccf4512ee08..ba8dde2e8bed 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 0afb04b184ec..67ef8927a634 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 f271fbc768b2..ed37f5f8d2bd 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 09dfe1a83b7c..09f9c30a85e7 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 6d5abcd91e52..3fdcd41aece4 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 5f52751639bf..106a497d0409 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 2c23ddc1cc22..6a52591040ea 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 ba6c62925986..7d15e9ed8aaf 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 058d7b9ec88e..46555387af3e 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 void foo(); // { dg-error "definition" } - templateclass X; // { dg-error "" } previous declaration + templateclass X; // { dg-error "previous declaration" } } template 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() -{ // { dg-error "" } +template<> void bar::foo() // { dg-error "different namespace" } +{ } template -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 7d930b52dc7a..fc37c9bd8bdb 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 f3c7c25d01ca..b18d99b30d7e 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 3fc4dc94561a..f5a00ed577c0 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 -S6::~S6(float) -{ // { dg-error "" } destructors may not have parameters +S6::~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 be04965dbe1d..a4db38ba7077 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 -S3::~S3() volatile -{ // { dg-error "" } prototype does not match +S3::~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 0501a74817f7..c5cfe8b9eb03 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 4e7645027965..c7684d18ca1d 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 bbf08bbfb767..be83f5abe7b6 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 A::A_impl -{ // { dg-error "" } does not declare a template +template 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 146c0b137832..13695f9c69b1 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 > rbegin() - { return reverse_iterator > // { dg-error "" } no type|instantiated here + { return reverse_iterator > (list_iterator(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 304645596664..41aab394d3ee 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 -template <> // { dg-error "" } enclosing classes not specialized -void S::f () -{ // { dg-error "" } template does not match any declaration +template <> // { dg-error "enclosing class templates|invalid explicit specialization" } +void S::f () // { 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 acb9e70e8be0..e2c5b4e5296b 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) 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 5d883fdd6910..4a9b7ee39dcb 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 MapT> class base { - }; // specialization template -class base > -{ // { dg-error "" } type/value mismatch - +class base > // { 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 58abd0c6bede..c272d9403323 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 inline unsigned f (unsigned* ptr); template -inline unsigned f (unsigned* ptr) -{ //{ dg-error "" } partial specialization of function? +inline unsigned f (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 85dc43d5c446..e01d7478838f 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 3d4cc031e414..b969d686624c 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 d80414c63fcc..c660050628ec 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; } diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 711157815e63..78c379bb35cd 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2004-09-23 Zack Weinberg + + * 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. + 2004-09-23 P.J. Darcy * include/Makefile.am (thread_host_headers): Add gthr-tpf.h. @@ -6,7 +13,7 @@ 2004-09-23 Paolo Carlini Magnus Fromreide - + * include/bits/boost_concept_check.h (struct _SequenceConcept): Remove wrong requirement, i.e., not present in Table 67. @@ -124,18 +131,18 @@ 2004-09-02 Mark Mitchell * libsupc++/typeinfo: Honor __GXX_MERGED_TYPEINFO_NAMES if already - defined. + defined. 2004-09-02 Benjamin Kosnik - Simon Richter - + Simon Richter + PR libstdc++/16715 * include/bits/istream.tcc: Add extern template for iostream char and wchar_t instantiations. 2004-09-02 Benjamin Kosnik - Leland Wang - + Leland Wang + PR libstdc++/17259 * include/ext/ropeimpl.h (rope::_S_compare): Use _Rope_constants::_S_leaf. @@ -170,19 +177,19 @@ * testsuite/ext/mt_allocator/tune-1.cc: New. * testsuite/ext/mt_allocator/tune-2.cc: New. * testsuite/ext/mt_allocator/tune-3.cc: New. - * testsuite/ext/mt_allocator/tune-4.cc: New. + * testsuite/ext/mt_allocator/tune-4.cc: New. * testsuite/testsuite_allocator.h (__gnu_test::check_new): New. * testsuite/ext/allocators.cc: Use check_new, split into... * testsuite/ext/mt_allocator/check_new.cc: this. * testsuite/ext/pool_allocator/check_new.cc: this. - * testsuite/ext/malloc_allocator/check_new.cc: this. - * testsuite/ext/debug_allocator/check_new.cc: this. + * testsuite/ext/malloc_allocator/check_new.cc: this. + * testsuite/ext/debug_allocator/check_new.cc: this. * testsuite/ext/mt_allocator/instantiate.cc: this. * testsuite/ext/pool_allocator/instantiate.cc: this. - * testsuite/ext/malloc_allocator/instantiate.cc: this. + * testsuite/ext/malloc_allocator/instantiate.cc: this. * testsuite/ext/debug_allocator/instantiate.cc: this. - + 2004-08-30 Phil Edwards * docs/html/install.html: Update locales list (from Paolo). @@ -240,7 +247,7 @@ * testsuite/27_io/manipulators/basefield/wchar_t/1.cc: Likewise. * testsuite/27_io/manipulators/standard/wchar_t/1.cc: Likewise. * testsuite/27_io/manipulators/standard/wchar_t/2.cc: Likewise. - + * testsuite/27_io/manipulators/adjustfield/char/1.cc: Minor formatting fixes. * testsuite/27_io/manipulators/adjustfield/char/2.cc: Likewise. @@ -343,7 +350,7 @@ * cpu/hppa/atomicity.h (__exchange_and_add, __atomic_add): Add memory barrier to locking asm. - + 2004-08-20 Paolo Carlini * include/c_std/cmath.tcc (__cmath_power): Revert previous commit: @@ -397,7 +404,7 @@ * testsuite/22_locale/time_put/put/wchar_t/2.cc: Likewise. * testsuite/22_locale/time_put/put/wchar_t/3.cc: Likewise. * testsuite/22_locale/time_put/put/wchar_t/4.cc: Likewise. - + 2004-08-19 Paolo Carlini * config/abi/x86_64-linux-gnu/baseline_symbols.txt: Update to 3.4.0. @@ -464,7 +471,7 @@ * testsuite/22_locale/time_put/put/wchar_t/8.cc: Likewise. 2004-08-13 Paolo Carlini - + * src/debug.cc (_Error_formatter::_M_print_string): Fix thinko, memmove is not needed, memcpy suffices. @@ -521,7 +528,7 @@ * testsuite/27_io/basic_stringbuf/sbumpc/wchar_t/1.cc: Fix typo. 2004-08-11 Paolo Carlini - + * testsuite/27_io/basic_stringbuf/imbue/char/1.cc: Declare test variable. * testsuite/27_io/basic_stringbuf/imbue/wchar_t/1.cc: Ditto. @@ -564,7 +571,7 @@ 2004-08-07 Jonathan Wakely Paolo Carlini - + * src/debug.cc (_Error_formatter::_M_print_string): In order to print individual words from __string, _M_format_word can't be called since may be just sprintf, thus ignoring completely @@ -622,7 +629,7 @@ * include/c_std/std/std_cstdlib.h (stdlib.h): Do not include it when freestanding. Do not bring names into std:: namespace with "using" when freestanding. Declare required functions and macros - when freestanding. + when freestanding. * libsupc++/Makefile.am (c_sources): Do not include cp-demangle.c when freestanding. * libsupc++/del_op.cc: Declare "free" only when freestanding. @@ -647,11 +654,11 @@ * po/Makefile.in: Likewise. * src/Makefile.in: Likewise. * testsuite/Makefile.in: Likewise. - + 2004-08-01 Matt Austern PR libstdc++/16844 - * include/bits/stl_list.h (_M_create_node): Remove unused + * include/bits/stl_list.h (_M_create_node): Remove unused zero-argument version. * include/ext/slist (_M_create_node): Pass two arguments to allocator's construct() member function. @@ -664,7 +671,7 @@ * testsuite/23_containers/multiset/explicit_instantiation.cc: New. * testsuite/ext/hash_set_explicit_instantiation.cc: New. * testsuite/ext/slist_explicit_instantiation.cc: New. - + 2004-07-30 Paolo Carlini * include/bits/locale_facets.tcc (num_get<>::_M_extract_float, @@ -685,7 +692,7 @@ * docs/html/ext/lwg-active.html, lwg-defects.html: Import Revision 31. 2004-07-29 Paolo Carlini - Petur Runolfsson + Petur Runolfsson PR libstdc++/12658 (continued) * src/locale_init.cc (locale::locale, locale::global): Use @@ -732,14 +739,14 @@ * include/bits/stl_vector.h: Likewise. * include/bits/vector.tcc: Likewise. * include/ext/hashtable.h: Use rebind so that allocator_type - has correct type for a container's allocator. Replace use of - single-argument _Construct and _Destroy with use of allocator's + has correct type for a container's allocator. Replace use of + single-argument _Construct and _Destroy with use of allocator's construct and destroy methods. * include/ext/memory (__uninitialized_copy_n_a): New function. Like uninitialized_copy_n except that it takes an extra parameter, an allocator, and uses it for construct and destroy operations. * include/ext/rope: Use new forms defined in stl_construct.h, - stl_uninitialized.h, and ext/memory. Replace use of single-argument + stl_uninitialized.h, and ext/memory. Replace use of single-argument _Construct and _Destroy with allocator construct and destroy methods. * include/ext/ropeimpl.h: Likewise. * include/ext/slist.h: Likewise. @@ -747,11 +754,11 @@ * testsuite/testsuite_allocator.cc (check_construct_destroy): New. * testsuite/23_containers/deque/check_construct_destroy.cc: New. * testsuite/23_containers/list/check_construct_destroy.cc: New. - * testsuite/23_containers/set/check_construct_destroy.cc: New. - * testsuite/23_containers/vector/check_construct_destroy.cc: New. + * testsuite/23_containers/set/check_construct_destroy.cc: New. + * testsuite/23_containers/vector/check_construct_destroy.cc: New. * testsuite/ext/hash_check_construct_destroy.cc: New. * testsuite/ext/slist_check_construct_destroy.cc: New. - + 2004-07-28 Alexandre Oliva 2003-10-01 Eric Christopher @@ -931,7 +938,7 @@ * configure: Regenerated. * testsuite/testsuite_abi.cc (check_version): Add 3.4.2. - + 2004-07-07 Aaron W. LaFramboise PR libstdc++/16411 @@ -955,7 +962,7 @@ PR libstdc++/15928 * crossconfig.m4: Add in bits for djgpp. * configure: Regenerate. - + 2004-07-05 Jonathan Wakely * testsuite/23_containers/{set,multiset}/14340.cc: Fix typos in @@ -1016,14 +1023,14 @@ __is_trivially_copyable, __are_same and __copy::copy. (__copy): Rewrite as a class template and two specializations. (__copy_ni2): Simplify, just call __copy_aux. - + * include/bits/stl_algobase.h (__copy_backward_aux): Add __are_same check. * testsuite/25_algorithms/copy/1.cc, 2.cc, 3.cc, 4.cc: Test also for destination value type != source value type. 2004-07-01 Benjamin Kosnik - Per Bothner + Per Bothner Mohan Embar PR libstdc++/16248 @@ -1035,25 +1042,25 @@ * include/ext/pool_allocator.h (__pool_base::_M_get_mutex): Change to mutex_type. * src/allocator.cc: Same. - + 2004-06-30 Brad Spencer * include/ext/mt_allocator.h: Handle allocations at static initialization that happen before _S_options is (automatically) constructed; set _S_init even if _M_force_new is true. - + 2004-06-30 Benjamin Kosnik * config/linker-map.gnu: Revert new exports. 2004-06-30 Benjamin Kosnik - Stuart Anderson - + Stuart Anderson + * config/linker-map.gnu: Add destructor exports for abstract base classes to conform to LSB. 2004-06-30 Gabriel Dos Reis - Paolo Carlini + Paolo Carlini * include/bits/cpp_type_traits.h: Add __is_pointer and __is_trivially_copyable. @@ -1090,7 +1097,7 @@ Revert -Weffc++ changes that defined copy ctory and or assignment operator. * libsupc++/tinfo.cc (__upcast_result): Same. - + 2004-06-28 Paolo Carlini * src/localename.cc (locale::_Impl::_Impl): Slightly improve @@ -1135,7 +1142,7 @@ 2004-06-25 Benjamin Kosnik - PR libstdc++/16182 + PR libstdc++/16182 * linkage.m4 (GLIBCXX_CHECK_BUILTIN_MATH_DEC): Revert to AC_DEFINE_UNQUOTED. * configure: Regenerate. @@ -1201,10 +1208,10 @@ * src/allocator.cc: Move all instantiations... * src/allocator-inst.cc: ...here. - + 2004-06-23 Andrew Pinski - * linkage.m4: Remove check for libmx. + * linkage.m4: Remove check for libmx. * configure: Regenerate. 2004-06-23 Paolo Carlini @@ -1291,7 +1298,7 @@ (__pool_alloc): Move _S_force new here. * src/allocator.cc: Move out of line __pool_base definitions here. * config/linker-map.gnu: Export bits from __pool_base. - + 2004-06-18 Paolo Carlini * config/locale/gnu/numeric_members.cc @@ -1320,7 +1327,7 @@ (rope<>::_S_dump): Likewise. (rope<>::_S_fetch_ptr): Likewise. (rope<>::_S_compare): Likewise. - (rope<>::replace_with_c_str()): Likewise. + (rope<>::replace_with_c_str()): Likewise. * testsuite/ext/rope.cc: Rename to testsuite/ext/rope/1.cc. * testsuite/ext/rope/2.cc: New. @@ -1419,11 +1426,11 @@ 2004-06-09 Benjamin Kosnik - * crossconfig.m4: Remove signbit, signbitf, signbitl. + * crossconfig.m4: Remove signbit, signbitf, signbitl. * linkage.m4: Comment LIBMATHOBJS, tweak others. AC_DEFINES for builtin math functions instead of AC_DEFINE_UNQUOTED. * configure: Regenerate. - + 2004-06-08 Benjamin Kosnik * docs/doxygen/filter.sed: Rename _GLIBCXX_STD to std. @@ -1460,11 +1467,11 @@ * configure.ac (libtool_VERSION): Bump to 6:1:0. * configure: Regenerate. * aclocal.m4: Regenerate. - + 2004-05-30 Gabriel Dos Reis * include/std/std_complex.h (complex<_Tp>): Properly indent - to follow C++STYLE. + to follow C++STYLE. (complex<>::__rep): New. (__complex_abs): New. Dispatch to built-ins. (abs): Use them. @@ -1492,8 +1499,8 @@ (pow): Use it. 2004-05-29 Richard B. Kreckel - Benjamin Kosnik - + Benjamin Kosnik + PR libstdc++/14600 * include/ext/stdio_sync_filebuf.h (stdio_sync_filebuf::file): New. * include/ext/stdio_filebuf.h (stdio_filebuf::file): New. @@ -1540,25 +1547,25 @@ 2004-05-22 Benjamin Kosnik PR libstdc++/12854 - Fixups for -Weffc++. + Fixups for -Weffc++. * include/bits/basic_string.h (basic_string::operator=): Return pointer to this instead of result of assign. Although redundant, this doesn't impact resultant codegen. - + * include/bits/locale_facets.h (__numpunct_cache): Declare assignment opxserator and copy constructor private. (__timepunct_cache): Same. (__moneypunct_cache): Same. (collate): Use member initialization list for _M_c_locale_collate. * config/locale/gnu/messages_members.h: Same. - * config/locale/gnu/time_members.h (__timepunct): Same. + * config/locale/gnu/time_members.h (__timepunct): Same. * src/codecvt.cc: Use member initialization list to initialize - _M_c_locale_codecvt. + _M_c_locale_codecvt. * src/ctype.cc: Same, with _M_c_locale_ctype and _M_narrow_ok. * config/os/gnu-linux/ctype_noninline.h: Same. * src/locale.cc (_Impl): Same. * src/locale_init.cc: Same. - * src/localename.cc: Same. + * src/localename.cc: Same. * include/bits/basic_ios.h (basic_ios): Complete member initialization list. @@ -1569,7 +1576,7 @@ * include/std/std_streambuf.h: Same. * include/std/std_sstream.h: Same, for _M_mode. * src/ios.cc (ios_base): Same. - + * include/ext/rope: Make derived classes match exception specifications. Add copy constructors and assignment operators. @@ -1586,24 +1593,24 @@ 2004-05-22 Benjamin Kosnik * testsuite/testsuite_hooks.h (func_callback): Declare copy - constructor and assignment operator private. + constructor and assignment operator private. * testsuite/23_containers/deque/cons/clear_allocator.cc: Match exception specifications of base class. * testsuite/23_containers/list/cons/clear_allocator.cc: Same. * testsuite/23_containers/vector/cons/clear_allocator.cc: Same. * testsuite/23_containers/vector/bool/clear_allocator.cc: New. - + 2004-05-22 Benjamin Kosnik * libsupc++/cxxabi.h: Remove duplicated and useless public and - private keywords in class declarations. Format. Use - stddef.h. Expose declarations to "C" compilation. - * libsupc++/tinfo.cc (__upcast_result): Add copy constructor and - assignment operator. - (__dyncast_result): Same. - * libsupc++/vec.cc (uncatch_exception): Same, use member - initialization list. - + private keywords in class declarations. Format. Use + stddef.h. Expose declarations to "C" compilation. + * libsupc++/tinfo.cc (__upcast_result): Add copy constructor and + assignment operator. + (__dyncast_result): Same. + * libsupc++/vec.cc (uncatch_exception): Same, use member + initialization list. + 2004-05-22 Benjamin Kosnik * testsuite/abi_check.cc: Add unistd.h. @@ -1627,7 +1634,7 @@ * testsuite/22_locale/num_put/put/wchar_t/8.cc: Likewise. 2004-05-21 Matthias Klose - + * docs/doxygen/run_doxygen: Bump required version. 2004-05-21 Benjamin Kosnik @@ -1667,14 +1674,14 @@ * docs/doxygen/guide.html: Add dot note. * docs/doxygen/stdheader.cc: Edit, add files. * docs/doxygen/user.cfg.in: Regenerate with Doxygen 1.3.7. - + 2004-05-18 Jonathan Wakely * include/ext/stdio_filebuf.h: Update comments to reflect PR 11691. 2004-05-18 Jan Beulich - - PR libstdc++/15489 + + PR libstdc++/15489 * scripts/create_testsuite_files: Also find source files through symbolic links. @@ -1712,9 +1719,9 @@ 2004-05-17 Douglas Gregor - PR libstdc++/14340 - * include/debug/safe_iterator.h (_Safe_iterator converting - constructor): Only allow declaration to instantiate when the + PR libstdc++/14340 + * include/debug/safe_iterator.h (_Safe_iterator converting + constructor): Only allow declaration to instantiate when the incoming _Safe_iterator has exactly the right iterator type. 2004-05-17 Jonathan Wakely @@ -1754,7 +1761,7 @@ PR libstdc++/15046 * crossconfig.m4: Add C99 math bits for linux crosses. * configure: Regenerate. - + 2004-05-13 Simon Marshall Benjamin Kosnik @@ -1770,16 +1777,16 @@ * config/locale/gnu/numeric_members.cc: Same. * testsuite/testsuite_abi.cc: Same. * testsuite/testsuite_hooks.cc: Same. - + 2004-05-13 Jonathan Wakely - + * docs/html/abi.html: Document effect of -fabi-version on value of __GXX_ABI_VERSION, and that it's defined in c-cppbuiltin.c. Fix markup. 2004-05-13 Benjamin Kosnik - PR libstdc++/15074 + PR libstdc++/15074 * docs/html/faq/index.html: Update docs for libsupc++ usage. 2004-05-13 Benjamin Kosnik @@ -1788,12 +1795,12 @@ * include/bits/stl_threads.h (_GLIBCXX_mutex): Move to namespace __gnu_internal. (_GLIBCXX_mutex_address): Same. - (_GLIBCXX_once): Same. + (_GLIBCXX_once): Same. (_GLIBCXX_mutex_init): Same. (_GLIBCXX_mutex_address_init): Same. - + 2004-05-13 Benjamin Kosnik - + * docs/html/abi.html: New. * docs/html/abi.txt: Remove. * docs/html/documentation.html: Add link. @@ -1805,7 +1812,7 @@ * docs/html/17_intro/TODO: Update. * include/bits/stl_pair.h: Format. - + 2004-05-06 Matthias Klose * include/backward/iterator.h: Add GPL copyright info, @@ -1814,7 +1821,7 @@ * include * libsupc++/tinfo.h: Likewise. * po/string_literals.cc: Likewise. - + 2004-05-03 Andreas Tobler * acinclude.m4: Replace -W with more speaking -Wextra. @@ -1893,7 +1900,7 @@ 2004-04-24 Paolo Carlini - * testsuite/27_io/basic_istream/getline/char/4.cc: New. + * testsuite/27_io/basic_istream/getline/char/4.cc: New. * include/bits/istream.tcc (getline(basic_istream<>&, basic_string<>&, _CharT)): Change to use sgetc()/snextc() instead @@ -1931,17 +1938,17 @@ 2004-04-19 Benjamin Kosnik - * testsuite/27_io/basic_istream/extractors_character/char/9555-ic.cc: + * testsuite/27_io/basic_istream/extractors_character/char/9555-ic.cc: Clarify assertion, set test variable to false before assert. * testsuite/27_io/basic_istringstream/str/char/1.cc: Same. * testsuite/27_io/basic_stringstream/str/char/1.cc: Same. * testsuite/27_io/ios_base/storage/2.cc: Same. - + * testsuite/27_io/basic_filebuf/imbue/char/13171-4.cc: Fix function returns. * testsuite/27_io/basic_filebuf/imbue/wchar_t/13582-3.cc: Same. * testsuite/27_io/fpos/14320-3.cc: Same. - + * testsuite/27_io/basic_filebuf/2.cc: Instantiate in namespace std. * testsuite/27_io/fpos/1.cc: Same. * testsuite/27_io/basic_stringstream/2.cc: Same. @@ -1970,30 +1977,30 @@ * testsuite/21_strings/char_traits/requirements/wchar_t/1.cc: Same. * testsuite/21_strings/char_traits/requirements/char/1.cc: Same. * testsuite/21_strings/char_traits/requirements/short/1.cc: Same. - * testsuite/27_io/basic_istream/seekg/char/exceptions_badbit_throw.cc: + * testsuite/27_io/basic_istream/seekg/char/exceptions_badbit_throw.cc: Same. * testsuite/27_io/basic_ostream/inserters_arithmetic/char/exceptions_badbit_throw.cc: Same. - * testsuite/27_io/basic_ostream/seekp/char/exceptions_badbit_throw.cc: + * testsuite/27_io/basic_ostream/seekp/char/exceptions_badbit_throw.cc: Same. * testsuite/27_io/basic_ostream/inserters_arithmetic/char/exceptions_failbit_throw.cc: Same. * testsuite/27_io/types/2.cc: Same. * testsuite/ext/stdio_sync_filebuf/wchar_t/12077.cc: Fix temporary - file name. + file name. * testsuite/27_io/fpos/14775.cc: Same. - + 2004-04-19 Paolo Carlini PR libstdc++/15002 (partial) * include/bits/basic_string.h (_M_replace_aux, _M_replace_safe): - Special case __n2 == 1, not calling traits_type::assign/copy. + Special case __n2 == 1, not calling traits_type::assign/copy. 2004-04-17 Benjamin Kosnik * include/bits/stl_bvector.h: Use _M_impl._M_start. - + 2004-04-16 Benjamin Kosnik - + * include/bits/c++config (_GLIBCXX_STD): New. * src/list.cc: Use it. * include/std/std_bitset.h: Same. @@ -2015,7 +2022,7 @@ * include/debug/map.h: Same. * include/debug/list: Same. * include/debug/deque: Same. - * include/debug/bitset: Same. + * include/debug/bitset: Same. * include/debug/formatter.h (__gnu_debug): Remove using directive. Add using declaration for std::type_info. * include/debug/safe_iterator.h: Add using declaration for @@ -2029,7 +2036,7 @@ * include/bits/stl_bvector.h (_Bvector_base): Use _Bvector_impl idiom that other containers use. * testsuite/23_containers/vector/bool/clear_allocator.cc: New. - + 2004-04-16 Paolo Carlini PR libstdc++/14975 diff --git a/libstdc++-v3/testsuite/20_util/memory/auto_ptr/assign_neg.cc b/libstdc++-v3/testsuite/20_util/memory/auto_ptr/assign_neg.cc index 55291676f3d9..8899c9893ace 100644 --- a/libstdc++-v3/testsuite/20_util/memory/auto_ptr/assign_neg.cc +++ b/libstdc++-v3/testsuite/20_util/memory/auto_ptr/assign_neg.cc @@ -46,5 +46,5 @@ main() test01(); return 0; } -// { dg-error "candidates" "" { target *-*-* } 223 } -// { dg-error "std::auto_ptr" "" { target *-*-* } 353 } +// { dg-error "candidates" "" { target *-*-* } 222 } +// { dg-error "std::auto_ptr" "" { target *-*-* } 352 } diff --git a/libstdc++-v3/testsuite/23_containers/map/operators/1_neg.cc b/libstdc++-v3/testsuite/23_containers/map/operators/1_neg.cc index 64a1d7df866d..15b182d0c263 100644 --- a/libstdc++-v3/testsuite/23_containers/map/operators/1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/map/operators/1_neg.cc @@ -41,5 +41,5 @@ void test01() test &= itr == mapByName.end(); // { dg-error "no" } } -// { dg-error "candidates are" "" { target *-*-* } 209 } -// { dg-error "candidates are" "" { target *-*-* } 213 } +// { dg-error "candidates are" "" { target *-*-* } 208 } +// { dg-error "candidates are" "" { target *-*-* } 212 } diff --git a/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc b/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc index 8af78f30837e..4a5b45bd74cb 100644 --- a/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc @@ -39,6 +39,5 @@ void test01() test &= itr == setByName.end(); // { dg-error "no" } } -// { dg-error "candidates are" "" { target *-*-* } 282 } -// { dg-error "candidates are" "" { target *-*-* } 286 } - +// { dg-error "candidates are" "" { target *-*-* } 281 } +// { dg-error "candidates are" "" { target *-*-* } 285 }