Hi,
On Wed, Apr 07, 2010 at 06:06:16PM -0600, ThanhVu (Vu) Nguyen wrote:
> can I tell CIL to process/output the code without adding the #line X ?
--noPrintLn Do not output #line directives in the output
--commPrintLn Print #line directives in the output, but put
them in comments
--commPrintLnSparse Print commented #line directives in the output
only when the line number changes.
> another question is when I create an empty function with
> emptyFunction("fooname") of type void and then call GFfun() , CIL
> gives something like
>
> void emptyFunction(){
> {
>
> }
> }
>
> is there a way to remove these empty nested { } ?
Define your own cilPrinter (inheriting cilDefaultPrinter). It should be
enough to overload pBlock like this:
method pBlock () (blk: block) =
let rec dofirst () = function
[] -> nil
| [x] -> self#pStmtNext invalidStmt () x
| x :: rest -> dorest nil x rest
and dorest acc prev = function
[] -> acc ++ (self#pStmtNext invalidStmt () prev)
| x :: rest ->
dorest (acc ++ (self#pStmtNext x () prev) ++ line)
x rest
in
(* Skip empty blocks *)
if blk.battrs = [] && blk.bstmts = [] then
nil
else
(* Let the host of the block decide on the alignment. The d_block will
* pop the alignment as well *)
text "{"
++
(if blk.battrs <> [] then
self#pAttrsGen true blk.battrs
else nil)
++ line
++ (dofirst () blk.bstmts)
++ unalign ++ line ++ text "}"
Regards,
--
Gabriel Kerneis
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
CIL-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cil-users