From patchwork Thu Jan 5 10:01:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 89977 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp8890736qgi; Thu, 5 Jan 2017 02:02:05 -0800 (PST) X-Received: by 10.98.110.193 with SMTP id j184mr1970313pfc.21.1483610525250; Thu, 05 Jan 2017 02:02:05 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id i4si2786384plk.122.2017.01.05.02.02.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jan 2017 02:02:05 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-445437-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-445437-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-445437-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=Xx7XYFjkaS8MO6NBz LKK8GZBqS9bVG2gnMMbsLQ/PnglpEbApxBBpGUHIjL2VqO30xh/+Qlyc7DSWbIf6 XtEPj7+j7pzgVkjEsjCuxJR1mN/9nSp6air62InrVWMNWlNrcqLB9yI/AkF1RQ4S Qq+joDN396QL7QNr9pnoLPnAzU= 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=mPaobvghxsIuaWWbjlA0bJy GzVU=; b=JX9Zq+Gjy/fVODrxLZ0ztMS9nP3V03y8hAdnnbP4ZHkoSuik73CvvHe h/tbXqjDJw3rVq4qclgHUfh+wJ9CU9Oc/bxzoZqktrfUz5xPntBjqIswjpyD1LUM lxTzqGXb49UUGtBCUi8XVs0APIbUlODGxnipKb2b0dpgX0X/ur+M= Received: (qmail 100059 invoked by alias); 5 Jan 2017 10:01:51 -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 100044 invoked by uid 89); 5 Jan 2017 10:01:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Jan 2017 10:01:40 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5775DAB1D; Thu, 5 Jan 2017 10:01:38 +0000 (UTC) Subject: Re: [PATCH] Fix precompiled header for '-' being input file (PR, pch/78970) To: Jakub Jelinek References: <2577a04a-611e-ab46-b2c5-f39c71f02cca@suse.cz> <20170105091107.GW21933@tucnak> Cc: GCC Patches From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: Date: Thu, 5 Jan 2017 11:01:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170105091107.GW21933@tucnak> X-IsSubscribed: yes On 01/05/2017 10:11 AM, Jakub Jelinek wrote: > On Thu, Jan 05, 2017 at 10:00:33AM +0100, Martin Liška wrote: >> Having '-' used as indication that input should be taken from standard input >> is unfriendly to pch which calculates md5sum of all input file descriptors. >> With that fdopen fails for STDIN_FILENO. To be honest my patch is just a workaround >> for the ICE. Is there a better solution for that? > > Shouldn't we just error on trying to create PCH for - ? > I mean, how are you going to use such a PCH file? ./- is something > different from - . I think we should. I prepared a new version of patch which I've been testing. Are you fine with the error message? Martin > > If it makes some sense (I don't see it), then the question is if the stdin > is seakable or not. If it is not seakable, don't we reject it already, or > aren't there other places where we want to seek on it? > If it is seakable, then you might e.g. just read it into a buffer in a loop > and md5sum the buffer instead of md5summing the stream. > > Jakub > >From 0e14f21128c7aa67ed0eaa10877323a0b2011b63 Mon Sep 17 00:00:00 2001 From: marxin Date: Wed, 4 Jan 2017 16:04:44 +0100 Subject: [PATCH] Error for '-' as filename of a precompiled header (PR pch/78970) gcc/ChangeLog: 2017-01-05 Martin Liska * gcc.c (lookup_compiler): Reject '-' filename for a precompiled header. --- gcc/gcc.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/gcc.c b/gcc/gcc.c index 8154953eb1d..ea4af119e73 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -8325,7 +8325,19 @@ lookup_compiler (const char *name, size_t length, const char *language) { for (cp = compilers + n_compilers - 1; cp >= compilers; cp--) if (cp->suffix[0] == '@' && !strcmp (cp->suffix + 1, language)) - return cp; + { + if (name != NULL && strcmp (name, "-") == 0 + && (strcmp (cp->suffix, "@c-header") == 0 + || strcmp (cp->suffix, "@c++-header") == 0)) + { + fatal_error (input_location, + "can't use '-' as input filename for a " + "precompiled header"); + return 0; + } + + return cp; + } error ("language %s not recognized", language); return 0; -- 2.11.0