aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Elab.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2014-12-30 17:10:43 +0100
committerXavier Leroy <xavier.leroy@inria.fr>2014-12-30 17:10:43 +0100
commit3b8a094dafdeea5499239adadaf24d2b8bdb1f76 (patch)
treef43cb88aa5e8f0d80a11af889b59163e07dac894 /cparser/Elab.ml
parent2d32afc5daf16c75d1a34f2716c34ae2e1efcce4 (diff)
downloadcompcert-3b8a094dafdeea5499239adadaf24d2b8bdb1f76.tar.gz
compcert-3b8a094dafdeea5499239adadaf24d2b8bdb1f76.zip
PR#6: fix handling of wchar_t and assignments from wide string literals.
- cparser/Machine indicates whether wchar_t is signed or not (it is signed int in Linux and BSD, but unsigned short in Win32) - The type of a wide string literal is "wchar_t *" if the typedef "wchar_t" exists in the environment (e.g. after #include <stddef.h>). Only if wchar_t is not defined do we use the default from Machine. - Permit initialization of any integer array from a wide string literal, not just an array of wchar_t.
Diffstat (limited to 'cparser/Elab.ml')
-rw-r--r--cparser/Elab.ml4
1 files changed, 2 insertions, 2 deletions
diff --git a/cparser/Elab.ml b/cparser/Elab.ml
index dd42ae24..f7168eba 100644
--- a/cparser/Elab.ml
+++ b/cparser/Elab.ml
@@ -1087,7 +1087,7 @@ and elab_item zi item il =
| CStr _, _ ->
error loc "initialization of an array of non-char elements with a string literal";
elab_list zi il false
- | CWStr s, TInt(ik, _) when ik = wchar_ikind ->
+ | CWStr s, TInt(ik, _) ->
if not (I.index_below (Int64.of_int(List.length s - 1)) sz) then
warning loc "initializer string for array of wide chars %s is too long"
(I.name zi);
@@ -1198,7 +1198,7 @@ let elab_expr loc env a =
| CONSTANT cst ->
let cst' = elab_constant loc cst in
- { edesc = EConst cst'; etyp = type_of_constant cst' }
+ { edesc = EConst cst'; etyp = type_of_constant env cst' }
(* 6.5.2 Postfix expressions *)