Patchwork [MELT] Fix versions comparisons

login
register
mail settings
Submitter Alexandre Lissy
Date Aug. 30, 2011, 12:45 p.m.
Message ID <1314708317-14915-1-git-send-email-alissy@mandriva.com>
Download mbox | patch
Permalink /patch/112280/
State New
Headers show

Comments

Alexandre Lissy - Aug. 30, 2011, 12:45 p.m.
Comparison of MELT version were not consistent accross the codebase:
 - MELT .c meltdesc were generated with melt_versionstr using
   MELT_VERSION_STRING define
 - comparison at several places in the source code was done against
   MELT_VERSION_STRING
 - comparision at other places was done between melt_genversionstr and
   melt_version_str ().
This commit changes comparison/generation at all those place to
something more consistent:
 - generate meltdesc's melt_versionstr with melt_version_str () call.
 - compare between melt_versionstr and melt_version_str ().
---
 gcc/ChangeLog.MELT           |   10 ++++++++++
 gcc/melt-runtime.c           |   16 ++++++++--------
 gcc/melt/warmelt-outobj.melt |    2 +-
 3 files changed, 19 insertions(+), 9 deletions(-)

Patch

diff --git a/gcc/ChangeLog.MELT b/gcc/ChangeLog.MELT
index 46b1471..bb46c20 100644
--- a/gcc/ChangeLog.MELT
+++ b/gcc/ChangeLog.MELT
@@ -1,3 +1,13 @@ 
+2011-08-30  Alexandre Lissy  <alissy@mandriva.com>
+	* melt-runtime.c (melt_load_module_index):
+	  - Export melt_versionstr from meltdesc instead of
+	    melt_genversionstr.
+	  - Make use of melt_version_str() instead of MELT_VERSION_STR.
+	  - Compare melt_version_str() against melt_versionstr instead of
+	    melt_genversionstr.
+	* melt/warmelt-outobj.melt (output_melt_descriptor): Make use of
+	melt_version_str() to build melt_versionstr instead of using
+	MELT_VERSION_STRING.
 
 2011-08-30  Basile Starynkevitch  <basile@starynkevitch.net>
 	* melt-predef.list (DISCR_BOX):  Remove.
diff --git a/gcc/melt-runtime.c b/gcc/melt-runtime.c
index 08b3d7b..bb0505c 100644
--- a/gcc/melt-runtime.c
+++ b/gcc/melt-runtime.c
@@ -8548,7 +8548,7 @@  melt_load_module_index (const char*srcbase, const char*flavor)
   /* list of optional dynamic symbols (dlsymed in the module, provided
      in the FOO+meltdesc.c file). */
 #define MELTDESCR_OPTIONAL_LIST				\
-  MELTDESCR_OPTIONAL_SYMBOL (melt_genversionstr, char);	\
+  MELTDESCR_OPTIONAL_SYMBOL (melt_versionstr, char);	\
   MELTDESCR_OPTIONAL_SYMBOL (melt_modulerealpath, char)
 
   /* declare our dymamic symbols */
@@ -8646,10 +8646,10 @@  melt_load_module_index (const char*srcbase, const char*flavor)
 	     "MELT module name %s in MELT descriptive file %s not as expected", 
 	     descmodulename, srcpath);
   if (!flag_melt_bootstrapping 
-      && strcmp(descversionmelt, MELT_VERSION_STRING))
+      && strcmp(descversionmelt, melt_version_str ()))
     warning (0,
 	     "MELT descriptive file %s for MELT version %s, but this MELT runtime is version %s",
-	     srcpath, descversionmelt, MELT_VERSION_STRING);
+	     srcpath, descversionmelt, melt_version_str ());
   sobase = 
     concat (lbasename(descmodulename), ".", desccumulatedhexmd5, ".", flavor, ".so", NULL);
   debugeprintf ("melt_load_module_index long sobase %s workdir %s", 
@@ -8762,10 +8762,10 @@  melt_load_module_index (const char*srcbase, const char*flavor)
       time_t nowt = 0;
       time (&nowt);
       if (strcmp (MELTDESCR_REQUIRED (melt_versionmeltstr), 
-		  MELT_VERSION_STRING))
+		 melt_version_str ()))
 	warning (0,
 		 "MELT module %s for source %s has mismatching MELT version %s, expecting %s",
-		 sopath, srcbase, MELTDESCR_REQUIRED (melt_versionmeltstr), MELT_VERSION_STRING);
+		 sopath, srcbase, MELTDESCR_REQUIRED (melt_versionmeltstr), melt_version_str ());
       if (strcmp (MELTDESCR_REQUIRED (melt_prepromd5meltrun),
 		  melt_run_preprocessed_md5))
 	warning (0,
@@ -8830,11 +8830,11 @@  melt_load_module_index (const char*srcbase, const char*flavor)
           free (srcpath), srcpath = NULL;
 	  free (curpath), curpath = NULL;
 	};
-      if (MELTDESCR_OPTIONAL(melt_genversionstr)
-	  && strcmp(MELTDESCR_OPTIONAL(melt_genversionstr), melt_version_str()))
+      if (MELTDESCR_OPTIONAL(melt_versionstr)
+	  && strcmp(MELTDESCR_OPTIONAL(melt_versionstr), melt_version_str()))
 	warning (0,
 		 "MELT module %s generated by %s but used by %s [possible version mismatch]",
-		 sopath, MELTDESCR_OPTIONAL(melt_genversionstr), melt_version_str ());
+		 sopath, MELTDESCR_OPTIONAL(melt_versionstr), melt_version_str ());
       gentim = (time_t) (*MELTDESCR_REQUIRED(melt_gen_timenum));
       if (gentim > nowt)
 	warning (0,
diff --git a/gcc/melt/warmelt-outobj.melt b/gcc/melt/warmelt-outobj.melt
index 06b2261..10870d4 100644
--- a/gcc/melt/warmelt-outobj.melt
+++ b/gcc/melt/warmelt-outobj.melt
@@ -3778,7 +3778,7 @@ 
     (code_chunk 
      genvmeltch
      #{ /* output_melt_descriptor $GENVMELTCH + */
-     meltgc_add_strbuf_cstr ($DEBUF, MELT_VERSION_STRING) ;
+     meltgc_add_strbuf_cstr ($DEBUF, melt_version_str ()) ;
      }#)
     (add2sbuf_strconst debuf "\";")
     (add2sbuf_indentnl debuf 0)