From patchwork Sun Oct 20 18:00:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Oates X-Patchwork-Id: 99250 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 872863858C53 for ; Sun, 20 Oct 2024 18:00:39 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by sourceware.org (Postfix) with ESMTPS id F39D83858D20 for ; Sun, 20 Oct 2024 18:00:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F39D83858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=andrewoates.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F39D83858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::730 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729447219; cv=none; b=WnoGUg7ey8nUb1KgQJhi9BQNQMvpZ3/TaV95GbtYmdPyJLBeYS0v53JAIUqruoeUcHmmptZ52Kn0Ta3JVmvp4uzjQ1ZrVQp+cEDCbc+mj1akOsk+goz71M/4Gi9KqdrMDrSCOkuVvsMKIMl1sP/l2TmFJfSITJg3r7QqCOFF72k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729447219; c=relaxed/simple; bh=MXn53nYuFVfev2V4vXf6j5ZYRyXEPEB+saTHWPMyLlw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=hE2Lrr9KFcmar0oEBfvV4R1dfJtmsc+K4myl+5k/atN+t0QyWFjhpAYGBmBpPx9W0PzrGsC4EIliQDO14vjHx12TcOsdoDnEfIrGCD3ImieNUKA4cLp6YjKMrOx3jg3rDaw5f1w8AEEpvluv2Hf11MTkFjAZ7M3xcaHHy/tRuJo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-qk1-x730.google.com with SMTP id af79cd13be357-7b149ef910eso328038785a.3 for ; Sun, 20 Oct 2024 11:00:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729447208; x=1730052008; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=kUUk+DgE4mbk61sIrrH6JPVt0THUehed6ajygiLEcEw=; b=NNdeqLXOFBAvZJNeVzmlXTW4HRjhA3NMMhkN0Hcot8bODZTQCxDmS9JlQ4rs9MbYAm 2bFpEtj5PWZ8L13iPkxHsn+/cpsvtlcmwD67OIH23Fk5z3Hh0zZT+vFWzWPiZZgzEKFN G/TCqlsF3LSyMHrORZ+5K+/TcfDcT505Is+DiuJVxenf88GMz94f6I7cGWK5HJEQQt6Y Vn8I4l6oH+QiphP8Rivfm6hqOEW+jVwR7hEZmg+tkolC/eOY1Lb9qDPiD3N0J48Xb9hl t/R+xXOktZWhRTj6b4hvGQqYgoViPEx2L4GUftz8npEjAx9TF9L/VdcSBK0bLfeOg14x XGCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729447208; x=1730052008; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=kUUk+DgE4mbk61sIrrH6JPVt0THUehed6ajygiLEcEw=; b=rHNv5OWUhn5/LtNkjtRin4bTYrcVkmc/H/qoEFz5KV7B6i6VFTRtYLePrOUoi/u/Ds x/4ZO2uQ4YDu0wG/BS7nRpcRIKCP/n5BIQthjY9CRIZ8YWu6vWdIRLePTMBah6uj6T6o 4cwa532E/JvmRUwqerSNuiD/1hOjqXpwTXh0wttyYB17hZxFcUw3tqxcH+hiQ42FS9oH j4u7T/A8s0Iu7kOpP6NekCt3TIgw32yDPGQvj6t0a0eSd7vvJP9yvkjp4EmDuRlQTRC7 NPS4EopiByWUOPTAhBSF/r4IRRPi+KPfHwhU4fvHHUHtffCSQB/UCE6rMiIMRwajdppd BKpA== X-Gm-Message-State: AOJu0Yx+UjD5AhZ1yAU73HygBgtGAN+q3EKmdaoZCiJRBdT7c+UnnJV8 ckWHbgd0fsJD30Igi/d3FvHkblSDmTJ9rqJaXVoJeb7XVmWQMmkEss7UAQ== X-Google-Smtp-Source: AGHT+IF+X7fbyRJJ0cy4iCPTRBpyeC4IsHMCj5cE7mACgp/LhEIQC3yA1o9TeUx8+BsQW6pKzCrBtw== X-Received: by 2002:a05:6214:4b08:b0:6cb:ef7c:c1be with SMTP id 6a1803df08f44-6cde15066b9mr121422816d6.20.1729447204490; Sun, 20 Oct 2024 11:00:04 -0700 (PDT) Received: from Dug.localdomain ([2601:184:487f:a530:256b:ed42:c74f:2545]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6ce008b2a48sm9987036d6.25.2024.10.20.11.00.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 20 Oct 2024 11:00:04 -0700 (PDT) Sender: Andrew Oates From: andrew@andrewoates.com To: gdb-patches@sourceware.org Cc: Andrew Oates Subject: [PATCH] Fix compile error due to [[noreturn]] with clang Date: Sun, 20 Oct 2024 14:00:01 -0400 Message-ID: <20241020180001.67425-1-andrew@andrewoates.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, 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: 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 From: Andrew Oates Since commit d9deb60b2e9e94b532f43a7d3ddddf5ddf6dbdd3, I get the following compiler error when building binutils (cross-compiling) on macos: CXX remote-sim.o ../../gdb/remote-sim.c:334:28: error: assigning to 'void (*)(host_callback *, const char *, ...) __attribute__((noreturn))' (aka 'void (*)(host_callback_struct *, const char *, ...) __attribute__((noreturn))') from incompatible type 'void (host_callback *, const char *, ...)' (aka 'void (host_callback_struct *, const char *, ...)') gdb_callback.error = gdb_os_error; ^~~~~~~~~~~~ 1 error generated. This appears to be due to the mismatch between ATTRIBUTE_NORETURN and [[noreturn]] on gdb_os_error. Removing ATTTRIBUTE_NORETURN on the declaration of host_callback::error resolves the issue. Tested by compiling on macos both with the system clang, as well as with GCC 14. With clang, remote-sim.c does not compile (per above) without this patch. With GCC, it compiles with and without the patch (it doesn't link, but AFAICT that is unrelated). --- include/sim/callback.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sim/callback.h b/include/sim/callback.h index f69f783abac..045ac3411af 100644 --- a/include/sim/callback.h +++ b/include/sim/callback.h @@ -129,7 +129,7 @@ struct host_callback_struct In the case of gdb "exiting" means doing a longjmp back to the main command loop. */ void (*error) (host_callback *, const char *, ...) - ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_2; + ATTRIBUTE_PRINTF_2; int last_errno; /* host format */