python: Create macro to hide ugly function signature cast
authorNoel Power <noel.power@suse.com>
Thu, 2 May 2019 11:32:36 +0000 (12:32 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 16 May 2019 17:55:16 +0000 (17:55 +0000)
-Wcast-function-type triggers various warnings related to bad api
decisions in python source. To avoid these warnings we hide them
by casting to void first. Macro here is to hide the uglyness and
provide an easy place to either/or
  + fix better in a single place in the future
  + identify the places involved should python api change in a way
    this can be handled better

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
python/modules.h

index e7e97aa1bf4b503e3acc4c9f24ccd68f48848515..75108d779073e0208bbcb1a909e7fe3e581c4e22 100644 (file)
@@ -21,5 +21,6 @@
 #define __SAMBA_PYTHON_MODULES_H__
 
 bool py_update_path(void);
-
+/* discard signature of 'func' in favour of 'target_sig' */
+#define PY_DISCARD_FUNC_SIG(target_sig, func) (target_sig)(void(*)(void))func
 #endif /* __SAMBA_PYTHON_MODULES_H__ */