|
From: Per P. <per...@ma...> - 2005-05-08 19:33:25
|
On May 8, 2005, at 18:47, Hans-Bernhard Broeker wrote: > Per Persson wrote: >> I've had a report that gnuplot won't compile on OS X 10.4 and gcc 4.0 >> because of a conflict with a static char array "Class" in gplt_x11.c >> and the Objective-C type "Class". It has not been a problem before so >> it seems gcc 4 is pickier about this than gcc 3.x. > > Or maybe it's plain wrong about it. Stranger bugs have crept into > little-used corners of GCC before. Agreed. > >> When detecting Mac OS X and libaquaterm "-ObjC" is added to CFLAGS >> (apple.m4), and every file is compiled as ObjC although only >> aquaterm.trm needs the "-ObjC" flag. >> As I see it, there are two ways to fix this: >> 1) Change the name "Class" in gplt_x11.c >> 2) Increase granularity in buildsystem to only compile aquaterm.trm >> (or term.c) with "-ObjC" > > I'm not convinced that (2) can work. -ObjC effectively switches to a > different language, with possibly different calling conventions and > name mangling rules. ObjC is a strict superset of C, in the sense that any C (well make that C89 or whatever) code *should* compile using the ObjC compiler. There is no C++ style name mangling going on in ObjC. It is common practice to mix C and ObjC using each where it is best suited. > I wouldn't be surprised in any way if this broke the > link completely. Not a linker issue, it is the compiler complaining... The following is from a bugreport to DarwinPorts (package manager) list: > if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../term -I../term > -DBINDIR=\"/opt/local/bin\" - > DX11_DRIVER_DIR=\"/opt/local/libexec/gnuplot/4.0\" -DCONTACT=\"gnuplot- > bugs at lists.sourceforge.net\" > -DHELPFILE=\"/opt/local/share/gnuplot/4.0/gnuplot.gih\" -I/opt/local/ > include -no-cpp-precomp -I/usr/X11R6/include -I/opt/local/include > -I/opt/local/include -g -O2 - > ObjC -MT gplt_x11.o -MD -MP -MF ".deps/gplt_x11.Tpo" \ > -c -o gplt_x11.o `test -f 'gplt_x11.c' || echo './'`gplt_x11.c; \ > then mv ".deps/gplt_x11.Tpo" ".deps/gplt_x11.Po"; \ > else rm -f ".deps/gplt_x11.Tpo"; exit 1; \ > fi > gplt_x11.c:519: error: 'Class' redeclared as different kind of symbol > <built-in>:0: error: previous declaration of 'Class' was here > make[3]: *** [gplt_x11.o] Error 1 > make[2]: *** [all-recursive] Error 1 > make[1]: *** [all-recursive] Error 1 > make: *** [all] Error 2 As I said, until I get 10.4 installed I really can't explore this further. Still, I think that (2) would be nice to implement some time from a pure cleanlyness perpspective... /Per |