From fcbc39ee072d5f387ac7de5bd49ba6192076629b Mon Sep 17 00:00:00 2001 From: Niranjan Yardi Date: Fri, 20 Sep 2024 18:08:20 -0700 Subject: [PATCH] Add nplb compiler check for all linux based platforms (#4102) b/356067446 --- starboard/nplb/BUILD.gn | 2 +- .../cpp_compiler_version_check.cc | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/starboard/nplb/BUILD.gn b/starboard/nplb/BUILD.gn index 68c21ad89b99..33997e67e144 100644 --- a/starboard/nplb/BUILD.gn +++ b/starboard/nplb/BUILD.gn @@ -303,7 +303,7 @@ target(gtest_target_type, "nplb") { "window_get_size_test.cc", ] - if (!is_android) { + if (is_linux) { # Android has a different clang version than linux. sources += [ "//starboard/nplb/compiler_compliance/cpp_compiler_version_check.cc" ] diff --git a/starboard/nplb/compiler_compliance/cpp_compiler_version_check.cc b/starboard/nplb/compiler_compliance/cpp_compiler_version_check.cc index 51ea6b039579..17e713d35885 100644 --- a/starboard/nplb/compiler_compliance/cpp_compiler_version_check.cc +++ b/starboard/nplb/compiler_compliance/cpp_compiler_version_check.cc @@ -14,15 +14,18 @@ #include +#define COBALT_CLANG_ERROR_MSG "We compile above Starboard targets like Cobalt, Nplb with " \ + "clang17 or higher. If you are building with a non-Cobalt " \ + "provided toolchain you may run into this error. To fix this error" \ + "build libnplb using the Evergreen toolchain : " \ + "cobalt.dev/development/setup-raspi" + #ifdef __clang__ // Check Clang major version required for building Nplb tests. // Clang major version can be deduced from "clang_revision" in // starboard/build/config/clang.gni -static_assert( - __clang_major__ >= 17, - "We compile above Starboard targets like Cobalt, Nplb with " - "clang17 or higher. If you are building with a non-Cobalt " - "provided toolchain you may run into this error. To fix this error" - "build libnplb using the Evergreen toolchain : " - "cobalt.dev/development/setup-raspi"); +static_assert(__clang_major__ >= 17, COBALT_CLANG_ERROR_MSG); +#else +static_assert(false, COBALT_CLANG_ERROR_MSG); #endif // __clang__ +#undef COBALT_CLANG_ERROR_MSG