[PATCH] [MELT] Fixing echo stderr permission issue

2012-09-28 Thread Alexandre Lissy
Hello,

While updating my gcc melt package for debian/ubuntu, I ran into an
issue of /dev/stderr permissions. Some melt build script are directly
echoing to /dev/stderr; and that seems not correct. The attached patch
changes this to echoing to &2, which is more sane and works.
>From ebc8fa49c1aee06160844012220bdf08c8e6bff9 Mon Sep 17 00:00:00 2001
From: Alexandre Lissy 
Date: Fri, 28 Sep 2012 12:23:30 +0200
Subject: [PATCH] 2012-09-26  Alexandre Lissy  

[gcc/]
	* melt-build-script.pl: Using >&2 instead of >/dev/stderr
---
 gcc/ChangeLog.MELT|3 ++-
 gcc/melt-build-script.tpl |   28 ++--
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/gcc/ChangeLog.MELT b/gcc/ChangeLog.MELT
index dac5c2a..734547e 100644
--- a/gcc/ChangeLog.MELT
+++ b/gcc/ChangeLog.MELT
@@ -1,4 +1,5 @@
-
+2012-09-28  Alexandre Lissy  
+	* melt-build-script.pl: using >&2 instead of >/dev/stderr
 
 2012-09-26  Basile Starynkevitch  
 
diff --git a/gcc/melt-build-script.tpl b/gcc/melt-build-script.tpl
index 55d0117..4d3eddf 100644
--- a/gcc/melt-build-script.tpl
+++ b/gcc/melt-build-script.tpl
@@ -65,7 +65,7 @@ date +"/*empty file for MELT build %c*/" > meltbuild-empty-file.c
 
 ## our error function  [+(.(fromline))+]
 function meltbuild_error () {
-echo MELT BUILD SCRIPT FAILURE: $@ > /dev/stderr
+echo MELT BUILD SCRIPT FAILURE: $@ >&2
 exit 1
 }
 
