From 62f9079a9372e04d7610098c57e7c320d922459b Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 25 Jun 2015 16:26:05 +0000 Subject: [PATCH] cilk.c (extract_free_variables): Use is_global_var. * cilk.c (extract_free_variables): Use is_global_var. * c-decl.c: Use is_global_var throughout. * c-parser.c: Likewise. * c-typeck.c: Likewise. From-SVN: r224947 --- gcc/c-family/ChangeLog | 4 ++++ gcc/c-family/cilk.c | 2 +- gcc/c/ChangeLog | 6 ++++++ gcc/c/c-decl.c | 8 +++----- gcc/c/c-parser.c | 2 +- gcc/c/c-typeck.c | 4 ++-- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index cf43d39c0bd..ecfb52c03e9 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,7 @@ +2015-06-25 Marek Polacek + + * cilk.c (extract_free_variables): Use is_global_var. + 2015-06-23 Richard Sandiford * c-common.c: Don't include target-def.h. diff --git a/gcc/c-family/cilk.c b/gcc/c-family/cilk.c index c38e05f4134..347e4b9f2a5 100644 --- a/gcc/c-family/cilk.c +++ b/gcc/c-family/cilk.c @@ -1063,7 +1063,7 @@ extract_free_variables (tree t, struct wrapper_data *wd, TREE_ADDRESSABLE (t) = 1; case VAR_DECL: case PARM_DECL: - if (!TREE_STATIC (t) && !DECL_EXTERNAL (t)) + if (!is_global_var (t)) add_variable (wd, t, how); return; diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 4bac6e02c35..c8d1c24c064 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2015-06-25 Marek Polacek + + * c-decl.c: Use is_global_var throughout. + * c-parser.c: Likewise. + * c-typeck.c: Likewise. + 2015-06-17 Andrew MacLeod * c-array-notation.c: Do not include input.h, line-map.h or is-a.h. diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index fc1fdf97bee..1aa2bd49669 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -4395,7 +4395,7 @@ c_decl_attributes (tree *node, tree attributes, int flags) /* Add implicit "omp declare target" attribute if requested. */ if (current_omp_declare_target_attribute && ((TREE_CODE (*node) == VAR_DECL - && (TREE_STATIC (*node) || DECL_EXTERNAL (*node))) + && is_global_var (*node)) || TREE_CODE (*node) == FUNCTION_DECL)) { if (TREE_CODE (*node) == VAR_DECL @@ -4794,8 +4794,7 @@ finish_decl (tree decl, location_t init_loc, tree init, TREE_TYPE (decl) = error_mark_node; } - if ((DECL_EXTERNAL (decl) || TREE_STATIC (decl)) - && DECL_SIZE (decl) != 0) + if (is_global_var (decl) && DECL_SIZE (decl) != 0) { if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST) constant_expression_warning (DECL_SIZE (decl)); @@ -4911,8 +4910,7 @@ finish_decl (tree decl, location_t init_loc, tree init, { /* Recompute the RTL of a local array now if it used to be an incomplete type. */ - if (was_incomplete - && !TREE_STATIC (decl) && !DECL_EXTERNAL (decl)) + if (was_incomplete && !is_global_var (decl)) { /* If we used it already as memory, it must stay in memory. */ TREE_ADDRESSABLE (decl) = TREE_USED (decl); diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index e0ab0a1a33c..f4d18bdaed2 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -14769,7 +14769,7 @@ c_parser_omp_threadprivate (c_parser *parser) error_at (loc, "%qD is not a variable", v); else if (TREE_USED (v) && !C_DECL_THREADPRIVATE_P (v)) error_at (loc, "%qE declared % after first use", v); - else if (! TREE_STATIC (v) && ! DECL_EXTERNAL (v)) + else if (! is_global_var (v)) error_at (loc, "automatic variable %qE cannot be %", v); else if (TREE_TYPE (v) == error_mark_node) ; diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index aeb104363bf..7ca6e6af730 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -4380,7 +4380,7 @@ c_mark_addressable (tree exp) if (C_DECL_REGISTER (x) && DECL_NONLOCAL (x)) { - if (TREE_PUBLIC (x) || TREE_STATIC (x) || DECL_EXTERNAL (x)) + if (TREE_PUBLIC (x) || is_global_var (x)) { error ("global register variable %qD used in nested function", x); @@ -4390,7 +4390,7 @@ c_mark_addressable (tree exp) } else if (C_DECL_REGISTER (x)) { - if (TREE_PUBLIC (x) || TREE_STATIC (x) || DECL_EXTERNAL (x)) + if (TREE_PUBLIC (x) || is_global_var (x)) error ("address of global register variable %qD requested", x); else error ("address of register variable %qD requested", x); -- 2.30.2