diff options
author | Iain Sandoe <iain@sandoe.co.uk> | 2020-02-10 20:29:30 +0100 |
---|---|---|
committer | Iain Sandoe <iain@sandoe.co.uk> | 2020-02-10 20:31:39 +0100 |
commit | c88ffcc6f4f46223c219014729f33f6cb9649928 (patch) | |
tree | 6fd91f0fc7707f21136c522d39c8efbb6dd9812e /gcc | |
parent | 7848054c68bad6e2aa40cb59f77cc99bd8448d52 (diff) | |
download | gcc-c88ffcc6f4f46223c219014729f33f6cb9649928.zip gcc-c88ffcc6f4f46223c219014729f33f6cb9649928.tar.gz gcc-c88ffcc6f4f46223c219014729f33f6cb9649928.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/darwin-c.c | 3 |
2 files changed, 8 insertions, 1 deletions
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 <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 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. */ |