From patchwork Tue Oct 23 07:02:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 149425 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp349056ljp; Tue, 23 Oct 2018 00:12:44 -0700 (PDT) X-Google-Smtp-Source: AJdET5eEuBn2F28gDU3J2ulDajqxX5uN2cIgUAjUdMgdSIgWIZSoyUSNXv1Jg/vT18MSFsXsFx14 X-Received: by 2002:a37:8bc4:: with SMTP id n187-v6mr11125758qkd.220.1540278764104; Tue, 23 Oct 2018 00:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540278764; cv=none; d=google.com; s=arc-20160816; b=UDAQWqMF8jVHOHQQatf4nI9/VDllK8lW/6qqcwQFv1ZOQLMr1CQNJeBwgA4i8f4e1i dLzpwjDaDOBy/3La6Haa05OWJ8lu3SiurLaRs4vtj0V/A/3hOQyomYhpHaCls8A8yEM1 RnysIggMH5u3ghz7pXFEu6UQ807CVFDydF7dCoq1KSRnkZZlGFahp3Y2N/Ogq3hxtcxI K8eh0h7MT3x5p7WwKeEb79QlS9XSzvcmpZnkznV7iWpl/ep1j3TU6wRg430rp23dL+wx IhWdYJtV9R9tOkF0WiqlvqFWzADoi72W6OcxLeq2i64Z6OWLZyMH2gr9oaT9yCckrMmm ANeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Aemm+FkfNxZFuIuM8Lsl0WBJ4No9SI3OzHQ9cbNtZas=; b=dklMe4usXaH8TwO+T/6UqtzMGwKwPnVznKiwCfeqGGdLEGIt2O5PbHZhZiMi/DOofx lBbeKWpjhvN3rmC2Y2nJe96KonPZK7uke/ULKrSpa7aRLThuo2r0Uk7CQco0Gmqyod3x S79rQ+bqU0JiajwVdSi+2U1vKXqKkUogpqI+RuE0YcAH7+vUCAlmacqiH1Ct0JH6ccHn NuP84Kir1B4ALmssMyq/M9oOcY4SeADdDdepVQqDsncb/4Tl2h/DrnCoFbSwTLwVh6oj 92sAxf4PJvOnIYCKC3q4TfmRPDQlxVqSEkcMIURdftpE4+sFVc4tsOeh0kozq69j71ky npqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MP+KFp5m; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id p33-v6si5763qtd.311.2018.10.23.00.12.43 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 23 Oct 2018 00:12:44 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MP+KFp5m; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38495 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEqrr-0005qW-8O for patch@linaro.org; Tue, 23 Oct 2018 03:12:43 -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) 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-Received: by 2002:adf:ae09:: with SMTP id x9-v6mr47194806wrc.102.1540278179587; Tue, 23 Oct 2018 00:02:59 -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) 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- include/qemu/osdep.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.17.2 Reviewed-by: Philippe Mathieu-Daudé 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" +/* + * 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