aboutsummaryrefslogtreecommitdiff
path: root/libcpp/expr.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-11-02 08:29:58 -0800
committerNathan Sidwell <nathan@acm.org>2020-11-02 08:56:38 -0800
commite9a2e208dd763bf71b0cc9db8526ef8f47ee289e (patch)
tree0d5f2dd77fcc92b927b3b4bbfb97f8cac4cb9a92 /libcpp/expr.c
parent1c689b827c6a0a5e164f22865696a94e6d7ec308 (diff)
downloadgcc-e9a2e208dd763bf71b0cc9db8526ef8f47ee289e.zip
gcc-e9a2e208dd763bf71b0cc9db8526ef8f47ee289e.tar.gz
gcc-e9a2e208dd763bf71b0cc9db8526ef8f47ee289e.tar.bz2
cpplib: Macro use location and comparison
Our macro use hook passes a location, but doesn't recieve it from the using location. This patch adds the extra location_t parameter and passes it though. A second cleanup is breaking out the macro comparison code from the redefinition warning. That;ll turn out useful for modules. Finally, there's a filename comparison needed for the location optimization of rewinding from line 2 (occurs during the emission of builtin macros). libcpp/ * internal.h (_cpp_notify_macro_use): Add location parm. (_cpp_maybe_notify_macro_use): Likewise. * directives.c (_cpp_do_file_change): Check we've not changed file when optimizing a rewind. (do_ifdef): Pass location to _cpp_maybe_notify_macro_use. (do_ifndef): Likewise. Delete obsolete comment about powerpc. * expr.c (parse_defined): Pass location to _cpp_maybe_notify_macro_use. * macro.c (enter_macro_context): Likewise. (warn_of_redefinition): Break out helper function. Call it. (compare_macros): New function broken out of warn_of_redefinition. (_cpp_new_macro): Zero all fields. (_cpp_notify_macro_use): Add location parameter.
Diffstat (limited to 'libcpp/expr.c')
-rw-r--r--libcpp/expr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libcpp/expr.c b/libcpp/expr.c
index 2ae9be0..e01a47a 100644
--- a/libcpp/expr.c
+++ b/libcpp/expr.c
@@ -1070,7 +1070,7 @@ parse_defined (cpp_reader *pfile)
"this use of \"defined\" may not be portable");
_cpp_mark_macro_used (node);
- _cpp_maybe_notify_macro_use (pfile, node);
+ _cpp_maybe_notify_macro_use (pfile, node, token->src_loc);
/* A possible controlling macro of the form #if !defined ().
_cpp_parse_expr checks there was no other junk on the line. */