[LinuxBIOS] romcc and preprocessor problems

Ben Hewson ben at hewson-venieri.com
Sat Dec 2 10:37:48 CET 2006


Hi Eric

Please find attached some simple test cases.
These were compiled using the following



./romcc -O  -fno-eliminate-inefectual-code
-I../../../../../src/arch/i386/include/  -o testdef3.inc  testdef3.c

if you look at testdef2.c, testdef2.inc you can see that a C++ comment
has caused one line to be missed, no comment or a C comment are fine. I
checked no comments, C comments and C++ comments on both the #if and
#else lines. The one thing I did not check was a C++ comment on the
#endif to see if the following line was missed.

I may be missing needed options for romcc, but I have tried similar
tests in a proper build, with the same results.

regards
Ben


> Stefan Reinauer <stepan at coresystems.de> writes:
>
>   
>> Hi,
>>
>> since the romcc builtin preprocessor silently eats lines of code,
>> can we just use the gcc preprocessor (cpp) before calling romcc as
>> a workaround? 
>>     
>
> I'd love to see a reproducer of that problem.  I don't have a good feel
> that it has been root caused.  The parser is fairly straight forward
> so if we can reproduce this problem it shouldn't be hard to fix.
>
> I'm not convinced the problem is actually isolated to just the c pre processor.
>
>   
>> Is there a reason romcc has its own preprocessor?
>>     
>
> A couple of reasons.
> - It was comparatively easy.
> - It makes the dependencies much easier to get right.
> - We don't have to worry about gcc polluting the compile with #defines
>   that are not correct for the romcc environment.
> - There are several C features that you cannot implement properly unless
>   you implement some level of c preprocessor.
>
> All of that said you can look back into the history to when romcc did not have
> a preprocessor and can probably make that work.  I'd much rather fix
> the stupid parsing bug.
>
> Eric
>
>
>   

-------------- next part --------------
A non-text attachment was scrubbed...
Name: testdef.c
Type: text/x-csrc
Size: 240 bytes
Desc: not available
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20061202/76bc414b/attachment.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testdef.inc
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20061202/76bc414b/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testdef2.c
Type: text/x-csrc
Size: 240 bytes
Desc: not available
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20061202/76bc414b/attachment-0001.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testdef2.inc
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20061202/76bc414b/attachment-0001.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testdef3.c
Type: text/x-csrc
Size: 239 bytes
Desc: not available
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20061202/76bc414b/attachment-0002.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testdef3.inc
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20061202/76bc414b/attachment-0002.ksh>


More information about the coreboot mailing list