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

[Frama-c-discuss] Unknows Pragma



> How do I get frama-c to understand these pragmas?
>
> #pragma LINK_INFO DERIVATIVE ? "MC9S12C32"
> #pragma LINK_INFO OSCFREQUENCY "16000000"

That's easy, if by "understand" you mean "ignore":
grep them out at pre-processing (after pre-processing,
in case these pragmas are found inside include files).

Use the option:

-cpp-command "gcc -C -E -I. - < %1  | grep -v pragma\ LINK_INFO > %2"

in addition to what you were already doing.

You may find that the option -cpp-command does not
handle the tokens %1 and %2 as documented.
That's an unfortunate bug. But since you are already setting
yourself up for compiling Frama-C from sources with
your exotic target architecture, it won't be too much additional
trouble to apply the following patch :

--- src/kernel/file.ml	(revision 8516)
+++ src/kernel/file.ml	(working copy)
@@ -498,7 +498,7 @@
 	  in
 	  (* Format.eprintf "-cpp-command cmd2=|%s|@\n" cmd2; *)
           let cmd3 =
-	    String.sub cmdl (percent2 + 2) (String.length cmdl - percent2 + 2)
+	    String.sub cmdl (percent2 + 2) (String.length cmdl - (percent2 + 2))
           in
 	  (* Format.eprintf "-cpp-command cmd3=|%s|@\n" cmd3; *)
           Format.sprintf "%s%s %s %s%s%s" cmd1