From 254d3f88b467dffb1c34e23aac1a96ab243550d0 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Sun, 13 Aug 1995 18:32:16 -0400 Subject: [PATCH] (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 --- gcc/cccp.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/gcc/cccp.c b/gcc/cccp.c index ee726e591c2..a1cc53e4288 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. @@ -9002,6 +9003,22 @@ verror_with_line (line, msg, args) errors++; } +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; @@ -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"); -- 2.30.2