[libgsf] Compilation: improve clang support.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgsf] Compilation: improve clang support.
- Date: Sun, 17 Feb 2013 21:54:27 +0000 (UTC)
commit 5d8d1e17a51407c75da92f0e1a5f33114a6554ee
Author: Morten Welinder <terra gnome org>
Date: Sun Feb 17 16:53:57 2013 -0500
Compilation: improve clang support.
And fix a few minor problems it finds.
ChangeLog | 4 ++++
configure.ac | 39 +++++++++++++++++++++++++++++----------
gsf/gsf-blob.c | 2 +-
gsf/gsf-clip-data.c | 2 +-
gsf/gsf-doc-meta-data.c | 2 +-
5 files changed, 36 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3f2e5fa..4f8c4ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-02-17 Morten Welinder <terra gnome org>
+
+ * configure.ac (set_more_warnings): Improve support for clang.
+
2013-02-05 Jean Brefort <jean brefort normalesup org>
* doc/gsf-sections.txt: fix gtk-doc warnings.
diff --git a/configure.ac b/configure.ac
index a8e1772..f19ff00 100644
--- a/configure.ac
+++ b/configure.ac
@@ -163,26 +163,44 @@ AC_SUBST(TYPELIBDIR)
## this should come after `AC_PROG_CC'
ifdef([GNOME_COMPILE_WARNINGS],[GNOME_COMPILE_WARNINGS],)
CFLAGS="$CFLAGS $WARN_CFLAGS -DG_DISABLE_DEPRECATED"
-if test "$GCC" = "yes"; then
- warning_options="-Wsign-compare -Wpointer-arith -Wnested-externs \
+
+set_more_warnings=yes
+if test "$GCC" = yes -a "x$set_more_warnings" != xno; then
+ dnl Clang needs to option, or else it will appear to support any
+ dnl warning option
+ uwoption="-Werror=unknown-warning-option"
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $uwoption"
+ AC_MSG_CHECKING([whether gcc understands $uwoption])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([], [])],
+ [has_unknown_warning_option=yes],
+ [has_unknown_warning_option=no; uwoption=""])
+ AC_MSG_RESULT($has_unknown_warning_option)
+ CFLAGS="$SAVE_CFLAGS"
+
+ warning_options="-Wsign-compare -Wpointer-arith \
-Wchar-subscripts -Wwrite-strings \
-Wdeclaration-after-statement -Wnested-externs \
- -Wmissing-noreturn -Wmissing-prototypes \
+ -Wmissing-noreturn \
-Werror=missing-prototypes -Werror=nested-externs \
-Werror=implicit-function-declaration \
-Wmissing-declarations -Wno-pointer-sign \
-Werror=format-security -Wbitwise -Wcast-to-as \
-Wdefault-bitfield-sign -Wdo-while -Wparen-string \
- -Wptr-subtraction-blows -Wreturn-void -Wtypesign"
+ -Wptr-subtraction-blows -Wreturn-void -Wtypesign \
+ -Wstrict-prototypes"
for option in $warning_options ; do
SAVE_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $option"
+ CFLAGS="$CFLAGS $uwoption $option"
AC_MSG_CHECKING([whether gcc understands $option])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
- has_option=yes,
- has_option=no)
- if test $has_option = no; then
- CFLAGS="$SAVE_CFLAGS"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([], [])],
+ [has_option=yes],
+ [has_option=no])
+ CFLAGS="$SAVE_CFLAGS"
+ if test $has_option = yes; then
+ CFLAGS="$CFLAGS $option"
fi
AC_MSG_RESULT($has_option)
unset has_option
@@ -190,6 +208,7 @@ if test "$GCC" = "yes"; then
done
unset option
fi
+AC_SUBST(WARN_CFLAGS)
AC_CHECK_DECL(fdopen, fdopen_works=yes, fdopen_works=no)
if test $fdopen_works = no ; then
diff --git a/gsf/gsf-blob.c b/gsf/gsf-blob.c
index 5382b1c..d22f751 100644
--- a/gsf/gsf-blob.c
+++ b/gsf/gsf-blob.c
@@ -73,7 +73,7 @@ gsf_blob_init (GsfBlob *blob)
GSF_CLASS (GsfBlob, gsf_blob,
gsf_blob_class_init, gsf_blob_init,
- G_TYPE_OBJECT);
+ G_TYPE_OBJECT)
/**
diff --git a/gsf/gsf-clip-data.c b/gsf/gsf-clip-data.c
index 60f80b0..63a5f5f 100644
--- a/gsf/gsf-clip-data.c
+++ b/gsf/gsf-clip-data.c
@@ -81,7 +81,7 @@ gsf_clip_data_class_init (GObjectClass *gobject_class)
GSF_CLASS (GsfClipData, gsf_clip_data,
gsf_clip_data_class_init, gsf_clip_data_init,
- G_TYPE_OBJECT);
+ G_TYPE_OBJECT)
/**
* gsf_clip_data_new:
diff --git a/gsf/gsf-doc-meta-data.c b/gsf/gsf-doc-meta-data.c
index b117119..c51c0ce 100644
--- a/gsf/gsf-doc-meta-data.c
+++ b/gsf/gsf-doc-meta-data.c
@@ -235,7 +235,7 @@ gsf_doc_meta_data_size (GsfDocMetaData const *meta)
}
static void
-cb_print_property (G_GNUC_UNUSED char const *name,
+cb_print_property (char const *name,
GsfDocProp const *prop)
{
if (gsf_doc_prop_get_link (prop) != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]