Commit 981e3997 by Tobias Burnus

[Fortran] Fix column of %C diagnostic location

        gcc/fortran/
        * error (error_print, gfc_format_decoder): Fix off-by one issue with %C.

        gcc/testsuite/
        * gfortran.dg/use_without_only_1.f90: Update column num in dg-warning.

From-SVN: r276567
parent 48528394
2019-10-04 Tobias Burnus <tobias@codesourcery.com>
* error (error_print, gfc_format_decoder): Fix off-by one issue with %C.
2019-10-03 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91497
......@@ -54,7 +58,7 @@
messages instead of the original call to gfc_typename.
* misc.c (gfc_typename): New function for gfc_expr *, use for where
character types are possible it can get the character length from
gfc_expr for character literals.
gfc_expr for character literals.
(gfc_dummy_typename): New functionfor gfc_typespec *, if no character
length is present the character type is assumed and the appropriate
string is return otherwise it calls gfc_typename for gfc_typespec *.
......@@ -88,10 +92,10 @@
a subroutine reference.
* resolve.c (resolve_function): BOZ cannot be an actual argument in
a function reference.
2019-10-01 Jan Hubicka <jh@suse.cz>
* module.c (load_commons): Initialize flags to 0 to silecne
* module.c (load_commons): Initialize flags to 0 to silence
-Wmaybe-uninitialized warning.
(read_module): Likewise for n and comp_name.
......
......@@ -618,12 +618,18 @@ error_print (const char *type, const char *format0, va_list argp)
{
l2 = loc;
arg[pos].u.stringval = "(2)";
/* Point %C first offending character not the last good one. */
if (arg[pos].type == TYPE_CURRENTLOC)
l2->nextc++;
}
else
{
l1 = loc;
have_l1 = 1;
arg[pos].u.stringval = "(1)";
/* Point %C first offending character not the last good one. */
if (arg[pos].type == TYPE_CURRENTLOC)
l1->nextc++;
}
break;
......@@ -963,6 +969,9 @@ gfc_format_decoder (pretty_printer *pp, text_info *text, const char *spec,
loc = va_arg (*text->args_ptr, locus *);
gcc_assert (loc->nextc - loc->lb->line >= 0);
unsigned int offset = loc->nextc - loc->lb->line;
if (*spec == 'C')
/* Point %C first offending character not the last good one. */
offset++;
/* 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;
......@@ -1401,7 +1410,7 @@ gfc_internal_error (const char *gmsgid, ...)
void
gfc_clear_error (void)
{
error_buffer.flag = 0;
error_buffer.flag = false;
warnings_not_errors = false;
gfc_clear_pp_buffer (pp_error_buffer);
}
......
2019-10-04 Tobias Burnus <tobias@codesourcery.com>
* gfortran.dg/use_without_only_1.f90: Update column num in dg-warning.
2019-10-04 Jakub Jelinek <jakub@redhat.com>
PR c++/71504
......
......@@ -6,16 +6,16 @@ MODULE foo
END MODULE
MODULE testmod
USE foo ! { dg-warning "6:has no ONLY qualifier" }
USE foo ! { dg-warning "7:has no ONLY qualifier" }
IMPLICIT NONE
CONTAINS
SUBROUTINE S1
USE foo ! { dg-warning "9:has no ONLY qualifier" }
USE foo ! { dg-warning "10:has no ONLY qualifier" }
END SUBROUTINE S1
SUBROUTINE S2
USE foo, ONLY: bar
END SUBROUTINE
SUBROUTINE S3
USE ISO_C_BINDING ! { dg-warning "9:has no ONLY qualifier" }
USE ISO_C_BINDING ! { dg-warning "10:has no ONLY qualifier" }
END SUBROUTINE S3
END MODULE
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