--- layout: fc_discuss_archives title: Message 8 from Frama-C-discuss on June 2010 ---
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] Unknows Pragma



Hello,

> How can we make it working with this?
>
> extern volatile PORTABSTR _PORTAB @(REG_BASE + 0x00000000);

If you only wish to remove the "@(...)" part, that's very possible.
I realise though that this may turn my small pre-processor
into a full-fledged implementation of the commanline utility sed[1]
and that perhaps sed was the program to use from the beginning.

Let's just combine the two for the time being:
___

#pragma bar
#pragma foo
#pragma zut
#pragma LINK_INFO blah, blah

extern volatile int _PORTAB @(REG_BASE + 0x00000000);

int main()
{
	return 0; /* hopefully all goes well. */
}
___

bin/toplevel.opt -cpp-command "gcc -C -E -I. %1 | gr |  sed -e
s/@\\(.*\\)//g > %2" -print test.c

The output of gcc is sent to gr, and
the output of gr is sent to the sed command s/@\(.*\)//g
The blackslashes in the later command needs to be escaped
when inside the double quotes of the Frama-C commandline,
but this command simply replaces strings that match @(...)
with nothing. Hopefully you do not have occurrences of this
pattern that mustn't be suppressed in your source code?

Pascal


[1] http://www.grymoire.com/Unix/Sed.html