aboutsummaryrefslogtreecommitdiff
path: root/libcpp/directives.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp/directives.c')
-rw-r--r--libcpp/directives.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libcpp/directives.c b/libcpp/directives.c
index bffdc91..fa66b5c 100644
--- a/libcpp/directives.c
+++ b/libcpp/directives.c
@@ -667,7 +667,8 @@ do_undef (cpp_reader *pfile)
pfile->directive_line, 0,
"undefining \"%s\"", NODE_NAME (node));
- if (CPP_OPTION (pfile, warn_unused_macros))
+ if (node->value.macro
+ && CPP_OPTION (pfile, warn_unused_macros))
_cpp_warn_if_unused_macro (pfile, node, NULL);
_cpp_free_definition (node);
@@ -1981,8 +1982,10 @@ do_ifdef (cpp_reader *pfile)
if (node)
{
skip = !_cpp_defined_macro_p (node);
+ if (!_cpp_maybe_notify_macro_use (pfile, node, pfile->directive_line))
+ /* It wasn't a macro after all. */
+ skip = true;
_cpp_mark_macro_used (node);
- _cpp_maybe_notify_macro_use (pfile, node, pfile->directive_line);
if (pfile->cb.used)
pfile->cb.used (pfile, pfile->directive_line, node);
check_eol (pfile, false);
@@ -2006,8 +2009,10 @@ do_ifndef (cpp_reader *pfile)
if (node)
{
skip = _cpp_defined_macro_p (node);
+ if (!_cpp_maybe_notify_macro_use (pfile, node, pfile->directive_line))
+ /* It wasn't a macro after all. */
+ skip = false;
_cpp_mark_macro_used (node);
- _cpp_maybe_notify_macro_use (pfile, node, pfile->directive_line);
if (pfile->cb.used)
pfile->cb.used (pfile, pfile->directive_line, node);
check_eol (pfile, false);