Skip to content

Commit 2ed63f5

Browse files
authored
Merge pull request diffblue#2156 from tautschnig/gcc-8-fixes
Fixes to build using GCC 8
2 parents 260156f + e5f3c41 commit 2ed63f5

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed

jbmc/src/java_bytecode/expr2java.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ std::string type2java(const typet &type, const namespacet &ns);
5858
template <typename float_type>
5959
std::string floating_point_to_java_string(float_type value)
6060
{
61-
const auto is_float = std::is_same<float_type, float>::value;
61+
static const bool is_float = std::is_same<float_type, float>::value;
6262
static const std::string class_name = is_float ? "Float" : "Double";
6363
if(std::isnan(value))
6464
return class_name + ".NaN";
@@ -83,7 +83,7 @@ std::string floating_point_to_java_string(float_type value)
8383
{
8484
return std::stod(decimal) == value;
8585
}
86-
catch(std::out_of_range)
86+
catch(std::out_of_range &)
8787
{
8888
return false;
8989
}

scripts/minisat-2.2.1-patch

+36
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,39 @@ index 9cbbc51..27b9700 100644
227227
#include <fpu_control.h>
228228
#endif
229229

230+
diff --git a/minisat/mtl/Vec.h b/minisat/mtl/Vec.h
231+
--- a/minisat/mtl/Vec.h
232+
+++ b/minisat/mtl/Vec.h
233+
@@ -96,8 +96,10 @@
234+
void vec<T>::capacity(int min_cap) {
235+
if (cap >= min_cap) return;
236+
int add = imax((min_cap - cap + 1) & ~1, ((cap >> 1) + 2) & ~1); // NOTE: grow by approximately 3/2
237+
- if (add > INT_MAX - cap || (((data = (T*)::realloc(data, (cap += add) * sizeof(T))) == NULL) && errno == ENOMEM))
238+
- throw OutOfMemoryException();
239+
+ if (add > INT_MAX - cap)
240+
+ throw OutOfMemoryException();
241+
+
242+
+ data = (T*)xrealloc(data, (cap += add) * sizeof(T));
243+
}
244+
245+
246+
diff --git a/minisat/mtl/XAlloc.h b/minisat/mtl/XAlloc.h
247+
--- a/minisat/mtl/XAlloc.h
248+
+++ b/minisat/mtl/XAlloc.h
249+
@@ -21,7 +21,6 @@
250+
#ifndef Minisat_XAlloc_h
251+
#define Minisat_XAlloc_h
252+
253+
-#include <errno.h>
254+
#include <stdlib.h>
255+
256+
namespace Minisat {
257+
@@ -33,7 +32,7 @@
258+
static inline void* xrealloc(void *ptr, size_t size)
259+
{
260+
void* mem = realloc(ptr, size);
261+
- if (mem == NULL && errno == ENOMEM){
262+
+ if (mem == NULL){
263+
throw OutOfMemoryException();
264+
}else
265+
return mem;

src/pointer-analysis/value_set_fivrns.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,23 @@ hash_numbering<irep_idt, irep_id_hash> value_set_fivrnst::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(); \
36+
for(object_map_dt::const_iterator it = (map).begin(); \
3737
(it)!=(map).end(); \
3838
(it)++)
3939

4040
#define forall_valid_objects(it, map) \
41-
for(object_map_dt::const_iterator (it) = (map).begin(); \
41+
for(object_map_dt::const_iterator it = (map).begin(); \
4242
(it)!=(map).end(); \
4343
(it)++) \
4444
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(); \
47+
for(object_map_dt::iterator it = (map).begin(); \
4848
(it)!=(map).end(); \
4949
(it)++)
5050

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

0 commit comments

Comments
 (0)