changeset 10789:6a1640251330

Add warnings module.
author Simon Josefsson <simon@josefsson.org>
date Tue, 11 Nov 2008 10:29:18 +0100
parents a25a90d69546
children 8e910025bd67
files ChangeLog MODULES.html.sh m4/warnings.m4 modules/warnings
diffstat 4 files changed, 59 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Nov 10 19:20:23 2008 -0700
+++ b/ChangeLog	Tue Nov 11 10:29:18 2008 +0100
@@ -1,3 +1,11 @@
+2008-11-10  Simon Josefsson  <simon@josefsson.org>
+
+	* modules/warnings: New module.
+	* m4/warnings.m4: New file.
+	* MODULES.html.sh: Mention warnings module.
+	With review improvements from Paolo Bonzini <bonzini@gnu.org> and
+	Ralf Wildenhues <Ralf.Wildenhues@gmx.de>.
+
 2008-11-10  Eric Blake  <ebb9@byu.net>
 
 	fdl.texi: make a symlink to the latest version
--- a/MODULES.html.sh	Mon Nov 10 19:20:23 2008 -0700
+++ b/MODULES.html.sh	Tue Nov 11 10:29:18 2008 +0100
@@ -2972,6 +2972,7 @@
   func_module relocatable-prog
   func_module relocatable-prog-wrapper
   func_module relocatable-script
+  func_module warnings
   func_end_table
 
   element="Support for building documentation"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m4/warnings.m4	Tue Nov 11 10:29:18 2008 +0100
@@ -0,0 +1,34 @@
+# warnings.m4 serial 1
+dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Simon Josefsson
+
+# gl_WARN_INIT
+# Initializes WARN_CFLAGS variable.
+AC_DEFUN([gl_WARN_INIT],
+[
+  AC_ARG_VAR(WARN_CFLAGS, [C compiler warning flags])
+])
+
+# gl_WARN_ADD([parameter]) adds parameter to WARN_CFLAGS if compiler
+# supports it.  For example, use gl_WARN_ADD([-Werror]).
+AC_DEFUN([gl_WARN_ADD],
+[
+  pushdef([param],[translit([$1],[ABCDEFGHIJKLMNOPQRSTUVWXYZ./-],
+                                 [abcdefghijklmnopqrstuvwxyz___])])
+
+  AC_CACHE_CHECK([whether compiler handles $1], [gl_cv_warn[]param[]], [
+    save_CFLAGS="$CFLAGS"
+    CFLAGS="${CFLAGS} $1"
+    AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
+                       gl_cv_warn[]param=yes, gl_cv_warn[]param=no)
+    CFLAGS="$save_CFLAGS"
+  ])
+
+  if test $gl_cv_warn[]param = "yes"; then
+    WARN_CFLAGS="$WARN_CFLAGS $1"
+  fi
+])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/warnings	Tue Nov 11 10:29:18 2008 +0100
@@ -0,0 +1,16 @@
+Description:
+Helper M4 functions for safely adding compiler warning parameters.
+
+Files:
+m4/warnings.m4
+
+Depends-on:
+
+configure.ac:
+gl_WARN_INIT
+
+License:
+unlimited
+
+Maintainer:
+Simon Josefsson