From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 95B18389042B for ; Tue, 28 Nov 2023 09:20:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 95B18389042B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 95B18389042B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701163210; cv=none; b=lmuF2UeFKH3JolJj7lj0+cWbnWo2Y81x/4r+3d4mMJ6rlIiSFXwfycCdANuAZ1DW5ZzEcDWHVtcARhLJnjSbvH9y0ElnA4ZiUpRC06LU9dDNhZGRcuNOUp9qG08m9R8SNqn7ZzmdWeifOKWTYWG8M0Zg6dlq6hKH+foWlrCOL38= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701163210; c=relaxed/simple; bh=LvUZNqEWtGopJwKrygRXuaFT+Q7XIsoGiFsKmtc8kWk=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=sKtjM9xyoEpL7t4Shx29PTMK2TITnnFMUBBBfFxJfx7w2Eppdjf9P597Uh+khvaWFreQ1lTDls2gw1JLm3YgS07RLyw8trcw0bEtKhLfPbOzA4gXhOIhUSWOvqNzHEO/a5+yZ/rKC4v6L5afUOiUP1UXDU6bYKP5VRlGDz/UT7I= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701163209; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=slvMjatfJdm0J7y4XW36qx82U7Y2wS1HnWLh9WMTB2k=; b=CqSEsuopjK0+bR0Rd6Grmd0LXBOc1nYHJqWkIgc1pk4YR065YQN2fXVku/YVQmVSvGkV0X yCJiBsX1eMUHtsEfNBkre+2h39mmUJ1B4Ec8lsDHszCKztw+LAYVHWbfxxyS0dR1NFdg6G CTjmvB/X6CeUTYjoBb+KEuzD2xBNAac= Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-657-UVf-pFMlOnabNLdq0ZLl-A-1; Tue, 28 Nov 2023 04:20:07 -0500 X-MC-Unique: UVf-pFMlOnabNLdq0ZLl-A-1 Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-2859d0d09a3so4708195a91.0 for ; Tue, 28 Nov 2023 01:20:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701163206; x=1701768006; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=slvMjatfJdm0J7y4XW36qx82U7Y2wS1HnWLh9WMTB2k=; b=HMutPbGaBQdnmDgCBbt1OAet4HbvYQEsbJXH10Dya/DJnJTDlFFa3YC066vigdz9xZ 59xJX9nVo78rnKEwGQknr93rbB2O6wijt+kmEIo/QBnv3dlFgDxo+emtkKsA34z/PivS Dsvf55taUekg63JKNXQy/EMoT2878VkJFD6iI6o0A9W4SGsZzuqQuq+E2ApMfYLJ48vJ jBQqjKO2dce5ZsO4Kv2Gd7UQNK5ESBdkpHpL9uXyexUGydY8dq/m2Z3sWe2vcnDpRcye o7Y3vCGLI0iHcZJDJJ9PaMmOiwmJzwEtcBn/GPeH9cNSXwmVyXrzoaavJxa9f1oexTNN GntQ== X-Gm-Message-State: AOJu0YyisdkQWimL5R2Ftbe4dR+2H/0j5+CiNZDStyh6qlHMsvD+ePzB Bnd2ODCT3jN5riZLaoYhiHKYeyuOBiZWEXzEpc6aGacg6y+L9e1B2ZtSdWUSmSKT3/5QonkjMpk uVE49ud0EDTMHO57CDoyTwuCkLzNhrUiqdjM/xIt23ICdxAOK X-Received: by 2002:a05:6a20:da86:b0:18c:57a7:ea29 with SMTP id iy6-20020a056a20da8600b0018c57a7ea29mr8975048pzb.45.1701163206462; Tue, 28 Nov 2023 01:20:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGYty8qixfBpJuqCcuI1CLoAcBB5sgfGxBXmQowwIUB6aoQnIdDLW6bCgoOoW0n4nyfkcwkAhTPVgq5e3G6SnA= X-Received: by 2002:a05:6a20:da86:b0:18c:57a7:ea29 with SMTP id iy6-20020a056a20da8600b0018c57a7ea29mr8975031pzb.45.1701163206097; Tue, 28 Nov 2023 01:20:06 -0800 (PST) MIME-Version: 1.0 References: <20231127033908.13249-1-tdevries@suse.de> In-Reply-To: <20231127033908.13249-1-tdevries@suse.de> From: Alexandra Petlanova Hajkova Date: Tue, 28 Nov 2023 10:19:55 +0100 Message-ID: Subject: Re: [PATCH 1/2] [gdb/tui] Use const std::string for string literals in tui-stack.c To: Tom de Vries Cc: gdb-patches@sourceware.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="0000000000009ace7b060b32ece2" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --0000000000009ace7b060b32ece2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Nov 27, 2023 at 4:39=E2=80=AFAM Tom de Vries wro= te: > I noticed in gdb/tui/tui-stack.c a source-level micro-optimization where > strlen with a string literal argument: > ... > strlen ("bla") > ... > is replaced with sizeof: > ... > sizeof ("bla") - 1 > ... > > The benefit of this is that the optimization is also done at O0, but the > drawback is that it makes expression harder to read. > > Use const std::string to encapsulate the string literals, and use > std::string::size () instead. > > I tried making the string names (PROC_PREFIX, LINE_PREFIX, PC_PREFIX and > SINGLE_KEY) lower-case, but that clashed with a pre-existing pc_prefix, so > I've them upper-case. > > Tested on x86_64-linux. > > The last paragraph of the commit message sounds a bit confusing, I mean "I've them upper-case". Maybe you could rephrase it? I can confirm the change adds no regressions on ppc64le Fedora Rawhide. --0000000000009ace7b060b32ece2--