From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 1D0783851C17 for ; Fri, 20 Nov 2020 16:41:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1D0783851C17 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Kwok_Yeung@mentor.com IronPort-SDR: V2nrlZ+CGsmsXRUBdyAOoyXBhA7jLn8QfSJ6uLsfNXg+DajDteCPvBiIeD4oF8d7DDkWh8ingD I6bpRDSuTaVIB/ilAriIWFtPppXBhqXdY+erScbVQTLtD2DRD7DAfzdf/IGcVUxN0sjs2QqmRM e+T4eXNPgpX3H26BPx5mqLBBzUFdwgm+f4qhAldCQatWGNyz/8OTMEGDinisVrgVn0mMoKXHzW XgGdwh2xQTRyEAJ1bmdXWHyC2XDpp0Xz6TUJk79f2htVf1Tzn05eT9UQd1gXbYhTlLRjOMY8cl IWQ= X-IronPort-AV: E=Sophos;i="5.78,357,1599552000"; d="scan'208";a="55439163" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 20 Nov 2020 08:41:38 -0800 IronPort-SDR: mDTLTyjPwwzFncNSBD8gmpqdyAcHzK8TydG13BHQFMyY99fIe/JbniW8rLvq0x21jjhUq30iep /N3MmgAe+frYngJrxnH4X5Xg8X0mRKS1f4YVqRUA/WAQZuF3W5oMc7wmEUrwrPEOnjhwDa3HMv OezOHutCZDTCW+sq1Uq9ZP1yRVnWETR4FXTKjKRIGrsfpGm0CpsU7PvFPErOoaKlbsq+0EpPZp sGxgcAvl9OQ9ZdqMnm2/0PgD8EpRe27YR24HPYTc6997ZzFohBZ/rxKxaWQ7MqUAOkwDI3CAu9 PHI= To: , GCC Patches References: <20181108171611.GK11625@tucnak> Subject: Nested declare target support From: Kwok Cheung Yeung Message-ID: <0437a064-2787-5cc6-9fb0-6153a5f9af30@codesourcery.com> Date: Fri, 20 Nov 2020 16:41:15 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20181108171611.GK11625@tucnak> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-07.mgc.mentorg.com (139.181.222.7) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no 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: , X-List-Received-Date: Fri, 20 Nov 2020 16:41:41 -0000 Hello > New OpenMP 5.0 features that won't be available in GCC 9, are planned for GCC 10 > or later versions as time permits: > ... > - nested declare target support You said in an email two years ago that nested declare target was not supported yet. I do not see any patches that claim to implement this since then, but when I ran a quick test with a trunk build: #pragma omp declare target #pragma omp declare target int foo() { return 1; } #pragma omp end declare target int bar() { return 2; } #pragma omp end declare target This compiles and appears to do the right thing: __attribute__((omp declare target, omp declare target block)) foo () ... __attribute__((omp declare target, omp declare target block)) bar () ... Looking at the C parser: static void c_parser_omp_declare_target (c_parser *parser) { ... else { c_parser_skip_to_pragma_eol (parser); current_omp_declare_target_attribute++; return; } static void c_parser_omp_end_declare_target (c_parser *parser) { ... current_omp_declare_target_attribute--; } It looks like this was written to handle nesting to begin with (since at least 2013) by making current_omp_declare_target_attribute (which effectively tracks the nesting level) an integer. Is there anything that is currently missing for nested declare target support? Thanks Kwok