public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-4236] c++: don't use strchrnul [PR107781]
@ 2022-11-22 14:30 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2022-11-22 14:30 UTC (permalink / raw)
  To: gcc-cvs

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

commit r13-4236-gac5054144bd2248e948842937448eb5f4ce36bfd
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Nov 21 17:42:14 2022 -0500

    c++: don't use strchrnul [PR107781]
    
    The contracts implementation was using strchrnul, which is a glibc
    extension, so bootstrap broke on non-glibc targets.  Use C89 strcspn
    instead.
    
            PR c++/107781
    
    gcc/cp/ChangeLog:
    
            * contracts.cc (role_name_equal): Use strcspn instead
            of strchrnul.

Diff:
---
 gcc/cp/contracts.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/contracts.cc b/gcc/cp/contracts.cc
index f3afcc62ba0..a9097016768 100644
--- a/gcc/cp/contracts.cc
+++ b/gcc/cp/contracts.cc
@@ -210,8 +210,8 @@ lookup_concrete_semantic (const char *name)
 static bool
 role_name_equal (const char *role, const char *name)
 {
-  size_t role_len = strchrnul (role, ':') - role;
-  size_t name_len = strchrnul (name, ':') - name;
+  size_t role_len = strcspn (role, ":");
+  size_t name_len = strcspn (name, ":");
   if (role_len != name_len)
     return false;
   return strncmp (role, name, role_len) == 0;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-22 14:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-22 14:30 [gcc r13-4236] c++: don't use strchrnul [PR107781] Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).