aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2015-05-16 12:31:00 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2015-05-16 12:31:00 +0000
commit2a2703a2bd0046ed60a2054df1f4f3ba5c793062 (patch)
treee38c12f0ed89361988c13ec74581d698238467a0 /gcc/fortran
parent40de31cfe4e8959e5f92c82aa34550693897d29c (diff)
downloadgcc-2a2703a2bd0046ed60a2054df1f4f3ba5c793062.zip
gcc-2a2703a2bd0046ed60a2054df1f4f3ba5c793062.tar.gz
gcc-2a2703a2bd0046ed60a2054df1f4f3ba5c793062.tar.bz2
re PR fortran/44054 (Handle -Werror, -Werror=, -fdiagnostics-show-option, !GCC$ diagnostic (pragmas) and color)
gcc/fortran/ChangeLog: 2015-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 Replace all calls to gfc_notify_std_1 with gfc_notify_std and gfc_warning_1 with gfc_warning. * decl.c (gfc_verify_c_interop_param): Here. * resolve.c (resolve_branch): Here. (resolve_fl_derived): Here. * dependency.c (gfc_check_argument_var_dependency): * scanner.c (preprocessor_line): Use gfc_warning_now_at. Fix line counter and locations before and after warning. * gfortran.h (gfc_warning_1, gfc_warning_now_1, gfc_notify_std_1): Delete. (gfc_warning_now_at): Declare. * error.c (gfc_warning_1): Delete. (gfc_notify_std_1): Delete. (gfc_warning_now_1): Delete. (gfc_format_decoder): Handle two locations. (gfc_diagnostic_build_prefix): Rename as gfc_diagnostic_build_kind_prefix. (gfc_diagnostic_build_locus_prefix): Take an expanded_location instead of diagnostic_info. (gfc_diagnostic_build_locus_prefix): Add overload that takes two expanded_location. (gfc_diagnostic_starter): Handle two locations. (gfc_warning_now_at): New. (gfc_diagnostics_init): Initialize caret_chars array. (gfc_diagnostics_finish): Reset caret_chars array to default. gcc/cp/ChangeLog: 2015-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * error.c (cp_diagnostic_starter): Use diagnostic_location function. (cp_print_error_function): Likewise. (cp_printer): Replace locus pointer with accessor function. gcc/c/ChangeLog: 2015-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * c-objc-common.c (c_tree_printer): Replace locus pointer with accessor function. gcc/ChangeLog: 2015-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * tree-pretty-print.c (percent_K_format): Replace locus pointer with accessor function. * tree-diagnostic.c (diagnostic_report_current_function): Use diagnostic_location function. (maybe_unwind_expanded_macro_loc): Likewise. (virt_loc_aware_diagnostic_finalizer): Likewise. (default_tree_printer): Replace locus pointer with accessor function. * diagnostic.c (diagnostic_initialize): Initialize caret_chars array. (diagnostic_set_info_translated): Initialize second location. (diagnostic_build_prefix): Use CARET_LINE_MARGIN. (diagnostic_show_locus): Handle two locations. Call diagnostic_print_caret_line. (diagnostic_print_caret_line): New. (default_diagnostic_starter): Use diagnostic_location function. (diagnostic_report_diagnostic): Use diagnostic_location function. (verbatim): Do not set text.locus. * diagnostic.h (struct diagnostic_info): Remove location field. (struct diagnostic_context): Make caret_chars an array of two. (diagnostic_location): New inline. (diagnostic_expand_location): Handle two locations. (diagnostic_same_line): New inline. (diagnostic_print_caret_line): Declare. (CARET_LINE_MARGIN): New constant. * pretty-print.c (pp_printf): Do not set text.locus. (pp_verbatim): Do not set text.locus. * pretty-print.h (MAX_LOCATIONS_PER_MESSAGE): New constant. (struct text_info): Replace locus pointer with locations array. Add accessor functions. gcc/testsuite/ChangeLog: 2015-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * lib/gfortran-dg.exp: Update regex to handle two locations for the same diagnostic without caret. * gfortran.dg/badline.f: Test also that line numbers are correct before and after "left but not entered" warning. From-SVN: r223237
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/decl.c2
-rw-r--r--gcc/fortran/dependency.c2
-rw-r--r--gcc/fortran/error.c363
-rw-r--r--gcc/fortran/gfortran.h5
-rw-r--r--gcc/fortran/resolve.c6
-rw-r--r--gcc/fortran/scanner.c17
6 files changed, 201 insertions, 194 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 0c15fb9..13002d4 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1126,7 +1126,7 @@ gfc_verify_c_interop_param (gfc_symbol *sym)
either assumed size or explicit shape. Deferred shape is already
covered by the pointer/allocatable attribute. */
if (sym->as != NULL && sym->as->type == AS_ASSUMED_SHAPE
- && !gfc_notify_std_1 (GFC_STD_F2008_TS, "Assumed-shape array '%s' "
+ && !gfc_notify_std (GFC_STD_F2008_TS, "Assumed-shape array %qs "
"at %L as dummy argument to the BIND(C) "
"procedure '%s' at %L", sym->name,
&(sym->declared_at),
diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c
index 63c6630..8b07f59 100644
--- a/gcc/fortran/dependency.c
+++ b/gcc/fortran/dependency.c
@@ -956,7 +956,7 @@ gfc_check_argument_var_dependency (gfc_expr *var, sym_intent intent,
If a dependency is found in the case
elemental == ELEM_CHECK_VARIABLE, we will generate
a temporary, so we don't need to bother the user. */
- gfc_warning_1 ("INTENT(%s) actual argument at %L might "
+ gfc_warning (0, "INTENT(%s) actual argument at %L might "
"interfere with actual argument at %L.",
intent == INTENT_OUT ? "OUT" : "INOUT",
&var->where, &expr->where);
diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index da0eb8f..23308b6 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -807,37 +807,6 @@ gfc_clear_pp_buffer (output_buffer *this_buffer)
}
-/* Issue a warning. */
-/* Use gfc_warning instead, unless two locations are used in the same
- warning or for scanner.c, if the location is not properly set up. */
-
-void
-gfc_warning_1 (const char *gmsgid, ...)
-{
- va_list argp;
-
- if (inhibit_warnings)
- return;
-
- warning_buffer.flag = 1;
- warning_buffer.index = 0;
- cur_error_buffer = &warning_buffer;
-
- va_start (argp, gmsgid);
- error_print (_("Warning:"), _(gmsgid), argp);
- va_end (argp);
-
- error_char ('\0');
-
- if (!buffered_p)
- {
- warnings++;
- if (warnings_are_errors)
- gfc_increment_error_count();
- }
-}
-
-
/* This is just a helper function to avoid duplicating the logic of
gfc_warning. */
@@ -889,9 +858,6 @@ gfc_warning (int opt, const char *gmsgid, va_list ap)
}
/* Issue a warning. */
-/* This function uses the common diagnostics, but does not support
- two locations; when being used in scanner.c, ensure that the location
- is properly setup. Otherwise, use gfc_warning_1. */
bool
gfc_warning (int opt, const char *gmsgid, ...)
@@ -927,84 +893,6 @@ gfc_notification_std (int std)
an error is generated. */
bool
-gfc_notify_std_1 (int std, const char *gmsgid, ...)
-{
- va_list argp;
- bool warning;
- const char *msg1, *msg2;
- char *buffer;
-
- warning = ((gfc_option.warn_std & std) != 0) && !inhibit_warnings;
- if ((gfc_option.allow_std & std) != 0 && !warning)
- return true;
-
- if (suppress_errors)
- return warning ? true : false;
-
- cur_error_buffer = warning ? &warning_buffer : &error_buffer;
- cur_error_buffer->flag = 1;
- cur_error_buffer->index = 0;
-
- if (warning)
- msg1 = _("Warning:");
- else
- msg1 = _("Error:");
-
- switch (std)
- {
- case GFC_STD_F2008_TS:
- msg2 = "TS 29113/TS 18508:";
- break;
- case GFC_STD_F2008_OBS:
- msg2 = _("Fortran 2008 obsolescent feature:");
- break;
- case GFC_STD_F2008:
- msg2 = "Fortran 2008:";
- break;
- case GFC_STD_F2003:
- msg2 = "Fortran 2003:";
- break;
- case GFC_STD_GNU:
- msg2 = _("GNU Extension:");
- break;
- case GFC_STD_LEGACY:
- msg2 = _("Legacy Extension:");
- break;
- case GFC_STD_F95_OBS:
- msg2 = _("Obsolescent feature:");
- break;
- case GFC_STD_F95_DEL:
- msg2 = _("Deleted feature:");
- break;
- default:
- gcc_unreachable ();
- }
-
- buffer = (char *) alloca (strlen (msg1) + strlen (msg2) + 2);
- strcpy (buffer, msg1);
- strcat (buffer, " ");
- strcat (buffer, msg2);
-
- va_start (argp, gmsgid);
- error_print (buffer, _(gmsgid), argp);
- va_end (argp);
-
- error_char ('\0');
-
- if (!buffered_p)
- {
- if (warning && !warnings_are_errors)
- warnings++;
- else
- gfc_increment_error_count();
- cur_error_buffer->flag = 0;
- }
-
- return (warning && !warnings_are_errors) ? true : false;
-}
-
-
-bool
gfc_notify_std (int std, const char *gmsgid, ...)
{
va_list argp;
@@ -1066,35 +954,6 @@ gfc_notify_std (int std, const char *gmsgid, ...)
}
-/* Immediate warning (i.e. do not buffer the warning). */
-/* Use gfc_warning_now instead, unless two locations are used in the same
- warning or for scanner.c, if the location is not properly set up. */
-
-void
-gfc_warning_now_1 (const char *gmsgid, ...)
-{
- va_list argp;
- bool buffered_p_saved;
-
- if (inhibit_warnings)
- return;
-
- buffered_p_saved = buffered_p;
- buffered_p = false;
- warnings++;
-
- va_start (argp, gmsgid);
- error_print (_("Warning:"), _(gmsgid), argp);
- va_end (argp);
-
- error_char ('\0');
-
- if (warnings_are_errors)
- gfc_increment_error_count();
-
- buffered_p = buffered_p_saved;
-}
-
/* Called from output_format -- during diagnostic message processing
to handle Fortran specific format specifiers with the following meanings:
@@ -1112,7 +971,7 @@ gfc_format_decoder (pretty_printer *pp,
case 'C':
case 'L':
{
- static const char *result = "(1)";
+ static const char *result[2] = { "(1)", "(2)" };
locus *loc;
if (*spec == 'C')
loc = &gfc_current_locus;
@@ -1120,13 +979,14 @@ gfc_format_decoder (pretty_printer *pp,
loc = va_arg (*text->args_ptr, locus *);
gcc_assert (loc->nextc - loc->lb->line >= 0);
unsigned int offset = loc->nextc - loc->lb->line;
- gcc_assert (text->locus);
- *text->locus
- = linemap_position_for_loc_and_offset (line_table,
- loc->lb->location,
- offset);
- global_dc->caret_char = '1';
- pp_string (pp, result);
+ /* If location[0] != UNKNOWN_LOCATION means that we already
+ processed one of %C/%L. */
+ int loc_num = text->get_location (0) == UNKNOWN_LOCATION ? 0 : 1;
+ text->set_location (loc_num,
+ linemap_position_for_loc_and_offset (line_table,
+ loc->lb->location,
+ offset));
+ pp_string (pp, result[loc_num]);
return true;
}
default:
@@ -1134,11 +994,11 @@ gfc_format_decoder (pretty_printer *pp,
}
}
-/* Return a malloc'd string describing a location. The caller is
- responsible for freeing the memory. */
+/* Return a malloc'd string describing the kind of diagnostic. The
+ caller is responsible for freeing the memory. */
static char *
-gfc_diagnostic_build_prefix (diagnostic_context *context,
- const diagnostic_info *diagnostic)
+gfc_diagnostic_build_kind_prefix (diagnostic_context *context,
+ const diagnostic_info *diagnostic)
{
static const char *const diagnostic_kind_text[] = {
#define DEFINE_DIAGNOSTIC_KIND(K, T, C) (T),
@@ -1170,12 +1030,11 @@ gfc_diagnostic_build_prefix (diagnostic_context *context,
responsible for freeing the memory. */
static char *
gfc_diagnostic_build_locus_prefix (diagnostic_context *context,
- const diagnostic_info *diagnostic)
+ expanded_location s)
{
pretty_printer *pp = context->printer;
const char *locus_cs = colorize_start (pp_show_color (pp), "locus");
const char *locus_ce = colorize_stop (pp_show_color (pp));
- expanded_location s = diagnostic_expand_location (diagnostic);
return (s.file == NULL
? build_message_string ("%s%s:%s", locus_cs, progname, locus_ce )
: !strcmp (s.file, N_("<built-in>"))
@@ -1186,35 +1045,160 @@ gfc_diagnostic_build_locus_prefix (diagnostic_context *context,
: build_message_string ("%s%s:%d:%s", locus_cs, s.file, s.line, locus_ce));
}
-static void
+/* Return a malloc'd string describing two locations. The caller is
+ responsible for freeing the memory. */
+static char *
+gfc_diagnostic_build_locus_prefix (diagnostic_context *context,
+ expanded_location s, expanded_location s2)
+{
+ pretty_printer *pp = context->printer;
+ const char *locus_cs = colorize_start (pp_show_color (pp), "locus");
+ const char *locus_ce = colorize_stop (pp_show_color (pp));
+
+ return (s.file == NULL
+ ? 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)
+ : context->show_column
+ ? build_message_string ("%s%s:%d:%d-%d:%s", locus_cs, s.file, s.line,
+ MIN (s.column, s2.column),
+ MAX (s.column, s2.column), locus_ce)
+ : build_message_string ("%s%s:%d:%s", locus_cs, s.file, s.line,
+ locus_ce));
+}
+
+/* This function prints the locus (file:line:column), the diagnostic kind
+ (Error, Warning) and (optionally) the caret line (a source line
+ with '1' and/or '2' below it).
+
+ With -fdiagnostic-show-caret (the default) and for valid locations,
+ it prints for one location:
+
+ [locus]:
+
+ some code
+ 1
+ Error: Some error at (1)
+
+ for two locations that fit in the same locus line:
+
+ [locus]:
+
+ some code and some more code
+ 1 2
+ Error: Some error at (1) and (2)
+
+ and for two locations that do not fit in the same locus line:
+
+ [locus]:
+
+ some code
+ 1
+ [locus2]:
+
+ some other code
+ 2
+ Error: Some error at (1) and (2)
+
+ With -fno-diagnostic-show-caret or if one of the locations is not
+ valid, it prints for one location (or for two locations that fit in
+ the same locus line):
+
+ [locus]: Error: Some error at (1) and (2)
+
+ and for two locations that do not fit in the same locus line:
+
+ [name]:[locus]: Error: (1)
+ [name]:[locus2]: Error: Some error at (1) and (2)
+*/
+static void
gfc_diagnostic_starter (diagnostic_context *context,
diagnostic_info *diagnostic)
{
- char * locus_prefix = gfc_diagnostic_build_locus_prefix (context, diagnostic);
- char * prefix = gfc_diagnostic_build_prefix (context, diagnostic);
- /* First we assume there is a caret line. */
- pp_set_prefix (context->printer, NULL);
- if (pp_needs_newline (context->printer))
- pp_newline (context->printer);
- pp_verbatim (context->printer, locus_prefix);
- /* Fortran uses an empty line between locus and caret line. */
- pp_newline (context->printer);
- diagnostic_show_locus (context, diagnostic);
- if (pp_needs_newline (context->printer))
+ char * kind_prefix = gfc_diagnostic_build_kind_prefix (context, diagnostic);
+
+ expanded_location s1 = diagnostic_expand_location (diagnostic);
+ expanded_location s2;
+ bool one_locus = diagnostic_location (diagnostic, 1) == UNKNOWN_LOCATION;
+ bool same_locus = false;
+
+ if (!one_locus)
+ {
+ s2 = diagnostic_expand_location (diagnostic, 1);
+ same_locus = diagnostic_same_line (context, s1, s2);
+ }
+
+ char * locus_prefix = (one_locus || !same_locus)
+ ? gfc_diagnostic_build_locus_prefix (context, s1)
+ : gfc_diagnostic_build_locus_prefix (context, s1, s2);
+
+ if (!context->show_caret
+ || diagnostic_location (diagnostic, 0) <= BUILTINS_LOCATION
+ || diagnostic_location (diagnostic, 0) == context->last_location)
+ {
+ pp_set_prefix (context->printer,
+ concat (locus_prefix, " ", kind_prefix, NULL));
+ free (locus_prefix);
+
+ if (one_locus || same_locus)
+ {
+ free (kind_prefix);
+ return;
+ }
+ /* In this case, we print the previous locus and prefix as:
+
+ [locus]:[prefix]: (1)
+
+ and we flush with a new line before setting the new prefix. */
+ pp_string (context->printer, "(1)");
+ pp_newline (context->printer);
+ locus_prefix = gfc_diagnostic_build_locus_prefix (context, s2);
+ pp_set_prefix (context->printer,
+ concat (locus_prefix, " ", kind_prefix, NULL));
+ free (kind_prefix);
+ free (locus_prefix);
+ }
+ else
{
+ pp_verbatim (context->printer, locus_prefix);
+ free (locus_prefix);
+ /* Fortran uses an empty line between locus and caret line. */
+ pp_newline (context->printer);
+ diagnostic_show_locus (context, diagnostic);
pp_newline (context->printer);
/* If the caret line was shown, the prefix does not contain the
locus. */
- pp_set_prefix (context->printer, prefix);
- }
- else
- {
- /* Otherwise, start again. */
- pp_clear_output_area(context->printer);
- pp_set_prefix (context->printer, concat (locus_prefix, " ", prefix, NULL));
- free (prefix);
+ pp_set_prefix (context->printer, kind_prefix);
+
+ if (one_locus || same_locus)
+ return;
+
+ locus_prefix = gfc_diagnostic_build_locus_prefix (context, s2);
+ if (diagnostic_location (diagnostic, 1) <= BUILTINS_LOCATION)
+ {
+ /* No caret line for the second location. Override the previous
+ prefix with [locus2]:[prefix]. */
+ pp_set_prefix (context->printer,
+ concat (locus_prefix, " ", kind_prefix, NULL));
+ free (kind_prefix);
+ free (locus_prefix);
+ }
+ else
+ {
+ /* We print the caret for the second location. */
+ pp_verbatim (context->printer, locus_prefix);
+ free (locus_prefix);
+ /* Fortran uses an empty line between locus and caret line. */
+ pp_newline (context->printer);
+ s1.column = 0; /* Print only a caret line for s2. */
+ diagnostic_print_caret_line (context, s2, s1,
+ context->caret_chars[1], '\0');
+ pp_newline (context->printer);
+ /* If the caret line was shown, the prefix does not contain the
+ locus. */
+ pp_set_prefix (context->printer, kind_prefix);
+ }
}
- free (locus_prefix);
}
static void
@@ -1225,10 +1209,25 @@ gfc_diagnostic_finalizer (diagnostic_context *context,
pp_newline_and_flush (context->printer);
}
+/* Immediate warning (i.e. do not buffer the warning) with an explicit
+ location. */
+
+bool
+gfc_warning_now_at (location_t loc, int opt, const char *gmsgid, ...)
+{
+ va_list argp;
+ diagnostic_info diagnostic;
+ bool ret;
+
+ va_start (argp, gmsgid);
+ diagnostic_set_info (&diagnostic, gmsgid, &argp, loc, DK_WARNING);
+ diagnostic.option_index = opt;
+ ret = report_diagnostic (&diagnostic);
+ va_end (argp);
+ return ret;
+}
+
/* Immediate warning (i.e. do not buffer the warning). */
-/* This function uses the common diagnostics, but does not support
- two locations; when being used in scanner.c, ensure that the location
- is properly setup. Otherwise, use gfc_warning_now_1. */
bool
gfc_warning_now (int opt, const char *gmsgid, ...)
@@ -1639,7 +1638,8 @@ gfc_diagnostics_init (void)
diagnostic_starter (global_dc) = gfc_diagnostic_starter;
diagnostic_finalizer (global_dc) = gfc_diagnostic_finalizer;
diagnostic_format_decoder (global_dc) = gfc_format_decoder;
- global_dc->caret_char = '^';
+ global_dc->caret_chars[0] = '1';
+ global_dc->caret_chars[1] = '2';
pp_warning_buffer = new (XNEW (output_buffer)) output_buffer ();
pp_warning_buffer->flush_p = false;
pp_error_buffer = new (XNEW (output_buffer)) output_buffer ();
@@ -1654,5 +1654,6 @@ gfc_diagnostics_finish (void)
defaults. */
diagnostic_starter (global_dc) = gfc_diagnostic_starter;
diagnostic_finalizer (global_dc) = gfc_diagnostic_finalizer;
- global_dc->caret_char = '^';
+ global_dc->caret_chars[0] = '^';
+ global_dc->caret_chars[1] = '^';
}
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 514e93f..aaa4e89 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -2660,10 +2660,10 @@ void gfc_buffer_error (bool);
const char *gfc_print_wide_char (gfc_char_t);
-void gfc_warning_1 (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
bool gfc_warning (int opt, const char *, ...) ATTRIBUTE_GCC_GFC(2,3);
-void gfc_warning_now_1 (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
bool gfc_warning_now (int opt, const char *, ...) ATTRIBUTE_GCC_GFC(2,3);
+bool gfc_warning_now_at (location_t loc, int opt, const char *gmsgid, ...)
+ ATTRIBUTE_GCC_GFC(3,4);
void gfc_clear_warning (void);
void gfc_warning_check (void);
@@ -2679,7 +2679,6 @@ bool gfc_error_check (void);
bool gfc_error_flag_test (void);
notification gfc_notification_std (int);
-bool gfc_notify_std_1 (int, const char *, ...) ATTRIBUTE_GCC_GFC(2,3);
bool gfc_notify_std (int, const char *, ...) ATTRIBUTE_GCC_GFC(2,3);
/* A general purpose syntax error. */
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 316b413..fbf260f 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -8779,7 +8779,7 @@ resolve_branch (gfc_st_label *label, gfc_code *code)
/* The label is not in an enclosing block, so illegal. This was
allowed in Fortran 66, so we allow it as extension. No
further checks are necessary in this case. */
- gfc_notify_std_1 (GFC_STD_LEGACY, "Label at %L is not in the same block "
+ gfc_notify_std (GFC_STD_LEGACY, "Label at %L is not in the same block "
"as the GOTO statement at %L", &label->where,
&code->loc);
return;
@@ -12920,8 +12920,8 @@ resolve_fl_derived (gfc_symbol *sym)
if (gen_dt && gen_dt->generic && gen_dt->generic->next
&& (!gen_dt->generic->sym->attr.use_assoc
|| gen_dt->generic->sym->module != gen_dt->generic->next->sym->module)
- && !gfc_notify_std_1 (GFC_STD_F2003, "Generic name '%s' of function "
- "'%s' at %L being the same name as derived "
+ && !gfc_notify_std (GFC_STD_F2003, "Generic name %qs of function "
+ "%qs at %L being the same name as derived "
"type at %L", sym->name,
gen_dt->generic->sym == sym
? gen_dt->generic->next->sym->name
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index f0e6404..55b3625 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -2014,9 +2014,13 @@ preprocessor_line (gfc_char_t *c)
if (!current_file->up
|| filename_cmp (current_file->up->filename, filename) != 0)
{
- gfc_warning_now_1 ("%s:%d: file %s left but not entered",
- current_file->filename, current_file->line,
- filename);
+ linemap_line_start (line_table, current_file->line, 80);
+ /* ??? One could compute the exact column where the filename
+ starts and compute the exact location here. */
+ gfc_warning_now_at (linemap_position_for_column (line_table, 1),
+ 0, "file %qs left but not entered",
+ filename);
+ current_file->line++;
if (unescape)
free (wide_filename);
free (filename);
@@ -2048,8 +2052,11 @@ preprocessor_line (gfc_char_t *c)
return;
bad_cpp_line:
- gfc_warning_now_1 ("%s:%d: Illegal preprocessor directive",
- current_file->filename, current_file->line);
+ linemap_line_start (line_table, current_file->line, 80);
+ /* ??? One could compute the exact column where the directive
+ starts and compute the exact location here. */
+ gfc_warning_now_at (linemap_position_for_column (line_table, 2), 0,
+ "Illegal preprocessor directive");
current_file->line++;
}