From nobody Sat May 4 00:22:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641843091; cv=none; d=zohomail.com; s=zohoarc; b=QAdemqOnaTkC67yVWgNc+TMi57ujz8hAhUxGarh+fLquP0dfZuBFfE1D2omuPDB8UkKG1WCjxZmbEOCTV2u/JTHh8mvaFkcZPGy4dM9v6GAL230B74DzMSscKa3wqbphJbMBpmZVUOH/G3j7+nOFCa3anRe1KmnFmMkgC51E+BE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641843091; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=NwOJ7W0q/pYFOyZh1Xbq8WoDYGV9gt57w84iz0l5T8M=; b=jCRm23d9tTLBYZ1O9Ki85F9qasxpfxF11f4sYbVZrQuiXfz7GRLJ3Axyz82Gf8ghHr2H6PPz/YTarRzB2SIwtna6klQyNrugxvv8BmiUg+2wWovMQFj68OjHKeAsccN5sEb7njgECJgAmMeDcEg1OozHiAgIa7jcOrOfBlUpj0I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641843091113519.9733876326758; Mon, 10 Jan 2022 11:31:31 -0800 (PST) Received: from localhost ([::1]:35486 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n70O9-0002bP-RY for importer@patchew.org; Mon, 10 Jan 2022 14:31:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n70BD-0007qG-SJ for qemu-devel@nongnu.org; Mon, 10 Jan 2022 14:18:09 -0500 Received: from [2a00:1450:4864:20::436] (port=38410 helo=mail-wr1-x436.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n70BA-00051H-Cx for qemu-devel@nongnu.org; Mon, 10 Jan 2022 14:18:06 -0500 Received: by mail-wr1-x436.google.com with SMTP id a5so24746448wrh.5 for ; Mon, 10 Jan 2022 11:17:54 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t8sm7427847wmq.19.2022.01.10.11.17.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jan 2022 11:17:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NwOJ7W0q/pYFOyZh1Xbq8WoDYGV9gt57w84iz0l5T8M=; b=tsZNJsLOYWgdFLn7SyYrKzdpPdPdKNZWKl7eU4aE/NPUH0TtdSc/2qkhqS31L5tZgl sal+dahdFcT61wkuZr3OgI7E0HQWMA/07a7kQKsbycoehgTMQNLSXgfur4c9rqd0q3a3 xZWn8vVJohVDeL1vDnPugJbX2wlmBxYxwpu//zzeAd3ZvC6lbEZ7oZGzgbRLQB2YW3Vj JLSL8LIV3WI3h9WmyBdUL5gEP/7xUZicHwlRr9npTW3y68aa6Zl2B0OJOwNeYLVv+aj3 xsvzPi6CEUASGv2Vo5PS6x+6OruOO8gFKse753Y/xTZcmLBGFivAZCZARswHUrg0wvcV VF6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NwOJ7W0q/pYFOyZh1Xbq8WoDYGV9gt57w84iz0l5T8M=; b=Q/YnlYfM18LonedOsV3X1bBTndgYiaDVFo7vPvqd41/AsoQVmWxpaZyp/5eKAqzS0N CyMDAcFofPAYkoIwhjA0ANnt6LLlmmip/4I7enhR1Yna+j1GA+9/zJwaKCUKjVguosit t9QwsXRWu9wJw/yh23ekwEU8NN0UhUaMJIQ2ytQwf70naQkepcf2J4tuNZEpnpVtwWrU fohYP7mDDcADMplLMXUs5SSVTWfiEZMbQ5EbV4a+o4No3DpSJxZ4Z1kS2llWwRxXP05U a/frpU7AK8RMOzIFTPGNSqnKWDwzvA/dVt6AKotgFYQ7xX8CO3OfP8jODn9lW9Ro/k7i mUBg== X-Gm-Message-State: AOAM532p1ahDN7nxEl647fXhVNTqwfKB3624d20LNZGNomLxn+4EfRvm ICrOTtjiiTIk2BRNYD3qw2z09FTBmjsMIg== X-Google-Smtp-Source: ABdhPJyAOOzdPpDXnqMpSqInP2ZmbspdndWwNEzG/NyjghBNzWovVROqT4ILXeod5b8k1k+bTq/vaQ== X-Received: by 2002:a5d:6881:: with SMTP id h1mr869737wru.250.1641842272947; Mon, 10 Jan 2022 11:17:52 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH] linux-user: Fix clang warning for nios2-linux-user code Date: Mon, 10 Jan 2022 19:17:51 +0000 Message-Id: <20220110191751.3335516-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::436 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641843093245100001 Content-Type: text/plain; charset="utf-8" The clang in Ubuntu 18.04 (10.0.0-4ubuntu1) produces a warning on the code added in commit f5ef0e518d03 where we use a shifted expression in a boolean context: ../../linux-user/elfload.c:2423:16: error: converting the result of '<<' to= a boolean always evaluates to true [-Werror,-Wtautological-constant-compar= e] } else if (LO_COMMPAGE) { ^ ../../linux-user/elfload.c:1102:22: note: expanded from macro 'LO_COMMPAGE' #define LO_COMMPAGE TARGET_PAGE_SIZE ^ /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/include/exec/cpu-all.h:231:31: n= ote: expanded from macro 'TARGET_PAGE_SIZE' #define TARGET_PAGE_SIZE (1 << TARGET_PAGE_BITS) ^ 1 error generated. The warning is bogus because whether LO_COMMPAGE is zero or not depends on compile-time ifdefs; shut the compiler up by adding an explicit comparison to zero. Fixes: f5ef0e518d0331 ("linux-user/nios2: Map a real kuser page") Signed-off-by: Peter Maydell Reviewed-by: Warner Losh --- I'm probably going to apply this directly once it's reviewed, because it fixes a build-break on one of my machines. linux-user/elfload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 329b2375ef1..2993b01e60c 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2420,7 +2420,7 @@ static void pgb_static(const char *image_name, abi_ul= ong orig_loaddr, } else { offset =3D -(HI_COMMPAGE & -align); } - } else if (LO_COMMPAGE) { + } else if (LO_COMMPAGE =3D=3D 0) { loaddr =3D MIN(loaddr, LO_COMMPAGE & -align); } =20 --=20 2.25.1