This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Compatibility: g++-2.7.2 and g++-2.95.2
- To: bug-gcc at gnu dot org
- Subject: Compatibility: g++-2.7.2 and g++-2.95.2
- From: "Ulrich Windl" <Ulrich dot Windl at rz dot uni-regensburg dot de>
- Date: Fri, 3 Mar 2000 08:45:26 +0100
- Organization: Universitaet Regensburg, Klinikum
Hello,
I have a problem: I have to change a C++ program last modified
in 1997. At that time it worked fine with gcc-2.7.2. As I now
have more recent tools, I use gcc-2.95.2 on HP-UX 11.0.
I was able to fix most problems in my code that the old compiler
did not complain about, but now I have a real problem with
"__FUNCTION__":
I use it to generate tags for error messages, using some macros.
With gcc-2.95.2 I get these (rather useless) error messages:
rkdvmhp3:windl(31) % gmake
g++ -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wtr
aditional -Wstrict-prototypes -Wnested-externs -O2 -ggdb3 -DPATH_MAX=255 -pipe
-c -o HCMextract.o HCMextract.cc
In file included from /opt/gcc/lib/gcc-lib/hppa2.0n-hp-hpux11.00/2.95.2/include/
limits.h:117,
from /opt/gcc/lib/gcc-lib/hppa2.0n-hp-hpux11.00/2.95.2/include/
syslimits.h:7,
from /opt/gcc/lib/gcc-lib/hppa2.0n-hp-hpux11.00/2.95.2/include/
limits.h:11,
from HCMextract.cc:114:
/usr/include/limits.h:285: warning: `PATH_MAX' redefined
*Initialization*:1: warning: this is the location of the previous definition
HCMextract.cc: In method `int Lock::lock()':
HCMextract.cc:203: parse error before `;'
HCMextract.cc: In method `int Lock::unlock()':
HCMextract.cc:216: parse error before `;'
HCMextract.cc: In method `int Lock::function()':
HCMextract.cc:242: parse error before `;'
HCMextract.cc: In function `int extract_data(int)':
HCMextract.cc:271: parse error before `;'
...
Line 242 reads ``SCOPE("Lock::function");''
The macros in question are (top down):
#define SCOPE(name) DECLARE_INSTANCE(name); Scope scope__
#ifdef __GNUC__
#define DECLARE_INSTANCE(name) DECLARE_INSTANCE_P1 __FUNCTION__
#else
#define DECLARE_INSTANCE(name) DECLARE_INSTANCE_P1 name
#endif
#define DECLARE_INSTANCE_P1 const char instance[] = __FILE__ "::"
The preprocessor actually expands it to this:
const char instance[] = "HCMextract.cc" "::" __FUNCTION__ ; Scope scope__ ;
In the documentation provided, the __FUNCTION__ is still documented.
Do I need a different option to enable it?
Regards,
Ulrich Windl