]> git.proxmox.com Git - mirror_edk2.git/commitdiff
RedfishPkg/JsonLib: Ignore the build error of conditional expression.
authorAbner Chang <abner.chang@hpe.com>
Fri, 29 Jan 2021 04:11:59 +0000 (12:11 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 24 Feb 2021 09:54:14 +0000 (09:54 +0000)
Ignore the build error of assignment within conditional expression.
Add build option to ignore the build error of "assignment within
conditional expression".
This build error is caused by the macros defined in open source
project jansson header file jansson.h.

- json_object_foreach
- json_object_foreach_safe
- json_array_foreach

We use build option to avoid the build errors on Visual Studio
(GCC doesn't havvve this problem) for now. Already sent an email
to jansson open source community to revise these macro as Leif's
suggestion as below,

for (key = json_object_iter_key(json_object_iter(object));    \
       key;                                                   \
       key = json_object_iter_key(                            \
            json_object_iter_next(object,
json_object_key_to_iter(key)))) { \
       value =
json_object_iter_value(json_object_key_to_iter(key));         \
      if (!value) \
        break; \
  } \

We will remove this build option once the patch is accepted and
upstreamed.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Nickle Wang <nickle.wang@hpe.com>
RedfishPkg/Library/JsonLib/JsonLib.inf

index 48b094a78af88aab06f8ae26fee18c033f5579e5..9d52a622e13afcdf8e4a906c9d2f7d534c418018 100644 (file)
   #   C4244: conversion from type1 to type2, possible loss of data\r
   #   C4334: 32-bit shift implicitly converted to 64-bit\r
   #   C4204: nonstandard extension used: non-constant aggregate initializer\r
+  #   C4706: assignment within conditional expression\r
   #\r
   # Define macro HAVE_CONFIG_H to include jansson_private_config.h to build.\r
   # Undefined _WIN32, WIN64, _MSC_VER macros\r
   # On GCC, no error on the unused-function and unused-but-set-variable.\r
   #\r
-  MSFT:*_*_X64_CC_FLAGS = /wd4204 /wd4244 /wd4090 /wd4334 /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER\r
-  MSFT:*_*_IA32_CC_FLAGS = /wd4204 /wd4244 /wd4090 /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER\r
+  MSFT:*_*_X64_CC_FLAGS = /wd4204 /wd4244 /wd4090 /wd4334 /wd4706 /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER\r
+  MSFT:*_*_IA32_CC_FLAGS = /wd4204 /wd4244 /wd4090 /wd4706 /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER\r
   GCC:*_*_*_CC_FLAGS = -Wno-unused-function -Wno-unused-but-set-variable\r
 \r