Skip to content

Commit

Permalink
cleanup: fix GCC warnings with Wall (GoogleCloudPlatform#395)
Browse files Browse the repository at this point in the history
I was too optimistic about the state of the code with GCC 13, while the
code is clean with Clang, there was a useful warning emitted by GCC 13,
and a number of useless warnings too.
  • Loading branch information
coryan committed Jul 10, 2023
1 parent 6fabe85 commit e79a212
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/site/http_content/http_content.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ std::string urldecode(std::string const& encoded) {
auto const* end = encoded.data() + i + 3;
auto r =
std::from_chars(encoded.data() + i + 1, end, value, kUrlEncodingBase);
if (r.ptr == end) {
if (r.ec == std::errc{} && r.ptr == end) {
result.push_back(value);
i += 2;
} else {
Expand Down
12 changes: 12 additions & 0 deletions google/cloud/functions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ if (BUILD_TESTING)
functions_framework_cpp_add_common_options(${target})
add_test(NAME ${target} COMMAND ${target})
endforeach ()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# GCC turns on -Wmaybe-unitialized with -Wall. This results in false
# positives in this test, but the warning was useful in other tests.
#
# https://godbolt.org/z/xhj57Y6qG shows an example of these false
# positives.
#
# It seems the GTEST_*() macros trigger a new version of:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635
target_compile_options(cloud_event_test
PRIVATE "-Wno-maybe-uninitialized")
endif ()

add_subdirectory(integration_tests)
endif ()
Expand Down

0 comments on commit e79a212

Please sign in to comment.