3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 09:05:31 +00:00

Make C-layer of OCaml bindings C89 compatible.

This patch ensures that the C code generated for the OCaml stubs complies with C89. It is needed to compile Z3 with OCaml support with Visual Studio versions older than VS2013.
This commit is contained in:
martin-neuhaeusser 2016-05-25 09:59:36 +02:00
parent 19f98547f7
commit f069b1c0e9
2 changed files with 69 additions and 24 deletions

View file

@ -227,6 +227,7 @@ void Z3_ast_finalize(value v) {
int Z3_ast_compare(value v1, value v2) {
Z3_ast_plus * a1 = (Z3_ast_plus*)Data_custom_val(v1);
Z3_ast_plus * a2 = (Z3_ast_plus*)Data_custom_val(v2);
unsigned id1, id2;
/* if the two ASTs belong to different contexts, we take
their contexts' addresses to order them (arbitrarily, but fixed) */
@ -242,8 +243,8 @@ int Z3_ast_compare(value v1, value v2) {
return +1;
/* Comparison according to AST ids. */
unsigned id1 = Z3_get_ast_id(a1->cp->ctx, a1->p);
unsigned id2 = Z3_get_ast_id(a2->cp->ctx, a2->p);
id1 = Z3_get_ast_id(a1->cp->ctx, a1->p);
id2 = Z3_get_ast_id(a2->cp->ctx, a2->p);
if (id1 == id2)
return 0;
else if (id1 < id2)
@ -255,7 +256,7 @@ int Z3_ast_compare(value v1, value v2) {
int Z3_ast_compare_ext(value v1, value v2) {
Z3_ast_plus * a1 = (Z3_ast_plus*)Data_custom_val(v1);
unsigned id1;
int id2 = Val_int(v2);
unsigned id2 = (unsigned)Val_int(v2);
if (a1->p == NULL && id2 == 0)
return 0;
if (a1->p == NULL)