1
0
mirror of https://github.com/nlohmann/json.git synced 2025-08-06 07:02:42 +03:00

Add GCC 15.1.0 flags (#4766)

* 🔧 add GCC 15.1.0 flags

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🔧 add GCC 15.1.0 flags

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🔧 add GCC 15.1.0 flags

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🚨 suppress -Wstrict-overflow warning

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🚨 suppress -Wstrict-overflow warning

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🚨 suppress -Wstrict-overflow warning

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🚨 suppress -Wstrict-overflow warning

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🚨 fix -Wstrict-overflow warning

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🚨 fix -Wstrict-overflow warning

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🚨 fix warnings

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🚨 fix warnings

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🎨 fix format

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

---------

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2025-05-16 08:32:18 +02:00
committed by GitHub
parent e02de2f971
commit 6f6be39332
3 changed files with 31 additions and 18 deletions

View File

@@ -1,13 +1,13 @@
# Warning flags determined for GCC 14.2.0 with https://github.com/nlohmann/gcc_flags: # Warning flags determined for GCC 15.1.0 with https://github.com/nlohmann/gcc_flags:
# Ignored GCC warnings: # Ignored GCC warnings:
# -Wno-abi-tag We do not care about ABI tags. # -Wno-abi-tag We do not care about ABI tags.
# -Wno-aggregate-return The library uses aggregate returns. # -Wno-aggregate-return The library uses aggregate returns.
# -Wno-long-long The library uses the long long type to interface with system functions. # -Wno-long-long The library uses the long long type to interface with system functions.
# -Wno-namespaces The library uses namespaces. # -Wno-namespaces The library uses namespaces.
# -Wno-nrvo Doctest triggers this warning. # -Wno-nrvo Doctest triggers this warning.
# -Wno-padded We do not care about padding warnings. # -Wno-padded We do not care about padding warnings.
# -Wno-system-headers We do not care about warnings in system headers. # -Wno-system-headers We do not care about warnings in system headers.
# -Wno-templates The library uses templates. # -Wno-templates The library uses templates.
set(GCC_CXXFLAGS set(GCC_CXXFLAGS
-pedantic -pedantic
@@ -65,6 +65,7 @@ set(GCC_CXXFLAGS
-Wanalyzer-tainted-offset -Wanalyzer-tainted-offset
-Wanalyzer-tainted-size -Wanalyzer-tainted-size
-Wanalyzer-too-complex -Wanalyzer-too-complex
-Wanalyzer-undefined-behavior-ptrdiff
-Wanalyzer-undefined-behavior-strtok -Wanalyzer-undefined-behavior-strtok
-Wanalyzer-unsafe-call-within-signal-handler -Wanalyzer-unsafe-call-within-signal-handler
-Wanalyzer-use-after-free -Wanalyzer-use-after-free
@@ -123,6 +124,7 @@ set(GCC_CXXFLAGS
-Wcoverage-invalid-line-number -Wcoverage-invalid-line-number
-Wcoverage-mismatch -Wcoverage-mismatch
-Wcoverage-too-many-conditions -Wcoverage-too-many-conditions
-Wcoverage-too-many-paths
-Wcpp -Wcpp
-Wctad-maybe-unsupported -Wctad-maybe-unsupported
-Wctor-dtor-privacy -Wctor-dtor-privacy
@@ -130,6 +132,7 @@ set(GCC_CXXFLAGS
-Wdangling-pointer=2 -Wdangling-pointer=2
-Wdangling-reference -Wdangling-reference
-Wdate-time -Wdate-time
-Wdefaulted-function-deleted
-Wdelete-incomplete -Wdelete-incomplete
-Wdelete-non-virtual-dtor -Wdelete-non-virtual-dtor
-Wdeprecated -Wdeprecated
@@ -138,6 +141,8 @@ set(GCC_CXXFLAGS
-Wdeprecated-declarations -Wdeprecated-declarations
-Wdeprecated-enum-enum-conversion -Wdeprecated-enum-enum-conversion
-Wdeprecated-enum-float-conversion -Wdeprecated-enum-float-conversion
-Wdeprecated-literal-operator
-Wdeprecated-variadic-comma-omission
-Wdisabled-optimization -Wdisabled-optimization
-Wdiv-by-zero -Wdiv-by-zero
-Wdouble-promotion -Wdouble-promotion
@@ -157,20 +162,21 @@ set(GCC_CXXFLAGS
-Wfloat-conversion -Wfloat-conversion
-Wfloat-equal -Wfloat-equal
-Wformat -Wformat-contains-nul -Wformat -Wformat-contains-nul
-Wformat -Wformat-diag
-Wformat -Wformat-extra-args -Wformat -Wformat-extra-args
-Wformat -Wformat-nonliteral -Wformat -Wformat-nonliteral
-Wformat -Wformat-overflow=2
-Wformat -Wformat-security -Wformat -Wformat-security
-Wformat -Wformat-signedness
-Wformat -Wformat-truncation=2
-Wformat -Wformat-y2k -Wformat -Wformat-y2k
-Wformat -Wformat-zero-length -Wformat -Wformat-zero-length
-Wformat-diag
-Wformat-overflow=2
-Wformat-signedness
-Wformat-truncation=2
-Wformat=2 -Wformat=2
-Wframe-address -Wframe-address
-Wfree-nonheap-object -Wfree-nonheap-object
-Wglobal-module -Wglobal-module
-Whardened -Whardened
-Wheader-guard
-Whsa -Whsa
-Wif-not-aligned -Wif-not-aligned
-Wignored-attributes -Wignored-attributes
@@ -197,6 +203,7 @@ set(GCC_CXXFLAGS
-Wno-long-long -Wno-long-long
-Wlto-type-mismatch -Wlto-type-mismatch
-Wmain -Wmain
-Wmaybe-musttail-local-addr
-Wmaybe-uninitialized -Wmaybe-uninitialized
-Wmemset-elt-size -Wmemset-elt-size
-Wmemset-transposed-args -Wmemset-transposed-args
@@ -215,6 +222,7 @@ set(GCC_CXXFLAGS
-Wmultichar -Wmultichar
-Wmultiple-inheritance -Wmultiple-inheritance
-Wmultistatement-macros -Wmultistatement-macros
-Wmusttail-local-addr
-Wno-namespaces -Wno-namespaces
-Wnarrowing -Wnarrowing
-Wnoexcept -Wnoexcept
@@ -245,6 +253,7 @@ set(GCC_CXXFLAGS
-Wpmf-conversions -Wpmf-conversions
-Wpointer-arith -Wpointer-arith
-Wpointer-compare -Wpointer-compare
-Wpragma-once-outside-header
-Wpragmas -Wpragmas
-Wprio-ctor-dtor -Wprio-ctor-dtor
-Wpsabi -Wpsabi
@@ -276,10 +285,12 @@ set(GCC_CXXFLAGS
-Wsizeof-pointer-div -Wsizeof-pointer-div
-Wsizeof-pointer-memaccess -Wsizeof-pointer-memaccess
-Wstack-protector -Wstack-protector
-Wstrict-aliasing
-Wstrict-aliasing=3 -Wstrict-aliasing=3
-Wstrict-null-sentinel -Wstrict-null-sentinel
-Wstrict-overflow -Wstrict-overflow
-Wstring-compare -Wstring-compare
-Wstringop-overflow
-Wstringop-overflow=4 -Wstringop-overflow=4
-Wstringop-overread -Wstringop-overread
-Wstringop-truncation -Wstringop-truncation
@@ -304,8 +315,12 @@ set(GCC_CXXFLAGS
-Wsynth -Wsynth
-Wno-system-headers -Wno-system-headers
-Wtautological-compare -Wtautological-compare
-Wtemplate-body
-Wtemplate-id-cdtor
-Wtemplate-names-tu-local
-Wno-templates -Wno-templates
-Wterminate -Wterminate
-Wtrailing-whitespace
-Wtrampolines -Wtrampolines
-Wtrigraphs -Wtrigraphs
-Wtrivial-auto-var-init -Wtrivial-auto-var-init

View File

@@ -1914,12 +1914,10 @@ TEST_CASE("MessagePack with std::byte")
SECTION("empty vector") SECTION("empty vector")
{ {
const std::vector<std::byte> empty_data; const std::vector<std::byte> empty_data;
CHECK_THROWS_WITH_AS([&]() CHECK_THROWS_WITH_AS([&]() {
{
[[maybe_unused]] auto result = json::from_msgpack(empty_data); [[maybe_unused]] auto result = json::from_msgpack(empty_data);
return true; return true;
} }(),
(),
"[json.exception.parse_error.110] parse error at byte 1: syntax error while parsing MessagePack value: unexpected end of input", "[json.exception.parse_error.110] parse error at byte 1: syntax error while parsing MessagePack value: unexpected end of input",
json::parse_error&); json::parse_error&);
} }

View File

@@ -3904,7 +3904,7 @@ const char* skipPathFromFilename(const char* file) {
{ {
const auto prefix_start = pos; const auto prefix_start = pos;
pos = std::min(prefixes.find(separator, prefix_start), prefixes.size()); pos = std::min(prefixes.find(separator, prefix_start), prefixes.size());
const auto prefix_size = pos - prefix_start; const auto prefix_size = pos - prefix_start;
if(prefix_size > longest_match) if(prefix_size > longest_match)
{ {