This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [CPP] fix some diagnostic locations
>>>>> "Manuel" == Manuel LÃpez-IbÃÃez <lopezibanez@gmail.com> writes:
Tom> If you plan to do more work in this area, and you'd like it as a
Tom> starting point, I can send it.
Manuel> Yes definitely.
I've appended it. I haven't updated my trunk tree recently so I would
not be surprised if it did not apply cleanly.
I'm not sure when I'll get around to finishing this. It is a bit big
for stage 3, so I probably won't bother until the next stage 1. Also,
parts of it are weird and could use a rethink.
If you do work on it, let me know. I'd rather we not duplicate work :)
Manuel> So, are you sure you want me to commit the patch? If your
Manuel> solution is better...
Sure, go ahead. In this particular area my patch is different, but
I think not really any better.
Tom
Index: libcpp/macro.c
===================================================================
--- libcpp/macro.c (revision 140858)
+++ libcpp/macro.c (working copy)
@@ -67,7 +67,7 @@
static cpp_token *lex_expansion_token (cpp_reader *, cpp_macro *);
static bool warn_of_redefinition (cpp_reader *, const cpp_hashnode *,
const cpp_macro *);
-static bool parse_params (cpp_reader *, cpp_macro *);
+static bool parse_params (cpp_reader *, cpp_macro *, source_location);
static void check_trad_stringification (cpp_reader *, const cpp_macro *,
const cpp_string *);
@@ -1476,9 +1476,10 @@
}
/* Check the syntax of the parameters in a MACRO definition. Returns
- false if an error occurs. */
+ false if an error occurs. LOCATION is the location of the open
+ paren. */
static bool
-parse_params (cpp_reader *pfile, cpp_macro *macro)
+parse_params (cpp_reader *pfile, cpp_macro *macro, source_location location)
{
unsigned int prev_ident = 0;
@@ -1549,10 +1550,15 @@
token = _cpp_lex_token (pfile);
if (token->type == CPP_CLOSE_PAREN)
return true;
+
+ /* Put the error on the token after the ellipsis in this
+ case. */
+ location = token->src_loc;
/* Fall through. */
case CPP_EOF:
- cpp_error (pfile, CPP_DL_ERROR, "missing ')' in macro parameter list");
+ cpp_error_with_line (pfile, CPP_DL_ERROR, location, 0,
+ "missing ')' in macro parameter list");
return false;
}
}
@@ -1600,6 +1606,7 @@
cpp_token *token;
const cpp_token *ctoken;
bool following_paste_op = false;
+ source_location previous_location;
const char *paste_op_error_msg =
N_("'##' cannot appear at either end of a macro expansion");
@@ -1609,7 +1616,7 @@
if (ctoken->type == CPP_OPEN_PAREN && !(ctoken->flags & PREV_WHITE))
{
- bool ok = parse_params (pfile, macro);
+ bool ok = parse_params (pfile, macro, ctoken->src_loc);
macro->params = (cpp_hashnode **) BUFF_FRONT (pfile->a_buff);
if (!ok)
return false;
@@ -1688,8 +1695,8 @@
/* Let assembler get away with murder. */
else if (CPP_OPTION (pfile, lang) != CLK_ASM)
{
- cpp_error (pfile, CPP_DL_ERROR,
- "'#' is not followed by a macro parameter");
+ cpp_error_with_line (pfile, CPP_DL_ERROR, token[-1].src_loc, 0,
+ "'#' is not followed by a macro parameter");
return false;
}
}
@@ -1701,7 +1708,8 @@
function-like macros, but not at the end. */
if (following_paste_op)
{
- cpp_error (pfile, CPP_DL_ERROR, paste_op_error_msg);
+ cpp_error_with_line (pfile, CPP_DL_ERROR, previous_location, 0,
+ paste_op_error_msg);
return false;
}
break;
@@ -1714,7 +1722,8 @@
function-like macros, but not at the beginning. */
if (macro->count == 1)
{
- cpp_error (pfile, CPP_DL_ERROR, paste_op_error_msg);
+ cpp_error_with_line (pfile, CPP_DL_ERROR, token->src_loc, 0,
+ paste_op_error_msg);
return false;
}
@@ -1723,6 +1732,7 @@
}
following_paste_op = (token->type == CPP_PASTE);
+ previous_location = token->src_loc;
token = lex_expansion_token (pfile, macro);
}
@@ -1753,7 +1763,8 @@
/* Parse a macro and save its expansion. Returns nonzero on success. */
bool
-_cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node)
+_cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node,
+ source_location location)
{
cpp_macro *macro;
unsigned int i;
@@ -1764,7 +1775,7 @@
(sizeof (cpp_macro));
else
macro = (cpp_macro *) _cpp_aligned_alloc (pfile, sizeof (cpp_macro));
- macro->line = pfile->directive_line;
+ macro->line = location;
macro->params = 0;
macro->paramc = 0;
macro->variadic = 0;
@@ -1807,7 +1818,7 @@
if (warn_of_redefinition (pfile, node, macro))
{
- cpp_error_with_line (pfile, CPP_DL_PEDWARN, pfile->directive_line, 0,
+ cpp_error_with_line (pfile, CPP_DL_PEDWARN, macro->line, 0,
"\"%s\" redefined", NODE_NAME (node));
if (node->type == NT_MACRO && !(node->flags & NODE_BUILTIN))
Index: libcpp/directives.c
===================================================================
--- libcpp/directives.c (revision 140858)
+++ libcpp/directives.c (working copy)
@@ -93,18 +93,20 @@
static void skip_rest_of_line (cpp_reader *);
static void check_eol (cpp_reader *);
-static void start_directive (cpp_reader *);
+static void start_directive (cpp_reader *, source_location);
static void prepare_directive_trad (cpp_reader *);
static void end_directive (cpp_reader *, int);
-static void directive_diagnostics (cpp_reader *, const directive *, int);
+static void directive_diagnostics (cpp_reader *, const directive *, int,
+ source_location);
static void run_directive (cpp_reader *, int, const char *, size_t);
-static char *glue_header_name (cpp_reader *);
-static const char *parse_include (cpp_reader *, int *, const cpp_token ***);
+static char *glue_header_name (cpp_reader *, source_location *);
+static const char *parse_include (cpp_reader *, int *, const cpp_token ***,
+ source_location *);
static void push_conditional (cpp_reader *, int, int, const cpp_hashnode *);
static unsigned int read_flag (cpp_reader *, unsigned int);
static bool strtolinenum (const uchar *, size_t, linenum_type *, bool *);
static void do_diagnostic (cpp_reader *, int, int);
-static cpp_hashnode *lex_macro_node (cpp_reader *, bool);
+static const cpp_token *lex_macro_node (cpp_reader *, bool);
static int undefine_macros (cpp_reader *, cpp_hashnode *, void *);
static void do_include_common (cpp_reader *, enum include_type);
static struct pragma_entry *lookup_pragma_entry (struct pragma_entry *,
@@ -120,9 +122,11 @@
static void do_linemarker (cpp_reader *);
static const cpp_token *get_token_no_padding (cpp_reader *);
static const cpp_token *get__Pragma_string (cpp_reader *);
-static void destringize_and_run (cpp_reader *, const cpp_string *);
-static int parse_answer (cpp_reader *, struct answer **, int);
-static cpp_hashnode *parse_assertion (cpp_reader *, struct answer **, int);
+static void destringize_and_run (cpp_reader *, const cpp_string *,
+ unsigned int, source_location);
+static int parse_answer (cpp_reader *, source_location, struct answer **, int);
+static cpp_hashnode *parse_assertion (cpp_reader *, source_location,
+ struct answer **, int);
static struct answer ** find_answer (cpp_hashnode *, const struct answer *);
static void handle_assertion (cpp_reader *, const char *, int);
@@ -257,9 +261,12 @@
return buf;
}
-/* Called when entering a directive, _Pragma or command-line directive. */
+/* Called when entering a directive, _Pragma or command-line
+ directive. LOC is the location of the directive, used by some
+ handlers for diagnostics. If zero, the line table's highest line
+ is used instead. */
static void
-start_directive (cpp_reader *pfile)
+start_directive (cpp_reader *pfile, source_location loc)
{
/* Setup in-directive state. */
pfile->state.in_directive = 1;
@@ -267,7 +274,7 @@
pfile->directive_result.type = CPP_PADDING;
/* Some handlers need the position of the # for diagnostics. */
- pfile->directive_line = pfile->line_table->highest_line;
+ pfile->directive_line = loc ? loc : pfile->line_table->highest_line;
}
/* Called when leaving a directive, _Pragma or command-line directive. */
@@ -309,6 +316,13 @@
{
if (pfile->directive != &dtable[T_DEFINE])
{
+ /* Save the current highest line. */
+/* struct line_map *saved_map */
+/* = &pfile->line_table->maps[pfile->line_table->used - 1]; */
+/* struct line_map *map; */
+/* linenum_type saved_max_line */
+/* = SOURCE_LINE (saved_map, pfile->line_table->highest_line); */
+
bool no_expand = (pfile->directive
&& ! (pfile->directive->flags & EXPAND));
bool was_skipping = pfile->state.skipping;
@@ -321,6 +335,11 @@
if (no_expand)
pfile->state.prevent_expansion++;
_cpp_scan_out_logical_line (pfile, NULL);
+
+/* map = &pfile->line_table->maps[pfile->line_table->used - 1]; */
+/* if (SOURCE_LINE (map, pfile->line_table->highest_line) != saved_max_line) */
+/* linemap_line_start (pfile->line_table, saved_max_line, 0); */
+
if (no_expand)
pfile->state.prevent_expansion--;
@@ -334,9 +353,10 @@
}
/* Output diagnostics for a directive DIR. INDENTED is nonzero if
- the '#' was indented. */
+ the '#' was indented. HASH_LOC is the location of the '#' token. */
static void
-directive_diagnostics (cpp_reader *pfile, const directive *dir, int indented)
+directive_diagnostics (cpp_reader *pfile, const directive *dir, int indented,
+ source_location hash_loc)
{
/* Issue -pedantic or deprecated warnings for extensions. We let
-pedantic take precedence if both are applicable. */
@@ -345,12 +365,14 @@
if (dir->origin == EXTENSION
&& !(dir == &dtable[T_IMPORT] && CPP_OPTION (pfile, objc))
&& CPP_PEDANTIC (pfile))
- cpp_error (pfile, CPP_DL_PEDWARN, "#%s is a GCC extension", dir->name);
+ cpp_error_with_line (pfile, CPP_DL_PEDWARN, hash_loc, 0,
+ "#%s is a GCC extension", dir->name);
else if (((dir->flags & DEPRECATED) != 0
|| (dir == &dtable[T_IMPORT] && !CPP_OPTION (pfile, objc)))
&& CPP_OPTION (pfile, warn_deprecated))
- cpp_error (pfile, CPP_DL_WARNING, "#%s is a deprecated GCC extension",
- dir->name);
+ cpp_error_with_line (pfile, CPP_DL_WARNING, hash_loc, 0,
+ "#%s is a deprecated GCC extension",
+ dir->name);
}
/* Traditionally, a directive is ignored unless its # is in
@@ -362,16 +384,16 @@
if (CPP_WTRADITIONAL (pfile))
{
if (dir == &dtable[T_ELIF])
- cpp_error (pfile, CPP_DL_WARNING,
- "suggest not using #elif in traditional C");
+ cpp_error_with_line (pfile, CPP_DL_WARNING, hash_loc, 0,
+ "suggest not using #elif in traditional C");
else if (indented && dir->origin == KANDR)
- cpp_error (pfile, CPP_DL_WARNING,
- "traditional C ignores #%s with the # indented",
- dir->name);
+ cpp_error_with_line (pfile, CPP_DL_WARNING, hash_loc, 0,
+ "traditional C ignores #%s with the # indented",
+ dir->name);
else if (!indented && dir->origin != KANDR)
- cpp_error (pfile, CPP_DL_WARNING,
- "suggest hiding #%s from traditional C with an indented #",
- dir->name);
+ cpp_error_with_line (pfile, CPP_DL_WARNING, hash_loc, 0,
+ "suggest hiding #%s from traditional C with an indented #",
+ dir->name);
}
}
@@ -388,6 +410,7 @@
bool was_parsing_args = pfile->state.parsing_args;
bool was_discarding_output = pfile->state.discarding_output;
int skip = 1;
+ source_location hash_location = pfile->line_table->highest_location;
if (was_discarding_output)
pfile->state.prevent_expansion = 0;
@@ -400,7 +423,7 @@
pfile->state.parsing_args = 0;
pfile->state.prevent_expansion = 0;
}
- start_directive (pfile);
+ start_directive (pfile, 0);
dname = _cpp_lex_token (pfile);
if (dname->type == CPP_NAME)
@@ -455,7 +478,7 @@
pfile->state.angled_headers = dir->flags & INCL;
pfile->state.directive_wants_padding = dir->flags & INCL;
if (! CPP_OPTION (pfile, preprocessed))
- directive_diagnostics (pfile, dir, indented);
+ directive_diagnostics (pfile, dir, indented, hash_location);
if (pfile->state.skipping && !(dir->flags & COND))
dir = 0;
}
@@ -503,7 +526,7 @@
{
cpp_push_buffer (pfile, (const uchar *) buf, count,
/* from_stage3 */ true);
- start_directive (pfile);
+ start_directive (pfile, 0);
/* This is a short-term fix to prevent a leading '#' being
interpreted as a directive. */
@@ -521,7 +544,7 @@
#ifndef directives. IS_DEF_OR_UNDEF is true if this call is
processing a #define or #undefine directive, and false
otherwise. */
-static cpp_hashnode *
+static const cpp_token *
lex_macro_node (cpp_reader *pfile, bool is_def_or_undef)
{
const cpp_token *token = _cpp_lex_token (pfile);
@@ -541,7 +564,7 @@
cpp_error (pfile, CPP_DL_ERROR,
"\"defined\" cannot be used as a macro name");
else if (! (node->flags & NODE_POISONED))
- return node;
+ return token;
}
else if (token->flags & NAMED_OP)
cpp_error (pfile, CPP_DL_ERROR,
@@ -560,10 +583,12 @@
static void
do_define (cpp_reader *pfile)
{
- cpp_hashnode *node = lex_macro_node (pfile, true);
+ const cpp_token *token = lex_macro_node (pfile, true);
- if (node)
+ if (token)
{
+ cpp_hashnode *node = token->val.node;
+
/* If we have been requested to expand comments into macros,
then re-enable saving of comments. */
pfile->state.save_comments =
@@ -572,7 +597,7 @@
if (pfile->cb.before_define)
pfile->cb.before_define (pfile);
- if (_cpp_create_definition (pfile, node))
+ if (_cpp_create_definition (pfile, node, token->src_loc))
if (pfile->cb.define)
pfile->cb.define (pfile, pfile->directive_line, node);
@@ -584,10 +609,12 @@
static void
do_undef (cpp_reader *pfile)
{
- cpp_hashnode *node = lex_macro_node (pfile, true);
+ const cpp_token *token = lex_macro_node (pfile, true);
- if (node)
+ if (token)
{
+ cpp_hashnode *node = token->val.node;
+
if (pfile->cb.before_define)
pfile->cb.before_define (pfile);
@@ -636,9 +663,10 @@
/* Helper routine used by parse_include. Reinterpret the current line
as an h-char-sequence (< ... >); we are looking at the first token
- after the <. Returns a malloced filename. */
+ after the <. Returns a malloced filename. *LOCATION is set to a
+ location suitable for diagnostics. */
static char *
-glue_header_name (cpp_reader *pfile)
+glue_header_name (cpp_reader *pfile, source_location *location)
{
const cpp_token *token;
char *buffer;
@@ -651,6 +679,9 @@
{
token = get_token_no_padding (pfile);
+ if (!total_len)
+ *location = token->src_loc;
+
if (token->type == CPP_GREATER)
break;
if (token->type == CPP_EOF)
@@ -680,10 +711,11 @@
/* Returns the file name of #include, #include_next, #import and
#pragma dependency. The string is malloced and the caller should
- free it. Returns NULL on error. */
+ free it. Returns NULL on error. *LOCATION is set to the location
+ at which diagnostics should be emitted. */
static const char *
parse_include (cpp_reader *pfile, int *pangle_brackets,
- const cpp_token ***buf)
+ const cpp_token ***buf, source_location *location)
{
char *fname;
const cpp_token *header;
@@ -696,10 +728,11 @@
memcpy (fname, header->val.str.text + 1, header->val.str.len - 2);
fname[header->val.str.len - 2] = '\0';
*pangle_brackets = header->type == CPP_HEADER_NAME;
+ *location = header->src_loc;
}
else if (header->type == CPP_LESS)
{
- fname = glue_header_name (pfile);
+ fname = glue_header_name (pfile, location);
*pangle_brackets = 1;
}
else
@@ -739,12 +772,13 @@
const char *fname;
int angle_brackets;
const cpp_token **buf = NULL;
+ source_location err_loc;
/* Re-enable saving of comments if requested, so that the include
callback can dump comments which follow #include. */
pfile->state.save_comments = ! CPP_OPTION (pfile, discard_comments);
- fname = parse_include (pfile, &angle_brackets, &buf);
+ fname = parse_include (pfile, &angle_brackets, &buf, &err_loc);
if (!fname)
{
if (buf)
@@ -754,8 +788,9 @@
if (!*fname)
{
- cpp_error (pfile, CPP_DL_ERROR, "empty filename in #%s",
- pfile->directive->name);
+ cpp_error_with_line (pfile, CPP_DL_ERROR, err_loc, 0,
+ "empty filename in #%s",
+ pfile->directive->name);
XDELETEVEC (fname);
if (buf)
XDELETEVEC (buf);
@@ -764,7 +799,8 @@
/* Prevent #include recursion. */
if (pfile->line_table->depth >= CPP_STACK_MAX)
- cpp_error (pfile, CPP_DL_ERROR, "#include nested too deeply");
+ cpp_error_with_line (pfile, CPP_DL_ERROR, pfile->directive_line, 0,
+ "#include nested too deeply");
else
{
/* Get out of macro context, if we are. */
@@ -1467,18 +1503,20 @@
{
const char *fname;
int angle_brackets, ordering;
+ source_location err_loc;
- fname = parse_include (pfile, &angle_brackets, NULL);
+ fname = parse_include (pfile, &angle_brackets, NULL, &err_loc);
if (!fname)
return;
ordering = _cpp_compare_file_date (pfile, fname, angle_brackets);
if (ordering < 0)
- cpp_error (pfile, CPP_DL_WARNING, "cannot find source file %s", fname);
+ cpp_error_with_line (pfile, CPP_DL_WARNING, err_loc, 0,
+ "cannot find source file %s", fname);
else if (ordering > 0)
{
- cpp_error (pfile, CPP_DL_WARNING,
- "current file is older than %s", fname);
+ cpp_error_with_line (pfile, CPP_DL_WARNING, err_loc, 0,
+ "current file is older than %s", fname);
if (cpp_get_token (pfile)->type != CPP_EOF)
{
_cpp_backup_tokens (pfile, 1);
@@ -1532,9 +1570,14 @@
}
/* Destringize IN into a temporary buffer, by removing the first \ of
- \" and \\ sequences, and process the result as a #pragma directive. */
+ \" and \\ sequences, and process the result as a #pragma directive.
+ START_COLUMN is the starting column of the string.
+ DIRECTIVE_LOCATION is the location of the directive itself, for
+ error-reporting purposes. */
static void
-destringize_and_run (cpp_reader *pfile, const cpp_string *in)
+destringize_and_run (cpp_reader *pfile, const cpp_string *in,
+ unsigned int start_column,
+ source_location directive_location)
{
const unsigned char *src, *limit;
char *dest, *result;
@@ -1545,7 +1588,12 @@
int count;
const struct directive *save_directive;
- dest = result = (char *) alloca (in->len - 1);
+ dest = result = (char *) alloca (start_column + in->len - 1);
+
+ /* Skip over to the correct starting column. */
+ while (start_column--)
+ *dest++ = ' ';
+
src = in->text + 1 + (in->text[0] == 'L');
limit = in->text + in->len - 1;
while (src < limit)
@@ -1582,7 +1630,7 @@
if (pfile->buffer->prev)
pfile->buffer->file = pfile->buffer->prev->file;
- start_directive (pfile);
+ start_directive (pfile, directive_location);
_cpp_clean_line (pfile);
save_directive = pfile->directive;
pfile->directive = &dtable[T_PRAGMA];
@@ -1658,7 +1706,39 @@
if (string)
{
- destringize_and_run (pfile, &string->val.str);
+ struct line_maps *line_table = pfile->line_table;
+
+ /* Save the current highest line. */
+ struct line_map *saved_map = &line_table->maps[line_table->used - 1];
+ linenum_type saved_max_line = SOURCE_LINE (saved_map,
+ line_table->highest_line);
+
+ const struct line_map *map = linemap_lookup (line_table, string->src_loc);
+ unsigned int column = SOURCE_COLUMN (map, string->src_loc);
+ source_location dir_loc;
+
+ /* Go "back" to the string's line, so that error messages can be
+ reported properly. */
+ linemap_line_start (line_table, SOURCE_LINE (map, string->src_loc), 0);
+
+ /* Set the directive's location properly for pragma handlers.
+ The logic here is a bit funny -- at this point, we know that
+ no context for the _Pragma has been pushed. So, if the
+ current context came from a macro, it is some outer macro
+ whose expansion has a _Pragma. In this case we want to the
+ directive to use the invocation location of the macro, if
+ that exists. Otherwise, the directive should just use the
+ location of the _Pragma's argument. */
+ if (pfile->context->macro && pfile->invocation_location)
+ dir_loc = pfile->invocation_location;
+ else
+ LINEMAP_POSITION_FOR_COLUMN (dir_loc, line_table, column);
+
+ destringize_and_run (pfile, &string->val.str, column, dir_loc);
+
+ /* Now return to the saved line. */
+ linemap_line_start (line_table, saved_max_line, 0);
+
return 1;
}
cpp_error (pfile, CPP_DL_ERROR,
@@ -1674,10 +1754,12 @@
if (! pfile->state.skipping)
{
- cpp_hashnode *node = lex_macro_node (pfile, false);
+ const cpp_token *token = lex_macro_node (pfile, false);
- if (node)
+ if (token)
{
+ cpp_hashnode *node = token->val.node;
+
skip = node->type != NT_MACRO;
_cpp_mark_macro_used (node);
if (!(node->flags & NODE_USED))
@@ -1710,10 +1792,12 @@
if (! pfile->state.skipping)
{
- node = lex_macro_node (pfile, false);
+ const cpp_token *token = lex_macro_node (pfile, false);
- if (node)
+ if (token)
{
+ node = token->val.node;
+
skip = node->type == NT_MACRO;
_cpp_mark_macro_used (node);
if (!(node->flags & NODE_USED))
@@ -1889,11 +1973,14 @@
/* Read the tokens of the answer into the macro pool, in a directive
of type TYPE. Only commit the memory if we intend it as permanent
storage, i.e. the #assert case. Returns 0 on success, and sets
- ANSWERP to point to the answer. */
+ ANSWERP to point to the answer. ERROR_LOC is when reporting errors
+ where the location of the tokens in the answer itself are not
+ useful. */
static int
-parse_answer (cpp_reader *pfile, struct answer **answerp, int type)
+parse_answer (cpp_reader *pfile, source_location error_loc,
+ struct answer **answerp, int type)
{
- const cpp_token *paren;
+ const cpp_token *paren, *previous_token;
struct answer *answer;
unsigned int acount;
@@ -1916,10 +2003,12 @@
if (type == T_UNASSERT && paren->type == CPP_EOF)
return 0;
- cpp_error (pfile, CPP_DL_ERROR, "missing '(' after predicate");
+ cpp_error_with_line (pfile, CPP_DL_ERROR, error_loc, 0,
+ "missing '(' after predicate");
return 1;
}
+ previous_token = paren;
for (acount = 0;; acount++)
{
size_t room_needed;
@@ -1931,7 +2020,11 @@
if (token->type == CPP_EOF)
{
- cpp_error (pfile, CPP_DL_ERROR, "missing ')' to complete answer");
+ /* If we had the location of the end of the previous token,
+ we could use that here. */
+ cpp_error_with_line (pfile, CPP_DL_ERROR,
+ previous_token->src_loc, 0,
+ "missing ')' to complete answer");
return 1;
}
@@ -1947,6 +2040,7 @@
/* Drop whitespace at start, for answer equivalence purposes. */
if (acount == 0)
dest->flags &= ~PREV_WHITE;
+ previous_token = token;
}
if (acount == 0)
@@ -1965,9 +2059,14 @@
/* Parses an assertion directive of type TYPE, returning a pointer to
the hash node of the predicate, or 0 on error. If an answer was
- supplied, it is placed in ANSWERP, otherwise it is set to 0. */
+ supplied, it is placed in ANSWERP, otherwise it is set to 0.
+ ERROR_LOC is used when reporting syntax errors in the assertion,
+ when the tokens of the assertion itself are not useful for this
+ purpose. It should point to an appropriate location at the start
+ of the assertion. */
static cpp_hashnode *
-parse_assertion (cpp_reader *pfile, struct answer **answerp, int type)
+parse_assertion (cpp_reader *pfile, source_location error_loc,
+ struct answer **answerp, int type)
{
cpp_hashnode *result = 0;
const cpp_token *predicate;
@@ -1978,10 +2077,12 @@
*answerp = 0;
predicate = cpp_get_token (pfile);
if (predicate->type == CPP_EOF)
- cpp_error (pfile, CPP_DL_ERROR, "assertion without predicate");
+ cpp_error_with_line (pfile, CPP_DL_ERROR, error_loc, 0,
+ "assertion without predicate");
else if (predicate->type != CPP_NAME)
- cpp_error (pfile, CPP_DL_ERROR, "predicate must be an identifier");
- else if (parse_answer (pfile, answerp, type) == 0)
+ cpp_error_with_line (pfile, CPP_DL_ERROR, predicate->src_loc, 0,
+ "predicate must be an identifier");
+ else if (parse_answer (pfile, predicate->src_loc, answerp, type) == 0)
{
unsigned int len = NODE_LEN (predicate->val.node);
unsigned char *sym = (unsigned char *) alloca (len + 1);
@@ -2024,14 +2125,17 @@
/* Test an assertion within a preprocessor conditional. Returns
nonzero on failure, zero on success. On success, the result of
- the test is written into VALUE, otherwise the value 0. */
+ the test is written into VALUE, otherwise the value 0. ERROR_LOC
+ is the location of the '#' token; it is used for error reporting in
+ some situations. */
int
-_cpp_test_assertion (cpp_reader *pfile, unsigned int *value)
+_cpp_test_assertion (cpp_reader *pfile, source_location error_loc,
+ unsigned int *value)
{
struct answer *answer;
cpp_hashnode *node;
- node = parse_assertion (pfile, &answer, T_IF);
+ node = parse_assertion (pfile, error_loc, &answer, T_IF);
/* For recovery, an erroneous assertion expression is handled as a
failing assertion. */
@@ -2054,7 +2158,7 @@
struct answer *new_answer;
cpp_hashnode *node;
- node = parse_assertion (pfile, &new_answer, T_ASSERT);
+ node = parse_assertion (pfile, pfile->directive_line, &new_answer, T_ASSERT);
if (node)
{
size_t answer_size;
@@ -2099,7 +2203,7 @@
cpp_hashnode *node;
struct answer *answer;
- node = parse_assertion (pfile, &answer, T_UNASSERT);
+ node = parse_assertion (pfile, pfile->directive_line, &answer, T_UNASSERT);
/* It isn't an error to #unassert something that isn't asserted. */
if (node && node->type == NT_ASSERTION)
{
@@ -2201,29 +2305,29 @@
}
/* Like lex_macro_node, but read the input from STR. */
-static cpp_hashnode *
+static const cpp_token *
lex_macro_node_from_str (cpp_reader *pfile, const char *str)
{
size_t len = strlen (str);
uchar *buf = (uchar *) alloca (len + 1);
- cpp_hashnode *node;
+ const cpp_token *token;
memcpy (buf, str, len);
buf[len] = '\n';
cpp_push_buffer (pfile, buf, len, true);
- node = lex_macro_node (pfile, true);
+ token = lex_macro_node (pfile, true);
_cpp_pop_buffer (pfile);
- return node;
+ return token;
}
/* If STR is a defined macro, return its definition node, else return NULL. */
cpp_macro *
cpp_push_definition (cpp_reader *pfile, const char *str)
{
- cpp_hashnode *node = lex_macro_node_from_str (pfile, str);
- if (node && node->type == NT_MACRO)
- return node->value.macro;
+ const cpp_token *token = lex_macro_node_from_str (pfile, str);
+ if (token && token->val.node->type == NT_MACRO)
+ return token->val.node->value.macro;
else
return NULL;
}
@@ -2233,9 +2337,11 @@
void
cpp_pop_definition (cpp_reader *pfile, const char *str, cpp_macro *dfn)
{
- cpp_hashnode *node = lex_macro_node_from_str (pfile, str);
- if (node == NULL)
+ cpp_hashnode *node;
+ const cpp_token *token = lex_macro_node_from_str (pfile, str);
+ if (token == NULL)
return;
+ node = token->val.node;
if (pfile->cb.before_define)
pfile->cb.before_define (pfile);
Index: libcpp/ChangeLog
===================================================================
--- libcpp/ChangeLog (revision 140858)
+++ libcpp/ChangeLog (working copy)
@@ -1,3 +1,21 @@
+2008-08-28 Tom Tromey <tromey@redhat.com>
+
+ * internal.h (_cpp_test_assertion): Update.
+ * expr.c (eval_token): Update.
+ * directives.c (start_directive): Add loc argument.
+ (_cpp_handle_directive): Update.
+ (run_directive): Update.
+ (destringize_and_run): Add start_column and directive_location
+ arguments. Insert spaces into temporary buffer.
+ (_cpp_do__Pragma): Save and restore current location.
+ (parse_answer): Add error_loc argument. Use cpp_error_with_line.
+ (parse_assertion): Likewise.
+ (_cpp_test_assertion): Add error_loc argument.
+ (do_assert): Update.
+ (do_unassert): Update.
+ * macro.c (create_iso_definition): Emit '##' error at correct
+ location.
+
2008-09-18 Simon Baldwin <simonb@google.com>
* include/cpplib.h (struct cpp_options): Add new boolean flag
Index: libcpp/pch.c
===================================================================
--- libcpp/pch.c (revision 140858)
+++ libcpp/pch.c (working copy)
@@ -1,5 +1,5 @@
/* Part of CPP library. (Precompiled header reading/writing.)
- Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2008
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
@@ -702,7 +702,9 @@
!= NULL)
{
_cpp_clean_line (r);
- if (!_cpp_create_definition (r, h))
+ /* It is strange, but we do not seem to save macro
+ locations. */
+ if (!_cpp_create_definition (r, h, 0))
abort ();
_cpp_pop_buffer (r);
}
Index: libcpp/expr.c
===================================================================
--- libcpp/expr.c (revision 140858)
+++ libcpp/expr.c (working copy)
@@ -43,8 +43,10 @@
static cpp_num num_trim (cpp_num, size_t);
static cpp_num num_part_mul (cpp_num_part, cpp_num_part);
-static cpp_num num_unary_op (cpp_reader *, cpp_num, enum cpp_ttype);
-static cpp_num num_binary_op (cpp_reader *, cpp_num, cpp_num, enum cpp_ttype);
+static cpp_num num_unary_op (cpp_reader *, cpp_num, enum cpp_ttype,
+ source_location);
+static cpp_num num_binary_op (cpp_reader *, cpp_num, cpp_num, enum cpp_ttype,
+ source_location);
static cpp_num num_negate (cpp_num, size_t);
static cpp_num num_bitwise_op (cpp_reader *, cpp_num, cpp_num, enum cpp_ttype);
static cpp_num num_inequality_op (cpp_reader *, cpp_num, cpp_num,
@@ -52,7 +54,8 @@
static cpp_num num_equality_op (cpp_reader *, cpp_num, cpp_num,
enum cpp_ttype);
static cpp_num num_mul (cpp_reader *, cpp_num, cpp_num);
-static cpp_num num_div_op (cpp_reader *, cpp_num, cpp_num, enum cpp_ttype);
+static cpp_num num_div_op (cpp_reader *, cpp_num, cpp_num, enum cpp_ttype,
+ source_location);
static cpp_num num_lshift (cpp_num, size_t, size_t);
static cpp_num num_rshift (cpp_num, size_t, size_t);
@@ -70,11 +73,34 @@
/* With -O2, gcc appears to produce nice code, moving the error
message load and subsequent jump completely out of the main path. */
-#define SYNTAX_ERROR(msgid) \
- do { cpp_error (pfile, CPP_DL_ERROR, msgid); goto syntax_error; } while(0)
-#define SYNTAX_ERROR2(msgid, arg) \
- do { cpp_error (pfile, CPP_DL_ERROR, msgid, arg); goto syntax_error; } \
- while(0)
+#define SYNTAX_ERROR(loc, msgid) \
+ do \
+ { \
+ cpp_error_with_line (pfile, CPP_DL_ERROR, loc, 0, msgid); \
+ goto syntax_error; \
+ } \
+ while (0)
+#define SYNTAX_ERROR2(loc, msgid, arg) \
+ do \
+ { \
+ cpp_error_with_line (pfile, CPP_DL_ERROR, loc, 0, msgid, arg); \
+ goto syntax_error; \
+ } \
+ while (0)
+#define SYNTAX_ERROR_NOLOC(msgid) \
+ do \
+ { \
+ cpp_error (pfile, CPP_DL_ERROR, msgid); \
+ goto syntax_error; \
+ } \
+ while (0)
+#define SYNTAX_ERROR2_NOLOC(msgid, arg) \
+ do \
+ { \
+ cpp_error (pfile, CPP_DL_ERROR, msgid, arg); \
+ goto syntax_error; \
+ } \
+ while (0)
/* Subroutine of cpp_classify_number. S points to a float suffix of
length LEN, possibly zero. Returns 0 for an invalid suffix, or a
@@ -258,7 +284,7 @@
if (float_flag == NOT_FLOAT)
float_flag = AFTER_POINT;
else
- SYNTAX_ERROR ("too many decimal points in number");
+ SYNTAX_ERROR_NOLOC ("too many decimal points in number");
}
else if ((radix <= 10 && (c == 'e' || c == 'E'))
|| (radix == 16 && (c == 'p' || c == 'P')))
@@ -300,19 +326,17 @@
if (max_digit >= radix)
{
if (radix == 2)
- SYNTAX_ERROR2 ("invalid digit \"%c\" in binary constant", '0' + max_digit);
+ SYNTAX_ERROR2_NOLOC ("invalid digit \"%c\" in binary constant",
+ '0' + max_digit);
else
- SYNTAX_ERROR2 ("invalid digit \"%c\" in octal constant", '0' + max_digit);
+ SYNTAX_ERROR2_NOLOC ("invalid digit \"%c\" in octal constant",
+ '0' + max_digit);
}
if (float_flag != NOT_FLOAT)
{
if (radix == 2)
- {
- cpp_error (pfile, CPP_DL_ERROR,
- "invalid prefix \"0b\" for floating constant");
- return CPP_N_INVALID;
- }
+ SYNTAX_ERROR_NOLOC ("invalid prefix \"0b\" for floating constant");
if (radix == 16 && CPP_PEDANTIC (pfile) && !CPP_OPTION (pfile, c99))
cpp_error (pfile, CPP_DL_PEDWARN,
@@ -325,14 +349,14 @@
/* Exponent is decimal, even if string is a hex float. */
if (!ISDIGIT (*str))
- SYNTAX_ERROR ("exponent has no digits");
+ SYNTAX_ERROR_NOLOC ("exponent has no digits");
do
str++;
while (ISDIGIT (*str));
}
else if (radix == 16)
- SYNTAX_ERROR ("hexadecimal floating constants require an exponent");
+ SYNTAX_ERROR_NOLOC ("hexadecimal floating constants require an exponent");
result = interpret_float_suffix (str, limit - str);
if (result == 0)
@@ -355,8 +379,8 @@
if ((result & CPP_N_DFLOAT) && radix != 10)
{
cpp_error (pfile, CPP_DL_ERROR,
- "invalid suffix \"%.*s\" with hexadecimal floating constant",
- (int) (limit - str), str);
+ "invalid suffix \"%.*s\" with hexadecimal floating constant",
+ (int) (limit - str), str);
return CPP_N_INVALID;
}
@@ -757,7 +781,7 @@
cpp_error (pfile, CPP_DL_WARNING,
"assertions are a deprecated extension");
}
- _cpp_test_assertion (pfile, &temp);
+ _cpp_test_assertion (pfile, token->src_loc, &temp);
result.high = 0;
result.low = temp;
break;
@@ -887,7 +911,8 @@
case CPP_NAME:
case CPP_HASH:
if (!want_value)
- SYNTAX_ERROR2 ("missing binary operator before token \"%s\"",
+ SYNTAX_ERROR2 (op.token->src_loc,
+ "missing binary operator before token \"%s\"",
cpp_token_as_text (pfile, op.token));
want_value = false;
top->value = eval_token (pfile, op.token);
@@ -907,7 +932,8 @@
default:
if ((int) op.op <= (int) CPP_EQ || (int) op.op >= (int) CPP_PLUS_EQ)
- SYNTAX_ERROR2 ("token \"%s\" is not valid in preprocessor expressions",
+ SYNTAX_ERROR2 (op.token->src_loc,
+ "token \"%s\" is not valid in preprocessor expressions",
cpp_token_as_text (pfile, op.token));
break;
}
@@ -916,7 +942,8 @@
if (optab[op.op].flags & NO_L_OPERAND)
{
if (!want_value)
- SYNTAX_ERROR2 ("missing binary operator before token \"%s\"",
+ SYNTAX_ERROR2 (op.token->src_loc,
+ "missing binary operator before token \"%s\"",
cpp_token_as_text (pfile, op.token));
}
else if (want_value)
@@ -924,18 +951,22 @@
/* We want a number (or expression) and haven't got one.
Try to emit a specific diagnostic. */
if (op.op == CPP_CLOSE_PAREN && top->op == CPP_OPEN_PAREN)
- SYNTAX_ERROR ("missing expression between '(' and ')'");
+ SYNTAX_ERROR (op.token->src_loc,
+ "missing expression between '(' and ')'");
if (op.op == CPP_EOF && top->op == CPP_EOF)
- SYNTAX_ERROR2 ("%s with no expression", is_if ? "#if" : "#elif");
+ SYNTAX_ERROR2 (pfile->directive_line, "%s with no expression",
+ is_if ? "#if" : "#elif");
if (top->op != CPP_EOF && top->op != CPP_OPEN_PAREN)
- SYNTAX_ERROR2 ("operator '%s' has no right operand",
+ SYNTAX_ERROR2 (top->token->src_loc,
+ "operator '%s' has no right operand",
cpp_token_as_text (pfile, top->token));
else if (op.op == CPP_CLOSE_PAREN || op.op == CPP_EOF)
/* Complain about missing paren during reduction. */;
else
- SYNTAX_ERROR2 ("operator '%s' has no left operand",
+ SYNTAX_ERROR2 (op.token->src_loc,
+ "operator '%s' has no left operand",
cpp_token_as_text (pfile, op.token));
}
@@ -961,7 +992,7 @@
break;
case CPP_COLON:
if (top->op != CPP_QUERY)
- SYNTAX_ERROR (" ':' without preceding '?'");
+ SYNTAX_ERROR (op.token->src_loc, " ':' without preceding '?'");
if (!num_zerop (top[-1].value)) /* Was '?' condition true? */
pfile->state.skip_eval++;
else
@@ -988,8 +1019,9 @@
if (top != pfile->op_stack)
{
- cpp_error (pfile, CPP_DL_ICE, "unbalanced stack in %s",
- is_if ? "#if" : "#elif");
+ cpp_error_with_line (pfile, CPP_DL_ICE, pfile->directive_line, 0,
+ "unbalanced stack in %s",
+ is_if ? "#if" : "#elif");
syntax_error:
return false; /* Return false on syntax error. */
}
@@ -1008,7 +1040,8 @@
if (top->op <= CPP_EQ || top->op > CPP_LAST_CPP_OP + 2)
{
bad_op:
- cpp_error (pfile, CPP_DL_ICE, "impossible operator '%u'", top->op);
+ cpp_error_with_line (pfile, CPP_DL_ICE, top->token->src_loc, 0,
+ "impossible operator '%u'", top->op);
return 0;
}
@@ -1030,7 +1063,8 @@
case CPP_UMINUS:
case CPP_NOT:
case CPP_COMPL:
- top[-1].value = num_unary_op (pfile, top->value, top->op);
+ top[-1].value = num_unary_op (pfile, top->value, top->op,
+ top->token->src_loc);
break;
case CPP_PLUS:
@@ -1039,7 +1073,8 @@
case CPP_LSHIFT:
case CPP_COMMA:
top[-1].value = num_binary_op (pfile, top[-1].value,
- top->value, top->op);
+ top->value, top->op,
+ top->token->src_loc);
break;
case CPP_GREATER:
@@ -1070,7 +1105,8 @@
case CPP_DIV:
case CPP_MOD:
top[-1].value = num_div_op (pfile, top[-1].value,
- top->value, top->op);
+ top->value, top->op,
+ top->token->src_loc);
break;
case CPP_OR_OR:
@@ -1098,7 +1134,9 @@
case CPP_OPEN_PAREN:
if (op != CPP_CLOSE_PAREN)
{
- cpp_error (pfile, CPP_DL_ERROR, "missing ')' in expression");
+ cpp_error_with_line (pfile, CPP_DL_ERROR,
+ top->token->src_loc, 0,
+ "missing ')' in expression");
return 0;
}
top--;
@@ -1122,7 +1160,8 @@
/* COMMA and COLON should not reduce a QUERY operator. */
if (op == CPP_COMMA || op == CPP_COLON)
return top;
- cpp_error (pfile, CPP_DL_ERROR, "'?' without following ':'");
+ cpp_error_with_line (pfile, CPP_DL_ERROR, top->token->src_loc, 0,
+ "'?' without following ':'");
return 0;
default:
@@ -1131,8 +1170,8 @@
top--;
if (top->value.overflow && !pfile->state.skip_eval)
- cpp_error (pfile, CPP_DL_PEDWARN,
- "integer overflow in preprocessor expression");
+ cpp_error_with_line (pfile, CPP_DL_PEDWARN, top[1].token->src_loc, 0,
+ "integer overflow in preprocessor expression");
}
if (op == CPP_CLOSE_PAREN)
@@ -1168,14 +1207,14 @@
if (op->value.unsignedp)
{
if (!num_positive (op[-1].value, CPP_OPTION (pfile, precision)))
- cpp_error (pfile, CPP_DL_WARNING,
- "the left operand of \"%s\" changes sign when promoted",
- cpp_token_as_text (pfile, op->token));
+ cpp_error_with_line (pfile, CPP_DL_WARNING, op->token->src_loc, 0,
+ "the left operand of \"%s\" changes sign when promoted",
+ cpp_token_as_text (pfile, op->token));
}
else if (!num_positive (op->value, CPP_OPTION (pfile, precision)))
- cpp_error (pfile, CPP_DL_WARNING,
- "the right operand of \"%s\" changes sign when promoted",
- cpp_token_as_text (pfile, op->token));
+ cpp_error_with_line (pfile, CPP_DL_WARNING, op->token->src_loc, 0,
+ "the right operand of \"%s\" changes sign when promoted",
+ cpp_token_as_text (pfile, op->token));
}
/* Clears the unused high order bits of the number pointed to by PNUM. */
@@ -1426,14 +1465,15 @@
/* The four unary operators: +, -, ! and ~. */
static cpp_num
-num_unary_op (cpp_reader *pfile, cpp_num num, enum cpp_ttype op)
+num_unary_op (cpp_reader *pfile, cpp_num num, enum cpp_ttype op,
+ source_location loc)
{
switch (op)
{
case CPP_UPLUS:
if (CPP_WTRADITIONAL (pfile) && !pfile->state.skip_eval)
- cpp_error (pfile, CPP_DL_WARNING,
- "traditional C rejects the unary plus operator");
+ cpp_error_with_line (pfile, CPP_DL_WARNING, loc, 0,
+ "traditional C rejects the unary plus operator");
num.overflow = false;
break;
@@ -1461,7 +1501,8 @@
/* The various binary operators. */
static cpp_num
-num_binary_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op)
+num_binary_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op,
+ source_location loc)
{
cpp_num result;
size_t precision = CPP_OPTION (pfile, precision);
@@ -1515,7 +1556,7 @@
default: /* case CPP_COMMA: */
if (CPP_PEDANTIC (pfile) && (!CPP_OPTION (pfile, c99)
|| !pfile->state.skip_eval))
- cpp_error (pfile, CPP_DL_PEDWARN,
+ cpp_error_with_line (pfile, CPP_DL_PEDWARN, loc, 0,
"comma operator in operand of #if");
lhs = rhs;
break;
@@ -1608,7 +1649,8 @@
/* Divide two preprocessing numbers, returning the answer or the
remainder depending upon OP. */
static cpp_num
-num_div_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op)
+num_div_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op,
+ source_location loc)
{
cpp_num result, sub;
cpp_num_part mask;
@@ -1648,7 +1690,8 @@
else
{
if (!pfile->state.skip_eval)
- cpp_error (pfile, CPP_DL_ERROR, "division by zero in #if");
+ cpp_error_with_line (pfile, CPP_DL_ERROR, loc, 0,
+ "division by zero in #if");
return lhs;
}
@@ -1667,7 +1710,7 @@
{
if (num_greater_eq (lhs, sub, precision))
{
- lhs = num_binary_op (pfile, lhs, sub, CPP_MINUS);
+ lhs = num_binary_op (pfile, lhs, sub, CPP_MINUS, loc);
if (i >= PART_PRECISION)
result.high |= (cpp_num_part) 1 << (i - PART_PRECISION);
else
Index: libcpp/internal.h
===================================================================
--- libcpp/internal.h (revision 140858)
+++ libcpp/internal.h (working copy)
@@ -520,7 +520,8 @@
/* In macro.c */
extern void _cpp_free_definition (cpp_hashnode *);
-extern bool _cpp_create_definition (cpp_reader *, cpp_hashnode *);
+extern bool _cpp_create_definition (cpp_reader *, cpp_hashnode *,
+ source_location);
extern void _cpp_pop_context (cpp_reader *);
extern void _cpp_push_text_context (cpp_reader *, cpp_hashnode *,
const unsigned char *, size_t);
@@ -576,7 +577,7 @@
extern void _cpp_maybe_push_include_file (cpp_reader *);
/* In directives.c */
-extern int _cpp_test_assertion (cpp_reader *, unsigned int *);
+extern int _cpp_test_assertion (cpp_reader *, source_location, unsigned int *);
extern int _cpp_handle_directive (cpp_reader *, int);
extern void _cpp_define_builtin (cpp_reader *, const char *);
extern char ** _cpp_save_pragma_names (cpp_reader *);
Index: libcpp/lex.c
===================================================================
--- libcpp/lex.c (revision 140858)
+++ libcpp/lex.c (working copy)
@@ -663,8 +663,11 @@
"null character(s) preserved in literal");
if (type == CPP_OTHER && CPP_OPTION (pfile, lang) != CLK_ASM)
- cpp_error (pfile, CPP_DL_PEDWARN, "missing terminating %c character",
- (int) terminator);
+ /* It seems nicer to use the location of the starting quote for
+ this error. */
+ cpp_error_with_line (pfile, CPP_DL_PEDWARN, token->src_loc, 0,
+ "missing terminating %c character",
+ (int) terminator);
pfile->buffer->cur = cur;
create_literal (pfile, token, base, cur - base, type);
Index: gcc/testsuite/gcc.dg/cpp/if-4.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/if-4.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/if-4.c (working copy)
@@ -2,7 +2,7 @@
NUL terminated, so we would print garbage after it. */
/* { dg-do compile } */
-#if 1 += 2 /* { dg-error "is not valid" "+= in if" } */
+#if 1 += 2 /* { dg-error "7:is not valid" "+= in if" } */
syntax_error
#endif
int foo;
Index: gcc/testsuite/gcc.dg/cpp/redef3.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/redef3.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/redef3.c (working copy)
@@ -11,11 +11,11 @@
#define D 1 2
#define E
-/* { dg-warning "redefined" "redef A" { target *-*-* } 7 }
- { dg-warning "redefined" "redef B" { target *-*-* } 9 }
- { dg-warning "redefined" "redef D" { target *-*-* } 11 }
- { dg-warning "redefined" "redef E" { target *-*-* } 12 }
- { dg-warning "previous" "prev def A" { target *-*-* } 6 }
- { dg-warning "previous" "prev def B" { target *-*-* } 8 }
+/* { dg-warning "9:redefined" "redef A" { target *-*-* } 7 }
+ { dg-warning "9:redefined" "redef B" { target *-*-* } 9 }
+ { dg-warning "9:redefined" "redef D" { target *-*-* } 11 }
+ { dg-warning "9:redefined" "redef E" { target *-*-* } 12 }
+ { dg-warning "9:previous" "prev def A" { target *-*-* } 6 }
+ { dg-warning "9:previous" "prev def B" { target *-*-* } 8 }
{ dg-warning "previous" "prev def D/E" { target *-*-* } 0 }
*/
Index: gcc/testsuite/gcc.dg/cpp/unc4.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/unc4.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/unc4.c (working copy)
@@ -1,17 +1,16 @@
/* { dg-do preprocess } */
-/* { dg-options "-fno-show-column" } */
/* Tests for un-terminated conditional diagnostics.
- Copyright (c) 1999 Free Software Foundation.
+ Copyright (c) 1999, 2008 Free Software Foundation.
Contributed by Zack Weinberg, who made it up all by himself. */
-#endif /* { dg-error "#endif" "#endif without #if" } */
+#endif /* { dg-error "2:#endif" "#endif without #if" } */
-#else /* { dg-error "#else" "#else without #if" } */
-#endif /* { dg-error "#endif" "#endif after #else without #if" } */
+#else /* { dg-error "2:#else" "#else without #if" } */
+#endif /* { dg-error "2:#endif" "#endif after #else without #if" } */
-#elif 0 /* { dg-error "#elif" "#elif without #if" } */
-#endif /* { dg-error "#endif" "#endif after #else without #if" } */
+#elif 0 /* { dg-error "2:#elif" "#elif without #if" } */
+#endif /* { dg-error "2:#endif" "#endif after #else without #if" } */
#if 1 /* { dg-bogus "unterminated" "terminated true conditional" } */
blah
@@ -37,4 +36,4 @@
/* dg.exp doesn't read the included files for tags, so we have to
do them explicitly here. */
-/* { dg-error "#if" "unc1.c: unterminated #if" { target *-*-* } 4 } */
+/* { dg-error "1:#if" "unc1.c: unterminated #if" { target *-*-* } 4 } */
Index: gcc/testsuite/gcc.dg/cpp/mac-dir-2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/mac-dir-2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/mac-dir-2.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc. */
+/* Copyright (C) 2002, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
@@ -11,6 +11,6 @@
#define f(x) x
f (
-#if 1 /* { dg-error "not portable" } */
+#if 1 /* { dg-error "1:not portable" } */
1)
#endif
Index: gcc/testsuite/gcc.dg/cpp/tr-warn3.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/tr-warn3.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/tr-warn3.c (working copy)
@@ -3,7 +3,7 @@
warnings inside unused clauses because they are often hidden this
way on purpose. However they do still require indentation for K&R. */
/* { dg-do preprocess } */
-/* { dg-options "-pedantic -Wtraditional -fno-show-column" } */
+/* { dg-options "-pedantic -Wtraditional" } */
#if 1
@@ -11,21 +11,21 @@
#define foo bar /* { dg-bogus "indented" "^#kandr" } */
# define foo bar /* { dg-bogus "indented" "^# kandr" } */
- #define foo bar /* { dg-warning "indented" "^ #kandr" } */
- # define foo bar /* { dg-warning "indented" "^ # kandr" } */
+ #define foo bar /* { dg-warning "2:indented" "^ #kandr" } */
+ # define foo bar /* { dg-warning "2:indented" "^ # kandr" } */
/* Block 2: C89 directives should not have the # indented to warn. */
-#pragma whatever /* { dg-warning "indented" "^#c89" } */
-# pragma whatever /* { dg-warning "indented" "^# c89" } */
+#pragma whatever /* { dg-warning "1:indented" "^#c89" } */
+# pragma whatever /* { dg-warning "1:indented" "^# c89" } */
#pragma whatever /* { dg-bogus "indented" "^ #c89" } */
# pragma whatever /* { dg-bogus "indented" "^ # c89" } */
/* Block 3: Extensions should not have the # indented to warn, _and_
they should get a -pedantic warning. */
-#assert foo(bar) /* { dg-warning "indented" "^#ext" } */
-# assert bar(baz) /* { dg-warning "indented" "^# ext" } */
+#assert foo(bar) /* { dg-warning "1:indented" "^#ext" } */
+# assert bar(baz) /* { dg-warning "1:indented" "^# ext" } */
#assert baz(quux) /* { dg-bogus "indented" "^ #ext" } */
# assert quux(weeble) /* { dg-bogus "indented" "^ # ext" } */
@@ -35,21 +35,21 @@
#undef foo bar /* { dg-bogus "indented" "^#kandr" } */
# undef foo bar /* { dg-bogus "indented" "^# kandr" } */
- #undef foo bar /* { dg-warning "indented" "^ #kandr" } */
- # undef foo bar /* { dg-warning "indented" "^ # kandr" } */
+ #undef foo bar /* { dg-warning "2:indented" "^ #kandr" } */
+ # undef foo bar /* { dg-warning "2:indented" "^ # kandr" } */
/* Block 2: C89 directives should not have the # indented to warn. */
-#error whatever /* { dg-warning "indented" "^#c89" } */
-# error whatever /* { dg-warning "indented" "^# c89" } */
+#error whatever /* { dg-warning "1:indented" "^#c89" } */
+# error whatever /* { dg-warning "1:indented" "^# c89" } */
#error whatever /* { dg-bogus "indented" "^ #c89" } */
# error whatever /* { dg-bogus "indented" "^ # c89" } */
/* Block 3: Extensions should not have the # indented to warn, and
they should _not_ get a -pedantic warning. */
-#unassert foo(bar) /* { dg-warning "indented" "^#ext" } */
-# unassert bar(baz) /* { dg-warning "indented" "^# ext" } */
+#unassert foo(bar) /* { dg-warning "1:indented" "^#ext" } */
+# unassert bar(baz) /* { dg-warning "1:indented" "^# ext" } */
#unassert baz(quux) /* { dg-bogus "indented" "^ #ext" } */
# unassert quux(weeble) /* { dg-bogus "indented" "^ # ext" } */
Index: gcc/testsuite/gcc.dg/cpp/counter-2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/counter-2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/counter-2.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright 2007 Free Software Foundation, Inc.
+/* Copyright 2007, 2008 Free Software Foundation, Inc.
Contributed by Ollie Wild <aaw@google.com>. */
/* { dg-do preprocess } */
@@ -10,5 +10,5 @@
#ifdef __COUNTER__ /* Macro not expanded. */
#endif
-#if __COUNTER__ == 0 /* { dg-error "__COUNTER__ expanded inside directive with -fdirectives-only" } */
+#if __COUNTER__ == 0 /* { dg-error "5:__COUNTER__ expanded inside directive with -fdirectives-only" } */
#endif
Index: gcc/testsuite/gcc.dg/cpp/pr35322.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr35322.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/pr35322.c (working copy)
@@ -1,4 +1,4 @@
/* Test case for PR 35322 -- _Pragma ICE. */
/* { dg-do preprocess } */
-_Pragma("GCC dependency") /* { dg-error "#pragma dependency expects" } */
+_Pragma("GCC dependency") /* { dg-error "24:#pragma dependency expects" } */
Index: gcc/testsuite/gcc.dg/cpp/_Pragma1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/_Pragma1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/_Pragma1.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
@@ -7,15 +7,15 @@
/* Within the preprocessor, the easy pragma to test is "poison". */
#pragma GCC poison p1
-p1 /* { dg-error "poisoned" } */
+p1 /* { dg-error "1:poisoned" } */
/* Standard use of _Pragma. */
_Pragma ("GCC poison p2")
-p2 /* { dg-error "poisoned" } */
+p2 /* { dg-error "1:poisoned" } */
/* Don't interpret _Pragmas in directives. The standard is not clear
on this, but I think this makes most sense. */
-#if 1 _Pragma (L"GCC poison p3") /* { dg-error "missing binary operator" } */
+#if 1 _Pragma (L"GCC poison p3") /* { dg-error "7:missing binary operator" } */
p3
#endif
@@ -24,8 +24,8 @@
#define M2(x) _Pragma (#x)
/* Now test macro expansion with embedded _Pragmas. */
-M1 p4 /* { dg-error "poisoned" } */
-M2 (GCC poison p5) p5 /* { dg-error "poisoned" } */
+M1 p4 /* { dg-error "4:poisoned" } */
+M2 (GCC poison p5) p5 /* { dg-error "20:poisoned" } */
/* Not interpreting _Pragma in directives means they don't nest. */
_Pragma ("_Pragma (\"GCC poison p6\") GCC poison p7")
Index: gcc/testsuite/gcc.dg/cpp/20000209-1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/20000209-1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/20000209-1.c (working copy)
@@ -7,28 +7,28 @@
#define g f
f (3);
-#error here /* { dg-error "here" "case 0" } */
+#error here /* { dg-error "2:here" "case 0" } */
f
(3);
-#error here /* { dg-error "here" "case 1" } */
+#error here /* { dg-error "2:here" "case 1" } */
(f
)(3);
-#error here /* { dg-error "here" "case 2" } */
+#error here /* { dg-error "2:here" "case 2" } */
g
(3);
-#error here /* { dg-error "here" "case 3" } */
+#error here /* { dg-error "2:here" "case 3" } */
(g
)(3);
-#error here /* { dg-error "here" "case 4" } */
+#error here /* { dg-error "2:here" "case 4" } */
f /* some
text */ (3);
-#error here /* { dg-error "here" "case 5" } */
+#error here /* { dg-error "2:here" "case 5" } */
(g /* some
text */ )(3);
-#error here /* { dg-error "here" "case 6" } */
+#error here /* { dg-error "2:here" "case 6" } */
Index: gcc/testsuite/gcc.dg/cpp/paste4.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/paste4.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/paste4.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */
/* { dg-do compile } */
/* { dg-options -save-temps } */
@@ -11,7 +11,7 @@
int main ()
{
- double d = glue (1.0e, +1); /* { dg-error "exponent|parse error|syntax error|expected" } */
+ double d = glue (1.0e, +1); /* { dg-error "14:exponent|parse error|syntax error|expected" } */
return 0;
}
Index: gcc/testsuite/gcc.dg/cpp/Wvariadic-3.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/Wvariadic-3.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/Wvariadic-3.c (working copy)
@@ -2,5 +2,5 @@
/* { dg-options "-std=iso9899:1999 -pedantic -Werror" } */
#define f(x,...)
-#define g(x,y...) /* { dg-error "variadic" } */
+#define g(x,y...) /* { dg-error "14:variadic" } */
int not_empty;
Index: gcc/testsuite/gcc.dg/cpp/pr36320.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr36320.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/pr36320.c (working copy)
@@ -4,5 +4,5 @@
int z;
#if 1
-#elif /* { dg-error "with no expression" } */
+#elif /* { dg-error "1:with no expression" } */
#endif
Index: gcc/testsuite/gcc.dg/cpp/sysmac1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/sysmac1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/sysmac1.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc. */
+/* Copyright (C) 2001, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-std=gnu99 -pedantic -Wtraditional" } */
@@ -12,15 +12,15 @@
#define uint 1U
#define str(x) x
-#define foo(x, y...) bar(x, ##y) /* { dg-warning "named variadic macros" } */
+#define foo(x, y...) bar(x, ##y) /* { dg-warning "17:named variadic macros" } */
-#if uint /* { dg-warning "traditional C rejects" } */
+#if uint /* { dg-warning "5:traditional C rejects" } */
#endif
#if sys_uint /* { dg-bogus "traditional C rejects" } */
#endif
-(str); /* { dg-warning "used with arguments" } */
+(str); /* { dg-warning "2:used with arguments" } */
(sys_str); /* { dg-bogus "used with arguments" } */
-foo (one_arg); /* { dg-warning "requires rest arguments" } */
+foo (one_arg); /* { dg-warning "13:requires rest arguments" } */
sys_foo (one_arg); /* { dg-bogus "requires rest arguments" } */
Index: gcc/testsuite/gcc.dg/cpp/very-long-comment.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/very-long-comment.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/very-long-comment.c (working copy)
@@ -5,7 +5,7 @@
comment so avoid editing the text above here. */
/* { dg-options "-Wall" } */
/* { dg-do compile } */
-#warning test warning /* { dg-warning "test warning" } */
+#warning test warning /* { dg-warning "2:test warning" } */
#include <stdio.h>
int main()
{
Index: gcc/testsuite/gcc.dg/cpp/pr29612-2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr29612-2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/pr29612-2.c (working copy)
@@ -1,10 +1,10 @@
/* PR preprocessor/29612 */
/* { dg-do preprocess } */
-/* { dg-options "-Wtraditional -fno-show-column" } */
+/* { dg-options "-Wtraditional" } */
# 6 "pr29612-2.c"
-#if 1U /* { dg-warning "traditional C rejects" "numeric constant suffix" } */
+#if 1U /* { dg-warning "5:traditional C rejects" "numeric constant suffix" } */
#endif
# 1 "foo.h" 1 3
@@ -14,5 +14,5 @@
# 16 "pr29612-2.c" 2
-#if 1U /* { dg-warning "traditional C rejects" "numeric constant suffix" } */
+#if 1U /* { dg-warning "5:traditional C rejects" "numeric constant suffix" } */
#endif
Index: gcc/testsuite/gcc.dg/cpp/c89-pedantic.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/c89-pedantic.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/c89-pedantic.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-std=c89 -pedantic" } */
@@ -6,5 +6,5 @@
/* This file is for testing the preprocessor in -std=c89 -pedantic mode.
Neil Booth, 2 Dec 2000. */
-#if 1LL /* { dg-warning "long long" } */
+#if 1LL /* { dg-warning "5:long long" } */
#endif
Index: gcc/testsuite/gcc.dg/cpp/if-5.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/if-5.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/if-5.c (working copy)
@@ -2,8 +2,8 @@
Jakub Jelinek <jakub@redhat.com>. */
/* { dg-do preprocess } */
-#ifdef 0 /* { dg-error "macro names" } */
+#ifdef 0 /* { dg-error "8:macro names" } */
#endif
-#ifndef 0 /* { dg-error "macro names" } */
+#ifndef 0 /* { dg-error "9:macro names" } */
#endif
Index: gcc/testsuite/gcc.dg/cpp/tr-warn4.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/tr-warn4.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/tr-warn4.c (working copy)
@@ -2,11 +2,11 @@
Note, gcc should omit these warnings in system header files.
By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000. */
/* { dg-do preprocess } */
-/* { dg-options "-Wtraditional -fno-show-column" } */
+/* { dg-options "-Wtraditional" } */
-#if 1U /* { dg-warning "traditional C rejects" "numeric constant suffix" } */
+#if 1U /* { dg-warning "5:traditional C rejects" "numeric constant suffix" } */
#endif
-#if 1u /* { dg-warning "traditional C rejects" "numeric constant suffix" } */
+#if 1u /* { dg-warning "5:traditional C rejects" "numeric constant suffix" } */
#endif
#if 1L
#endif
Index: gcc/testsuite/gcc.dg/cpp/19951227-1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/19951227-1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/19951227-1.c (working copy)
@@ -1,3 +1,3 @@
/* { dg-do preprocess } */
-#if 0xe-1 /* { dg-error "invalid suffix" } */
+#if 0xe-1 /* { dg-error "5:invalid suffix" } */
#endif
Index: gcc/testsuite/gcc.dg/cpp/charconst.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/charconst.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/charconst.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc. */
+/* Copyright (C) 2001, 2008 Free Software Foundation, Inc. */
/* { dg-do compile } */
@@ -7,16 +7,16 @@
Neil Booth, 22 May 2001. */
-#if '' /* { dg-error "empty" "empty charconst" } */
+#if '' /* { dg-error "5:empty" "empty charconst" } */
#endif
-#if L'' /* { dg-error "empty" "empty wide charconst" } */
+#if L'' /* { dg-error "5:empty" "empty wide charconst" } */
#endif
-#if 'very long' /* { dg-warning "too long" "long charconst" } */
+#if 'very long' /* { dg-warning "5:too long" "long charconst" } */
#endif
-#if L'very long' /* { dg-warning "too long" "long wide charconst" } */
+#if L'very long' /* { dg-warning "5:too long" "long wide charconst" } */
#endif
/* Don't do this test for L'ab'; it depends upon sizeof (wchar_t). */
-#if 'ab' /* { dg-warning "multi-char" "multi-character" } */
+#if 'ab' /* { dg-warning "5:multi-char" "multi-character" } */
#endif
void foo ()
@@ -24,13 +24,13 @@
int c;
__WCHAR_TYPE__ w;
- c = ''; /* { dg-error "empty" "empty charconst" } */
- w = L''; /* { dg-error "empty" "empty wide charconst" } */
+ c = ''; /* { dg-error "7:empty" "empty charconst" } */
+ w = L''; /* { dg-error "7:empty" "empty wide charconst" } */
- c = 'very long'; /* { dg-warning "too long" "long charconst" } */
- w = L'very long'; /* { dg-warning "too long" "long wide charconst" } */
+ c = 'very long'; /* { dg-warning "7:too long" "long charconst" } */
+ w = L'very long'; /* { dg-warning "7:too long" "long wide charconst" } */
- c = 'ab'; /* { dg-warning "multi-char" "multi-char" } */
+ c = 'ab'; /* { dg-warning "7:multi-char" "multi-char" } */
/* Wide charconsts cannot contain more than one wide character. */
- w = L'ab'; /* { dg-warning "too long" "multi-char wide" } */
+ w = L'ab'; /* { dg-warning "7:too long" "multi-char wide" } */
}
Index: gcc/testsuite/gcc.dg/cpp/c99-if-comma-1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/c99-if-comma-1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/c99-if-comma-1.c (working copy)
@@ -4,7 +4,7 @@
/* { dg-do preprocess } */
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
-#if (1, 2) /* { dg-error "comma" "evaluated comma" } */
+#if (1, 2) /* { dg-error "7:comma" "evaluated comma" } */
#endif
#if 1 || (1, 2)
Index: gcc/testsuite/gcc.dg/cpp/Wtrigraphs.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/Wtrigraphs.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/Wtrigraphs.c (working copy)
@@ -1,26 +1,26 @@
/* { dg-do preprocess } */
-/* { dg-options "-std=gnu99 -Wtrigraphs -fno-show-column" } */
+/* { dg-options "-std=gnu99 -Wtrigraphs" } */
/* Test we don't double warn for trigraphs immediately after preceding
text. Source Neil Booth. 22 Nov 2000. */
-abcdef??< /* { dg-warning "ignored" } */
-123456??> /* { dg-warning "ignored" } */
-+??= /* { dg-warning "ignored" } */
+abcdef??< /* { dg-warning "7:ignored" } */
+123456??> /* { dg-warning "7:ignored" } */
++??= /* { dg-warning "2:ignored" } */
/* Test we warn of escaped newlines only in comments. Source Neil
Booth. 4 May 2003. */
/* { dg-bogus "ignored" } Test ??< ??= a few ??/ random things in
- { dg-warning "ignored" } some ??/
+ { dg-warning "37:ignored" } some ??/
{ dg-bogus "ignored" } ??< comments. */
// { dg-bogus "ignored" } More ??/ comment ??> tests.
-// { dg-warning "ignored" } Another ??/
+// { dg-warning "40:ignored" } Another ??/
Test
-// { dg-warning "ignored" } And another with space after ??/
+// { dg-warning "61:ignored" } And another with space after ??/
the escape
// { dg-bogus "ignored" } A tricky one ??/\
Index: gcc/testsuite/gcc.dg/cpp/if-cexp.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/if-cexp.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/if-cexp.c (working copy)
@@ -3,12 +3,12 @@
/* Test the ? : opearator, for precedence and both true and false. */
#if 1 ? 1 ? 2 : 0 : 0
-#error OK /* { dg-error "OK" "nested ? :" } */
+#error OK /* { dg-error "2:OK" "nested ? :" } */
#endif
#if ((0) ? (1) ? (2) : (3) : (4) ? (5): (6)) == 5
-#error OK /* { dg-error "OK" "nested ? : with parens" } */
+#error OK /* { dg-error "2:OK" "nested ? : with parens" } */
#endif
-#if 2: /* { dg-error "':' without" "immediate :" } */
+#if 2: /* { dg-error "6:':' without" "immediate :" } */
#endif
Index: gcc/testsuite/gcc.dg/cpp/endif-pedantic2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/endif-pedantic2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/endif-pedantic2.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc. */
+/* Copyright (C) 2002, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-Wno-endif-labels -pedantic-errors" } */
@@ -11,7 +11,7 @@
#if 1
#if 0
-#else foo /* { dg-error "extra tokens" "tokens after #else" } */
-#endif / /* { dg-error "extra tokens" "tokens after #endif" } */
+#else foo /* { dg-error "7:extra tokens" "tokens after #else" } */
+#endif / /* { dg-error "8:extra tokens" "tokens after #endif" } */
#endif
Index: gcc/testsuite/gcc.dg/cpp/macsyntx.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/macsyntx.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/macsyntx.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-pedantic -std=gnu99" } */
@@ -19,22 +19,22 @@
Split a couple of the lines to check that the errors appear on the
right line (i.e. are associated with the correct token). */
-#define ; /* { dg-error "identifier" } */
-#define SEMI; /* { dg-warning "space" } */
-#define foo(X /* { dg-error "missing" } */
+#define ; /* { dg-error "9:identifier" } */
+#define SEMI; /* { dg-warning "13:space" } */
+#define foo(X /* { dg-error "12:missing" } */
#define foo\
-(X,) /* { dg-error "parameter name" } */
-#define foo(, X) /* { dg-error "parameter name" } */
-#define foo(X, X) /* { dg-error "duplicate" } */
-#define foo(X Y) /* { dg-error "comma" } */
-#define foo(() /* { dg-error "may not appear" } */
-#define foo(..., X) /* { dg-error "missing" } */
+(X,) /* { dg-error "4:parameter name" } */
+#define foo(, X) /* { dg-error "13:parameter name" } */
+#define foo(X, X) /* { dg-error "16:duplicate" } */
+#define foo(X Y) /* { dg-error "15:comma" } */
+#define foo(() /* { dg-error "13:may not appear" } */
+#define foo(..., X) /* { dg-error "16:missing" } */
#define foo \
-__VA_ARGS__ /* { dg-warning "__VA_ARGS__" } */
-#define goo(__VA_ARGS__) /* { dg-warning "__VA_ARGS__" } */
+__VA_ARGS__ /* { dg-warning "1:__VA_ARGS__" } */
+#define goo(__VA_ARGS__) /* { dg-warning "13:__VA_ARGS__" } */
#define hoo(...) __VA_ARGS__ /* OK. */
-#define __VA_ARGS__ /* { dg-warning "__VA_ARGS__" } */
-__VA_ARGS__ /* { dg-warning "__VA_ARGS__" } */
+#define __VA_ARGS__ /* { dg-warning "9:__VA_ARGS__" } */
+__VA_ARGS__ /* { dg-warning "1:__VA_ARGS__" } */
/* test # of supplied arguments. */
#define none()
@@ -57,9 +57,9 @@
/* This tests two oddities of GNU rest args - omitting a comma is OK,
and backtracking a token on pasting an empty rest args. */
-#define rest(x, y...) x ## y /* { dg-warning "ISO C" } */
+#define rest(x, y...) x ## y /* { dg-warning "18:ISO C" } */
rest(ichi,) /* OK. */
-rest(ichi) /* { dg-warning "rest arguments to be used" } */
+rest(ichi) /* { dg-warning "10:rest arguments to be used" } */
#if 23 != rest(2, 3) /* OK, no warning. */
#error 23 != 23 !!
#endif
Index: gcc/testsuite/gcc.dg/cpp/poison.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/poison.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/poison.c (working copy)
@@ -1,25 +1,24 @@
-/* { dg-do preprocess }
- { dg-options "-fno-show-column" } */
+/* { dg-do preprocess } */
#pragma GCC poison foo
-foo /* { dg-error "foo" "use of foo" } */
+foo /* { dg-error "1:foo" "use of foo" } */
#pragma GCC poison foo2 foo3
-foo2 /* { dg-error "foo2" "use of foo2" } */
-foo3 /* { dg-error "foo3" "use of foo3" } */
+foo2 /* { dg-error "1:foo2" "use of foo2" } */
+foo3 /* { dg-error "1:foo3" "use of foo3" } */
#pragma GCC poison foo4 foo5
-foo4 /* { dg-error "foo4" "use of foo4" } */
-foo5 /* { dg-error "foo5" "use of foo5" } */
-#pragma GCC poison +++ /* { dg-error "invalid" "poison non-identifier" } */
+foo4 /* { dg-error "1:foo4" "use of foo4" } */
+foo5 /* { dg-error "1:foo5" "use of foo5" } */
+#pragma GCC poison +++ /* { dg-error "20:invalid" "poison non-identifier" } */
#define foo6 123
-#pragma GCC poison foo6 /* { dg-warning "foo6" "poison defined macro" } */
-#define foo6 345 /* { dg-error "foo6" "def of foo6" } */
-#define foo6 456 /* { dg-error "foo6" "redef of foo6" } */
-#ifdef foo6 /* { dg-error "foo6" "#ifdef foo6" } */
+#pragma GCC poison foo6 /* { dg-warning "20:foo6" "poison defined macro" } */
+#define foo6 345 /* { dg-error "9:foo6" "def of foo6" } */
+#define foo6 456 /* { dg-error "9:foo6" "redef of foo6" } */
+#ifdef foo6 /* { dg-error "8:foo6" "#ifdef foo6" } */
#error hey! foo6 defined!
#endif
-#if defined(foo6) /* { dg-error "foo6" "#if defined foo6" } */
+#if defined(foo6) /* { dg-error "13:foo6" "#if defined foo6" } */
#error foo6 still defined!
#else
-foo6 /* { dg-error "foo6" "use of foo6" } */
+foo6 /* { dg-error "1:foo6" "use of foo6" } */
#endif
#pragma GCC poison
Index: gcc/testsuite/gcc.dg/cpp/sysmac2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/sysmac2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/sysmac2.c (working copy)
@@ -1,7 +1,7 @@
/* Copyright (C) 2001 Free Software Foundation, Inc. */
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -pedantic -Wtraditional -fno-show-column" } */
+/* { dg-options "-std=gnu99 -pedantic -Wtraditional" } */
/* Tests diagnostics are suppressed for some macros defined in system
headers. */
@@ -17,11 +17,11 @@
int
main ()
{
- int u1 = uint; /* { dg-warning "traditional C rejects" } */
+ int u1 = uint; /* { dg-warning "12:traditional C rejects" } */
int u2 = sys_uint; /* { dg-bogus "traditional C rejects" } */
- float f1 = fl; /* { dg-warning "traditional C rejects" } */
+ float f1 = fl; /* { dg-warning "14:traditional C rejects" } */
float f2 = sys_fl; /* { dg-bogus "traditional C rejects" } */
- long double ld1 = ld; /* { dg-warning "traditional C rejects" } */
+ long double ld1 = ld; /* { dg-warning "21:traditional C rejects" } */
long double l2 = sys_ld; /* { dg-bogus "traditional C rejects" } */
return 0;
Index: gcc/testsuite/gcc.dg/cpp/pr22168-2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr22168-2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/pr22168-2.c (working copy)
@@ -3,10 +3,10 @@
/* { dg-do preprocess }
{ dg-options -Wdeprecated } */
-#if #foo(bar) /* { dg-warning "deprecated" } */
+#if #foo(bar) /* { dg-warning "5:deprecated" } */
int x;
#else
int y;
#endif
-#assert zzz(a) /* { dg-warning "deprecated" } */
-#unassert yyy /* { dg-warning "deprecated" } */
+#assert zzz(a) /* { dg-warning "1:deprecated" } */
+#unassert yyy /* { dg-warning "1:deprecated" } */
Index: gcc/testsuite/gcc.dg/cpp/pr28165.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr28165.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/pr28165.c (working copy)
@@ -1,6 +1,6 @@
-/* Copyright (C) 2007 Free Software Foundation, Inc. */
+/* Copyright (C) 2007, 2008 Free Software Foundation, Inc. */
/* PR preprocessor/28165 */
/* { dg-do preprocess } */
-#pragma GCC system_header /* { dg-warning "system_header" "ignored" } */
-_Pragma ("GCC system_header") /* { dg-warning "system_header" "ignored" } */
+#pragma GCC system_header /* { dg-warning "13:system_header" "ignored" } */
+_Pragma ("GCC system_header") /* { dg-warning "15:system_header" "ignored" } */
Index: gcc/testsuite/gcc.dg/cpp/cpp.exp
===================================================================
--- gcc/testsuite/gcc.dg/cpp/cpp.exp (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/cpp.exp (working copy)
@@ -1,4 +1,4 @@
-# Copyright (C) 1997, 2000, 2003, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2000, 2003, 2007, 2008 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@
# Main loop.
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,S} ]] \
- "-fno-show-column" $DEFAULT_CFLAGS
+ "" $DEFAULT_CFLAGS
# All done.
dg-finish
Index: gcc/testsuite/gcc.dg/cpp/gnuc89-pedantic.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/gnuc89-pedantic.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/gnuc89-pedantic.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-std=gnu89 -pedantic" } */
@@ -6,5 +6,5 @@
/* This file is for testing the preprocessor in -std=gnu89 -pedantic mode.
Neil Booth, 2 Dec 2000. */
-#if 1LL /* { dg-warning "long long" } */
+#if 1LL /* { dg-warning "5:long long" } */
#endif
Index: gcc/testsuite/gcc.dg/cpp/widestr1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/widestr1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/widestr1.c (working copy)
@@ -1,9 +1,9 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation.
+/* Copyright (C) 2000, 2001, 2008 Free Software Foundation.
by Alexandre Oliva <oliva@lsd.ic.unicamp.br> */
/* { dg-do preprocess } */
-#line 1 L"foo" /* { dg-error "not a valid filename" "wide string in #line" } */
-#include L"stdio.h" /* { dg-error "expects" "wide string in #include" } */
+#line 1 L"foo" /* { dg-error "9:not a valid filename" "wide string in #line" } */
+#include L"stdio.h" /* { dg-error "10:expects" "wide string in #include" } */
Index: gcc/testsuite/gcc.dg/cpp/tr-warn5.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/tr-warn5.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/tr-warn5.c (working copy)
@@ -2,9 +2,9 @@
Note, gcc should omit these warnings in system header files.
By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000. */
/* { dg-do preprocess } */
-/* { dg-options "-Wtraditional -fno-show-column" } */
+/* { dg-options "-Wtraditional" } */
-#if +1 /* { dg-warning "unary plus operator" "unary plus operator" } */
+#if +1 /* { dg-warning "5:unary plus operator" "unary plus operator" } */
#endif
# 11 "sys-header.h" 3
Index: gcc/testsuite/gcc.dg/cpp/paste15.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/paste15.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/paste15.c (working copy)
@@ -1,15 +1,15 @@
/* PR preprocessor/20077 */
/* { dg-do preprocess } */
-#define a a ## ## /* { dg-error "end of a macro expansion" } */
-#define b() b ## ## /* { dg-error "end of a macro expansion" } */
-#define c c ## /* { dg-error "end of a macro expansion" } */
-#define d() d ## /* { dg-error "end of a macro expansion" } */
+#define a a ## ## /* { dg-error "18:end of a macro expansion" } */
+#define b() b ## ## /* { dg-error "18:end of a macro expansion" } */
+#define c c ## /* { dg-error "15:end of a macro expansion" } */
+#define d() d ## /* { dg-error "15:end of a macro expansion" } */
-#define e ## ## e /* { dg-error "end of a macro expansion" } */
-#define f() ## ## f /* { dg-error "end of a macro expansion" } */
-#define g ## g /* { dg-error "end of a macro expansion" } */
-#define h() ## h /* { dg-error "end of a macro expansion" } */
-#define i ## /* { dg-error "end of a macro expansion" } */
-#define j() ## /* { dg-error "end of a macro expansion" } */
+#define e ## ## e /* { dg-error "13:end of a macro expansion" } */
+#define f() ## ## f /* { dg-error "13:end of a macro expansion" } */
+#define g ## g /* { dg-error "13:end of a macro expansion" } */
+#define h() ## h /* { dg-error "13:end of a macro expansion" } */
+#define i ## /* { dg-error "13:end of a macro expansion" } */
+#define j() ## /* { dg-error "13:end of a macro expansion" } */
Index: gcc/testsuite/gcc.dg/cpp/error-1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/error-1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/error-1.c (working copy)
@@ -2,4 +2,4 @@
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
/* { dg-do preprocess } */
-/* { dg-error "unterminated comment" }
+/* { dg-error "1:unterminated comment" }
Index: gcc/testsuite/gcc.dg/cpp/Wunused.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/Wunused.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/Wunused.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */
+/* Copyright (C) 2002, 2003, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* Duplicate command line options should not warn. */
@@ -15,9 +15,9 @@
#define used3 /* { dg-bogus "used" } */
#define used4 used4 /* { dg-bogus "used" } */
-#define unused5 /* { dg-warning "used" } */
-#define unused6 /* { dg-warning "used" } */
-#define unused7() /* { dg-warning "used" } */
+#define unused5 /* { dg-warning "9:used" } */
+#define unused6 /* { dg-warning "9:used" } */
+#define unused7() /* { dg-warning "9:used" } */
#if defined used1
#endif
Index: gcc/testsuite/gcc.dg/cpp/20000129-1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/20000129-1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/20000129-1.c (working copy)
@@ -12,4 +12,4 @@
blah \
blah
-??> /* { dg-warning "trigraph ..." "trigraph encountered" } */
+??> /* { dg-warning "1:trigraph ..." "trigraph encountered" } */
Index: gcc/testsuite/gcc.dg/cpp/pr7263-2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr7263-2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/pr7263-2.c (working copy)
@@ -11,7 +11,7 @@
unsigned long long /* { dg-error "ISO C90 does not support .long long." } */
bar2 ()
{
- return 0x1b27da572ef3cd86ULL; /* { dg-error "use of C99 long long integer constant" } */
+ return 0x1b27da572ef3cd86ULL; /* { dg-error "10:use of C99 long long integer constant" } */
}
Index: gcc/testsuite/gcc.dg/cpp/Wmissingdirs.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/Wmissingdirs.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/Wmissingdirs.c (working copy)
@@ -1,5 +1,5 @@
/* { dg-do preprocess } */
-/* { dg-options "-std=gnu99 -I /jolly/well/better/not/exist -Wmissing-include-dirs -fno-show-column" } */
+/* { dg-options "-std=gnu99 -I /jolly/well/better/not/exist -Wmissing-include-dirs" } */
/* Test that -Wmissing-include-dirs issues a warning when a specified
directory does not exist. Source Ben Elliston, 2004-05-13. */
Index: gcc/testsuite/gcc.dg/cpp/skipping2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/skipping2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/skipping2.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc. */
+/* Copyright (C) 2001, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
@@ -10,5 +10,5 @@
#if foo
#else foo /* { dg-bogus "extra tokens" "extra tokens in skipped block" } */
#endif foo /* { dg-bogus "extra tokens" "extra tokens in skipped block" } */
-#endif bar /* { dg-error "extra tokens" "tokens after #endif" } */
+#endif bar /* { dg-error "8:extra tokens" "tokens after #endif" } */
Index: gcc/testsuite/gcc.dg/cpp/c94-pedantic.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/c94-pedantic.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/c94-pedantic.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-std=iso9899:199409 -pedantic" } */
@@ -6,5 +6,5 @@
/* This file is for testing the preprocessor in -std=iso9899:199409
-pedantic mode. Neil Booth, 2 Dec 2000. */
-#if 1LL /* { dg-warning "long long" } */
+#if 1LL /* { dg-warning "5:long long" } */
#endif
Index: gcc/testsuite/gcc.dg/cpp/Wtrigraphs-2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/Wtrigraphs-2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/Wtrigraphs-2.c (working copy)
@@ -1,19 +1,19 @@
/* { dg-do preprocess } */
-/* { dg-options "-std=c99 -Wtrigraphs -fno-show-column" } */
+/* { dg-options "-std=c99 -Wtrigraphs" } */
/* Test warnings for trigraphs in comments, with trigraphs enabled.
Neil Booth. 4 May 2003. */
/* { dg-bogus "converted" } Test ??< ??= a few ??/ random things in
- { dg-warning "converted" } some ??/
+ { dg-warning "39:converted" } some ??/
{ dg-bogus "converted" } ??< comments. */
// { dg-bogus "converted" } More ??/ comment ??> tests.
-// { dg-warning "converted" } Another ??/
+// { dg-warning "42:converted" } Another ??/
Test
-// { dg-warning "converted" } And another with space after ??/
+// { dg-warning "63:converted" } And another with space after ??/
the escape
// { dg-bogus "converted" } A tricky one ??/\
Index: gcc/testsuite/gcc.dg/cpp/pr7263-3.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr7263-3.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/pr7263-3.c (working copy)
@@ -15,5 +15,5 @@
__complex__ bar3 () /* { dg-error "ISO C does not support plain .complex. meaning .double complex." } */
{
- return _Complex_I; /* { dg-error "imaginary constants are a GCC extension" } */
+ return _Complex_I; /* { dg-error "10:imaginary constants are a GCC extension" } */
}
Index: gcc/testsuite/gcc.dg/cpp/macspace1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/macspace1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/macspace1.c (working copy)
@@ -1,63 +1,64 @@
/* PR preprocessor/19475 */
/* { dg-do preprocess } */
-/* { dg-options "-std=iso9899:1990 -pedantic-errors -fno-show-column" } */
+/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
-#define a! /* { dg-warning "missing whitespace" } */
-#define b" /* { dg-warning "missing whitespace" } */
-#define c# /* { dg-warning "missing whitespace" } */
-#define d% /* { dg-warning "missing whitespace" } */
-#define e& /* { dg-warning "missing whitespace" } */
-#define f' /* { dg-warning "missing whitespace" } */
-#define g) /* { dg-warning "missing whitespace" } */
-#define h* /* { dg-warning "missing whitespace" } */
-#define i+ /* { dg-warning "missing whitespace" } */
-#define j, /* { dg-warning "missing whitespace" } */
-#define k- /* { dg-warning "missing whitespace" } */
-#define l. /* { dg-warning "missing whitespace" } */
-#define m/ /* { dg-warning "missing whitespace" } */
-#define n: /* { dg-warning "missing whitespace" } */
-#define o; /* { dg-warning "missing whitespace" } */
-#define p< /* { dg-warning "missing whitespace" } */
-#define q= /* { dg-warning "missing whitespace" } */
-#define r> /* { dg-warning "missing whitespace" } */
-#define s? /* { dg-warning "missing whitespace" } */
-#define t[ /* { dg-warning "missing whitespace" } */
-#define u] /* { dg-warning "missing whitespace" } */
-#define v^ /* { dg-warning "missing whitespace" } */
-#define w{ /* { dg-warning "missing whitespace" } */
-#define x| /* { dg-warning "missing whitespace" } */
-#define y} /* { dg-warning "missing whitespace" } */
-#define z~ /* { dg-warning "missing whitespace" } */
-#define A>> /* { dg-warning "missing whitespace" } */
-#define B<< /* { dg-warning "missing whitespace" } */
-#define E&& /* { dg-warning "missing whitespace" } */
-#define F|| /* { dg-warning "missing whitespace" } */
-#define G== /* { dg-warning "missing whitespace" } */
-#define H!= /* { dg-warning "missing whitespace" } */
-#define I>= /* { dg-warning "missing whitespace" } */
-#define J<= /* { dg-warning "missing whitespace" } */
-#define K+= /* { dg-warning "missing whitespace" } */
-#define L-= /* { dg-warning "missing whitespace" } */
-#define M*= /* { dg-warning "missing whitespace" } */
-#define N/= /* { dg-warning "missing whitespace" } */
-#define O%= /* { dg-warning "missing whitespace" } */
-#define P&= /* { dg-warning "missing whitespace" } */
-#define Q|= /* { dg-warning "missing whitespace" } */
-#define R^= /* { dg-warning "missing whitespace" } */
-#define S>>= /* { dg-warning "missing whitespace" } */
-#define T<<= /* { dg-warning "missing whitespace" } */
-#define W... /* { dg-warning "missing whitespace" } */
-#define X++ /* { dg-warning "missing whitespace" } */
-#define Y-- /* { dg-warning "missing whitespace" } */
-#define Z-> /* { dg-warning "missing whitespace" } */
-#define aa:: /* { dg-warning "missing whitespace" } */
-#define ab->* /* { dg-warning "missing whitespace" } */
-#define ac.* /* { dg-warning "missing whitespace" } */
-#define ad\x /* { dg-warning "missing whitespace" } */
-#define ae\\x /* { dg-warning "missing whitespace" } */
-#define af'1' /* { dg-warning "missing whitespace" } */
-#define ag"abc" /* { dg-warning "missing whitespace" } */
+#define a! /* { dg-warning "10:missing whitespace" } */
+/* Note: no tab characters on the next line. */
+#define b" /* { dg-warning "10:missing whitespace" } */
+#define c# /* { dg-warning "10:missing whitespace" } */
+#define d% /* { dg-warning "10:missing whitespace" } */
+#define e& /* { dg-warning "10:missing whitespace" } */
+#define f' /* { dg-warning "10:missing whitespace" } */
+#define g) /* { dg-warning "10:missing whitespace" } */
+#define h* /* { dg-warning "10:missing whitespace" } */
+#define i+ /* { dg-warning "10:missing whitespace" } */
+#define j, /* { dg-warning "10:missing whitespace" } */
+#define k- /* { dg-warning "10:missing whitespace" } */
+#define l. /* { dg-warning "10:missing whitespace" } */
+#define m/ /* { dg-warning "10:missing whitespace" } */
+#define n: /* { dg-warning "10:missing whitespace" } */
+#define o; /* { dg-warning "10:missing whitespace" } */
+#define p< /* { dg-warning "10:missing whitespace" } */
+#define q= /* { dg-warning "10:missing whitespace" } */
+#define r> /* { dg-warning "10:missing whitespace" } */
+#define s? /* { dg-warning "10:missing whitespace" } */
+#define t[ /* { dg-warning "10:missing whitespace" } */
+#define u] /* { dg-warning "10:missing whitespace" } */
+#define v^ /* { dg-warning "10:missing whitespace" } */
+#define w{ /* { dg-warning "10:missing whitespace" } */
+#define x| /* { dg-warning "10:missing whitespace" } */
+#define y} /* { dg-warning "10:missing whitespace" } */
+#define z~ /* { dg-warning "10:missing whitespace" } */
+#define A>> /* { dg-warning "10:missing whitespace" } */
+#define B<< /* { dg-warning "10:missing whitespace" } */
+#define E&& /* { dg-warning "10:missing whitespace" } */
+#define F|| /* { dg-warning "10:missing whitespace" } */
+#define G== /* { dg-warning "10:missing whitespace" } */
+#define H!= /* { dg-warning "10:missing whitespace" } */
+#define I>= /* { dg-warning "10:missing whitespace" } */
+#define J<= /* { dg-warning "10:missing whitespace" } */
+#define K+= /* { dg-warning "10:missing whitespace" } */
+#define L-= /* { dg-warning "10:missing whitespace" } */
+#define M*= /* { dg-warning "10:missing whitespace" } */
+#define N/= /* { dg-warning "10:missing whitespace" } */
+#define O%= /* { dg-warning "10:missing whitespace" } */
+#define P&= /* { dg-warning "10:missing whitespace" } */
+#define Q|= /* { dg-warning "10:missing whitespace" } */
+#define R^= /* { dg-warning "10:missing whitespace" } */
+#define S>>= /* { dg-warning "10:missing whitespace" } */
+#define T<<= /* { dg-warning "10:missing whitespace" } */
+#define W... /* { dg-warning "10:missing whitespace" } */
+#define X++ /* { dg-warning "10:missing whitespace" } */
+#define Y-- /* { dg-warning "10:missing whitespace" } */
+#define Z-> /* { dg-warning "10:missing whitespace" } */
+#define aa:: /* { dg-warning "11:missing whitespace" } */
+#define ab->* /* { dg-warning "11:missing whitespace" } */
+#define ac.* /* { dg-warning "11:missing whitespace" } */
+#define ad\x /* { dg-warning "11:missing whitespace" } */
+#define ae\\x /* { dg-warning "11:missing whitespace" } */
+#define af'1' /* { dg-warning "11:missing whitespace" } */
+#define ag"abc" /* { dg-warning "11:missing whitespace" } */
int dummy;
-/* { dg-error "missing terminating" "" { target *-*-* } 6 } */
+/* { dg-error "63:missing terminating" "" { target *-*-* } 7 } */
/* { dg-error "missing terminating" "" { target *-*-* } 10 } */
Index: gcc/testsuite/gcc.dg/cpp/escape-2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/escape-2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/escape-2.c (working copy)
@@ -1,20 +1,20 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc. */
+/* Copyright (C) 2001, 2008 Free Software Foundation, Inc. */
/* { dg-do compile } */
-/* { dg-options "-pedantic -std=c99 -fno-show-column" } */
+/* { dg-options "-pedantic -std=c99" } */
/* This tests various diagnostics with -pedantic about escape
sequences, for both the preprocessor and the compiler.
Neil Booth, 22 May 2001. */
-#if '\e' /* { dg-warning "non-ISO" "non-ISO \\e" } */
+#if '\e' /* { dg-warning "5:non-ISO" "non-ISO \\e" } */
#endif
-#if L'\u00a0' /* { dg-bogus "unknown" "\\u is known in C99" } */
+#if L'\u00a0' /* { dg-bogus "5:unknown" "\\u is known in C99" } */
#endif
void foo ()
{
- int c = '\E'; /* { dg-warning "non-ISO" "non-ISO \\E" } */
- c = L'\u00a0'; /* { dg-bogus "unknown" "\\u is known in C99" } */
+ int c = '\E'; /* { dg-warning "11:non-ISO" "non-ISO \\E" } */
+ c = L'\u00a0'; /* { dg-bogus "7:unknown" "\\u is known in C99" } */
}
Index: gcc/testsuite/gcc.dg/cpp/escape.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/escape.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/escape.c (working copy)
@@ -1,25 +1,25 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc. */
+/* Copyright (C) 2001, 2008 Free Software Foundation, Inc. */
/* { dg-do compile } */
-/* { dg-options "-Wtraditional -std=c89 -fno-show-column" } */
+/* { dg-options "-Wtraditional -std=c89" } */
/* This tests various diagnostics with -Wtraditioanl about escape
sequences, for both the preprocessor and the compiler.
Neil Booth, 22 May 2001. */
-#if '\a' /* { dg-warning "traditional" "traditional bell" } */
+#if '\a' /* { dg-warning "5:traditional" "traditional bell" } */
#endif
-#if '\x1a' != 26 /* { dg-warning "traditional" "traditional hex" } */
+#if '\x1a' != 26 /* { dg-warning "5:traditional" "traditional hex" } */
#error bad hex /* { dg-bogus "bad" "bad hexadecimal evaluation" } */
#endif
-#if L'\u00a1' /* { dg-warning "only valid" "\u is unknown in C89" } */
+#if L'\u00a1' /* { dg-warning "5:only valid" "\u is unknown in C89" } */
#endif
void foo ()
{
- int c = '\a'; /* { dg-warning "traditional" "traditional bell" } */
+ int c = '\a'; /* { dg-warning "11:traditional" "traditional bell" } */
- c = '\xa1'; /* { dg-warning "traditional" "traditional hex" } */
- c = L'\u00a1'; /* { dg-warning "only valid" "\u is unknown in C89" } */
+ c = '\xa1'; /* { dg-warning "7:traditional" "traditional hex" } */
+ c = L'\u00a1'; /* { dg-warning "7:only valid" "\u is unknown in C89" } */
}
Index: gcc/testsuite/gcc.dg/cpp/empty-include.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/empty-include.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/empty-include.c (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004, 2008 Free Software Foundation, Inc.
* Contributed and written by Nathanael Nerode.
*
* GCC 3.4 would attempt to open stdin as the included file
@@ -9,5 +9,5 @@
*/
/* { dg-do preprocess } */
-#include "" /* { dg-error "empty" "error on empty filename in include" } */
+#include "" /* { dg-error "10:empty" "error on empty filename in include" } */
int x; /* Otherwise we have an empty file and get more errors. */
Index: gcc/testsuite/gcc.dg/cpp/assert2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/assert2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/assert2.c (working copy)
@@ -1,24 +1,28 @@
/* Malformed assertion tests. */
/* { dg-do preprocess } */
-/* { dg-options "-fno-show-column -Wno-deprecated" } */
+/* { dg-options "-Wno-deprecated" } */
-#assert /* { dg-error "without predicate" "assert w/o predicate" } */
-#assert % /* { dg-error "an identifier" "assert punctuation" } */
-#assert 12 /* { dg-error "an identifier" "assert number" } */
-#assert abc /* { dg-error "missing" "assert w/o answer" } */
+#assert /* { dg-error "1:without predicate" "assert w/o predicate" } */
+#assert % /* { dg-error "9:an identifier" "assert punctuation" } */
+#assert 12 /* { dg-error "9:an identifier" "assert number" } */
+#assert abc /* { dg-error "9:missing" "assert w/o answer" } */
-#if # /* { dg-error "without predicate" "test w/o predicate" } */
+#if # /* { dg-error "5:without predicate" "test w/o predicate" } */
#endif
-#if #% /* { dg-error "an identifier" "test punctuation" } */
+#if #% /* { dg-error "6:an identifier" "test punctuation" } */
#endif
-#if #12 /* { dg-error "an identifier" "test number" } */
+#if #12 /* { dg-error "6:an identifier" "test number" } */
#endif
#if #abc
#error /* { dg-bogus "error" "test w/o answer" } */
#endif
-#if #abc[def] /* { dg-error "is not valid" "test with malformed answer" } */
+#if #abc[def] /* { dg-error "9:is not valid" "test with malformed answer" } */
#endif
+
+#assert maude(23 /* { dg-error "15:to complete answer" "missing ')'" } */
+
+#assert lalala() /* { dg-error "16:answer is empty" "empty answer" } */
Index: gcc/testsuite/gcc.dg/cpp/undef2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/undef2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/undef2.c (working copy)
@@ -1,15 +1,13 @@
/* C99 6.10.8 para 4: None of [the predefined macro names] shall be
- the subject of a #define or an #undef preprocessing directive. We
- pass -fno-show-column as otherwise dejagnu gets confused. */
+ the subject of a #define or an #undef preprocessing directive. */
/* { dg-do preprocess } */
-/* { dg-options "-fno-show-column" } */
-#undef __DATE__ /* { dg-warning "undefining" "__DATE__" } */
-#undef __TIME__ /* { dg-warning "undefining" "__TIME__" } */
-#undef __FILE__ /* { dg-warning "undefining" "__FILE__" } */
-#undef __LINE__ /* { dg-warning "undefining" "__LINE__" } */
-#undef __STDC__ /* { dg-warning "undefining" "__STDC__" } */
+#undef __DATE__ /* { dg-warning "8:undefining" "__DATE__" } */
+#undef __TIME__ /* { dg-warning "8:undefining" "__TIME__" } */
+#undef __FILE__ /* { dg-warning "8:undefining" "__FILE__" } */
+#undef __LINE__ /* { dg-warning "8:undefining" "__LINE__" } */
+#undef __STDC__ /* { dg-warning "8:undefining" "__STDC__" } */
/* These should be protected from #undef, but aren't, because they
are set with normal #define commands - and on top of that, some
Index: gcc/testsuite/gcc.dg/cpp/if-mop.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/if-mop.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/if-mop.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
@@ -6,26 +6,26 @@
/* Various illegal expressions with missing components. */
-#if /* { dg-error "no expression" "empty #if" } */
+#if /* { dg-error "1:no expression" "empty #if" } */
#endif
-#if ~ /* { dg-error "no right op" "no unary operand" } */
+#if ~ /* { dg-error "5:no right op" "no unary operand" } */
#endif
-#if 3 + * 6 + 4 /* { dg-error "no right op" "no right operand" } */
+#if 3 + * 6 + 4 /* { dg-error "7:no right op" "no right operand" } */
#endif
-#if 2 ~2 /* { dg-error "missing bin" "no binary operator" } */
+#if 2 ~2 /* { dg-error "7:missing bin" "no binary operator" } */
#endif
-#if 1 + 2 (3) /* { dg-error "missing bin" "immediate then open paren" } */
+#if 1 + 2 (3) /* { dg-error "11:missing bin" "immediate then open paren" } */
#endif
-#if (2) 4 * 2 /* { dg-error "missing bin" "close paren then immediate" } */
+#if (2) 4 * 2 /* { dg-error "9:missing bin" "close paren then immediate" } */
#endif
-#if == 2 /* { dg-error "no left op" } */
+#if == 2 /* { dg-error "5:no left op" } */
#endif
-#if (==2) /* { dg-error "no left op" } */
+#if (==2) /* { dg-error "6:no left op" } */
#endif
Index: gcc/testsuite/gcc.dg/cpp/if-1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/if-1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/if-1.c (working copy)
@@ -9,33 +9,33 @@
#error 077 != 63 /* { dg-bogus "#error" "normal conversion" } */
#endif
-#if 12wrt /* { dg-error "invalid suffix" "invalid number" } */
+#if 12wrt /* { dg-error "5:invalid suffix" "invalid number" } */
#endif
-#if 0abc /* { dg-error "invalid suffix" "invalid number" } */
+#if 0abc /* { dg-error "5:invalid suffix" "invalid number" } */
#endif
-#if 42abc /* { dg-error "invalid suffix" "invalid number" } */
+#if 42abc /* { dg-error "5:invalid suffix" "invalid number" } */
#endif
#if 0xabc != 2748
#error 0xabc /* { dg-bogus "#error" "normal conversion" } */
#endif
-#if 1.2 /* { dg-error "loating constant" "floating point in #if" } */
+#if 1.2 /* { dg-error "5:loating constant" "floating point in #if" } */
#endif
-#if 4uu /* { dg-error "invalid suffix" "too many suffixes" } */
+#if 4uu /* { dg-error "5:invalid suffix" "too many suffixes" } */
#endif
-#if 124123231lll /* { dg-error "invalid suffix" "too many suffixes" } */
+#if 124123231lll /* { dg-error "5:invalid suffix" "too many suffixes" } */
#endif
-#if 1234lul /* { dg-error "invalid suffix" "u between ls" } */
+#if 1234lul /* { dg-error "5:invalid suffix" "u between ls" } */
#endif
-#if 099 /* { dg-error "invalid digit" "decimal in octal constant" } */
+#if 099 /* { dg-error "5:invalid digit" "decimal in octal constant" } */
#endif
-#if 0xfffffffffffffffff /* { dg-error "integer constant" "range error" } */
+#if 0xfffffffffffffffff /* { dg-error "5:integer constant" "range error" } */
#endif
Index: gcc/testsuite/gcc.dg/cpp/macspace2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/macspace2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/macspace2.c (working copy)
@@ -1,63 +1,64 @@
/* PR preprocessor/19475 */
/* { dg-do preprocess } */
-/* { dg-options "-std=iso9899:1999 -pedantic-errors -fno-show-column" } */
+/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
-#define a! /* { dg-error "requires whitespace" } */
-#define b" /* { dg-error "requires whitespace" } */
-#define c# /* { dg-error "requires whitespace" } */
-#define d% /* { dg-error "requires whitespace" } */
-#define e& /* { dg-error "requires whitespace" } */
-#define f' /* { dg-error "requires whitespace" } */
-#define g) /* { dg-error "requires whitespace" } */
-#define h* /* { dg-error "requires whitespace" } */
-#define i+ /* { dg-error "requires whitespace" } */
-#define j, /* { dg-error "requires whitespace" } */
-#define k- /* { dg-error "requires whitespace" } */
-#define l. /* { dg-error "requires whitespace" } */
-#define m/ /* { dg-error "requires whitespace" } */
-#define n: /* { dg-error "requires whitespace" } */
-#define o; /* { dg-error "requires whitespace" } */
-#define p< /* { dg-error "requires whitespace" } */
-#define q= /* { dg-error "requires whitespace" } */
-#define r> /* { dg-error "requires whitespace" } */
-#define s? /* { dg-error "requires whitespace" } */
-#define t[ /* { dg-error "requires whitespace" } */
-#define u] /* { dg-error "requires whitespace" } */
-#define v^ /* { dg-error "requires whitespace" } */
-#define w{ /* { dg-error "requires whitespace" } */
-#define x| /* { dg-error "requires whitespace" } */
-#define y} /* { dg-error "requires whitespace" } */
-#define z~ /* { dg-error "requires whitespace" } */
-#define A>> /* { dg-error "requires whitespace" } */
-#define B<< /* { dg-error "requires whitespace" } */
-#define E&& /* { dg-error "requires whitespace" } */
-#define F|| /* { dg-error "requires whitespace" } */
-#define G== /* { dg-error "requires whitespace" } */
-#define H!= /* { dg-error "requires whitespace" } */
-#define I>= /* { dg-error "requires whitespace" } */
-#define J<= /* { dg-error "requires whitespace" } */
-#define K+= /* { dg-error "requires whitespace" } */
-#define L-= /* { dg-error "requires whitespace" } */
-#define M*= /* { dg-error "requires whitespace" } */
-#define N/= /* { dg-error "requires whitespace" } */
-#define O%= /* { dg-error "requires whitespace" } */
-#define P&= /* { dg-error "requires whitespace" } */
-#define Q|= /* { dg-error "requires whitespace" } */
-#define R^= /* { dg-error "requires whitespace" } */
-#define S>>= /* { dg-error "requires whitespace" } */
-#define T<<= /* { dg-error "requires whitespace" } */
-#define W... /* { dg-error "requires whitespace" } */
-#define X++ /* { dg-error "requires whitespace" } */
-#define Y-- /* { dg-error "requires whitespace" } */
-#define Z-> /* { dg-error "requires whitespace" } */
-#define aa:: /* { dg-error "requires whitespace" } */
-#define ab->* /* { dg-error "requires whitespace" } */
-#define ac.* /* { dg-error "requires whitespace" } */
-#define ad\x /* { dg-error "requires whitespace" } */
-#define ae\\x /* { dg-error "requires whitespace" } */
-#define af'1' /* { dg-error "requires whitespace" } */
-#define ag"abc" /* { dg-error "requires whitespace" } */
+#define a! /* { dg-error "10:requires whitespace" } */
+/* Note: no tab characters on the next line. */
+#define b" /* { dg-error "10:requires whitespace" } */
+#define c# /* { dg-error "10:requires whitespace" } */
+#define d% /* { dg-error "10:requires whitespace" } */
+#define e& /* { dg-error "10:requires whitespace" } */
+#define f' /* { dg-error "10:requires whitespace" } */
+#define g) /* { dg-error "10:requires whitespace" } */
+#define h* /* { dg-error "10:requires whitespace" } */
+#define i+ /* { dg-error "10:requires whitespace" } */
+#define j, /* { dg-error "10:requires whitespace" } */
+#define k- /* { dg-error "10:requires whitespace" } */
+#define l. /* { dg-error "10:requires whitespace" } */
+#define m/ /* { dg-error "10:requires whitespace" } */
+#define n: /* { dg-error "10:requires whitespace" } */
+#define o; /* { dg-error "10:requires whitespace" } */
+#define p< /* { dg-error "10:requires whitespace" } */
+#define q= /* { dg-error "10:requires whitespace" } */
+#define r> /* { dg-error "10:requires whitespace" } */
+#define s? /* { dg-error "10:requires whitespace" } */
+#define t[ /* { dg-error "10:requires whitespace" } */
+#define u] /* { dg-error "10:requires whitespace" } */
+#define v^ /* { dg-error "10:requires whitespace" } */
+#define w{ /* { dg-error "10:requires whitespace" } */
+#define x| /* { dg-error "10:requires whitespace" } */
+#define y} /* { dg-error "10:requires whitespace" } */
+#define z~ /* { dg-error "10:requires whitespace" } */
+#define A>> /* { dg-error "10:requires whitespace" } */
+#define B<< /* { dg-error "10:requires whitespace" } */
+#define E&& /* { dg-error "10:requires whitespace" } */
+#define F|| /* { dg-error "10:requires whitespace" } */
+#define G== /* { dg-error "10:requires whitespace" } */
+#define H!= /* { dg-error "10:requires whitespace" } */
+#define I>= /* { dg-error "10:requires whitespace" } */
+#define J<= /* { dg-error "10:requires whitespace" } */
+#define K+= /* { dg-error "10:requires whitespace" } */
+#define L-= /* { dg-error "10:requires whitespace" } */
+#define M*= /* { dg-error "10:requires whitespace" } */
+#define N/= /* { dg-error "10:requires whitespace" } */
+#define O%= /* { dg-error "10:requires whitespace" } */
+#define P&= /* { dg-error "10:requires whitespace" } */
+#define Q|= /* { dg-error "10:requires whitespace" } */
+#define R^= /* { dg-error "10:requires whitespace" } */
+#define S>>= /* { dg-error "10:requires whitespace" } */
+#define T<<= /* { dg-error "10:requires whitespace" } */
+#define W... /* { dg-error "10:requires whitespace" } */
+#define X++ /* { dg-error "10:requires whitespace" } */
+#define Y-- /* { dg-error "10:requires whitespace" } */
+#define Z-> /* { dg-error "10:requires whitespace" } */
+#define aa:: /* { dg-error "11:requires whitespace" } */
+#define ab->* /* { dg-error "11:requires whitespace" } */
+#define ac.* /* { dg-error "11:requires whitespace" } */
+#define ad\x /* { dg-error "11:requires whitespace" } */
+#define ae\\x /* { dg-error "11:requires whitespace" } */
+#define af'1' /* { dg-error "11:requires whitespace" } */
+#define ag"abc" /* { dg-error "11:requires whitespace" } */
int dummy;
-/* { dg-error "missing terminating" "" { target *-*-* } 6 } */
-/* { dg-error "missing terminating" "" { target *-*-* } 10 } */
+/* { dg-error "62:missing terminating" "" { target *-*-* } 7 } */
+/* { dg-error "missing terminating" "" { target *-*-* } 11 } */
Index: gcc/testsuite/gcc.dg/cpp/multiline-2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/multiline-2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/multiline-2.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2003, 2008 Free Software Foundation, Inc. */
/* { dg-do compile } */
Index: gcc/testsuite/gcc.dg/cpp/assembler.S
===================================================================
--- gcc/testsuite/gcc.dg/cpp/assembler.S (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/assembler.S (working copy)
@@ -12,7 +12,7 @@
/* Check we don't EOF on an unknown directive. */
#unknown directive
-#error a later diagnostic /* { dg-error "diagnostic" } */
+#error a later diagnostic /* { dg-error "2:diagnostic" } */
/*
{ dg-final { if ![file exists 20000510-1.i] { return } } }
Index: gcc/testsuite/gcc.dg/cpp/paste1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/paste1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/paste1.c (working copy)
@@ -1,10 +1,10 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* Test operator ## semantics. */
-#define bad1 ## owt /* { dg-error "cannot" "## at objlike start" } */
-#define bad2 owt ## /* { dg-error "cannot" "## at objlike end" } */
-#define bad3(x) ## x /* { dg-error "cannot" "## at funlike start" } */
-#define bad4(x) x ## /* { dg-error "cannot" "## at funlike end" } */
+#define bad1 ## owt /* { dg-error "14:cannot" "## at objlike start" } */
+#define bad2 owt ## /* { dg-error "18:cannot" "## at objlike end" } */
+#define bad3(x) ## x /* { dg-error "17:cannot" "## at funlike start" } */
+#define bad4(x) x ## /* { dg-error "19:cannot" "## at funlike end" } */
Index: gcc/testsuite/gcc.dg/cpp/strify1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/strify1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/strify1.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
@@ -6,5 +6,5 @@
#define OK1 # /* No problem. */
#define OK2(x) x#x /* No problem. */
-#define bad1(x) # /* { dg-error "followed by a macro parameter" "#1" } */
-#define bad2(x) #y /* { dg-error "followed by a macro parameter" "#2" } */
+#define bad1(x) # /* { dg-error "17:followed by a macro parameter" "#1" } */
+#define bad2(x) #y /* { dg-error "17:followed by a macro parameter" "#2" } */
Index: gcc/testsuite/gcc.dg/cpp/directiv.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/directiv.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/directiv.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options -pedantic } */
@@ -8,7 +8,7 @@
/* Test directive name is not expanded. */
#define foo define
-#foo EMPTY /* { dg-error "invalid" } */
+#foo EMPTY /* { dg-error "2:invalid" } */
/* Test # must be first on line. */
EMPTY #define bar
@@ -18,8 +18,8 @@
/* Test form feed and vertical tab warn pedantically, see 6.10
paragraph 5. Tab is OK. */
-#define something /* { dg-warning "form feed" } */
-#define something_else /* { dg-warning "vertical tab" } */
+#define something /* { dg-warning "2:form feed" } */
+#define something_else /* { dg-warning "9:vertical tab" } */
#define some thing /* Tab OK, as is form feed before #. */
/* Our friend the null directive OK? */
@@ -31,5 +31,5 @@
Note that the #if is still treated as a conditional, so there
should be no errors about #endif without #if. */
#define func(x) x
-#if func ( /* { dg-error "unterminated argument" } */
+#if func ( /* { dg-error "10:unterminated argument" } */
#endif
Index: gcc/testsuite/gcc.dg/cpp/pr22168.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr22168.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/pr22168.c (working copy)
@@ -3,10 +3,10 @@
/* { dg-do preprocess }
{ dg-options -pedantic } */
-#if #foo(bar) /* { dg-warning "GCC extension" } */
+#if #foo(bar) /* { dg-warning "5:GCC extension" } */
int x;
#else
int y;
#endif
-#assert zzz(a) /* { dg-warning "GCC extension" } */
-#unassert yyy /* { dg-warning "GCC extension" } */
+#assert zzz(a) /* { dg-warning "1:GCC extension" } */
+#unassert yyy /* { dg-warning "1:GCC extension" } */
Index: gcc/testsuite/gcc.dg/cpp/if-2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/if-2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/if-2.c (working copy)
@@ -18,11 +18,11 @@
#endif
/* The 'character constant (is )?too long' message is produced by 16-bit targets. */
-#if 'abcd' /* { dg-warning "(multi-character character constant)|(character constant (is )?too long)" "multi-character charconst" } */
+#if 'abcd' /* { dg-warning "5:(multi-character character constant)|(character constant (is )?too long)" "multi-character charconst" } */
#endif
-#if 'abcdefghi' /* { dg-warning "character constant (is )?too long" "charconst too long" } */
+#if 'abcdefghi' /* { dg-warning "5:character constant (is )?too long" "charconst too long" } */
#endif
-#if '' /* { dg-error "empty character constant" "empty charconst" } */
+#if '' /* { dg-error "5:empty character constant" "empty charconst" } */
#endif
Index: gcc/testsuite/gcc.dg/cpp/defined.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/defined.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/defined.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
@@ -6,7 +6,7 @@
/* Source: Neil Booth, 29 Oct 2000, Zack Weinberg 11 Dec 2000. */
-#define defined /* { dg-error "defined" } */
+#define defined /* { dg-error "9:defined" } */
/* No diagnostics, though you could argue there should be. */
#if defined defined
Index: gcc/testsuite/gcc.dg/cpp/19930510-1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/19930510-1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/19930510-1.c (working copy)
@@ -3,5 +3,5 @@
extern void exit (int);
#define ugly 3
-#ugly "foobar" 3 /* { dg-error "invalid" "invalid directive" } */
+#ugly "foobar" 3 /* { dg-error "2:invalid" "invalid directive" } */
int main() { exit (0); }
Index: gcc/testsuite/gcc.dg/cpp/tr-warn1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/tr-warn1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/tr-warn1.c (working copy)
@@ -1,26 +1,26 @@
/* Test for warnings about nontraditional directives. */
/* { dg-do preprocess } */
-/* { dg-options "-pedantic -Wtraditional -fno-show-column" } */
+/* { dg-options "-pedantic -Wtraditional" } */
/* Block 1: K+R directives should have the # indented. */
#define foo bar /* { dg-bogus "indented" "^#kandr" } */
# define foo bar /* { dg-bogus "indented" "^# kandr" } */
- #define foo bar /* { dg-warning "indented" "^ #kandr" } */
- # define foo bar /* { dg-warning "indented" "^ # kandr" } */
+ #define foo bar /* { dg-warning "2:indented" "^ #kandr" } */
+ # define foo bar /* { dg-warning "2:indented" "^ # kandr" } */
/* Block 2: C89 directives should not have the # indented. */
-#pragma whatever /* { dg-warning "indented" "^#c89" } */
-# pragma whatever /* { dg-warning "indented" "^# c89" } */
+#pragma whatever /* { dg-warning "1:indented" "^#c89" } */
+# pragma whatever /* { dg-warning "1:indented" "^# c89" } */
#pragma whatever /* { dg-bogus "indented" "^ #c89" } */
# pragma whatever /* { dg-bogus "indented" "^ # c89" } */
/* Block 3: Extensions should not have the # indented,
_and_ they should get a -pedantic warning. */
-#assert foo(bar) /* { dg-warning "indented" "^#ext" } */
-# assert bar(baz) /* { dg-warning "indented" "^# ext" } */
+#assert foo(bar) /* { dg-warning "1:indented" "^#ext" } */
+# assert bar(baz) /* { dg-warning "1:indented" "^# ext" } */
#assert baz(quux) /* { dg-bogus "indented" "^ #ext" } */
# assert quux(weeble) /* { dg-bogus "indented" "^ # ext" } */
@@ -28,9 +28,9 @@
do not warn about indentaion. */
#if 0
#if 1
-#elif 1 /* { dg-warning "#elif" "#elif skipping" } */
+#elif 1 /* { dg-warning "1:#elif" "#elif skipping" } */
#endif
-#elif 0 /* { dg-warning "#elif" "#elif not skipping" } */
+#elif 0 /* { dg-warning "1:#elif" "#elif not skipping" } */
#endif
/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 22 } */
Index: gcc/testsuite/gcc.dg/cpp/paste11.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/paste11.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/paste11.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
@@ -9,7 +9,7 @@
glue (ident, 12) /* OK. */
glue (ident, 12e3) /* OK. */
-glue (ident, 12e+3) /* { dg-error "valid preprocessing tok" } */
-glue (ident, 12e-3) /* { dg-error "valid preprocessing tok" } */
-glue (ident, 1.2) /* { dg-error "valid preprocessing tok" } */
-glue (ident, .12) /* { dg-error "valid preprocessing tok" } */
+glue (ident, 12e+3) /* { dg-error "1:valid preprocessing tok" } */
+glue (ident, 12e-3) /* { dg-error "1:valid preprocessing tok" } */
+glue (ident, 1.2) /* { dg-error "1:valid preprocessing tok" } */
+glue (ident, .12) /* { dg-error "1:valid preprocessing tok" } */
Index: gcc/testsuite/gcc.dg/cpp/cxxcom1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/cxxcom1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/cxxcom1.c (working copy)
@@ -2,7 +2,7 @@
/* { dg-options "-pedantic -std=gnu89" } */
/* You can't do this in your own code... */
-// C++ comment is not in C89 { dg-warning "style comment|reported only once" "good warning" }
+// C++ comment is not in C89 { dg-warning "1:style comment|reported only once" "good warning" }
/* ...but we don't bitch about it more than once. */
// C++ comment is not in C89 { dg-bogus "style comment" "bad warning" }
Index: gcc/testsuite/gcc.dg/cpp/extratokens2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/extratokens2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/extratokens2.c (working copy)
@@ -1,7 +1,7 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc. */
+/* Copyright (C) 2002, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
-/* { dg-options "-fno-show-column -Wno-endif-labels" } */
+/* { dg-options "-Wno-endif-labels" } */
/* Tests that -Wno-endif-labels correctly disables the checks done by
default (and tested in extratokens.c). */
@@ -11,8 +11,8 @@
#if 1
#if 0
-#else foo /* { dg-bogus "extra tokens" "bad warning" } */
-#endif / /* { dg-bogus "extra tokens" "bad warning" } */
+#else foo /* { dg-bogus "7:extra tokens" "bad warning" } */
+#endif / /* { dg-bogus "8:extra tokens" "bad warning" } */
#endif
# 36 "file.c" 3
Index: gcc/testsuite/gcc.dg/cpp/Wvariadic-1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/Wvariadic-1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/Wvariadic-1.c (working copy)
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-std=iso9899:1990 -pedantic -Werror" } */
-#define f(x,...) /* { dg-error "variadic" } */
-#define g(x,y...) /* { dg-error "variadic" } */
+#define f(x,...) /* { dg-error "13:variadic" } */
+#define g(x,y...) /* { dg-error "14:variadic" } */
int not_empty;
Index: gcc/testsuite/gcc.dg/cpp/c90-if-comma-1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/c90-if-comma-1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/c90-if-comma-1.c (working copy)
@@ -4,8 +4,8 @@
/* { dg-do preprocess } */
/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
-#if (1, 2) /* { dg-error "comma" "evaluated comma" } */
+#if (1, 2) /* { dg-error "7:comma" "evaluated comma" } */
#endif
-#if 1 || (1, 2) /* { dg-error "comma" "unevaluated comma" } */
+#if 1 || (1, 2) /* { dg-error "12:comma" "unevaluated comma" } */
#endif
Index: gcc/testsuite/gcc.dg/cpp/Wsignprom.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/Wsignprom.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/Wsignprom.c (working copy)
@@ -4,23 +4,23 @@
/* Test that -Wall emits the warnings about integer promotion changing
the sign of an operand. */
-#if -1 > 0U /* { dg-warning "changes sign when promoted" } */
+#if -1 > 0U /* { dg-warning "8:changes sign when promoted" } */
#endif
-#if 0U + -1 /* { dg-warning "changes sign when promoted" } */
+#if 0U + -1 /* { dg-warning "8:changes sign when promoted" } */
#endif
-#if 0U * -1 /* { dg-warning "changes sign when promoted" } */
+#if 0U * -1 /* { dg-warning "8:changes sign when promoted" } */
#endif
-#if 1U / -2 /* { dg-warning "changes sign when promoted" } */
+#if 1U / -2 /* { dg-warning "8:changes sign when promoted" } */
#endif
-#if -1 % 1U /* { dg-warning "changes sign when promoted" } */
+#if -1 % 1U /* { dg-warning "8:changes sign when promoted" } */
#endif
-#if 1 ? 0U : -1 /* { dg-warning "changes sign when promoted" } */
+#if 1 ? 0U : -1 /* { dg-warning "12:changes sign when promoted" } */
#endif
-#if 1 ? -1 : 0U /* { dg-warning "changes sign when promoted" } */
+#if 1 ? -1 : 0U /* { dg-warning "12:changes sign when promoted" } */
#endif
Index: gcc/testsuite/gcc.dg/cpp/pr27777.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr27777.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/pr27777.c (working copy)
@@ -4,5 +4,5 @@
#error "BUG??!"
-/* { dg-error "BUG" "" { target *-*-* } 5 } */
-/* { dg-warning "trigraph" "" { target *-*-* } 5 } */
+/* { dg-error "2:BUG" "" { target *-*-* } 5 } */
+/* { dg-warning "12:trigraph" "" { target *-*-* } 5 } */
Index: gcc/testsuite/gcc.dg/cpp/redef2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/redef2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/redef2.c (working copy)
@@ -1,7 +1,7 @@
/* Test for redefining macros with significant differences. */
/* { dg-do preprocess }
- { dg-options "-ansi -Wall -fno-show-column" } */
+ { dg-options "-ansi -Wall" } */
#define mac(a, b) (a) + (b)
#define mac(a, b) (a) * (b)
@@ -17,15 +17,15 @@
#define foo(x) x
#define foo(x)x /* { dg-bogus "redefined" "redefined foo" } */
-/* { dg-warning "redefined" "redef mac" { target *-*-* } 7 }
- { dg-warning "redefined" "redef mac" { target *-*-* } 8 }
- { dg-warning "redefined" "redef mac" { target *-*-* } 9 }
- { dg-warning "redefined" "redef ro" { target *-*-* } 12 }
- { dg-warning "redefined" "redef va" { target *-*-* } 15 }
+/* { dg-warning "9:redefined" "redef mac" { target *-*-* } 7 }
+ { dg-warning "9:redefined" "redef mac" { target *-*-* } 8 }
+ { dg-warning "9:redefined" "redef mac" { target *-*-* } 9 }
+ { dg-warning "9:redefined" "redef ro" { target *-*-* } 12 }
+ { dg-warning "9:redefined" "redef va" { target *-*-* } 15 }
- { dg-warning "previous" "prev def mac" { target *-*-* } 6 }
- { dg-warning "previous" "prev def mac" { target *-*-* } 7 }
- { dg-warning "previous" "prev def mac" { target *-*-* } 8 }
- { dg-warning "previous" "prev def ro" { target *-*-* } 11 }
- { dg-warning "previous" "prev def va" { target *-*-* } 14 }
+ { dg-warning "9:previous" "prev def mac" { target *-*-* } 6 }
+ { dg-warning "9:previous" "prev def mac" { target *-*-* } 7 }
+ { dg-warning "9:previous" "prev def mac" { target *-*-* } 8 }
+ { dg-warning "9:previous" "prev def ro" { target *-*-* } 11 }
+ { dg-warning "9:previous" "prev def va" { target *-*-* } 14 }
*/
Index: gcc/testsuite/gcc.dg/cpp/trad/assert2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/trad/assert2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/trad/assert2.c (working copy)
@@ -2,23 +2,27 @@
/* { dg-do preprocess } */
/* { dg-options "-Wno-deprecated" } */
-#assert /* { dg-error "without predicate" "assert w/o predicate" } */
-#assert % /* { dg-error "an identifier" "assert punctuation" } */
-#assert 12 /* { dg-error "an identifier" "assert number" } */
-#assert abc /* { dg-error "missing" "assert w/o answer" } */
+#assert /* { dg-error "1:without predicate" "assert w/o predicate" } */
+#assert % /* { dg-error "9:an identifier" "assert punctuation" } */
+#assert 12 /* { dg-error "9:an identifier" "assert number" } */
+#assert abc /* { dg-error "9:missing" "assert w/o answer" } */
-#if # /* { dg-error "without predicate" "test w/o predicate" } */
+#if # /* { dg-error "5:without predicate" "test w/o predicate" } */
#endif
-#if #% /* { dg-error "an identifier" "test punctuation" } */
+#if #% /* { dg-error "6:an identifier" "test punctuation" } */
#endif
-#if #12 /* { dg-error "an identifier" "test number" } */
+#if #12 /* { dg-error "6:an identifier" "test number" } */
#endif
#if #abc
#error /* { dg-bogus "error" "test w/o answer" } */
#endif
-#if #abc[def] /* { dg-error "not valid in" "bad syntax" } */
+#if #abc[def] /* { dg-error "9:not valid in" "bad syntax" } */
#endif
+
+#assert maude(23 /* { dg-error "15:to complete answer" "missing ')'" } */
+
+#assert lalala() /* { dg-error "16:answer is empty" "empty answer" } */
Index: gcc/testsuite/gcc.dg/cpp/trad/trad.exp
===================================================================
--- gcc/testsuite/gcc.dg/cpp/trad/trad.exp (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/trad/trad.exp (working copy)
@@ -1,4 +1,4 @@
-# Copyright (C) 1997, 2000, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2000, 2007, 2008 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@
# Main loop.
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
- "-fno-show-column" $DEFAULT_TRADCPPFLAGS
+ "" $DEFAULT_TRADCPPFLAGS
# All done.
dg-finish
Index: gcc/testsuite/gcc.dg/cpp/backslash2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/backslash2.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/backslash2.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
@@ -7,7 +7,7 @@
foo \
bar
-/* { dg-warning "separated by space" "" { target *-*-* } 8 } */
+/* { dg-warning "5:separated by space" "" { target *-*-* } 8 } */
/* foo \
bar */
Index: gcc/testsuite/gcc.dg/cpp/19951025-1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/19951025-1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/19951025-1.c (working copy)
@@ -1,4 +1,4 @@
/* { dg-do preprocess } */
-/* { dg-error "include expects" "include" { target *-*-* } 4 } */
-/* { dg-error "newline at end" "newline" { target *-*-* } 4 } */
+/* { dg-error "include expects" "10:include" { target *-*-* } 4 } */
+/* { dg-error "newline at end" "11:newline" { target *-*-* } 4 } */
#include /\
Index: gcc/testsuite/gcc.dg/cpp/charconst-4.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/charconst-4.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/charconst-4.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc. */
+/* Copyright (C) 2001, 2008 Free Software Foundation, Inc. */
/* { dg-do run } */
/* { dg-options "-Wno-multichar -fsigned-char" } */
@@ -38,7 +38,7 @@
# error Charconst incorrectly sign-extended
#endif
-#if LONG_CHARCONST != SHORT_CHARCONST /* { dg-warning "too long" "" } */
+#if LONG_CHARCONST != SHORT_CHARCONST /* { dg-warning "5:too long" "" } */
# error Overly long charconst truncates wrongly for preprocessor
#endif
@@ -46,7 +46,7 @@
{
if (POS_CHARCONST < 0)
abort ();
- if (LONG_CHARCONST != SHORT_CHARCONST) /* { dg-warning "too long" "" } */
+ if (LONG_CHARCONST != SHORT_CHARCONST) /* { dg-warning "7:too long" "" } */
abort ();
return 0;
}
Index: gcc/testsuite/gcc.dg/cpp/dir-only-6.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/dir-only-6.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/dir-only-6.c (working copy)
@@ -1,7 +1,7 @@
-/* Copyright 2007 Free Software Foundation, Inc.
+/* Copyright 2007, 2008 Free Software Foundation, Inc.
Contributed by Ollie Wild <aaw@google.com>. */
/* { dg-do preprocess } */
/* { dg-options -fdirectives-only } */
-/* { dg-error "unterminated comment" }
+/* { dg-error "1:unterminated comment" }
Index: gcc/testsuite/gcc.dg/cpp/if-paren.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/if-paren.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/if-paren.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
@@ -11,21 +11,21 @@
#error /* { dg-bogus "error" "without paren" } */
#endif
-#if () /* { dg-error "expression between" "empty paren" } */
+#if () /* { dg-error "6:expression between" "empty paren" } */
#endif
#if (1) == 1
-#error /* { dg-error "" "simple parens no. 1" } */
+#error /* { dg-error "2:" "simple parens no. 1" } */
#endif
#if (2)
-#error /* { dg-error "" "simple parens no. 2" } */
+#error /* { dg-error "2:" "simple parens no. 2" } */
#endif
#if 3 == (3)
-#error /* { dg-error "" "simple parens no. 3" } */
+#error /* { dg-error "2:" "simple parens no. 3" } */
#endif
#if (((-1) + 8)) == ((+2) * ((3)) - -1)
-#error /* { dg-error "" "nested parentheses" } */
+#error /* { dg-error "2:" "nested parentheses" } */
#endif
Index: gcc/testsuite/gcc.dg/cpp/extratokens.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/extratokens.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/extratokens.c (working copy)
@@ -1,7 +1,7 @@
/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
-/* { dg-options "-fno-show-column -Wno-deprecated" } */
+/* { dg-options "-Wno-deprecated" } */
/* Tests all directives that do not permit excess tokens at the end of
the line. */
@@ -9,27 +9,27 @@
/* Source: Neil Booth, 4 Dec 2000. The combination of separate test
cases. */
-#ifdef foo bar /* { dg-warning "extra tokens" "tokens after #ifdef" } */
+#ifdef foo bar /* { dg-warning "12:extra tokens" "tokens after #ifdef" } */
#endif
-#ifndef foo bar /* { dg-warning "extra tokens" "tokens after #ifndef" } */
+#ifndef foo bar /* { dg-warning "13:extra tokens" "tokens after #ifndef" } */
#endif
#if 1
#if 0
-#else foo /* { dg-warning "extra tokens" "tokens after #else" } */
-#endif / /* { dg-warning "extra tokens" "tokens after #endif" } */
+#else foo /* { dg-warning "7:extra tokens" "tokens after #else" } */
+#endif / /* { dg-warning "8:extra tokens" "tokens after #endif" } */
#endif
-#undef foo bar /* { dg-warning "extra tokens" "tokens after #undef" } */
+#undef foo bar /* { dg-warning "12:extra tokens" "tokens after #undef" } */
-#assert foo(bar) bar /* { dg-warning "extra tokens" "tokens after #assert" } */
+#assert foo(bar) bar /* { dg-warning "18:extra tokens" "tokens after #assert" } */
-#unassert foo(bar) b /* { dg-warning "extra tokens" "tokens after #unassert" } */
+#unassert foo(bar) b /* { dg-warning "20:extra tokens" "tokens after #unassert" } */
-#include "mi1c.h" bar /* { dg-warning "extra tokens" "tokens after #include" } */
+#include "mi1c.h" bar /* { dg-warning "19:extra tokens" "tokens after #include" } */
-#ident "something" bar /* { dg-warning "extra tokens" "tokens after #ident" } */
+#ident "something" bar /* { dg-warning "20:extra tokens" "tokens after #ident" } */
# 36 "file.c" 3
Index: gcc/testsuite/gcc.dg/cpp/pr29612-1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr29612-1.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/pr29612-1.c (working copy)
@@ -4,7 +4,7 @@
# 6 "pr29612-1.c"
-int foo (void) { return 'ab'; } /* { dg-warning "multi-character" } */
+int foo (void) { return 'ab'; } /* { dg-warning "25:multi-character" } */
# 1 "foo.h" 1 3
@@ -12,4 +12,4 @@
# 14 "pr29612-1.c" 2
-int baz (void) { return 'ab'; } /* { dg-warning "multi-character" } */
+int baz (void) { return 'ab'; } /* { dg-warning "25:multi-character" } */
Index: gcc/testsuite/gcc.dg/cpp/if-mpar.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/if-mpar.c (revision 140858)
+++ gcc/testsuite/gcc.dg/cpp/if-mpar.c (working copy)
@@ -1,24 +1,24 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */
/* Test various combinations of missing parentheses give the correct
missing parenthesis message. */
/* { dg-do preprocess } */
-#if (1 /* { dg-error "missing '\\)'" "missing ')' no. 1" } */
+#if (1 /* { dg-error "5:missing '\\)'" "missing ')' no. 1" } */
#endif
-#if 2 * (3 + 4 /* { dg-error "missing '\\)'" "missing ')' no. 2" } */
+#if 2 * (3 + 4 /* { dg-error "9:missing '\\)'" "missing ')' no. 2" } */
#endif
-#if (2)) /* { dg-error "missing '\\('" "missing '(' no. 1" } */
+#if (2)) /* { dg-error "8:missing '\\('" "missing '(' no. 1" } */
#endif
-#if ) /* { dg-error "missing '\\('" "missing '(' no. 2" } */
+#if ) /* { dg-error "5:missing '\\('" "missing '(' no. 2" } */
#endif
-#if 4) /* { dg-error "missing '\\('" "missing '(' no. 3" } */
+#if 4) /* { dg-error "6:missing '\\('" "missing '(' no. 3" } */
#endif
-#if ( /* { dg-error "missing '\\)'" "missing ')' no. 3" } */
+#if ( /* { dg-error "5:missing '\\)'" "missing ')' no. 3" } */
#endif
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (revision 140858)
+++ gcc/testsuite/ChangeLog (working copy)
@@ -1,3 +1,11 @@
+<<<<<<< .mine
+2008-08-28 Tom Tromey <tromey@redhat.com>
+
+ * gcc.dg/cpp/trad/assert2.c: Add assertion tests.
+ * gcc.dg/cpp/paste15.c: Add column numbers.
+ * gcc.dg/cpp/cpp.exp: Don't pass -fno-show-column.
+
+=======
2008-10-03 Jakub Jelinek <jakub@redhat.com>
PR debug/37726
@@ -2492,6 +2500,7 @@
* gcc.dg/ipa/ipa-5.c: Add -fipa-cp-clone
* gcc.dg/ipa/ipa-7.c: Add -fipa-cp-clone
+>>>>>>> .r140858
2008-08-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/35321
Index: gcc/testsuite/lib/gcc-dg.exp
===================================================================
--- gcc/testsuite/lib/gcc-dg.exp (revision 140858)
+++ gcc/testsuite/lib/gcc-dg.exp (working copy)
@@ -613,6 +613,19 @@
}
}
+if { [info procs saved-dg-bogus] == [list] \
+ && [info exists gcc_error_prefix] } {
+ rename dg-bogus saved-dg-bogus
+
+ proc dg-bogus { args } {
+ # Make this variable available here and to the saved proc.
+ upvar dg-messages dg-messages
+ global gcc_error_prefix
+
+ process-message saved-dg-bogus "$gcc_error_prefix" "$args"
+ }
+}
+
# Modify the regular expression saved by a DejaGnu message directive to
# include a prefix and to force the expression to match a single line.
# MSGPROC is the procedure to call.
@@ -645,7 +658,11 @@
# Include the column in the search expression.
set expmsg "$column: $msgprefix\[^\n]*$expmsg"
} else {
- set expmsg "$msgprefix\[^\n]*$expmsg"
+ # Note that we must ignore columns if they exist. Otherwise,
+ # a dg-bogus (which by its nature should not have a column
+ # number) can fail if there is a message whose column happens
+ # to be the same as the line number expected by the dg-bogus.
+ set expmsg "(\[0-9\]+: )?$msgprefix\[^\n]*$expmsg"
}
set newentry [lreplace $newentry 2 2 $expmsg]