From patchwork Tue Feb 1 15:31:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1587274 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=XuiPaKE0; dkim-atps=neutral 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+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jp86n0S8Cz9sFv for ; Wed, 2 Feb 2022 02:31:45 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DC735385AC31 for ; Tue, 1 Feb 2022 15:31:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DC735385AC31 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1643729502; bh=EMR5QJNkeybymR8H6tEKHghF/yG40PmNIDExKMBQe8w=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=XuiPaKE0mAq7XbAw5ZhGgm+9f1zlZ9dMkmjmvg37d0pbHSBb4D358i3jnney1WxSF GA8N6MDVKtfHF3WEFjZRiZP0Fx/jbuxrIMvPY5/cpLl2RImVIYPL8X5M+OLTsiW5kD XGlsaIm/+PTo5qepjG0i8wk4XOQ3drpX767paORc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 C21F93858C74 for ; Tue, 1 Feb 2022 15:31:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C21F93858C74 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-383-EhS6PG1RN6y9uTU6E99Hhw-1; Tue, 01 Feb 2022 10:31:19 -0500 X-MC-Unique: EhS6PG1RN6y9uTU6E99Hhw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 421E0802926; Tue, 1 Feb 2022 15:31:18 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.125]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A48912B6EB; Tue, 1 Feb 2022 15:31:17 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 211FVEU43426135 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 1 Feb 2022 16:31:15 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 211FVEIl3426134; Tue, 1 Feb 2022 16:31:14 +0100 Date: Tue, 1 Feb 2022 16:31:14 +0100 To: Jason Merrill , Marek Polacek , "Joseph S. Myers" Subject: [PATCH] libcpp: Avoid PREV_WHITE and other random content on CPP_PADDING tokens Message-ID: <20220201153114.GY2646553@tucnak> References: <20220131190349.GM2646553@tucnak> <20220131232857.GO2646553@tucnak> <20220201090357.GS2646553@tucnak> MIME-Version: 1.0 In-Reply-To: <20220201090357.GS2646553@tucnak> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" On Tue, Feb 01, 2022 at 10:03:57AM +0100, Jakub Jelinek via Gcc-patches wrote: > I wonder if we shouldn't replace that > toks[0] = pfile->directive_result; > line with > toks[0] = pfile->avoid_paste; > or even replace those > toks = XNEW (cpp_token); > toks[0] = pfile->directive_result; > lines with > toks = &pfile->avoid_paste; Here is a patch that does that, bootstrapped/regtested on powerpc64le-linux, ok for trunk? 2022-02-01 Jakub Jelinek * directives.cc (destringize_and_run): Push &pfile->avoid_paste instead of a copy of pfile->directive_result for the CPP_PADDING case. Jakub --- libcpp/directives.cc.jj 2022-01-18 11:59:00.257972414 +0100 +++ libcpp/directives.cc 2022-02-01 13:39:27.240114485 +0100 @@ -1954,8 +1954,7 @@ destringize_and_run (cpp_reader *pfile, else { count = 1; - toks = XNEW (cpp_token); - toks[0] = pfile->directive_result; + toks = &pfile->avoid_paste; /* If we handled the entire pragma internally, make sure we get the line number correct for the next token. */