aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Ceval.mli
diff options
context:
space:
mode:
authorXavier Leroy <xavierleroy@users.noreply.github.com>2018-04-26 18:00:36 +0200
committerGitHub <noreply@github.com>2018-04-26 18:00:36 +0200
commitf1d9a90486ac2744e0f2096eeaeedac117af5b9a (patch)
tree17da3fcddc04d9710f245a64e6124d7d13807c6a /cparser/Ceval.mli
parent7d91167706b72103ddf9f4088cf02dd9761fdf47 (diff)
downloadcompcert-kvx-f1d9a90486ac2744e0f2096eeaeedac117af5b9a.tar.gz
compcert-kvx-f1d9a90486ac2744e0f2096eeaeedac117af5b9a.zip
Earlier, more comprehensive check for constant initializers (#88)
This commit checks *during elaboration* that initializers for global variables or local static variables are compile-time constants. Before this commit, some non-constant initializers were detected later in the C2C pass, but others were eliminated by the Cleanup pass before being checked, and yet others could cause the Rename pass to abort. To determine which variables are constant l-values, we leverage the recent addition of the Storage_auto storage class and base the determination on the storage class of the identifier: 'auto' or 'register' is not constant, the others are constant.
Diffstat (limited to 'cparser/Ceval.mli')
-rw-r--r--cparser/Ceval.mli2
1 files changed, 2 insertions, 0 deletions
diff --git a/cparser/Ceval.mli b/cparser/Ceval.mli
index 7425a332..32a0ed91 100644
--- a/cparser/Ceval.mli
+++ b/cparser/Ceval.mli
@@ -16,3 +16,5 @@
val integer_expr : Env.t -> C.exp -> int64 option
val constant_expr : Env.t -> C.typ -> C.exp -> C.constant option
val normalize_int : int64 -> C.ikind -> int64
+val is_constant_init: Env.t -> C.init -> bool
+val is_constant_expr: Env.t -> C.exp -> bool