aboutsummaryrefslogtreecommitdiff
path: root/gcc/cccp.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-08-13 18:32:16 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1995-08-13 18:32:16 -0400
commit254d3f88b467dffb1c34e23aac1a96ab243550d0 (patch)
tree9b65fdbc87f3a92e093b68d0ddeab4b1bb3440fd /gcc/cccp.c
parent5a00de6f5251379d0883143759eae721ca99fc4d (diff)
downloadgcc-254d3f88b467dffb1c34e23aac1a96ab243550d0.zip
gcc-254d3f88b467dffb1c34e23aac1a96ab243550d0.tar.gz
gcc-254d3f88b467dffb1c34e23aac1a96ab243550d0.tar.bz2
(warning_with_line): New function.
(trigraph_pcp): Use it, to avoid reporting line number. (vwarning_with_line): Don't report line number if zero. From-SVN: r10217
Diffstat (limited to 'gcc/cccp.c')
-rw-r--r--gcc/cccp.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index ee726e5..a1cc53e 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -1157,6 +1157,7 @@ static void vwarning PROTO((char *, va_list));
static void error_with_line PRINTF_PROTO_2((int, char *, ...));
static void verror_with_line PROTO((int, char *, va_list));
static void vwarning_with_line PROTO((int, char *, va_list));
+static void warning_with_line PROTO((int, char *, ...));
void pedwarn PRINTF_PROTO_1((char *, ...));
void pedwarn_with_line PRINTF_PROTO_2((int, char *, ...));
static void pedwarn_with_file_and_line PRINTF_PROTO_3((char *, int, char *, ...));
@@ -2487,7 +2488,7 @@ trigraph_pcp (buf)
buf->length -= fptr - bptr;
buf->buf[buf->length] = '\0';
if (warn_trigraphs && fptr != bptr)
- warning ("%d trigraph(s) encountered", (fptr - bptr) / 2);
+ warning_with_line (0, "%d trigraph(s) encountered", (fptr - bptr) / 2);
}
/* Move all backslash-newline pairs out of embarrassing places.
@@ -9003,6 +9004,22 @@ verror_with_line (line, msg, args)
}
static void
+#if defined (__STDC__) && defined (HAVE_VPRINTF)
+warning_with_line (int line, PRINTF_ALIST (msg))
+#else
+warning_with_line (line, PRINTF_ALIST (msg))
+ int line;
+ PRINTF_DCL (msg)
+#endif
+{
+ va_list args;
+
+ VA_START (args, msg);
+ vwarning_with_line (line, msg, args);
+ va_end (args);
+}
+
+static void
vwarning_with_line (line, msg, args)
int line;
char *msg;
@@ -9026,7 +9043,7 @@ vwarning_with_line (line, msg, args)
}
if (ip != NULL)
- fprintf (stderr, "%s:%d: ", ip->nominal_fname, line);
+ fprintf (stderr, line ? "%s:%d: " : "%s: ", ip->nominal_fname, line);
fprintf (stderr, "warning: ");
vfprintf (stderr, msg, args);
fprintf (stderr, "\n");