diff options
author | Xavier Leroy <xavierleroy@users.noreply.github.com> | 2022-09-19 16:37:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-19 16:37:17 +0200 |
commit | 994c6c34182606385140e5695e33c90507ce59ee (patch) | |
tree | e9291d64997dd3e2ac8660c0e6fbe1b9a597799e /cparser/Cutil.ml | |
parent | 103aa7074a9dd3b1bcb2864d52c89292a2ab7bff (diff) | |
download | compcert-994c6c34182606385140e5695e33c90507ce59ee.tar.gz compcert-994c6c34182606385140e5695e33c90507ce59ee.zip |
Support C11 Unicode string literals and character constants (#452)
* Support C11 Unicode string literals and character constants
* Add tests for C11 string literals and character constants
* Better error message for ill-formed universal character names
E.g. \u followed by fewer than 4 hex digits, or \U followed by fewer than 8 hex digits.
* Add new warning `invalid-utf8` for byte sequences that are not valid UTF8.
The warning is activated but not fatal by default.
* Warn on uses of C11 Unicode character constants and string literals
This uses the `c11-extensions` warning, which is off by default.
* Support preprocessing option -finput-charset= for GNU toolchains
Diffstat (limited to 'cparser/Cutil.ml')
-rw-r--r-- | cparser/Cutil.ml | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cparser/Cutil.ml b/cparser/Cutil.ml index 6fd12323..f226d51b 100644 --- a/cparser/Cutil.ml +++ b/cparser/Cutil.ml @@ -1024,9 +1024,9 @@ let type_of_constant = function | CStr s -> let size = Int64.of_int (String.length s + 1) in TArray(TInt(IChar,[]), Some size, []) - | CWStr s -> + | CWStr(s, ik) -> let size = Int64.of_int (List.length s + 1) in - TArray(TInt(wchar_ikind(), []), Some size, []) + TArray(TInt(ik, []), Some size, []) | CEnum(_, _) -> TInt(IInt, []) (* Check that a C expression is a lvalue *) |