Skip to content
Snippets Groups Projects
  • Julien Signoles's avatar
    b2009ccd
    [e-acsl] Hollydays works (now ready for alpha release): · b2009ccd
    Julien Signoles authored
    * fixes bug:
      - fixed bug in quantifications when the bound variable got C type
      - fixed bug with DEV_FLAGS in Makefile.in
    * implements new E-ACSL features:
      - invariant as assertion
      - existential quantification \exists over integers
      - equivalence <==>
      - \at as a predicate
      - conditional _ ? _ : _ (for terms and predicates)
      - binary boolean operations over terms
      - mixed assumes and ensures in function contracts
    * other new features:
      - better error messages when runtime checks fail 
        (replace e_acsl_fail by e_acsl_assert)
      - remove option -e-acsl-assert
      - add E-ACSL manuals in doc/manuals
      - add files doc/Changelog, INSTALL, README and VERSION
      - new option -e-acsl-version
      - check Frama-C version at configure
      - make src-distrib
      - header 2012
    b2009ccd
    History
    [e-acsl] Hollydays works (now ready for alpha release):
    Julien Signoles authored
    * fixes bug:
      - fixed bug in quantifications when the bound variable got C type
      - fixed bug with DEV_FLAGS in Makefile.in
    * implements new E-ACSL features:
      - invariant as assertion
      - existential quantification \exists over integers
      - equivalence <==>
      - \at as a predicate
      - conditional _ ? _ : _ (for terms and predicates)
      - binary boolean operations over terms
      - mixed assumes and ensures in function contracts
    * other new features:
      - better error messages when runtime checks fail 
        (replace e_acsl_fail by e_acsl_assert)
      - remove option -e-acsl-assert
      - add E-ACSL manuals in doc/manuals
      - add files doc/Changelog, INSTALL, README and VERSION
      - new option -e-acsl-version
      - check Frama-C version at configure
      - make src-distrib
      - header 2012
error.ml 2.73 KiB
(**************************************************************************)
(*                                                                        *)
(*  This file is part of the Frama-C's E-ACSL plug-in.                    *)
(*                                                                        *)
(*  Copyright (C) 2012                                                    *)
(*    CEA (Commissariat  l'nergie atomique et aux nergies              *)
(*         alternatives)                                                  *)
(*                                                                        *)
(*  you can redistribute it and/or modify it under the terms of the GNU   *)
(*  Lesser General Public License as published by the Free Software       *)
(*  Foundation, version 2.1.                                              *)
(*                                                                        *)
(*  It is distributed in the hope that it will be useful,                 *)
(*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *)
(*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *)
(*  GNU Lesser General Public License for more details.                   *)
(*                                                                        *)
(*  See the GNU Lesser General Public License version 2.1                 *)
(*  for more details (enclosed in the file licenses/LGPLv2.1).            *)
(*                                                                        *)
(**************************************************************************)

exception Typing_error of string
let untypable s = raise (Typing_error s)

exception Not_yet of string
let not_yet s = raise (Not_yet s)

module Nb_typing = 
  State_builder.Ref
    (Datatype.Int)
    (struct
      let name = "E_ACSL.Error.Nb_typing"
      let default () = 0
      let dependencies = [ Ast.self ]
      let kind = `Correctness
     end)

let nb_untypable = Nb_typing.get

module Nb_not_yet = 
  State_builder.Ref
    (Datatype.Int)
    (struct
      let name = "E_ACSL.Error.Nb_not_yet"
      let default () = 0
      let dependencies = [ Ast.self ]
      let kind = `Correctness
     end)

let nb_not_yet = Nb_not_yet.get

let handle f x = 
  try
    f x
  with
  | Typing_error s ->
    let msg = Format.sprintf "@[invalid E-ACSL construct@ `%s'.@]" s in
    Options.warning ~current:true "@[%s@ Ignoring annotation.@]" msg;
    Nb_typing.set (Nb_typing.get () + 1);
    x
  | Not_yet s ->
    let msg = 
      Format.sprintf "@[E-ACSL construct@ `%s'@ is not yet supported.@]" s
    in 
    Options.warning ~current:true "@[%s@ Ignoring annotation.@]" msg;
    Nb_not_yet.set (Nb_not_yet.get () + 1);
    x

(*
Local Variables:
compile-command: "make"
End:
*)