]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Darwin: -Wformat-diag fix (PR93641)
authorIain Sandoe <iain@sandoe.co.uk>
Mon, 10 Feb 2020 19:29:30 +0000 (20:29 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Mon, 10 Feb 2020 19:31:39 +0000 (20:31 +0100)
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.

gcc/ChangeLog
gcc/config/darwin-c.c

index 39de837b32693c9d60bd65b68e00c51066bc3cbd..3892d9aed53a1461750ddfa70e766fbae8a5cb4d 100644 (file)
@@ -1,3 +1,9 @@
+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.
index 6b2ba2f961c1232139dd1e5da6d92866d1654144..85d775f056a0ad48298eb749a8119e9941121b20 100644 (file)
@@ -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.  */