path: root/drivers/
diff options
authorGavin Hu <>2018-06-30 01:27:37 +0800
committerThomas Monjalon <>2018-07-11 21:14:21 +0200
commitd292a42fc86b6b3ab69abb36f3112720cceb0b4b (patch)
tree9481b6772f02464148db81ef88d4e4c5d2afb8e8 /drivers/
parentc0d022070f7c7a77c1a47fee55f971b2afb763d4 (diff)
build: fix for host clang and cross gcc
The following error hits if host cc compiler is clang(default one in most linux distributions) and the cross compiler is gcc. The root cause is: the hybride compilers add the warning options to the meson project as project arguments, which apply for both host compiling and cross compiling. But some options such as '-Wno-format-truncation' are not supported nor recognized by clang, so they have to be removed from the project arguments for the host compiler to run smoothily and added back as cflags for the cross compiler to compile for cross source files. The fix is remove unrecognized warning options from the meson project arguments shared by gcc and clang, as add them specifically for gcc or clang as cflags. [265/893] Compiling C object 'buildtools/pmdinfogen/pmdinfogen@exe/pmdinfogen.c.o'. warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option] Fixes: a55277a788 ("devtools: add test script for meson builds") Cc: Signed-off-by: Gavin Hu <> Reviewed-by: Phil Yang <> Reviewed-by: Song Zhu <> Reviewed-by: Steve Capper <> Acked-by: Bruce Richardson <>
Diffstat (limited to 'drivers/')
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/ b/drivers/
index ac6c972..1737d86 100644
--- a/drivers/
+++ b/drivers/
@@ -32,6 +32,9 @@ foreach class:driver_classes
sources = []
objs = []
cflags = machine_args
+ if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+ endif
includes = [include_directories(drv_path)]
# set up internal deps. Drivers can append/override as necessary
deps = std_deps