From patchwork Tue Feb 27 17:25:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 86464 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0D3E2385841D for ; Tue, 27 Feb 2024 17:25:51 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by sourceware.org (Postfix) with ESMTPS id 4C3A23858D28 for ; Tue, 27 Feb 2024 17:25:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4C3A23858D28 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4C3A23858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::12a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709054723; cv=none; b=nVS4/HGHbHEUvbPmvTjq91EQtTRQ8J787SLhCtMBppljEIDozW+KE4Fx4gGrPO+WiBZJn2YErUGWhGgfZBtjQlSVHrOvGNy/Ig+hpXiKyyKB8bfafgEY+A43jKh951AcR0fCwP3vBqhX7tO8OeFf5Eiq8zD8R8Q7krfbgroV72o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709054723; c=relaxed/simple; bh=n2SzZG3QXHi5P/I8EA06FHrpXmpQdD9G5JUBHprD9Vg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=GwAj0Mp4EKcNnfL4MhvnA2iICw2ROl/vnRRdkBaCoPzvHKWtiVfv+n6Z5lA6ZstAgYsfGRLTXKje/Qt0aPt5DlEa6ZV8t3WdB4/8qj62+tGezSfbpnPRIz7l96y1nn75GWmn0zq+jlk9+mJtdau9tJrK51scaJPqnqhwoeIPQIo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-365145ef32fso10396435ab.1 for ; Tue, 27 Feb 2024 09:25:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1709054720; x=1709659520; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vQLszZ5s4HDCNKPzbWpX+6tEF3YOu9WMO74FkbSJCQQ=; b=Ry/pLT/Ww7gALMI8tqqwjaM3NZsTMgTO0gn7RxeCfZXxRNbHqIMOPIGjURJjNiEeb4 48ktxwfXng/ivpXd6tO+0TJ9C1y2lvkluctwcLsfdhOaRzWB80kRGtZXKLgMTZ+G0wwV js5i3o6jbAUJQJ5pmuLP6kI7dUUck6bCwC615hHfolGrSXH+MwQbUeOLK04FNb6/eGPD BQUq1vG+exCqxO2ToywU831ZEZORVhLfeBoX93R0Wou/bilyccIPGFJl2mYmmT/eFVAd GlKXnJRPt3Mam5i4ogsceCVCxacyvXM/BzAFMtwrJeBIYIEa0FPu9Ue2yu7/9CQOLBAK BjUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709054720; x=1709659520; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vQLszZ5s4HDCNKPzbWpX+6tEF3YOu9WMO74FkbSJCQQ=; b=qbd+t42qEHgPU0u2sB7fSxqKdu2GxhQdPtNP8DzfTY0XE4htlEEtqXZPEW4unaC4fF MtIzvkpLDIHRjQ4NBlmpofEBvovo5PofOmjpMnvmGdUcsLxZYSWlG3/Zr79O32fzNE7y c7jAo4cENgWL672gAhO36BDlhi0+YSbd4cvb5kccczBJm+/EKerTId2vfKMsWcC0G11G BDpjGdBqywR2vYpXXP1w4jJxH9hKg4Tc3MubvNH2mBAzAzkZ9SenemfY/8L1YUCSjRQ5 ypupG4HMDq43wq99IIM9yJ+vHytHh2bH86/NMSnLxBat/Vsv2f0K9WJi0OJiEA97L+TI bndQ== X-Gm-Message-State: AOJu0YxDGHLBzLGoBiws+PTqp48nesfI0DUW/N5T5SK58aSv4/2D91jm T1R4xM5TG+WcKiGZo3zTxsbEaJuh6ma2nWNoJsid6qodwQtAPJ8/zMoOrxW4C3bvWybvlQRYs+g = X-Google-Smtp-Source: AGHT+IFB2OcTo5Aj1qMQrtow6vITbQvbEjV4PdOXgTlxLDIfJs7ZNQA+C/U8bWoRPArzhp5tc26HBA== X-Received: by 2002:a92:d30d:0:b0:365:1dbc:a4f0 with SMTP id x13-20020a92d30d000000b003651dbca4f0mr10925124ila.31.1709054720509; Tue, 27 Feb 2024 09:25:20 -0800 (PST) Received: from localhost.localdomain (71-211-170-195.hlrn.qwest.net. [71.211.170.195]) by smtp.gmail.com with ESMTPSA id t8-20020a02c488000000b00474337784absm1816949jam.115.2024.02.27.09.25.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 09:25:20 -0800 (PST) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Rely on std::uncaught_exceptions Date: Tue, 27 Feb 2024 10:25:10 -0700 Message-ID: <20240227172510.1754154-1-tromey@adacore.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org std::uncaught_exceptions is a C++17 feature, so I think we can remove this conditional code from inferior.h. --- gdb/inferior.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/gdb/inferior.h b/gdb/inferior.h index 7be28423aeb..e8729658b38 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -86,13 +86,7 @@ struct infcall_suspend_state_deleter /* If we are restoring the inferior state due to an exception, some error message will be printed. So, only warn the user when we cannot restore during normal execution. */ - bool unwinding; -#if __cpp_lib_uncaught_exceptions - unwinding = std::uncaught_exceptions () > 0; -#else - unwinding = std::uncaught_exception (); -#endif - if (!unwinding) + if (std::uncaught_exceptions () == 0) warning (_("Failed to restore inferior state: %s"), e.what ()); } }