[gcc(refs/users/marxin/heads/marxin-gcc-benchmark-branch)] Darwin: -Wformat-diag fix (PR93641)

Martin Liska marxin@gcc.gnu.org
Mon Mar 30 10:57:04 GMT 2020


https://gcc.gnu.org/g:c88ffcc6f4f46223c219014729f33f6cb9649928

commit c88ffcc6f4f46223c219014729f33f6cb9649928
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Mon Feb 10 20:29:30 2020 +0100

    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.

Diff:
---
 gcc/ChangeLog         | 6 ++++++
 gcc/config/darwin-c.c | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 39de837b326..3892d9aed53 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c
index 6b2ba2f961c..85d775f056a 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.  */


More information about the Gcc-cvs mailing list