From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115515 invoked by alias); 27 Nov 2018 14:53:36 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 115311 invoked by uid 89); 27 Nov 2018 14:53:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3 autolearn=ham version=3.3.2 spammy=Act, scan-file, scanfile, 1214 X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (207.211.31.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Nov 2018 14:53:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mathworks.com; s=mimecast20180117; t=1543330410; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yBDD6+25Z7cXgikwZro9yYaluo4WzZsd6niSiisaFs8=; b=GXYRJz9SXTKf06qdCqnrbnoNHzEwbMrB/LXlj5XEkpbw1GxVoacwct5s0AogBTwpDGUt050GNAZCwajaDdwiMi/m+59jvAA6ybn/YP0thcvS12CKi4mjqdjJ/+gCmg8Y53Jtzds68VqolgqpstyCsE3eiOAhYJhraUrlmW9iyCk= Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-co1nam04lp0053.outbound.protection.outlook.com [216.32.181.53]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-235-rQfKLmzHP0uUW-xHO9nrWQ-1; Tue, 27 Nov 2018 09:53:27 -0500 Received: from BYAPR05CA0085.namprd05.prod.outlook.com (2603:10b6:a03:e0::26) by MWHPR05MB3664.namprd05.prod.outlook.com (2603:10b6:301:3e::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1361.9; Tue, 27 Nov 2018 14:53:24 +0000 Received: from DM3NAM05FT036.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::202) by BYAPR05CA0085.outlook.office365.com (2603:10b6:a03:e0::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1382.8 via Frontend Transport; Tue, 27 Nov 2018 14:53:24 +0000 Received: from exedge.mathworks.com (144.212.100.42) by DM3NAM05FT036.mail.protection.outlook.com (10.152.98.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1382.7 via Frontend Transport; Tue, 27 Nov 2018 14:53:24 +0000 Received: from ex16-01-ah.mathworks.com (172.31.80.219) by ex16edge-00-ah.mathworks.com (172.31.187.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1531.3; Tue, 27 Nov 2018 09:52:56 -0500 Received: from ex16-00-ah.mathworks.com (172.31.39.22) by ex16-01-ah.mathworks.com (172.31.80.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1531.3; Tue, 27 Nov 2018 09:53:16 -0500 Received: from mail-vif.mathworks.com (144.212.95.101) by ex16-00-ah.mathworks.com (172.31.39.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1531.3 via Frontend Transport; Tue, 27 Nov 2018 09:53:16 -0500 Received: from mgulick-deb9-64.dhcp.mathworks.com (mgulick-deb9-64.dhcp.mathworks.com [172.21.82.68]) by mail-vif.mathworks.com (8.14.7/8.14.7) with ESMTP id wARErGIa016334; Tue, 27 Nov 2018 09:53:16 -0500 Received: (from mgulick@localhost) by mgulick-deb9-64.dhcp.mathworks.com (8.15.2/8.15.2/Submit) id wARErGXL228871; Tue, 27 Nov 2018 09:53:16 -0500 From: Mike Gulick To: CC: David Malcolm , Mike Gulick Subject: [PATCH v5 2/3] PR preprocessor/83173: New test Date: Tue, 27 Nov 2018 14:53:00 -0000 Message-ID: <20181127145304.228046-2-mgulick@mathworks.com> In-Reply-To: <20181127145304.228046-1-mgulick@mathworks.com> References: <1543329772.4619.104.camel@redhat.com> <20181127145304.228046-1-mgulick@mathworks.com> MIME-Version: 1.0 Return-Path: Mike.Gulick@mathworks.com Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2018-11/txt/msg02192.txt.bz2 2018-11-27 Mike Gulick PR preprocessor/83173 * gcc.dg/plugin/location-overflow-test-pr83173.c: New test. * gcc.dg/plugin/location-overflow-test-pr83173.h: Header for pr83173.c. * gcc.dg/plugin/location-overflow-test-pr83173-1.h: Header for pr83173.c. * gcc.dg/plugin/location-overflow-test-pr83173-2.h: Header for pr83173.c. * gcc.dg/plugin/location_overflow_plugin.c: Use PLUGIN_PRAGMAS instead of PLUGIN_START_UNIT. * gcc.dg/plugin/plugin.exp: Enable new test. --- .../plugin/location-overflow-test-pr83173-1.h | 2 ++ .../plugin/location-overflow-test-pr83173-2.h | 2 ++ .../plugin/location-overflow-test-pr83173.c | 21 +++++++++++++++++++ .../plugin/location-overflow-test-pr83173.h | 2 ++ .../gcc.dg/plugin/location_overflow_plugin.c | 13 +++++++----- gcc/testsuite/gcc.dg/plugin/plugin.exp | 3 ++- 6 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83= 173-1.h create mode 100644 gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83= 173-2.h create mode 100644 gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83= 173.c create mode 100644 gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83= 173.h diff --git a/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173-1.h= b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173-1.h new file mode 100644 index 00000000000..f47dc3643c2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173-1.h @@ -0,0 +1,2 @@ +#pragma once +#define LOCATION_OVERFLOW_TEST_PR83173_1_H diff --git a/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173-2.h= b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173-2.h new file mode 100644 index 00000000000..bc23ed2a188 --- /dev/null +++ b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173-2.h @@ -0,0 +1,2 @@ +#pragma once +#define LOCATION_OVERFLOW_TEST_PR83173_2_H diff --git a/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173.c b= /gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173.c new file mode 100644 index 00000000000..2d581283474 --- /dev/null +++ b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173.c @@ -0,0 +1,21 @@ +/* + { dg-options "-fplugin-arg-location_overflow_plugin-value=3D0x60000001" } + { dg-do preprocess } +*/ + +#include "location-overflow-test-pr83173.h" + +int +main () +{ + return 0; +} + +/* + The preprocessor output should contain + '# 1 "path/to/location-overflow-test-pr83173-1.h" 1', but should not + contain any other references to location-overflow-test-pr83183-1.h. + + { dg-final { scan-file location-overflow-test-pr83173.i "# 1 \[^\r\n\]+l= ocation-overflow-test-pr83173-1\.h\" 1" } } + { dg-final { scan-file-not location-overflow-test-pr83173.i "# (?!1 \[^\= r\n\]+location-overflow-test-pr83173-1\.h\" 1)\[0-9\]+ \[^\r\n\]+location-o= verflow-test-pr83173-1\.h\"" } } +*/ diff --git a/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173.h b= /gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173.h new file mode 100644 index 00000000000..49076f7ea3c --- /dev/null +++ b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173.h @@ -0,0 +1,2 @@ +#include "location-overflow-test-pr83173-1.h" +#include "location-overflow-test-pr83173-2.h" diff --git a/gcc/testsuite/gcc.dg/plugin/location_overflow_plugin.c b/gcc/t= estsuite/gcc.dg/plugin/location_overflow_plugin.c index 5c9d5bae77e..09bac50d2af 100644 --- a/gcc/testsuite/gcc.dg/plugin/location_overflow_plugin.c +++ b/gcc/testsuite/gcc.dg/plugin/location_overflow_plugin.c @@ -12,11 +12,14 @@ int plugin_is_GPL_compatible; =20 static location_t base_location; =20 -/* Callback handler for the PLUGIN_START_UNIT event; pretend - we parsed a very large include file. */ +/* Callback handler for the PLUGIN_PRAGMAS event; pretend we parsed a + very large include file. This is used to set the initial line table + offset for the preprocessor, to make it appear as if we had parsed a + very large file. PRAGMA_START_UNIT is not suitable here as is not + invoked during the preprocessor stage. */ =20 static void -on_start_unit (void */*gcc_data*/, void */*user_data*/) +on_pragma_registration (void */*gcc_data*/, void */*user_data*/) { /* Act as if we've already parsed a large body of code; so that we can simulate various fallbacks in libcpp: @@ -81,8 +84,8 @@ plugin_init (struct plugin_name_args *plugin_info, error_at (UNKNOWN_LOCATION, "missing plugin argument"); =20 register_callback (plugin_info->base_name, - PLUGIN_START_UNIT, - on_start_unit, + PLUGIN_PRAGMAS, + on_pragma_registration, NULL); /* void *user_data */ =20 /* Hack in additional testing, based on the exact value supplied. */ diff --git a/gcc/testsuite/gcc.dg/plugin/plugin.exp b/gcc/testsuite/gcc.dg/= plugin/plugin.exp index d92ede79c0d..f9e89c48140 100644 --- a/gcc/testsuite/gcc.dg/plugin/plugin.exp +++ b/gcc/testsuite/gcc.dg/plugin/plugin.exp @@ -96,7 +96,8 @@ set plugin_test_list [list \ diagnostic-test-inlining-4.c } \ { location_overflow_plugin.c \ location-overflow-test-1.c \ - location-overflow-test-2.c } \ + location-overflow-test-2.c \ + location-overflow-test-pr83173.c } \ { must_tail_call_plugin.c \ must-tail-call-1.c \ must-tail-call-2.c } \ --=20 2.19.1