This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Updated: [Patch, c* ,ObjC*] handle string objects in format checking.

On 1 Nov 2010, at 08:09, Paolo Bonzini wrote:

2010-10-31 Nicola Pero <>

+	* c-common.h (objc_is_string_type): New.
+	(objc_maybe_extract_string_cst_from_objc_string): New.
+	* stub-objc.c (objc_is_string_type): New.
+	(objc_maybe_extract_string_cst_from_objc_string): New.	
+	* c-format.c (is_string_type): New.
+	(handle_format_arg_attribute): Updated call to
+	check_format_string.  Use is_string_type.
+	(check_format_string): Added objc_string argument.  If set, check
+	that the format string is an Objective-C string.
+	(handle_format_attribute): For nsstring_format_type, check that
+	format strings are Objective-C strings.
+	(struct format_wanted_type): Added objc_object_flag.
+	(nsstring_length_specs): New.
+	(nsstring_flag_pairs): New.
+	(nsstring_flag_specs): New.
+	(nsstring_char_table): New.
+	(check_format_arg): Implemented nsstring_format_type.
+	(check_format_info_main): Implemented '@' as valid flag2.
+	(check_format_types): Implemented objc_object_flag.
+	* c-format.h: Updated comments.
+	(T89_AT): New.	

Just a heads-up: my patch at conflicts with this a bit, in that it changes a few messages in the attribute((format)) output. So the tests would have to be adjusted.

I saw your patch and figured that whichever went in first there might be some tweaking of things ...
... I'm happy to adjust tests in ObjC*.

Apropos Nicola's additions, I wonder if we really need to keep the handling of ObjC strings in ObJC.
Can we guarantee always to be able to fetch an equivalent string that is parse-able by the printf machinery?

(just thinking aloud).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]