chiark / gitweb /
macro: introduce nice macro for disabling -Wmissing-prototypes warnigs
authorLennart Poettering <lennart@poettering.net>
Thu, 20 Feb 2014 17:35:03 +0000 (18:35 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 20 Feb 2014 17:47:33 +0000 (18:47 +0100)
Makefile.am
src/python-systemd/_daemon.c
src/python-systemd/_journal.c
src/python-systemd/_reader.c
src/python-systemd/id128.c
src/python-systemd/login.c
src/shared/macro.h

index 08b94d7b1483f7d1e662e6d3a937e95e7d56b893..03a65bf08454b91c57bc829568090315249eae7b 100644 (file)
@@ -4245,7 +4245,8 @@ id128_la_LDFLAGS = \
 
 id128_la_LIBADD = \
        $(PYTHON_DEVEL_LIBS) \
 
 id128_la_LIBADD = \
        $(PYTHON_DEVEL_LIBS) \
-       libsystemd.la
+       libsystemd.la \
+       libsystemd-shared.la
 
 _daemon_la_SOURCES = \
        src/python-systemd/_daemon.c \
 
 _daemon_la_SOURCES = \
        src/python-systemd/_daemon.c \
@@ -4266,7 +4267,8 @@ _daemon_la_LDFLAGS = \
 
 _daemon_la_LIBADD = \
        $(PYTHON_DEVEL_LIBS) \
 
 _daemon_la_LIBADD = \
        $(PYTHON_DEVEL_LIBS) \
-       libsystemd.la
+       libsystemd.la \
+       libsystemd-shared.la
 
 _reader_la_SOURCES = \
        src/python-systemd/_reader.c \
 
 _reader_la_SOURCES = \
        src/python-systemd/_reader.c \
index 3982e854264becf18b1b734651c1d973d627b4bc..7756a7880d2f788ebdcca6bdeeb2174667b7aa8d 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <systemd/sd-daemon.h>
 #include "pyutil.h"
 
 #include <systemd/sd-daemon.h>
 #include "pyutil.h"
+#include "macro.h"
 
 PyDoc_STRVAR(module__doc__,
         "Python interface to the libsystemd-daemon library.\n\n"
 
 PyDoc_STRVAR(module__doc__,
         "Python interface to the libsystemd-daemon library.\n\n"
@@ -284,11 +285,9 @@ static PyMethodDef methods[] = {
         { NULL, NULL, 0, NULL }        /* Sentinel */
 };
 
         { NULL, NULL, 0, NULL }        /* Sentinel */
 };
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmissing-prototypes"
-
 #if PY_MAJOR_VERSION < 3
 
 #if PY_MAJOR_VERSION < 3
 
+DISABLE_WARNING_MISSING_PROTOTYPES;
 PyMODINIT_FUNC init_daemon(void) {
         PyObject *m;
 
 PyMODINIT_FUNC init_daemon(void) {
         PyObject *m;
 
@@ -299,6 +298,7 @@ PyMODINIT_FUNC init_daemon(void) {
         PyModule_AddIntConstant(m, "LISTEN_FDS_START", SD_LISTEN_FDS_START);
         PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION);
 }
         PyModule_AddIntConstant(m, "LISTEN_FDS_START", SD_LISTEN_FDS_START);
         PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION);
 }
+REENABLE_WARNING;
 
 #else
 
 
 #else
 
@@ -310,6 +310,7 @@ static struct PyModuleDef module = {
         methods
 };
 
         methods
 };
 
+DISABLE_WARNING_MISSING_PROTOTYPES;
 PyMODINIT_FUNC PyInit__daemon(void) {
         PyObject *m;
 
 PyMODINIT_FUNC PyInit__daemon(void) {
         PyObject *m;
 
@@ -325,7 +326,6 @@ PyMODINIT_FUNC PyInit__daemon(void) {
 
         return m;
 }
 
         return m;
 }
+REENABLE_WARNING;
 
 #endif
 
 #endif
-
-#pragma GCC diagnostic pop
index 8cc6d3e52a68dd095122c07f3850e002fd59f9f0..cbc661d837ad45c6786c2826dd465161547ba6e1 100644 (file)
@@ -113,11 +113,9 @@ static PyMethodDef methods[] = {
         { NULL, NULL, 0, NULL }        /* Sentinel */
 };
 
         { NULL, NULL, 0, NULL }        /* Sentinel */
 };
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmissing-prototypes"
-
 #if PY_MAJOR_VERSION < 3
 
 #if PY_MAJOR_VERSION < 3
 
+DISABLE_WARNING_MISSING_PROTOTYPES;
 PyMODINIT_FUNC init_journal(void) {
         PyObject *m;
 
 PyMODINIT_FUNC init_journal(void) {
         PyObject *m;
 
@@ -127,6 +125,7 @@ PyMODINIT_FUNC init_journal(void) {
 
         PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION);
 }
 
         PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION);
 }
+REENABLE_WARNING;
 
 #else
 
 
 #else
 
@@ -138,6 +137,7 @@ static struct PyModuleDef module = {
         methods
 };
 
         methods
 };
 
