[Patch, c* ,ObjC*] handle string objects in format checking.
IainS
developer@sandoe-acoustics.co.uk
Sun Oct 24 15:09:00 GMT 2010
Hello,
ObjC* (currently for NeXT, but potentially also with GNU runtime) can
use string object references in format args.
Darwin [and potentially other platforms, if the GNUstep people wish to
implement] can also use CFStrings from c* in the same context (as
these are essentially the same beast internally) and thus share with
ObjC*.
Since Dawin10 was released some important system headers make use of
CFStringRefs, which is a bit of show-stopper for [c, c++ and ObjC*]
CoreFoundation on Darwin10 -- this is PR44981.
We have now implemented CFString on FSF gcc and this patch adds use of
those in formatters.
ObjC strings are implemented in the normal way, with function calls
and a stub in stub-objc.
CFString is handled with a c-family target hook.
Clearly, the main part of this is darwin and ObjC*-specific...
** however we do need review and approval for the gcc/c-family changes.
boostrapped & checked on darwin9 & 10 (clears the remaining header
parse errors there) and on x86_64-unk-linux (to ensure no changes to
objc results).
OK for trunk?
Iain
gcc:
PR target/44981
* doc/tm.texi: Document TARGET_STRING_OBJECT_REF_TYPE_P hook.
* doc/tm.texi.in: TARGET_STRING_OBJECT_REF_TYPE_P: New.
* c-family/c-format.c (format_type): Add gcc_objc_string_format_type.
(valid_stringptr_type_p): New.
(handle_format_arg_attribute): Use valid_stringptr_type_p().
(check_format_string): Likewise.
(format_types_orig): Add NSString.
* c-family/c-common.h (objc_string_ref_type_p): New prototype.
* c-family/stub-objc.c: New stub.
* config/darwin-c.c (darwin_cfstring_ref_p): New.
* config/darwin-protos.h: Correct arg list for
darwin_build_constant_cfstring()
(darwin_cfstring_ref_p): New prototype.
* config/darwin.c: Add c-format.h.
(darwin_additional_format_types): New.
* config/darwin.h: (TARGET_STRING_OBJECT_REF_TYPE_P) New.
(TARGET_N_FORMAT_TYPES): New.
(TARGET_FORMAT_TYPES): New.
* target.def (string_object_ref_type_p): New hook.
gcc/objc:
PR target/44981
* objc/objc-act.c (objc_string_ref_type_p): New.
gcc/testsuite:
PR target/44981
* obj-c++.dg/property/property-2.m: Adjust for darwin10 linker warning.
* obj-c++.dg/property/property-3.mm: Likewise.
* obj-c++.dg/torture/strings/const-cfstring-1.mm: Likewise.
* objc.dg/property/property-3.m: Likewise.
* objc.dg/property/property-2.m: Likewise.
* objc.dg/torture/strings/const-cfstring-1.m: Likewise.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 165889-string-object-formats.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101024/46bbf10f/attachment.txt>
-------------- next part --------------
More information about the Gcc-patches
mailing list