From patchwork Tue Jan 19 19:53:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 1428837 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; 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=J3pWZ5Et; 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 4DKzqk2W2Bz9sVS for ; Wed, 20 Jan 2021 06:53:52 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A0DAC385483B; Tue, 19 Jan 2021 19:53:46 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by sourceware.org (Postfix) with ESMTPS id 97CD0385800B for ; Tue, 19 Jan 2021 19:53:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 97CD0385800B 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-qv1-xf31.google.com with SMTP id s6so9755114qvn.6 for ; Tue, 19 Jan 2021 11:53:42 -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=n2R+yNoqojLquaPJaqh2i6eZSMhIGJB3jRpqfmS/yvE=; b=J3pWZ5EtGe0vu8+OX9V0Xw/KXv37rpTmgkI09a+1KS8Qkv/i2lQ4q8kb3hYBNJWpay imzIyYQcZd4+42xjtTeuGu0E+8WthN2jA0vdppgUm72USVfzy029CG8Z5WfnxkTtS9w0 ekNUa149m4A8dUN+JCQ1W3LJfqdZmUwMw+2BZ0tswmZe8g9iLLQZ00ZJqVvCftlQLHa1 5HrG7rDXRcpGSmtXl3bS4wLdRmJSI71zx9DLwTKeMYlDURFzzjMasgGxa+tG4V4QNI/l JIr4dutxu/rBjFesAgnbXfNFoMl8YhHPKf0K5tDw2xAEs2rYIg1qD+CwXECFCHtuB5qP R5TQ== 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=n2R+yNoqojLquaPJaqh2i6eZSMhIGJB3jRpqfmS/yvE=; b=iK2KFqlJ7VcGkO9C9u64x1clL8BtdaEZhF7QVZUXfbncaoMnx8uJZ2934mHfCmadOr YKRENq3bXjdAqWzndaLui4xpF6/tDfMQKLXurD6dFbgen62Dz/91LavbGX5DOjCQeS+T HA90NR7bTnNZlx23v7RzduHx30kU4jigSo3RcPsgdwRVQ6mrQo66oImi5g6tCheD21F5 3gav8gslbQNvuFDDm0hlrCcIsGfV+a4jjHIuyqx7FGHhJTisWbpP52IuO0d0euy4+0TX 3+FjAzthByAjy7zWi0Q9AuePU/y2la20eEinGjVUTR2jxLh1+AL6R4A+KhigVkCwX5Mx V+Dg== X-Gm-Message-State: AOAM530KSotfHYbnUDcS0yvQtEyJ1IwZXELYYUY9eq6aw8C8sLaqa27G azDXprMVYv59tO+vXi4bI/M= X-Google-Smtp-Source: ABdhPJyDuLbBt2VunEXWUb1pvkLrUADOk7/Ahq1UnVKcXUDVQPsAxYKaa8VsJngCFplY4jFeh7Pajg== X-Received: by 2002:a05:6214:80d:: with SMTP id df13mr5936342qvb.10.1611086022131; Tue, 19 Jan 2021 11:53:42 -0800 (PST) Received: from ?IPv6:2620:10d:c0a8:1102:2d44:c1cd:58a0:3f? ([2620:10d:c091:480::1:d708]) by smtp.googlemail.com with ESMTPSA id x134sm13716241qka.1.2021.01.19.11.53.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Jan 2021 11:53:41 -0800 (PST) To: GCC Patches , Joseph Myers From: Nathan Sidwell Subject: driver: do not check input file existence here [PR 98452] Message-ID: Date: Tue, 19 Jan 2021 14:53:40 -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.4 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" Joseph, I was relying on this patch on the modules branch, but didn't realize the implications when merging and thought it was just a cleanup. I'm not sure why the driver wants to check here, rather than leave it to the compiler. Seems optimizing for failure? The only difference I can think is that the diagnostic might mention the driver name, rather than say (cc1plus), but that's a different problem that I've also reported. The existing code seems confused anyway, we look for NAME, but then report NAME + 1 if name's initial char indicates a response file '@'. IMHO if that's some subtle way of giving an error for an (already) failed missing response file, it seems odd. The failure for modules concerns -x c++-system-header (or c++-user-header), where the compiler will search for the file on the appropriate include path. booted & tested on x86_64-linux, ok? gcc/ * gcc.c (process_command): Don't check OPT_SPECIAL_input_file existence here. diff --git i/gcc/gcc.c w/gcc/gcc.c index 7dccfadfef2..aa5774af7e7 100644 --- i/gcc/gcc.c +++ w/gcc/gcc.c @@ -4811,44 +4811,12 @@ process_command (unsigned int decoded_options_count, if (decoded_options[j].opt_index == OPT_SPECIAL_input_file) { const char *arg = decoded_options[j].arg; - const char *p = strrchr (arg, '@'); - char *fname; - long offset; - int consumed; + #ifdef HAVE_TARGET_OBJECT_SUFFIX arg = convert_filename (arg, 0, access (arg, F_OK)); #endif - /* For LTO static archive support we handle input file - specifications that are composed of a filename and - an offset like FNAME@OFFSET. */ - if (p - && p != arg - && sscanf (p, "@%li%n", &offset, &consumed) >= 1 - && strlen (p) == (unsigned int)consumed) - { - fname = (char *)xmalloc (p - arg + 1); - memcpy (fname, arg, p - arg); - fname[p - arg] = '\0'; - /* Only accept non-stdin and existing FNAME parts, otherwise - try with the full name. */ - if (strcmp (fname, "-") == 0 || access (fname, F_OK) < 0) - { - free (fname); - fname = xstrdup (arg); - } - } - else - fname = xstrdup (arg); - - if (strcmp (fname, "-") != 0 && access (fname, F_OK) < 0) - { - bool resp = fname[0] == '@' && access (fname + 1, F_OK) < 0; - error ("%s: %m", fname + resp); - } - else - add_infile (arg, spec_lang); + add_infile (arg, spec_lang); - free (fname); continue; }