+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>
* f95-lang.c: Adjust include files.
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_("<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
- ? 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
{
/* 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);
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;
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;
}
-/* 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;
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);
if (gfc_current_form == FORM_UNKNOWN)
{
gfc_current_form = FORM_FREE;
- gfc_warning_cmdline ("Reading file %qs as free form",
- (filename[0] == '\0') ? "<stdin>" : filename);
+ gfc_warning_now_2 ("Reading file %qs as free form",
+ (filename[0] == '\0') ? "<stdin>" : filename);
}
}
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. */
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. */
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;
}
&& !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;
}
&& 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)
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;
}
}