From c7adc93617712acdde0ea81649eff11ada7d96b9 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 24 Feb 2020 20:22:45 +0100 Subject: The type of a wide char constant is wchar_t. (#223) See ISO C2011 standard, section 6.4.4.4 para 11. --- cparser/Elab.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cparser/Elab.ml') diff --git a/cparser/Elab.ml b/cparser/Elab.ml index 9aa6761c..f60e15a3 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -452,7 +452,8 @@ let elab_constant loc = function let (v, fk) = elab_float_constant f in CFloat(v, fk) | CONST_CHAR(wide, s) -> - CInt(elab_char_constant loc wide s, IInt, "") + let ikind = if wide then wchar_ikind () else IInt in + CInt(elab_char_constant loc wide s, ikind, "") | CONST_STRING(wide, s) -> elab_string_literal loc wide s -- cgit From 039b532ae972292ec2f726505422afd49569b738 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 4 Mar 2020 18:18:40 +0100 Subject: Include typedef name in error message (#228) In case of redefinition of a typedef name with a different type. --- cparser/Elab.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cparser/Elab.ml') diff --git a/cparser/Elab.ml b/cparser/Elab.ml index f60e15a3..9e17cb7e 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -2428,8 +2428,8 @@ let enter_typedef loc env sto (s, ty, init) = env end else begin - error loc "typedef redefinition with different types (%a vs %a)" - (print_typ env) ty (print_typ env) ty'; + error loc "redefinition of typedef '%s' with different type (%a vs %a)" + s (print_typ env) ty (print_typ env) ty'; env end | _ -> -- cgit