Skip to content

Commit

Permalink
Do not use c_qualifiers on goto-program expressions
Browse files Browse the repository at this point in the history
goto-programs are not C specific.
  • Loading branch information
tautschnig committed Jun 6, 2018
1 parent 7716f3f commit 0a77ce0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
7 changes: 2 additions & 5 deletions src/analyses/does_remove_const.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <util/expr.h>
#include <util/std_code.h>
#include <util/base_type.h>
#include <ansi-c/c_qualifiers.h>

/// A naive analysis to look for casts that remove const-ness from pointers.
/// \param goto_program: the goto program to check
Expand Down Expand Up @@ -163,8 +162,6 @@ bool does_remove_constt::does_type_preserve_const_correctness(
bool does_remove_constt::is_type_at_least_as_const_as(
const typet &type_more_const, const typet &type_compare) const
{
const c_qualifierst type_compare_qualifiers(type_compare);
const c_qualifierst more_constant_qualifiers(type_more_const);
return !type_compare_qualifiers.is_constant ||
more_constant_qualifiers.is_constant;
return !type_compare.get_bool(ID_C_constant) ||
type_more_const.get_bool(ID_C_constant);
}
1 change: 0 additions & 1 deletion src/analyses/module_dependencies.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
analyses
ansi-c # should go away
goto-programs
langapi # should go away
pointer-analysis
Expand Down
16 changes: 4 additions & 12 deletions src/goto-programs/remove_const_function_pointers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Author: Thomas Kiley, [email protected]
#include <util/std_expr.h>
#include <util/symbol_table.h>

#include <ansi-c/c_qualifiers.h>

#include "goto_functions.h"

#define LOG(message, irep) \
Expand Down Expand Up @@ -786,16 +784,10 @@ bool remove_const_function_pointerst::is_const_expression(
/// arrays are implicitly const in C.
bool remove_const_function_pointerst::is_const_type(const typet &type) const
{
c_qualifierst qualifers(type);
if(type.id()==ID_array)
{
c_qualifierst array_type_qualifers(type.subtype());
return qualifers.is_constant || array_type_qualifers.is_constant;
}
else
{
return qualifers.is_constant;
}
if(type.id() == ID_array && type.subtype().get_bool(ID_C_constant))
return true;

return type.get_bool(ID_C_constant);
}

/// To extract the value of the specific component within a struct
Expand Down

0 comments on commit 0a77ce0

Please sign in to comment.