Skip to content

Commit

Permalink
Merge pull request #156 from goblint/issue_136
Browse files Browse the repository at this point in the history
Add option `silenceLongDoubleWarning`
  • Loading branch information
michael-schwarz authored Oct 3, 2023
2 parents 13efd21 + 8095737 commit c7ffc37
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/frontc/cabs2cil.ml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ let continueOnError = true
(** Turn on tranformation that forces correct parameter evaluation order *)
let forceRLArgEval = ref false

(** By default, we warn as large constants cannot be appropriately represented as OCaml floats.
This can be set to true by tools that are aware of this problem and only use the string component of CReal
to avoid emitting warnings that are spurious in that context. *)
let silenceLongDoubleWarning = ref false

(** Leave a certain global alone. Use a negative number to disable. *)
let nocil: int ref = ref (-1)

Expand Down Expand Up @@ -3706,7 +3711,7 @@ and doExp (asconst: bool) (* This expression is used as a constant *)
else
str, FDouble
in
if kind = FLongDouble || kind = FFloat128 then
if (kind = FLongDouble || kind = FFloat128) && not !silenceLongDoubleWarning then
(* We only have 64-bit values in Ocaml *)
E.log "treating %a constant %s as double constant at %a (only relevant if first argument of CReal is used).\n"
d_fkind kind str d_loc !currentLoc;
Expand Down
5 changes: 5 additions & 0 deletions src/frontc/cabs2cil.mli
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ val convFile: Cabs.file -> Cil.file
(** Turn on tranformation that forces correct parameter evaluation order *)
val forceRLArgEval: bool ref

(** By default, we warn as large constants cannot be appropriately represented as OCaml floats.
This can be set to true by tools that are aware of this problem and only use the string component of CReal
to avoid emitting warnings that are spurious in that context. *)
val silenceLongDoubleWarning: bool ref

(** Set this integer to the index of the global to be left in CABS form. Use
-1 to disable *)
val nocil: int ref
Expand Down

0 comments on commit c7ffc37

Please sign in to comment.