+DISABLE_WARNING_MISSING_PROTOTYPES;
 PyMODINIT_FUNC PyInit__journal(void) {
         PyObject *m;
 
 PyMODINIT_FUNC PyInit__journal(void) {
         PyObject *m;
 
@@ -152,7 +152,6 @@ PyMODINIT_FUNC PyInit__journal(void) {
 
         return m;
 }
 
         return m;
 }
+REENABLE_WARNING;
 
 #endif
 
 #endif
-
-#pragma GCC diagnostic pop
index ee25c49741e97fe5474f7f1842689da2d8e44343..224a9169e6d00a9f290a0038c5ee99218c6a535f 100644 (file)
@@ -1046,8 +1046,7 @@ static PyModuleDef module = {
 static bool initialized = false;
 #endif
 
 static bool initialized = false;
 #endif
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+DISABLE_WARNING_MISSING_PROTOTYPES;
 
 PyMODINIT_FUNC
 #if PY_MAJOR_VERSION >= 3
 
 PyMODINIT_FUNC
 #if PY_MAJOR_VERSION >= 3
@@ -1110,4 +1109,4 @@ init_reader(void)
 #endif
 }
 
 #endif
 }
 
-#pragma GCC diagnostic pop
+REENABLE_WARNING;
index ec1d9fb4a2b530d6d7929bd0cf07356c40219108..6dadf7b2fd14d3770a73e9ccbf6a239afa702eb3 100644 (file)
@@ -24,6 +24,9 @@
 #include <systemd/sd-messages.h>
 
 #include "pyutil.h"
 #include <systemd/sd-messages.h>
 
 #include "pyutil.h"
+#include "log.h"
+#include "util.h"
+#include "macro.h"
 
 PyDoc_STRVAR(module__doc__,
              "Python interface to the libsystemd-id128 library.\n\n"
 
 PyDoc_STRVAR(module__doc__,
              "Python interface to the libsystemd-id128 library.\n\n"
@@ -108,11 +111,9 @@ static int add_id(PyObject *module, const char* name, sd_id128_t id) {
         return PyModule_AddObject(module, name, obj);
 }
 
         return PyModule_AddObject(module, name, obj);
 }
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmissing-prototypes"
-
 #if PY_MAJOR_VERSION < 3
 
 #if PY_MAJOR_VERSION < 3
 
+DISABLE_WARNING_MISSING_PROTOTYPES;
 PyMODINIT_FUNC initid128(void) {
         PyObject *m;
 
 PyMODINIT_FUNC initid128(void) {
         PyObject *m;
 
@@ -126,6 +127,7 @@ PyMODINIT_FUNC initid128(void) {
 #undef JOINER
         PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION);
 }
 #undef JOINER
         PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION);
 }
+REENABLE_WARNING;
 
 #else
 
 
 #else
 
@@ -137,6 +139,7 @@ static struct PyModuleDef module = {
         methods
 };
 
         methods
 };
 
+DISABLE_WARNING_MISSING_PROTOTYPES;
 PyMODINIT_FUNC PyInit_id128(void) {
         PyObject *m;
 
 PyMODINIT_FUNC PyInit_id128(void) {
         PyObject *m;
 
@@ -155,7 +158,6 @@ PyMODINIT_FUNC PyInit_id128(void) {
 
         return m;
 }
 
         return m;
 }
+REENABLE_WARNING;
 
 #endif
 
 #endif
-
-#pragma GCC diagnostic pop
index 43f781922d414056693726702000dd7b70c89d1e..e844f5fc697123eec9ef8c62860a7cc223bf67a4 100644 (file)
@@ -316,12 +316,9 @@ static PyTypeObject MonitorType = {
         .tp_new = PyType_GenericNew,
 };
 
         .tp_new = PyType_GenericNew,
 };
 
-
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmissing-prototypes"
-
 #if PY_MAJOR_VERSION < 3
 
 #if PY_MAJOR_VERSION < 3
 
+DISABLE_WARNING_MISSING_PROTOTYPES;
 PyMODINIT_FUNC initlogin(void) {
         PyObject *m;
 
 PyMODINIT_FUNC initlogin(void) {
         PyObject *m;
 
@@ -337,6 +334,8 @@ PyMODINIT_FUNC initlogin(void) {
         Py_INCREF(&MonitorType);
         PyModule_AddObject(m, "Monitor", (PyObject *) &MonitorType);
 }
         Py_INCREF(&MonitorType);
         PyModule_AddObject(m, "Monitor", (PyObject *) &MonitorType);
 }
+REENABLE_WARNING;
+
 #else
 
 static struct PyModuleDef module = {
 #else
 
 static struct PyModuleDef module = {
@@ -347,6 +346,7 @@ static struct PyModuleDef module = {
         methods
 };
 
         methods
 };
 
+DISABLE_WARNING_MISSING_PROTOTYPES;
 PyMODINIT_FUNC PyInit_login(void) {
         PyObject *m;
 
 PyMODINIT_FUNC PyInit_login(void) {
         PyObject *m;
 
@@ -371,7 +371,6 @@ PyMODINIT_FUNC PyInit_login(void) {
 
         return m;
 }
 
         return m;
 }
+REENABLE_WARNING;
 
 #endif
 
 #endif
-
-#pragma GCC diagnostic pop
index 1941f0e6517c472536b0acacbfa30a0e37460f53..458e0ebed30bf6566bb1aac223d89f5c5cb42b9c 100644 (file)
         _Pragma("GCC diagnostic push");                                 \
         _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"")
 
         _Pragma("GCC diagnostic push");                                 \
         _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"")
 
+#define DISABLE_WARNING_MISSING_PROTOTYPES                              \
+        _Pragma("GCC diagnostic push");                                 \
+        _Pragma("GCC diagnostic ignored \"-Wmissing-prototypes\"")
+
 #define REENABLE_WARNING                                                \
         _Pragma("GCC diagnostic pop")
 
 #define REENABLE_WARNING                                                \
         _Pragma("GCC diagnostic pop")