kwo pushed a commit to branch master.

http://git.enlightenment.org/legacy/imlib2_loaders.git/commit/?id=6d3ad84127fa6925cf7a9f5a46121fb89ee3779a

commit 6d3ad84127fa6925cf7a9f5a46121fb89ee3779a
Author: Kim Woelders <k...@woelders.dk>
Date:   Fri Apr 6 05:49:24 2018 +0200

    Set warning options when using gcc.
---
 configure.ac                    |  2 ++
 m4/ec_warnflags.m4              | 31 +++++++++++++++++++++++++++++++
 src/modules/loaders/Makefile.am |  2 ++
 3 files changed, 35 insertions(+)

diff --git a/configure.ac b/configure.ac
index dfc303a..5fa0182 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,8 @@ AM_CONDITIONAL(BUILD_EET_LOADER, test x$eet != xno)
 AM_CONDITIONAL(BUILD_ICO_LOADER, test x$ico != xno)
 AM_CONDITIONAL(BUILD_XCF_LOADER, test x$xcf != xno)
 
+EC_C_WARNINGS()
+
 AC_CONFIG_HEADERS(config.h)
 AC_CONFIG_FILES([
 Makefile
diff --git a/m4/ec_warnflags.m4 b/m4/ec_warnflags.m4
new file mode 100644
index 0000000..451de53
--- /dev/null
+++ b/m4/ec_warnflags.m4
@@ -0,0 +1,31 @@
+dnl Copyright (C) 2008 Kim Woelders
+dnl This code is public domain and can be freely used or copied.
+
+dnl Macro to set compiler warning flags in CFLAGS_WARNINGS
+
+dnl Provides configure argument --enable-werror to stop compilation on warnings
+
+dnl Usage: EC_C_WARNINGS([LANG])
+dnl Set LANG to 'cpp' when compiling for C++
+
+AC_DEFUN([EC_C_WARNINGS], [
+  define(ec_c_compile_cpp, ifelse([$1], [cpp], [yes], [no]))
+
+  AC_ARG_ENABLE(werror,
+    [  --enable-werror         treat compiler warnings as errors 
@<:@default=no@:>@],,
+    enable_werror=no)
+
+  if test "x$GCC" = "xyes"; then
+    CFLAGS_WARNINGS="-W -Wall -Wcast-align -Wpointer-arith -Wshadow 
-Wwrite-strings"
+dnl # ignore some warnings for now...
+    CFLAGS_WARNINGS="$CFLAGS_WARNINGS -Wno-unused-parameter"
+    ifelse(ec_c_compile_cpp, no, [
+      CFLAGS_WARNINGS="$CFLAGS_WARNINGS -Wmissing-prototypes 
-Wmissing-declarations -Wstrict-prototypes"
+    ],)
+
+    if test "x$enable_werror" = "xyes"; then
+      CFLAGS_WARNINGS="$CFLAGS_WARNINGS -Werror"
+    fi
+  fi
+  AC_SUBST(CFLAGS_WARNINGS)
+])
diff --git a/src/modules/loaders/Makefile.am b/src/modules/loaders/Makefile.am
index b95aac3..a5cbcf0 100644
--- a/src/modules/loaders/Makefile.am
+++ b/src/modules/loaders/Makefile.am
@@ -1,5 +1,7 @@
 MAINTAINERCLEANFILES = Makefile.in
 
+AM_CFLAGS            = $(CFLAGS_WARNINGS)
+
 pkgdir               = $(libdir)/imlib2/loaders
 
 if BUILD_ANI_LOADER

-- 


Reply via email to