Skip to content

Fixes to build using GCC 8 #2156

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 4 commits into from
Jun 6, 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,7 +58,7 @@ std::string type2java(const typet &type, const namespacet &ns);
template <typename float_type>
std::string floating_point_to_java_string(float_type value)
{
const auto is_float = std::is_same<float_type, float>::value;
static const bool is_float = std::is_same<float_type, float>::value;
static const std::string class_name = is_float ? "Float" : "Double";
if(std::isnan(value))
return class_name + ".NaN";
Expand All @@ -83,7 +83,7 @@ std::string floating_point_to_java_string(float_type value)
{
return std::stod(decimal) == value;
}
catch(std::out_of_range)
catch(std::out_of_range &)
{
return false;
}
Expand Down
36 changes: 36 additions & 0 deletions scripts/minisat-2.2.1-patch
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,39 @@ index 9cbbc51..27b9700 100644
#include <fpu_control.h>
#endif

diff --git a/minisat/mtl/Vec.h b/minisat/mtl/Vec.h
--- a/minisat/mtl/Vec.h
+++ b/minisat/mtl/Vec.h
@@ -96,8 +96,10 @@
void vec<T>::capacity(int min_cap) {
if (cap >= min_cap) return;
int add = imax((min_cap - cap + 1) & ~1, ((cap >> 1) + 2) & ~1); // NOTE: grow by approximately 3/2
- if (add > INT_MAX - cap || (((data = (T*)::realloc(data, (cap += add) * sizeof(T))) == NULL) && errno == ENOMEM))
- throw OutOfMemoryException();
+ if (add > INT_MAX - cap)
+ throw OutOfMemoryException();
+
+ data = (T*)xrealloc(data, (cap += add) * sizeof(T));
}


diff --git a/minisat/mtl/XAlloc.h b/minisat/mtl/XAlloc.h
--- a/minisat/mtl/XAlloc.h
+++ b/minisat/mtl/XAlloc.h
@@ -21,7 +21,6 @@
#ifndef Minisat_XAlloc_h
#define Minisat_XAlloc_h

-#include <errno.h>
#include <stdlib.h>

namespace Minisat {
@@ -33,7 +32,7 @@
static inline void* xrealloc(void *ptr, size_t size)
{
void* mem = realloc(ptr, size);
- if (mem == NULL && errno == ENOMEM){
+ if (mem == NULL){
throw OutOfMemoryException();
}else
return mem;
8 changes: 4 additions & 4 deletions src/pointer-analysis/value_set_fivrns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ hash_numbering<irep_idt, irep_id_hash> value_set_fivrnst::function_numbering;
static const char *alloc_adapter_prefix="alloc_adaptor::";

#define forall_objects(it, map) \
for(object_map_dt::const_iterator (it) = (map).begin(); \
for(object_map_dt::const_iterator it = (map).begin(); \
(it)!=(map).end(); \
(it)++)

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

#define Forall_objects(it, map) \
for(object_map_dt::iterator (it) = (map).begin(); \
for(object_map_dt::iterator it = (map).begin(); \
(it)!=(map).end(); \
(it)++)

#define Forall_valid_objects(it, map) \
for(object_map_dt::iterator (it) = (map).begin(); \
for(object_map_dt::iterator it = (map).begin(); \
(it)!=(map).end(); \
(it)++) \
if((map).is_valid_at((it)->first, from_function, from_target_index)) /* NOLINT(*) */
Expand Down