diff mbox

PATCH GCC5.0: conditionally skip gcc_version in plugin-version.h

Message ID 1415861547.32600.7.camel@starynkevitch.net
State New
Headers show

Commit Message

Basile Starynkevitch Nov. 13, 2014, 6:52 a.m. UTC
On Wed, 2014-11-12 at 14:36 +0100, Basile Starynkevitch wrote:
> On Wed, Nov 12, 2014 at 02:29:13PM +0100, Jakub Jelinek wrote:
> > On Wed, Nov 12, 2014 at 02:20:22PM +0100, Basile Starynkevitch wrote:
> > > Most plugin don't need any configure, because they are installed in 
> > > a version specific directory (like /usr/lib/gcc/x86_64-linux-gnu/4.9/plugin 
> > > for example). I don't think it is wise to require plugin to be 
> > > autoconf-configurable. Their Makefile simply uses 
> > > $(shell gcc -print-file-name=plugin), there is no need to complex
> > > autoconf machinery.
> > 
> > If you use $(shell gcc -print-file-name=plugin), there is no point
> > to include plugin-version.h, just use __GNUC__/__GNUC_MINOR__ ?
> 
> 
> I could compile a plugin (notably for a GCC cross-compiler) with a GCC version
> different of the GCC targetting the plugin. I could also compile a 
> plugin with Clang or some other non-GCC compiler. In both cases
> plugin-version.h is needed with its GCCPLUGIN_VERSION.

I'm trying to patch GCC to get a plugin-version.c file generated, but I
can't get that work. Here is attached a buggy patch against trunk svn
r217460 which does not work. Could any one help me to catch my mistake
please?


Regards.
diff mbox

Patch

Index: fixincludes/fixincl.x
===================================================================
--- fixincludes/fixincl.x	(revision 217460)
+++ fixincludes/fixincl.x	(working copy)
@@ -1,12 +1,12 @@ 
 /*  -*- buffer-read-only: t -*- vi: set ro:
- * 
+ *
  * DO NOT EDIT THIS FILE   (fixincl.x)
- * 
- * It has been AutoGen-ed  October 21, 2014 at 10:18:16 AM by AutoGen 5.16.2
+ *
+ * It has been AutoGen-ed
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Tue Oct 21 10:18:17 CEST 2014
+/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Nov 13 07:50:38 MET 2014
  *
  * You must regenerate it.  Use the ./genfixes script.
  *
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 217460)
+++ gcc/Makefile.in	(working copy)
@@ -1324,6 +1324,7 @@ 
 	opts-global.o \
 	passes.o \
 	plugin.o \
+	plugin-version.o \
 	postreload-gcse.o \
 	postreload.o \
 	predict.o \
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 217460)
+++ gcc/configure.ac	(working copy)
@@ -1656,7 +1656,25 @@ 
 else
         gcc_REVISION=""
 fi
+
+cat > plugin-version.c <<EOF
+/* generated file plugin-version.c for GCC */
+#include "plugin-version.h"
+static const char basever[] = "$gcc_BASEVER";
+static const char datestamp[] = "$gcc_DATESTAMP";
+static const char devphase[] = "$gcc_DEVPHASE";
+static const char revision[] = "$gcc_REVISION";
+
+/* FIXME plugins: We should make the version information more precise.
+   One way to do is to add a checksum. */
+
+const struct plugin_gcc_version gcc_version = {basever, datestamp,
+                                               devphase, revision,
+                                               configuration_arguments};
+EOF
+
 cat > plugin-version.h <<EOF
+/* generated header plugin-version.h for GCC */
 #include "configargs.h"
 
 #define GCCPLUGIN_VERSION_MAJOR   `echo $gcc_BASEVER | sed -e 's/^\([0-9]*\).*$/\1/'`
@@ -1664,18 +1682,9 @@ 
 #define GCCPLUGIN_VERSION_PATCHLEVEL   `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$/\1/'`
 #define GCCPLUGIN_VERSION  (GCCPLUGIN_VERSION_MAJOR*1000 + GCCPLUGIN_VERSION_MINOR)
 
-static char basever[] = "$gcc_BASEVER";
-static char datestamp[] = "$gcc_DATESTAMP";
-static char devphase[] = "$gcc_DEVPHASE";
-static char revision[] = "$gcc_REVISION";
+extern const struct plugin_gcc_version gcc_version;
+EOF
 
-/* FIXME plugins: We should make the version information more precise.
-   One way to do is to add a checksum. */
-
-static struct plugin_gcc_version gcc_version = {basever, datestamp,
-						devphase, revision,
-						configuration_arguments};
-EOF
 changequote([,])dnl
 
 # Internationalization