From patchwork Tue Nov 17 14:46:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 1401584 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=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=eWnWIjEC; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cb80j1yPQz9s0b for ; Wed, 18 Nov 2020 01:46:59 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CA6C7385801E; Tue, 17 Nov 2020 14:46:56 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by sourceware.org (Postfix) with ESMTPS id 4C3E93858006 for ; Tue, 17 Nov 2020 14:46:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4C3E93858006 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nathanmsidwell@gmail.com Received: by mail-qk1-x735.google.com with SMTP id d9so20532745qke.8 for ; Tue, 17 Nov 2020 06:46:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=Ze2QZu0+usphX73oya7oix406yzWb7bapMTsVrAUC+0=; b=eWnWIjECNvnMPo4Pqpd8ttfQr2F5OnLN4G7c9XfaKV5euqxQHAr+v+krKWSBmS1mei u6xbgnJQLeJ9gSoBGwRHtJx//AtgB4FyRVU8ietH8e6Sj/pCP2aNhph2n8KLKxp939sR 4JF9d/Sy13yN0wEPYfh8c5A64UTaqkwJ6Y7Z1Yd3Vo0+4kdF4ygTMZ8gsyXmOa9NSaVi hD5Tfu1bFGqUW83LSehWPvDTLNNKqFNhzGEbjT6ierMMl7wR0NWeb/NJIJzGuRog+FQ3 xDnTKD+CHpqApVxkttUOGp44PUg399f1As9Fiyqfl3nbs0KUyq2TPVQ8CO/6CY45er9z FACA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version:content-language; bh=Ze2QZu0+usphX73oya7oix406yzWb7bapMTsVrAUC+0=; b=X7eUPG08ehWIiIxHRP8l4CXSwbqV+IJmPcyXT+kTqr42SnrVc6wIaS+DdK+ZhSUCKI rtQyKkR1Aa/vtJ+e6xYW4a71U+Ood5jW1wjP1pkvS8nMA5tVbKaSDBZ9CxSocMhLgrYn /zeY2xaY+rKDLZp8zfOlypN1qe9QjdC9RYLx1Mp6zGjxoJ3tVMUr+eTXHjZctQqlnzSs EvHpbWR5ZVI6xU7uhuhseinSO9BQDWVbzAp0byYGJ2Af7/fAk5ZxPdzmlflnZypkjHa2 N3h252MQ5CaWUGIsqUIYsxTemKg5xN0XHyJzRZsxuLQ39gtekbpLtAYHQqroHBUaumf9 wxhQ== X-Gm-Message-State: AOAM530AAuTEFymzR/YLc5wosH7k9JXZmzQf7isGeUatR3A5vnhOd+UV 6OY8OC4DMJA659B+wTpsppI= X-Google-Smtp-Source: ABdhPJyFnlz4S3IGjxTGF0ICCoJnIXqcMWq3F7jShmMynF2BrkPes8ZwJ/7GOdRZiVcnig4b1VvQ5w== X-Received: by 2002:ae9:edc1:: with SMTP id c184mr19314834qkg.188.1605624413186; Tue, 17 Nov 2020 06:46:53 -0800 (PST) Received: from ?IPv6:2620:10d:c0a8:1102:81bf:d41:8bba:9858? ([2620:10d:c091:480::1:113e]) by smtp.googlemail.com with ESMTPSA id 7sm13846128qko.106.2020.11.17.06.46.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Nov 2020 06:46:51 -0800 (PST) To: GCC Patches From: Nathan Sidwell Subject: preprocessor: Fix profiled bootstrap warning [pr97858] Message-ID: Date: Tue, 17 Nov 2020 09:46:50 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" As Jakub points out, we only ever pass a single variadic parm (if at all), so just an optional arg is fine. PR 97858 libcpp/ * mkdeps.c (munge): Drop varadic args, we only ever use one. pushing to trunk diff --git i/libcpp/mkdeps.c w/libcpp/mkdeps.c index ea5f060c380..a989ed355fa 100644 --- i/libcpp/mkdeps.c +++ w/libcpp/mkdeps.c @@ -105,23 +105,20 @@ public: unsigned short quote_lwm; }; -/* Apply Make quoting to STR, TRAIL etc. Note that it's not possible - to quote all such characters - e.g. \n, %, *, ?, [, \ (in some +/* Apply Make quoting to STR, TRAIL. Note that it's not possible to + quote all such characters - e.g. \n, %, *, ?, [, \ (in some contexts), and ~ are not properly handled. It isn't possible to get this right in any current version of Make. (??? Still true? Old comment referred to 3.76.1.) */ static const char * -munge (const char *str, const char *trail = NULL, ...) +munge (const char *str, const char *trail = nullptr) { static unsigned alloc; static char *buf; unsigned dst = 0; - va_list args; - if (trail) - va_start (args, trail); - for (bool first = true; str; first = false) + for (; str; str = trail, trail = nullptr) { unsigned slashes = 0; char c; @@ -169,14 +166,7 @@ munge (const char *str, const char *trail = NULL, ...) buf[dst++] = c; } - - if (first) - str = trail; - else - str = va_arg (args, const char *); } - if (trail) - va_end (args); buf[dst] = 0; return buf; @@ -332,7 +322,7 @@ make_write_name (const char *name, FILE *fp, unsigned col, unsigned colmax, bool quote = true, const char *trail = NULL) { if (quote) - name = munge (name, trail, NULL); + name = munge (name, trail); unsigned size = strlen (name); if (col)