Disable/avoid some warnings.

Implement DAWN_DECLARE_UNUSED macro to avoid -Wunneeded-internal-declaration
warning.

Change-Id: I4d087d2b09b74e35ba7ea69533df2c5adef4ef82
Reviewed-on: https://dawn-review.googlesource.com/c/2943
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Stephen White 2018-12-06 19:01:22 +00:00 committed by Commit Bot service account
parent 5aacd29d5e
commit 0f50114b3c
3 changed files with 15 additions and 2 deletions

View File

@ -110,7 +110,7 @@
};
//* Returns the required transfer size for `record` in addition to the transfer structure.
size_t {{name}}GetExtraRequiredSize(const {{name}}& record) {
DAWN_DECLARE_UNUSED size_t {{name}}GetExtraRequiredSize(const {{name}}& record) {
DAWN_UNUSED(record);
size_t result = 0;

View File

@ -24,6 +24,9 @@
// (resp. false) to help it generate code that leads to better branch prediction.
// - DAWN_UNUSED(EXPR): Prevents unused variable/expression warnings on EXPR.
// - DAWN_UNUSED_FUNC(FUNC): Prevents unused function warnings on FUNC.
// - DAWN_DECLARE_UNUSED: Prevents unused function warnings a subsequent declaration.
// Both DAWN_UNUSED_FUNC and DAWN_DECLARE_UNUSED may be necessary, e.g. to suppress clang's
// unneeded-internal-declaration warning.
// Clang and GCC, check for __clang__ too to catch clang-cl masquarading as MSVC
#if defined(__GNUC__) || defined(__clang__)
@ -57,6 +60,8 @@
# define DAWN_NO_DISCARD [[nodiscard]]
# endif
# define DAWN_DECLARE_UNUSED __attribute__((unused))
// MSVC
#elif defined(_MSC_VER)
# define DAWN_COMPILER_MSVC
@ -71,6 +76,8 @@ extern void __cdecl __debugbreak(void);
# define DAWN_NO_DISCARD [[nodiscard]]
# endif
# define DAWN_DECLARE_UNUSED
#else
# error "Unsupported compiler"
#endif

View File

@ -58,6 +58,9 @@ static_library("spirv_cross") {
"-Wno-return-type",
"-Wno-sign-compare",
]
} else {
# Disable "not all control paths return a value" warning.
cflags_cc = [ "/wd4715" ]
}
sources = [
@ -211,7 +214,10 @@ static_library("glfw") {
# nonstandard extension, function/data pointer conversion in expression
cflags_c = [ "/wd4152" ]
} else {
cflags_c = [ "-Wno-sign-compare" ]
cflags_c = [
"-Wno-sign-compare",
"-Wno-missing-field-initializers",
]
}
sources = [