From: Iain Sandoe Date: Mon, 10 Feb 2020 19:29:30 +0000 (+0100) Subject: Darwin: -Wformat-diag fix (PR93641) X-Git-Tag: upstream/12.2.0~18471 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c88ffcc6f4f46223c219014729f33f6cb9649928;p=platform%2Fupstream%2Fgcc.git 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 PR other/93641 * config/darwin-c.c (darwin_cfstring_ref_p): Fix up last argument of strncmp. --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 39de837..3892d9a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-02-10 Iain Sandoe + + PR other/93641 + * config/darwin-c.c (darwin_cfstring_ref_p): Fix up last + argument of strncmp. + 2020-02-10 Hans-Peter Nilsson Try to generate zero-based comparisons. diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c index 6b2ba2f..85d775f 100644 --- a/gcc/config/darwin-c.c +++ b/gcc/config/darwin-c.c @@ -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. */