diff options
author | Marek Polacek <polacek@redhat.com> | 2015-05-20 10:10:07 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2015-05-20 10:10:07 +0000 |
commit | 21b634ae9bc1c800784c7b009706477a9f49c1fb (patch) | |
tree | ab37dc96be2c4a9dc3538a81822d6d0a42cdd9b3 /gcc/c-family | |
parent | 42242005dcaeda1b553cd877358abeae032c5b2d (diff) | |
download | gcc-21b634ae9bc1c800784c7b009706477a9f49c1fb.zip gcc-21b634ae9bc1c800784c7b009706477a9f49c1fb.tar.gz gcc-21b634ae9bc1c800784c7b009706477a9f49c1fb.tar.bz2 |
c-pragma.c: Use VAR_OR_FUNCTION_DECL_P throughout.
* c-pragma.c: Use VAR_OR_FUNCTION_DECL_P throughout.
* c-common.c: Likewise.
* c-decl.c: Use VAR_OR_FUNCTION_DECL_P throughout.
* c-typeck.c: Likewise.
From-SVN: r223437
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c-family/c-common.c | 20 | ||||
-rw-r--r-- | gcc/c-family/c-pragma.c | 7 |
3 files changed, 16 insertions, 16 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 695bfee..fba79aa 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2015-05-20 Marek Polacek <polacek@redhat.com> + + * c-pragma.c: Use VAR_OR_FUNCTION_DECL_P throughout. + * c-common.c: Likewise. + 2015-05-19 David Malcolm <dmalcolm@redhat.com> * c-common.h (fe_file_change): Strengthen param from diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 3998b23..a2b3793 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -7406,7 +7406,7 @@ handle_externally_visible_attribute (tree *pnode, tree name, { tree node = *pnode; - if (TREE_CODE (node) == FUNCTION_DECL || TREE_CODE (node) == VAR_DECL) + if (VAR_OR_FUNCTION_DECL_P (node)) { if ((!TREE_STATIC (node) && TREE_CODE (node) != FUNCTION_DECL && !DECL_EXTERNAL (node)) || !TREE_PUBLIC (node)) @@ -7437,7 +7437,7 @@ handle_no_reorder_attribute (tree *pnode, { tree node = *pnode; - if ((TREE_CODE (node) != FUNCTION_DECL && TREE_CODE (node) != VAR_DECL) + if (!VAR_OR_FUNCTION_DECL_P (node) && !(TREE_STATIC (node) || DECL_EXTERNAL (node))) { warning (OPT_Wattributes, @@ -7893,7 +7893,7 @@ handle_section_attribute (tree *node, tree ARG_UNUSED (name), tree args, user_defined_section_attribute = true; - if (TREE_CODE (decl) != FUNCTION_DECL && TREE_CODE (decl) != VAR_DECL) + if (!VAR_OR_FUNCTION_DECL_P (decl)) { error ("section attribute not allowed for %q+D", *node); goto fail; @@ -8172,8 +8172,7 @@ handle_weak_attribute (tree *node, tree name, *no_add_attrs = true; return NULL_TREE; } - else if (TREE_CODE (*node) == FUNCTION_DECL - || TREE_CODE (*node) == VAR_DECL) + else if (VAR_OR_FUNCTION_DECL_P (*node)) { struct symtab_node *n = symtab_node::get (*node); if (n && n->refuse_visibility_changes) @@ -8309,7 +8308,7 @@ handle_weakref_attribute (tree *node, tree ARG_UNUSED (name), tree args, such symbols do not even have a DECL_WEAK field. */ if (decl_function_context (*node) || current_function_decl - || (TREE_CODE (*node) != VAR_DECL && TREE_CODE (*node) != FUNCTION_DECL)) + || !VAR_OR_FUNCTION_DECL_P (*node)) { warning (OPT_Wattributes, "%qE attribute ignored", name); *no_add_attrs = true; @@ -8466,8 +8465,7 @@ handle_visibility_attribute (tree *node, tree name, tree args, bool c_determine_visibility (tree decl) { - gcc_assert (TREE_CODE (decl) == VAR_DECL - || TREE_CODE (decl) == FUNCTION_DECL); + gcc_assert (VAR_OR_FUNCTION_DECL_P (decl)); /* If the user explicitly specified the visibility with an attribute, honor that. DECL_VISIBILITY will have been set during @@ -9014,8 +9012,7 @@ handle_tm_wrap_attribute (tree *node, tree name, tree args, if (error_operand_p (wrap_decl)) ; else if (TREE_CODE (wrap_decl) != IDENTIFIER_NODE - && TREE_CODE (wrap_decl) != VAR_DECL - && TREE_CODE (wrap_decl) != FUNCTION_DECL) + && !VAR_OR_FUNCTION_DECL_P (wrap_decl)) error ("%qE argument not an identifier", name); else { @@ -9089,8 +9086,7 @@ handle_deprecated_attribute (tree *node, tree name, if (TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == PARM_DECL - || TREE_CODE (decl) == VAR_DECL - || TREE_CODE (decl) == FUNCTION_DECL + || VAR_OR_FUNCTION_DECL_P (decl) || TREE_CODE (decl) == FIELD_DECL || objc_method_decl (TREE_CODE (decl))) TREE_DEPRECATED (decl) = 1; diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c index 6894f0e..b82ca9f 100644 --- a/gcc/c-family/c-pragma.c +++ b/gcc/c-family/c-pragma.c @@ -306,7 +306,7 @@ maybe_apply_pragma_weak (tree decl) /* If it's not a function or a variable, it can't be weak. FIXME: what kinds of things are visible outside this file but aren't functions or variables? Should this be an assert instead? */ - if (TREE_CODE (decl) != FUNCTION_DECL && TREE_CODE (decl) != VAR_DECL) + if (!VAR_OR_FUNCTION_DECL_P (decl)) return; if (DECL_ASSEMBLER_NAME_SET_P (decl)) @@ -486,8 +486,7 @@ handle_pragma_redefine_extname (cpp_reader * ARG_UNUSED (dummy)) } if ((TREE_PUBLIC (decl) || DECL_EXTERNAL (decl)) - && (TREE_CODE (decl) == FUNCTION_DECL - || TREE_CODE (decl) == VAR_DECL)) + && VAR_OR_FUNCTION_DECL_P (decl)) { found = true; if (DECL_ASSEMBLER_NAME_SET_P (decl)) @@ -547,7 +546,7 @@ maybe_apply_renaming_pragma (tree decl, tree asmname) /* The renaming pragmas are only applied to declarations with external linkage. */ - if ((TREE_CODE (decl) != FUNCTION_DECL && TREE_CODE (decl) != VAR_DECL) + if (!VAR_OR_FUNCTION_DECL_P (decl) || (!TREE_PUBLIC (decl) && !DECL_EXTERNAL (decl)) || !has_c_linkage (decl)) return asmname; |