summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-01-30 03:31:59 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-01-30 03:31:59 +0000
commit2b9117afd21ac57a437e5b907d0ee4d91698af93 (patch)
tree79fd63777562408a7a168cbfdeed51b0d2eb1186
parent0748bb79d63eb853a969df6be759fcbe644f13d9 (diff)
downloadgcc-2b9117afd21ac57a437e5b907d0ee4d91698af93.tar.gz
* cpperror.c (cpp_file_line_for_message): If 'line' is zero,
just print "<command line>". If 'filename' is null or an empty string, print "<stdin>" for the filename. * cpplib.c (do_define): Don't print the 'location of the previous definition' message if we're still parsing the command line. (cpp_pedwarn_with_file_and_line): Always call cpp_file_line_for_message. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31697 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/cpperror.c6
-rw-r--r--gcc/cpplib.c5
3 files changed, 18 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 31411bfb7ad..86854043200 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2000-01-29 Zack Weinberg <zack@wolery.cumb.org>
+
+ * cpperror.c (cpp_file_line_for_message): If 'line' is zero,
+ just print "<command line>". If 'filename' is null or an
+ empty string, print "<stdin>" for the filename.
+ * cpplib.c (do_define): Don't print the 'location of the
+ previous definition' message if we're still parsing the
+ command line.
+ (cpp_pedwarn_with_file_and_line): Always call
+ cpp_file_line_for_message.
+
2000-01-29 Mark Mitchell <mark@codesourcery.com>
* flow.c (mark_regs_live_at_end): Fix typo.
diff --git a/gcc/cpperror.c b/gcc/cpperror.c
index 40fb26ecebb..d0900e84373 100644
--- a/gcc/cpperror.c
+++ b/gcc/cpperror.c
@@ -84,7 +84,11 @@ cpp_file_line_for_message (pfile, filename, line, column)
const char *filename;
int line, column;
{
- if (column > 0)
+ if (filename == 0 || *filename == '\0')
+ filename = "<stdin>";
+ if (line == 0)
+ fputs (_("<command line>: "), stderr);
+ else if (column > 0)
fprintf (stderr, "%s:%d:%d: ", filename, line, column);
else
fprintf (stderr, "%s:%d: ", filename, line);
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index 44134e605cd..cdfdaa3e29d 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -685,7 +685,7 @@ do_define (pfile, keyword)
mdef.symlen, mdef.symnam);
else
cpp_pedwarn (pfile, "`%.*s' redefined", mdef.symlen, mdef.symnam);
- if (hp->type == T_MACRO)
+ if (hp->type == T_MACRO && CPP_OPTIONS (pfile)->done_initializing)
cpp_pedwarn_with_file_and_line (pfile, hp->value.defn->file,
hp->value.defn->line,
"this is the location of the previous definition");
@@ -3474,8 +3474,7 @@ cpp_pedwarn_with_file_and_line VPARAMS ((cpp_reader *pfile, const char *file,
if (!CPP_OPTIONS (pfile)->pedantic_errors
&& CPP_OPTIONS (pfile)->inhibit_warnings)
return;
- if (file != NULL)
- cpp_file_line_for_message (pfile, file, line, -1);
+ cpp_file_line_for_message (pfile, file, line, -1);
v_cpp_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors, msgid, ap);
va_end(ap);
}