Commit c88ffcc6 by Iain Sandoe

Darwin: -Wformat-diag fix (PR93641)

The length used for the comparison for 'CFStringRef' was only comparing
for 'CFString', potentially allowing mismatched identifiers.

2020-02-10  Iain Sandoe  <iain@sandoe.co.uk>

	PR other/93641
	* config/darwin-c.c (darwin_cfstring_ref_p): Fix up last
	argument of strncmp.
parent 7848054c
2020-02-10 Iain Sandoe <iain@sandoe.co.uk>
PR other/93641
* config/darwin-c.c (darwin_cfstring_ref_p): Fix up last
argument of strncmp.
2020-02-10 Hans-Peter Nilsson <hp@axis.com>
Try to generate zero-based comparisons.
......
......@@ -809,7 +809,8 @@ darwin_cfstring_ref_p (const_tree strp)
tn = DECL_NAME (tn);
return (tn
&& IDENTIFIER_POINTER (tn)
&& !strncmp (IDENTIFIER_POINTER (tn), "CFStringRef", 8));
&& !strncmp (IDENTIFIER_POINTER (tn), "CFStringRef",
strlen ("CFStringRef")));
}
/* At present the behavior of this is undefined and it does nothing. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment