[cfe-dev] GNU runtime non-fragile ABI and cleanup
David Chisnall
csdavec at swansea.ac.uk
Mon Aug 31 10:26:23 PDT 2009
On 31 Aug 2009, at 17:52, Fariborz Jahanian wrote:
> To have the effect on SL you need to provide both -fno-constant-
> cfstrings -fconstant-string-class=xx
> It is probably a gcc bug that it silently ignores -fconstant-string-
> class=xx all by itself.
In that case it is a gcc bug. A test program that just prints the
class of a constant string produces an NSCFString when compiled with -
fconstant-string-class=NSConstantString on SL:
$ cat str.m
#include <stdio.h>
#include <objc/runtime.h>
int main(void)
{
printf("%s\n", class_getName(((id)@"foo")->isa));
return 0;
}
$ gcc -fconstant-string-class=NSConstantString str.m -lobjc
Undefined symbols:
"___CFConstantStringClassReference", referenced from:
_main in cc7mMxrY.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There
is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
This should be emitting an error that the NSConstantString class is
not found. If you link this against Cocoa, you get NSCFString as the
output.
> Warning will indeed
> be useful to us.
Looking in clang-cc.cpp, it seems that other cases where incompatible
options are specified are logging an error with fprintf and exiting.
What is the correct way of issuing an option-ignored warning in clang-
cc? Or should this be handled in clang?
David
More information about the cfe-dev
mailing list