From 7e44016d38dae01ab7b0f2bf9ff543b9ec777d38 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Fri, 27 Sep 2019 18:00:52 +0200 Subject: [PATCH] [buddy] improve C++ backward compatibility around bdd_allsat change * src/bddx.h (bdd_allsat): Add a version with the old prototype. --- buddy/src/bddx.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/buddy/src/bddx.h b/buddy/src/bddx.h index 573569c7f..48018ccec 100644 --- a/buddy/src/bddx.h +++ b/buddy/src/bddx.h @@ -269,6 +269,10 @@ typedef void (*bdd2inthandler)(int,int); typedef int (*bddsizehandler)(void); typedef void (*bddfilehandler)(FILE *, int); typedef void (*bddallsathandler)(signed char*, int); +// The historical type of bddallsathandler is the following, +// unfortunately the signedness of char* is implementation defined. +// Now we have to support both for backward compatibility. +typedef void (*bddallsathandler_old)(char*, int); BUDDY_API bddinthandler bdd_error_hook(bddinthandler); BUDDY_API bddgbchandler bdd_gbc_hook(bddgbchandler); @@ -613,6 +617,7 @@ protected: friend bdd bdd_fullsatone(const bdd &); friend bdd bdd_satprefix(bdd &); friend void bdd_allsat(const bdd &r, bddallsathandler handler); + friend void bdd_allsat(const bdd &r, bddallsathandler_old handler); friend double bdd_satcount(const bdd &); friend double bdd_satcountset(const bdd &, const bdd &); friend double bdd_satcountln(const bdd &); @@ -829,6 +834,10 @@ inline bdd bdd_satprefix(bdd &r) inline void bdd_allsat(const bdd &r, bddallsathandler handler) { bdd_allsat(r.root, handler); } +// backward compatibility for C++ users +inline void bdd_allsat(const bdd &r, bddallsathandler_old handler) +{ bdd_allsat(r.root, (bddallsathandler)handler); } + inline double bdd_satcount(const bdd &r) { return bdd_satcount(r.root); }