This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: bug in g++ error output
- To: tromey at cygnus dot com
- Subject: Re: bug in g++ error output
- From: Gabriel Dos Reis <gdr at codesourcery dot com>
- Date: 27 Feb 2000 22:51:08 +0100
- Cc: Gcc Bug List <bug-gcc at gnu dot org>
- Organization: CodeSourcery, LLC
- References: <87og92coor.fsf@cygnus.com>
Tom Tromey <tromey@cygnus.com> writes:
| I'm using a relatively new cvs gcc.
|
| I have code that looks like this:
|
| try
| {
| _Jv_JNI_LocalFrame *frame
| = (_Jv_JNI_LocalFrame *) _Jv_Malloc (sizeof (_Jv_JNI_LocalFrame)
| + size * sizeof (jobject));
| }
| catch (jthrowable t)
| {
| env->ex = t;
| return JNI_ERR;
| }
|
| frame->marker = true;
|
| The bug here is that `frame' is declared inside the `try', but used
| after the `try'. Oops.
|
| g++ gives a strange message in this case:
|
| ../../../libgcj/libjava/jni.cc: In function `jint
| ../../../libgcj/libjava/jni.cc: _Jv_JNI_EnsureLocalCapacity (JNIEnv *,
| ../../../libgcj/libjava/jni.cc: __java_int)':
| ../../../libgcj/libjava/jni.cc:188: warning: unused variable `
| ../../../libgcj/libjava/jni.cc:188: warning: _Jv_JNI_LocalFrame *frame'
| ../../../libgcj/libjava/jni.cc:197: `frame' undeclared (first use this
| ../../../libgcj/libjava/jni.cc:197: function)
| ../../../libgcj/libjava/jni.cc:197: (Each undeclared identifier is
| ../../../libgcj/libjava/jni.cc:197: reported only once
| ../../../libgcj/libjava/jni.cc:197: for each function it appears in.)
|
| Look at the two lines that say `188: warning: '. I find this strange
| because g++ has apparently chosen to word wrap the message in a way
| that is hard to read. I think it would be better to format those
| lines like this:
|
| ../../../libgcj/libjava/jni.cc:188: warning: unused variable
| ../../../libgcj/libjava/jni.cc:188: `_Jv_JNI_LocalFrame *frame'
Sounds reasonable. Working on a patch.
-- Gaby
gdr@codesourcery.com CodeSourcery, LLC