[vte] build: Update warning flags check



commit f34959ef25a7c70c545a8e31087a35e8c586e100
Author: Christian Persch <chpe gnome org>
Date:   Wed Apr 23 19:21:06 2014 +0200

    build: Update warning flags check

 acinclude.m4    |   85 ++++++++++++++++++-------------------------------------
 configure.ac    |   57 +++++++++++++++++++++++++++++--------
 src/Makefile.am |    8 ++--
 src/vte.c       |    3 ++
 4 files changed, 80 insertions(+), 73 deletions(-)
---
diff --git a/acinclude.m4 b/acinclude.m4
index 4701476..211f9a3 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1,11 +1,12 @@
 dnl Macros to check the presence of generic (non-typed) symbols.
 dnl Copyright (c) 2006-2008 Diego Pettenò <flameeyes gmail com>
 dnl Copyright (c) 2006-2008 xine project
+dnl Copyright (c) 2012 Lucas De Marchi <lucas de marchi gmail com>
 dnl
-dnl This program is free software: you can redistribute it and/or modify
+dnl This program is free software; you can redistribute it and/or modify
 dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation, either version 3 of the License, or
-dnl (at your option) any later version.
+dnl the Free Software Foundation; either version 2, or (at your option)
+dnl any later version.
 dnl
 dnl This program is distributed in the hope that it will be useful,
 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -13,7 +14,9 @@ dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 dnl GNU General Public License for more details.
 dnl
 dnl You should have received a copy of the GNU General Public License
-dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+dnl 02110-1301, USA.
 dnl
 dnl As a special exception, the copyright owners of the
 dnl macro gives unlimited permission to copy, distribute and modify the
@@ -30,52 +33,28 @@ dnl distribute a modified version of the Autoconf Macro, you may extend
 dnl this special exception to the GPL to apply to your modified version as
 dnl well.
 
-dnl Check if the flag is supported by compiler
-dnl CC_CHECK_CFLAGS_SILENT([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
-
-AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [
-  AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]),
-    [ac_save_CFLAGS="$CFLAGS"
-     CFLAGS="$CFLAGS $1"
-     AC_COMPILE_IFELSE([AC_LANG_SOURCE([int a;])],
-       [eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"],
-       [eval "AS_TR_SH([cc_cv_cflags_$1])='no'"])
-     CFLAGS="$ac_save_CFLAGS"
-    ])
-
-  AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
-    [$2], [$3])
-])
-
-dnl Check if the flag is supported by compiler (cacheable)
-dnl CC_CHECK_CFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
-
-AC_DEFUN([CC_CHECK_CFLAGS], [
-  AC_CACHE_CHECK([if $CC supports $1 flag],
-    AS_TR_SH([cc_cv_cflags_$1]),
-    CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here!
-  )
-
-  AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
-    [$2], [$3])
-])
-
-dnl CC_CHECK_CFLAG_APPEND(FLAG, [action-if-found], [action-if-not-found])
-dnl Check for CFLAG and appends them to CFLAGS if supported
-AC_DEFUN([CC_CHECK_CFLAG_APPEND], [
-  AC_CACHE_CHECK([if $CC supports $1 flag],
-    AS_TR_SH([cc_cv_cflags_$1]),
-    CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here!
-  )
-
-  AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
-    [CFLAGS="$CFLAGS $1"; DEBUG_CFLAGS="$DEBUG_CFLAGS $1"; $2], [$3])
+dnl Check if FLAG in ENV-VAR is supported by compiler and append it
+dnl to WHERE-TO-APPEND variable
+dnl CC_CHECK_FLAG_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG])
+
+AC_DEFUN([CC_CHECK_FLAG_APPEND], [
+  AC_CACHE_CHECK([if $CC supports flag $3 in envvar $2],
+                 AS_TR_SH([cc_cv_$2_$3]),
+                [eval "AS_TR_SH([cc_save_$2])='${$2}'"
+                 eval "AS_TR_SH([$2])='$3'"
+                 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int a = 0; int main(void) { return a; } ])],
+                                    [eval "AS_TR_SH([cc_cv_$2_$3])='yes'"],
+                                    [eval "AS_TR_SH([cc_cv_$2_$3])='no'"])
+                 eval "AS_TR_SH([$2])='$cc_save_$2'"])
+
+  AS_IF([eval test x$]AS_TR_SH([cc_cv_$2_$3])[ = xyes],
+        [eval "$1='${$1} $3'"])
 ])
 
