Frama-C-discuss mailing list archives

This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] Whether could I know in advance it would have errors before adding a file (Kernel.Files.add)?


  • Subject: [Frama-c-discuss] Whether could I know in advance it would have errors before adding a file (Kernel.Files.add)?
  • From: abiao.yang at gmail.com (David Yang)
  • Date: Tue, 17 Sep 2013 08:19:07 +0800

>
> you can try to parse the file alone in an independent project and
> catch the exception that is raised by the parser in case of user
> error. e.g. something like (not tested)
> ...
> let prepare_file f = try File.init_from_c_files [File.from_filename
> f]; true with Log.AbortError s -> MyPlugin.warning "Not adding %s
> because of %s" f s; false in
> let prj = Project.create "tmp" in
> let is_ok = Project.on prj prepare_file "foo.c" in
> Project.remove prj;
> if is_ok then Kernel.Files.add "foo.c";
> ...
> Best regards,
> --
> E tutto per oggi, a la prossima volta
> Virgile


Dear Virgile,

Thank you for providing me this solution. It works fine.

Best regards,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/frama-c-discuss/attachments/20130917/a0ab61fc/attachment-0001.html>