From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id 224423858401 for ; Sat, 6 Nov 2021 20:29:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 224423858401 Received: by mail-wr1-x429.google.com with SMTP id s13so19452589wrb.3 for ; Sat, 06 Nov 2021 13:29:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4DNoN6NI5Z7ZBBciooiufayZuVmQRQNAJQSce4iQTns=; b=WH6MA+/h4BiJpah+guAT7YaQbVeXL04FdEBnYrNx8iwW5m4h6M37EMzm63oeFpJf/v njSfrxr5pSCGXmBna+NwOQ/ARudPwEI9wxwyJffeX9umEL5h2iUftSN+CWqAJAa8bmcp 3hVW7YoG9SeqBcnQnO0Z8kN1BIhIkpj+ZbkiKdVraajTYdfIR8gFyL29NbKOaw8yfjBL ZIyvwOf2Fm97QxH7CH7QlBZA4mlNvIZ+/TKSI6A1d/MBtdikH7mZDO+mhunR7TnmfoTy rhxQAo25n2iv59P2O76hDZnvl94xpno2wXlZimzHzQ9KMKrVI7ysgZCBfHJf/BC4UkZ8 yvkQ== X-Gm-Message-State: AOAM533QdOAqqvRadoke3se2fGAKWhEl3tFNc38iIVCg3vUF2uSolQ4p hB4STqHayd/xzKUQaJgAvEk= X-Google-Smtp-Source: ABdhPJxC9fGKhu0OcDoqoAxy39j/YRLUQHF/1PXRX2fxRgI2ODtktn5WIcUkAmjAZgfA6bdmUTtXDQ== X-Received: by 2002:a5d:5244:: with SMTP id k4mr75159287wrc.77.1636230598140; Sat, 06 Nov 2021 13:29:58 -0700 (PDT) Received: from nbbrfq (dynamic-2bq7di4u2lfl4qjka9-pd01.res.v6.highway.a1.net. [2001:871:227:33a8:f6a3:c58c:7641:e771]) by smtp.gmail.com with ESMTPSA id 6sm11407701wma.48.2021.11.06.13.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Nov 2021 13:29:57 -0700 (PDT) Date: Sat, 6 Nov 2021 21:29:42 +0100 From: Bernhard Reutner-Fischer To: Jason Merrill Cc: rep.dot.nop@gmail.com, Marek Polacek , Marek Polacek via Gcc-patches , Jakub Jelinek Subject: Re: [PATCH v5] attribs: Implement -Wno-attributes=vendor::attr [PR101940] Message-ID: <20211106212942.0d3c0fa8@nbbrfq> In-Reply-To: <516f3ddd-8634-9d73-ddd4-ae470f4284cf@redhat.com> References: <20210920170658.28014-1-polacek@redhat.com> <20210920173859.GK304296@tucnak> <20210920190809.GM304296@tucnak> <8636350f-e588-12d1-b687-89245de0b62d@redhat.com> <89690210-3ac3-9486-1fa0-742fc67d3748@redhat.com> <84D9B2CE-EA9B-46FB-9BF5-809D29B7018E@gmail.com> <516f3ddd-8634-9d73-ddd4-ae470f4284cf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2021 20:30:00 -0000 On Sat, 6 Nov 2021 15:29:57 -0400 Jason Merrill wrote: > On 11/6/21 14:28, Marek Polacek wrote: > > On Sat, Nov 06, 2021 at 02:32:26AM +0100, Bernhard Reutner-Fischer wrote: > > No, I want q to point into the copy of the string, since I'm about > > to modify it. And I'd prefer a single call to xstrdup rather than > > two. > > It occurs to me that instead of calling xstrdup at all, since you're > already passing the strings to get_identifier you could use > get_identifier_with_length instead, and then refer to IDENTIFIER_POINTER > of the result. Right, i should have looked at the full diff. I can see the point in stripping __attr__ to attr but also stripping the vendors sounds a bit odd, doesn't it. IMHO it would have been way easier to just calculate the desired start and end and get_identifier_with_length for the vendor and attr as Jason said. Guess these local lambdas are a thing nowadays :) Sorry for the noise..