public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] RedfishPkg/JsonLib: Ignore the build error of assignment within conditional expression
@ 2021-01-29  4:19 Abner Chang
  2021-02-01  1:55 ` 回复: [edk2-devel] " gaoliming
  2021-02-18  3:34 ` Nickle Wang
  0 siblings, 2 replies; 3+ messages in thread
From: Abner Chang @ 2021-01-29  4:19 UTC (permalink / raw)
  To: devel; +Cc: Leif Lindholm, Nickle Wang, Michael D Kinney

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>
---
 RedfishPkg/Library/JsonLib/JsonLib.inf | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/RedfishPkg/Library/JsonLib/JsonLib.inf b/RedfishPkg/Library/JsonLib/JsonLib.inf
index 48b094a78a..9d52a622e1 100644
--- a/RedfishPkg/Library/JsonLib/JsonLib.inf
+++ b/RedfishPkg/Library/JsonLib/JsonLib.inf
@@ -75,12 +75,13 @@
   #   C4244: conversion from type1 to type2, possible loss of data
   #   C4334: 32-bit shift implicitly converted to 64-bit
   #   C4204: nonstandard extension used: non-constant aggregate initializer
+  #   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 = /wd4204 /wd4244 /wd4090 /wd4334 /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER
-  MSFT:*_*_IA32_CC_FLAGS = /wd4204 /wd4244 /wd4090 /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER
+  MSFT:*_*_X64_CC_FLAGS = /wd4204 /wd4244 /wd4090 /wd4334 /wd4706 /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER
+  MSFT:*_*_IA32_CC_FLAGS = /wd4204 /wd4244 /wd4090 /wd4706 /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER
   GCC:*_*_*_CC_FLAGS = -Wno-unused-function -Wno-unused-but-set-variable
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* 回复: [edk2-devel] [PATCH] RedfishPkg/JsonLib: Ignore the build error of assignment within conditional expression
  2021-01-29  4:19 [PATCH] RedfishPkg/JsonLib: Ignore the build error of assignment within conditional expression Abner Chang
@ 2021-02-01  1:55 ` gaoliming
  2021-02-18  3:34 ` Nickle Wang
  1 sibling, 0 replies; 3+ messages in thread
From: gaoliming @ 2021-02-01  1:55 UTC (permalink / raw)
  To: devel, abner.chang
  Cc: 'Leif Lindholm', 'Nickle Wang',
	'Michael D Kinney'

Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: bounce+27952+70884+4905953+8761045@groups.io
> <bounce+27952+70884+4905953+8761045@groups.io> 代表 Abner Chang
> 发送时间: 2021年1月29日 12:20
> 收件人: devel@edk2.groups.io
> 抄送: Leif Lindholm <leif@nuviainc.com>; Nickle Wang
> <nickle.wang@hpe.com>; Michael D Kinney <michael.d.kinney@intel.com>
> 主题: [edk2-devel] [PATCH] RedfishPkg/JsonLib: 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>
> ---
>  RedfishPkg/Library/JsonLib/JsonLib.inf | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/RedfishPkg/Library/JsonLib/JsonLib.inf
> b/RedfishPkg/Library/JsonLib/JsonLib.inf
> index 48b094a78a..9d52a622e1 100644
> --- a/RedfishPkg/Library/JsonLib/JsonLib.inf
> +++ b/RedfishPkg/Library/JsonLib/JsonLib.inf
> @@ -75,12 +75,13 @@
>    #   C4244: conversion from type1 to type2, possible loss of data
>    #   C4334: 32-bit shift implicitly converted to 64-bit
>    #   C4204: nonstandard extension used: non-constant aggregate
> initializer
> +  #   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 = /wd4204 /wd4244 /wd4090 /wd4334
> /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER
> -  MSFT:*_*_IA32_CC_FLAGS = /wd4204 /wd4244 /wd4090
> /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER
> +  MSFT:*_*_X64_CC_FLAGS = /wd4204 /wd4244 /wd4090 /wd4334
> /wd4706 /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER
> +  MSFT:*_*_IA32_CC_FLAGS = /wd4204 /wd4244 /wd4090 /wd4706
> /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER
>    GCC:*_*_*_CC_FLAGS = -Wno-unused-function
> -Wno-unused-but-set-variable
> 
> --
> 2.17.1
> 
> 
> 
> 
> 




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RedfishPkg/JsonLib: Ignore the build error of assignment within conditional expression
  2021-01-29  4:19 [PATCH] RedfishPkg/JsonLib: Ignore the build error of assignment within conditional expression Abner Chang
  2021-02-01  1:55 ` 回复: [edk2-devel] " gaoliming
@ 2021-02-18  3:34 ` Nickle Wang
  1 sibling, 0 replies; 3+ messages in thread
From: Nickle Wang @ 2021-02-18  3:34 UTC (permalink / raw)
  To: Chang, Abner (HPS SW/FW Technologist), devel@edk2.groups.io
  Cc: Leif Lindholm, Michael D Kinney

Reviewed-by: Nickle Wang <nickle.wang@hpe.com>

Thanks,
Nickle

> -----Original Message-----
> From: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>
> Sent: Friday, January 29, 2021 12:20 PM
> To: devel@edk2.groups.io
> Cc: Leif Lindholm <leif@nuviainc.com>; Wang, Nickle (HPS SW)
> <nickle.wang@hpe.com>; Michael D Kinney <michael.d.kinney@intel.com>
> Subject: [PATCH] RedfishPkg/JsonLib: 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>
> ---
>  RedfishPkg/Library/JsonLib/JsonLib.inf | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/RedfishPkg/Library/JsonLib/JsonLib.inf
> b/RedfishPkg/Library/JsonLib/JsonLib.inf
> index 48b094a78a..9d52a622e1 100644
> --- a/RedfishPkg/Library/JsonLib/JsonLib.inf
> +++ b/RedfishPkg/Library/JsonLib/JsonLib.inf
> @@ -75,12 +75,13 @@
>    #   C4244: conversion from type1 to type2, possible loss of data
>    #   C4334: 32-bit shift implicitly converted to 64-bit
>    #   C4204: nonstandard extension used: non-constant aggregate initializer
> +  #   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 = /wd4204 /wd4244 /wd4090 /wd4334
> /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER
> -  MSFT:*_*_IA32_CC_FLAGS = /wd4204 /wd4244 /wd4090
> /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER
> +  MSFT:*_*_X64_CC_FLAGS = /wd4204 /wd4244 /wd4090 /wd4334 /wd4706
> + /DHAVE_CONFIG_H=1 /U_WIN32 /UWIN64 /U_MSC_VER
> MSFT:*_*_IA32_CC_FLAGS
> + = /wd4204 /wd4244 /wd4090 /wd4706 /DHAVE_CONFIG_H=1 /U_WIN32
> /UWIN64
> + /U_MSC_VER
>    GCC:*_*_*_CC_FLAGS = -Wno-unused-function -Wno-unused-but-set-
> variable
> 
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-18  3:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-29  4:19 [PATCH] RedfishPkg/JsonLib: Ignore the build error of assignment within conditional expression Abner Chang
2021-02-01  1:55 ` 回复: [edk2-devel] " gaoliming
2021-02-18  3:34 ` Nickle Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox