From nobody Thu Nov 6 08:24:08 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540232260184154.11376127163987; Mon, 22 Oct 2018 11:17:40 -0700 (PDT) Received: from localhost ([::1]:36526 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEelj-00072v-CG for importer@patchew.org; Mon, 22 Oct 2018 14:17:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEekl-0006ef-KE for qemu-devel@nongnu.org; Mon, 22 Oct 2018 14:16:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gEekg-0006KN-Mj for qemu-devel@nongnu.org; Mon, 22 Oct 2018 14:16:35 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:35444) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gEekg-0006IH-8s for qemu-devel@nongnu.org; Mon, 22 Oct 2018 14:16:30 -0400 Received: by mail-wm1-x342.google.com with SMTP id w186-v6so55215wmf.0 for ; Mon, 22 Oct 2018 11:16:26 -0700 (PDT) Received: from cloudburst.twiddle.net.ASUS (host86-153-40-62.range86-153.btcentralplus.com. [86.153.40.62]) by smtp.gmail.com with ESMTPSA id t198-v6sm19240029wmd.9.2018.10.22.11.16.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Oct 2018 11:16:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=Aemm+FkfNxZFuIuM8Lsl0WBJ4No9SI3OzHQ9cbNtZas=; b=jZiDV4hrubPiDyCemv9Zgh9iPmGw0nKxiG7QFZa32C0uMAlxDe7m0oh1fe9/Rqoa1S RZ7u5enTC7hT+VkLjcADnfKlCSXxcXqqpNIQwKMPwUbDZxPm8+117IyVLvIi1NTc7UkX 6fRahcD8SjJfKorG0Rrqvpex5Z7xLkEXxdMqo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Aemm+FkfNxZFuIuM8Lsl0WBJ4No9SI3OzHQ9cbNtZas=; b=D2gergb27xTdg8UmKmWYV0Ug2DWgJS/GSof6gNOmAR/AknymIJ9nJks0XgZ+iiPkLB 3mWTwLd28FTNBUt3aha116mCLabBY9Kc/E58N/CiQx5Ix0IBPitB945wZ7BzLQHxGGp5 bdct+u11W2uyWn1gOLspH5rPXrQ3cQivQ6l2PGNiKBami29m1EPTeu8IkN+lkbynKcbQ dXizhHSJ+4LuboFxBU837f31gvqQ+xeXGSOPNjWsvbAH+mb0mKTdFzrunF6PZX3dIX2b /gukgMYYfajXLZAyoTkP+alNnYelAwHx2ynqwttl6I16UXsG4pmqBMGebfURdnITuAzQ drEQ== X-Gm-Message-State: ABuFfogqM0vB0Et2e3P7KVytryW9zXXDxeLv2+wc1dTJRjI0IW4aFQV6 oTDCmcH9x1tFOxMJn06a6Spbu97Dfaw= X-Google-Smtp-Source: ACcGV60qJCYL0tqSrueqWSJQcN8NgbasEZ32F8t+ElcUaZeu20ACJx8tXXM+N1EPNvD/FqAIxzQA7g== X-Received: by 2002:a1c:90cc:: with SMTP id s195-v6mr16216321wmd.53.1540232185189; Mon, 22 Oct 2018 11:16:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 22 Oct 2018 19:16:23 +0100 Message-Id: <20181022181623.8810-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH, build fix] osdep: Work around MinGW assert X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In several places we use assert(FEATURE), and assume that if FEATURE is disabled, all following code is removed as unreachable. Which allows us to compile-out functions that are only present with FEATURE, and have a link-time failure if the functions remain used. MinGW does not mark its internal function _assert() as noreturn, so the compiler cannot see when code is unreachable, which leads to link errors for this host that are not present elsewhere. The current build-time failure concerns 62823083b8a2, but I remember having seen this same error before. Fix it once and for all for MinGW. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/qemu/osdep.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 4f8559e550..0c1e335a43 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -122,6 +122,18 @@ extern int daemon(int, int); #include "glib-compat.h" #include "qemu/typedefs.h" =20 +/* + * For mingw, as of v6.0.0, the function implementing the assert macro is + * not marked a noreturn, so the compiler cannot delete code following an + * assert(false) as unused. We rely on this within the code base to delete + * code that is unreachable when features are disabled. + * All supported versions of Glib's g_assert() satisfy this requirement. + */ +#ifdef __MINGW32__ +#undef assert +#define assert(x) g_assert(x) +#endif + /* * According to waitpid man page: * WCOREDUMP --=20 2.17.2