From patchwork Wed Feb 1 17:03:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 64102 Return-Path: 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 1E9603947410 for ; Wed, 1 Feb 2023 17:07:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1E9603947410 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675271249; bh=6vrJsjuPSBEnYiH6vQCIl2c/+1Z+TJJoaBWPQwlpPzM=; 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=XZh/tWYbL3DkruBHxAjWysiGB5Xuwo1CkX9oRXOuCLoKa/h+lkGuOyLHmQOr6OWw5 AENbmpYJq25ntQlvV++7o4f+LvZJLomHvkdia1kgG8MiTlTYraVrXuaHDa1L/7aax7 0NZbn7ho2S5sFfUEI11YSg6Xr9AReUN6QI0JpAwg= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id 4B0A93857B9B for ; Wed, 1 Feb 2023 17:05:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B0A93857B9B Received: by mail-ot1-x32c.google.com with SMTP id r34-20020a05683044a200b0068d4a8a8d2dso132470otv.12 for ; Wed, 01 Feb 2023 09:05:10 -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=6vrJsjuPSBEnYiH6vQCIl2c/+1Z+TJJoaBWPQwlpPzM=; b=5TNRL8vIx+GKR1zXcZgYIdtFWn3mJAYcTbHeqPukdhFgnfgQ8IH2fGBnPWV2RCg9Vu 0R/CVxr8bccHm1BzWdgcrhuUYY0ojYS7SZwcfSYfYRoBcWgS5f0DN/SQr20KaxquBVwA BkVnDURV4f86mhSRvXWg726CtAbi5toaAVG7+cgVc+SQ/4kVoyItT+D+zJpX8UiU31iV bcpl9SwHxNKGaCPHeMx5EnyHxwvKuiBhRQnkp0UMCvPr4HikWR9WT4YTPPxOFVAH5AfO rPi1KyzcxEPBtXTnNdAXrgKY3YYijUuc79+d3eMCs/4/rBGng6q9nL6zlOp7CccT+j7P S/qw== X-Gm-Message-State: AO0yUKWwoH6J0Xg5jZq/vKtEWk7oTeTIqeBwXsed+AVKjOaYqf4jdaOP S1MOk4Bg0FdaDt3LRIQ46XX3jZDUUT2M9vN3qU0= X-Google-Smtp-Source: AK7set9aA2ZQ45VOHdSebCZv8NyrE6aj9FSgDZ7A/9dK1jnpSxUnEK3NeoZrBkZiyLOss+MmWkLwhA== X-Received: by 2002:a9d:65c2:0:b0:68b:bc6c:d955 with SMTP id z2-20020a9d65c2000000b0068bbc6cd955mr1618439oth.17.1675271108661; Wed, 01 Feb 2023 09:05:08 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c2:1887:d2ed:98c2:d2cc:bf06]) by smtp.gmail.com with ESMTPSA id b17-20020a056830311100b006863ccbf067sm8077090ots.74.2023.02.01.09.05.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 09:05:07 -0800 (PST) To: libc-alpha@sourceware.org, Richard Henderson , Noah Goldstein , Jeff Law , Xi Ruoyao Subject: [PATCH v11 22/29] string: Hook up the default implementation on test-strnlen Date: Wed, 1 Feb 2023 14:03:59 -0300 Message-Id: <20230201170406.303978-23-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230201170406.303978-1-adhemerval.zanella@linaro.org> References: <20230201170406.303978-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Also remove the SIMPLE_STRNLEN, which is not used anywhere. Reviewed-by: Richard Henderson --- string/test-strnlen.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/string/test-strnlen.c b/string/test-strnlen.c index 8b5372c3a1..ef73dd34f4 100644 --- a/string/test-strnlen.c +++ b/string/test-strnlen.c @@ -43,17 +43,30 @@ typedef size_t (*proto_t) (const CHAR *, size_t); -IMPL (STRNLEN, 1) - -/* Naive implementation to verify results. */ -size_t -SIMPLE_STRNLEN (const CHAR *s, size_t maxlen) -{ - size_t i; - - for (i = 0; i < maxlen && s[i]; ++i); - return i; -} +/* Also check the default implementation. */ +#undef STRNLEN +#ifndef WIDE +# define MEMCHR __memchr_default +# define weak_alias(a, b) +# define libc_hidden_def(a) +# define libc_hidden_builtin_def(a) +# include "string/memchr.c" +# undef STRNLEN +# define STRNLEN __strnlen_default +# define memchr __memchr_default +# include "string/strnlen.c" +IMPL (__strnlen_default, 1) +#else +# define WMEMCHR __wmemchr_default +# define weak_alias(a, b) +# define libc_hidden_def(a) +# define libc_hidden_weak(a) +# include "wcsmbs/wmemchr.c" +# define WCSNLEN __wcsnlen_default +# define wmemchr __wmemchr_default +# include "wcsmbs/wcsnlen.c" +IMPL (__wcsnlen_default, 1) +#endif static void do_one_test (impl_t *impl, const CHAR *s, size_t maxlen, size_t exp_len)