-dnl CC_CHECK_CFLAGS_APPEND([FLAG1 FLAG2], [action-if-found], [action-if-not])
-AC_DEFUN([CC_CHECK_CFLAGS_APPEND], [
-  for flag in $1; do
-    CC_CHECK_CFLAG_APPEND($flag, [$2], [$3])
+dnl CC_CHECK_FLAGS_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG1 FLAG2])
+AC_DEFUN([CC_CHECK_FLAGS_APPEND], [
+  for flag in $3; do
+    CC_CHECK_FLAG_APPEND($1, $2, $flag)
   done
 ])
 
@@ -87,11 +66,9 @@ AC_DEFUN([CC_CHECK_LDFLAGS], [
     AS_TR_SH([cc_cv_ldflags_$1]),
     [ac_save_LDFLAGS="$LDFLAGS"
      LDFLAGS="$LDFLAGS $1"
-     AC_LANG_PUSH([C])
-     AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 1; }])],
+     AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 1; }]])],
        [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
        [eval "AS_TR_SH([cc_cv_ldflags_$1])="])
-     AC_LANG_POP([C])
      LDFLAGS="$ac_save_LDFLAGS"
     ])
 
@@ -147,11 +124,9 @@ AC_DEFUN([CC_CHECK_ATTRIBUTE], [
     AS_TR_SH([cc_cv_attribute_$1]),
     [ac_save_CFLAGS="$CFLAGS"
      CFLAGS="$CFLAGS $cc_cv_werror"
-     AC_LANG_PUSH([C])
      AC_COMPILE_IFELSE([AC_LANG_SOURCE([$3])],
        [eval "AS_TR_SH([cc_cv_attribute_$1])='yes'"],
        [eval "AS_TR_SH([cc_cv_attribute_$1])='no'"])
-     AC_LANG_POP([C])
      CFLAGS="$ac_save_CFLAGS"
     ])
 
@@ -273,7 +248,6 @@ AC_DEFUN([CC_FUNC_EXPECT], [
     [cc_cv_func_expect],
     [ac_save_CFLAGS="$CFLAGS"
      CFLAGS="$CFLAGS $cc_cv_werror"
-     AC_LANG_PUSH([C])
      AC_COMPILE_IFELSE([AC_LANG_SOURCE(
        [int some_function() {
         int a = 3;
@@ -281,7 +255,6 @@ AC_DEFUN([CC_FUNC_EXPECT], [
        }])],
        [cc_cv_func_expect=yes],
        [cc_cv_func_expect=no])
-     AC_LANG_POP([C])
      CFLAGS="$ac_save_CFLAGS"
     ])
 
@@ -298,7 +271,6 @@ AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [
     [cc_cv_attribute_aligned],
     [ac_save_CFLAGS="$CFLAGS"
      CFLAGS="$CFLAGS $cc_cv_werror"
-     AC_LANG_PUSH([C])
      for cc_attribute_align_try in 64 32 16 8 4 2; do
         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
           int main() {
@@ -306,7 +278,6 @@ AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [
             return c;
           }])], [cc_cv_attribute_aligned=$cc_attribute_align_try; break])
      done
-     AC_LANG_POP([C])
      CFLAGS="$ac_save_CFLAGS"
   ])
 
diff --git a/configure.ac b/configure.ac
index dedff4d..45bd8a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -129,18 +129,51 @@ AC_SUBST([LIBTOOL_FLAGS])
 # Compilation
 ################################################################################
 
-CC_CHECK_CFLAGS_APPEND([ \
-  -Wall -Wextra \
-  -Wformat-nonliteral -Werror=format-security \
-  -Wsign-compare -Werror=implicit-function-declaration \
-  -Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
-  -Waggregate-return -Wcast-align -Wimplicit -Wuninitialized \
-  -Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
-  -Wpacked -Wmissing-format-attribute -Wshadow \
-  -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
-  -Wdeclaration-after-statement -Wold-style-definition \
-  -Wno-missing-field-initializers -Wno-unused-parameter \
-  -fno-common -Wno-switch-enum])
+CC_CHECK_FLAGS_APPEND([AM_CFLAGS],[CFLAGS],[ \
+  -pipe \
+  -Waggregate-return \
+  -Wall \
+  -Wcast-align \
+  -Wendif-labels \
+  -Werror=declaration-after-statement \
+  -Werror=format=2 \
+  -Werror=format-nonliteral \
+  -Werror=format-security \
+  -Werror=implicit-function-declaration \
+  -Werror=init-self \
+  -Werror=missing-include-dirs \
+  -Werror=missing-prototypes \
+  -Werror=pointer-arith \
+  -Wextra \
+  -Wfloat-equal \
+  -Wformat-nonliteral \
+  -Wimplicit \
+  -Wlogical-op \
+  -Wmissing-declarations \
+  -Wmissing-include-dirs \
+  -Wmissing-format-attribute \
+  -Wmissing-noreturn \
+  -Wnested-externs \
+  -Wno-missing-field-initializers \
+  -Wno-switch-enum \
+  -Wno-unused-parameter \
+  -Wold-style-definition \
+  -Wpacked \
+  -Wshadow \
+  -Wsign-compare \
+  -Wstrict-aliasing=2 \
+  -Wstrict-prototypes \
+  -Wundef \
+  -Wuninitialized \
+  -Wunsafe-loop-optimizations \
+  -Wwrite-strings \
+  -fno-common \
+  -fdiagnostics-show-option \
+  -fno-strict-aliasing \
+  -fstack-protector \
+  -fstack-protector-strong \
+  -Wno-deprecated-declarations \
+])
 
 ##########################################################
 # Check for -Bsymbolic-functions linker flag used to avoid
diff --git a/src/Makefile.am b/src/Makefile.am
index 3fc5d29..dd0e8a4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -286,9 +286,6 @@ EXTRA_DIST += $(TEST_SH)
 check_PROGRAMS = dumpkeys iso2022 reflect-text-view reflect-vte mev table trie xticker vteconv vtetc
 TESTS = table trie $(TEST_SH)
 
-AM_CFLAGS = $(GLIB_CFLAGS)
-LDADD = $(GLIB_LIBS)
-
 reflect_text_view_CPPFLAGS = -DUSE_TEXT_VIEW
 reflect_text_view_CFLAGS = $(VTE_CFLAGS)
 reflect_text_view_SOURCES = reflect.c
@@ -353,7 +350,10 @@ iso2022_CFLAGS = $(GTK_CFLAGS)
 iso2022_LDADD = $(GTK_LIBS)
 
 slowcat_SOURCES = \
-       slowcat.c
+       slowcat.c \
+       $(NULL)
+slowcat_CFLAGS = $(GLIB_CFLAGS) $(AM_CFLAGS)
+slowcat_LDADD = $(GLIB_LIBS)
 
 table_SOURCES = \
        buffer.h \
diff --git a/src/vte.c b/src/vte.c
index 9e2a342..d66220b 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -5250,7 +5250,10 @@ vte_terminal_key_press(GtkWidget *widget, GdkEventKey *event)
                                                          terminal->pvt->cursor_mode == 
VTE_KEYMODE_APPLICATION,
                                                          &normal,
                                                          &normal_length);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
                        output = g_strdup_printf(normal, 1);
+#pragma GCC diagnostic pop
                        vte_terminal_feed_child_using_modes(terminal,
                                                            output, -1);
                        g_free(output);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]