From nobody Thu Nov 6 08:24:09 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 1540278725003100.01241045977883; Tue, 23 Oct 2018 00:12:05 -0700 (PDT) Received: from localhost ([::1]:38492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEqrD-0004cz-9B for importer@patchew.org; Tue, 23 Oct 2018 03:12:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEqm5-0008QL-1m for qemu-devel@nongnu.org; Tue, 23 Oct 2018 03:06:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gEqid-0003sh-EP for qemu-devel@nongnu.org; Tue, 23 Oct 2018 03:03:17 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:46002) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gEqic-0003id-7w for qemu-devel@nongnu.org; Tue, 23 Oct 2018 03:03:11 -0400 Received: by mail-wr1-x442.google.com with SMTP id f17-v6so341630wrs.12 for ; Tue, 23 Oct 2018 00:03:01 -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 t13-v6sm258355wrn.22.2018.10.23.00.02.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Oct 2018 00:02:58 -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:in-reply-to:references; bh=Aemm+FkfNxZFuIuM8Lsl0WBJ4No9SI3OzHQ9cbNtZas=; b=MP+KFp5mmz7e2KCoUB9Kwtxxd2dwfOaRFJ1AjYJh15ltU5N0iVsI4kx1A8sxaMEdmk XvuNkTsCEiute7zck15tVfegCTKLq3Bincs0XSMzC5tMLms0dtOCtxjpbQbKKtGGAekJ iir99Uv4yZNfDOKxUzwGGhICug9CB4e7oZvVk= 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:in-reply-to :references; bh=Aemm+FkfNxZFuIuM8Lsl0WBJ4No9SI3OzHQ9cbNtZas=; b=p267jJRCIwDS7K6yc/02G14CjSISe+Jek1z993hzGnMCLYpXfIoj5fFnBbqth1vyO4 pK0mnsQTo1ydNafTYwmgMcy7VeJcAkKIkbGUxH30yp5LpoArwwrLvlG1G+E81ryZVyRu swh805XPGMUxsVfd78cPHDSlQG6Edt9daOVAakf7AWYOEnhSgem4Z+BbVNYTiUuyIDSg H/tPaR2ai10c0N59HUT2j4H9uKZv/HlB5SMxwPZ2hJQFyssr+mEfzJstBKdcUNqU4X73 KtiY4z0fgH1aP3xORDp+DQO0TdlJK1pIv3nHmAvYwHrUPTzGa3tOtAguUhXYFpGv6A9t GHIA== X-Gm-Message-State: ABuFfogMe13KziskCDHttknHT8O9G4D+TWbhA5lM0ehHdxqpJrg0qkTb sPYCHDB1yEGZwsn48YoFzAqajVH5Qcg= X-Google-Smtp-Source: ACcGV60m4TVlvzMId9Ila8iw+s0h5znRO1EQowDdYl66PcL1cPdyIE7WpgvGGgaEDTHvum7AAvdkZg== X-Received: by 2002:adf:ae09:: with SMTP id x9-v6mr47194806wrc.102.1540278179587; Tue, 23 Oct 2018 00:02:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 23 Oct 2018 08:02:44 +0100 Message-Id: <20181023070253.6407-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181023070253.6407-1-richard.henderson@linaro.org> References: <20181023070253.6407-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 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: cota@braap.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