I am using -Werror
flag to treat all warnings as errors in my code. However, I would like compile warnings issued from code to still be treated as warnings. A GCC option for this is -Wno-error=cpp
which works correctly, however clang option is -Wno-error=#warnings
which I don't know how to pass to clang
from Android.mk
.
I've tried this:
ifeq "$(findstring clang,$(NDK_TOOLCHAIN_VERSION))" "clang"
LOCAL_CFLAGS += -Wno-error=#warnings
endif
and this (as suggested in this SO answer):
ifeq "$(findstring clang,$(NDK_TOOLCHAIN_VERSION))" "clang"
LOCAL_CFLAGS += -Wno-error=\#warnings
endif
However, both versions treat #
as beginning of comment and ndk-build
passes -Wno-error=
to compiler (i.e. everything after =
is ignored) - I inspected that with ndk-build -n
.
I even tried
ifeq "$(findstring clang,$(NDK_TOOLCHAIN_VERSION))" "clang"
LOCAL_CFLAGS += -Wno-error=\\#warnings
endif
which produces -Wno-error=\
compiler flag.
How to properly pass this compiler flag to clang from Android.mk
file?
I am using NDK r12b.
EDIT: I even tried this:
ifeq "$(findstring clang,$(NDK_TOOLCHAIN_VERSION))" "clang"
VAR=\#warnings
$(info VAR is '$(VAR)')
LOCAL_CFLAGS += -Wno-error=$(VAR)
endif
and ndk-build
first outputs message VAR is '#warnings'
yet compiler arguments contain -Wno-error=
. This is obviously an NDK issue.