aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppmacro.c
diff options
context:
space:
mode:
authorNeil Booth <neilb@earthling.net>2000-10-29 11:37:18 +0000
committerNeil Booth <neil@gcc.gnu.org>2000-10-29 11:37:18 +0000
commit44ed91a1d664478bb2f6f2e277988908ce3675a5 (patch)
treec48aad594f9cc3ca2781664e65c553c6fb3277cb /gcc/cppmacro.c
parent3542203b30a788180f69c3298227c97eeefec03d (diff)
downloadgcc-44ed91a1d664478bb2f6f2e277988908ce3675a5.zip
gcc-44ed91a1d664478bb2f6f2e277988908ce3675a5.tar.gz
gcc-44ed91a1d664478bb2f6f2e277988908ce3675a5.tar.bz2
cppmacro.c (_cpp_create_definition): Optimize the case of a macro defined to itself.
* cppmacro.c (_cpp_create_definition): Optimize the case of a macro defined to itself. From-SVN: r37123
Diffstat (limited to 'gcc/cppmacro.c')
-rw-r--r--gcc/cppmacro.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c
index 58d3020..35e66f4 100644
--- a/gcc/cppmacro.c
+++ b/gcc/cppmacro.c
@@ -1403,7 +1403,6 @@ _cpp_create_definition (pfile, node)
macro->paramc = 0;
macro->fun_like = 0;
macro->var_args = 0;
- macro->disabled = 0;
macro->count = 0;
macro->expansion = (cpp_token *) POOL_FRONT (&pfile->macro_pool);
@@ -1485,6 +1484,11 @@ _cpp_create_definition (pfile, node)
/* Clear the whitespace flag from the leading token. */
macro->expansion[0].flags &= ~PREV_WHITE;
+ /* Implement the macro-defined-to-itself optimisation. */
+ macro->disabled = (macro->count == 1 && !macro->fun_like
+ && macro->expansion[0].type == CPP_NAME
+ && macro->expansion[0].val.node == node);
+
/* Commit the memory. */
POOL_COMMIT (&pfile->macro_pool, macro->count * sizeof (cpp_token));