PCH / ObjC issue with gcc 4.0.2-pre

2005-08-26 Thread Helge Hess

Hi,

I'm experiencing some issue with using a precompiled header with an 
Objective-C file. When including the header, I'll get duplicate 
symbols, like this:

---snip---
SaxAttributeList.m:188: error: redefinition of 'struct _objc_symtab'
SaxAttributeList.m:188: error: redefinition of 'struct _objc_module'
SaxAttributeList.m:188: error: redefinition of '__objc_gnu_init'
common.h:26: error: previous definition of '__objc_gnu_init' was here
{standard input}: Assembler messages:
{standard input}:2136: Error: symbol `_OBJC_SYMBOLS' is already defined
---snap---

The same makefile/compilation flags work just fine on OSX 10.4.2.

More logs:
---snip---
[EMAIL PROTECTED]:~/dev/SOPE-4.5/sope-xml/SaxObjC$ gcc --version
gcc (GCC) 4.0.2 20050816 (prerelease) (Debian 4.0.1-5)
[EMAIL PROTECTED]:~/dev/SOPE-4.5/sope-xml/SaxObjC$ make messages=yes
Making all for library libSaxObjC...
cd .; \
/home/helge/GNUstep/Library/Makefiles/mkinstalldirs ./shared_debug_obj; 
\

rm -f obj; \
ln -s ./shared_debug_obj obj
if ! test -d ./derived_src; then \
  /home/helge/GNUstep/Library/Makefiles/mkinstalldirs ./derived_src; \
fi
gcc -x objective-c-header common.h -c \
  -pipe -Wall -Wno-protocol -Wall -DCOMPILE_FOR_GSTEP_MAKE=1 
-DSOPE_MAJOR_VERSION=4 -DSOPE_MINOR_VERSION=5 
-DSOPE_SUBMINOR_VERSION=52 -Wno-protocol 
-I/home/helge/GNUstep/Library/Headers/libFoundation/ix86/linux-gnu/GNU 
-DGNUSTEP=1 -DWITH_GSTEP_MAKE=1 -DLIB_FOUNDATION_LIBRARY=1 
-DFD_WITH_GSMAKE=1 -DGNUSTEP=1 -DGNU_RUNTIME=1 -D_REENTRANT -fPIC -g 
-Wall -DDEBUG -fno-omit-frame-pointer -DGSWARN -DGSDIAGNOSE 
-fno-strict-aliasing -fgnu-runtime -I.. -I. 
-I/home/helge/GNUstep/Library/Headers 
-I/home/helge/GNUstep//Library/Headers 
-I/home/helge/GNUstep/Library/Headers/libFoundation 
-I/home/helge/GNUstep//Library/Headers/libFoundation 
-I/home/helge/GNUstep//Library/Headers/libFoundation 
-I/home/helge/GNUstep/Library/Headers/libFoundation 
-I/home/helge/GNUstep/Library/Headers/libFoundation/./GNU 
-I/home/helge/GNUstep//Library/Headers/libFoundation/./GNU 
-I/home/helge/GNUstep//Library/Headers/libFoundation/./GNU 
-I/home/helge/GNUstep/Library/Headers/libFoundation/./GNU \

   -o derived_src/common.h.gch
gcc SaxAttributeList.m -c \
  -pipe -Wall -Wno-protocol -Wall -DCOMPILE_FOR_GSTEP_MAKE=1 
-DSOPE_MAJOR_VERSION=4 -DSOPE_MINOR_VERSION=5 
-DSOPE_SUBMINOR_VERSION=52 -Wno-protocol 
-I/home/helge/GNUstep/Library/Headers/libFoundation/ix86/linux-gnu/GNU 
-DGNUSTEP=1 -DWITH_GSTEP_MAKE=1 -DLIB_FOUNDATION_LIBRARY=1 
-DFD_WITH_GSMAKE=1 -DGNUSTEP=1 -DGNU_RUNTIME=1 -D_REENTRANT -fPIC -g 
-Wall -DDEBUG -fno-omit-frame-pointer -DGSWARN -DGSDIAGNOSE 
-fno-strict-aliasing -fgnu-runtime -I.. -I. 
-I/home/helge/GNUstep/Library/Headers 
-I/home/helge/GNUstep//Library/Headers 
-I/home/helge/GNUstep/Library/Headers/libFoundation 
-I/home/helge/GNUstep//Library/Headers/libFoundation 
-I/home/helge/GNUstep//Library/Headers/libFoundation 
-I/home/helge/GNUstep/Library/Headers/libFoundation 
-I/home/helge/GNUstep/Library/Headers/libFoundation/./GNU 
-I/home/helge/GNUstep//Library/Headers/libFoundation/./GNU 
-I/home/helge/GNUstep//Library/Headers/libFoundation/./GNU 
-I/home/helge/GNUstep/Library/Headers/libFoundation/./GNU \

  -include ./derived_src/common.h \
   -o shared_debug_obj/SaxAttributeList.o
SaxAttributeList.m:188: error: redefinition of 'struct _objc_symtab'
SaxAttributeList.m:188: error: redefinition of 'struct _objc_module'
SaxAttributeList.m:188: error: redefinition of '__objc_gnu_init'
common.h:26: error: previous definition of '__objc_gnu_init' was here
{standard input}: Assembler messages:
{standard input}:2136: Error: symbol `_OBJC_SYMBOLS' is already defined
{standard input}:2302: Error: symbol `_OBJC_MODULES' is already defined
{standard input}:2351: Error: symbol `_OBJC_CLASS_NAME_0' is already 
defined

...
[EMAIL PROTECTED]:~/dev/SOPE-4.5/sope-xml/SaxObjC$ file derived_src/common.h.gch
derived_src/common.h.gch: GCC precompiled header (version 012) for 
Objective C

---snap---

Any hints?

Thanks a lot,
  Helge
--
http://docs.opengroupware.org/Members/helge/
OpenGroupware.org



Re: gcc 4.1

2006-03-14 Thread Helge Hess

On 14. Mrz 2006, at 01:53 Uhr, Mike Stump wrote:

Am I the only one who gets those:
  DOMElement.m:283: warning: pointer type mismatch in conditional  
expression

I doubt it.


;-)


For stuff like:
  objs[1] = _ns ? _ns : (id)null;
or
  return [pathes isNotNull] ? pathes : nil;


And here all information that I can use to answer the question has  
been stripped.


I assume you refer to the types of the variables. Why would they  
matter in the two given cases? Both "(id)null" and "nil" are of type  
'id' which in turn should not conflict with any other typed ObjC  
reference?


You can find the full source of the file at:
  http://svn.opengroupware.org/SOPE/trunk/sope-xml/DOM/DOMElement.m

The relevant section for the first error:
  "DOMElement.m:283: warning: pointer type mismatch in conditional  
expression"

should be:
---snip---
...
static NSNull *null = nil;
...

- (BOOL)hasAttribute:(NSString *)_localName namespaceURI:(NSString *) 
_ns {

  id objs[2];
...
  objs[1] = _ns ? _ns : (id)null;
...
}
---snap---

Thanks a lot,
  Helge
--
http://docs.opengroupware.org/Members/helge/
OpenGroupware.org