changeset 2591:377344362073

PR1937: Add configure option for -Werror 2015-06-24 Andrew John Hughes <gnu_andrew@member.fsf.org> * Makefile.am: (ICEDTEA_CONFIGURE): Pass --enable-warnings-as-errors or --disable-warnings-as-errors, depending on whether or not ENABLE_WERROR is set. 2012-08-16 Andrew John Hughes <gnu_andrew@member.fsf.org> * acinclude.m4: (IT_ENABLE_WERROR): New macro to enable -Werror. This is disabled by default. * configure.ac: Call IT_ENABLE_WERROR. * javac.in: Handle stripping of arguments which take parameters, specifically -Xmaxwarns.
author Andrew John Hughes <gnu_andrew@member.fsf.org>
date Thu, 25 Jun 2015 02:00:15 +0100
parents f2c069c0fbe6
children 8d2c9a898f50
files ChangeLog Makefile.am acinclude.m4 configure.ac javac.in
diffstat 5 files changed, 56 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jun 19 13:22:58 2015 +0100
+++ b/ChangeLog	Thu Jun 25 02:00:15 2015 +0100
@@ -1,3 +1,19 @@
+2015-06-24  Andrew John Hughes  <gnu_andrew@member.fsf.org>
+
+	* Makefile.am:
+	(ICEDTEA_CONFIGURE): Pass --enable-warnings-as-errors
+	or --disable-warnings-as-errors, depending on whether
+	or not ENABLE_WERROR is set.
+
+2012-08-16  Andrew John Hughes  <gnu_andrew@member.fsf.org>
+
+	* acinclude.m4:
+	(IT_ENABLE_WERROR): New macro to enable -Werror.
+	This is disabled by default.
+	* configure.ac: Call IT_ENABLE_WERROR.
+	* javac.in: Handle stripping of arguments which
+	take parameters, specifically -Xmaxwarns.
+
 2015-06-17  Andrew John Hughes  <gnu_andrew@member.fsf.org>
 
 	PR2456: Installation path for hotspot_gc.stp is
--- a/Makefile.am	Fri Jun 19 13:22:58 2015 +0100
+++ b/Makefile.am	Thu Jun 25 02:00:15 2015 +0100
@@ -359,6 +359,14 @@
 	--with-jvm-variants=zeroshark
 endif
 
+if ENABLE_WERROR
+ICEDTEA_CONFIGURE += \
+	--enable-warnings-as-errors
+else
+ICEDTEA_CONFIGURE += \
+	--disable-warnings-as-errors
+endif
+
 ICEDTEA_ENV = \
 	LANG="C" \
 	PATH="$(BOOT_DIR)/bin:$(OS_PATH):$$PATH" \
--- a/acinclude.m4	Fri Jun 19 13:22:58 2015 +0100
+++ b/acinclude.m4	Thu Jun 25 02:00:15 2015 +0100
@@ -1229,6 +1229,28 @@
 AC_PROVIDE([$0])dnl
 ])
 
+AC_DEFUN([IT_ENABLE_WERROR],
+[
+  AC_MSG_CHECKING([whether to enable -Werror])
+  AC_ARG_ENABLE([Werror],
+                [AS_HELP_STRING(--enable-Werror,build with -Werror [[default=no]])],
+  [
+    case "${enableval}" in
+      yes)
+        enable_werror=yes
+        ;;
+      *)
+        enable_werror=no
+        ;;
+    esac
+  ],
+  [
+    enable_werror=no
+  ])
+  AC_MSG_RESULT([$enable_werror])
+  AM_CONDITIONAL([ENABLE_WERROR], test x"${enable_werror}" = "xyes")
+])
+
 AC_DEFUN([IT_FIND_NUMBER_OF_PROCESSORS],[
   FIND_TOOL([GETCONF], [getconf])
   AC_CACHE_CHECK([the number of online processors], it_cv_proc, [
--- a/configure.ac	Fri Jun 19 13:22:58 2015 +0100
+++ b/configure.ac	Thu Jun 25 02:00:15 2015 +0100
@@ -127,6 +127,7 @@
 IT_WITH_JAMVM_SRC_ZIP
 
 IT_DISABLE_OPTIMIZATIONS
+IT_ENABLE_WERROR
 IT_ENABLE_JAR_COMPRESSION
 IT_ENABLE_ZERO_BUILD
 IT_CHECK_ADDITIONAL_VMS
--- a/javac.in	Fri Jun 19 13:22:58 2015 +0100
+++ b/javac.in	Thu Jun 25 02:00:15 2015 +0100
@@ -1,7 +1,8 @@
 #!/usr/bin/perl -w
 use strict;
 use constant NO_DUP_ARGS => qw(-source -target -d -encoding);
-use constant STRIP_ARGS => qw(-Werror -implicit:none);
+use constant STRIP_ARGS_1 => qw(-Werror -implicit:none);
+use constant STRIP_ARGS_2 => qw(-Xmaxwarns);
 
 my ($ECJ_WARNINGS, $JAVAC_WARNINGS);
 
@@ -38,12 +39,18 @@
 	}
     }
 
-    for my $opt (STRIP_ARGS) 
+    for my $opt (STRIP_ARGS_1) 
     {
 	my @indices = reverse grep {$new_args[$_] eq $opt} 0..$#new_args;
 	splice @new_args, $_, 1 for @indices;
     }
 
+    for my $opt (STRIP_ARGS_2) 
+    {
+	my @indices = reverse grep {$new_args[$_] eq $opt} 0..$#new_args;
+	splice @new_args, $_, 2 for @indices;
+    }
+
     return @new_args;
 }