aboutsummaryrefslogtreecommitdiff
path: root/libcpp/expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp/expr.c')
-rw-r--r--libcpp/expr.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libcpp/expr.c b/libcpp/expr.c
index b98c038..2ba7726 100644
--- a/libcpp/expr.c
+++ b/libcpp/expr.c
@@ -1068,6 +1068,7 @@ parse_defined (cpp_reader *pfile)
}
}
+ bool is_defined = false;
if (node)
{
if ((pfile->context != initial_context
@@ -1075,9 +1076,11 @@ parse_defined (cpp_reader *pfile)
&& CPP_OPTION (pfile, warn_expansion_to_defined))
cpp_pedwarning (pfile, CPP_W_EXPANSION_TO_DEFINED,
"this use of \"defined\" may not be portable");
-
+ is_defined = _cpp_defined_macro_p (node);
+ if (!_cpp_maybe_notify_macro_use (pfile, node, token->src_loc))
+ /* It wasn't a macro after all. */
+ is_defined = false;
_cpp_mark_macro_used (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. */
@@ -1093,7 +1096,7 @@ parse_defined (cpp_reader *pfile)
result.unsignedp = false;
result.high = 0;
result.overflow = false;
- result.low = node && _cpp_defined_macro_p (node);
+ result.low = is_defined;
return result;
}