@@ -76,14 +76,14 @@ function meltbuild_symlink () {
 
 ## our info function
 function meltbuild_info () {
-echo MELT BUILD SCRIPT INFO: $@ > /dev/stderr
+echo MELT BUILD SCRIPT INFO: $@ >&2
 }
 
 ## our notice function - for more important things than info
 function meltbuild_notice () {
 meltnotititle=$1
 shift
-(echo; echo; echo MELT BUILD SCRIPT NOTICE "$meltnotititle:" $@ ; echo ) > /dev/stderr
+(echo; echo; echo MELT BUILD SCRIPT NOTICE "$meltnotititle:" $@ ; echo ) >&2
 if [ -n "$GCCMELT_BUILD_NOTIFICATION" ]; then
 	$GCCMELT_BUILD_NOTIFICATION "$meltnotititle:" "$*"
 fi
@@ -205,7 +205,7 @@ meltbuild_notice STAGE0+  [+(.(fromline))+] starting stage zero
 ##
   mv $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK
   meltbuild_info [+(.(fromline))+] generated stagezero makedep $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK
-  ls -l $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK > /dev/stderr
+  ls -l $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK >&2
 
   $GCCMELT_MAKE -f $GCCMELT_MODULE_MK melt_module \
   GCCMELT_FROM=stagezero-[+(.(fromline))+] \
@@ -221,7 +221,7 @@ meltbuild_notice STAGE0+  [+(.(fromline))+] starting stage zero
   || meltbuild_error  [+(.(fromline))+] stage0 [+base+] did not build "(with $GCCMELT_MAKE  -f $GCCMELT_MODULE_MK)" compiler $GCCMELT_COMPILER cflags $GCCMELT_COMPILER_FLAGS
 
   meltbuild_info [+(.(fromline))+] stage0 [+base+] module 
-  ls -l "$GCCMELT_STAGE_ZERO/[+base+].meltmod-$MELT_ZERO_GENERATED_[+varsuf+]_CUMULMD5.$GCCMELT_ZERO_FLAVOR.so" > /dev/stderr \
+  ls -l "$GCCMELT_STAGE_ZERO/[+base+].meltmod-$MELT_ZERO_GENERATED_[+varsuf+]_CUMULMD5.$GCCMELT_ZERO_FLAVOR.so" >&2 \
   || meltbuild_error  [+(.(fromline))+] stage0 [+base+] fail to build \
   "$GCCMELT_STAGE_ZERO/[+base+].meltmod-$MELT_ZERO_GENERATED_[+varsuf+]_CUMULMD5.$GCCMELT_ZERO_FLAVOR.so"
 
@@ -250,7 +250,7 @@ else
meltbuild_info [+(.(fromline))+] skipped stage0 because of stamp file $melt_stagezero_stamp
 fi
 
-meltbuild_info [+(.(fromline))+] times after stagezero at `date '+%x %H:%M:%S'`: ;  times > /dev/stderr
+meltbuild_info [+(.(fromline))+] times after stagezero at `date '+%x %H:%M:%S'`: ;  times >&2
 
 
 
@@ -301,7 +301,7 @@ function meltbuild_emit () {
 echo meltbuild-empty-file.c >>  $meltargs-$$-tmp
 mv $meltargs-$$-tmp $meltargs
 meltbuild_info $meltfrom argument file $meltargs is
-cat  $meltargs < /dev/null > /dev/stderr
+cat  $meltargs < /dev/null >&2
 if [ -z "$GCCMELT_SKIPEMITC" ]; then
 	$GCCMELT_CC1_PREFIX $GCCMELT_CC1 @$meltargs || meltbuild_error $meltfrom failed with arguments @$meltargs
 ## remove obsolete secondary C files left previously in $meltstage 
@@ -557,7 +557,7 @@ fi
 
 meltbuild_info [+(.(fromline))+] before applications GCCMELT_SKIPEMITC=$GCCMELT_SKIPEMITC.
 
-meltbuild_info [+(.(fromline))+] times before applications at `date '+%x %H:%M:%S'`: ;  times > /dev/stderr
+meltbuild_info [+(.(fromline))+] times before applications at `date '+%x %H:%M:%S'`: ;  times >&2
  
 melt_final_application_stamp=meltbuild-final-application.stamp
 
@@ -622,7 +622,7 @@ meltbuild_notice 'doing applications'  [+(.(fromline))+] doing applications
 [+ENDFOR melt_application

[PATCH] [MELT] An alternative probe for GCC MELT

2012-09-26 Thread Alexandre Lissy
Hello,

As I reported on the gcc-m...@googlegroups.com list, I experienced bad
behavior of the GtkMM probe for MELT. I identified the issue as linked
to the amount of inline buttons added in the source code, but was not
able to fix or identify the root of the issue. Since I'm not very
skilled with C++ and Gtk, I decided to provide another implementation of
the probe, writing it using Qt4 and Python. I hope it makes the source
easier to read and hack.

It's now nearly as functionnal as the original one, so I'm proposing the
attached patch that adds this probe under the contrib/ directory.
>From 4f32b3261c730a0002a4c316bc64c4ae40fc5eb7 Mon Sep 17 00:00:00 2001
From: Alexandre Lissy 
Date: Wed, 26 Sep 2012 18:26:39 +0200
Subject: [PATCH] 2012-09-26  Alexandre Lissy  

[contrib/]
* simplemelt-pyqt4-probe.py: Introducing another implementation of
  the MELT probe, written in Python and Qt4.
---
 contrib/ChangeLog.MELT|3 +
 contrib/simplemelt-pyqt4-probe.py |  780 +
 2 files changed, 783 insertions(+)
 create mode 100644 contrib/simplemelt-pyqt4-probe.py

diff --git a/contrib/ChangeLog.MELT b/contrib/ChangeLog.MELT
index bb529ed..56e83d0 100644
--- a/contrib/ChangeLog.MELT
+++ b/contrib/ChangeLog.MELT
@@ -1,3 +1,6 @@
+2012-09-26  Alexandre Lissy  
+
+	* simplemelt-pyqt4-probe.py: Adding Python/Qt4 probe
 
 2012-09-24  Basile Starynkevitch  
 
diff --git a/contrib/simplemelt-pyqt4-probe.py b/contrib/simplemelt-pyqt4-probe.py
new file mode 100644
index 000..4271763
--- /dev/null
+++ b/contrib/simplemelt-pyqt4-probe.py
@@ -0,0 +1,780 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+# vim: set ts=4 sw=4 et:
+
+#  This program is free software: you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation, either version 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+"""
+MELT probe in PyQt
+"""
+
+import sys
+import os
+import argparse
+import select
+import pprint
+import re
+import logging
+from datetime import datetime
+from threading import Thread
+from PyQt4.QtGui import *
+from PyQt4.QtCore import *
+from PyQt4.Qsci import *
+
+MELT_SIGNAL_UNHANDLED_COMMAND = SIGNAL("unhandledCommand(PyQt_PyObject)")
+MELT_SIGNAL_DISPATCH_COMMAND = SIGNAL("dispatchCommand(PyQt_PyObject)")
+MELT_SIGNAL_APPEND_TRACE_COMMAND = SIGNAL("appendCommand(PyQt_PyObject)")
+MELT_SIGNAL_APPEND_TRACE_REQUEST = SIGNAL("appendRequest(PyQt_PyObject)")
+MELT_SIGNAL_SOURCE_SHOWFILE = SIGNAL("sourceShowfile(PyQt_PyObject)")
+MELT_SIGNAL_SOURCE_MARKLOCATION = SIGNAL("sourceMarklocation(PyQt_PyObject)")
+MELT_SIGNAL_SOURCE_INFOLOCATION = SIGNAL("sourceInfoLocation(PyQt_PyObject)")
+MELT_SIGNAL_ASK_INFOLOCATION = SIGNAL("askInfoLocation(PyQt_PyObject)")
+MELT_SIGNAL_MOVE_TO_INDICATOR = SIGNAL("moveToIndicator(PyQt_PyObject)")
+
+MELT_SIGNAL_SOURCE_STARTINFOLOC = SIGNAL("startInfoLocation(PyQt_PyObject)")
+MELT_SIGNAL_SOURCE_ADDINFOLOC = SIGNAL("addInfoLocation(PyQt_PyObject)")
+
+MELT_SIGNAL_SHOWFILE_COMPLETE = SIGNAL("showfileComplete(PyQt_PyObject)")
+
+MELT_SIGNAL_INFOLOC_COMPLETE = SIGNAL("infolocComplete(PyQt_PyObject)")
+
+MELT_SIGNAL_INFOLOC_QUIT = SIGNAL("quitInfoloc()")
+
+MELT_SIGNAL_UPDATECOUNT = SIGNAL("updateCount(PyQt_PyObject)")
+MELT_SIGNAL_UPDATECURRENT = SIGNAL("updateCurrent(PyQt_PyObject)")
+
+MELT_SIGNAL_GETVERSION = SIGNAL("getVersion(PyQt_PyObject)")
+
+logger = logging.getLogger('melt-probe')
+console = logging.StreamHandler()
+formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+console.setFormatter(formatter)
+logger.addHandler(console)
+
+class MeltInfoLoc(QMainWindow):
+INFOLOC_IDENT_RE = re.compile(r"(\d+):(.*)")
+
+def __init__(self):
+QMainWindow.__init__(self)
+self.handled_marknums = {}
+self.initUI()
+
+def initUI(self):
+window = QWidget()
+self.vlayout = QVBoxLayout()
+self.tree = QTreeWidget()
+# {'marknum': 543, 'command': 'addinfoloc', 'filenum': 1, 'payload': [' "1:Basic Block #10 Gimple Seq', '[drivers/media/rc/imon.c : 1247:10] rel_x.11 = (signed char) rel_x;\\n[drivers/media/rc/imon.c : 1247:10] D.21223 = rel_x.11 | -16;\\n[driv

[PATCH] [MELT] Fix CUMULMD5 leading space

2011-09-14 Thread Alexandre Lissy
Since v3.82, make issued some strange warning on duplicated targets. It
turns out that those were due to a leading space hidden in CUMULMD5
variable, leading to target breakage.
---
 gcc/ChangeLog.MELT |4 
 gcc/melt-build.mk  |   18 +-
 gcc/melt-build.tpl |2 +-
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/gcc/ChangeLog.MELT b/gcc/ChangeLog.MELT
index 78c6ae6..6efd8d9 100644
--- a/gcc/ChangeLog.MELT
+++ b/gcc/ChangeLog.MELT
@@ -1,3 +1,7 @@
+2011-09-14  Alexandre Lissy  
+   * melt-build.tpl: Remove leading space on CUMULMD5, breaking some make
+   targets.
+   * melt-build.mk: Regenerate.
 
 2011-09-14  Basile Starynkevitch  
* melt-runtime.c (melt_dbgshortbacktrace): Print just the basename
diff --git a/gcc/melt-build.mk b/gcc/melt-build.mk
index af9e266..fd9d8a2 100644
--- a/gcc/melt-build.mk
+++ b/gcc/melt-build.mk
@@ -15,7 +15,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 # 
-#@ from melt-build.tpl line 21 generated by Autogen 5.12 using melt-build.def
+#@ from melt-build.tpl line 21 generated by Autogen 5.11.9 using melt-build.def
 
 
 ## the following Makefile variables are expected to be set
@@ -147,7 +147,7 @@ MELT_GENERATED_FIRST_C_FILES= \
 MELT_GENERATED_FIRST_BASE= \
   $(basename $(notdir $(MELT_GENERATED_FIRST_C_FILES)))
 
-MELT_GENERATED_FIRST_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-first+meltdesc.c) 
+MELT_GENERATED_FIRST_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-first+meltdesc.c)
 
 #@ from melt-build.tpl line 135
 MELT_GENERATED_BASE_C_FILES= \
@@ -156,7 +156,7 @@ MELT_GENERATED_BASE_C_FILES= \
 MELT_GENERATED_BASE_BASE= \
   $(basename $(notdir $(MELT_GENERATED_BASE_C_FILES)))
 
-MELT_GENERATED_BASE_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-base+meltdesc.c) 
+MELT_GENERATED_BASE_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-base+meltdesc.c)
 
 #@ from melt-build.tpl line 135
 MELT_GENERATED_DEBUG_C_FILES= \
@@ -165,7 +165,7 @@ MELT_GENERATED_DEBUG_C_FILES= \
 MELT_GENERATED_DEBUG_BASE= \
   $(basename $(notdir $(MELT_GENERATED_DEBUG_C_FILES)))
 
-MELT_GENERATED_DEBUG_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-debug+meltdesc.c) 
+MELT_GENERATED_DEBUG_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-debug+meltdesc.c)
 
 #@ from melt-build.tpl line 135
 MELT_GENERATED_MACRO_C_FILES= \
@@ -174,7 +174,7 @@ MELT_GENERATED_MACRO_C_FILES= \
 MELT_GENERATED_MACRO_BASE= \
   $(basename $(notdir $(MELT_GENERATED_MACRO_C_FILES)))
 
-MELT_GENERATED_MACRO_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-macro+meltdesc.c) 
+MELT_GENERATED_MACRO_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-macro+meltdesc.c)
 
 #@ from melt-build.tpl line 135
 MELT_GENERATED_NORMAL_C_FILES= \
@@ -183,7 +183,7 @@ MELT_GENERATED_NORMAL_C_FILES= \
 MELT_GENERATED_NORMAL_BASE= \
   $(basename $(notdir $(MELT_GENERATED_NORMAL_C_FILES)))
 
-MELT_GENERATED_NORMAL_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-normal+meltdesc.c) 
+MELT_GENERATED_NORMAL_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-normal+meltdesc.c)
 
 #@ from melt-build.tpl line 135
 MELT_GENERATED_NORMATCH_C_FILES= \
@@ -192,7 +192,7 @@ MELT_GENERATED_NORMATCH_C_FILES= \
 MELT_GENERATED_NORMATCH_BASE= \
   $(basename $(notdir $(MELT_GENERATED_NORMATCH_C_FILES)))
 
-MELT_GENERATED_NORMATCH_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-normatch+meltdesc.c) 
+MELT_GENERATED_NORMATCH_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-normatch+meltdesc.c)
 
 #@ from melt-build.tpl line 135
 MELT_GENERATED_GENOBJ_C_FILES= \
@@ -201,7 +201,7 @@ MELT_GENERATED_GENOBJ_C_FILES= \
 MELT_GENERATED_GENOBJ_BASE= \
   $(basename $(notdir $(MELT_GENERATED_GENOBJ_C_FILES)))
 
-MELT_GENERATED_GENOBJ_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-genobj+meltdesc

[PATCH] [MELT] Fix CUMULMD5 leading space

2011-09-14 Thread Alexandre Lissy
Since v3.82, make issued some strange warning on duplicated targets. It
turns out that those were due to a leading space hidden in CUMULMD5
variable, leading to target breakage.
---
 gcc/ChangeLog.MELT |4 
 gcc/melt-build.mk  |   18 +-
 gcc/melt-build.tpl |2 +-
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/gcc/ChangeLog.MELT b/gcc/ChangeLog.MELT
index 78c6ae6..6efd8d9 100644
--- a/gcc/ChangeLog.MELT
+++ b/gcc/ChangeLog.MELT
@@ -1,3 +1,7 @@
+2011-09-14  Alexandre Lissy  
+   * melt-build.tpl: Remove leading space on CUMULMD5, breaking some make
+   targets.
+   * melt-build.mk: Regenerate.
 
 2011-09-14  Basile Starynkevitch  
* melt-runtime.c (melt_dbgshortbacktrace): Print just the basename
diff --git a/gcc/melt-build.mk b/gcc/melt-build.mk
index af9e266..fd9d8a2 100644
--- a/gcc/melt-build.mk
+++ b/gcc/melt-build.mk
@@ -15,7 +15,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 # 
-#@ from melt-build.tpl line 21 generated by Autogen 5.12 using melt-build.def
+#@ from melt-build.tpl line 21 generated by Autogen 5.11.9 using melt-build.def
 
 
 ## the following Makefile variables are expected to be set
@@ -147,7 +147,7 @@ MELT_GENERATED_FIRST_C_FILES= \
 MELT_GENERATED_FIRST_BASE= \
   $(basename $(notdir $(MELT_GENERATED_FIRST_C_FILES)))
 
-MELT_GENERATED_FIRST_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-first+meltdesc.c) 
+MELT_GENERATED_FIRST_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-first+meltdesc.c)
 
 #@ from melt-build.tpl line 135
 MELT_GENERATED_BASE_C_FILES= \
@@ -156,7 +156,7 @@ MELT_GENERATED_BASE_C_FILES= \
 MELT_GENERATED_BASE_BASE= \
   $(basename $(notdir $(MELT_GENERATED_BASE_C_FILES)))
 
-MELT_GENERATED_BASE_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-base+meltdesc.c) 
+MELT_GENERATED_BASE_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-base+meltdesc.c)
 
 #@ from melt-build.tpl line 135
 MELT_GENERATED_DEBUG_C_FILES= \
@@ -165,7 +165,7 @@ MELT_GENERATED_DEBUG_C_FILES= \
 MELT_GENERATED_DEBUG_BASE= \
   $(basename $(notdir $(MELT_GENERATED_DEBUG_C_FILES)))
 
-MELT_GENERATED_DEBUG_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-debug+meltdesc.c) 
+MELT_GENERATED_DEBUG_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-debug+meltdesc.c)
 
 #@ from melt-build.tpl line 135
 MELT_GENERATED_MACRO_C_FILES= \
@@ -174,7 +174,7 @@ MELT_GENERATED_MACRO_C_FILES= \
 MELT_GENERATED_MACRO_BASE= \
   $(basename $(notdir $(MELT_GENERATED_MACRO_C_FILES)))
 
-MELT_GENERATED_MACRO_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-macro+meltdesc.c) 
+MELT_GENERATED_MACRO_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-macro+meltdesc.c)
 
 #@ from melt-build.tpl line 135
 MELT_GENERATED_NORMAL_C_FILES= \
@@ -183,7 +183,7 @@ MELT_GENERATED_NORMAL_C_FILES= \
 MELT_GENERATED_NORMAL_BASE= \
   $(basename $(notdir $(MELT_GENERATED_NORMAL_C_FILES)))
 
-MELT_GENERATED_NORMAL_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-normal+meltdesc.c) 
+MELT_GENERATED_NORMAL_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-normal+meltdesc.c)
 
 #@ from melt-build.tpl line 135
 MELT_GENERATED_NORMATCH_C_FILES= \
@@ -192,7 +192,7 @@ MELT_GENERATED_NORMATCH_C_FILES= \
 MELT_GENERATED_NORMATCH_BASE= \
   $(basename $(notdir $(MELT_GENERATED_NORMATCH_C_FILES)))
 
-MELT_GENERATED_NORMATCH_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-normatch+meltdesc.c) 
+MELT_GENERATED_NORMATCH_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-normatch+meltdesc.c)
 
 #@ from melt-build.tpl line 135
 MELT_GENERATED_GENOBJ_C_FILES= \
@@ -201,7 +201,7 @@ MELT_GENERATED_GENOBJ_C_FILES= \
 MELT_GENERATED_GENOBJ_BASE= \
   $(basename $(notdir $(MELT_GENERATED_GENOBJ_C_FILES)))
 
-MELT_GENERATED_GENOBJ_CUMULMD5 := $(shell $(GAWK) -F\" 
'/melt_cumulated_hexmd5/{print $$2}' 
$(melt_make_source_dir)/generated/warmelt-genobj+meltdesc

[PATCH] [MELT] Fix versions comparisons

2011-08-30 Thread Alexandre Lissy
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(-)

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  
+   * 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  
* 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)
-- 
1.7.6



[PATCH] [MELT] Fix failing target 'melt-tiny-tests'

2011-08-29 Thread Alexandre Lissy
The newly introduced target 'melt-tiny-tests' was buggy, this commit
fixes the issue by:
 - splitting target in two targets, introducing the
   'melt-sayhello.melt' target which produces the MELT code
   corresponding, with a dependency on
   $(melt_default_modules_list).modlis.
 - adding a dependency for target melt-tiny-test on melt-sayhello.melt
 - changing behavior of melt-tiny-tests to avoid hardcoding the
   previsously added dependency, using $(basename $<)
 - removing the '.c' extension in melt-output argument
 - adding bootstrapping flag
---
 gcc/ChangeLog.MELT |3 +++
 gcc/melt-build.tpl |   20 
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/gcc/ChangeLog.MELT b/gcc/ChangeLog.MELT
index d3ea85e..9ca1fc4 100644
--- a/gcc/ChangeLog.MELT
+++ b/gcc/ChangeLog.MELT
@@ -1,4 +1,7 @@
 2011-08-29  Alexandre Lissy  
+   * melt-build.tpl: Fix melt-tiny-tests failing target.
+
+2011-08-29  Alexandre Lissy  
* melt-runtime.c (melt_load_module_index): Fix loading path of .c
files.
* melt/warmelt-outobj.melt (output_melt_descriptor): Fix generation
diff --git a/gcc/melt-build.tpl b/gcc/melt-build.tpl
index 10462a4..7525b9e 100644
--- a/gcc/melt-build.tpl
+++ b/gcc/melt-build.tpl
@@ -562,18 +562,22 @@ melt-modules/[+base+].quicklybuilt.so: 
melt-sources/[+base+].c \
 
 
 #@ [+ (. (tpl-file-line))+]
-melt-tiny-tests: melt-modules melt-sources melt-all-modules melt-all-sources
+melt-sayhello.melt: $(melt_default_modules_list).modlis
+   @date +'(code_chunk say%YM%mhello #{printf("hello_from_MELT on %c pid 
%%d\n", (int) getpid());}#)' > $@
+#@ [+ (. (tpl-file-line))+]
+
+#@ [+ (. (tpl-file-line))+]
+melt-tiny-tests: melt-sayhello.melt melt-modules melt-sources melt-all-modules 
melt-all-sources
 # test that a helloworld can be translated
-   @date +'(code_chunk say%YM%mhello #{printf("hello_from_MELT on %c pid 
%%d\n", (int) getpid());}#)' > melt-sayhello.melt
@echo   $(MELTCCAPPLICATION1ARGS) \
-$(meltarg_arg)=$<  -frandom-seed=$(shell md5sum melt-sayhello.melt 
| cut -b-24) \
+$(meltarg_arg)=$<  -frandom-seed=$(shell md5sum $< | cut -b-24) \
 $(meltarg_module_path)=$(realpath melt-modules) \
 $(meltarg_source_path)=$(realpath melt-sources) \
- $(meltarg_workdir)=melt-workdir $(meltarg_inhibitautobuild) \
- $(meltarg_output)=melt-sayhello.c empty-file-for-melt.c > 
melt-sayhello.args-tmp
-   @mv melt-sayhello.args-tmp melt-sayhello.args
-   @echo -n melt-sayhello.args: ; cat melt-sayhello.args ; echo "* 
doing " melt-sayhello
-   $(melt_make_cc1) @melt-sayhello.args
+   $(meltarg_workdir)=melt-workdir $(meltarg_inhibitautobuild) 
$(meltarg_bootstrapping) \
+   $(meltarg_output)=$(basename $<) empty-file-for-melt.c > $(basename 
$<).args-tmp
+   @mv $(basename $<).args-tmp $(basename $<).args
+   @echo -n $(basename $<).args: ; cat $(basename $<).args ; echo "* 
doing " $(basename $<)
+   $(melt_make_cc1) @$(basename $<).args
 #@ [+ (. (tpl-file-line))+]
 
 
-- 
1.7.6



Re: [PATCH] [MELT] Fix loading of .c files

2011-08-29 Thread Alexandre Lissy
Le 29/08/2011 17:22, Alexandre Lissy a écrit :
> Le 29/08/2011 17:08, Alexandre Lissy a écrit :
>> Le 29/08/2011 16:57, Alexandre Lissy a écrit :
>>> Le 29/08/2011 16:44, Alexandre Lissy a écrit :
>>>> Le 29/08/2011 15:15, Basile Starynkevitch a écrit :
>>>>> On Mon, Aug 29, 2011 at 12:21:12PM +0200, Alexandre Lissy wrote:
>>>>>> Files containing the MELT translated to C code were not loaded correctly
>>>>>> due to bad search path when working with an installed plugin. Present
>>>>>> commit fixes this by:
>>>>>>  - using a melt find to search in current dir
>>>>>>  - ensuring the melt_modulename in melt descriptor only contains the
>>>>>>module name, and no path component
>>>>>
>>>>> Are you sure of that patch?  It seems that it loops on the hello world 
>>>>> tiny test I added in the MELT branch rev 178154
>>>>>
>>>>> Does it work for you when merging with latest MELT updates (ie when 
>>>>> applying that patch to rev  178154 of the MELT branch?
>>>>>
>>>>> (I am investigating)
>>>>>
>>>>> Cheers.
>>>>>
>>>>
>>>> Okay, once fixing your Makefile it's okay:
>>>>
>>>> $ LC_ALL=C time -p gcc -c @melt-sayhello.args
>>>> cc1: note: MELT is bootstrapping so ignore builtin source directory
>>>> /usr/lib64/gcc/x86_64-mandriva-linux-gnu/4.6.1/plugin/melt-sources
>>>> cc1: note: MELT is bootstrapping so ignore builtin module directory
>>>> /usr/lib64/gcc/x86_64-mandriva-linux-gnu/4.6.1/plugin/melt-modules
>>>> cc1: note: MELT generating C code of module melt-sayhello
>>>> cc1: note: MELT generated same file melt-sayhello.c in
>>>> /home/alex/BuildSystem/gcc-plugin-melt/BUILD/melt-0.8.99-plugin-for-gcc-4.6
>>>> cc1: note: MELT generated descriptor file melt-sayhello+meltdesc.c
>>>> cc1: note: MELT generated C code of module melt-sayhello with 0
>>>> secondary files in 10 CPU millisec.
>>>> real 0.06
>>>> user 0.02
>>>> sys 0.02
>>>>
>>>> The bug was: -fplugin-arg-melt-arg=melt-modules. I suspect it's this
>>>> line in melt-build.tpl:
>>>> $(meltarg_arg)=$<  -frandom-seed=$(shell md5sum melt-sayhello.melt | cut
>>>> -b-24) \
>>>>
>>>> The '$<' part ... But I have no idea of your intentions.
>>>>
>>>
>>> I suspect '$<' should be replaced by 'melt-sayhello.melt' to get
>>> -fplugin-arg-melt-arg=melt-sayhello.melt
>>>
>>> At least, it goes well doing this ...
>>>
>>
>> I am currently trying the attached patch.
> 
> A small change for dependencies.

Better without the suffix ...
diff --git a/gcc/melt-build.tpl b/gcc/melt-build.tpl
index 10462a4..7525b9e 100644
--- a/gcc/melt-build.tpl
+++ b/gcc/melt-build.tpl
@@ -562,18 +562,22 @@ melt-modules/[+base+].quicklybuilt.so: melt-sources/[+base+].c \
 
 
 #@ [+ (. (tpl-file-line))+]
-melt-tiny-tests: melt-modules melt-sources melt-all-modules melt-all-sources
+melt-sayhello.melt: $(melt_default_modules_list).modlis
+	@date +'(code_chunk say%YM%mhello #{printf("hello_from_MELT on %c pid %%d\n", (int) getpid());}#)' > $@
+#@ [+ (. (tpl-file-line))+]
+
+#@ [+ (. (tpl-file-line))+]
+melt-tiny-tests: melt-sayhello.melt melt-modules melt-sources melt-all-modules melt-all-sources
 # test that a helloworld can be translated
-	@date +'(code_chunk say%YM%mhello #{printf("hello_from_MELT on %c pid %%d\n", (int) getpid());}#)' > melt-sayhello.melt
 	@echo	$(MELTCCAPPLICATION1ARGS) \
-	 $(meltarg_arg)=$<  -frandom-seed=$(shell md5sum melt-sayhello.melt | cut -b-24) \
+	 $(meltarg_arg)=$<  -frandom-seed=$(shell md5sum $< | cut -b-24) \
 	 $(meltarg_module_path)=$(realpath melt-modules) \
 	 $(meltarg_source_path)=$(realpath melt-sources) \
- $(meltarg_workdir)=melt-workdir $(meltarg_inhibitautobuild) \
- $(meltarg_output)=melt-sayhello.c empty-file-for-melt.c > melt-sayhello.args-tmp
-	@mv melt-sayhello.args-tmp melt-sayhello.args
-	@echo -n melt-sayhello.args: ; cat melt-sayhello.args ; echo "* doing " melt-sayhello
-	$(melt_make_cc1) @melt-sayhello.args
+   $(meltarg_workdir)=melt-workdir $(meltarg_inhibitautobuild) $(meltarg_bootstrapping) \
+   $(meltarg_output)=$(basename $<) empty-file-for-melt.c > $(basename $<).args-tmp
+	@mv $(basename $<).args-tmp $(basename $<).args
+	@echo -n $(basename $<).args: ; cat $(basename $<).args ; echo "* doing " $(basename $<)
+	$(melt_make_cc1) @$(basename $<).args
 #@ [+ (. (tpl-file-line))+]
 
 


Re: [PATCH] [MELT] Fix loading of .c files

2011-08-29 Thread Alexandre Lissy
Le 29/08/2011 17:08, Alexandre Lissy a écrit :
> Le 29/08/2011 16:57, Alexandre Lissy a écrit :
>> Le 29/08/2011 16:44, Alexandre Lissy a écrit :
>>> Le 29/08/2011 15:15, Basile Starynkevitch a écrit :
>>>> On Mon, Aug 29, 2011 at 12:21:12PM +0200, Alexandre Lissy wrote:
>>>>> Files containing the MELT translated to C code were not loaded correctly
>>>>> due to bad search path when working with an installed plugin. Present
>>>>> commit fixes this by:
>>>>>  - using a melt find to search in current dir
>>>>>  - ensuring the melt_modulename in melt descriptor only contains the
>>>>>module name, and no path component
>>>>
>>>> Are you sure of that patch?  It seems that it loops on the hello world 
>>>> tiny test I added in the MELT branch rev 178154
>>>>
>>>> Does it work for you when merging with latest MELT updates (ie when 
>>>> applying that patch to rev  178154 of the MELT branch?
>>>>
>>>> (I am investigating)
>>>>
>>>> Cheers.
>>>>
>>>
>>> Okay, once fixing your Makefile it's okay:
>>>
>>> $ LC_ALL=C time -p gcc -c @melt-sayhello.args
>>> cc1: note: MELT is bootstrapping so ignore builtin source directory
>>> /usr/lib64/gcc/x86_64-mandriva-linux-gnu/4.6.1/plugin/melt-sources
>>> cc1: note: MELT is bootstrapping so ignore builtin module directory
>>> /usr/lib64/gcc/x86_64-mandriva-linux-gnu/4.6.1/plugin/melt-modules
>>> cc1: note: MELT generating C code of module melt-sayhello
>>> cc1: note: MELT generated same file melt-sayhello.c in
>>> /home/alex/BuildSystem/gcc-plugin-melt/BUILD/melt-0.8.99-plugin-for-gcc-4.6
>>> cc1: note: MELT generated descriptor file melt-sayhello+meltdesc.c
>>> cc1: note: MELT generated C code of module melt-sayhello with 0
>>> secondary files in 10 CPU millisec.
>>> real 0.06
>>> user 0.02
>>> sys 0.02
>>>
>>> The bug was: -fplugin-arg-melt-arg=melt-modules. I suspect it's this
>>> line in melt-build.tpl:
>>> $(meltarg_arg)=$<  -frandom-seed=$(shell md5sum melt-sayhello.melt | cut
>>> -b-24) \
>>>
>>> The '$<' part ... But I have no idea of your intentions.
>>>
>>
>> I suspect '$<' should be replaced by 'melt-sayhello.melt' to get
>> -fplugin-arg-melt-arg=melt-sayhello.melt
>>
>> At least, it goes well doing this ...
>>
> 
> I am currently trying the attached patch.

A small change for dependencies.
diff --git a/gcc/melt-build.tpl b/gcc/melt-build.tpl
index 10462a4..106c535 100644
--- a/gcc/melt-build.tpl
+++ b/gcc/melt-build.tpl
@@ -562,18 +562,22 @@ melt-modules/[+base+].quicklybuilt.so: melt-sources/[+base+].c \
 
 
 #@ [+ (. (tpl-file-line))+]
-melt-tiny-tests: melt-modules melt-sources melt-all-modules melt-all-sources
+melt-sayhello.melt: $(melt_default_modules_list).modlis
+	@date +'(code_chunk say%YM%mhello #{printf("hello_from_MELT on %c pid %%d\n", (int) getpid());}#)' > $@
+#@ [+ (. (tpl-file-line))+]
+
+#@ [+ (. (tpl-file-line))+]
+melt-tiny-tests: melt-sayhello.melt melt-modules melt-sources melt-all-modules melt-all-sources
 # test that a helloworld can be translated
-	@date +'(code_chunk say%YM%mhello #{printf("hello_from_MELT on %c pid %%d\n", (int) getpid());}#)' > melt-sayhello.melt
 	@echo	$(MELTCCAPPLICATION1ARGS) \
-	 $(meltarg_arg)=$<  -frandom-seed=$(shell md5sum melt-sayhello.melt | cut -b-24) \
+	 $(meltarg_arg)=$<  -frandom-seed=$(shell md5sum $< | cut -b-24) \
 	 $(meltarg_module_path)=$(realpath melt-modules) \
 	 $(meltarg_source_path)=$(realpath melt-sources) \
- $(meltarg_workdir)=melt-workdir $(meltarg_inhibitautobuild) \
- $(meltarg_output)=melt-sayhello.c empty-file-for-melt.c > melt-sayhello.args-tmp
-	@mv melt-sayhello.args-tmp melt-sayhello.args
-	@echo -n melt-sayhello.args: ; cat melt-sayhello.args ; echo "* doing " melt-sayhello
-	$(melt_make_cc1) @melt-sayhello.args
+   $(meltarg_workdir)=melt-workdir $(meltarg_inhibitautobuild) $(meltarg_bootstrapping) \
+   $(meltarg_output)=$(basename $<).c empty-file-for-melt.c > $(basename $<).args-tmp
+	@mv $(basename $<).args-tmp $(basename $<).args
+	@echo -n $(basename $<).args: ; cat $(basename $<).args ; echo "* doing " $(basename $<)
+	$(melt_make_cc1) @$(basename $<).args
 #@ [+ (. (tpl-file-line))+]
 
 


Re: [PATCH] [MELT] Fix loading of .c files

2011-08-29 Thread Alexandre Lissy
Le 29/08/2011 16:57, Alexandre Lissy a écrit :
> Le 29/08/2011 16:44, Alexandre Lissy a écrit :
>> Le 29/08/2011 15:15, Basile Starynkevitch a écrit :
>>> On Mon, Aug 29, 2011 at 12:21:12PM +0200, Alexandre Lissy wrote:
>>>> Files containing the MELT translated to C code were not loaded correctly
>>>> due to bad search path when working with an installed plugin. Present
>>>> commit fixes this by:
>>>>  - using a melt find to search in current dir
>>>>  - ensuring the melt_modulename in melt descriptor only contains the
>>>>module name, and no path component
>>>
>>> Are you sure of that patch?  It seems that it loops on the hello world tiny 
>>> test I added in the MELT branch rev 178154
>>>
>>> Does it work for you when merging with latest MELT updates (ie when 
>>> applying that patch to rev  178154 of the MELT branch?
>>>
>>> (I am investigating)
>>>
>>> Cheers.
>>>
>>
>> Okay, once fixing your Makefile it's okay:
>>
>> $ LC_ALL=C time -p gcc -c @melt-sayhello.args
>> cc1: note: MELT is bootstrapping so ignore builtin source directory
>> /usr/lib64/gcc/x86_64-mandriva-linux-gnu/4.6.1/plugin/melt-sources
>> cc1: note: MELT is bootstrapping so ignore builtin module directory
>> /usr/lib64/gcc/x86_64-mandriva-linux-gnu/4.6.1/plugin/melt-modules
>> cc1: note: MELT generating C code of module melt-sayhello
>> cc1: note: MELT generated same file melt-sayhello.c in
>> /home/alex/BuildSystem/gcc-plugin-melt/BUILD/melt-0.8.99-plugin-for-gcc-4.6
>> cc1: note: MELT generated descriptor file melt-sayhello+meltdesc.c
>> cc1: note: MELT generated C code of module melt-sayhello with 0
>> secondary files in 10 CPU millisec.
>> real 0.06
>> user 0.02
>> sys 0.02
>>
>> The bug was: -fplugin-arg-melt-arg=melt-modules. I suspect it's this
>> line in melt-build.tpl:
>> $(meltarg_arg)=$<  -frandom-seed=$(shell md5sum melt-sayhello.melt | cut
>> -b-24) \
>>
>> The '$<' part ... But I have no idea of your intentions.
>>
> 
> I suspect '$<' should be replaced by 'melt-sayhello.melt' to get
> -fplugin-arg-melt-arg=melt-sayhello.melt
> 
> At least, it goes well doing this ...
> 

I am currently trying the attached patch.
diff --git a/gcc/melt-build.tpl b/gcc/melt-build.tpl
index 10462a4..55fec0d 100644
--- a/gcc/melt-build.tpl
+++ b/gcc/melt-build.tpl
@@ -562,18 +562,22 @@ melt-modules/[+base+].quicklybuilt.so: melt-sources/[+base+].c \
 
 
 #@ [+ (. (tpl-file-line))+]
-melt-tiny-tests: melt-modules melt-sources melt-all-modules melt-all-sources
+melt-sayhello.melt:
+	@date +'(code_chunk say%YM%mhello #{printf("hello_from_MELT on %c pid %%d\n", (int) getpid());}#)' > $@
+#@ [+ (. (tpl-file-line))+]
+
+#@ [+ (. (tpl-file-line))+]
+melt-tiny-tests: melt-sayhello.melt melt-modules melt-sources melt-all-modules melt-all-sources
 # test that a helloworld can be translated
-	@date +'(code_chunk say%YM%mhello #{printf("hello_from_MELT on %c pid %%d\n", (int) getpid());}#)' > melt-sayhello.melt
 	@echo	$(MELTCCAPPLICATION1ARGS) \
-	 $(meltarg_arg)=$<  -frandom-seed=$(shell md5sum melt-sayhello.melt | cut -b-24) \
+	 $(meltarg_arg)=$<  -frandom-seed=$(shell md5sum $< | cut -b-24) \
 	 $(meltarg_module_path)=$(realpath melt-modules) \
 	 $(meltarg_source_path)=$(realpath melt-sources) \
- $(meltarg_workdir)=melt-workdir $(meltarg_inhibitautobuild) \
- $(meltarg_output)=melt-sayhello.c empty-file-for-melt.c > melt-sayhello.args-tmp
-	@mv melt-sayhello.args-tmp melt-sayhello.args
-	@echo -n melt-sayhello.args: ; cat melt-sayhello.args ; echo "* doing " melt-sayhello
-	$(melt_make_cc1) @melt-sayhello.args
+   $(meltarg_workdir)=melt-workdir $(meltarg_inhibitautobuild) $(meltarg_bootstrapping) \
+   $(meltarg_output)=$(basename $<).c empty-file-for-melt.c > $(basename $<).args-tmp
+	@mv $(basename $<).args-tmp $(basename $<).args
+	@echo -n $(basename $<).args: ; cat $(basename $<).args ; echo "* doing " $(basename $<)
+	$(melt_make_cc1) @$(basename $<).args
 #@ [+ (. (tpl-file-line))+]
 
 


Re: [PATCH] [MELT] Fix loading of .c files

2011-08-29 Thread Alexandre Lissy
Le 29/08/2011 16:44, Alexandre Lissy a écrit :
> Le 29/08/2011 15:15, Basile Starynkevitch a écrit :
>> On Mon, Aug 29, 2011 at 12:21:12PM +0200, Alexandre Lissy wrote:
>>> Files containing the MELT translated to C code were not loaded correctly
>>> due to bad search path when working with an installed plugin. Present
>>> commit fixes this by:
>>>  - using a melt find to search in current dir
>>>  - ensuring the melt_modulename in melt descriptor only contains the
>>>module name, and no path component
>>
>> Are you sure of that patch?  It seems that it loops on the hello world tiny 
>> test I added in the MELT branch rev 178154
>>
>> Does it work for you when merging with latest MELT updates (ie when applying 
>> that patch to rev  178154 of the MELT branch?
>>
>> (I am investigating)
>>
>> Cheers.
>>
> 
> Okay, once fixing your Makefile it's okay:
> 
> $ LC_ALL=C time -p gcc -c @melt-sayhello.args
> cc1: note: MELT is bootstrapping so ignore builtin source directory
> /usr/lib64/gcc/x86_64-mandriva-linux-gnu/4.6.1/plugin/melt-sources
> cc1: note: MELT is bootstrapping so ignore builtin module directory
> /usr/lib64/gcc/x86_64-mandriva-linux-gnu/4.6.1/plugin/melt-modules
> cc1: note: MELT generating C code of module melt-sayhello
> cc1: note: MELT generated same file melt-sayhello.c in
> /home/alex/BuildSystem/gcc-plugin-melt/BUILD/melt-0.8.99-plugin-for-gcc-4.6
> cc1: note: MELT generated descriptor file melt-sayhello+meltdesc.c
> cc1: note: MELT generated C code of module melt-sayhello with 0
> secondary files in 10 CPU millisec.
> real 0.06
> user 0.02
> sys 0.02
> 
> The bug was: -fplugin-arg-melt-arg=melt-modules. I suspect it's this
> line in melt-build.tpl:
> $(meltarg_arg)=$<  -frandom-seed=$(shell md5sum melt-sayhello.melt | cut
> -b-24) \
> 
> The '$<' part ... But I have no idea of your intentions.
> 

I suspect '$<' should be replaced by 'melt-sayhello.melt' to get
-fplugin-arg-melt-arg=melt-sayhello.melt

At least, it goes well doing this ...


Re: [PATCH] [MELT] Fix loading of .c files

2011-08-29 Thread Alexandre Lissy
Le 29/08/2011 15:15, Basile Starynkevitch a écrit :
> On Mon, Aug 29, 2011 at 12:21:12PM +0200, Alexandre Lissy wrote:
>> Files containing the MELT translated to C code were not loaded correctly
>> due to bad search path when working with an installed plugin. Present
>> commit fixes this by:
>>  - using a melt find to search in current dir
>>  - ensuring the melt_modulename in melt descriptor only contains the
>>module name, and no path component
> 
> Are you sure of that patch?  It seems that it loops on the hello world tiny 
> test I added in the MELT branch rev 178154
> 
> Does it work for you when merging with latest MELT updates (ie when applying 
> that patch to rev  178154 of the MELT branch?
> 
> (I am investigating)
> 
> Cheers.
> 

Okay, once fixing your Makefile it's okay:

$ LC_ALL=C time -p gcc -c @melt-sayhello.args
cc1: note: MELT is bootstrapping so ignore builtin source directory
/usr/lib64/gcc/x86_64-mandriva-linux-gnu/4.6.1/plugin/melt-sources
cc1: note: MELT is bootstrapping so ignore builtin module directory
/usr/lib64/gcc/x86_64-mandriva-linux-gnu/4.6.1/plugin/melt-modules
cc1: note: MELT generating C code of module melt-sayhello
cc1: note: MELT generated same file melt-sayhello.c in
/home/alex/BuildSystem/gcc-plugin-melt/BUILD/melt-0.8.99-plugin-for-gcc-4.6
cc1: note: MELT generated descriptor file melt-sayhello+meltdesc.c
cc1: note: MELT generated C code of module melt-sayhello with 0
secondary files in 10 CPU millisec.
real 0.06
user 0.02
sys 0.02

The bug was: -fplugin-arg-melt-arg=melt-modules. I suspect it's this
line in melt-build.tpl:
$(meltarg_arg)=$<  -frandom-seed=$(shell md5sum melt-sayhello.melt | cut
-b-24) \

The '$<' part ... But I have no idea of your intentions.


Re: [PATCH] [MELT] Fix loading of .c files

2011-08-29 Thread Alexandre Lissy
Le 29/08/2011 15:15, Basile Starynkevitch a écrit :
> On Mon, Aug 29, 2011 at 12:21:12PM +0200, Alexandre Lissy wrote:
>> Files containing the MELT translated to C code were not loaded correctly
>> due to bad search path when working with an installed plugin. Present
>> commit fixes this by:
>>  - using a melt find to search in current dir
>>  - ensuring the melt_modulename in melt descriptor only contains the
>>module name, and no path component
> 
> Are you sure of that patch?  It seems that it loops on the hello world tiny 
> test I added in the MELT branch rev 178154
> 
> Does it work for you when merging with latest MELT updates (ie when applying 
> that patch to rev  178154 of the MELT branch?
> 
> (I am investigating)
> 
> Cheers.
> 

And on a second run, I get:

$ LC_ALL=C gcc -c @melt-sayhello.args
cc1: warning: MELT cannot access module makefile
/usr/lib64/gcc/x86_64-mandriva-linux-gnu/4.6.1/plugin/melt-module.mk :
No such file or directory [enabled by default]
cc1: error: cannot load MELT module list melt-default-modules
cc1: note: MELT source path
/home/alex/BuildSystem/gcc-plugin-melt/BUILD/melt-0.8.99-plugin-for-gcc-4.6/melt-sources
cc1: note: builtin MELT source directory
/usr/lib64/gcc/x86_64-mandriva-linux-gnu/4.6.1/plugin/melt-sources
cc1: error: MELT fatal failure from melt-runtime.c:9050 [MELT built Aug
29 2011]
cc1: error: MELT failed at melt-runtime.c:9050 in directory
/home/alex/BuildSystem/gcc-plugin-melt/BUILD/melt-0.8.99-plugin-for-gcc-4.6

SHORT BACKTRACE[#0] MELT fatal failure;
#1:_ {melt-runtime.c:9020:: meltgc_load_module_list start depth 0
modlistbase melt-default-modules}
#2:_ {melt-runtime.c:9347:: meltgc_load_modules_and_do_mode before
loading curmod @@} .

cc1: error: MELT got fatal failure from melt-runtime.c:9050
cc1: fatal error: MELT failed to load module list
melt-default-modules.modlis
compilation terminated.


Re: [PATCH] [MELT] Fix loading of .c files

2011-08-29 Thread Alexandre Lissy
Le 29/08/2011 15:15, Basile Starynkevitch a écrit :
> On Mon, Aug 29, 2011 at 12:21:12PM +0200, Alexandre Lissy wrote:
>> Files containing the MELT translated to C code were not loaded correctly
>> due to bad search path when working with an installed plugin. Present
>> commit fixes this by:
>>  - using a melt find to search in current dir
>>  - ensuring the melt_modulename in melt descriptor only contains the
>>module name, and no path component
> 
> Are you sure of that patch?  It seems that it loops on the hello world tiny 
> test I added in the MELT branch rev 178154
> 
> Does it work for you when merging with latest MELT updates (ie when applying 
> that patch to rev  178154 of the MELT branch?
> 
> (I am investigating)
> 
> Cheers.
> 

I did a contrib/gcc_update, cherry-pick'd my patch and for now it builds
well, however I ran into:

* doing  melt-sayhello
gcc -c @melt-sayhello.args
gcc: erreur: missing argument to ‘-frandom-seed=’
make: *** [melt-tiny-tests] Erreur 1
rm gfmeltgcc_revision gfmeltgcc_version_number


Re: [PATCH] [MELT] Fix loading of .c files

2011-08-29 Thread Alexandre Lissy
Le 29/08/2011 15:15, Basile Starynkevitch a écrit :
> On Mon, Aug 29, 2011 at 12:21:12PM +0200, Alexandre Lissy wrote:
>> Files containing the MELT translated to C code were not loaded correctly
>> due to bad search path when working with an installed plugin. Present
>> commit fixes this by:
>>  - using a melt find to search in current dir
>>  - ensuring the melt_modulename in melt descriptor only contains the
>>module name, and no path component
> 
> Are you sure of that patch?  It seems that it loops on the hello world tiny 
> test I added in the MELT branch rev 178154
At least it works here with MELT as a plugin.

> 
> Does it work for you when merging with latest MELT updates (ie when applying 
> that patch to rev  178154 of the MELT branch?
> 
> (I am investigating)
> 
> Cheers.
> 



[PATCH] [MELT] Fix loading of .c files

2011-08-29 Thread Alexandre Lissy
Files containing the MELT translated to C code were not loaded correctly
due to bad search path when working with an installed plugin. Present
commit fixes this by:
 - using a melt find to search in current dir
 - ensuring the melt_modulename in melt descriptor only contains the
   module name, and no path component
---
 gcc/ChangeLog.MELT   |6 ++
 gcc/melt-runtime.c   |   24 ++--
 gcc/melt/warmelt-outobj.melt |7 ++-
 3 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/gcc/ChangeLog.MELT b/gcc/ChangeLog.MELT
index cfdac12..241c862 100644
--- a/gcc/ChangeLog.MELT
+++ b/gcc/ChangeLog.MELT
@@ -1,3 +1,9 @@
+2011-08-29  Alexandre Lissy  
+   * melt-runtime.c (melt_load_module_index): Fix loading path of .c
+   files.
+   * melt/warmelt-outobj.melt (output_melt_descriptor): Fix generation
+   of melt_modulename (taking basename).
+
 2011-08-27  Pierre Vittet  
 
* melt-build.tpl (warmelt-upgrade-translator): replace move-if-change
diff --git a/gcc/melt-runtime.c b/gcc/melt-runtime.c
index dd11a6e..cf8e0cc 100644
--- a/gcc/melt-runtime.c
+++ b/gcc/melt-runtime.c
@@ -8683,6 +8683,8 @@ melt_load_module_index (const char*srcbase, const 
char*flavor)
 {
   FILE *sfil = 0;
   char *curpath = 0;
+  char *srcpath = 0;
+  const char* srcpathstr = melt_argument ("source-path");
   int nbsecfile = 0;
   int cursecix = 0;
   time_t gentim = 0;
@@ -8701,7 +8703,15 @@ melt_load_module_index (const char*srcbase, const 
char*flavor)
 melt_run_preprocessed_md5);
   nbsecfile = *(MELTDESCR_REQUIRED(melt_lastsecfileindex));
   debugeprintf ("melt_load_module_index descmodulename %s nbsecfile %d", 
descmodulename, nbsecfile);
-  curpath = concat (descmodulename, ".c", NULL);
+  srcpath = concat (descmodulename, ".c", NULL);
+  curpath = 
+  MELT_FIND_FILE (srcpath,
+   MELT_FILE_IN_DIRECTORY, ".",
+   MELT_FILE_IN_PATH, srcpathstr,
+   MELT_FILE_IN_PATH, getenv ("GCCMELT_SOURCE_PATH"),
+   MELT_FILE_IN_DIRECTORY, melt_source_dir,
+   NULL);
+  debugeprintf ("melt_load_module_index srcpath %s ", srcpath);
   sfil = fopen (curpath, "r");
   if (!sfil) 
warning (0,
@@ -8714,6 +8724,7 @@ melt_load_module_index (const char*srcbase, const 
char*flavor)
 curpath, MELTDESCR_REQUIRED (melt_primaryhexmd5));
  fclose (sfil), sfil = NULL;
};
+  free (srcpath), srcpath = NULL;
   free (curpath), curpath = NULL;
   for (cursecix = 1; cursecix < nbsecfile; cursecix++) 
{
@@ -8722,7 +8733,15 @@ melt_load_module_index (const char*srcbase, const 
char*flavor)
continue;
  memset (suffixbuf, 0, sizeof(suffixbuf));
  snprintf (suffixbuf, sizeof(suffixbuf)-1, "+%02d.c", cursecix);
- curpath = concat (descmodulename, suffixbuf, NULL);
+ srcpath = concat (descmodulename, suffixbuf, NULL);
+  curpath = 
+  MELT_FIND_FILE (srcpath,
+   MELT_FILE_IN_DIRECTORY, ".",
+   MELT_FILE_IN_PATH, srcpathstr,
+   MELT_FILE_IN_PATH, getenv ("GCCMELT_SOURCE_PATH"),
+   MELT_FILE_IN_DIRECTORY, melt_source_dir,
+   NULL);
+  debugeprintf ("melt_load_module_index srcpath %s ", srcpath);
  sfil = fopen (curpath, "r");
  if (!sfil) 
warning (0,
@@ -8737,6 +8756,7 @@ melt_load_module_index (const char*srcbase, const 
char*flavor)
 curpath, 
MELTDESCR_REQUIRED(melt_secondaryhexmd5tab)[cursecix]);
  fclose (sfil), sfil = NULL;
};
+  free (srcpath), srcpath = NULL;
  free (curpath), curpath = NULL;
};
   if (MELTDESCR_OPTIONAL(melt_genversionstr)
diff --git a/gcc/melt/warmelt-outobj.melt b/gcc/melt/warmelt-outobj.melt
index 0a63efb..a8b9650 100644
--- a/gcc/melt/warmelt-outobj.melt
+++ b/gcc/melt/warmelt-outobj.melt
@@ -3791,7 +3791,12 @@
 (add2sbuf_strconst debuf " */")
 (add2sbuf_indentnl debuf 0)
 (add2sbuf_strconst debuf "const char melt_modulename[]=\"")
-(add2sbuf_cencstring  debuf modnamstr)
+(code_chunk
+ genmodnamstr
+ #{ /* output_melt_descriptor $GENMODNAMSTR + */
+ meltgc_add_strbuf_cstr ($DEBUF, lbasename (melt_string_str($MODNAMSTR)));
+ }#
+)
 (add2sbuf_strconst debuf "\";")
 (add2sbuf_indentnl debuf 0)
 (add2sbuf_strconst debuf "const char melt_modulerealpath[]=\"")
-- 
1.7.6



[PATCH] [MELT] Fix slashes in paths

2011-08-25 Thread Alexandre Lissy

Removing useless slashes in path to avoid issues when RPM extracts debug
informations.
---
 contrib/ChangeLog.MELT   |3 +++
 contrib/MELT-Plugin-Makefile |   30 +++---
 gcc/ChangeLog.MELT   |3 +++
 gcc/melt-module.mk   |8 
 4 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/contrib/ChangeLog.MELT b/contrib/ChangeLog.MELT
index 953fb65..0b63775 100644
--- a/contrib/ChangeLog.MELT
+++ b/contrib/ChangeLog.MELT
@@ -1,4 +1,7 @@
 2011-08-25  Alexandre Lissy  
+	* MELT-Plugin-Makefile: Remove useless '/' after $(DESTDIR)
+
+2011-08-25  Alexandre Lissy  
 	* meltpluginapi.texi: Adding missing versionsubtitle macro
 
 2011-08-25  Alexandre Lissy  
diff --git a/contrib/MELT-Plugin-Makefile b/contrib/MELT-Plugin-Makefile
index 8625c09..0609cd5 100644
--- a/contrib/MELT-Plugin-Makefile
+++ b/contrib/MELT-Plugin-Makefile
@@ -275,28 +275,28 @@ install: all melt.so warmelt  \
 install-melt-mk install-melt-default-modules-list install-melt-so
 
 install-melt-includes: melt-runtime.h melt-predef.h melt-run.h melt-run-md5.h melt/generated/meltrunsup.h
-	$(mkinstalldirs) $(DESTDIR)/$(MELTGCC_PLUGIN_DIR)/include/
+	$(mkinstalldirs) $(DESTDIR)$(MELTGCC_PLUGIN_DIR)/include/
 	for f in $^; do \
-	   $(INSTALL_DATA) $$f $(DESTDIR)/$(MELTGCC_PLUGIN_DIR)/include/ ; \
+	   $(INSTALL_DATA) $$f $(DESTDIR)$(MELTGCC_PLUGIN_DIR)/include/ ; \
 	done
 
 install-melt-so: melt.so
-	$(INSTALL_PROGRAM) $< $(DESTDIR)/$(MELTGCC_PLUGIN_DIR)/melt.so
+	$(INSTALL_PROGRAM) $< $(DESTDIR)$(MELTGCC_PLUGIN_DIR)/melt.so
 
 
 
 ### notice that melt-sources is a directory, but melt-all-sources is a
 ### phony makefile target from melt-build.mk
 install-melt-sources: melt-sources  melt-all-sources
-	$(mkinstalldirs) $(DESTDIR)/$(melt_source_dir)
+	$(mkinstalldirs) $(DESTDIR)$(melt_source_dir)
 	for f in melt-sources/*.c melt-sources/*.melt ; do \
-	   $(INSTALL_DATA) $$f $(DESTDIR)/$(melt_source_dir) ; \
+	   $(INSTALL_DATA) $$f $(DESTDIR)$(melt_source_dir) ; \
 	done
 
 ### notice that melt-modules is a directory, but melt-all-modules is a
 ### phony makefile target from melt-build.mk
 install-melt-modules: melt-modules melt-all-modules
-	$(mkinstalldirs) $(DESTDIR)/$(melt_module_dir)
+	$(mkinstalldirs) $(DESTDIR)$(melt_module_dir)
 	for l in $(wildcard melt-modules/*) : ; do \
 	   if [ "$$l" != ":" ]; then \
 	  $(INSTALL_PROGRAM) `readlink $$l` $(DESTDIR)$(melt_module_dir)/$$(basename `readlink $$l`) ; \
@@ -306,18 +306,18 @@ install-melt-modules: melt-modules melt-all-modules
 
 ## install the makefile for MELT modules
 install-melt-mk: melt-module.mk
-	$(mkinstalldirs) $(DESTDIR)/$(libexecsubdir)
-	$(INSTALL_DATA) $< $(DESTDIR)/$(melt_installed_module_makefile)
+	$(mkinstalldirs) $(DESTDIR)$(libexecsubdir)
+	$(INSTALL_DATA) $< $(DESTDIR)$(melt_installed_module_makefile)
 
 ## install the default modules list
 install-melt-default-modules-list: $(melt_default_modules_list).modlis 
-	$(INSTALL_DATA) $< $(DESTDIR)/$(melt_module_dir) 
+	$(INSTALL_DATA) $< $(DESTDIR)$(melt_module_dir) 
 
 ### install the MELT documentation files
 install-melt-doc: doc doc-info doc-pdf doc-html
-	$(mkinstalldirs) $(DESTDIR)/$(MELTGCC_DOC_INFO_DIR)
-	$(INSTALL_DATA) *.info *.info-*[0-9] $(DESTDIR)/$(MELTGCC_DOC_INFO_DIR)
-	$(mkinstalldirs) $(DESTDIR)/$(MELTGCC_DOC_HTML_DIR)
-	$(INSTALL_DATA) *.html $(DESTDIR)/$(MELTGCC_DOC_HTML_DIR)
-	$(mkinstalldirs) $(DESTDIR)/$(MELTGCC_DOC_PDF_DIR)
-	$(INSTALL_DATA) *.pdf $(DESTDIR)/$(MELTGCC_DOC_PDF_DIR)
+	$(mkinstalldirs) $(DESTDIR)$(MELTGCC_DOC_INFO_DIR)
+	$(INSTALL_DATA) *.info *.info-*[0-9] $(DESTDIR)$(MELTGCC_DOC_INFO_DIR)
+	$(mkinstalldirs) $(DESTDIR)$(MELTGCC_DOC_HTML_DIR)
+	$(INSTALL_DATA) *.html $(DESTDIR)$(MELTGCC_DOC_HTML_DIR)
+	$(mkinstalldirs) $(DESTDIR)$(MELTGCC_DOC_PDF_DIR)
+	$(INSTALL_DATA) *.pdf $(DESTDIR)$(MELTGCC_DOC_PDF_DIR)
diff --git a/gcc/ChangeLog.MELT b/gcc/ChangeLog.MELT
index ceb0d04..3379208 100644
--- a/gcc/ChangeLog.MELT
+++ b/gcc/ChangeLog.MELT
@@ -1,4 +1,7 @@
 2011-08-25  Alexandre Lissy  
+	* melt-module.mk: Remove double slashes (makes RPM unhappy)
+
+2011-08-25  Alexandre Lissy  
 	* contrib/meltpluginapi.texi: Fix nodes (thanks to Patrice Dumas
 	
 
diff --git a/gcc/melt-module.mk b/gcc/melt-module.mk
index ef2d07f..b0426f5 100644
--- a/gcc/melt-module.mk
+++ b/gcc/melt-module.mk
@@ -125,7 +125,7 @@ $(GCCMELT_MODULE_WORKSPACE)/%.optimized.pic.o:
 	echo optimized base3name at  $(basename $(basename $(basename $@)))
 	echo optimized base4name at  $(basename $(basename $(basename $(basename $@
 	$(GCCMELT_CC) -DMELTGCC_MODULE_OPTIMIZED  -DMELT_HAVE_DEBUG=0  $(GCCMELT_OPTIMIZED_FLAGS) $(GCCMELT_CFLAGS) \
-	   -fPIC -c -o $@  $(patsubst %, $(GCCMELT_SOURCEDIR)/%.c, $(basename $(basename $(basename $(basename $(notdir $@))
+	   -fPIC -c -o $@  $(patsubst %, $(GCCMELT_SOURCEDIR)%.c, $(basename $(basename $(basename $(basename $(notdir $@))
 
 vpath

[PATCH, MELT] Multiple slashes in paths

2011-08-25 Thread Alexandre Lissy
Hello,

There are some points in MELT build where several slashes are used and
present in paths, mainly when calling GCC. This is bad not only for
cosmetic reasons, but it also makes rpm not happy when extracting debug
symbols. The following patch fixes this.



[PATCH, MELT] Fixing PDF documentation generation

2011-08-25 Thread Alexandre Lissy
Hello,

The texi file defining the MELT Plugin API was missing the
versionsubtitle macro definition (which is however present in
meltplugin.texi), and this resulted in PDF documentation generation
failing. Following patch fixes this by adding the macro to
meltpluginapi.texi.



[PATCH] [MELT] Missign macro versionsubtitle

2011-08-25 Thread Alexandre Lissy

The MELT Plugin API texi source misses the macro versionsubtitle which
is also defined in meltplugin.texi. This commit simply steals the
definition from the last one.
---
 contrib/ChangeLog.MELT |3 +++
 contrib/meltpluginapi.texi |   10 ++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/contrib/ChangeLog.MELT b/contrib/ChangeLog.MELT
index 01aaf4c..953fb65 100644
--- a/contrib/ChangeLog.MELT
+++ b/contrib/ChangeLog.MELT
@@ -1,4 +1,7 @@
 2011-08-25  Alexandre Lissy  
+	* meltpluginapi.texi: Adding missing versionsubtitle macro
+
+2011-08-25  Alexandre Lissy  
 	* MELT-Plugin-Makefile: Adding target to build .html and .pdf
 
 2011-08-25  Alexandre Lissy  
diff --git a/contrib/meltpluginapi.texi b/contrib/meltpluginapi.texi
index b71ec38..75413c5 100644
--- a/contrib/meltpluginapi.texi
+++ b/contrib/meltpluginapi.texi
@@ -2,6 +2,16 @@
 @c %**start of header
 @setfilename meltpluginapi.info
 @c don't need @include gcc-common.texi
+@c Macro to generate a "For the N.N.N version" subtitle on the title
+@c page of TeX documentation.  This macro should be used in the
+@c titlepage environment after the title and any other subtitles have
+@c been placed, and before any authors are placed.
+@macro versionsubtitle
+@subtitle For @sc{MELT} plugin of @sc{gcc}
+@c Even if there are no authors, the second titlepage line should be
+@c forced to the bottom of the page.
+@vskip 0pt plus 1filll
+@end macro
 
 @settitle MELT plugin API (generated documentation)
 


[PATCH] [MELT] HTML and PDF targets for plugin doc

2011-08-25 Thread Alexandre Lissy

Plugin documentation was being built as .info file thanks to the
default's make .info target, but none were defined for HTML and PDF. The
present commit add the missing targets.
---
 contrib/ChangeLog.MELT   |3 +++
 contrib/MELT-Plugin-Makefile |9 +
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/contrib/ChangeLog.MELT b/contrib/ChangeLog.MELT
index 42f2aca..01aaf4c 100644
--- a/contrib/ChangeLog.MELT
+++ b/contrib/ChangeLog.MELT
@@ -1,4 +1,7 @@
 2011-08-25  Alexandre Lissy  
+	* MELT-Plugin-Makefile: Adding target to build .html and .pdf
+
+2011-08-25  Alexandre Lissy  
 	* MELT-Plugin-Makefile (install-melt-modules): Fix installation paths
 
 2011-07-18  Basile Starynkevitch  
diff --git a/contrib/MELT-Plugin-Makefile b/contrib/MELT-Plugin-Makefile
index a4be1f0..8625c09 100644
--- a/contrib/MELT-Plugin-Makefile
+++ b/contrib/MELT-Plugin-Makefile
@@ -66,6 +66,9 @@ MAKEINFO?= makeinfo
 ## the GNU texi2pdf utility from makeinfo 
 TEXI2PDF?= texi2pdf
 
+## the GNU texi2html utility from makeinfo 
+TEXI2HTML?= texi2html
+
 ## an install driver, which could be sudo or echo, or stay empty
 INSTALL_DRIVER?=
 
@@ -246,6 +249,12 @@ MELTDOCPDF= $(patsubst %.texi,%.pdf,$(MELTDOCSRC))
 MELTDOCINFO= $(patsubst %.texi,%.info,$(MELTDOCSRC))
 MELTDOCHTML= $(patsubst %.texi,%.html,$(MELTDOCSRC))
 
+%.html: %.texi
+	$(TEXI2HTML) $(TEXI2HTML_FLAGS) $< -o $@
+
+%.pdf: %.texi
+	$(TEXI2PDF) $(TEXI2PDF_FLAGS) $< -o $@
+
 doc: meltgendoc.texi meltplugin.texi meltpluginapi.texi doc-pdf doc-info doc-html
 
 doc-pdf: $(MELTDOCPDF)


[PATCH, MELT] Plugin documentation generation

2011-08-25 Thread Alexandre Lissy
Hello,

Documentation for the MELT plugin was only produced as .info file, but
the PDF and HTML output were missing. This was due to missing target for
both ; hence the following patch which fixes by defining two targets:
 - %.html
 - %.pdf
Simply calling respectivement $(TEXI2HTML) and $(TEXI2PDF).



[PATCH] [MELT] Fix installation of MELT modules

2011-08-25 Thread Alexandre Lissy

Path computation for installation in GCC's plugin/melt-modules/ path was
broken (in fact not updated to the latest changes). Present commit fixes
this by reading the link targets and installing them.
---
 contrib/ChangeLog.MELT   |2 ++
 contrib/MELT-Plugin-Makefile |   10 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/contrib/ChangeLog.MELT b/contrib/ChangeLog.MELT
index 9b8123c..42f2aca 100644
--- a/contrib/ChangeLog.MELT
+++ b/contrib/ChangeLog.MELT
@@ -1,3 +1,5 @@
+2011-08-25  Alexandre Lissy  
+	* MELT-Plugin-Makefile (install-melt-modules): Fix installation paths
 
 2011-07-18  Basile Starynkevitch  
 	* MELT-Plugin-Makefile (melt_make_move): Use move-if-change.
diff --git a/contrib/MELT-Plugin-Makefile b/contrib/MELT-Plugin-Makefile
index 5e5baae..a4be1f0 100644
--- a/contrib/MELT-Plugin-Makefile
+++ b/contrib/MELT-Plugin-Makefile
@@ -288,13 +288,13 @@ install-melt-sources: melt-sources  melt-all-sources
 ### phony makefile target from melt-build.mk
 install-melt-modules: melt-modules melt-all-modules
 	$(mkinstalldirs) $(DESTDIR)/$(melt_module_dir)
-	for d in $(wildcard melt-modules/*); do \
-	  $(mkinstalldirs) $(DESTDIR)/$(melt_module_dir)/`basename $$d` ; \
-	  for f in $$d/*.so ; do \
-	 $(INSTALL_PROGRAM) $$f $(DESTDIR)/$(melt_module_dir)/`basename $$d`/`basename $$f ` ; \
-	  done; \
+	for l in $(wildcard melt-modules/*) : ; do \
+	   if [ "$$l" != ":" ]; then \
+	  $(INSTALL_PROGRAM) `readlink $$l` $(DESTDIR)$(melt_module_dir)/$$(basename `readlink $$l`) ; \
+	   fi; \
 	done
 
+
 ## install the makefile for MELT modules
 install-melt-mk: melt-module.mk
 	$(mkinstalldirs) $(DESTDIR)/$(libexecsubdir)


Re: [PATCH] [MELT] Fix installation of MELT modules

2011-08-25 Thread Alexandre Lissy
Hello,

Thanks for your suggestions. I made the suggested changes, I hope it
matches your requirements :).



[PATCH] [MELT] Fix installation of MELT modules

2011-08-25 Thread Alexandre Lissy

Path computation for installation in GCC's plugin/melt-modules/ path was
broken (in fact not updated to the latest changes). Present commit fixes
this by reading the link targets and installing them.
---
 contrib/ChangeLog.MELT   |2 ++
 contrib/MELT-Plugin-Makefile |8 +++-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/contrib/ChangeLog.MELT b/contrib/ChangeLog.MELT
index 9b8123c..42f2aca 100644
--- a/contrib/ChangeLog.MELT
+++ b/contrib/ChangeLog.MELT
@@ -1,3 +1,5 @@
+2011-08-25  Alexandre Lissy  
+	* MELT-Plugin-Makefile (install-melt-modules): Fix installation paths
 
 2011-07-18  Basile Starynkevitch  
 	* MELT-Plugin-Makefile (melt_make_move): Use move-if-change.
diff --git a/contrib/MELT-Plugin-Makefile b/contrib/MELT-Plugin-Makefile
index 5e5baae..7ab032a 100644
--- a/contrib/MELT-Plugin-Makefile
+++ b/contrib/MELT-Plugin-Makefile
@@ -288,13 +288,11 @@ install-melt-sources: melt-sources  melt-all-sources
 ### phony makefile target from melt-build.mk
 install-melt-modules: melt-modules melt-all-modules
 	$(mkinstalldirs) $(DESTDIR)/$(melt_module_dir)
-	for d in $(wildcard melt-modules/*); do \
-	  $(mkinstalldirs) $(DESTDIR)/$(melt_module_dir)/`basename $$d` ; \
-	  for f in $$d/*.so ; do \
-	 $(INSTALL_PROGRAM) $$f $(DESTDIR)/$(melt_module_dir)/`basename $$d`/`basename $$f ` ; \
-	  done; \
+	for l in $(wildcard melt-modules/*); do \
+	  $(INSTALL_PROGRAM) `readlink $$l` $(DESTDIR)/$(melt_module_dir)/$$(basename `readlink $$l`) ; \
 	done
 
+
 ## install the makefile for MELT modules
 install-melt-mk: melt-module.mk
 	$(mkinstalldirs) $(DESTDIR)/$(libexecsubdir)


[PATCH, MELT] MELT modules installation fix

2011-08-25 Thread Alexandre Lissy
Hello,

Changes recently happened on the MELT modules which broke the way the
install-melt-modules target in MELT's Makefile in the plugin case works.
Attached is a patch that fixes this.



[PATCH] [MELT] Fix nodes in MELT plugin API texi

2011-08-25 Thread Alexandre Lissy

Several nodes were not present in the menu, fixing. Thanks to Patrice
Dumas .
---
 contrib/meltpluginapi.texi |3 +++
 gcc/ChangeLog.MELT |4 
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/contrib/meltpluginapi.texi b/contrib/meltpluginapi.texi
index b2d843f..b71ec38 100644
--- a/contrib/meltpluginapi.texi
+++ b/contrib/meltpluginapi.texi
@@ -84,6 +84,9 @@ Additional tutorial information for GCC is linked to from
 
 @menu
 * MELT Programming Reference::the MELT API.
+* GNU Project::
+* Copying::   the GPLv3 license.
+* MELT API Index::
 @end menu
 
 @c the meltgendoc.texi is generated from various *.melt source files
diff --git a/gcc/ChangeLog.MELT b/gcc/ChangeLog.MELT
index c801737..ceb0d04 100644
--- a/gcc/ChangeLog.MELT
+++ b/gcc/ChangeLog.MELT
@@ -1,4 +1,8 @@
 2011-08-25  Alexandre Lissy  
+	* contrib/meltpluginapi.texi: Fix nodes (thanks to Patrice Dumas
+	
+
+2011-08-25  Alexandre Lissy  
 	* gcc/melt-build.tpl: Allow build to "fail" ; meltgentdoc.texi target
 	might return 1 while the generation was successful
 


[PATCH, MELT] Fixing texi file for MELT Plugin API

2011-08-25 Thread Alexandre Lissy
Hello,

A couple of nodes in the texi file for the MELT Plugin API were not
present in the menu, hence makeinfo failed. Fixing with help from
Patrice Dumas .



[PATCH] [MELT] Allow build to "fail"

2011-08-25 Thread Alexandre Lissy

The meltgendoc.texi target runs GCC and might return a value of 1 which
confuses make while the texi file was correctly generated ; thus, adding
'|| true' allows for the build to continue instead of stopping.
---
 gcc/ChangeLog.MELT |4 
 gcc/melt-build.tpl |2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/gcc/ChangeLog.MELT b/gcc/ChangeLog.MELT
index f32e960..c801737 100644
--- a/gcc/ChangeLog.MELT
+++ b/gcc/ChangeLog.MELT
@@ -1,4 +1,8 @@
 2011-08-25  Alexandre Lissy  
+	* gcc/melt-build.tpl: Allow build to "fail" ; meltgentdoc.texi target
+	might return 1 while the generation was successful
+
+2011-08-25  Alexandre Lissy  
 	* gcc/melt/melt-build.tpl: Fix meltgendoc.texi target (missing .texi
 	extension for generated file)
 
diff --git a/gcc/melt-build.tpl b/gcc/melt-build.tpl
index 87f920b..afbee1f 100644
--- a/gcc/melt-build.tpl
+++ b/gcc/melt-build.tpl
@@ -617,7 +617,7 @@ meltgendoc.texi: $(melt_default_modules_list).modlis \
   empty-file-for-melt.c > $(notdir $(basename $@)).args-tmp
 	mv  $(notdir $(basename $@)).args-tmp  $(notdir $(basename $@)).args
 	@echo -n $(notdir $(basename $@)).args: ; cat $(notdir $(basename $@)).args ; echo "* doing " $@
-	$(melt_make_cc1) @$(notdir $(basename $@)).args
+	$(melt_make_cc1) @$(notdir $(basename $@)).args || true
 
 
 vpath %.so $(melt_make_module_dir) . 


[PATCH, MELT] meltgendoc.texi "failure"

2011-08-25 Thread Alexandre Lissy
Hello,

The meltgendoc.texi target can "fail", returning a value of 1 while the
file has been correctly written. The attached patch allows to circumvent
this.



[PATCH, MELT] Fixing documentation generation

2011-08-25 Thread Alexandre Lissy
Hello,

A prevoous commit introduced a typo on the output argument when generating
documentation, hence the attached commit fixes the issue.



[PATCH] [MELT] Fix meltgendoc.texi target

2011-08-25 Thread Alexandre Lissy

A previous commit has introduced a change for melt output argument in
meltgendoc.texi target: going from $@ ti $(basename $@). This is bad
since we are loosing the extension of the filename, hence the build
process is stopped because of missing meltgendoc.texi file.
---
 gcc/ChangeLog.MELT |4 
 gcc/melt-build.tpl |2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/gcc/ChangeLog.MELT b/gcc/ChangeLog.MELT
index a341a49..f32e960 100644
--- a/gcc/ChangeLog.MELT
+++ b/gcc/ChangeLog.MELT
@@ -1,4 +1,8 @@
 2011-08-25  Alexandre Lissy  
+	* gcc/melt/melt-build.tpl: Fix meltgendoc.texi target (missing .texi
+	extension for generated file)
+
+2011-08-25  Alexandre Lissy  
 	* gcc/melt/melt-build.tpl: Use -quicklybuilt instead of -static for
 	consistency with the whole build system
 	* contrib/MELT-Plugin-Makefile: Using -quicklybuilt instead of
diff --git a/gcc/melt-build.tpl b/gcc/melt-build.tpl
index e3e8282..87f920b 100644
--- a/gcc/melt-build.tpl
+++ b/gcc/melt-build.tpl
@@ -611,7 +611,7 @@ meltgendoc.texi: $(melt_default_modules_list).modlis \
 	  $(meltarg_init)=@$(melt_default_modules_list) \
 	  $(meltarg_module_path)=$(realpath melt-modules):. \
 	  $(meltarg_source_path)=$(realpath melt-sources):. \
-	  $(meltarg_output)=$(basename $@)  \
+	  $(meltarg_output)=$(basename $@).texi  \
   $(meltarg_arglist)=[+FOR melt_translator_file+][+base+].melt,[+ENDFOR melt_translator_file+]\
 [+FOR melt_application_file "," +][+base+].melt[+ENDFOR melt_application_file+] \
   empty-file-for-melt.c > $(notdir $(basename $@)).args-tmp


[PATCH] Fix .so handling on failure

2011-08-23 Thread Alexandre Lissy

When an invalid handle from dlopen() was generated, the else branch
corresponding was not at the right place and was a child of
'if (!quiet_flag || flag_melt_debug)' condition. This leads to unloading
of shared library just loaded by MELT runtime when debug is not enabled,
hence the next call to mi->mmi_startrout() in
meltgc_start_module_by_index would refer to an invalid address (shared
library unloaded at the time of the call).
---
 gcc/ChangeLog.MELT |3 +++
 gcc/melt-runtime.c |   10 +-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/gcc/ChangeLog.MELT b/gcc/ChangeLog.MELT
index f4cc6a5..4282321 100644
--- a/gcc/ChangeLog.MELT
+++ b/gcc/ChangeLog.MELT
@@ -1,3 +1,6 @@
+2011-08-23  Alexandre Lissy 
+	* melt-runtime.c (melt_load_module_index): Correct handling of invalid
+	dlopen handle.
 
 2011-08-05  Basile Starynkevitch  
 	* melt-runtime.c (melt_run_make_for_plugin): Don't use fullbinfile.
diff --git a/gcc/melt-runtime.c b/gcc/melt-runtime.c
index 8eea8f1..ca580a4 100644
--- a/gcc/melt-runtime.c
+++ b/gcc/melt-runtime.c
@@ -8764,11 +8764,11 @@ melt_load_module_index (const char*srcbase, const char*flavor)
 		  MELTDESCR_REQUIRED(melt_gen_timestamp), 
 		  MELTDESCR_REQUIRED(melt_build_timestamp));
   }
-  else 
-	{
-	  debugeprintf ("melt_load_module_index invalid dlh %p sopath %s", dlh, sopath);
-	  dlclose (dlh), dlh = NULL;
-	}
+}
+else 
+{
+	debugeprintf ("melt_load_module_index invalid dlh %p sopath %s", dlh, sopath);
+	dlclose (dlh), dlh = NULL;
 }
  end:
   if (srcpath) 


[PATCH, MELT] Calling unloaded shared library

2011-08-23 Thread Alexandre Lissy
Hello,

The following patch fixes a 'small' issue I have been facing since a
couple of days: MELT would not be able to call the start_module_melt()
symbol that is present in warmelt-first(...).so. It turned out that the
shared library where *unloaded* at run time ; each one being loaded and
then unloaded.

This was due to a misplaced else branch which is supposed to check the
handler returned by dlopen is valid, and if it is not then unload the
library ; this check has been displaced as an alternative to the
presence of debug options. Since I was not using debug, the else branch
was taken and thus the shared library as unloaded.



[PATCH] Fix regression with unexistent symbol 'fullbinfile'

2011-08-05 Thread Alexandre Lissy

This symbol has been changed to binbase a couple of commits ago, yet
some places remained untouched for the new name.
---
 gcc/melt-runtime.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/melt-runtime.c b/gcc/melt-runtime.c
index 32a4288..ad49ccb 100644
--- a/gcc/melt-runtime.c
+++ b/gcc/melt-runtime.c
@@ -5044,13 +5044,13 @@ melt_run_make_for_plugin (const char*ourmakecommand, const char*ourmakefile, con
 melt_fatal_error ("MELT module compilation failed for command %s", cmdstr);
   cmdstr = NULL;
   obstack_free (&cmd_obstack, NULL); /* free all the cmd_obstack */
-  debugeprintf ("melt_run_make_for_plugin meltplugin did built fullbinfile %s", 
-		fullbinfile);
-  if (IS_ABSOLUTE_PATH (fullbinfile))
-inform (UNKNOWN_LOCATION, "MELT plugin has built module %s", fullbinfile);
+  debugeprintf ("melt_run_make_for_plugin meltplugin did built binbase %s", 
+		binbase);
+  if (IS_ABSOLUTE_PATH (binbase))
+inform (UNKNOWN_LOCATION, "MELT plugin has built module %s", binbase);
   else
 inform (UNKNOWN_LOCATION, "MELT plugin has built module %s in %s",
-	fullbinfile, mycwd);
+	binbase, mycwd);
   return;
 }
 


[MELT] Fix MELT breakage at build

2011-08-05 Thread Alexandre Lissy
Hello,

Following is a trivial patch patch that fixes build of the current
melt-branch, due to some previous commit changing identifier
"fullbinfile" to "binbase" in function parameters but not in some usages
at the end of the function.



[PATCH] MELT: Separate build and install steps

2011-06-27 Thread Alexandre Lissy
In order to ease a bit packaging, this commit add two switches to the
current build infrastructure of "GCC MELT as plugin":
 - "-b" which runs the script to build GCC MELT
 - "-i" which runs the script to install GCC MELT
Both are mutually exclusive.
---
 ChangeLog.MELT   |4 
 contrib/build-melt-plugin.sh |   32 +---
 2 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/ChangeLog.MELT b/ChangeLog.MELT
index d00a4e1..2b88e00 100644
--- a/ChangeLog.MELT
+++ b/ChangeLog.MELT
@@ -1,3 +1,7 @@
+2011-06-27  Alexandre Lissy 
+
+   * contrib/build-melt-plugin.sh: Adding -b and -i switches to separate
+ build from install.
 
 2011-06-27  Basile Starynkevitch  
 
diff --git a/contrib/build-melt-plugin.sh b/contrib/build-melt-plugin.sh
index 5ee8c3b..0119742 100644
--- a/contrib/build-melt-plugin.sh
+++ b/contrib/build-melt-plugin.sh
@@ -41,6 +41,8 @@ usage() {
 echo " -B buildpath  # sets the GCC build path, e.g. -B /tmp/gcc-build" 
 echo " -M meltpath   # sets the GCC-MELT source subtree, e.g. 
/usr/src/gcc-melt/gcc" 
 echo " -Y your/gt-melt-runtime.h  # force the gengtype generated 
gt-melt-runtime.h" 
+echo " -b  # building MELT"
+echo " -i  # installing MELT"
 echo "$progname is for building MELT as a plugin, not a branch."
 echo "run $progname -h to get help" >&2
 exit 1
@@ -86,6 +88,8 @@ set_default_variables() {
 gcc_target=""
 gcc_plugin_directory=""
 quiet=""
+install=""
+build=""
 timestamp_file=build-gccmelt-timestamp
 gtypelist_file=buildmelt-gtype-input.list
 }
@@ -121,10 +125,20 @@ verbose_sleep() {
  parsing the shell program argument
 parse_args() {
 progname=$0
-while getopts "hqs:S:B:Y:M:C:" opt ; do
+while getopts "hqbis:S:B:Y:M:C:" opt ; do
case $opt in
h) usage;;
q) quiet=1;;
+b) 
+   echo build-melt-plugin: entering build mode
+   build=1;
+   install=""
+   ;;
+i) 
+   echo build-melt-plugin: entering install mode
+   build="";
+   install=1
+   ;;
s) 
verbose_echo Evaluating $OPTARG;
eval "$OPTARG"
@@ -450,12 +464,16 @@ verbose_sleep
 #
 # here we go!
 sanity_checks_gcc_info
-get_gty_melt_header
-build_melt_run_headers
-build_melt_dot_so
-bootstrap_melt
-make_melt_documentation
-install_melt
+if [ ! -z "$build" ]; then
+   get_gty_melt_header
+   build_melt_run_headers
+   build_melt_dot_so
+   bootstrap_melt
+   make_melt_documentation
+fi
+if [ ! -z "$install" ]; then
+   install_melt
+fi
 
 verbose_echo MELT plugin building terminated
 if [ ! -z "$quiet" ]; then
-- 
1.7.6



[MELT] Separation between build and install

2011-06-27 Thread Alexandre Lissy
Hello,

While packaging GCC MELT as a plugin for Mandriva, I noticed that we
could do a slight improvement to the current build script to ease a bit
packaging, by adding a clear separation between the building steps and
installation steps. This allows to "cleanly" exploit the build script in
both %build and %install sections of the RPM spec file. Separation is
handled by adding two new switches, -b and -i which respectively enables
the build process and installation process. Both are of course mutually
exclusive, and it is expected that installation process is ran using the
same command line arguments as building (just changing -b to -i).



[PATCH 3/4] Regenerating melt-build.mk

2011-03-07 Thread Alexandre Lissy
---
 gcc/melt-build.mk |  128 ++--
 1 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/gcc/melt-build.mk b/gcc/melt-build.mk
index f00e43b..e75229e 100644
--- a/gcc/melt-build.mk
+++ b/gcc/melt-build.mk
@@ -164,7 +164,7 @@ melt-stage0-static/warmelt-first-0.so: 
$(MELT_GENERATED_FIRST_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-static/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-static \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/warmelt-first-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-static/warmelt-first-0
@@ -174,7 +174,7 @@ melt-stage0-dynamic/warmelt-first-0.d.so: 
$(MELT_GENERATED_FIRST_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module_dynamic \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/warmelt-first-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-dynamic/warmelt-first-0
@@ -188,7 +188,7 @@ melt-stage0-static/warmelt-base-0.so: 
$(MELT_GENERATED_BASE_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-static/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-static \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/warmelt-base-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-static/warmelt-base-0
@@ -198,7 +198,7 @@ melt-stage0-dynamic/warmelt-base-0.d.so: 
$(MELT_GENERATED_BASE_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module_dynamic \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/warmelt-base-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-dynamic/warmelt-base-0
@@ -212,7 +212,7 @@ melt-stage0-static/warmelt-debug-0.so: 
$(MELT_GENERATED_DEBUG_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-static/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-static \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/warmelt-debug-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-static/warmelt-debug-0
@@ -222,7 +222,7 @@ melt-stage0-dynamic/warmelt-debug-0.d.so: 
$(MELT_GENERATED_DEBUG_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module_dynamic \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/warmelt-debug-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-dynamic/warmelt-debug-0
@@ -236,7 +236,7 @@ melt-stage0-static/warmelt-macro-0.so: 
$(MELT_GENERATED_MACRO_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-static/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-static \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/warmelt-macro-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-static/warmelt-macro-0
@@ -246,7 +246,7 @@ melt-stage0-dynamic/warmelt-macro-0.d.so: 
$(MELT_GENERATED_MACRO_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module_dynamic \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/warmelt-macro-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-dynamic/warmelt-macro-0
@@ -260,7 +260

[PATCH 2/4] Fix double '/' in MELT build process

2011-03-07 Thread Alexandre Lissy
Double slashes while building are a problem for RPM's debugedit tool,
which seems to be 'well-known', while never fixed. The only solution is
to fix the build process. Also, remove any trailing slash from
MELTMODULE_SRCDIR variable, since slashes are added when used.
---
 gcc/melt-build.tpl |8 
 gcc/melt-module.mk |2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/melt-build.tpl b/gcc/melt-build.tpl
index 20c0012..4666990 100644
--- a/gcc/melt-build.tpl
+++ b/gcc/melt-build.tpl
@@ -107,7 +107,7 @@ melt-stage0-static/[+base+]-0.so: 
$(MELT_GENERATED_[+mkvarsuf+]_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-static/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-static \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/[+base+]-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-static/[+base+]-0
@@ -117,7 +117,7 @@ melt-stage0-dynamic/[+base+]-0.d.so: 
$(MELT_GENERATED_[+mkvarsuf+]_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module_dynamic \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/[+base+]-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-dynamic/[+base+]-0
@@ -181,7 +181,7 @@ $(MELT_STAGE_ZERO):
   melt-run.h melt-runtime.h melt-predef.h \
   $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module \
-  GCCMELT_MODULE_WORKSPACE=[+melt_stage+]/ \
+  GCCMELT_MODULE_WORKSPACE=[+melt_stage+] \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  GCCMELT_MODULE_SOURCE=[+melt_stage+]/[+ (. outbase)+]-[+(. 
stageindex)+].c \
   GCCMELT_MODULE_BINARY=[+melt_stage+]/[+(. outbase)+]-[+(. 
stageindex)+]
@@ -191,7 +191,7 @@ $(MELT_STAGE_ZERO):
   melt-run.h melt-runtime.h melt-predef.h \
   $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module_withoutline \
-  GCCMELT_MODULE_WORKSPACE=[+melt_stage+]/ \
+  GCCMELT_MODULE_WORKSPACE=[+melt_stage+] \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  GCCMELT_MODULE_SOURCE=[+melt_stage+]/[+ (. outbase)+]-[+(. 
stageindex)+].c \
   GCCMELT_MODULE_BINARY=[+melt_stage+]/[+(. outbase)+]-[+(. 
stageindex)+]
diff --git a/gcc/melt-module.mk b/gcc/melt-module.mk
index 38dad9b..3f45736 100644
--- a/gcc/melt-module.mk
+++ b/gcc/melt-module.mk
@@ -46,7 +46,7 @@ endif
 
 MELTMODULE_BASENAME:=$(basename $(GCCMELT_MODULE_SOURCE))
 MELTMODULE_PLAIN:=$(notdir $(MELTMODULE_BASENAME))
-MELTMODULE_SRCDIR:=$(dir $(GCCMELT_MODULE_SOURCE))
+MELTMODULE_SRCDIR:=$(patsubst %/, %, $(dir $(GCCMELT_MODULE_SOURCE)))
 
 
 ## The .d.so & .n.so suffixes are wired in melt-runtime.c!
-- 
1.7.4.1



[PATCH 4/4] Updating MELT ChangeLog

2011-03-07 Thread Alexandre Lissy
---
 ChangeLog.MELT |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/ChangeLog.MELT b/ChangeLog.MELT
index b18e8ff..0e52116 100644
--- a/ChangeLog.MELT
+++ b/ChangeLog.MELT
@@ -1,3 +1,7 @@
+2011-03-07 Alexandre Lissy 
+
+   * Fixing issues in compilation process for RPM packaging
+   * Regenerating melt-build.mk
 
 2011-02-07 Basile Starynkevitch  
 MELT branch merged with trunk rev 169877 [probably!]
-- 
1.7.4.1



[PATCH 1/4] Fix RPM compilation

2011-03-07 Thread Alexandre Lissy
The GCC's options -pipe and -Wp,-D_FORTIFY_SOURCE=2 are passed by
default by Mandriva's GCC RPM spec file, and end up in some parts of
MELT CFLAGS. But they should not end up there.
---
 gcc/Makefile.in |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 3f1ffa0..f841776 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -5341,6 +5341,7 @@ MELT_RAW_CFLAGS= \
 ## since the generated routines are no more huge (since the
 ## initialization code is split in several chunks).. Likewise, avoid
 ## passing -gtoggle and -g
+## Also remove -pipe and -Wp,-D_FORTIFY_SOURCE=2
 MELTHERE_CFLAGS= $(filter-out -g, $(filter-out -gtoggle, $(MELT_RAW_CFLAGS)))
 export MELTHERE_CFLAGS
 
@@ -5430,7 +5431,10 @@ melt_make_source_dir=$(srcdir)/melt
 melt_make_module_dir=$(objdir)
 melt_make_move=$(SHELL) $(srcdir)/../move-if-change
 ## Don't use := definitions here!
-melt_make_cc1flags= -I. $(MELTHERE_CFLAGS) -I $(melt_build_include_dir)
+## CC1 forbids -pipe and -Wp,-D_FORTIFY_SOURCE=2
+comma= ,
+MELTHERE_CC1_CFLAGS=$(filter-out -pipe -Wp$(comma)-D_FORTIFY_SOURCE=2, 
$(MELTHERE_CFLAGS))
+melt_make_cc1flags= -I. $(MELTHERE_CC1_CFLAGS) -I $(melt_build_include_dir)
 melt_cflags=  -I. $(MELTHERE_CFLAGS) -I $(melt_build_include_dir)
 export melt_cflags
 ## extra cflags are for compiling applicative MELT files, e.g. xtramelt*.c
-- 
1.7.4.1



[MELT] Fixing compilation issues

2011-03-07 Thread Alexandre Lissy
Hello,

Sorry for the delay, but I had no time to perform this small change while
attending ROADEF 2011 :).
So, here we go, same patches again, with ChangeLog.MELT updated.