summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-07-29 14:26:44 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2018-07-29 16:48:18 +0200
commit9a3567d5c0f6c451d008da003e64c5ba91e53842 (patch)
treeff99ffb2cc3835ba227b616ec27dab98bcfe0aaa
parent80923051b3e803bf5bdc118c3bac246a308497d6 (diff)
downloadgobject-introspection-9a3567d5c0f6c451d008da003e64c5ba91e53842.tar.gz
build: enable -Wdiscarded-qualifiers
Except for the Python module because nothing in the CPython API is marked const and we'd have to cast everywhere.
-rw-r--r--Makefile-giscanner.am2
-rw-r--r--configure.ac6
-rw-r--r--examples/glib-print.c8
-rw-r--r--girepository/girwriter.c2
-rw-r--r--girepository/gitypelib.c2
-rw-r--r--tests/scanner/annotation.c2
6 files changed, 13 insertions, 9 deletions
diff --git a/Makefile-giscanner.am b/Makefile-giscanner.am
index cf9f79a1..7f437d0e 100644
--- a/Makefile-giscanner.am
+++ b/Makefile-giscanner.am
@@ -110,7 +110,7 @@ nobase_dist_template_DATA = \
_giscanner_la_CFLAGS = \
$(PYTHON_INCLUDES) \
$(GOBJECT_CFLAGS) \
- $(WARN_CFLAGS) \
+ $(WARN_CFLAGS_PYTHON) \
-I$(top_srcdir)/giscanner
_giscanner_la_LIBADD = libgiscanner.la $(GOBJECT_LIBS)
diff --git a/configure.ac b/configure.ac
index 9ae070c0..d35337cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,12 +63,16 @@ fi
m4_ifndef([AX_COMPILER_FLAGS], [AC_MSG_ERROR(['autoconf-archive' missing])])
AX_COMPILER_FLAGS(,, [yes])
# These get triggered a lot, not worth it imo, but feel free to fix them
-AX_APPEND_COMPILE_FLAGS([-Wno-discarded-qualifiers -Wno-duplicated-branches -Wno-switch-enum])
+AX_APPEND_COMPILE_FLAGS([-Wno-duplicated-branches -Wno-switch-enum])
# FIXME: Fix the warnings and remove the flags
AX_APPEND_COMPILE_FLAGS([-Wno-redundant-decls -Wno-switch-default -Wno-shadow -Wno-deprecated-declarations -Wno-cast-function-type -Wno-type-limits])
AX_APPEND_COMPILE_FLAGS([-Wno-implicit-fallthrough -Wno-suggest-attribute=format -Wno-double-promotion -Wno-sign-compare])
AX_APPEND_COMPILE_FLAGS([-Wno-incompatible-pointer-types])
+WARN_CFLAGS_PYTHON="$WARN_CFLAGS"
+AX_APPEND_COMPILE_FLAGS([-Wno-discarded-qualifiers], [WARN_CFLAGS_PYTHON])
+AC_SUBST(WARN_CFLAGS_PYTHON)
+
# Checks for libraries.
AC_CHECK_LIB([dl], [dlopen])
diff --git a/examples/glib-print.c b/examples/glib-print.c
index caa7cda8..595ae48b 100644
--- a/examples/glib-print.c
+++ b/examples/glib-print.c
@@ -24,11 +24,11 @@ main (void)
return 1;
}
- in_args[0].v_pointer = "domain";
- in_args[1].v_pointer = "glib-print.c";
+ in_args[0].v_pointer = (gpointer)"domain";
+ in_args[1].v_pointer = (gpointer)"glib-print.c";
in_args[2].v_int = 42;
- in_args[3].v_pointer = "main";
- in_args[4].v_pointer = "hello world";
+ in_args[3].v_pointer = (gpointer)"main";
+ in_args[4].v_pointer = (gpointer)"hello world";
if (!g_function_info_invoke ((GIFunctionInfo *) base_info,
(const GIArgument *) &in_args,
diff --git a/girepository/girwriter.c b/girepository/girwriter.c
index 4bc7fc96..dacce86f 100644
--- a/girepository/girwriter.c
+++ b/girepository/girwriter.c
@@ -237,7 +237,7 @@ write_type_info (const gchar *namespace,
else if (tag == GI_TYPE_TAG_ARRAY)
{
gint length, size;
- char *name = NULL;
+ const char *name = NULL;
xml_start_element (file, "array");
diff --git a/girepository/gitypelib.c b/girepository/gitypelib.c
index d9e924f6..8ad13604 100644
--- a/girepository/gitypelib.c
+++ b/girepository/gitypelib.c
@@ -272,7 +272,7 @@ strsplit_iter_init (StrSplitIter *iter,
static gboolean
strsplit_iter_next (StrSplitIter *iter,
- char **out_val)
+ const char **out_val)
{
const char *s = iter->s;
const char *next;
diff --git a/tests/scanner/annotation.c b/tests/scanner/annotation.c
index 49bdd246..0f3858f2 100644
--- a/tests/scanner/annotation.c
+++ b/tests/scanner/annotation.c
@@ -816,7 +816,7 @@ regress_annotation_space_after_comment_bug631690 (void)
gchar*
regress_annotation_return_filename (void)
{
- return "a utf-8 filename";
+ return g_strdup ("a utf-8 filename");
}
/**