Skip to content

Do not unnecessarily mark local variables static #2471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jbmc/src/java_bytecode/expr2java.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ std::string type2java(const typet &type, const namespacet &ns);
template <typename float_type>
std::string floating_point_to_java_string(float_type value)
{
static const bool is_float = std::is_same<float_type, float>::value;
static const std::string class_name = is_float ? "Float" : "Double";
const bool is_float = std::is_same<float_type, float>::value;
const std::string class_name = is_float ? "Float" : "Double";
if(std::isnan(value))
return class_name + ".NaN";
if(std::isinf(value) && value >= 0.)
Expand Down
2 changes: 1 addition & 1 deletion jbmc/src/java_bytecode/java_bytecode_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ const select_pointer_typet &
void java_bytecode_languaget::methods_provided(
std::unordered_set<irep_idt> &methods) const
{
static std::string cprover_class_prefix = "java::org.cprover.CProver.";
const std::string cprover_class_prefix = "java::org.cprover.CProver.";

// Add all string solver methods to map
string_preprocess.get_all_function_names(methods);
Expand Down
6 changes: 3 additions & 3 deletions jbmc/src/java_bytecode/java_bytecode_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@ class base_ref_infot : public structured_pool_entryt
public:
explicit base_ref_infot(pool_entryt entry) : structured_pool_entryt(entry)
{
static std::set<u1> info_tags = {
CONSTANT_Fieldref, CONSTANT_Methodref, CONSTANT_InterfaceMethodref};
PRECONDITION(info_tags.find(entry.tag) != info_tags.end());
PRECONDITION(
entry.tag == CONSTANT_Fieldref || entry.tag == CONSTANT_Methodref ||
entry.tag == CONSTANT_InterfaceMethodref);
class_index = entry.ref1;
name_and_type_index = entry.ref2;
}
Expand Down
2 changes: 1 addition & 1 deletion jbmc/src/java_bytecode/load_method_by_regex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ bool does_pattern_miss_descriptor(const std::string &pattern)
if(descriptor_index == std::string::npos)
return true;

static const std::string java_prefix = "java::";
const std::string java_prefix = "java::";
return descriptor_index == java_prefix.length() - 1 &&
has_prefix(pattern, java_prefix);
}
Expand Down