aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppexp.c
diff options
context:
space:
mode:
authorNeil Booth <neil@cat.daikokuya.demon.co.uk>2001-11-05 22:26:13 +0000
committerNeil Booth <neil@gcc.gnu.org>2001-11-05 22:26:13 +0000
commit63d7500569483951597d95d6cf477e4526114013 (patch)
treef0c6212de4e1011133e309e692cd9ad0e138101c /gcc/cppexp.c
parenta5356269d3d2f8c1a48184c27fdfc052934ae0c4 (diff)
downloadgcc-63d7500569483951597d95d6cf477e4526114013.zip
gcc-63d7500569483951597d95d6cf477e4526114013.tar.gz
gcc-63d7500569483951597d95d6cf477e4526114013.tar.bz2
cppexp.c (lex, [...]): Update warning about defined.
* cppexp.c (lex, parse_defined): Update warning about defined. * gcc.dg/cpp/defined.c: Update. From-SVN: r46794
Diffstat (limited to 'gcc/cppexp.c')
-rw-r--r--gcc/cppexp.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
index c7a00da..ac222ee 100644
--- a/gcc/cppexp.c
+++ b/gcc/cppexp.c
@@ -219,6 +219,7 @@ parse_defined (pfile)
cpp_hashnode *node = 0;
const cpp_token *token;
struct op op;
+ cpp_context *initial_context = pfile->context;
/* Don't expand macros. */
pfile->state.prevent_expansion++;
@@ -259,6 +260,9 @@ parse_defined (pfile)
op.op = CPP_ERROR;
else
{
+ if (pfile->context != initial_context)
+ cpp_warning (pfile, "this use of \"defined\" may not be portable");
+
op.value = node->type == NT_MACRO;
op.unsignedp = 0;
op.op = CPP_NUMBER;
@@ -314,12 +318,7 @@ lex (pfile, skip_evaluation)
case CPP_NAME:
if (token->val.node == pfile->spec_nodes.n_defined)
- {
- if (pfile->context->prev && CPP_PEDANTIC (pfile))
- cpp_pedwarn (pfile, "\"defined\" operator appears during macro expansion");
-
- return parse_defined (pfile);
- }
+ return parse_defined (pfile);
else if (CPP_OPTION (pfile, cplusplus)
&& (token->val.node == pfile->spec_nodes.n_true
|| token->val.node == pfile->spec_nodes.n_false))