summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-02-20 18:35:03 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-07-05 14:19:21 -0400
commitce4e46ae66761931f386cfff0065ad056c528717 (patch)
tree50f309288defc8ba3216aa8824bfecb0c3234f00
parent5e1d42a18032bff6863784d18671a3cb65cae0c3 (diff)
downloadpython-systemd-ce4e46ae66761931f386cfff0065ad056c528717.tar.gz
macro: introduce nice macro for disabling -Wmissing-prototypes warnigs
-rw-r--r--systemd/_daemon.c10
-rw-r--r--systemd/_journal.c9
-rw-r--r--systemd/_reader.c5
-rw-r--r--systemd/id128.c12
-rw-r--r--systemd/login.c11
5 files changed, 23 insertions, 24 deletions
diff --git a/systemd/_daemon.c b/systemd/_daemon.c
index 3982e85..7756a78 100644
--- a/systemd/_daemon.c
+++ b/systemd/_daemon.c
@@ -31,6 +31,7 @@
#include <systemd/sd-daemon.h>
#include "pyutil.h"
+#include "macro.h"
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 */
};
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmissing-prototypes"
-
#if PY_MAJOR_VERSION < 3
+DISABLE_WARNING_MISSING_PROTOTYPES;
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);
}
+REENABLE_WARNING;
#else
@@ -310,6 +310,7 @@ static struct PyModuleDef module = {
methods
};
+DISABLE_WARNING_MISSING_PROTOTYPES;
PyMODINIT_FUNC PyInit__daemon(void) {
PyObject *m;
@@ -325,7 +326,6 @@ PyMODINIT_FUNC PyInit__daemon(void) {
return m;
}
+REENABLE_WARNING;
#endif
-
-#pragma GCC diagnostic pop
diff --git a/systemd/_journal.c b/systemd/_journal.c
index 8cc6d3e..cbc661d 100644
--- a/systemd/_journal.c
+++ b/systemd/_journal.c
@@ -113,11 +113,9 @@ static PyMethodDef methods[] = {
{ NULL, NULL, 0, NULL } /* Sentinel */
};
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmissing-prototypes"
-
#if PY_MAJOR_VERSION < 3
+DISABLE_WARNING_MISSING_PROTOTYPES;
PyMODINIT_FUNC init_journal(void) {
PyObject *m;
@@ -127,6 +125,7 @@ PyMODINIT_FUNC init_journal(void) {
PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION);
}
+REENABLE_WARNING;
#else
@@ -138,6 +137,7 @@ static struct PyModuleDef module = {
methods
};
+DISABLE_WARNING_MISSING_PROTOTYPES;
PyMODINIT_FUNC PyInit__journal(void) {
PyObject *m;
@@ -152,7 +152,6 @@ PyMODINIT_FUNC PyInit__journal(void) {
return m;
}
+REENABLE_WARNING;
#endif
-
-#pragma GCC diagnostic pop
diff --git a/systemd/_reader.c b/systemd/_reader.c
index ee25c49..224a916 100644
--- a/systemd/_reader.c
+++ b/systemd/_reader.c
@@ -1046,8 +1046,7 @@ static PyModuleDef module = {
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
@@ -1110,4 +1109,4 @@ init_reader(void)
#endif
}
-#pragma GCC diagnostic pop
+REENABLE_WARNING;
diff --git a/systemd/id128.c b/systemd/id128.c
index ec1d9fb..6dadf7b 100644
--- a/systemd/id128.c
+++ b/systemd/id128.c
@@ -24,6 +24,9 @@
#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"
@@ -108,11 +111,9 @@ static int add_id(PyObject *module, const char* name, sd_id128_t id) {
return PyModule_AddObject(module, name, obj);
}
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmissing-prototypes"
-
#if PY_MAJOR_VERSION < 3
+DISABLE_WARNING_MISSING_PROTOTYPES;
PyMODINIT_FUNC initid128(void) {
PyObject *m;
@@ -126,6 +127,7 @@ PyMODINIT_FUNC initid128(void) {
#undef JOINER
PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION);
}
+REENABLE_WARNING;
#else
@@ -137,6 +139,7 @@ static struct PyModuleDef module = {
methods
};
+DISABLE_WARNING_MISSING_PROTOTYPES;
PyMODINIT_FUNC PyInit_id128(void) {
PyObject *m;
@@ -155,7 +158,6 @@ PyMODINIT_FUNC PyInit_id128(void) {
return m;
}
+REENABLE_WARNING;
#endif
-
-#pragma GCC diagnostic pop
diff --git a/systemd/login.c b/systemd/login.c
index 43f7819..e844f5f 100644
--- a/systemd/login.c
+++ b/systemd/login.c
@@ -316,12 +316,9 @@ static PyTypeObject MonitorType = {
.tp_new = PyType_GenericNew,
};
-
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmissing-prototypes"
-
#if PY_MAJOR_VERSION < 3
+DISABLE_WARNING_MISSING_PROTOTYPES;
PyMODINIT_FUNC initlogin(void) {
PyObject *m;
@@ -337,6 +334,8 @@ PyMODINIT_FUNC initlogin(void) {
Py_INCREF(&MonitorType);
PyModule_AddObject(m, "Monitor", (PyObject *) &MonitorType);
}
+REENABLE_WARNING;
+
#else
static struct PyModuleDef module = {
@@ -347,6 +346,7 @@ static struct PyModuleDef module = {
methods
};
+DISABLE_WARNING_MISSING_PROTOTYPES;
PyMODINIT_FUNC PyInit_login(void) {
PyObject *m;
@@ -371,7 +371,6 @@ PyMODINIT_FUNC PyInit_login(void) {
return m;
}
+REENABLE_WARNING;
#endif
-
-#pragma GCC diagnostic pop