Patchwork [MELT] Fix loading of .c files

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

Comments

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

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