Browse Source

gcc: Relax the GCC version test.

* gcc-plugin/src/starpu.c (STRINGIFY, STRINGIFY_): New macros.
  (plugin_init)[VERSION_CHECK]: New macro.
  Use it in lieu of `plugin_default_version_check'.
Ludovic Courtès 13 years ago
parent
commit
6d99679dd5
1 changed files with 30 additions and 2 deletions
  1. 30 2
      gcc-plugin/src/starpu.c

+ 30 - 2
gcc-plugin/src/starpu.c

@@ -102,6 +102,11 @@ extern int yydebug;
 
 extern tree xref_tag (enum tree_code, tree);
 
+#ifndef STRINGIFY
+# define STRINGIFY_(x) # x
+# define STRINGIFY(x)  STRINGIFY_ (x)
+#endif
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -3285,8 +3290,31 @@ int
 plugin_init (struct plugin_name_args *plugin_info,
 	     struct plugin_gcc_version *version)
 {
-  if (!plugin_default_version_check (version, &gcc_version))
-    return 1;
+  /* `plugin_default_version_check' happens to be stricter than necessary
+     (for instance, it fails when the `buildstamp' field of the plug-in
+     doesn't match that of GCC), so write our own check and make more relax
+     and more verbose.  */
+
+#define VERSION_CHECK(field)						\
+  do									\
+    {									\
+      if (strcmp (gcc_version. field, version-> field) != 0)		\
+	{								\
+	  error_at (UNKNOWN_LOCATION, "plug-in version check for `"	\
+		    STRINGIFY (field) "' failed: expected `%s', "	\
+		    "got `%s'",						\
+		    gcc_version. field, version-> field);		\
+	  return 1;							\
+	}								\
+    }									\
+  while (0)
+
+  VERSION_CHECK (basever);			  /* e.g., "4.6.2" */
+  VERSION_CHECK (devphase);
+  VERSION_CHECK (revision);
+  VERSION_CHECK (configuration_arguments);
+
+#undef VERSION_CHECK
 
   register_callback (plugin_name, PLUGIN_START_UNIT,
 		     define_cpp_macros, NULL);