From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web10.25285.1611844316930130046 for ; Thu, 28 Jan 2021 06:31:57 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=dpOKu5N3; spf=pass (domain: hpe.com, ip: 148.163.143.35, mailfrom: prvs=0662e9a25a=abner.chang@hpe.com) Received: from pps.filterd (m0134424.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 10SEMkoK019022; Thu, 28 Jan 2021 14:31:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pps0720; bh=bP9PxDJiEtKhQfE3njkPirzyPYKRxFJe6vj8+HHXAPc=; b=dpOKu5N3oIcraVecQe8z3AILYURpGaMGhJTsSIp6gRR7uY2aIvpmDsDx0J4iHZIemR50 Wd51wqa1hZbDNgbvr8h+CwkEj8zmdFhbzwGIYR/5zUDutAI4h+e7tYgVnbh0+LAMCA/X tkq/Wmo9c8JUjvAH9nNzLMS9hjRzO9sMVHc+7uO1N4/DJBNlEUx7sUxxx0Z8zNfXGswB Wk+p5zlQhw1kSYkeOVxVgHkroXrHMIaqNboBP0VkWRyjH4wsuRcfeHe2IiGbYuoitjrq 5UrvB36Q96Z/R5Jm3aH1Ic298rNkunDUN9wGJJYrVCT5th03x+jYFBNdc5riMogwtxju tQ== Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) by mx0b-002e3701.pphosted.com with ESMTP id 36b20pd9tg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Jan 2021 14:31:55 +0000 Received: from G4W9121.americas.hpqcorp.net (g4w9121.houston.hp.com [16.210.21.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3426.houston.hpe.com (Postfix) with ESMTPS id 87CC165; Thu, 28 Jan 2021 14:31:54 +0000 (UTC) Received: from G1W8107.americas.hpqcorp.net (2002:10c1:483b::10c1:483b) by G4W9121.americas.hpqcorp.net (2002:10d2:1510::10d2:1510) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 28 Jan 2021 14:30:39 +0000 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (15.241.52.12) by G1W8107.americas.hpqcorp.net (16.193.72.59) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Thu, 28 Jan 2021 14:30:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jpGHR8yaAX7F1uu1XfJh+xBiRL4JpAZcywchOsap+J06lcfsmswIa6NKW3B3d8yYtBcMldQPH/O4EzXqlys90Rpy7Ed35Vr9dCrViu9aHeTI8ise7eeYi1tQzLT9uMqlml0Q+xI00oweCdGuMKSpKnw0CGsUdPOTgUd9vbIKZiu5xwKP8De11lgGHy73mhJtnzMQySb/SKv5ZDSyMAvz+O8aiQWy9IMrQg45xIkm8ypFBsx90pmnwc28iUiDc9iSU6JaCbUABpJNNptKIMJmhPwACAuIhQuGELsbEZTo7h3uyn4IhaOtN6cEcsOP2TjYhNJIXsSq7/rM78FVA8e3Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rSv0rKdLaI7gR6zbgPNxRuPmP7TbgLB2hXp7r8bhstY=; b=lgrLhO3Y1S2m9WZNBkiWYq0lSjDdy8ad5ighAWEAH+awVDkYWKUh0OgxoEkvSgqKYyhnqruyU/e/QDPt7J8TYbxRneYrkQgQiYhCoUMn9o4W2T+gC4h2MeQghTuMmhq92kn5ZLWWCEPgIyLISJeOAuH3y52xLUUOoPkjfnuywf4qn+eFcdMZGx3vWhJAZfDTnpQdsS6n9V2Ziy1W4jr6SRVO6R3iZc1lvekqoCcY0+GqUueOgMRcWp/RD/ZstTyu4Znh/RyLErke6h3Ft1Mz0wQAL1rvH4Fsa3KDCHo2W1F5nEN7TZHKwQ13zw7DCcFQ48WDkHODjF4gTCit7w4sHA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hpe.com; dmarc=pass action=none header.from=hpe.com; dkim=pass header.d=hpe.com; arc=none Received: from CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:7508::16) by CS1PR8401MB0709.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:750c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.15; Thu, 28 Jan 2021 14:30:35 +0000 Received: from CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM ([fe80::adb6:a875:93ca:b54a]) by CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM ([fe80::adb6:a875:93ca:b54a%12]) with mapi id 15.20.3784.019; Thu, 28 Jan 2021 14:30:34 +0000 From: "Abner Chang" To: Leif Lindholm CC: "devel@edk2.groups.io" , "Wang, Nickle (HPS SW)" , Michael D Kinney Subject: Re: [edk2-devel] [PATCH] RedfishPkg/JsonLib: Fix build errors Thread-Topic: [edk2-devel] [PATCH] RedfishPkg/JsonLib: Fix build errors Thread-Index: AQHW89a6vRrWezpPEU2lmA06POIB8Ko8a3xQgAB7CgCAADR64A== Date: Thu, 28 Jan 2021 14:30:34 +0000 Message-ID: References: <20210125043154.20645-1-abner.chang@hpe.com> <20210126113034.GO1664@vanye> <20210128111702.GT1664@vanye> In-Reply-To: <20210128111702.GT1664@vanye> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: nuviainc.com; dkim=none (message not signed) header.d=none;nuviainc.com; dmarc=none action=none header.from=hpe.com; x-originating-ip: [165.225.116.142] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: b1bb860a-a114-4c57-1f0c-08d8c399464b x-ms-traffictypediagnostic: CS1PR8401MB0709: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1923; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: wV5Zb+b+ca44BsrQsaL+ORfwD5cA66Ea7lEBp+kpthStvmaRkmpw8/uRhZxArWqXfi6CUbHPTdYYd6lrtSKylu0DD2793xKjh5Apz3/c3nM/OOchZdkxuHfsln6RF6qI9TowoPaKPg5BS5Vgl6YWKiJgnY/b3gMSbzLESuD7p5LIqXtzEkf/x0J3qOX9sBCHpNPBVE4M1G1D8OJg0bPpK7DhBID89O29dxzQ5Ng6cK7ZDVgE77zBNOPecuUTV5KwJKqmrrw9rW2Jqi+/ATzDoygldScA7YByRNXKu+HzCGC1D81NKWWcJpoDyYOETH7Mze+ynfGGe0/nSq6OesdA9Grja/ndUomR/kS4hgsL3tpp/eSNSdiOej0Ad6B7GII5zfgg9cbyaV++IbCLNCSA1awj4Al3xV7Lx/dVMoADExK3ODPGbOYEwFAIH4uyskmxb5HMdH5cK6GgY9RfUklMh2yb7zSWw+FZb1eaKLrE8+vVT+mIGGTAM2oWnniiE0Q3zrgXDmC/hzyQpkPONAtAwA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(376002)(366004)(39860400002)(396003)(136003)(346002)(53546011)(55016002)(55236004)(83380400001)(5660300002)(6506007)(478600001)(33656002)(71200400001)(186003)(52536014)(4326008)(26005)(7696005)(8936002)(54906003)(64756008)(66446008)(2906002)(66476007)(316002)(76116006)(86362001)(9686003)(8676002)(66556008)(66946007)(6916009);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?viwl9dXQG87OCu7FhNyd/D8O3YEmH6myLZ3LzOJOl/q3Uq74Fqz7U6xBJjCl?= =?us-ascii?Q?5YiKZVBZj+Z6q+oHa7bWj7lS6x7cYAmcGoO4pZpUCRB8OqnSNAAc4t5I4mtn?= =?us-ascii?Q?vVkKdiDc7hWrB4psJMLfo4TTXp+o9JDABC3xywGVNsO+hZvnk/d64iwwg+uo?= =?us-ascii?Q?kmNcoGiZRaZfR0IfKKgQ0LgUUemR8cZBVEaxNyHZ/v91xwfbgeoaOpO+LHtM?= =?us-ascii?Q?cHefNbD7pPobExO+DreVNYZE/VIT0Zu9Qnx5r2YIVCSjpOI403Odcf0ZFL9L?= =?us-ascii?Q?Cz3YYCHCM21CG4HnE7gHBwtDeTbNqOyZW4xJBFtH1Eb+GFP21MEvsWx7Ol1C?= =?us-ascii?Q?rR2yhlpBpKzJYWINNF7x9nTpG8LMnGY8KR88Y6oIvvTCl7tQUrHmckvz/xXp?= =?us-ascii?Q?Z8uptYi9u7tW3DodAkGrVgvxPv10j5wJOEKnYkJ53o7dTACd1mxMgzjeOw2S?= =?us-ascii?Q?VQSKjJAcCb2m8gZGSSUaET5TSIVs/0oRJfxLUSS0AkYgIP15YA3r4vFDj1lj?= =?us-ascii?Q?JZP88PD8dJ1cRu356Tr3Vr3UIzbNbqyLy5u4QiQYUMSIENqxflEEnf6nxLOj?= =?us-ascii?Q?im0qi5djiJPWrmowIOkbit8BBkon6O4nLdc3JACKzHBHvZaW3a0Pvrb83EIL?= =?us-ascii?Q?fgtBsiFn+iS0BsCUk+Wg5IiiLt02Bvmn0TJzPhZfeiuisqYHZXqLnkGZZReq?= =?us-ascii?Q?1idiB+5Nh03q6KmmIvGMGWDYK+jjl44ifB2Dzod7vdrSZ9urz4XDOj0MWnyk?= =?us-ascii?Q?iPqJUPUwAKI/X+7YF3XjLx2r09dyUyQdEMGnkDqAqtzpbYWu7NJNTyn5YnZz?= =?us-ascii?Q?8kfPi+MM6OefNQPNNbHJhxubFTtOV3oqudP5Qnqdi4IZDe9LcPpmiJsG9JPb?= =?us-ascii?Q?vKRJGkagrl6erOQ97vrPvX7nl9iRiEZW7sIOdzsfHsfnqVXzePiDmtBiJg3N?= =?us-ascii?Q?rY3prdVu/Uzkblaz0/vVARc3w5BMgsTzHSGpCjdox8iIw9n3PAj/rWRJk2bX?= =?us-ascii?Q?SRlpds58Spf0P0yw+NyuYL43xxeRlvvkjE0uWPnYwmanfGtBLzYatXz1XYV5?= =?us-ascii?Q?zoRSKj0y?= X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: b1bb860a-a114-4c57-1f0c-08d8c399464b X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jan 2021 14:30:34.8826 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Rz0KtNGnxq3+MkUNQIiUFmEK3dMfooCvWpH292q+TKD/tRAVy07KB7ANY9k9ADY+bBEZ9naE7jX8VZbwLP8mWQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR8401MB0709 X-OriginatorOrg: hpe.com X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343,18.0.737 definitions=2021-01-28_08:2021-01-28,2021-01-28 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 lowpriorityscore=0 phishscore=0 mlxscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 bulkscore=0 impostorscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101280073 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Leif Lindholm [mailto:leif@nuviainc.com] > Sent: Thursday, January 28, 2021 7:17 PM > To: Chang, Abner (HPS SW/FW Technologist) > Cc: devel@edk2.groups.io; Wang, Nickle (HPS SW) ; > Michael D Kinney > Subject: Re: [edk2-devel] [PATCH] RedfishPkg/JsonLib: Fix build errors >=20 > On Thu, Jan 28, 2021 at 04:02:54 +0000, Chang, Abner (HPS SW/FW > Technologist) wrote: > > > > + # C4706: assignment within conditional expression > > > > # > > > > # Define macro HAVE_CONFIG_H to include > > > > jansson_private_config.h to > > > build. > > > > # Undefined _WIN32, WIN64, _MSC_VER macros > > > > # On GCC, no error on the unused-function and unused-but-set- > variable. > > > > # > > > > - MSFT:*_*_X64_CC_FLAGS =3D /wd4204 /wd4244 /wd4090 /wd4334 > > > > /DHAVE_CONFIG_H=3D1 /U_WIN32 /UWIN64 /U_MSC_VER > > > > - MSFT:*_*_IA32_CC_FLAGS =3D /wd4204 /wd4244 /wd4090 > > > /DHAVE_CONFIG_H=3D1 > > > > /U_WIN32 /UWIN64 /U_MSC_VER > > > > + MSFT:*_*_X64_CC_FLAGS =3D /wd4204 /wd4244 /wd4090 /wd4334 > > > /wd4706 > > > > + /DHAVE_CONFIG_H=3D1 /U_WIN32 /UWIN64 /U_MSC_VER > > > > + MSFT:*_*_IA32_CC_FLAGS =3D /wd4204 /wd4244 /wd4090 /wd4706 > > > > + /DHAVE_CONFIG_H=3D1 /U_WIN32 /UWIN64 /U_MSC_VER > > > > > > Urgh, please don't do this. > > > C4706 is what gives you a warning for accidentally assigning instead > > > of comparing. It's our last defence against the jeopardy-comparing > > > hordes that think > > > if (NULL =3D=3D Ptr) > > > is a sensible way of writing C. > > > > > > What is the actual problem being encountered? > > > > That is because we use the macro defined in open source header file, > > RedfishPkg/Library/JsonLib/jansson/src/jansson.h > > > > #define json_object_foreach(object, key, value) = \ > > for (key =3D json_object_iter_key(json_object_iter(object)); = \ > > key && (value =3D > json_object_iter_value(json_object_key_to_iter(key))); \ > > key =3D json_object_iter_key( = \ > > json_object_iter_next(object, > > json_object_key_to_iter(key)))) >=20 > Yay, "optimisation" by using preprocessor... >=20 > Apart from how this ought to be a helper function: > - No parentheses around parameters in macro. > - Setting "value" at each iteration through the loop condition. > - Slinging parentheses like it's a lisp convention. > - And it would be worse if they treated the parameters properly. >=20 > If we ignore the other issues, the below should be functionally equivalent > and build on VS without disabling the warning: >=20 > for (key =3D json_object_iter_key(json_object_iter(object)); = \ > key; = \ > key =3D json_object_iter_key( = \ > json_object_iter_next(object, json_object_key_to_iter(key)))) > { \ > value =3D json_object_iter_value(json_object_key_to_iter(key)); > \ > if (!value) = \ > break; = \ > } >=20 > Could you try to convince upstream to take the patch? Sure, I just sent an email to community, hope we can get the feedback soon. Leif, that may takes time to have this patch to be in upstream (if they agr= ee with it)... I have another PR which is not get merged yet. This will block our works on edk2, thus I would like to just add build opti= on to suppress this build error. The build option is only for JsonLib thoug= h. Do you agree with this? Thanks Abner >=20 > > > Beyond that, this will probably be an issue for all architectures, > > > so why add explicit (identical) workarounds for IA32/X64? > > > > I didn't catch this build error on GCC. You may know why? >=20 > Ugh. > This is because (for whatever reason), both clang and GCC suppress this > warning if you add parentheses around the assignment. VS does not. >=20 > / > Leif