[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gettext] A couple of warnings during compilation
From: |
Daiki Ueno |
Subject: |
Re: [bug-gettext] A couple of warnings during compilation |
Date: |
Mon, 07 Jan 2013 20:20:47 +0900 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
Daiki Ueno <address@hidden> writes:
>> gcj ./gnu/gettext/DumpResource.java --main=gnu.gettext.DumpResource \
>> -o gnu.gettext.DumpResource
>> ./gnu/gettext/DumpResource.java:120: warning: Enumeration is a raw type. \
>> References to generic type Enumeration<E> should be parameterized
>> Enumeration keys = catalog.getKeys();
>> ^^^^^^^^^^^
>
> This could be avoided by passing "-fsource=1.3" to gcj, though some old
> gcj versions do not have that option. So gt_GCJ (in gettext's gcj.m4)
> should take the source_version argument and do some tests like
> gt_JAVACOMP (in gnulib's javacomp.m4).
Here is the tentative patch.
>From 77e1e1621a8297793cd48c89490be08ab0f702a1 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <address@hidden>
Date: Mon, 7 Jan 2013 20:14:16 +0900
Subject: [PATCH] Add 'source-version' argument to gt_GCJ macro.
---
gettext-tools/ChangeLog | 4 ++
gettext-tools/configure.ac | 2 +-
gettext-tools/examples/ChangeLog | 6 +++
gettext-tools/examples/hello-java-awt/configure.ac | 2 +-
.../examples/hello-java-swing/configure.ac | 2 +-
gettext-tools/examples/hello-java/configure.ac | 2 +-
gnulib-local/ChangeLog | 4 ++
gnulib-local/m4/gcj.m4 | 51 ++++++++++++++++++--
8 files changed, 65 insertions(+), 8 deletions(-)
diff --git a/gettext-tools/ChangeLog b/gettext-tools/ChangeLog
index 167d6a6..0d48014 100644
--- a/gettext-tools/ChangeLog
+++ b/gettext-tools/ChangeLog
@@ -1,3 +1,7 @@
+2013-01-07 Daiki Ueno <address@hidden>
+
+ * configure.ac: Call gt_GCJ with source-version 1.3.
+
2012-12-25 Daiki Ueno <address@hidden>
* gettext-0.18.2 released.
diff --git a/gettext-tools/configure.ac b/gettext-tools/configure.ac
index 6392756..7df9e21 100644
--- a/gettext-tools/configure.ac
+++ b/gettext-tools/configure.ac
@@ -35,7 +35,7 @@ AC_PROG_YACC
gt_JAVA_CHOICE
-gt_GCJ
+gt_GCJ([1.3])
if test -n "$HAVE_GCJ" && test "$JAVA_CHOICE" = yes; then
BUILDJAVAEXE=yes
else
diff --git a/gettext-tools/examples/ChangeLog b/gettext-tools/examples/ChangeLog
index 9e5f19b..7848c10 100644
--- a/gettext-tools/examples/ChangeLog
+++ b/gettext-tools/examples/ChangeLog
@@ -1,3 +1,9 @@
+2013-01-07 Daiki Ueno <address@hidden>
+
+ * hello-java/configure.ac: Call gt_GCJ with source-version 1.3.
+ * hello-java-awt/configure.ac: Likewise.
+ * hello-java-swing/configure.ac: Likewise.
+
2012-12-25 Daiki Ueno <address@hidden>
* gettext-0.18.2 released.
diff --git a/gettext-tools/examples/hello-java-awt/configure.ac
b/gettext-tools/examples/hello-java-awt/configure.ac
index da5b758..98da8c1 100644
--- a/gettext-tools/examples/hello-java-awt/configure.ac
+++ b/gettext-tools/examples/hello-java-awt/configure.ac
@@ -11,7 +11,7 @@ dnl Check whether we can build native executable.
AC_ARG_ENABLE(java-exe,
[ --enable-java-exe compile Java to native code, not to bytecode],
:, enable_java_exe=no)
-gt_GCJ
+gt_GCJ([1.3])
if test "$enable_java_exe" != no && test -n "$HAVE_GCJ"; then
BUILDJAVAEXE=yes
else
diff --git a/gettext-tools/examples/hello-java-swing/configure.ac
b/gettext-tools/examples/hello-java-swing/configure.ac
index 838224c..839e814 100644
--- a/gettext-tools/examples/hello-java-swing/configure.ac
+++ b/gettext-tools/examples/hello-java-swing/configure.ac
@@ -11,7 +11,7 @@ dnl Check whether we can build native executable.
AC_ARG_ENABLE(java-exe,
[ --enable-java-exe compile Java to native code, not to bytecode],
:, enable_java_exe=no)
-gt_GCJ
+gt_GCJ([1.3])
if test "$enable_java_exe" != no && test -n "$HAVE_GCJ"; then
BUILDJAVAEXE=yes
else
diff --git a/gettext-tools/examples/hello-java/configure.ac
b/gettext-tools/examples/hello-java/configure.ac
index 030c636..e4b6c0d 100644
--- a/gettext-tools/examples/hello-java/configure.ac
+++ b/gettext-tools/examples/hello-java/configure.ac
@@ -11,7 +11,7 @@ dnl Check whether we can build native executable.
AC_ARG_ENABLE(java-exe,
[ --disable-java-exe compile Java to bytecode only, not to native
code],
:, enable_java_exe=yes)
-gt_GCJ
+gt_GCJ([1.3])
if test "$enable_java_exe" != no && test -n "$HAVE_GCJ"; then
BUILDJAVAEXE=yes
else
diff --git a/gnulib-local/ChangeLog b/gnulib-local/ChangeLog
index 5a3a486..880ff41 100644
--- a/gnulib-local/ChangeLog
+++ b/gnulib-local/ChangeLog
@@ -1,3 +1,7 @@
+2013-01-07 Daiki Ueno <address@hidden>
+
+ * m4/gcj.m4 (gt_GCJ): Add 'source-version' argument.
+
2013-01-03 Daiki Ueno <address@hidden>
Update after gnulib changed.
diff --git a/gnulib-local/m4/gcj.m4 b/gnulib-local/m4/gcj.m4
index f84b7fb..4033af9 100644
--- a/gnulib-local/m4/gcj.m4
+++ b/gnulib-local/m4/gcj.m4
@@ -1,18 +1,22 @@
-# gcj.m4 serial 2 (gettext-0.17)
-dnl Copyright (C) 2002, 2006 Free Software Foundation, Inc.
+# gcj.m4 serial 3 (gettext-0.18)
+dnl Copyright (C) 2002, 2006, 2012 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.
# Check for a Java compiler that creates executables.
-# Assigns the variables GCJ and GCJFLAGS, and set HAVE_GCJ to nonempty,
-# if found. Otherwise sets HAVE_GCJ to empty.
+# gt_GCJ([source-version])
+# Assigns the variables GCJ and GCJFLAGS, and set HAVE_GCJ to
+# nonempty, if the Java compiler will allow Java source code according
+# to source-version. Otherwise sets HAVE_GCJ to empty.
AC_DEFUN([gt_GCJ],
[
AC_ARG_VAR([GCJ], [Java native code compiler command])
AC_ARG_VAR([GCJFLAGS], [Java native code compiler flags])
+ source_version=$1
+
AC_MSG_CHECKING([for Java to native code compiler])
# Search for the gcj command or use the one provided by the user.
if test -z "$GCJ"; then
@@ -28,6 +32,45 @@ AC_DEFUN([gt_GCJ],
if test "$GCJ" != none; then
test "${GCJFLAGS+set}" != set || GCJFLAGS="-O2 -g"
fi
+
+ # Add "-fsource=1.X" or "-fno-assert" to GCJFLAGS depending on
+ # source version, only if it is working. See the comment in
+ # javacomp.m4.
+ if test -n "$source_version"; then
+ case "$source_version" in
+ 1.3) goodcode='class conftest {}'
+ failcode='class conftestfail { static { assert(true); } }' ;;
+ 1.4) goodcode='class conftest { static { assert(true); } }'
+ failcode='class conftestfail<T> { T foo() { return null; } }' ;;
+ 1.5) goodcode='class conftest<T> { T foo() { return null; } }'
+ failcode='class conftestfail syntax error' ;;
+ *) AC_MSG_ERROR([invalid source-version argument to gt_@&address@hidden:
$source_version]) ;;
+ esac
+ echo "$goodcode" > conftest.java
+ echo "$failcode" > conftestfail.java
+ if { echo "$as_me:__oline__: $GCJ -c -fsource=$source_version
conftest.java" >&AS_MESSAGE_LOG_FD
+ $GCJ -c -fsource="$source_version" conftest.java >&AS_MESSAGE_LOG_FD
2>&1
+ } \
+ && test -f conftest.$ac_objext \
+ && { echo "$as_me:__oline__: $GCJ -c conftestfail.java"
>&AS_MESSAGE_LOG_FD
+ $GCJ -c conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
+ } \
+ && test -f conftestfail.$ac_objext \
+ && ! { echo "$as_me:__oline__: $GCJ -c -fsource=$source_version
conftestfail.java" >&AS_MESSAGE_LOG_FD
+ $GCJ -c -fsource="$source_version" conftestfail.java
>&AS_MESSAGE_LOG_FD 2>&1
+ }; then
+ GCJFLAGS="$GCJFLAGS -fsource=$source_version"
+ elif test "$source_version" = "1.3" \
+ && { echo "$as_me:__oline__: $GCJ -c -fno-assert conftest.java"
>&AS_MESSAGE_LOG_FD
+ $GCJ -c -fno-assert conftest.java >&AS_MESSAGE_LOG_FD 2>&1
+ } \
+ && test -f conftest.$ac_objext; then
+ GCJFLAGS="$GCJFLAGS -fno-assert"
+ fi
+ rm -f conftest.java conftest.$ac_objext
+ rm -f conftestfail.java conftestfail.$ac_objext
+ fi
+
# Check whether the version is ok and it can create executables.
ac_gcj_link="$GCJ $GCJFLAGS conftest.java --main=conftest -o
conftest$ac_exeext"
changequote(,)dnl
--
1.7.10.4