From patchwork Mon Oct 22 18:16:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 149397 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp2949719lji; Mon, 22 Oct 2018 11:17:56 -0700 (PDT) X-Google-Smtp-Source: ACcGV63CyFXBxFNyZ57MgCtOGhz4gaUwEwshauWyPK48kRJ2XW5/z9x6haG1CaXB7ylkp7MJYDau X-Received: by 2002:aed:2e61:: with SMTP id j88-v6mr26883000qtd.339.1540232276734; Mon, 22 Oct 2018 11:17:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540232276; cv=none; d=google.com; s=arc-20160816; b=GyIdtS2vTdeePVkwcOjrhg3+9+uuB0P310NDKVMwloeI14ed7R1WMF1VtPCEM3qTf/ H6O8qfi6sm9jk6Y9yOz77Wa9Kyv2oIB8ZBZRdAmwRdr1RQjFBytcvQy+J7nR1xY+6hsQ vxLiOxys/fg5ccGSmfecCEnFIU835UjbW9bTN9M1ReXN10MEnTj/2vXz1B5LCMaN2kR2 wjLaGxGEOA7lTAX8mNA6UsIx7IW1d/7jkjjGpvyMEFFz9HqWOKTTImQoxfeWWHe8MtZE xLtNGeYiosbLM68606JaWUkt56tRuNygXD1WDQrQGrYfJuoNcm2B3mYvnTpIIJa8h2M/ HPjQ== 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:message-id:date:to:from :dkim-signature; bh=Aemm+FkfNxZFuIuM8Lsl0WBJ4No9SI3OzHQ9cbNtZas=; b=zBxLgKsv30YqxmwyaQ0U9Q3eUmOgo0k/U6H1+cOuTgUCiovf27QT5ADwdGLmHLPdFQ mQX8JCErQBA/HaOfzTawIn3kwG85p/YsRQcnmdK9H1kqjLbIt12l2FMm7ulXIDKo9chp YHtPpZBl2c31JGEvZJV9TH0E34+Ig4WBYGrOnS0X8eT0SiaOPGg+p8+102DXs5sLLHgn 2hhZz+UDSWz4af6iql74Ja0JJxzN6T9OCaEeZrtJMxaIMstuDC988Gisb9bpbcPzhw38 APFYjOOB4EbsseS8NxiRa5fQTWInKQPYR6/XGI4pyPhYFa0f4WPuKPGLDLBM3n267+Rz 4guQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jZiDV4hr; 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 m27-v6si1049411qtg.248.2018.10.22.11.17.56 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 22 Oct 2018 11:17:56 -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=jZiDV4hr; 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]:36527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEem4-0007kV-2x for patch@linaro.org; Mon, 22 Oct 2018 14:17:56 -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) 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-Received: by 2002:a1c:90cc:: with SMTP id s195-v6mr16216321wmd.53.1540232185189; Mon, 22 Oct 2018 11:16:25 -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) 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+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