Browse Source

gcc: Check for `affects_type_identity' in `struct attribute_spec'.

* m4/gcc.m4 (STARPU_GCC_PLUGIN_SUPPORT): Check for
  `affects_type_identity' in `struct attribute_spec'.

* gcc-plugin/src/starpu-gcc-config.h.in (HAVE_ATTRIBUTE_SPEC_AFFECTS_TYPE_IDENTITY):
  New macro.

* gcc-plugin/src/starpu.c (register_task_attributes)[HAVE_ATTRIBUTE_SPEC_AFFECTS_TYPE_IDENTITY]:
  Initialize the `affects_type_identity' member.
Ludovic Courtès 13 years ago
parent
commit
4f838dae68
3 changed files with 23 additions and 4 deletions
  1. 2 0
      gcc-plugin/src/starpu-gcc-config.h.in
  2. 12 4
      gcc-plugin/src/starpu.c
  3. 9 0
      m4/gcc.m4

+ 2 - 0
gcc-plugin/src/starpu-gcc-config.h.in

@@ -28,6 +28,8 @@
 
 #undef HAVE_DECL_BUILTIN_DECL_EXPLICIT
 
+#undef HAVE_ATTRIBUTE_SPEC_AFFECTS_TYPE_IDENTITY
+
 #undef HAVE_C_FAMILY_C_COMMON_H
 #undef HAVE_C_COMMON_H
 

+ 12 - 4
gcc-plugin/src/starpu.c

@@ -1523,27 +1523,35 @@ register_task_attributes (void *gcc_data, void *user_data)
     {
       task_attribute_name, 0, 0, true, false, false,
       handle_task_attribute
+#ifdef HAVE_ATTRIBUTE_SPEC_AFFECTS_TYPE_IDENTITY
+      , false
+#endif
     };
 
   static const struct attribute_spec task_implementation_attr =
     {
       task_implementation_attribute_name, 2, 2, true, false, false,
       handle_task_implementation_attribute
+#ifdef HAVE_ATTRIBUTE_SPEC_AFFECTS_TYPE_IDENTITY
+      , false
+#endif
     };
 
   static const struct attribute_spec heap_allocated_attr =
     {
       heap_allocated_attribute_name, 0, 0, true, false, false,
       handle_heap_allocated_attribute
+#ifdef HAVE_ATTRIBUTE_SPEC_AFFECTS_TYPE_IDENTITY
+      , false
+#endif
     };
 
   static const struct attribute_spec output_attr =
     {
       output_attribute_name, 0, 0, true, true, false,
-      handle_output_attribute,
-#if 0 /* FIXME: Check whether the `affects_type_identity' field is
-	 present.  */
-      true /* affects type identity */
+      handle_output_attribute
+#ifdef HAVE_ATTRIBUTE_SPEC_AFFECTS_TYPE_IDENTITY
+      , true /* affects type identity */
 #endif
     };
 

+ 9 - 0
m4/gcc.m4

@@ -149,6 +149,7 @@ AC_DEFUN([STARPU_GCC_PLUGIN_SUPPORT], [
     dnl   build_array_ref           -- present but undeclared in 4.6.1
     dnl   build_zero_cst            -- not in GCC 4.5.x; appears in 4.6
     dnl   builtin_decl_explicit     -- new in 4.7, replaces `built_in_decls'
+    dnl   .affects_type_identity    -- new field in 4.7
     _STARPU_WITH_GCC_PLUGIN_API([
       AC_CHECK_DECLS([build_call_expr_loc_array, build_call_expr_loc_vec,
                       build_array_ref, build_zero_cst,
@@ -161,6 +162,14 @@ AC_DEFUN([STARPU_GCC_PLUGIN_SUPPORT], [
       AC_CHECK_HEADERS([c-common.h c-pragma.h c-family/c-common.h c-family/c-pragma.h],
         [], [], [#include <gcc-plugin.h>
 	         #include <tree.h>])
+
+      AC_CHECK_MEMBER([struct attribute_spec.affects_type_identity],
+        [AC_DEFINE([HAVE_ATTRIBUTE_SPEC_AFFECTS_TYPE_IDENTITY], [1],
+	  [Define to 1 when `struct attribute_spec' has the `affects_type_identity' field.])],
+	[],
+	[#include <gcc-plugin.h>
+	 #include <tree.h>])
+
     ])