Patchwork [MELT] Fix loading of .c files

login
register
mail settings
Submitter Alexandre Lissy
Date Aug. 29, 2011, 3:24 p.m.
Message ID <4E5BAF18.4070907@mandriva.com>
Download mbox | patch
Permalink /patch/112090/
State New
Headers show

Comments

Alexandre Lissy - Aug. 29, 2011, 3:24 p.m.
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 ...

Patch

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))+]