This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/47997] gcc on macosx: "ld: warning: -fwritable-strings not compatible with literal CF/NSString"
- From: "tobias.netzel at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 20 Jul 2011 20:51:43 +0000
- Subject: [Bug target/47997] gcc on macosx: "ld: warning: -fwritable-strings not compatible with literal CF/NSString"
- Auto-submitted: auto-generated
- References: <bug-47997-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47997
--- Comment #15 from Tobias Netzel <tobias.netzel at googlemail dot com> 2011-07-20 20:51:12 UTC ---
Created attachment 24800
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24800
sample objective-c code that still causes the warning
Said warning does still occur when linking many Objective-C and Objective-C++
files from the mozilla codebase.
The attached sample code and playing a little with it reveals the following
behaviour of gcc:
(to be compiled as follows: "gcc main.m -framework Foundation")
- the strings "Me", "Myself", "I", "Three", "a", "b", "c", "d", "e", "f" and ""
are put into (__TEXT,__const) -> warning
- the strings "One", "Two", "You" and "foo" are put into (__TEXT,__cstring) ->
no warning
- when adding more strings to "NSMutableArray *mutable" or to the
initialization of "NSArray *arr", all strings that have a length other than
three characters are put into (__TEXT,__const) (-> warning) and all strings of
exactly three characters are put into (__TEXT,__cstring) (-> no warning)
- when there's only one string in (__TEXT,__const) there is no warning!