summaryrefslogtreecommitdiff
path: root/gcc/fortran/error.c
diff options
context:
space:
mode:
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-23 23:47:42 +0000
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-23 23:47:42 +0000
commitfed21cc2fd6c90fab465bce9f4e771669a68d470 (patch)
treef611b28dd269fb7e389fd5408fb94d4f9fe5416f /gcc/fortran/error.c
parentbd35ba528ac0064eb863c629aa0cb30e10ef0327 (diff)
gcc/fortran/ChangeLog:
2014-11-23 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * decl.c (gfc_verify_c_interop_param): Use gfc_error_now_2. (gfc_set_constant_character_len): Use gfc_warning_now_2. * resolve.c (resolve_ordinary_assign): Likewise. * gfortran.h (warn_character_truncation): Do not declare here. * error.c (gfc_format_decoder): Handle %L. * lang.opt (Wcharacter-truncation): Add Var and LangEnabledBy. * options.c (gfc_init_options): Do not handle warn_character_truncation explicitly. (set_Wall): Likewise. (gfc_handle_option): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217992 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/error.c')
-rw-r--r--gcc/fortran/error.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index 0f85b496ecf8..471e0ecc8606 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -964,6 +964,7 @@ gfc_warning_now (const char *gmsgid, ...)
to handle Fortran specific format specifiers with the following meanings:
%C Current locus (no argument)
+ %L Takes locus argument
*/
static bool
gfc_format_decoder (pretty_printer *pp,
@@ -974,15 +975,21 @@ gfc_format_decoder (pretty_printer *pp,
switch (*spec)
{
case 'C':
+ case 'L':
{
static const char *result = "(1)";
- gcc_assert (gfc_current_locus.nextc - gfc_current_locus.lb->line >= 0);
- unsigned int c1 = gfc_current_locus.nextc - gfc_current_locus.lb->line;
+ locus *loc;
+ if (*spec == 'C')
+ loc = &gfc_current_locus;
+ else
+ 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,
- gfc_current_locus.lb->location,
- c1);
+ loc->lb->location,
+ offset);
global_dc->caret_char = '1';
pp_string (pp, result);
return true;