aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-05-08 08:43:16 -0700
committerNathan Sidwell <nathan@acm.org>2020-05-08 08:47:13 -0700
commitdebfaee5d51e3c07bb88a971618de2baff35d9c0 (patch)
tree2235ab59ddd814c6f88ce14e1d6e112636fc1a6d /gcc/cp/parser.c
parente34495985e49545c468e664ee10bd0e66c7395bf (diff)
downloadgcc-debfaee5d51e3c07bb88a971618de2baff35d9c0.zip
gcc-debfaee5d51e3c07bb88a971618de2baff35d9c0.tar.gz
gcc-debfaee5d51e3c07bb88a971618de2baff35d9c0.tar.bz2
EOF has a location
There's no need to special-case EOF's location. For the complete file we give it a legitimate location. And for deferred parses we now zap a temporary EOF onto the next token, so we can just use its location anyway. gcc/cp/ * parser.c (cp_lexer_set_source_position_from_token): EOF has a location too. gcc/testsuite/ * c-c++-common/raw-string-6.c: Adjust EOF error location. * g++.dg/cpp0x/decltype63.C: Likewise. * g++.dg/cpp0x/gen-attrs-64.C: Likewise. * g++.dg/cpp0x/pr68726.C: Likewise. * g++.dg/cpp0x/pr78341.C: Likewise. * g++.dg/cpp1y/pr65202.C: Likewise. * g++.dg/cpp1z/class-deduction44.C: Likewise. * g++.dg/diagnostic/unclosed-extern-c.C: Likewise. * g++.dg/diagnostic/unclosed-function.C: Likewise. * g++.dg/diagnostic/unclosed-namespace.C: Likewise. * g++.dg/diagnostic/unclosed-struct.C: Likewise. * g++.dg/ext/pr84598.C: Likewise. * g++.dg/other/switch4.C: Likewise. * g++.dg/parse/crash10.C: Likewise. * g++.dg/parse/crash18.C: Likewise. * g++.dg/parse/crash35.C: Likewise. * g++.dg/parse/crash59.C: Likewise. * g++.dg/parse/crash61.C: Likewise. * g++.dg/parse/crash67.C: Likewise. * g++.dg/parse/ctor3.C: Likewise. * g++.dg/parse/error14.C: Likewise. * g++.dg/parse/error5.C: Likewise. * g++.dg/parse/error56.C: Likewise. * g++.dg/parse/invalid1.C: Likewise. * g++.dg/parse/parameter-declaration-1.C: Likewise. * g++.dg/parse/parser-pr28152-2.C: Likewise. * g++.dg/parse/parser-pr28152.C: Likewise. * g++.dg/parse/pr68722.C: Likewise. * g++.dg/pr46852.C: Likewise. * g++.dg/pr46868.C: Likewise. * g++.dg/template/crash115.C: Likewise. * g++.dg/template/crash43.C: Likewise. * g++.dg/template/error-recovery1.C: Likewise. * g++.dg/template/error57.C: Likewise. * g++.old-deja/g++.other/crash31.C: Likewise.
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index d67fa3b..591f44f 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -895,10 +895,7 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token)
static inline void
cp_lexer_set_source_position_from_token (cp_token *token)
{
- if (token->type != CPP_EOF)
- {
- input_location = token->location;
- }
+ input_location = token->location;
}
/* Update the globals input_location and the input file stack from LEXER. */