From patchwork Fri Oct 25 23:35:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Oates X-Patchwork-Id: 99644 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 17BC83858C62 for ; Fri, 25 Oct 2024 23:36:31 +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 F0CAA3858D21 for ; Fri, 25 Oct 2024 23:36:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F0CAA3858D21 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 F0CAA3858D21 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=1729899370; cv=none; b=CrcPpqfCHdW+VJ5EUDgMm1/lGDqDwhRWcCYDUvGCxAfhKgaoFV7fCPIXmQz2JfCZomSw+7D9cKOCpNnc+IXkdKeJzQEiZBsV0md5pZOUgVc4g8Hb6J2WVkPrxJRxuNViWk2QSGFCZ4U0pCjEc0q8zc59rQH8CSwOo+9IZ4lrUwo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729899370; c=relaxed/simple; bh=NDUUSHEAmqnUhgKxpii3c2vaDcJ16jFtlWhpb3rSpTA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=d+WZVETgUH0GlotrHQPGAwLauei7bj+NCxzfazLXxQwrLifQf7Y4X+FzZj4kD8g06ERq3gozXLEfTxXVcyAjGXWGnC3Z1HkhRTMoBonu9F11vQwraT0dbHP9/iMGU25j/syVRon8Hhgd+TaEHg6sz6dmtlAWekEybOdlZVZMDnI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-qk1-x730.google.com with SMTP id af79cd13be357-7b161fa1c7bso164050985a.0 for ; Fri, 25 Oct 2024 16:36:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729899367; x=1730504167; 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=UemqcYNAy6lpu5jM8JJhl/4V1eAXqwg6IyL3u9onqXM=; b=FzZMGJO2+9wSnDMr7V4jKBQuajWK6v0Ot0k/Iraj/HLE2HvFqueB9GXIC7Zm30/O4v ysCdCtVzHt4SIgUqfXhMckoXXvrxzONBtTR4f5M824NUCBwFNhxxDO4fLub770iVVEbB 09W9fbvdaVHsD8Ujy5sHuE+ymc4140e28Lqqis2Fxn1bv5EZhB8aVN5BsDa8WkWUK1Hb ELWIwoaq//2IzefgxiJaZtsFBulqJ29VRQKM9R5dVXD37CaQGurRBC39gSuU3SqBq0jg KwlXA5jFPqU2wj0HVqXgs59dSkAqX2NmFTEu9LGSPDmbtnYiPQmRK2e+KLusgM9YXGOf ykvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729899367; x=1730504167; 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=UemqcYNAy6lpu5jM8JJhl/4V1eAXqwg6IyL3u9onqXM=; b=RqdGI1pS01cI50YHPq6HboWRhcYb2kqMIbYGv+ikQvlwDgSuRt4/I4eAPe/Ag8680W NlDji3YAlqZfl7agzccffle4h2yrWBDcguabvpk1PPbIq6XrxM5ZEQ5YNmiqF9gle4oz oiOD2SfuVn7kQJH9MHKr4QHqGYuEUh873xuWYNy/H8vQHqbCF7RcwjrI4WeocyqkQ+rG zEBkSvUPqA1bE8nfwrHNW2EmCFrp0lGgLUZEqWQnxy+oKJPv+97BiPE4GqEw6GG26aVC kf5a5BWnxZPUPP69Mlh1zSOi3+lKVuX/KcachZHdeK2AtdIjI4Dzp+dY6Tsrw/MAJQDc oSgg== X-Gm-Message-State: AOJu0YyC78edBy0+enBwb3Ka/aU6Nsmv+eNzfFE+nKyMALQsCTlZy0ae wWMV48HJicySUNbwFfCTins11J0mP44Ysj0J6ZXVUHz5glaWl+mVqGeAXA== X-Google-Smtp-Source: AGHT+IGOVCHso92OgJO26BUyvkLE3E1IbjPY60xCosJ6ufFcEK9811f71wbmi9vVhhtJSfggeEqF9Q== X-Received: by 2002:a05:620a:244f:b0:7b1:35bc:ae0b with SMTP id af79cd13be357-7b193f5b8e0mr145060885a.57.1729899366766; Fri, 25 Oct 2024 16:36:06 -0700 (PDT) Received: from Dug.localdomain ([2601:184:487f:a530:3031:baf3:5605:bda5]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b18d278276sm100803685a.10.2024.10.25.16.36.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 25 Oct 2024 16:36:06 -0700 (PDT) Sender: Andrew Oates From: andrew@andrewoates.com To: gdb-patches@sourceware.org Cc: Andrew Oates Subject: [PATCH v2] [gdb] Fix compile error due to [[noreturn]] with clang Date: Fri, 25 Oct 2024 19:35:34 -0400 Message-ID: <20241025233558.29432-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. Reverting the change for gdb_os_error resolves the issue. Removing ATTTRIBUTE_NORETURN on the declaration of host_callback::error also works, but deprives the compiler of data. 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). The clang bug is reported upstream at https://github.com/llvm/llvm-project/issues/113511 --- v2 reverts the change to gdb_os_error rather than changing the type of the callback. gdb/remote-sim.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 67d3f4c8b1c..e870c5c4f87 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -69,7 +69,8 @@ static void gdb_os_vprintf_filtered (host_callback *, const char *, va_list); static void gdb_os_evprintf_filtered (host_callback *, const char *, va_list); -[[noreturn]] static void gdb_os_error (host_callback *, const char *, ...); +static void gdb_os_error(host_callback *, const char *, ...) + ATTRIBUTE_NORETURN; /* Naming convention: