Skip to content

Commit 71c1227

Browse files
author
Daniel Kroening
authored
Merge pull request diffblue#2299 from tautschnig/no-c_qualifier
Do not use c_qualifiers on goto-program expressions
2 parents 339fcbd + 0a77ce0 commit 71c1227

File tree

4 files changed

+7
-19
lines changed

4 files changed

+7
-19
lines changed

src/analyses/does_remove_const.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <util/expr.h>
1717
#include <util/std_code.h>
1818
#include <util/base_type.h>
19-
#include <ansi-c/c_qualifiers.h>
2019

2120
/// A naive analysis to look for casts that remove const-ness from pointers.
2221
/// \param goto_program: the goto program to check
@@ -163,8 +162,6 @@ bool does_remove_constt::does_type_preserve_const_correctness(
163162
bool does_remove_constt::is_type_at_least_as_const_as(
164163
const typet &type_more_const, const typet &type_compare) const
165164
{
166-
const c_qualifierst type_compare_qualifiers(type_compare);
167-
const c_qualifierst more_constant_qualifiers(type_more_const);
168-
return !type_compare_qualifiers.is_constant ||
169-
more_constant_qualifiers.is_constant;
165+
return !type_compare.get_bool(ID_C_constant) ||
166+
type_more_const.get_bool(ID_C_constant);
170167
}

src/analyses/module_dependencies.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
analyses
2-
ansi-c # should go away
32
goto-programs
43
langapi # should go away
54
pointer-analysis

src/goto-programs/remove_const_function_pointers.cpp

+4-12
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ Author: Thomas Kiley, [email protected]
1616
#include <util/std_expr.h>
1717
#include <util/symbol_table.h>
1818

19-
#include <ansi-c/c_qualifiers.h>
20-
2119
#include "goto_functions.h"
2220

2321
#define LOG(message, irep) \
@@ -786,16 +784,10 @@ bool remove_const_function_pointerst::is_const_expression(
786784
/// arrays are implicitly const in C.
787785
bool remove_const_function_pointerst::is_const_type(const typet &type) const
788786
{
789-
c_qualifierst qualifers(type);
790-
if(type.id()==ID_array)
791-
{
792-
c_qualifierst array_type_qualifers(type.subtype());
793-
return qualifers.is_constant || array_type_qualifers.is_constant;
794-
}
795-
else
796-
{
797-
return qualifers.is_constant;
798-
}
787+
if(type.id() == ID_array && type.subtype().get_bool(ID_C_constant))
788+
return true;
789+
790+
return type.get_bool(ID_C_constant);
799791
}
800792

801793
/// To extract the value of the specific component within a struct

src/goto-programs/remove_function_pointers.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Author: Daniel Kroening, [email protected]
2020
#include <util/type_eq.h>
2121
#include <util/message.h>
2222
#include <util/base_type.h>
23-
#include <ansi-c/c_qualifiers.h>
23+
2424
#include <analyses/does_remove_const.h>
2525
#include <util/invariant.h>
2626

0 commit comments

Comments
 (0)