Skip to content

Commit b052a4d

Browse files
committed
Fix warnings emitted by C++2a compiler
This commit fixes diffblue#1972, in particular fixing these three classes of error that occurred over various files in the codebase: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../include/c++/7.3.1/ext/new_allocator.h:140:22: error: destructor called on non-final 'java_bytecode_parse_treet::methodt' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor] destroy(_Up* __p) { __p->~_Up(); } ^ cbmc/src/pointer-analysis/value_set_fivr.cpp:857:9: error: parentheses were disambiguated as redundant parentheses around declaration of variable named 'it' [-Werror,-Wvexing-parse] forall_objects(it, omt.read()) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cbmc/src/cpp/cpp_typecheck_resolve.cpp:591:34: error: unused variable 'next' [-Werror,-Wunused-variable] resolve_identifierst::iterator next; ^ These warnings are emitted when building with Clang 6.0 with the default flags. As of this commit, one warning remains, which can be suppressed by building with the flag -Wno-c++2a-compat until we have a proper fix.
1 parent eb1ac7b commit b052a4d

File tree

6 files changed

+19
-15
lines changed

6 files changed

+19
-15
lines changed

src/cpp/cpp_typecheck_resolve.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,6 @@ void cpp_typecheck_resolvet::make_constructors(
588588
{
589589
resolve_identifierst new_identifiers;
590590

591-
resolve_identifierst::iterator next;
592-
593591
for(resolve_identifierst::iterator
594592
it=identifiers.begin();
595593
it!=identifiers.end();

src/goto-instrument/cover_basic_blocks.h

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class message_handlert;
2121
class cover_blocks_baset
2222
{
2323
public:
24+
virtual ~cover_blocks_baset() = default;
2425
/// \param t a goto instruction
2526
/// \return the block number of the block
2627
/// the given goto instruction is part of

src/goto-instrument/cover_instrument.h

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class goal_filterst;
2525
class cover_instrumenter_baset
2626
{
2727
public:
28+
virtual ~cover_instrumenter_baset() = default;
2829
cover_instrumenter_baset(
2930
const symbol_tablet &_symbol_table,
3031
const goal_filterst &_goal_filters,

src/java_bytecode/java_bytecode_parse_tree.h

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Author: Daniel Kroening, [email protected]
2121
class java_bytecode_parse_treet
2222
{
2323
public:
24+
virtual ~java_bytecode_parse_treet() = default;
2425
class annotationt
2526
{
2627
public:
@@ -157,11 +158,14 @@ class java_bytecode_parse_treet
157158
is_synchronized(false)
158159
{
159160
}
161+
162+
virtual ~methodt() = default;
160163
};
161164

162165
class fieldt:public membert
163166
{
164167
public:
168+
virtual ~fieldt() = default;
165169
virtual void output(std::ostream &out) const;
166170
bool is_enum;
167171
};

src/pointer-analysis/value_set_fi.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ hash_numbering<irep_idt, irep_id_hash> value_set_fit::function_numbering;
3333
static const char *alloc_adapter_prefix="alloc_adaptor::";
3434

3535
#define forall_objects(it, map) \
36-
for(object_map_dt::const_iterator (it) = (map).begin(); \
37-
(it)!=(map).end(); \
36+
for(object_map_dt::const_iterator it = (map).begin(); \
37+
it!=(map).end(); \
3838
(it)++)
3939

4040
#define Forall_objects(it, map) \
41-
for(object_map_dt::iterator (it) = (map).begin(); \
42-
(it)!=(map).end(); \
41+
for(object_map_dt::iterator it = (map).begin(); \
42+
it!=(map).end(); \
4343
(it)++)
4444

4545
void value_set_fit::output(

src/pointer-analysis/value_set_fivr.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,24 @@ hash_numbering<irep_idt, irep_id_hash> value_set_fivrt::function_numbering;
3333
static const char *alloc_adapter_prefix="alloc_adaptor::";
3434

3535
#define forall_objects(it, map) \
36-
for(object_map_dt::const_iterator (it)=(map).begin(); \
37-
(it)!=(map).end(); \
36+
for(object_map_dt::const_iterator it=(map).begin(); \
37+
it!=(map).end(); \
3838
(it)++)
3939

4040
#define forall_valid_objects(it, map) \
41-
for(object_map_dt::const_iterator (it)=(map).begin(); \
42-
(it)!=(map).end(); \
41+
for(object_map_dt::const_iterator it=(map).begin(); \
42+
it!=(map).end(); \
4343
(it)++) \
44-
if((map).is_valid_at((it)->first, from_function, from_target_index))
44+
if((map).is_valid_at(it->first, from_function, from_target_index))
4545

4646
#define Forall_objects(it, map) \
47-
for(object_map_dt::iterator (it)=(map).begin(); \
48-
(it)!=(map).end(); \
47+
for(object_map_dt::iterator it=(map).begin(); \
48+
it!=(map).end(); \
4949
(it)++)
5050

5151
#define Forall_valid_objects(it, map) \
52-
for(object_map_dt::iterator (it)=(map).begin(); \
53-
(it)!=(map).end(); \
52+
for(object_map_dt::iterator it=(map).begin(); \
53+
it!=(map).end(); \
5454
(it)++) \
5555
if((map).is_valid_at((it)->first, from_function, from_target_index)) /* NOLINT(*) */
5656

0 commit comments

Comments
 (0)