diff options
author | Mark Wielaard <mark@klomp.org> | 2021-07-29 00:00:55 +0200 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-08-11 10:31:10 +0100 |
commit | 02424cf671eeee25ca371d17eef4a65c71de8eee (patch) | |
tree | ba6ff3a0b5287855dab4347726cf27d0061912c1 /gcc/omp-general.c | |
parent | e10f3d65566101c774a308f8286e2827455941ed (diff) | |
download | gcc-02424cf671eeee25ca371d17eef4a65c71de8eee.zip gcc-02424cf671eeee25ca371d17eef4a65c71de8eee.tar.gz gcc-02424cf671eeee25ca371d17eef4a65c71de8eee.tar.bz2 |
Pass pratt parsed location to expr parser functions to fix expr locus
The pratt parser skips the first token of an expression before
invoking the actual expression parsing function. This makes getting
the correct starting location of a pratt parsed expression hard. The
"correction" of the location by subtracting an integer is often wrong
(since there may be arbitrary whitespace or comments between
tokens). Fix this by passing the location of the skipped token to the
expression parsing functions (instead of just providing a pratt_parse
boolean). Use this location to set the start of the expression (and as
indicator to not try to parse the first token of the expression).
Before gccrs would generate the following error message:
return.rs:3:22: error: cannot ‘break’ outside of a loop
3 | let x = 5 - break return (16 + 2);
| ^~~~~~~~~~~~~~~~~
Now we get:
return.rs:3:17: error: cannot ‘break’ outside of a loop
3 | let x = 5 - break return (16 + 2);
| ^
Diffstat (limited to 'gcc/omp-general.c')
0 files changed, 0 insertions, 0 deletions