From a56abdccae1807251bcec03f8979fedba8edbf95 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez?= Date: Tue, 28 Oct 2014 21:56:24 +0000 Subject: [PATCH] re PR fortran/44054 (Handle -Werror, -Werror=, -fdiagnostics-show-option, !GCC$ diagnostic (pragmas) and color) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2014-10-28 Manuel López-Ibáñez PR fortran/44054 * gfortran.h (gfc_warning_cmdline): Rename as gfc_warning_now_2. (gfc_error_cmdline): Rename as gfc_error_now_2. * error.c (gfc_diagnostic_build_locus_prefix): Remove trailing space. (gfc_diagnostic_starter): Add space between locus and prefix. (gfc_warning_now_2): Renamed from gfc_warning_cmdline. (gfc_error_now_2): Renamed from gfc_error_cmdline. * scanner.c (add_path_to_list): Use gfc_warning_now_2. (load_line): Likewise. (load_file): Likewise. * options.c (gfc_post_options): Update all renamed functions. From-SVN: r216812 --- gcc/fortran/ChangeLog | 14 ++++++++++++++ gcc/fortran/error.c | 23 +++++++++++------------ gcc/fortran/gfortran.h | 6 +++--- gcc/fortran/options.c | 28 ++++++++++++++-------------- gcc/fortran/scanner.c | 24 ++++++++++++------------ 5 files changed, 54 insertions(+), 41 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 743b1d4f4c9..20de711b4b4 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,17 @@ +2014-10-28 Manuel López-Ibáñez + + PR fortran/44054 + * gfortran.h (gfc_warning_cmdline): Rename as gfc_warning_now_2. + (gfc_error_cmdline): Rename as gfc_error_now_2. + * error.c (gfc_diagnostic_build_locus_prefix): Remove trailing space. + (gfc_diagnostic_starter): Add space between locus and prefix. + (gfc_warning_now_2): Renamed from gfc_warning_cmdline. + (gfc_error_now_2): Renamed from gfc_error_cmdline. + * scanner.c (add_path_to_list): Use gfc_warning_now_2. + (load_line): Likewise. + (load_file): Likewise. + * options.c (gfc_post_options): Update all renamed functions. + 2014-10-28 Andrew MacLeod * f95-lang.c: Adjust include files. diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c index b623ea82c01..2116f56ba47 100644 --- a/gcc/fortran/error.c +++ b/gcc/fortran/error.c @@ -1004,13 +1004,13 @@ gfc_diagnostic_build_locus_prefix (diagnostic_context *context, s.column = diagnostic->override_column; return (s.file == NULL - ? build_message_string ("%s%s:%s ", locus_cs, progname, locus_ce ) + ? build_message_string ("%s%s:%s", locus_cs, progname, locus_ce ) : !strcmp (s.file, N_("")) - ? build_message_string ("%s%s:%s ", locus_cs, s.file, locus_ce) + ? build_message_string ("%s%s:%s", locus_cs, s.file, locus_ce) : context->show_column - ? build_message_string ("%s%s:%d:%d:%s ", locus_cs, s.file, s.line, + ? build_message_string ("%s%s:%d:%d:%s", locus_cs, s.file, s.line, s.column, locus_ce) - : build_message_string ("%s%s:%d:%s ", locus_cs, s.file, s.line, locus_ce)); + : build_message_string ("%s%s:%d:%s", locus_cs, s.file, s.line, locus_ce)); } static void @@ -1038,7 +1038,7 @@ gfc_diagnostic_starter (diagnostic_context *context, { /* Otherwise, start again. */ pp_clear_output_area(context->printer); - pp_set_prefix (context->printer, concat (locus_prefix, prefix, NULL)); + pp_set_prefix (context->printer, concat (locus_prefix, " ", prefix, NULL)); free (prefix); } free (locus_prefix); @@ -1052,10 +1052,10 @@ gfc_diagnostic_finalizer (diagnostic_context *context, pp_newline_and_flush (context->printer); } -/* Give a warning about the command-line. */ +/* Immediate warning (i.e. do not buffer the warning). */ bool -gfc_warning_cmdline (int opt, const char *gmsgid, ...) +gfc_warning_now_2 (int opt, const char *gmsgid, ...) { va_list argp; diagnostic_info diagnostic; @@ -1070,11 +1070,10 @@ gfc_warning_cmdline (int opt, const char *gmsgid, ...) return ret; } - -/* Give a warning about the command-line. */ +/* Immediate warning (i.e. do not buffer the warning). */ bool -gfc_warning_cmdline (const char *gmsgid, ...) +gfc_warning_now_2 (const char *gmsgid, ...) { va_list argp; diagnostic_info diagnostic; @@ -1089,10 +1088,10 @@ gfc_warning_cmdline (const char *gmsgid, ...) } -/* Give an error about the command-line. */ +/* Immediate error (i.e. do not buffer). */ void -gfc_error_cmdline (const char *gmsgid, ...) +gfc_error_now_2 (const char *gmsgid, ...) { va_list argp; diagnostic_info diagnostic; diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 6f258db961f..00bc8400e5a 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -2698,15 +2698,15 @@ const char *gfc_print_wide_char (gfc_char_t); void gfc_warning (const char *, ...) ATTRIBUTE_GCC_GFC(1,2); void gfc_warning_now (const char *, ...) ATTRIBUTE_GCC_GFC(1,2); -bool gfc_warning_cmdline (const char *gmsgid, ...) ATTRIBUTE_GCC_GFC(1,2); -bool gfc_warning_cmdline (int opt, const char *gmsgid, ...) ATTRIBUTE_GCC_GFC(2,3); +bool gfc_warning_now_2 (const char *gmsgid, ...) ATTRIBUTE_GCC_GFC(1,2); +bool gfc_warning_now_2 (int opt, const char *gmsgid, ...) ATTRIBUTE_GCC_GFC(2,3); void gfc_clear_warning (void); void gfc_warning_check (void); void gfc_error (const char *, ...) ATTRIBUTE_GCC_GFC(1,2); -void gfc_error_cmdline (const char *gmsgid, ...) ATTRIBUTE_GCC_GFC(1,2); void gfc_error_now (const char *, ...) ATTRIBUTE_GCC_GFC(1,2); +void gfc_error_now_2 (const char *gmsgid, ...) ATTRIBUTE_GCC_GFC(1,2); void gfc_fatal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2); void gfc_internal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2); void gfc_clear_error (void); diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index a482d2f3a73..8bc8f94a59d 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -362,8 +362,8 @@ gfc_post_options (const char **pfilename) if (gfc_current_form == FORM_UNKNOWN) { gfc_current_form = FORM_FREE; - gfc_warning_cmdline ("Reading file %qs as free form", - (filename[0] == '\0') ? "" : filename); + gfc_warning_now_2 ("Reading file %qs as free form", + (filename[0] == '\0') ? "" : filename); } } @@ -372,10 +372,10 @@ gfc_post_options (const char **pfilename) if (gfc_current_form == FORM_FREE) { if (gfc_option.flag_d_lines == 0) - gfc_warning_cmdline ("%<-fd-lines-as-comments%> has no effect " - "in free form"); + gfc_warning_now_2 ("%<-fd-lines-as-comments%> has no effect " + "in free form"); else if (gfc_option.flag_d_lines == 1) - gfc_warning_cmdline ("%<-fd-lines-as-code%> has no effect in free form"); + gfc_warning_now_2 ("%<-fd-lines-as-code%> has no effect in free form"); } /* If -pedantic, warn about the use of GNU extensions. */ @@ -393,21 +393,21 @@ gfc_post_options (const char **pfilename) if (!gfc_option.flag_automatic && gfc_option.flag_max_stack_var_size != -2 && gfc_option.flag_max_stack_var_size != 0) - gfc_warning_cmdline ("Flag %<-fno-automatic%> overwrites %<-fmax-stack-var-size=%d%>", - gfc_option.flag_max_stack_var_size); + gfc_warning_now_2 ("Flag %<-fno-automatic%> overwrites %<-fmax-stack-var-size=%d%>", + gfc_option.flag_max_stack_var_size); else if (!gfc_option.flag_automatic && gfc_option.flag_recursive) - gfc_warning_cmdline ("Flag %<-fno-automatic%> overwrites %<-frecursive%>"); + gfc_warning_now_2 ("Flag %<-fno-automatic%> overwrites %<-frecursive%>"); else if (!gfc_option.flag_automatic && gfc_option.gfc_flag_openmp) - gfc_warning_cmdline ("Flag %<-fno-automatic%> overwrites %<-frecursive%> implied by " - "%<-fopenmp%>"); + gfc_warning_now_2 ("Flag %<-fno-automatic%> overwrites %<-frecursive%> implied by " + "%<-fopenmp%>"); else if (gfc_option.flag_max_stack_var_size != -2 && gfc_option.flag_recursive) - gfc_warning_cmdline ("Flag %<-frecursive%> overwrites %<-fmax-stack-var-size=%d%>", - gfc_option.flag_max_stack_var_size); + gfc_warning_now_2 ("Flag %<-frecursive%> overwrites %<-fmax-stack-var-size=%d%>", + gfc_option.flag_max_stack_var_size); else if (gfc_option.flag_max_stack_var_size != -2 && gfc_option.gfc_flag_openmp) - gfc_warning_cmdline ("Flag %<-fmax-stack-var-size=%d%> overwrites %<-frecursive%> " - "implied by %<-fopenmp%>", + gfc_warning_now_2 ("Flag %<-fmax-stack-var-size=%d%> overwrites %<-frecursive%> " + "implied by %<-fopenmp%>", gfc_option.flag_max_stack_var_size); /* Implement -frecursive as -fmax-stack-var-size=-1. */ diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index 757037c4b30..2c0d4c3cf21 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -324,16 +324,16 @@ add_path_to_list (gfc_directorylist **list, const char *path, if (stat (q, &st)) { if (errno != ENOENT) - gfc_warning_cmdline ("Include directory %qs: %s", path, - xstrerror(errno)); + gfc_warning_now_2 ("Include directory %qs: %s", path, + xstrerror(errno)); else if (warn) - gfc_warning_cmdline (OPT_Wmissing_include_dirs, - "Nonexistent include directory %qs", path); + gfc_warning_now_2 (OPT_Wmissing_include_dirs, + "Nonexistent include directory %qs", path); return; } else if (!S_ISDIR (st.st_mode)) { - gfc_warning_cmdline ("%qs is not a directory", path); + gfc_warning_now_2 ("%qs is not a directory", path); return; } @@ -1476,11 +1476,11 @@ load_line (FILE *input, gfc_char_t **pbuf, int *pbuflen, const int *first_char) && !seen_printable && seen_ampersand) { if (pedantic) - gfc_error_now ("'&' not allowed by itself in line %d", - current_line); + gfc_error_now_2 ("%<&%> not allowed by itself in line %d", + current_line); else - gfc_warning_now ("'&' not allowed by itself in line %d", - current_line); + gfc_warning_now_2 ("%<&%> not allowed by itself in line %d", + current_line); } break; } @@ -1538,8 +1538,8 @@ load_line (FILE *input, gfc_char_t **pbuf, int *pbuflen, const int *first_char) && current_line != linenum) { linenum = current_line; - gfc_warning_now ("Nonconforming tab character in column %d " - "of line %d", i+1, linenum); + gfc_warning_now_2 ("Nonconforming tab character in column %d " + "of line %d", i+1, linenum); } while (i < 6) @@ -1922,7 +1922,7 @@ load_file (const char *realfilename, const char *displayedname, bool initial) input = gfc_open_file (realfilename); if (input == NULL) { - gfc_error_cmdline ("Can't open file %qs", filename); + gfc_error_now_2 ("Can't open file %qs", filename); return false; } } -- 2.30.2