Clang build support Change-Id: Iff869df44a75facc0165b8e6a6788fc6f68f5628
diff --git a/src/third_party/starboard/rdk/shared/build/rdk_toolchain.gni b/src/third_party/starboard/rdk/shared/build/rdk_toolchain.gni index 8f60930..f533c5d 100644 --- a/src/third_party/starboard/rdk/shared/build/rdk_toolchain.gni +++ b/src/third_party/starboard/rdk/shared/build/rdk_toolchain.gni
@@ -58,7 +58,7 @@ if (defined(invoker.toolchain_args)) { forward_variables_from(invoker.toolchain_args, "*") } - is_clang = false +# is_clang = false } } }
diff --git a/src/third_party/starboard/rdk/shared/drm/drm_system_ocdm.cc b/src/third_party/starboard/rdk/shared/drm/drm_system_ocdm.cc index 9c8342b..b4f6758 100644 --- a/src/third_party/starboard/rdk/shared/drm/drm_system_ocdm.cc +++ b/src/third_party/starboard/rdk/shared/drm/drm_system_ocdm.cc
@@ -565,7 +565,7 @@ int key_size, const void* session_id, int session_id_size) { - std::string id = {static_cast<const char*>(session_id), session_id_size}; + std::string id = {static_cast<const char*>(session_id), static_cast<std::string::size_type>(session_id_size)}; SB_LOG(INFO) << "Update: " << id; auto* session = GetSessionById(id); if (session) @@ -573,7 +573,7 @@ } void DrmSystemOcdm::CloseSession(const void* session_id, int session_id_size) { - std::string id = {static_cast<const char*>(session_id), session_id_size}; + std::string id = {static_cast<const char*>(session_id), static_cast<std::string::size_type>(session_id_size)}; SB_LOG(INFO) << "Close: " << id; auto* session = GetSessionById(id); if (session) @@ -666,7 +666,7 @@ for (auto& key_with_status : session_key.second) { cached_ready_keys_.emplace(std::string{ reinterpret_cast<const char*>(key_with_status.key.identifier), - key_with_status.key.identifier_size}); + static_cast<std::string::size_type>(key_with_status.key.identifier_size)}); } } }
diff --git a/src/third_party/starboard/rdk/shared/platform_configuration/BUILD.gn b/src/third_party/starboard/rdk/shared/platform_configuration/BUILD.gn index 255fb30..db89e5e 100644 --- a/src/third_party/starboard/rdk/shared/platform_configuration/BUILD.gn +++ b/src/third_party/starboard/rdk/shared/platform_configuration/BUILD.gn
@@ -134,11 +134,21 @@ } config("no_pedantic_warnings") { - cflags_cc = [ - "-Wno-literal-suffix", - "-Wno-deprecated-copy", - "-Wno-invalid-offsetof", - "-Wno-ignored-qualifiers", - "-Wno-pessimizing-move", - ] + if (!is_clang) { + cflags_cc = [ + "-Wno-literal-suffix", + "-Wno-deprecated-copy", + "-Wno-invalid-offsetof", + "-Wno-ignored-qualifiers", + "-Wno-pessimizing-move", + ] + } else { + cflags = [ + # Do not warn for implicit type conversions that may change a value. + "-Wno-conversion", + "-Wno-deprecated-declarations", + "-Wno-inconsistent-missing-override", + "-Wno-unknown-warning-option", + ] + } }
diff --git a/src/third_party/starboard/rdk/shared/player/player_internal.cc b/src/third_party/starboard/rdk/shared/player/player_internal.cc index 5131e67..3fe2993 100644 --- a/src/third_party/starboard/rdk/shared/player/player_internal.cc +++ b/src/third_party/starboard/rdk/shared/player/player_internal.cc
@@ -860,7 +860,7 @@ gst_query_parse_position(query, 0, &position); } gst_query_unref(query); - GST_INFO("Position from %s : %"GST_TIME_FORMAT, GST_ELEMENT_NAME(el), GST_TIME_ARGS(position)); + GST_INFO("Position from %s : %" GST_TIME_FORMAT, GST_ELEMENT_NAME(el), GST_TIME_ARGS(position)); } return TRUE; };
diff --git a/src/third_party/starboard/rdk/shared/system/system_get_path.cc b/src/third_party/starboard/rdk/shared/system/system_get_path.cc index c907f04..be5b04a 100644 --- a/src/third_party/starboard/rdk/shared/system/system_get_path.cc +++ b/src/third_party/starboard/rdk/shared/system/system_get_path.cc
@@ -169,12 +169,12 @@ // Gets only the name portion of the current executable. bool GetExecutableName(char* out_path, int path_size) { - char path[kSbFileMaxPath] = {0}; - if (!GetExecutablePath(path, kSbFileMaxPath)) { + std::vector<char> path(kSbFileMaxPath, 0); + if (!GetExecutablePath(path.data(), kSbFileMaxPath)) { return false; } - const char* last_slash = strrchr(path, '/'); + const char* last_slash = strrchr(path.data(), '/'); if (starboard::strlcpy<char>(out_path, last_slash + 1, path_size) >= path_size) { return false; } @@ -189,12 +189,12 @@ return true; } - char binary_name[kSbFileMaxPath] = {0}; - if (!GetExecutableName(binary_name, kSbFileMaxPath)) { + std::vector<char> binary_name(kSbFileMaxPath, 0); + if (!GetExecutableName(binary_name.data(), kSbFileMaxPath)) { return false; } - int result = SbStringFormatF(out_path, path_size, "/tmp/%s-%d", binary_name, + int result = SbStringFormatF(out_path, path_size, "/tmp/%s-%d", binary_name.data(), static_cast<int>(getpid())); if (result < 0 || result >= path_size) { out_path[0] = '\0';