Files
system76-edk2/RedfishPkg/Library/JsonLib/JsonLib.inf
Abner Chang 0cf260fabc RedfishPkg/JsonLib: Ignore the build error of conditional expression.
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>
2021-02-24 09:54:14 +00:00

88 lines
2.6 KiB
INI

## @file
# Thirty party Jansson library for JSON operations.
#
# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
[Defines]
INF_VERSION = 0x0001001b
BASE_NAME = JsonLib
FILE_GUID = F5E36815-305A-4C5A-9D75-4F2149E45255
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = JsonLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER
#
# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64
#
[Sources]
#
# Below are the source code of third
# party jansson library.
#
jansson/src/dump.c
jansson/src/error.c
jansson/src/hashtable.c
jansson/src/hashtable_seed.c
jansson/src/memory.c
jansson/src/pack_unpack.c
jansson/src/strbuffer.c
jansson/src/strconv.c
jansson/src/utf.c
jansson/src/value.c
jansson/src/version.c
#
# Below are the source of edk2 JsonLib.
#
JsonLib.c
jansson_config.h
jansson_private_config.h
#
# Below is the source code override to fix the build issue.
# Add code in load.c to conditionally use stdin according
# to HAVE_UNISTD_H macro. The PR is submitted to jansson
# open source community.
# https://github.com/akheron/jansson/pull/558
#
load.c
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
RedfishPkg/RedfishPkg.dec
[LibraryClasses]
BaseLib
BaseMemoryLib
Ucs2Utf8Lib
RedfishCrtLib
DebugLib
MemoryAllocationLib
PrintLib
UefiRuntimeServicesTableLib
UefiLib
[BuildOptions]
#
# Disables the following Visual Studio compiler warnings
# so we do not break the build with /WX option:
# C4090: 'function' : different 'const' qualifiers
# 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 /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