From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web10.5729.1611897068907315328 for ; Thu, 28 Jan 2021 21:11:08 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=KPgE0Rqt; spf=pass (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=06631716d4=abner.chang@hpe.com) Received: from pps.filterd (m0150242.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 10T54gJN013390; Fri, 29 Jan 2021 05:11:08 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=IfkpX6qmf2uco4dei0KrCci6McBZQOubHJELlO3tTwg=; b=KPgE0RqtGkXsduFWqZjK84v2geLi3bgIE8ikCDPY88LljE2l+Qi/5Evi54WPljLLdYnn 5/Gw3QOk088aO6yTvfOtwsgR6cH8YzIbtTP1H0X/ZibKIE26mqBLnjH6zqhCIYeP9yPX NKO8N3wY6NKzA5qDhqIYKJNKnSzZ9bJ1qA/3CR4WWOqFsRkSYSg+zvpMLpz6ud/tvOZT BQlchaV6+FqMpVQdKl6Zc3uM6xzFXlW97cxDsFsqFOseiinn4+b5C/V2u78QG1vlCTwe i9jluvQErme/1/64wKExNzY18EidMo/IsRzZPh6eiH8gGrsXcS0m9KI8J4bncPc/HZjv eQ== Received: from g2t2353.austin.hpe.com (g2t2353.austin.hpe.com [15.233.44.26]) by mx0a-002e3701.pphosted.com with ESMTP id 36b5wnrcde-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Jan 2021 05:11:08 +0000 Received: from G2W6311.americas.hpqcorp.net (g2w6311.austin.hp.com [16.197.64.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g2t2353.austin.hpe.com (Postfix) with ESMTPS id ACE2A90; Fri, 29 Jan 2021 05:11:07 +0000 (UTC) Received: from G9W8676.americas.hpqcorp.net (16.220.49.23) by G2W6311.americas.hpqcorp.net (16.197.64.53) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 29 Jan 2021 05:11:07 +0000 Received: from G9W9209.americas.hpqcorp.net (2002:10dc:429c::10dc:429c) by G9W8676.americas.hpqcorp.net (2002:10dc:3117::10dc:3117) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 29 Jan 2021 05:11:07 +0000 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (15.241.52.10) by G9W9209.americas.hpqcorp.net (16.220.66.156) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Fri, 29 Jan 2021 05:11:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e1zqlT7bnNGGChsbWmp7Zzzp+6iZn6BIvj2qqGy3uOt07rwubYNpvFkihqkg76tILJufy5Dk5ved0UU2Rk/9zm0w4BQDQI2V744czZhW80/pk00CNpdfVx7zO88d8qOyxybNfmdjCZDnJHJhkL7vswOvYdfJUR7DJo+Q7h2XJQW1aik8kfM/3pU/bRTcN6yuQBtlO+x95SPP3A/O42C5MHOoykZW8U/+lny3SfLRAylHq8v92XJ5Cx5W/5vRPaeXKfz4Dh1edkSjcSJd7QqKPxXpeCbW2s/1Brri7dN3BiCsU5BB3EyzvQC/eZQzwKafXgHsGsdsU1+/krctYP+7Nw== 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=IfkpX6qmf2uco4dei0KrCci6McBZQOubHJELlO3tTwg=; b=dUz58o2aarRzihiLOwXHR0byFM6ABjuX3F6x6cYgfqLSNkamNO9mEWE4XL0lhm+cJKhMRPjY0o/AdEPuqfClEx7hMDSBqRk44N6bqWpfcwugNFuzl/vxf6slCPnbGDDdMC5Xcpnwjqca8VHfk7mQHKia1HSZ43NfLHUY1thRlNuS24/VUndMePEOcaH+r2HVMMd+DDzpMRQXMOTRTB6/2AjAG8UumlAvZH9AdMXP/3S2KdRQUevUIQrrKqq/aIHfzRzvJh7ec1xmgzYncVf75gpR+egiG1xzCT3r2lIFrxIgtL+tIzhf72XaqfXS+GFw50S9+WV5VM63aAEaSwb0+g== 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 CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:7508::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.15; Fri, 29 Jan 2021 05:11:05 +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; Fri, 29 Jan 2021 05:11:05 +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: AQHW89a6vRrWezpPEU2lmA06POIB8Ko8a3xQgAB7CgCAADR64IAA9yxA Date: Fri, 29 Jan 2021 05:11:05 +0000 Message-ID: References: <20210125043154.20645-1-abner.chang@hpe.com> <20210126113034.GO1664@vanye> <20210128111702.GT1664@vanye> In-Reply-To: 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: b93c1e53-a31f-42e1-15f0-08d8c41447db x-ms-traffictypediagnostic: CS1PR8401MB1144: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2958; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: cmUYEXvUYCSHBa6iW5XXbuYY0pfG7Js/o3OzpGg37m/xA+PCohJfWDd8VLxqRZUXw0VQinbuX/fY/jqBdGvPu3buHesTYDA8X4CqV3ggG1W8lYlDRwd/LoekM3vJ+yUGY2mkmrKR8sbl0IAOaQpF7ae8BA6RIB/WF7MbNYFB5FQTg/gPnF2gzla4MGBLbJdkuCqdxQLLVg2sruazmD/ZmFEkx+UZxS4aBa/LHYKIotn4WMXoYLQUd2N8/5co2X6jy7D/xpifkIGK5I1aD4IxlWEOfO3tn7NkzKidqKB5I2BACvA9VkXD9k1xWNu/UR0AMiElhIAt6X1nFTVebGscQjPZwTer7h0yhpIBXHmOaj0NeN9z04xC9Tn1IFgQFIAThnH82dQNNAX0ducJL8Kj5g8ts+qoJ7UaP74Nevftz17L5tHYr5l20LGZIUomMTcyoWnCz/vWToEuigjF3eYdiBE1fpIfSY91BNUXEnHwJDavw7pv3MKjuDxZIxT2EbxUaTf/W39JOSzCzieaZWo7Og== 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:(39860400002)(346002)(376002)(396003)(366004)(136003)(55236004)(2906002)(9686003)(33656002)(8936002)(86362001)(8676002)(66556008)(66476007)(53546011)(5660300002)(64756008)(66946007)(66446008)(6506007)(54906003)(83380400001)(7696005)(76116006)(55016002)(478600001)(316002)(71200400001)(186003)(26005)(6916009)(4326008)(52536014);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?F0VyoC/oVenTYhoBwxyVkrHkwXiQYKEvPExLXH05Cwv4KBBieVeQVw8Ilr0R?= =?us-ascii?Q?P5P/cDCKvoVIYzYqYJBEH1s+jX6udSmpkF/ahHk76F3re/o/4cRPPkOFWtEZ?= =?us-ascii?Q?kXeCiY4KtdHjecKyZIPiUM3KdgAW19noZLE2SbcufqbDcAikDiDlPlzNyA7V?= =?us-ascii?Q?MDk2WZ9My15wJlaw5lSwdxUtA22moWVxWkD9QFkHOEAPn8n0IvFfurcXWF6y?= =?us-ascii?Q?0CFevgENzfHiY8aXDiMECadN5AzpGbsVOAuyfFTJ2HrsDpHioDv7VmgQc4S5?= =?us-ascii?Q?kYtV/N47878fswMckmREkmKOTXVAa9qUhlpvdhbkiigG6/fGkNU02GtNQME3?= =?us-ascii?Q?UE8NHhpIdItsdT5+xYSXA5PcrlEjUDc89pdAC8NLRYOMhpYzjdMkpmswDfAo?= =?us-ascii?Q?dBnk1NbwshRJUDoaZJkkhFTWoFoBjgtFpVdV553QPShQsFdmeQcRRG8ADKMV?= =?us-ascii?Q?b2OHoP6xeWy8QapSXou142XMJavKxZWmv3KpTE7zgoVRqsSJl7d6he/zGa7P?= =?us-ascii?Q?MX9BowKKHrRIK8ZLst8652XyIIby5FXBAc3cyKPOZHZOYXhPRo4X+jkLFS0e?= =?us-ascii?Q?Hn/dx0WpVf4iKYvgNYQHFBu+2UXIwjfHCrA+kHSKQmvmu2zZlstOPGrsJ4c5?= =?us-ascii?Q?ufgYJU91ddxIlWe63IXcychcVAEpaK/DproZ0gyHbVLGgEC9ATmyLq2EMmEX?= =?us-ascii?Q?JaVwAKqrdmaZq7y7dtRDlaEbj/Q4ETv1VDhxY7zbyvrhVT/U/Zz88g+D8I5Z?= =?us-ascii?Q?Wwe/7C6rdCwVLXS/Dd5lPmCauSMjP/LypjkSI4ISJGKw7zZ4KfnkXma7QnGk?= =?us-ascii?Q?lElRVlhjFTKf94INE8+Lvbc7hnm7E2zuqi3kL8jz28hhSMa3Y0yLSeOMMUeL?= =?us-ascii?Q?V5YotOLAHbmtV0JWNDWHPRxVmwnFhGX2uG8yGv7M8WV+s4l22kVX4nrAxZlk?= =?us-ascii?Q?nASxlMAjCI4EFy7uWiLs5aBKTRfcacbfmqRQ+lq7Bo86vQPLnLXlmwW31fUV?= =?us-ascii?Q?oCTDCMXPg74+xXqFZ2Jf0yrgVmwuSczUuIBUj5OJHTcNgXPYg7ce0Ntm8t57?= =?us-ascii?Q?D9nBkqRW?= X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: b93c1e53-a31f-42e1-15f0-08d8c41447db X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jan 2021 05:11:05.5636 (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: C7E327S6Dt1WNW0A49ocfRXLmTp/SW3H5egDAk7S/YWbWdgK/CP/dJwNlMcWKkK04mEjCT2t7zm1Tw84KqvH2A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR8401MB1144 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-29_02:2021-01-28,2021-01-29 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 impostorscore=0 mlxscore=0 adultscore=0 priorityscore=1501 malwarescore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101290026 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Leif, I split this patch into 3 separate patches. Please ignore the old one. Thank Abner > -----Original Message----- > From: Chang, Abner (HPS SW/FW Technologist) > Sent: Thursday, January 28, 2021 10:31 PM > 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 >=20 >=20 >=20 > > -----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 > > > > 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)))) > > > > Yay, "optimisation" by using preprocessor... > > > > 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. > > > > If we ignore the other issues, the below should be functionally > > equivalent and build on VS without disabling the warning: > > > > 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; = \ > > } > > > > Could you try to convince upstream to take the patch? > Sure, I just sent an email to community, hope we can get the feedback soo= n. >=20 > Leif, that may takes time to have this patch to be in upstream (if they a= gree > 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 op= tion to > suppress this build error. The build option is only for JsonLib though. D= o you > agree with this? >=20 > 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? > > > > Ugh. > > This is because (for whatever reason), both clang and GCC suppress > > this warning if you add parentheses around the assignment. VS does not. > > > > / > > Leif