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.web12.2152.1613618838636100378 for ; Wed, 17 Feb 2021 19:27:18 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=Z1O85Se0; spf=pass (domain: hpe.com, ip: 148.163.143.35, mailfrom: prvs=06830be148=abner.chang@hpe.com) Received: from pps.filterd (m0134423.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 11I3DQVJ029186; Thu, 18 Feb 2021 03:27:18 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=T9oZFto3caHGKI8Dt77kd46FqUGh6VXbwVxSd4VQ1Xw=; b=Z1O85Se0J4fSsm1lquV1Ou5JNILNuC+W3ho+xADhgDCscB3IzyqJ9Lgd8YlSCsWpdk0a El3MZ7UDUaYYBFzU6amIvDdCuGpevS1bQQh7b+bwhm1U1/OTfLccVXhVNOCwqwb/124Z roVBuwmf6WnV1tB0ZO9ABuhmUhuOBXSH0xo9ovsjlCQ8Cjun8YPSuEr2NTYmqMkCKlJW Go0MlPmUp/RSPbA+g3JsV9jGVe/OUOLnjMZwLPZld3BtUczuGmpzqp2MtMLXv0NFjwHX xSz9ydPLcyKwpjRfXbD9Hf4pJYbm2Z+89U4g69Otlt+Xd/DcKiLrBUSspv9SHMGdazKG PA== Received: from g9t5009.houston.hpe.com (g9t5009.houston.hpe.com [15.241.48.73]) by mx0b-002e3701.pphosted.com with ESMTP id 36sfsqg64p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Feb 2021 03:27:17 +0000 Received: from G1W8107.americas.hpqcorp.net (g1w8107.austin.hp.com [16.193.72.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g9t5009.houston.hpe.com (Postfix) with ESMTPS id 33D4351; Thu, 18 Feb 2021 03:27:17 +0000 (UTC) Received: from G9W8456.americas.hpqcorp.net (2002:10d8:a15f::10d8:a15f) by G1W8107.americas.hpqcorp.net (2002:10c1:483b::10c1:483b) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 18 Feb 2021 03:27:17 +0000 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (15.241.52.10) by G9W8456.americas.hpqcorp.net (16.216.161.95) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Thu, 18 Feb 2021 03:27:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YPsezXC2FSCaWyEFzinPE1reV6kytFynNj+tk1pwiA8t906kpdmrafWmH2n/fLnaZFPmZcMsBCtgkMrynlUAdNRHidWuBuFxZiW1lW4HnMLIqtvSVpZxRjOemrycbi7WYSzTRaYLlwhQ7CoecMvPd54xgNueOMl4+TjKbUFdiIn+z+XZ9n3xMmmPoL2CSd+7jARt0j8UVXDa8qrl/zGB35B/aXng5qyVjMHzMgmL65IjnmzTzCuo63EyjQNtkCbFF2ud3bpjAGOtW9RpL4c36Dd3HQjMeNCc+Q1ENJ2ksRlUXPwy8H9awlemELBzmmadxT/pwS1orwkvxFw5QWaIFQ== 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=T9oZFto3caHGKI8Dt77kd46FqUGh6VXbwVxSd4VQ1Xw=; b=ChAgLtoqaLXWoVF2M7T1JHInotPHnYMSsjqYIkLiGtMwxKqsdkjhQw17NcIHHOz3PktyZlguZLnNjOcSmreoYdXgSWmDo++S9yQSzlipDA+JVvvLNAHoZkHiOY8hIcq+dVYO1deLb/BXq9eZ8HR85mX7N/xq379NYsOhJb5cJjhHuVHF3fIkgK6YihgNe40ZSgxscN2fBjbre/TWfYKrOvN6uyau09aKYGHsvzvZbzQrc8StU1obn/b13BCg6ZLBnfnrbJu4ZBfcwU6tJfQS0zsQxwQ6cpsDYWUrCl6xxEj3Yrr2og55E3kCRsstAcALnQxUXU3eyaL/otAaLGqRkg== 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 CS1PR8401MB0949.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:750f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Thu, 18 Feb 2021 03:27:15 +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.3846.042; Thu, 18 Feb 2021 03:27:15 +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: AQHW89a6vRrWezpPEU2lmA06POIB8Ko8a3xQgAB7CgCAADR64IAA9yxAgB9R+fA= Date: Thu, 18 Feb 2021 03:27:15 +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: [16.242.247.131] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 147763e0-0e9b-4428-dd3a-08d8d3bd1692 x-ms-traffictypediagnostic: CS1PR8401MB0949: 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: VLFEZdNfg8X3yc/igCXn+WcXt+xarfZhfSUWsA8lGqtApPMTe/GGFa8CXRSDSuymavd4LNJ1eB3t1gmQi7Ii/HOSb+KbECObKYQ7t7XUXIcalO4TOiGPl9qvL1G42Lfe7/HrXF4eSsaYHZ3dLaF9Gn36wxjAfZXHEqJFL7AK8eVHXt3JsNFDpon1X+xdYYZ4FOyerHIAkbZuT0lgP1GE4bow3+0MWbE1ExpTsH0dhebkIbd4X4fmr1mW5psWohDHmpvz5TLlsctWTrJz0bLr79uH8MaLis46/YVpmZf6gyEnZkHeBY2XaJ2k0KKhUKfrAtK97kBwE6cF/qhja1Nk0GcfUedFK6VXmP4pp4CFQnn8DwPSvwp15mKqEQq0OqrqCKqwlZ0oKYXjmcmIiwi9nzbEhZbF/9KBWuiyKAhAZD133acFaHlMMIaONg16XnmYUH4YhC295+olxET1hAAvRpzQCPlgwoeWVAhE69NMy9Bk0pEAun09JYoWj4DrsSSGpl5l7mUspaQvKoEtDuDWXw== 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:(136003)(366004)(396003)(376002)(346002)(39860400002)(66946007)(64756008)(186003)(66446008)(66476007)(9686003)(76116006)(2906002)(316002)(6916009)(52536014)(7696005)(53546011)(26005)(33656002)(86362001)(478600001)(4326008)(8936002)(71200400001)(6506007)(54906003)(66556008)(8676002)(55016002)(5660300002)(83380400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?dY5XB/OXgedYnpjb++HdSEDhHX80PblkJomP1OkAUQVh8Usyi+PDB9Tapa7A?= =?us-ascii?Q?gORNzWTNgAQM+vAdzb56inRmWIr9imCcPRs2kh7FHa9dcTvsvN6+26J9d0Iu?= =?us-ascii?Q?Tu//Br2TxKURa6IgLgl/tYk/GfigjcCWqi/dX9TNFXg2959uuLAf2F9WVwiz?= =?us-ascii?Q?0XWrlnpDBVD93/YvRFmaxOnhXbcV2n+Ci97w5mue0cJ13yujTjLp8jdGl/bq?= =?us-ascii?Q?1svVXR56vZZc3NDvkW5M82iz9ltI8ZgsNXf5UFNo3Sq3oZu1dbntD8dj6HDZ?= =?us-ascii?Q?kwwz6T3QT87IKkjDK6J6iUkEu9mGFTe92RNvEn1lL9jm4hMySQer9hF1OwZi?= =?us-ascii?Q?sJsKwIv0LV6xpuy6Phpi54l+XRrfRqPLIZxU/DBBfFJ0Hdh3FnvpYmgZgEGW?= =?us-ascii?Q?1sMlZsHgZZ8/W/LaDGLea6Ub0jguIzwjYKFzxQpK2BEWvSCts/Lu2lGYruTM?= =?us-ascii?Q?YDAbftlVain77L4+2cCAXBh1uRJBqJQ/4Wkjr9EnPxzGp1pGydGXN+SRgOXj?= =?us-ascii?Q?SmGbzt+bNI9K2K7XsRWuYwwnstqw8g5UTrSOYvphtQ3e32eH19ofQJW3aHEg?= =?us-ascii?Q?C3uGbhGRl6i1I4T+AUCZn0iM/m1z8e/4cTqRlESlMr2w6ICO48tQ6brJsNoL?= =?us-ascii?Q?EKOjCQv1JTXWJ0A4+0e4gKqWvYNNjR0+bzkaVM0ZVljBqzNWttueBBzAQy5B?= =?us-ascii?Q?vuIIrAkxsyDjkz+tWX3BA2mgpjpCy+MPDC1iVje7fV8xvwoQxPv9pkYSLLU0?= =?us-ascii?Q?MnvW5DBi+mp2jTj878ooosmZHM7l6MobYvulSDGEGdQnbr7lzqZY9zDUKxQw?= =?us-ascii?Q?H2+WlnlsfcWBhTQjUB1+oy1riar/FBoF2G6THSbWDYaMQIVMCQXKXq65GDxL?= =?us-ascii?Q?WGOz7Uufie5xrw85VZ74VlIacF4O3J2NabkhmJmhn2UPklc4FuFvNX00zp2C?= =?us-ascii?Q?KtQ7BL6XBlZgPcI9DU6FiH3dINTXNfzT0qdZnXG0PUr0KzYkE0cpOv5Ut+w4?= =?us-ascii?Q?jsXGGBgUQz/nfF/rXEQiRGYf2PWS1BRV1ERkyGfgDSPaPPKgWuZjcAHzhwif?= =?us-ascii?Q?8gunYSWX8/+Dsd5QEAYmMGQQFEfbK/EieFamfdCmzqOJfjdRRwTH0bgaFFvd?= =?us-ascii?Q?qfdRZv/JADDdtx/z7rdcsp7cIrIxgagISpaaqvGrUIVsEKdcn7cGv2oktUQu?= =?us-ascii?Q?jr0YiuEP2m0ch/jJOpDT9CjrE7K8y2rzd8Qt+kvyPj79wCSKqBCNXdXnH8/J?= =?us-ascii?Q?QBQ229DU/UMRhfj88/esFIzcfGMwvyRsRAsLHSTefoDsIdSdXL4FW3wKIzdt?= =?us-ascii?Q?IM9D/Y8GzKOSpOhJzYyuxtTM?= X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 147763e0-0e9b-4428-dd3a-08d8d3bd1692 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Feb 2021 03:27:15.2479 (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: neFQleiOU/44HeG/3w+7Ey/km1HWqAp9pVqx5VH6pQWJ3CK6/2NlJfTFjdzWUg5UOU6g6jAF+VcF+RhhwX2AQQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR8401MB0949 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.369,18.0.761 definitions=2021-02-18_01:2021-02-16,2021-02-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 impostorscore=0 mlxscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180026 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Leif, Would you like to recheck the new patches I sent? Thanks Abner > -----Original Message----- > From: Chang, Abner (HPS SW/FW Technologist) > Sent: Friday, January 29, 2021 1:11 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 > Hi Leif, > I split this patch into 3 separate patches. Please ignore the old one. >=20 > Thank > Abner >=20 > > -----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 > > > > > > > > > -----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 > soon. > > > > Leif, that may takes time to have this patch to be in upstream (if > > they agree 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 > > option to suppress this build error. The build option is only for > > JsonLib though. Do you agree with this? > > > > Thanks > > Abner > > > > > > > > > > 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 no= t. > > > > > > / > > > Leif