From patchwork Tue Feb 11 02:30:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 1236128 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-519301-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=GDNSFUKF; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Gmx11n48z9sP7 for ; Tue, 11 Feb 2020 13:31:16 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=FK/FLgUaeeMl 6MERAd/8g7icJhM184CkiFE2paloNFEIId39gyHUA7XS4/izA29hrNyoza7eJ/pO CZWbt3QR9BTQb1gf2bb4qx+582lVTrI7MFwZ1eLyXvp114Fv9dGockTgVSFGnYt7 zrRGoCTlDGzBHSZ+9fzEptKNTAK7KSs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=ddNZiBDlkswO/f6Kls SLxMjWRKU=; b=GDNSFUKFEPH39avfTKLQp3NGW0W7xyqavbmoIU4sAmI2nvk0nu 3u8WFEc4p/EftAkdrag70c8z10AKrJVaGvrpcTijMEdIUhoiTztjWavOtwHoG5/u p19pOnvvaZ1axMCa+XsYMmC3PoIqEAfZiqyTjAFZJ+cnRycBeAP9JjpP8= Received: (qmail 34625 invoked by alias); 11 Feb 2020 02:31:08 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 34409 invoked by uid 89); 11 Feb 2020 02:30:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT autolearn=ham version=3.3.1 spammy=committing, 1.8.3.1, 1831 X-HELO: gcc1-power7.osuosl.org Received: from gcc1-power7.osuosl.org (HELO gcc1-power7.osuosl.org) (140.211.15.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Feb 2020 02:30:50 +0000 Received: by gcc1-power7.osuosl.org (Postfix, from userid 10019) id 19384124030C; Tue, 11 Feb 2020 02:30:47 +0000 (UTC) From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Cc: Segher Boessenkool Subject: [PATCH] rs6000: Use strlen instead of sizeof - 1 Date: Tue, 11 Feb 2020 02:30:45 +0000 Message-Id: <136c18ed814dea8942251304535b88a8c17f8ce2.1581387959.git.segher@kernel.crashing.org> X-IsSubscribed: yes It is easier to read and understand strlen ("string") than it is to read and understrand sizeof ("string") - 1 . Tested on powerpc64-linux {-m32,-m64}. Committing to trunk. Segher 2020-02-10 Segher Boessenkool * config/rs6000/rs6000.c (rs6000_debug_print_mode): Don't use sizeof where strlen is more legible. (rs6000_builtin_vectorized_libmass): Ditto. (rs6000_print_options_internal): Ditto. --- gcc/config/rs6000/rs6000.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index fc68976..a6fd1e6 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -2135,7 +2135,7 @@ rs6000_debug_print_mode (ssize_t m) spaces = 0; } else - spaces += sizeof (" Reload=sl") - 1; + spaces += strlen (" Reload=sl"); if (reg_addr[m].scalar_in_vmx_p) { @@ -2143,7 +2143,7 @@ rs6000_debug_print_mode (ssize_t m) spaces = 0; } else - spaces += sizeof (" Upper=y") - 1; + spaces += strlen (" Upper=y"); if (rs6000_vector_unit[m] != VECTOR_NONE || rs6000_vector_mem[m] != VECTOR_NONE) @@ -5206,7 +5206,7 @@ rs6000_builtin_vectorized_libmass (combined_fn fn, tree type_out, if (!bname) return NULL_TREE; - strcpy (name, bname + sizeof ("__builtin_") - 1); + strcpy (name, bname + strlen ("__builtin_")); strcat (name, suffix); if (n_args == 1) @@ -23547,7 +23547,7 @@ rs6000_print_options_internal (FILE *file, if ((flags & mask) == 0) { no_str = "no-"; - len += sizeof ("no-") - 1; + len += strlen ("no-"); } flags &= ~mask; @@ -23558,7 +23558,7 @@ rs6000_print_options_internal (FILE *file, if ((flags & mask) != 0) { no_str = "no-"; - len += sizeof ("no-") - 1; + len += strlen ("no-"); } flags |= mask; @@ -23574,7 +23574,7 @@ rs6000_print_options_internal (FILE *file, fprintf (file, "%s%s%s%s", comma, prefix, no_str, name); comma = ", "; - comma_len = sizeof (", ") - 1; + comma_len = strlen (", "); } fputs ("\n", file);