Skip to content

Commit 808818b

Browse files
committed
Various cleanup
1 parent ccd11f5 commit 808818b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+226
-110
lines changed

src/analyses/goto_check.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -934,8 +934,6 @@ void goto_checkt::pointer_validity_check(
934934
local_bitvector_analysist::flagst flags=
935935
local_bitvector_analysis->get(t, pointer);
936936

937-
const typet &dereference_type=pointer_type.subtype();
938-
939937
// For Java, we only need to check for null
940938
if(mode==ID_java)
941939
{
@@ -1044,7 +1042,7 @@ void goto_checkt::pointer_validity_check(
10441042
{
10451043
const or_exprt dynamic_bounds(
10461044
dynamic_object_lower_bound(pointer, ns, access_lb),
1047-
dynamic_object_upper_bound(pointer, dereference_type, ns, access_ub));
1045+
dynamic_object_upper_bound(pointer, ns, access_ub));
10481046

10491047
add_guarded_claim(
10501048
or_exprt(
@@ -1065,7 +1063,7 @@ void goto_checkt::pointer_validity_check(
10651063
{
10661064
const or_exprt object_bounds(
10671065
object_lower_bound(pointer, ns, access_lb),
1068-
object_upper_bound(pointer, dereference_type, ns, access_ub));
1066+
object_upper_bound(pointer, ns, access_ub));
10691067

10701068
add_guarded_claim(
10711069
or_exprt(allocs, dynamic_object(pointer), not_exprt(object_bounds)),

src/ansi-c/ansi_c_entry_point.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ Author: Daniel Kroening, [email protected]
2222
exprt::operandst build_function_environment(
2323
const code_typet::parameterst &parameters,
2424
code_blockt &init_code,
25-
symbol_tablet &symbol_table,
26-
message_handlert &message_handler)
25+
symbol_tablet &symbol_table)
2726
{
2827
exprt::operandst main_arguments;
2928
main_arguments.resize(parameters.size());
@@ -432,8 +431,7 @@ bool generate_ansi_c_start_function(
432431
build_function_environment(
433432
parameters,
434433
init_code,
435-
symbol_table,
436-
message_handler);
434+
symbol_table);
437435
}
438436

439437
init_code.move_to_operands(call_main);

src/ansi-c/c_typecast.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ typet c_typecastt::follow_with_qualifiers(const typet &src_type)
277277
c_typecastt::c_typet c_typecastt::get_c_type(
278278
const typet &type) const
279279
{
280-
unsigned width=type.get_int(ID_width);
280+
const std::size_t width = type.get_size_t(ID_width);
281281

282282
if(type.id()==ID_signedbv)
283283
{
@@ -396,8 +396,13 @@ void c_typecastt::implicit_typecast_arithmetic(
396396
case RATIONAL: new_type=rational_typet(); break;
397397
case REAL: new_type=real_typet(); break;
398398
case INTEGER: new_type=integer_typet(); break;
399-
case COMPLEX: return; // do nothing
400-
default: return;
399+
case COMPLEX:
400+
case OTHER:
401+
case VOIDPTR:
402+
case FIXEDBV:
403+
case LARGE_UNSIGNED_INT:
404+
case LARGE_SIGNED_INT:
405+
return; // do nothing
401406
}
402407

403408
if(new_type!=expr_type)

src/ansi-c/c_typecheck_code.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ void c_typecheck_baset::typecheck_gcc_switch_case_range(codet &code)
563563
implicit_typecast(code.op1(), switch_op_type);
564564
}
565565

566-
void c_typecheck_baset::typecheck_gcc_local_label(codet &code)
566+
void c_typecheck_baset::typecheck_gcc_local_label(codet &)
567567
{
568568
// these are just declarations, e.g.,
569569
// __label__ here, there;

src/ansi-c/c_typecheck_expr.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2694,20 +2694,20 @@ exprt c_typecheck_baset::do_special_functions(
26942694
// clang returns 4 for _Bool, gcc treats these as 'int'.
26952695
type_number =
26962696
config.ansi_c.preprocessor == configt::ansi_ct::preprocessort::CLANG
2697-
? 4
2698-
: 1;
2697+
? 4u
2698+
: 1u;
26992699
}
27002700
else
27012701
{
27022702
type_number =
2703-
type.id() == ID_empty ? 0
2704-
: (type.id() == ID_bool || type.id() == ID_c_bool) ? 4
2705-
: (type.id() == ID_pointer || type.id() == ID_array) ? 5
2706-
: type.id() == ID_floatbv ? 8
2707-
: (type.id() == ID_complex && type.subtype().id() == ID_floatbv) ? 9
2708-
: type.id() == ID_struct ? 12
2709-
: type.id() == ID_union ? 13
2710-
: 1; // int, short, char, enum_tag
2703+
type.id() == ID_empty ? 0u
2704+
: (type.id() == ID_bool || type.id() == ID_c_bool) ? 4u
2705+
: (type.id() == ID_pointer || type.id() == ID_array) ? 5u
2706+
: type.id() == ID_floatbv ? 8u
2707+
: (type.id() == ID_complex && type.subtype().id() == ID_floatbv) ? 9u
2708+
: type.id() == ID_struct ? 12u
2709+
: type.id() == ID_union ? 13u
2710+
: 1u; // int, short, char, enum_tag
27112711
}
27122712

27132713
exprt tmp=from_integer(type_number, expr.type());

src/ansi-c/c_typecheck_type.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,7 @@ void c_typecheck_baset::typecheck_c_bit_field_type(c_bit_field_typet &type)
13681368
throw 0;
13691369
}
13701370

1371-
sub_width=c_enum_type.subtype().get_int(ID_width);
1371+
sub_width = c_enum_type.subtype().get_size_t(ID_width);
13721372
}
13731373
else
13741374
{

src/ansi-c/expr2c.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,26 +1164,6 @@ std::string expr2ct::convert_unary(
11641164
return dest;
11651165
}
11661166

1167-
std::string expr2ct::convert_pointer_object_has_type(
1168-
const exprt &src,
1169-
unsigned precedence)
1170-
{
1171-
if(src.operands().size()!=1)
1172-
return convert_norep(src, precedence);
1173-
1174-
unsigned p0;
1175-
std::string op0=convert_with_precedence(src.op0(), p0);
1176-
1177-
std::string dest="POINTER_OBJECT_HAS_TYPE";
1178-
dest+='(';
1179-
dest+=op0;
1180-
dest+=", ";
1181-
dest+=convert(static_cast<const typet &>(src.find("object_type")));
1182-
dest+=')';
1183-
1184-
return dest;
1185-
}
1186-
11871167
std::string expr2ct::convert_allocate(const exprt &src, unsigned &precedence)
11881168
{
11891169
if(src.operands().size() != 2)
@@ -3578,9 +3558,6 @@ std::string expr2ct::convert_with_precedence(
35783558
else if(src.id()=="object_value")
35793559
return convert_function(src, "OBJECT_VALUE", precedence=16);
35803560

3581-
else if(src.id()=="pointer_object_has_type")
3582-
return convert_pointer_object_has_type(src, precedence=16);
3583-
35843561
else if(src.id()==ID_array_of)
35853562
return convert_array_of(src, precedence=16);
35863563

src/ansi-c/expr2c_class.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ class expr2ct
102102
std::string convert_member(
103103
const member_exprt &src, unsigned precedence);
104104

105-
std::string convert_pointer_object_has_type(
106-
const exprt &src, unsigned precedence);
107-
108105
std::string convert_array_of(const exprt &src, unsigned precedence);
109106

110107
std::string convert_trinary(

src/ansi-c/padding.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ underlying_width(const c_bit_field_typet &type, const namespacet &ns)
127127
const typet &c_enum_type = ns.follow_tag(to_c_enum_tag_type(subtype));
128128

129129
if(c_enum_type.id() == ID_c_enum)
130-
return c_enum_type.subtype().get_int(ID_width);
130+
return c_enum_type.subtype().get_size_t(ID_width);
131131
else
132132
return {};
133133
}

src/config.inc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ ifeq ($(BUILD_ENV),MSVC)
2121
# disable warning "behavior change ... called instead of ..."
2222
CXXFLAGS += /wd4350
2323
# disable warning "assignment operator could not be generated"
24-
CXXFLAGS += /wd4512
24+
CXXFLAGS += /wd4512 /wd4626
25+
# disable warning "copy constructor could not be generated"
26+
CXXFLAGS += /wd4625
27+
# disable warning "no override available, function is hidden"
28+
CXXFLAGS += /wd4266
2529
else
2630
CXXFLAGS += -Wall -pedantic -Werror -Wno-deprecated-declarations
2731
endif

0 commit comments

Comments
 (0)