diff options
author | Richard Henderson <rth@redhat.com> | 2004-08-26 17:27:24 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2004-08-26 17:27:24 -0700 |
commit | 525c6bf5a6b91fa09f57b79bad9737ab3733601d (patch) | |
tree | 1e34e5e9ca494cf80b9eeedaeeb9ab699cb921c7 /gcc/tree.c | |
parent | 81d1fb087780b62dbbb3994dfeeb93f76a9773cc (diff) | |
download | gcc-525c6bf5a6b91fa09f57b79bad9737ab3733601d.zip gcc-525c6bf5a6b91fa09f57b79bad9737ab3733601d.tar.gz gcc-525c6bf5a6b91fa09f57b79bad9737ab3733601d.tar.bz2 |
tree.c (staticp): Return the static object.
* tree.c (staticp): Return the static object.
* tree.h (staticp): Update decl.
* langhooks.h (struct lang_hooks): Change staticp return type to tree.
* langhooks.c (lhd_staticp): Return NULL_TREE.
* langhooks-def.h (lhd_staticp): Update decl.
* c-common.c (c_staticp): Return the static object.
* c-common.h (c_staticp): Update decl.
From-SVN: r86650
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 25 |
1 files changed, 11 insertions, 14 deletions
@@ -1366,7 +1366,7 @@ array_type_nelts (tree type) /* Return true if arg is static -- a reference to an object in static storage. This is not the same as the C meaning of `static'. */ -bool +tree staticp (tree arg) { switch (TREE_CODE (arg)) @@ -1375,19 +1375,21 @@ staticp (tree arg) /* Nested functions aren't static, since taking their address involves a trampoline. */ return ((decl_function_context (arg) == 0 || DECL_NO_STATIC_CHAIN (arg)) - && ! DECL_NON_ADDR_CONST_P (arg)); + && ! DECL_NON_ADDR_CONST_P (arg) + ? arg : NULL); case VAR_DECL: return ((TREE_STATIC (arg) || DECL_EXTERNAL (arg)) && ! DECL_THREAD_LOCAL (arg) - && ! DECL_NON_ADDR_CONST_P (arg)); + && ! DECL_NON_ADDR_CONST_P (arg) + ? arg : NULL); case CONSTRUCTOR: - return TREE_STATIC (arg); + return TREE_STATIC (arg) ? arg : NULL; case LABEL_DECL: case STRING_CST: - return true; + return arg; case COMPONENT_REF: /* If the thing being referenced is not a field, then it is @@ -1398,20 +1400,15 @@ staticp (tree arg) /* If we are referencing a bitfield, we can't evaluate an ADDR_EXPR at compile time and so it isn't a constant. */ if (DECL_BIT_FIELD (TREE_OPERAND (arg, 1))) - return false; + return NULL; return staticp (TREE_OPERAND (arg, 0)); case BIT_FIELD_REF: - return false; + return NULL; -#if 0 - /* This case is technically correct, but results in setting - TREE_CONSTANT on ADDR_EXPRs that cannot be evaluated at - compile time. */ case INDIRECT_REF: - return TREE_CONSTANT (TREE_OPERAND (arg, 0)); -#endif + return TREE_CONSTANT (TREE_OPERAND (arg, 0)) ? arg : NULL; case ARRAY_REF: case ARRAY_RANGE_REF: @@ -1426,7 +1423,7 @@ staticp (tree arg) >= (unsigned int) LAST_AND_UNUSED_TREE_CODE) return lang_hooks.staticp (arg); else - return false; + return NULL; } } |