Avoid -Wempty-body warnings from SWIG_contract_assert

This commit is contained in:
Olly Betts 2022-02-11 08:56:16 +13:00 committed by Olly Betts
commit 31af3ce9bf
11 changed files with 23 additions and 22 deletions

View file

@ -6,7 +6,7 @@
To support contracts, you need to add a macro to the runtime.
For Python, it looks like this:
#define SWIG_contract_assert(expr, msg) if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg #expr ); goto fail; } else
#define SWIG_contract_assert(expr, msg) do { if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg #expr ); goto fail; } } while (0)
Note: It is used like this:
SWIG_contract_assert(x == 1, "Some kind of error message");

View file

@ -47,9 +47,6 @@ ifeq (node,$(JSENGINE))
SWIGOPT += -v8 -DBUILDING_NODE_EXTENSION=1
# shut up some warnings
# contract macro has an empty 'else' at the end...
aggregate.cpptest: GYP_CFLAGS = \"-Wno-empty-body\"
contract.cpptest: GYP_CFLAGS = \"-Wno-empty-body\"
# dunno... ignoring generously
apply_signed_char.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"