diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 2000-01-28 16:34:00 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 2000-01-28 16:34:00 +0000 |
commit | b9ff48144498c9cc2b5f3fd6bd03391579bd24cd (patch) | |
tree | 97c01775857a42a4024e110809051cea97ee6677 | |
parent | 7267d6924e8ce13cbb4003cb6fe2a83702f8b0cc (diff) | |
download | gcc-b9ff48144498c9cc2b5f3fd6bd03391579bd24cd.zip gcc-b9ff48144498c9cc2b5f3fd6bd03391579bd24cd.tar.gz gcc-b9ff48144498c9cc2b5f3fd6bd03391579bd24cd.tar.bz2 |
diagnostic.c (build_message_string, [...]): Add ATTRIBUTE_PRINTF_*.
* diagnostic.c (build_message_string, output_printf,
line_wrapper_printf): Add ATTRIBUTE_PRINTF_*.
(build_location_prefix): Fix non-literal format string.
From-SVN: r31669
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/diagnostic.c | 30 |
2 files changed, 26 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0dc225f..0ed0123 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2000-01-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * diagnostic.c (build_message_string, output_printf, + line_wrapper_printf): Add ATTRIBUTE_PRINTF_*. + (build_location_prefix): Fix non-literal format string. + 2000-01-27 Richard Henderson <rth@cygnus.com> * alpha.md (trunctfsf2): New. diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 175151b..97ec8c0 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -63,12 +63,15 @@ static void output_append PARAMS ((struct output_buffer *, const char *, static void output_puts PARAMS ((struct output_buffer *, const char *)); static void dump_output PARAMS ((struct output_buffer *, FILE *)); static const char *vbuild_message_string PARAMS ((const char *, va_list)); -static const char *build_message_string PARAMS ((const char *, ...)); +static const char *build_message_string PARAMS ((const char *, ...)) + ATTRIBUTE_PRINTF_1; static const char *build_location_prefix PARAMS ((const char *, int, int)); static void voutput_notice PARAMS ((struct output_buffer *, const char *, va_list)); -static void output_printf PARAMS ((struct output_buffer *, const char *, ...)); -static void line_wrapper_printf PARAMS ((FILE *, const char *, ...)); +static void output_printf PARAMS ((struct output_buffer *, const char *, ...)) + ATTRIBUTE_PRINTF_2; +static void line_wrapper_printf PARAMS ((FILE *, const char *, ...)) + ATTRIBUTE_PRINTF_2; static void vline_wrapper_message_with_location PARAMS ((const char *, int, int, const char *, va_list)); @@ -315,13 +318,20 @@ build_location_prefix (file, line, warn) int line; int warn; { - const char *fmt = file - ? (warn ? "%s:%d: warning: " : "%s:%d: ") - : (warn ? "%s: warning: " : "%s: "); - - return file - ? build_message_string (fmt, file, line) - : build_message_string (fmt, progname); + if (file) + { + if (warn) + return build_message_string ("%s:%d: warning: ", file, line); + else + return build_message_string ("%s:%d: ", file, line); + } + else + { + if (warn) + return build_message_string ("%s: warning: ", progname); + else + return build_message_string ("%s: ", progname); + } } /* Format a MESSAGE into BUFFER. Automatically wrap lines. */ |