python: Enable C compiler warnings.

This commit is contained in:
Richard W.M. Jones
2012-12-15 18:06:11 +00:00
parent 62e775c350
commit 1571aef9cc
4 changed files with 17 additions and 4 deletions

View File

@@ -35,6 +35,12 @@ let rec generate_python_c () =
generate_header CStyle LGPLv2plus;
pr "\
/* This has to be included first, else definitions conflict with
* glibc header files. Python is broken.
*/
#define PY_SSIZE_T_CLEAN 1
#include <Python.h>
#include <config.h>
#include <stdio.h>
@@ -567,12 +573,16 @@ moduleinit (void)
}
#if PY_MAJOR_VERSION >= 3
extern PyMODINIT_FUNC PyInit_libguestfsmod (void);
PyMODINIT_FUNC
PyInit_libguestfsmod (void)
{
return moduleinit ();
}
#else
extern void initlibguestfsmod (void);
void
initlibguestfsmod (void)
{

View File

@@ -42,7 +42,7 @@ python_LTLIBRARIES = libguestfsmod.la
libguestfsmod_la_SOURCES = guestfs-py.c guestfs-py.h guestfs-py-byhand.c
libguestfsmod_la_CFLAGS = \
-DGUESTFS_PRIVATE_FUNCTIONS=1 \
-Wall \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
-I$(PYTHON_INCLUDEDIR) \
-I$(top_srcdir)/src -I$(top_builddir)/src
libguestfsmod_la_LIBADD = $(top_builddir)/src/libguestfs.la

View File

@@ -21,6 +21,12 @@
* guestfs-py.c).
*/
/* This has to be included first, else definitions conflict with
* glibc header files. Python is broken.
*/
#define PY_SSIZE_T_CLEAN 1
#include <Python.h>
#include <config.h>
#include <stdio.h>

View File

@@ -21,9 +21,6 @@
#include "guestfs.h"
#define PY_SSIZE_T_CLEAN 1
#include <Python.h>
#if PY_VERSION_HEX < 0x02050000
typedef int Py_ssize_t;
#define PY_SSIZE_T_MAX INT_MAX