This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug java/30570] New: Word "DEBUG" used as a variable in VMAccessController.java breaks build
- From: "rob1weld at aol dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Jan 2007 03:52:21 -0000
- Subject: [Bug java/30570] New: Word "DEBUG" used as a variable in VMAccessController.java breaks build
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I don't know if the severity might be a "blocker" but since I have a fix (which
is not so good - but works for me) I did not want to elevate the level and take
anyone away from something more important.
I'm getting an error during "make bootstrap" that halts the build.
In file included from
/cygdrive/C/makecygwin/gcc-4_2-branch/libjava/java/security/natVMAccessController.cc:17:
./java/security/VMAccessController.h:35: error: expected unqualified-id before
numeric constant
make[3]: *** [java/security/natVMAccessController.lo] Error 1
make[3]: Leaving directory
`/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libjava'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory
`/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libjava'
make[1]: *** [all-target-libjava] Error 2
make[1]: Leaving directory `/cygdrive/c/gcc-4_2-branch-build'
make: *** [bootstrap] Error 2
The ".java" file is here:
gcc-4_2-branch/libjava/java/security/VMAccessController.java
The ".cc" file is here:
gcc-4_2-branch/libjava/java/security/natVMAccessController.cc
The ".h" file is made here:
name=`echo classpath/lib/java/security/VMAccessController.class | sed -e
's/\.class$//' -e 's,classpath/lib/,,'`; \
/cygdrive/C/makecygwin/gcc-4_2-branch/mkinstalldirs `dirname $name`; \
./../.././gcc/gcjh -d . -classpath '' -bootclasspath classpath/lib
$name
Fix: Alter
/cygdrive/c/gcc-4_2-branch-build/i686-pc-cygwin/libjava/java/security/VMAccessController.h
(a file built during the compile) by changing the ".h" file as shown below. Now
re-type "make bootstrap".
Origonal (end of created ".h" file):
class java::security::VMAccessController : public ::java::lang::Object
{
private:
static void debug (::java::lang::String *);
VMAccessController ();
public: // actually package-private
static void pushContext (::java::security::AccessControlContext *);
static void popContext ();
static ::java::security::AccessControlContext *getContext ();
private:
static JArray< ::java::lang::Object *> *getStack ();
static ::java::security::AccessControlContext *DEFAULT_CONTEXT;
static const jint DEBUG = 1L;
public:
static ::java::lang::Class class$;
};
New:
class java::security::VMAccessController : public ::java::lang::Object
{
private:
static void debug (::java::lang::String *);
VMAccessController ();
public: // actually package-private
static void pushContext (::java::security::AccessControlContext *);
static void popContext ();
static ::java::security::AccessControlContext *getContext ();
private:
static JArray< ::java::lang::Object *> *getStack ();
static ::java::security::AccessControlContext *DEFAULT_CONTEXT;
#define DEBUG_TMP DEBUG
#undef DEBUG
static const jint DEBUG = 1L;
#define DEBUG DEBUG_TMP
public:
static ::java::lang::Class class$;
};
I am reluctant to change the ".java" or ".cc" for fear of breaking something.
The file gcc-4_2-branch/libjava/java/security/VMAccessController.java defines
the following:
private static final boolean DEBUG = gnu.classpath.Configuration.DEBUG;
Java wants the name "DEBUG" but so does something else (the compiler) so I get
the error "expected unqualified-id before numeric constant". The ".ii" file
(without my fix) makes the line in question "static const jint DEBUG = 1L;"
change to "static const jint = 1L;".
The compiler simply defines the word "DEBUG" to "" (empty string). My 'fix'
saves the value (in case it is ever defined) and restores it immediately after
it is finished.
Unfortunatley my fix requires you to wait until the file is made, and edit it
before it is used - there is enough time to do that but you need to be there at
the right time. Alternatley I can wait for the make to fail, edit the file and
continue.
I examined the ".ii" file and there are only two lines with the word
"debug/DEBUG" in them:
static void debug (::java::lang::String *); and static const jint DEBUG = 1L;
Only the capitalized word 'DEBUG' is affected, there are no other occurances of
the
word "DEBUG" in the ".ii" file so it must be a hidden internal compiler word.
If I check the "-D"'s for both my cc1.exe's I get this:
gcc/xgcc -g -v test.c
/usr/lib/gcc/i686-pc-cygwin/4.2.0/cc1.exe -quiet -v -iprefix
/cygdrive/c/gcc-4_2-branch-build/stage3-gcc/../lib/gcc/i686-pc-cygwin/4.2.0/
-D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter
/usr/lib/gcc/i686-pc-cygwin/4.2.0/../../../../include/w32api -idirafter
/usr/lib/gcc/i686-pc-cygwin/4.2.0/../../../../i686-pc-cygwin/lib/../../include/w32api
test.c -quiet -dumpbase test.c -mtune=athlon-xp -march=athlon-xp -auxbase test
-g -version -o /cygdrive/c/DOCUME~1/HP_ADM~1/LOCALS~1/Temp/ccSrUn2h.s
gcc/xgcc -Bgcc -g -v test.c
gcc/cc1.exe -quiet -v -iprefix
/cygdrive/c/gcc-4_2-branch-build/stage3-gcc/../lib/gcc/i686-pc-cygwin/4.2.0/
-isystem gcc/include -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix
-idirafter /usr/lib/gcc/i686-pc-cygwin/4.2.0/../../../../include/w32api
-idirafter
/usr/lib/gcc/i686-pc-cygwin/4.2.0/../../../../i686-pc-cygwin/lib/../../include/w32api
test.c -quiet -dumpbase test.c -mtune=athlon-xp -march=athlon-xp -auxbase test
-g -version -o /cygdrive/c/DOCUME~1/HP_ADM~1/LOCALS~1/Temp/ccu73DRz.s
The is no "-DDEBUG" anywhere and only the one "DEBUG" in the ".h" file. The
compiler (both version 3.4.4 and 4.2.0) will not accept a ".h" file with the
word "DEBUG" in it.
I'm not a java expert and I don't want to break the person's work. Even if
the fix is to add a sed command to the Makefile (for the cygwin) platform
I'd be happy.
I can't help but imagine that the word "DEBUG" is a protected word - much like
"unix", "__CYGWIN__", "__GNUC__", "WINVER" - and should not be used as a
variable.
--
Summary: Word "DEBUG" used as a variable in
VMAccessController.java breaks build
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rob1weld at aol dot com
GCC build triplet: i686-pc-cygwin
GCC host triplet: i686-pc-cygwin
GCC target triplet: i686-pc-cygwin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30570