Message ID | 20230202181149.2181553-23-adhemerval.zanella@linaro.org |
---|---|
State | Committed |
Commit | 52d9adc9e33819323eb971712c136bd618cdea1d |
Headers |
Return-Path: <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 96B5F38582BC for <patchwork@sourceware.org>; Thu, 2 Feb 2023 18:15:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 96B5F38582BC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675361736; bh=EdEacAiDNy91IxfCbhUa2BV1sVEmxuELNg72O36/HDw=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=nzqJzuikNwFtVTmIXxEAygdirx3v+o21J8faTxVKVfOThvojPAuvKq3OgTKhNjw6u Y3sllJnJPn1VXd/K8WBcSECSAvWSvnsfDkxxs7V0yRRzKnDOLjTMZZxBQ/q/nFM4KC G/QjuJyRmxWc+aFKmtnENPxEmKobTy+UIX57L/Rc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id D619D3858004 for <libc-alpha@sourceware.org>; Thu, 2 Feb 2023 18:12:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D619D3858004 Received: by mail-ot1-x336.google.com with SMTP id v24-20020a05683011d800b0068bdd29b160so681536otq.13 for <libc-alpha@sourceware.org>; Thu, 02 Feb 2023 10:12:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EdEacAiDNy91IxfCbhUa2BV1sVEmxuELNg72O36/HDw=; b=LsjLS/3/acnEp8tLoSK5bncvsotfGOi4IT6kKNsoeb4Rt6ylLwx89koMuZBZTs/D4u z7GI70ak/hXiZMeejqZ1Go4kb1LuAzwqnQphruw730Rn3lI++wYAqkkgqMqXl4n146HB FOowKXhOamqQeL5jL2Ef7lMUBKV+cdV2auNS8XMqY4tVCWCox/8v7Tyy5qYXIAC01d09 Ek7uUMA0kqkXpDRIoJ6wZNbOlPR68hlOKHp/QZ1sWDfLVu0bLSrHbbSBd/sSkn5TWQys SjuSbLmk7hDa85SoRR4DC1yU+umgukFqk33jB+Yp26eCH8/yoDy5pZCIHtNRycJzWyBY gIpA== X-Gm-Message-State: AO0yUKUjmm08cqlfIor3OqT9DZY2tnyDR+gTw4Vs3GLqR6HLyUWhaYFe QTt49FkKukkP1iYqeCbb7fyZ7lRXfYGlWo+IHbk= X-Google-Smtp-Source: AK7set95smygH1c1xDZSEC1GlyoaI33PKqV9MHqgxSBWKKA+RaARy85sH2cEUApKWqo0+IPuSMD8ww== X-Received: by 2002:a9d:3e7:0:b0:68b:e3c5:6eb0 with SMTP id f94-20020a9d03e7000000b0068be3c56eb0mr1145196otf.22.1675361568782; Thu, 02 Feb 2023 10:12:48 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c2:1887:da12:b9d3:2162:a28c]) by smtp.gmail.com with ESMTPSA id ci10-20020a05683063ca00b00684a10970adsm126689otb.16.2023.02.02.10.12.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Feb 2023 10:12:47 -0800 (PST) To: libc-alpha@sourceware.org, Richard Henderson <richard.henderson@linaro.org>, Jeff Law <jeffreyalaw@gmail.com>, Xi Ruoyao <xry111@xry111.site>, Noah Goldstein <goldstein.w.n@gmail.com> Subject: [PATCH v12 22/31] string: Hook up the default implementation on test-strlen Date: Thu, 2 Feb 2023 15:11:40 -0300 Message-Id: <20230202181149.2181553-23-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202181149.2181553-1-adhemerval.zanella@linaro.org> References: <20230202181149.2181553-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org> Reply-To: Adhemerval Zanella <adhemerval.zanella@linaro.org> Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
Improve generic string routines
|
|
Checks
Context | Check | Description |
---|---|---|
dj/TryBot-apply_patch | success | Patch applied to master at the time it was sent |
Commit Message
Adhemerval Zanella
Feb. 2, 2023, 6:11 p.m. UTC
Also remove the simple_STRLEN and builtin_strlen, which are not used
anywhere.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
string/test-strlen.c | 31 ++++++++++++++-----------------
1 file changed, 14 insertions(+), 17 deletions(-)
Comments
On Thu, Feb 2, 2023 at 12:12 PM Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote: > > Also remove the simple_STRLEN and builtin_strlen, which are not used > anywhere. Think I'm slightly opposed to removing the simple_* test implementations as they can be useful to hook in when debugging. > > Reviewed-by: Richard Henderson <richard.henderson@linaro.org> > --- > string/test-strlen.c | 31 ++++++++++++++----------------- > 1 file changed, 14 insertions(+), 17 deletions(-) > > diff --git a/string/test-strlen.c b/string/test-strlen.c > index 81adf23737..0f98576f40 100644 > --- a/string/test-strlen.c > +++ b/string/test-strlen.c > @@ -37,27 +37,24 @@ > > typedef size_t (*proto_t) (const CHAR *); > > -/* Naive implementation to verify results. */ > -size_t > -simple_STRLEN (const CHAR *s) > -{ > - const CHAR *p; > - > - for (p = s; *p; ++p); > - return p - s; > -} > +IMPL (STRLEN, 1) > > +/* Also check the generic implementation. */ > +#undef STRLEN > +#undef weak_alias > +#define weak_alias(a, b) > +#undef libc_hidden_builtin_def > +#define libc_hidden_builtin_def(a) > #ifndef WIDE > -size_t > -builtin_strlen (const CHAR *p) > -{ > - return __builtin_strlen (p); > -} > -IMPL (builtin_strlen, 0) > +# define STRLEN __strlen_default > +# include "string/strlen.c" > +IMPL (__strlen_default, 1) > +#else > +# define WCSLEN __wcslen_default > +# include "wcsmbs/wcslen.c" > +IMPL (__wcslen_default, 1) > #endif > > -IMPL (STRLEN, 1) > - > > static void > do_one_test (impl_t *impl, const CHAR *s, size_t exp_len) > -- > 2.34.1 >
On 03/02/23 20:30, Noah Goldstein wrote: > On Thu, Feb 2, 2023 at 12:12 PM Adhemerval Zanella > <adhemerval.zanella@linaro.org> wrote: >> >> Also remove the simple_STRLEN and builtin_strlen, which are not used >> anywhere. > Think I'm slightly opposed to removing the simple_* test implementations > as they can be useful to hook in when debugging. I think the simple_* test are really easy to come by if you need to debug a string/memory implementation; and they do consume CPU cycles on testing with no apparent gain. >> >> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> >> --- >> string/test-strlen.c | 31 ++++++++++++++----------------- >> 1 file changed, 14 insertions(+), 17 deletions(-) >> >> diff --git a/string/test-strlen.c b/string/test-strlen.c >> index 81adf23737..0f98576f40 100644 >> --- a/string/test-strlen.c >> +++ b/string/test-strlen.c >> @@ -37,27 +37,24 @@ >> >> typedef size_t (*proto_t) (const CHAR *); >> >> -/* Naive implementation to verify results. */ >> -size_t >> -simple_STRLEN (const CHAR *s) >> -{ >> - const CHAR *p; >> - >> - for (p = s; *p; ++p); >> - return p - s; >> -} >> +IMPL (STRLEN, 1) >> >> +/* Also check the generic implementation. */ >> +#undef STRLEN >> +#undef weak_alias >> +#define weak_alias(a, b) >> +#undef libc_hidden_builtin_def >> +#define libc_hidden_builtin_def(a) >> #ifndef WIDE >> -size_t >> -builtin_strlen (const CHAR *p) >> -{ >> - return __builtin_strlen (p); >> -} >> -IMPL (builtin_strlen, 0) >> +# define STRLEN __strlen_default >> +# include "string/strlen.c" >> +IMPL (__strlen_default, 1) >> +#else >> +# define WCSLEN __wcslen_default >> +# include "wcsmbs/wcslen.c" >> +IMPL (__wcslen_default, 1) >> #endif >> >> -IMPL (STRLEN, 1) >> - >> >> static void >> do_one_test (impl_t *impl, const CHAR *s, size_t exp_len) >> -- >> 2.34.1 >>
diff --git a/string/test-strlen.c b/string/test-strlen.c index 81adf23737..0f98576f40 100644 --- a/string/test-strlen.c +++ b/string/test-strlen.c @@ -37,27 +37,24 @@ typedef size_t (*proto_t) (const CHAR *); -/* Naive implementation to verify results. */ -size_t -simple_STRLEN (const CHAR *s) -{ - const CHAR *p; - - for (p = s; *p; ++p); - return p - s; -} +IMPL (STRLEN, 1) +/* Also check the generic implementation. */ +#undef STRLEN +#undef weak_alias +#define weak_alias(a, b) +#undef libc_hidden_builtin_def +#define libc_hidden_builtin_def(a) #ifndef WIDE -size_t -builtin_strlen (const CHAR *p) -{ - return __builtin_strlen (p); -} -IMPL (builtin_strlen, 0) +# define STRLEN __strlen_default +# include "string/strlen.c" +IMPL (__strlen_default, 1) +#else +# define WCSLEN __wcslen_default +# include "wcsmbs/wcslen.c" +IMPL (__wcslen_default, 1) #endif -IMPL (STRLEN, 1) - static void do_one_test (impl_t *impl, const CHAR *s, size_t exp_len)