The function is_cilkplus_vector_p is defined both in c-parser.c and parser.c
and is exactly the same so it seems that it should rather be defined in the
common Cilk+ code (even though for such a small static inline fn it probably
doesn't matter much).  While at it, fix some typos and simplify the code a bit.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2015-10-20  Marek Polacek  <pola...@redhat.com>

        * array-notation-common.c (is_cilkplus_vector_p): Define.
        * c-common.h (is_cilkplus_vector_p): Declare.

        * c-parser.c (is_cilkplus_vector_p): Don't define here.

        * parser.c (is_cilkplus_vector_p): Don't define here.

diff --git gcc/c-family/array-notation-common.c 
gcc/c-family/array-notation-common.c
index 85ded8d..6b55747 100644
--- gcc/c-family/array-notation-common.c
+++ gcc/c-family/array-notation-common.c
@@ -676,3 +676,12 @@ fix_sec_implicit_args (location_t loc, vec <tree, va_gc> 
*list,
       vec_safe_push (array_operand, (*list)[ii]);
   return array_operand;
 }
+
+/* Returns true if NAME is an IDENTIFIER_NODE with identifier "vector",
+   "__vector", or "__vector__".  */
+
+bool
+is_cilkplus_vector_p (tree name)
+{
+  return flag_cilkplus && is_attribute_p ("vector", name);
+}
diff --git gcc/c-family/c-common.h gcc/c-family/c-common.h
index cf44482..4b5cac8 100644
--- gcc/c-family/c-common.h
+++ gcc/c-family/c-common.h
@@ -1435,6 +1435,7 @@ extern void cilkplus_extract_an_triplets (vec<tree, 
va_gc> *, size_t, size_t,
                                          vec<vec<an_parts> > *);
 extern vec <tree, va_gc> *fix_sec_implicit_args
   (location_t, vec <tree, va_gc> *, vec<an_loop_parts>, size_t, tree);
+extern bool is_cilkplus_vector_p (tree);
 
 /* In cilk.c.  */
 extern tree insert_cilk_frame (tree);
diff --git gcc/c/c-parser.c gcc/c/c-parser.c
index 704ebc6..a5c1d84 100644
--- gcc/c/c-parser.c
+++ gcc/c/c-parser.c
@@ -3848,17 +3848,6 @@ c_parser_attribute_any_word (c_parser *parser)
   return attr_name;
 }
 
-/* Returns true of NAME is an IDENTIFIER_NODE with identiifer "vector,"
-   "__vector" or "__vector__."  */
-
-static inline bool
-is_cilkplus_vector_p (tree name)
-{ 
-  if (flag_cilkplus && is_attribute_p ("vector", name)) 
-    return true;
-  return false;
-}
-
 #define CILK_SIMD_FN_CLAUSE_MASK                                 \
        ((OMP_CLAUSE_MASK_1 << PRAGMA_CILK_CLAUSE_VECTORLENGTH)   \
         | (OMP_CLAUSE_MASK_1 << PRAGMA_CILK_CLAUSE_LINEAR)       \
diff --git gcc/cp/parser.c gcc/cp/parser.c
index f07a5e4..cfe5468 100644
--- gcc/cp/parser.c
+++ gcc/cp/parser.c
@@ -23225,17 +23225,6 @@ cp_parser_gnu_attributes_opt (cp_parser* parser)
   return attributes;
 }
 
-/* Returns true of NAME is an IDENTIFIER_NODE with identiifer "vector,"
-   "__vector" or "__vector__."  */
-
-static inline bool
-is_cilkplus_vector_p (tree name)
-{ 
-  if (flag_cilkplus && is_attribute_p ("vector", name)) 
-    return true;
-  return false;
-}
-
 /* Parse a GNU attribute-list.
 
    attribute-list:

        Marek

Reply via email to