From a2f174f7212ddafeefcc9b67a3ed6c6195e83a27 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Wed, 1 Feb 2017 15:09:40 +0100 Subject: [PATCH] [buddy] fix some -Wpedantic messages * src/bddop.c: Empty macro arguments are undefined ISO C90 and ISO C++98. Use '+' when calling APPLY_SHORTCUTS. * src/fdd.c, src/kernel.c: Avoid constructs invalid in C90. * src/bddop.c, src/bddx.h, src/kernel.c, src/kernel.h, examples/cmilner/cmilner.c: Remove C++ comments. --- buddy/examples/cmilner/cmilner.c | 2 +- buddy/src/bddop.c | 14 ++--- buddy/src/bddx.h | 7 +-- buddy/src/fdd.c | 21 +++++--- buddy/src/kernel.c | 93 +++++++++++++++++--------------- buddy/src/kernel.h | 4 +- 6 files changed, 79 insertions(+), 62 deletions(-) diff --git a/buddy/examples/cmilner/cmilner.c b/buddy/examples/cmilner/cmilner.c index ba6dafa3f..b68fc175c 100644 --- a/buddy/examples/cmilner/cmilner.c +++ b/buddy/examples/cmilner/cmilner.c @@ -214,7 +214,7 @@ static int has_deadlocks(bdd R, bdd T) for(int i=0; ic last, because not_rec() does not initialize it. + /* Check entry->c last, because not_rec() does not initialize it. */ if (entry->i.a == l && entry->i.c == applyop && entry->i.b == r) { #ifdef CACHESTATS @@ -928,7 +930,7 @@ int bdd_implies(BDD l, BDD r) return 0; entry = BddCache_lookup(&misccache, IMPLIESHASH(l,r)); - // Check entry->b last, because not_rec() does not initialize it. + /* Check entry->b last, because not_rec() does not initialize it. */ if (entry->i.a == l && entry->i.c == CACHEID_IMPLIES && entry->i.b == r) { #ifdef CACHESTATS @@ -944,8 +946,8 @@ int bdd_implies(BDD l, BDD r) { int hl = HIGH(l); int hr = HIGH(r); - // Avoid the recursion if the second implication will trivially - // fail. + /* Avoid the recursion if the second implication will trivially + fail. */ if ((ISONE(hl) || ISZERO(hr)) && (hl != hr)) res = 0; else @@ -1792,7 +1794,7 @@ static BDD simplify_rec(BDD f, BDD d) entry = BddCache_lookup(&applycache, APPLYHASH(f,d,bddop_simplify)); - // Check entry->b last, because not_rec() does not initialize it. + /* Check entry->b last, because not_rec() does not initialize it. */ if (entry->i.a == f && entry->i.c == bddop_simplify && entry->i.b == d) { #ifdef CACHESTATS diff --git a/buddy/src/bddx.h b/buddy/src/bddx.h index 84bd066b0..a1d80f61c 100644 --- a/buddy/src/bddx.h +++ b/buddy/src/bddx.h @@ -68,9 +68,10 @@ #endif #endif -// BUDDY_API is used for the public API symbols. It either DLL imports -// or DLL exports (or does nothing for static build) BUDDY_LOCAL is -// used for non-api symbols. +/* BUDDY_API is used for the public API symbols. It either DLL imports +** or DLL exports (or does nothing for static build) BUDDY_LOCAL is +** used for non-api symbols. +*/ #ifdef BUDDY_DLL #ifdef BUDDY_DLL_EXPORTS #define BUDDY_API BUDDY_HELPER_DLL_EXPORT diff --git a/buddy/src/fdd.c b/buddy/src/fdd.c index 2142d9498..46c1ba758 100644 --- a/buddy/src/fdd.c +++ b/buddy/src/fdd.c @@ -143,10 +143,13 @@ int fdd_extdomain(int *dom, int num) { fdvaralloc += (num > fdvaralloc) ? num : fdvaralloc; - Domain* tmp_ptr = (Domain*)realloc(domain, sizeof(Domain)*fdvaralloc); - if (tmp_ptr == NULL) - return bdd_error(BDD_MEMORY); - domain = tmp_ptr; + { + Domain* tmp_ptr = + (Domain*)realloc(domain, sizeof(Domain)*fdvaralloc); + if (tmp_ptr == NULL) + return bdd_error(BDD_MEMORY); + domain = tmp_ptr; + } } } @@ -220,10 +223,12 @@ int fdd_overlapdomain(int v1, int v2) { fdvaralloc += fdvaralloc; - Domain* tmp_ptr = (Domain*)realloc(domain, sizeof(Domain)*fdvaralloc); - if (tmp_ptr == NULL) - return bdd_error(BDD_MEMORY); - domain = tmp_ptr; + { + Domain* tmp_ptr = (Domain*)realloc(domain, sizeof(Domain)*fdvaralloc); + if (tmp_ptr == NULL) + return bdd_error(BDD_MEMORY); + domain = tmp_ptr; + } } d = &domain[fdvarnum]; diff --git a/buddy/src/kernel.c b/buddy/src/kernel.c index 09ece7e5b..b414de1c4 100644 --- a/buddy/src/kernel.c +++ b/buddy/src/kernel.c @@ -194,20 +194,21 @@ int bdd_init(int initnodesize, int cs) /* Load these globals into local variables to help the optimizer. */ - int sz = bddnodesize; - BddNodeInit* b = (BddNodeInit*)bddnodes; - for (n=0 ; n