From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [IPv6:2001:67c:2050:0:465::202]) by sourceware.org (Postfix) with ESMTPS id A57B63858C54; Tue, 4 Apr 2023 23:10:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A57B63858C54 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=aarsen.me Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=aarsen.me Received: from smtp202.mailbox.org (unknown [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4Prk5S0x94z9sWK; Wed, 5 Apr 2023 01:10:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aarsen.me; s=MBO0001; t=1680649852; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QC2YlU4U8EExSN20/p1p+EbFMl3wxwTImZYBdo8bKcQ=; b=lPPbWLq1YtJ/Rj9lsW8H4flQ11k6g1W4BdzCUy/unwi7M4tTNxdz7LVEpCjiCfPjndpfRv QxmFO/gMSDv6Z4kQxLOWYFshDnR4dd7vTtZAc9D+NSJ5VeBkAyYIpY4Cf9CI1rsR6jIrYp McTyzW1KDiBG2pATRK2AZ6INNRlOpPNnbAP2iHRHqimO7QS8zs58D71vE2h20+1xNM+M/Z vtce/y+u3Apxn6YCjKx8iULg3o6XWAOxwedlYZw627Lnu6KxwSKxoNAKHFVwL6duLA4BeZ Y1ZERZ7jYSIrR21i9mif2VL19/12QJhOoBp5mM8msD75XldibFmLk35bjU3dPA== From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, =?UTF-8?q?Arsen=20Arsenovi=C4=87?= Subject: [PATCH 3/4] libstdc++: Downgrade DEBUG to ASSERTIONS when !HOSTED Date: Wed, 5 Apr 2023 01:09:49 +0200 Message-Id: <20230404230950.158556-3-arsen@aarsen.me> In-Reply-To: <20230404230950.158556-1-arsen@aarsen.me> References: <20230404230950.158556-1-arsen@aarsen.me> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_INFOUSMEBIZ,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Supporting the debug mode in freestanding is a non-trivial job, so instead, as a best-effort, enable assertions, which are light and easy. libstdc++-v3/ChangeLog: * include/bits/c++config: When __STDC_HOSTED__ is zero, disable _GLIBCXX_DEBUG and, if it was set, enable _GLIBCXX_ASSERTIONS. * testsuite/lib/libstdc++.exp (check_v3_target_debug_mode): Include when determining whether debug is set, in order to inherit the logic from above --- libstdc++-v3/include/bits/c++config | 7 +++++++ libstdc++-v3/testsuite/lib/libstdc++.exp | 1 + 2 files changed, 8 insertions(+) diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 71f2401402f..13892787e09 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -397,6 +397,13 @@ _GLIBCXX_END_NAMESPACE_VERSION # define _GLIBCXX_END_INLINE_ABI_NAMESPACE(X) } // inline namespace X #endif +// In the case that we don't have a hosted environment, we can't provide the +// debugging mode. Instead, we do our best and downgrade to assertions. +#if defined(_GLIBCXX_DEBUG) && !__STDC_HOSTED__ +#undef _GLIBCXX_DEBUG +#define _GLIBCXX_ASSERTIONS 1 +#endif + // Inline namespaces for special modes: debug, parallel. #if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) namespace std diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index 98512c973fb..490abd108fa 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -1007,6 +1007,7 @@ proc check_v3_target_debug_mode { } { global cxxflags return [check_v3_target_prop_cached et_debug_mode { set code " + #include #if ! defined _GLIBCXX_DEBUG # error no debug mode #endif -- 2.40.0