re PR fortran/44054 (Handle -Werror, -Werror=, -fdiagnostics-show-option, !GCC$…

re PR fortran/44054 (Handle -Werror, -Werror=, -fdiagnostics-show-option, !GCC$ diagnostic (pragmas) and color)

2014-10-28  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	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
parent 99630555
2014-10-28 Manuel López-Ibáñez <manu@gcc.gnu.org>
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 <amacleod@redhat.com> 2014-10-28 Andrew MacLeod <amacleod@redhat.com>
* f95-lang.c: Adjust include files. * f95-lang.c: Adjust include files.
......
...@@ -1004,13 +1004,13 @@ gfc_diagnostic_build_locus_prefix (diagnostic_context *context, ...@@ -1004,13 +1004,13 @@ gfc_diagnostic_build_locus_prefix (diagnostic_context *context,
s.column = diagnostic->override_column; s.column = diagnostic->override_column;
return (s.file == NULL 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_("<built-in>")) : !strcmp (s.file, N_("<built-in>"))
? 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 : 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) 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 static void
...@@ -1038,7 +1038,7 @@ gfc_diagnostic_starter (diagnostic_context *context, ...@@ -1038,7 +1038,7 @@ gfc_diagnostic_starter (diagnostic_context *context,
{ {
/* Otherwise, start again. */ /* Otherwise, start again. */
pp_clear_output_area(context->printer); 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 (prefix);
} }
free (locus_prefix); free (locus_prefix);
...@@ -1052,10 +1052,10 @@ gfc_diagnostic_finalizer (diagnostic_context *context, ...@@ -1052,10 +1052,10 @@ gfc_diagnostic_finalizer (diagnostic_context *context,
pp_newline_and_flush (context->printer); pp_newline_and_flush (context->printer);
} }
/* Give a warning about the command-line. */ /* Immediate warning (i.e. do not buffer the warning). */
bool bool
gfc_warning_cmdline (int opt, const char *gmsgid, ...) gfc_warning_now_2 (int opt, const char *gmsgid, ...)
{ {
va_list argp; va_list argp;
diagnostic_info diagnostic; diagnostic_info diagnostic;
...@@ -1070,11 +1070,10 @@ gfc_warning_cmdline (int opt, const char *gmsgid, ...) ...@@ -1070,11 +1070,10 @@ gfc_warning_cmdline (int opt, const char *gmsgid, ...)
return ret; return ret;
} }
/* Immediate warning (i.e. do not buffer the warning). */
/* Give a warning about the command-line. */
bool bool
gfc_warning_cmdline (const char *gmsgid, ...) gfc_warning_now_2 (const char *gmsgid, ...)
{ {
va_list argp; va_list argp;
diagnostic_info diagnostic; diagnostic_info diagnostic;
...@@ -1089,10 +1088,10 @@ gfc_warning_cmdline (const char *gmsgid, ...) ...@@ -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 void
gfc_error_cmdline (const char *gmsgid, ...) gfc_error_now_2 (const char *gmsgid, ...)
{ {
va_list argp; va_list argp;
diagnostic_info diagnostic; diagnostic_info diagnostic;
......
...@@ -2698,15 +2698,15 @@ const char *gfc_print_wide_char (gfc_char_t); ...@@ -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 (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
void gfc_warning_now (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_now_2 (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 (int opt, const char *gmsgid, ...) ATTRIBUTE_GCC_GFC(2,3);
void gfc_clear_warning (void); void gfc_clear_warning (void);
void gfc_warning_check (void); void gfc_warning_check (void);
void gfc_error (const char *, ...) ATTRIBUTE_GCC_GFC(1,2); 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 (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_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_internal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2);
void gfc_clear_error (void); void gfc_clear_error (void);
......
...@@ -362,8 +362,8 @@ gfc_post_options (const char **pfilename) ...@@ -362,8 +362,8 @@ gfc_post_options (const char **pfilename)
if (gfc_current_form == FORM_UNKNOWN) if (gfc_current_form == FORM_UNKNOWN)
{ {
gfc_current_form = FORM_FREE; gfc_current_form = FORM_FREE;
gfc_warning_cmdline ("Reading file %qs as free form", gfc_warning_now_2 ("Reading file %qs as free form",
(filename[0] == '\0') ? "<stdin>" : filename); (filename[0] == '\0') ? "<stdin>" : filename);
} }
} }
...@@ -372,10 +372,10 @@ gfc_post_options (const char **pfilename) ...@@ -372,10 +372,10 @@ gfc_post_options (const char **pfilename)
if (gfc_current_form == FORM_FREE) if (gfc_current_form == FORM_FREE)
{ {
if (gfc_option.flag_d_lines == 0) if (gfc_option.flag_d_lines == 0)
gfc_warning_cmdline ("%<-fd-lines-as-comments%> has no effect " gfc_warning_now_2 ("%<-fd-lines-as-comments%> has no effect "
"in free form"); "in free form");
else if (gfc_option.flag_d_lines == 1) 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. */ /* If -pedantic, warn about the use of GNU extensions. */
...@@ -393,21 +393,21 @@ gfc_post_options (const char **pfilename) ...@@ -393,21 +393,21 @@ gfc_post_options (const char **pfilename)
if (!gfc_option.flag_automatic && gfc_option.flag_max_stack_var_size != -2 if (!gfc_option.flag_automatic && gfc_option.flag_max_stack_var_size != -2
&& gfc_option.flag_max_stack_var_size != 0) && gfc_option.flag_max_stack_var_size != 0)
gfc_warning_cmdline ("Flag %<-fno-automatic%> overwrites %<-fmax-stack-var-size=%d%>", gfc_warning_now_2 ("Flag %<-fno-automatic%> overwrites %<-fmax-stack-var-size=%d%>",
gfc_option.flag_max_stack_var_size); gfc_option.flag_max_stack_var_size);
else if (!gfc_option.flag_automatic && gfc_option.flag_recursive) 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) else if (!gfc_option.flag_automatic && gfc_option.gfc_flag_openmp)
gfc_warning_cmdline ("Flag %<-fno-automatic%> overwrites %<-frecursive%> implied by " gfc_warning_now_2 ("Flag %<-fno-automatic%> overwrites %<-frecursive%> implied by "
"%<-fopenmp%>"); "%<-fopenmp%>");
else if (gfc_option.flag_max_stack_var_size != -2 else if (gfc_option.flag_max_stack_var_size != -2
&& gfc_option.flag_recursive) && gfc_option.flag_recursive)
gfc_warning_cmdline ("Flag %<-frecursive%> overwrites %<-fmax-stack-var-size=%d%>", gfc_warning_now_2 ("Flag %<-frecursive%> overwrites %<-fmax-stack-var-size=%d%>",
gfc_option.flag_max_stack_var_size); gfc_option.flag_max_stack_var_size);
else if (gfc_option.flag_max_stack_var_size != -2 else if (gfc_option.flag_max_stack_var_size != -2
&& gfc_option.gfc_flag_openmp) && gfc_option.gfc_flag_openmp)
gfc_warning_cmdline ("Flag %<-fmax-stack-var-size=%d%> overwrites %<-frecursive%> " gfc_warning_now_2 ("Flag %<-fmax-stack-var-size=%d%> overwrites %<-frecursive%> "
"implied by %<-fopenmp%>", "implied by %<-fopenmp%>",
gfc_option.flag_max_stack_var_size); gfc_option.flag_max_stack_var_size);
/* Implement -frecursive as -fmax-stack-var-size=-1. */ /* Implement -frecursive as -fmax-stack-var-size=-1. */
......
...@@ -324,16 +324,16 @@ add_path_to_list (gfc_directorylist **list, const char *path, ...@@ -324,16 +324,16 @@ add_path_to_list (gfc_directorylist **list, const char *path,
if (stat (q, &st)) if (stat (q, &st))
{ {
if (errno != ENOENT) if (errno != ENOENT)
gfc_warning_cmdline ("Include directory %qs: %s", path, gfc_warning_now_2 ("Include directory %qs: %s", path,
xstrerror(errno)); xstrerror(errno));
else if (warn) else if (warn)
gfc_warning_cmdline (OPT_Wmissing_include_dirs, gfc_warning_now_2 (OPT_Wmissing_include_dirs,
"Nonexistent include directory %qs", path); "Nonexistent include directory %qs", path);
return; return;
} }
else if (!S_ISDIR (st.st_mode)) 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; return;
} }
...@@ -1476,11 +1476,11 @@ load_line (FILE *input, gfc_char_t **pbuf, int *pbuflen, const int *first_char) ...@@ -1476,11 +1476,11 @@ load_line (FILE *input, gfc_char_t **pbuf, int *pbuflen, const int *first_char)
&& !seen_printable && seen_ampersand) && !seen_printable && seen_ampersand)
{ {
if (pedantic) if (pedantic)
gfc_error_now ("'&' not allowed by itself in line %d", gfc_error_now_2 ("%<&%> not allowed by itself in line %d",
current_line); current_line);
else else
gfc_warning_now ("'&' not allowed by itself in line %d", gfc_warning_now_2 ("%<&%> not allowed by itself in line %d",
current_line); current_line);
} }
break; break;
} }
...@@ -1538,8 +1538,8 @@ load_line (FILE *input, gfc_char_t **pbuf, int *pbuflen, const int *first_char) ...@@ -1538,8 +1538,8 @@ load_line (FILE *input, gfc_char_t **pbuf, int *pbuflen, const int *first_char)
&& current_line != linenum) && current_line != linenum)
{ {
linenum = current_line; linenum = current_line;
gfc_warning_now ("Nonconforming tab character in column %d " gfc_warning_now_2 ("Nonconforming tab character in column %d "
"of line %d", i+1, linenum); "of line %d", i+1, linenum);
} }
while (i < 6) while (i < 6)
...@@ -1922,7 +1922,7 @@ load_file (const char *realfilename, const char *displayedname, bool initial) ...@@ -1922,7 +1922,7 @@ load_file (const char *realfilename, const char *displayedname, bool initial)
input = gfc_open_file (realfilename); input = gfc_open_file (realfilename);
if (input == NULL) if (input == NULL)
{ {
gfc_error_cmdline ("Can't open file %qs", filename); gfc_error_now_2 ("Can't open file %qs", filename);
return false; return false;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment