aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Bourke <tim@tbrk.org>2016-11-11 10:53:03 +0100
committerLionel Rieg <lionel.rieg@univ-grenoble-alpes.fr>2020-04-21 01:08:58 +0200
commit365e4f999541d8c8796ccc7210ee8fbf279fb2f1 (patch)
treea7c5fd041a8ae2dd32789bade122a0abc42f2733
parent850a1c46070c089523fa2836a231f66d67cab076 (diff)
downloadcompcert-kvx-365e4f999541d8c8796ccc7210ee8fbf279fb2f1.tar.gz
compcert-kvx-365e4f999541d8c8796ccc7210ee8fbf279fb2f1.zip
Expose the kind of elaborated char constants
-rw-r--r--cparser/Elab.ml8
-rw-r--r--cparser/Elab.mli2
2 files changed, 5 insertions, 5 deletions
diff --git a/cparser/Elab.ml b/cparser/Elab.ml
index 9e17cb7e..73a80c6f 100644
--- a/cparser/Elab.ml
+++ b/cparser/Elab.ml
@@ -420,11 +420,12 @@ let elab_char_constant loc wide chars =
warning loc Unnamed "character constant too long for its type";
(* C99 6.4.4.4 item 10: single character -> represent at type char
or wchar_t *)
- Ceval.normalize_int v
+ let k =
(if List.length chars = 1 then
if wide then wchar_ikind() else IChar
else
- IInt)
+ IInt) in
+ (Ceval.normalize_int v k, k)
let elab_string_literal loc wide chars =
let nbits = if wide then 8 * !config.sizeof_wchar else 8 in
@@ -452,8 +453,7 @@ let elab_constant loc = function
let (v, fk) = elab_float_constant f in
CFloat(v, fk)
| CONST_CHAR(wide, s) ->
- let ikind = if wide then wchar_ikind () else IInt in
- CInt(elab_char_constant loc wide s, ikind, "")
+ CInt(fst (elab_char_constant loc wide s), IInt, "")
| CONST_STRING(wide, s) ->
elab_string_literal loc wide s
diff --git a/cparser/Elab.mli b/cparser/Elab.mli
index 937e86bf..31d9b281 100644
--- a/cparser/Elab.mli
+++ b/cparser/Elab.mli
@@ -15,7 +15,7 @@
val elab_int_constant : Cabs.cabsloc -> string -> int64 * C.ikind
val elab_float_constant : Cabs.floatInfo -> C.float_cst * C.fkind
-val elab_char_constant : Cabs.cabsloc -> bool -> int64 list -> int64
+val elab_char_constant : Cabs.cabsloc -> bool -> int64 list -> int64 * C.ikind
val elab_file : Cabs.definition list -> C.program
(* This is the main entry point. It transforms a list of toplevel