From f88acb4875bbad6d6d1c96dabe5073724fd9c9e7 Mon Sep 17 00:00:00 2001 From: Virgile Prevosto <virgile.prevosto@m4x.org> Date: Mon, 19 Feb 2024 18:44:29 +0100 Subject: [PATCH] [IR] Remove constructors for inexisting types --- convert.ml | 10 +++++----- convert_acsl.ml | 10 ++-------- fclang_datatype.ml | 2 -- framaCIRGen_src/ACSLLogicType.cpp | 11 ++++------- framaCIRGen_src/ACSLTermOrPredicate.cpp | 2 +- intermediate_format.ast | 2 -- mangling.ml | 2 -- 7 files changed, 12 insertions(+), 27 deletions(-) diff --git a/convert.ml b/convert.ml index 7f39ea8f..2bbb4b5e 100644 --- a/convert.ml +++ b/convert.ml @@ -141,9 +141,9 @@ let make_integral_constant_kind k v = let s = match k with | IBool - | IChar_s | ISChar | IWChar_s | IWSChar + | IChar_s | ISChar | IWChar_s | IChar | IWChar | IShort | IInt -> "" - | IChar_u | IUChar | IChar16 | IChar32 | IWChar_u | IWUChar + | IChar_u | IUChar | IChar16 | IChar32 | IWChar_u | IUShort | IUInt -> "U" | ILong -> "L" | IULong -> "UL" @@ -154,10 +154,10 @@ let make_integral_constant_kind k v = let is_unsigned_kind = function | IBool -> true (* standard says that bool is neither signed nor unsigned, but at some point you have to take sides. *) - | IChar_s | ISChar | IWChar_s | IWSChar -> false + | IChar_s | ISChar | IWChar_s -> false | IChar | IWChar -> Cil.theMachine.theMachine.char_is_unsigned | IShort | IInt -> false - | IChar_u | IUChar | IChar16 | IChar32 | IWChar_u | IWUChar + | IChar_u | IUChar | IChar16 | IChar32 | IWChar_u | IUShort | IUInt -> true | ILong | ILongLong -> false | IULong | IULongLong -> true @@ -601,7 +601,7 @@ let rec convert_base_type env spec decl typ does_remove_virtual = greater size. *) | Int IChar16 -> spec_of_ikind (Cil.intKindForSize 2 true) @ spec, decl | Int IChar32 -> spec_of_ikind (Cil.intKindForSize 4 true) @ spec, decl - | Int (IWChar_u | IWChar_s | IWUChar | IWSChar | IWChar ) -> + | Int (IWChar_u | IWChar_s | IWChar ) -> let wchar_name = { prequalification=[];decl_name="fc_wchar_t"} in let base = if Convert_env.has_typedef env wchar_name then begin diff --git a/convert_acsl.ml b/convert_acsl.ml index 1a64c514..cd5be731 100644 --- a/convert_acsl.ml +++ b/convert_acsl.ml @@ -44,18 +44,12 @@ let convert_logic_label_opt = function let convert_ikind = function | IBool -> Cil_types.IBool - | IChar_u -> Cil_types.IChar - | IChar_s -> Cil_types.IChar + | IChar_u | IChar_s | IChar -> Cil_types.IChar | IUChar -> Cil_types.IUChar | ISChar -> Cil_types.ISChar | IChar16 -> Cil.intKindForSize 2 true | IChar32 -> Cil.intKindForSize 4 true - | IWChar_u - | IWChar_s - | IWUChar - | IWSChar -> Cil.theMachine.Cil.wcharKind - | IChar -> Cil_types.IChar - | IWChar -> Cil.theMachine.Cil.wcharKind + | IWChar_u | IWChar_s | IWChar -> Cil.theMachine.Cil.wcharKind | IShort -> Cil_types.IShort | IUShort -> Cil_types.IUShort | IInt -> Cil_types.IInt diff --git a/fclang_datatype.ml b/fclang_datatype.ml index 1a89bafb..0e8651e4 100644 --- a/fclang_datatype.ml +++ b/fclang_datatype.ml @@ -83,8 +83,6 @@ and pretty_type fmt typ = | IChar32 -> Format.pp_print_string fmt "char32_t" | IWChar_u | IWChar_s -> Format.pp_print_string fmt "wchar_t" - | IWUChar -> Format.pp_print_string fmt "unsigned wchar_t" - | IWSChar -> Format.pp_print_string fmt "signed wchar_t" | IChar -> Format.pp_print_string fmt "char" | IWChar -> Format.pp_print_string fmt "wchar_t" | IShort -> Format.pp_print_string fmt "short" diff --git a/framaCIRGen_src/ACSLLogicType.cpp b/framaCIRGen_src/ACSLLogicType.cpp index 034f23a8..09d8d650 100644 --- a/framaCIRGen_src/ACSLLogicType.cpp +++ b/framaCIRGen_src/ACSLLogicType.cpp @@ -36,7 +36,6 @@ bool is_signed(ikind i, Parser::Arguments &context) { case ICHAR_U: case IUCHAR: case IWCHAR_U: - case IWUCHAR: case IUSHORT: case IUINT: case IULONG: @@ -872,8 +871,9 @@ LogicType::readToken(Parser::State& state, Parser::Arguments& arguments) { DefineAddErrorAndParse("'unsigned' meaningless for char16_t") case ICHAR32: DefineAddErrorAndParse("'unsigned' meaningless for char32_t") + case IWCHAR: + DefineAddErrorAndParse("'unsigned' meaningless for wchar_t") case IUCHAR: - case IWUCHAR: case IUSHORT: case IUINT: case IULONG: @@ -882,9 +882,6 @@ LogicType::readToken(Parser::State& state, Parser::Arguments& arguments) { case ICHAR: _typeResult->cons_logic_type.Lint.kind = IUCHAR; break; - case IWCHAR: - _typeResult->cons_logic_type.Lint.kind = IWUCHAR; - break; case ISHORT: _typeResult->cons_logic_type.Lint.kind = IUSHORT; break; @@ -916,8 +913,9 @@ LogicType::readToken(Parser::State& state, Parser::Arguments& arguments) { DefineAddErrorAndParse("'signed' meaningless for char16_t") case ICHAR32: DefineAddErrorAndParse("'signed' meaningless for char32_t") + case IWCHAR: + DefineAddErrorAndParse("'signed' meaningless for wchar_t") case IUCHAR: - case IWUCHAR: case IUSHORT: case IUINT: case IULONG: @@ -925,7 +923,6 @@ LogicType::readToken(Parser::State& state, Parser::Arguments& arguments) { DefineAddErrorAndParse( "mixing 'signed' and 'unsigned' in type specification") case ICHAR: - case IWCHAR: case ISHORT: case ILONG: case ILONGLONG: diff --git a/framaCIRGen_src/ACSLTermOrPredicate.cpp b/framaCIRGen_src/ACSLTermOrPredicate.cpp index 6dbc2d5d..74a4653c 100644 --- a/framaCIRGen_src/ACSLTermOrPredicate.cpp +++ b/framaCIRGen_src/ACSLTermOrPredicate.cpp @@ -674,7 +674,7 @@ TermOrPredicate::isSignedInteger(logic_type ctype, Parser::Arguments& context) { if (ctype->tag_logic_type == LINT) { ikind kind = ctype->cons_logic_type.Lint.kind; result = (kind == ICHAR_S || kind == ISCHAR || kind == IWCHAR_S - || kind == IWSCHAR || kind == ISHORT || kind == IINT || kind == ILONG); + || kind == ISHORT || kind == IINT || kind == ILONG); } else if (ctype->tag_logic_type == LINTEGER) result = true; diff --git a/intermediate_format.ast b/intermediate_format.ast index 34b149ca..0977d392 100644 --- a/intermediate_format.ast +++ b/intermediate_format.ast @@ -33,8 +33,6 @@ type ikind = | IChar32 { } (* char32_t. Same as uint_least32_t *) | IWChar_u { } | IWChar_s { } - | IWUChar { } - | IWSChar { } | IChar { } | IWChar { } | IShort { } diff --git a/mangling.ml b/mangling.ml index 936f417f..cdb00451 100644 --- a/mangling.ml +++ b/mangling.ml @@ -152,8 +152,6 @@ let mangle_ikind = function | IShort -> "s" | IUShort -> "t" | IWChar | IWChar_s | IWChar_u -> "w" - | IWUChar -> "u6WUChar" - | IWSChar -> "u6WSChar" let mangle_fkind = function | FFloat -> "f" -- GitLab