Use #ifdef for IMAGE_BL* instead of #if
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Sun, 25 Dec 2016 14:36:24 +0000 (23:36 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 23 Jan 2017 16:01:21 +0000 (01:01 +0900)
commit3d8256b2a1ef1195aed86bef7378e83d0a61a91b
tree1c61d30c342b22f409e5e0d8700448ec39054e52
parentf38d93fdbf82ebec321c70f7bc15fe12b7d57275
Use #ifdef for IMAGE_BL* instead of #if

One nasty part of ATF is some of boolean macros are always defined
as 1 or 0, and the rest of them are only defined under certain
conditions.

For the former group, "#if FOO" or "#if !FOO" must be used because
"#ifdef FOO" is always true.  (Options passed by $(call add_define,)
are the cases.)

For the latter, "#ifdef FOO" or "#ifndef FOO" should be used because
checking the value of an undefined macro is strange.

Here, IMAGE_BL* is handled by make_helpers/build_macro.mk like
follows:

  $(eval IMAGE := IMAGE_BL$(call uppercase,$(3)))

  $(OBJ): $(2)
          @echo "  CC      $$<"
          $$(Q)$$(CC) $$(TF_CFLAGS) $$(CFLAGS) -D$(IMAGE) -c $$< -o $$@

This means, IMAGE_BL* is defined when building the corresponding
image, but *undefined* for the other images.

So, IMAGE_BL* belongs to the latter group where we should use #ifdef
or #ifndef.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
23 files changed:
drivers/arm/ccn/ccn.c
include/common/aarch32/el3_common_macros.S
include/common/aarch64/el3_common_macros.S
include/common/bl_common.h
include/lib/cpus/aarch32/cpu_macros.S
include/lib/cpus/aarch64/cpu_macros.S
include/plat/arm/board/common/board_arm_def.h
include/plat/arm/common/plat_arm.h
lib/cpus/aarch32/cpu_helpers.S
lib/cpus/aarch64/cpu_helpers.S
lib/el3_runtime/aarch64/context_mgmt.c
plat/arm/board/common/board_css_common.c
plat/arm/board/fvp/fvp_common.c
plat/arm/board/juno/include/platform_def.h
plat/arm/common/arm_gicv3.c
plat/common/plat_gicv3.c
plat/mediatek/mt6795/include/platform_def.h
plat/mediatek/mt8173/include/platform_def.h
plat/nvidia/tegra/include/platform_def.h
plat/qemu/qemu_common.c
plat/rockchip/common/rockchip_gicv3.c
plat/rockchip/rk3368/include/platform_def.h
plat/rockchip/rk3399/include/platform_def.h