From patchwork Tue Feb 21 14:14:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 60102 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp31078wrd; Tue, 21 Feb 2023 06:14:53 -0800 (PST) X-Google-Smtp-Source: AK7set+80rQRkXL70zZiJf87RpH+gpDKej5UUz1+XO60HpjDBD/Ux7kzYLb755kM6B/ICXVehodR X-Received: by 2002:a17:906:7e1a:b0:8af:3fef:52c9 with SMTP id e26-20020a1709067e1a00b008af3fef52c9mr13736024ejr.22.1676988893672; Tue, 21 Feb 2023 06:14:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676988893; cv=none; d=google.com; s=arc-20160816; b=A4S4xXhfvU4aOPQEXVkVqa1aJE5OtMIeFIxIT+r/ZpRLxryn/hb+JuuYieYYlRHELT ZCRH4GMiDJg5qRlIOeO8vCMQk6k21PWf5l8itd2mNgyc8ggs1M9y5USEDK5M4q26uHvF 2WBXFUaxTAZLgpJ8VaxSeievfWvkZ62IcltqRS9+0oj1l00KHo2EexLUbSTLB43vxjQM Gk5K29QWyjBAU5hoaKGMFiO6xaPUr4So9T1oy4kdOGvGAs99HPqgbcon+s9bfD9x1iRU U3z0CZ2eOZks0od4SSl6AePipRNFgDuNXK0WS4LPOyXa2LiN/zO5o9DTyImKUd5t+5/l UW2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=8B/HhFG0YYIc0vX0CWDGfPlGdd3Iln9L3LampSEJFME=; b=AXCXi/Ri4HmqTgMulXRyfT2SN0ErmAwQladqawEkOBHW+pEBAfPpGUeRbtNv2ykQ9b AJKZ7b47iRvmyu7FuKU/Y9eVwr9sszYRZrDh4i9Rlny5NDP93eZu3noURPNllOEg0uxS mUeRPie+lF31nOBmdv9mBimsWEXMqHwpa9OPZ4aQREwESXNQ4dKyXmZJ1q1zW2bY9Nqs /Uubtvg51kX5jM3g0sHPu4WRe5ahFimjBxTXc193tSLrsPKIMNkknU8Qw6T7Cc7bZ/ZK g1cITig6l/IcSLBLf5qUFMPFD1QWY2gqEfWiQVjCsHDedKLcM0AVAndxucoUtyMtmL6z M8cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=hL+Lb5zL; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id zz13-20020a170907350d00b008c35e1f30fcsi9041528ejb.404.2023.02.21.06.14.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 06:14:53 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=hL+Lb5zL; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9CF3C3858426 for ; Tue, 21 Feb 2023 14:14:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9CF3C3858426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676988892; bh=8B/HhFG0YYIc0vX0CWDGfPlGdd3Iln9L3LampSEJFME=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=hL+Lb5zLTDbd7TdqQ6USrWjnZ3vG4FvzyNT2Tb5I079GGNwSCULD4J2HeEdwRazfa bVrjd3lZ51+bBfMupaGhh6q3k4Wg+5JtW+YmbmO8KRCqFUmyznTN6sLwJWzvcU055T XR+UMK+UV0qJ5TDdl9DhQjsq9rV3P82T3p4LTsEA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [IPv6:2001:67c:2050:0:465::102]) by sourceware.org (Postfix) with ESMTPS id 885593858284 for ; Tue, 21 Feb 2023 14:14:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 885593858284 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (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-102.mailbox.org (Postfix) with ESMTPS id 4PLh9W1ZzJz9sRP; Tue, 21 Feb 2023 15:14:07 +0100 (CET) To: gcc-patches@gcc.gnu.org Cc: Iain Buclaw Subject: [committed] libphobos: Add @nogc to gcc.backtrace and gcc.libbacktrace modules. Date: Tue, 21 Feb 2023 15:14:05 +0100 Message-Id: <20230221141405.1798120-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4PLh9W1ZzJz9sRP X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 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: Iain Buclaw via Gcc-patches From: Iain Buclaw Reply-To: Iain Buclaw Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758450305670841743?= X-GMAIL-MSGID: =?utf-8?q?1758450305670841743?= Hi, This patch annotated the LibBacktrace class and the libbacktrace C bindings it uses with `@nogc' in preparation for a `Throwable.TraceInfo' becoming `@nogc' itself. Bootstrapped and regression tested on x86_64-linux-gnu, committed to mainline. Regards, Iain. --- libphobos/ChangeLog: * libdruntime/gcc/backtrace.d (simpleErrorCallback): Add @nogc. (LibBacktrace.initLibBacktrace): Likewise. (LibBacktrace.this): Likewise. (UnwindBacktrace.this): Likewise. (getBacktrace): Likewise. (getBacktraceSymbols): Likewise. * libdruntime/gcc/libbacktrace.d.in (backtrace_create_state): Likewise. (backtrace_full): Likewise. (backtrace_simple): Likewise. (backtrace_print): Likewise. (backtrace_pcinfo): Likewise. (backtrace_syminfo): Likewise. --- libphobos/libdruntime/gcc/backtrace.d | 12 ++++++------ libphobos/libdruntime/gcc/libbacktrace.d.in | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libphobos/libdruntime/gcc/backtrace.d b/libphobos/libdruntime/gcc/backtrace.d index eeaf0783e96..2b4a339e721 100644 --- a/libphobos/libdruntime/gcc/backtrace.d +++ b/libphobos/libdruntime/gcc/backtrace.d @@ -46,7 +46,7 @@ static if (BACKTRACE_SUPPORTED && !BACKTRACE_USES_MALLOC) /* * Used for backtrace_create_state and backtrace_simple */ - extern(C) void simpleErrorCallback(void* data, const(char)* msg, int errnum) + extern(C) void simpleErrorCallback(void* data, const(char)* msg, int errnum) @nogc { if (data) // context is not available in backtrace_create_state { @@ -187,7 +187,7 @@ static if (BACKTRACE_SUPPORTED && !BACKTRACE_USES_MALLOC) // FIXME: state is never freed as libbacktrace doesn't provide a free function... public class LibBacktrace : Throwable.TraceInfo { - static void initLibBacktrace() + static void initLibBacktrace() @nogc { if (!initialized) { @@ -196,7 +196,7 @@ static if (BACKTRACE_SUPPORTED && !BACKTRACE_USES_MALLOC) } } - this(int firstFrame) + this(int firstFrame) @nogc { _firstFrame = firstFrame; @@ -345,7 +345,7 @@ else */ public class UnwindBacktrace : Throwable.TraceInfo { - this(int firstFrame) + this(int firstFrame) @nogc { _firstFrame = firstFrame; _callstack = getBacktrace(); @@ -436,14 +436,14 @@ private: return _URC_NO_REASON; } - UnwindBacktraceData getBacktrace() + UnwindBacktraceData getBacktrace() @nogc { UnwindBacktraceData stackframe; _Unwind_Backtrace(&unwindCB, &stackframe); return stackframe; } - BTSymbolData getBacktraceSymbols(UnwindBacktraceData data) + BTSymbolData getBacktraceSymbols(UnwindBacktraceData data) @nogc { BTSymbolData symData; diff --git a/libphobos/libdruntime/gcc/libbacktrace.d.in b/libphobos/libdruntime/gcc/libbacktrace.d.in index 96382e1f7f3..def017d155b 100644 --- a/libphobos/libdruntime/gcc/libbacktrace.d.in +++ b/libphobos/libdruntime/gcc/libbacktrace.d.in @@ -46,28 +46,28 @@ extern(C): backtrace_error_callback; backtrace_state* backtrace_create_state(const(char)* filename, int threaded, - backtrace_error_callback error_callback, void* data) nothrow; + backtrace_error_callback error_callback, void* data) @nogc nothrow; alias extern(C) int function(void* data, uintptr_t pc, const(char)* filename, int lineno, const(char)* func) backtrace_full_callback; int backtrace_full(backtrace_state* state, int skip, backtrace_full_callback callback, - backtrace_error_callback error_callback, void* data) nothrow; + backtrace_error_callback error_callback, void* data) @nogc nothrow; alias extern(C) int function(void* data, uintptr_t pc) backtrace_simple_callback; int backtrace_simple(backtrace_state* state, int skip, backtrace_simple_callback callback, - backtrace_error_callback error_callback, void* data) nothrow; + backtrace_error_callback error_callback, void* data) @nogc nothrow; - void backtrace_print(backtrace_state* state, int skip, FILE* file) nothrow; + void backtrace_print(backtrace_state* state, int skip, FILE* file) @nogc nothrow; int backtrace_pcinfo(backtrace_state* state, uintptr_t pc, backtrace_full_callback callback, - backtrace_error_callback error_callback, void* data) nothrow; + backtrace_error_callback error_callback, void* data) @nogc nothrow; alias extern(C) void function(void* data, uintptr_t pc, const(char)* symname, uintptr_t symval) backtrace_syminfo_callback; int backtrace_syminfo(backtrace_state *state, uintptr_t pc, backtrace_syminfo_callback callback, - backtrace_error_callback error_callback, void* data) nothrow; + backtrace_error_callback error_callback, void* data) @nogc nothrow; }