diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95469979..a44ed622 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,6 @@ jobs: # Uses gcc 12.2.0, clang 15.0.7, cmake 3.24.2 image: "ubuntu:22.04" ubuntu: 22 - CXXFLAGS: -Wno-stringop-overread - name: Debian-10 # Uses gcc 8.3.0, clang 7.0.1, cmake 3.13.4 image: "debian:buster" @@ -65,15 +64,12 @@ jobs: - name: Debian-12 # Uses gcc 12.2.0, clang 15.0.6, cmake 3.25.1 image: "debian:bookworm" - CXXFLAGS: -Wno-stringop-overread - name: Debian-12 image: "debian:bookworm" cpp_version: c++17 - CXXFLAGS: -Wno-stringop-overread - name: Debian-12 image: "debian:bookworm" cpp_version: c++20 - CXXFLAGS: -Wno-stringop-overread - name: Debian-12 image: "debian:bookworm" c_compiler: clang @@ -91,7 +87,6 @@ jobs: - name: Debian-12 image: "debian:bookworm" build_type: RelWithDebInfo - CXXFLAGS: -Wno-stringop-overread - name: Debian-12 image: "debian:bookworm" c_compiler: clang @@ -100,14 +95,12 @@ jobs: LDFLAGS: -fsanitize=address,undefined - name: Debian-Testing image: "debian:testing" - CXXFLAGS: -Wno-stringop-overread -Wno-dangling-reference - name: Debian-Testing image: "debian:testing" c_compiler: clang cpp_compiler: clang++ - name: Debian-Experimental image: "debian:experimental" - CXXFLAGS: -Wno-stringop-overread -Wno-dangling-reference - name: Debian-Experimental image: "debian:experimental" c_compiler: clang @@ -115,19 +108,16 @@ jobs: - name: Fedora-35 # Uses gcc 11.2.1, clang 12.0.1, cmake 3.20.5 image: "fedora:35" - CXXFLAGS: -Wno-stringop-overread - name: Fedora-36 # Uses gcc 12.2.0, clang 14.0.5, cmake 3.24.2 image: "fedora:36" - CXXFLAGS: -Wno-stringop-overread - name: Fedora-37 # Uses gcc 12.3.1, clang 15.0.7, cmake 3.26.4 image: "fedora:37" - CXXFLAGS: -Wno-stringop-overread - name: Fedora-38 # Uses gcc 13.0.1, clang 16.0.5, cmake 3.26.4 image: "fedora:38" - CXXFLAGS: -Wno-stringop-overread -Wno-dangling-reference + CXXFLAGS: -Wno-dangling-reference container: image: ${{ matrix.image }} env: diff --git a/include/osmium/osm/object.hpp b/include/osmium/osm/object.hpp index a62c7603..530fffd7 100644 --- a/include/osmium/osm/object.hpp +++ b/include/osmium/osm/object.hpp @@ -316,6 +316,9 @@ namespace osmium { } /// Get user name for this object. +#if defined(__GNUC__) && (__GNUC__ > 11) + [[gnu::noipa]] // avoids stringop-overread warning from GNU compiler +#endif const char* user() const noexcept { return reinterpret_cast(data() + sizeof_object()); } diff --git a/include/osmium/osm/tag.hpp b/include/osmium/osm/tag.hpp index ac2d0f0c..7dd335d5 100644 --- a/include/osmium/osm/tag.hpp +++ b/include/osmium/osm/tag.hpp @@ -51,11 +51,15 @@ namespace osmium { friend class osmium::memory::CollectionIterator; static unsigned char* after_null(unsigned char* ptr) noexcept { - return reinterpret_cast(std::strchr(reinterpret_cast(ptr), 0) + 1); + while (*ptr) { ++ptr; } + ++ptr; + return ptr; } static const unsigned char* after_null(const unsigned char* ptr) noexcept { - return reinterpret_cast(std::strchr(reinterpret_cast(ptr), 0) + 1); + while (*ptr) { ++ptr; } + ++ptr; + return ptr; } unsigned char* next() noexcept { diff --git a/test/t/tags/test_filter.cpp b/test/t/tags/test_filter.cpp index 07a4454b..6d36180a 100644 --- a/test/t/tags/test_filter.cpp +++ b/test/t/tags/test_filter.cpp @@ -30,10 +30,10 @@ void check_filter(const osmium::TagList& tag_list, REQUIRE(std::distance(fi_begin, fi_end) == std::count(reference.begin(), reference.end(), true)); } -const osmium::TagList& make_tag_list(osmium::memory::Buffer& buffer, +const osmium::TagList* make_tag_list(osmium::memory::Buffer& buffer, const std::initializer_list>& tags) { const auto pos = osmium::builder::add_tag_list(buffer, osmium::builder::attr::_tags(tags)); - return buffer.get(pos); + return &buffer.get(pos); }