From patchwork Mon Nov 30 14:11:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1408300 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; dmarc=pass (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: 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=n/DkONXe; 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 4Cl6cF4bGtz9sSf for ; Tue, 1 Dec 2020 01:11:55 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BCC39386F44F; Mon, 30 Nov 2020 14:11:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BCC39386F44F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1606745512; bh=KBNwfBr0FwEsKpWBo8BHaHZUrT5htaXtoN65wV1yDfM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=n/DkONXeSFLvFLKMngCnsxaVjIrNc3hmbEWsA9N4QVpQX7oX9qS97+YeCKsMrDSai vdLJE1BKGjHrPA1Cu6Qj1Z1VasmZ6D0u1R3UWoRr01WsGM3ztptnj45rWXi+1Jxy5E Brcd3tHptAISWCDAIOtzj3tFpLEjHiJXx7ORHz4c= 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 [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id BDA62385802D for ; Mon, 30 Nov 2020 14:11:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BDA62385802D Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-181-IYcx68QiPtOGa7qkIZ7-lA-1; Mon, 30 Nov 2020 09:11:48 -0500 X-MC-Unique: IYcx68QiPtOGa7qkIZ7-lA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A287B1006C83 for ; Mon, 30 Nov 2020 14:11:47 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-113-127.ams2.redhat.com [10.36.113.127]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1A493189CE; Mon, 30 Nov 2020 14:11:46 +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 0AUEBjCV1100725 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 30 Nov 2020 15:11:45 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 0AUEBi4p1100724; Mon, 30 Nov 2020 15:11:44 +0100 Date: Mon, 30 Nov 2020 15:11:44 +0100 To: Jason Merrill Subject: [PATCH] c++, debug: Treat -std=c++20 -gdwarf-5 like C++14 rather than C++98 Message-ID: <20201130141144.GJ3788@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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: , 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@gcc.gnu.org Sender: "Gcc-patches" Hi! I have noticed that while we use DW_LANG_C_plus_plus_14 for -std=c++17 -gdwarf-5, we use DW_LANG_C_plus_plus (aka C++98) for -std=c++20 -gdwarf-5. The following patch makes those two match. Ok for trunk if it passes bootstrap/regtest? 2020-11-30 Jakub Jelinek * dwarf2out.c (gen_compile_unit_die): Treat GNU C++20 like C++14 for -gdwarf-5. * g++.dg/debug/dwarf2/lang-cpp17.C: New test. * g++.dg/debug/dwarf2/lang-cpp20.C: New test. Jakub --- gcc/dwarf2out.c.jj 2020-11-26 16:22:29.111352844 +0100 +++ gcc/dwarf2out.c 2020-11-30 15:05:52.601317310 +0100 @@ -24646,7 +24646,8 @@ gen_compile_unit_die (const char *filena language = DW_LANG_C_plus_plus_11; else if (strcmp (language_string, "GNU C++14") == 0) language = DW_LANG_C_plus_plus_14; - else if (strcmp (language_string, "GNU C++17") == 0) + else if (strcmp (language_string, "GNU C++17") == 0 + || strcmp (language_string, "GNU C++20") == 0) /* For now. */ language = DW_LANG_C_plus_plus_14; } --- gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp17.C.jj 2020-11-30 15:06:35.631836747 +0100 +++ gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp17.C 2020-11-30 15:07:19.160350623 +0100 @@ -0,0 +1,7 @@ +// { dg-do compile } +// { dg-options "-O -std=c++17 -gdwarf-5 -dA" } +// For -gdwarf-6 hopefully DW_LANG_C_plus_plus_17 +// DW_LANG_C_plus_plus_14 = 0x0021 +// { dg-final { scan-assembler "0x21\[^\n\r]* DW_AT_language" } } */ + +int version; --- gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp20.C.jj 2020-11-30 15:07:27.436258201 +0100 +++ gcc/testsuite/g++.dg/debug/dwarf2/lang-cpp20.C 2020-11-30 15:07:37.801142442 +0100 @@ -0,0 +1,7 @@ +// { dg-do compile } +// { dg-options "-O -std=c++20 -gdwarf-5 -dA" } +// For -gdwarf-6 hopefully DW_LANG_C_plus_plus_20 +// DW_LANG_C_plus_plus_14 = 0x0021 +// { dg-final { scan-assembler "0x21\[^\n\r]* DW_AT_language" } } */ + +int version;