summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Szuba <marecki@gentoo.org>2023-08-21 18:49:40 +0100
committerMarek Szuba <marecki@gentoo.org>2023-08-21 19:08:48 +0100
commitc21efb2f184c2d4189a623d9dd2df088295eecfb (patch)
tree61b9f4c19dcee5c109ba8367218c366099cf0525 /app-misc
parentapp-text/pinfo: drop 99999 (diff)
downloadgentoo-c21efb2f184c2d4189a623d9dd2df088295eecfb.tar.gz
gentoo-c21efb2f184c2d4189a623d9dd2df088295eecfb.tar.bz2
gentoo-c21efb2f184c2d4189a623d9dd2df088295eecfb.zip
app-misc/ola: do not use reinterpret_cast on NULL
In C++, nullptr_t values generally cannot be converted to a pointer using reinterpret_cast. I say "generally" because glibc apparently lets it slide; musl on the other hand does not. Do it the proper way and use static_cast instead. Closes: https://bugs.gentoo.org/877319 Signed-off-by: Marek Szuba <marecki@gentoo.org>
Diffstat (limited to 'app-misc')
-rw-r--r--app-misc/ola/files/ola-0.10.9-nullptr.patch214
-rw-r--r--app-misc/ola/ola-0.10.9.ebuild7
2 files changed, 220 insertions, 1 deletions
diff --git a/app-misc/ola/files/ola-0.10.9-nullptr.patch b/app-misc/ola/files/ola-0.10.9-nullptr.patch
new file mode 100644
index 000000000000..d0efb84dce8d
--- /dev/null
+++ b/app-misc/ola/files/ola-0.10.9-nullptr.patch
@@ -0,0 +1,214 @@
+--- a/common/web/JsonTest.cpp
++++ b/common/web/JsonTest.cpp
+@@ -560,7 +560,7 @@
+ #ifdef __FreeBSD__
+ OLA_ASSERT_EQ(reinterpret_cast<JsonValue*>(0),
+ #else
+- OLA_ASSERT_EQ(reinterpret_cast<JsonValue*>(NULL),
++ OLA_ASSERT_EQ(static_cast<JsonValue*>(NULL),
+ #endif // __FreeBSD__
+ string1.LookupElement(invalid_pointer));
+
+@@ -580,7 +580,7 @@
+ #ifdef __FreeBSD__
+ OLA_ASSERT_EQ(reinterpret_cast<JsonValue*>(0),
+ #else
+- OLA_ASSERT_EQ(reinterpret_cast<JsonValue*>(NULL),
++ OLA_ASSERT_EQ(static_cast<JsonValue*>(NULL),
+ #endif // __FreeBSD__
+ object.LookupElement(invalid_pointer));
+
+@@ -605,7 +605,7 @@
+ #ifdef __FreeBSD__
+ OLA_ASSERT_EQ(reinterpret_cast<JsonValue*>(0),
+ #else
+- OLA_ASSERT_EQ(reinterpret_cast<JsonValue*>(NULL),
++ OLA_ASSERT_EQ(static_cast<JsonValue*>(NULL),
+ #endif // __FreeBSD__
+ array->LookupElement(invalid_pointer));
+
+@@ -619,14 +619,14 @@
+ #ifdef __FreeBSD__
+ OLA_ASSERT_EQ(reinterpret_cast<JsonValue*>(0),
+ #else
+- OLA_ASSERT_EQ(reinterpret_cast<JsonValue*>(NULL),
++ OLA_ASSERT_EQ(static_cast<JsonValue*>(NULL),
+ #endif // __FreeBSD__
+ array->LookupElement(one_past_last));
+
+ #ifdef __FreeBSD__
+ OLA_ASSERT_EQ(reinterpret_cast<JsonValue*>(0),
+ #else
+- OLA_ASSERT_EQ(reinterpret_cast<JsonValue*>(NULL),
++ OLA_ASSERT_EQ(static_cast<JsonValue*>(NULL),
+ #endif // __FreeBSD__
+ array->LookupElement(invalid));
+
+--- a/ola/AutoStart.cpp
++++ b/ola/AutoStart.cpp
+@@ -113,7 +113,7 @@
+ #ifdef __FreeBSD__
+ reinterpret_cast<char*>(0));
+ #else
+- reinterpret_cast<char*>(NULL));
++ static_cast<char*>(NULL));
+ #endif // __FreeBSD__
+ OLA_WARN << "Failed to exec: " << strerror(errno);
+ _exit(1);
+--- a/olad/plugin_api/UniverseTest.cpp
++++ b/olad/plugin_api/UniverseTest.cpp
+@@ -635,7 +635,7 @@
+ #ifdef __FreeBSD__
+ reinterpret_cast<const RDMResponse*>(0)));
+ #else
+- reinterpret_cast<const RDMResponse*>(NULL)));
++ static_cast<const RDMResponse*>(NULL)));
+ #endif // __FreeBSD__
+
+ // ok, now try something that returns a response from the port
+@@ -661,7 +661,7 @@
+ #ifdef __FreeBSD__
+ reinterpret_cast<const RDMResponse*>(0)));
+ #else
+- reinterpret_cast<const RDMResponse*>(NULL)));
++ static_cast<const RDMResponse*>(NULL)));
+ #endif // __FreeBSD__
+
+ // now try a broadcast fan out
+@@ -694,7 +694,7 @@
+ #ifdef __FreeBSD__
+ reinterpret_cast<const RDMResponse*>(0)));
+ #else
+- reinterpret_cast<const RDMResponse*>(NULL)));
++ static_cast<const RDMResponse*>(NULL)));
+ #endif // __FreeBSD__
+
+ // now confirm that if one of the ports fails to send, we see this response
+@@ -722,7 +722,7 @@
+ #ifdef __FreeBSD__
+ reinterpret_cast<const RDMResponse*>(0)));
+ #else
+- reinterpret_cast<const RDMResponse*>(NULL)));
++ static_cast<const RDMResponse*>(NULL)));
+ #endif // __FreeBSD__
+
+ // DUB responses are slightly different
+@@ -746,7 +746,7 @@
+ #ifdef __FreeBSD__
+ reinterpret_cast<const RDMResponse*>(0)));
+ #else
+- reinterpret_cast<const RDMResponse*>(NULL)));
++ static_cast<const RDMResponse*>(NULL)));
+ #endif // __FreeBSD__
+
+ // now check that we still get a RDM_DUB_RESPONSE even if one port returns an
+@@ -767,7 +767,7 @@
+ #ifdef __FreeBSD__
+ reinterpret_cast<const RDMResponse*>(0)));
+ #else
+- reinterpret_cast<const RDMResponse*>(NULL)));
++ static_cast<const RDMResponse*>(NULL)));
+ #endif // __FreeBSD__
+
+ // and the same again but the second port returns
+@@ -788,7 +788,7 @@
+ #ifdef __FreeBSD__
+ reinterpret_cast<const RDMResponse*>(0)));
+ #else
+- reinterpret_cast<const RDMResponse*>(NULL)));
++ static_cast<const RDMResponse*>(NULL)));
+ #endif // __FreeBSD__
+
+ // now the first port returns a RDM_TIMEOUT
+@@ -808,7 +808,7 @@
+ #ifdef __FreeBSD__
+ reinterpret_cast<const RDMResponse*>(0)));
+ #else
+- reinterpret_cast<const RDMResponse*>(NULL)));
++ static_cast<const RDMResponse*>(NULL)));
+ #endif // __FreeBSD__
+
+ // finally if neither ports support the DUB, we should return that
+@@ -828,7 +828,7 @@
+ #ifdef __FreeBSD__
+ reinterpret_cast<const RDMResponse*>(0)));
+ #else
+- reinterpret_cast<const RDMResponse*>(NULL)));
++ static_cast<const RDMResponse*>(NULL)));
+ #endif // __FreeBSD__
+
+ universe->RemovePort(&port1);
+--- a/plugins/spi/SPIOutputTest.cpp
++++ b/plugins/spi/SPIOutputTest.cpp
+@@ -160,7 +160,7 @@
+ OLA_ASSERT_EQ(5u, backend.Writes(0));
+
+ // Check nothing changed on the other output.
+- OLA_ASSERT_EQ(reinterpret_cast<const uint8_t*>(NULL),
++ OLA_ASSERT_EQ(static_cast<const uint8_t*>(NULL),
+ backend.GetData(1, &length));
+ OLA_ASSERT_EQ(0u, backend.Writes(1));
+ }
+@@ -210,7 +210,7 @@
+ OLA_ASSERT_EQ(3u, backend.Writes(0));
+
+ // Check nothing changed on the other output.
+- OLA_ASSERT_EQ(reinterpret_cast<const uint8_t*>(NULL),
++ OLA_ASSERT_EQ(static_cast<const uint8_t*>(NULL),
+ backend.GetData(1, &length));
+ OLA_ASSERT_EQ(0u, backend.Writes(1));
+ }
+@@ -265,7 +265,7 @@
+ OLA_ASSERT_EQ(4u, backend.Writes(0));
+
+ // Check nothing changed on the other output.
+- OLA_ASSERT_EQ(reinterpret_cast<const uint8_t*>(NULL),
++ OLA_ASSERT_EQ(static_cast<const uint8_t*>(NULL),
+ backend.GetData(1, &length));
+ OLA_ASSERT_EQ(0u, backend.Writes(1));
+ }
+@@ -312,7 +312,7 @@
+ OLA_ASSERT_DATA_EQUALS(EXPECTED4, arraysize(EXPECTED4), data, length);
+
+ // Check nothing changed on the other output.
+- OLA_ASSERT_EQ(reinterpret_cast<const uint8_t*>(NULL),
++ OLA_ASSERT_EQ(static_cast<const uint8_t*>(NULL),
+ backend.GetData(1, &length));
+ OLA_ASSERT_EQ(0u, backend.Writes(1));
+ }
+@@ -371,7 +371,7 @@
+ OLA_ASSERT_EQ(4u, backend.Writes(0));
+
+ // Check nothing changed on the other output.
+- OLA_ASSERT_EQ(reinterpret_cast<const uint8_t*>(NULL),
++ OLA_ASSERT_EQ(static_cast<const uint8_t*>(NULL),
+ backend.GetData(1, &length));
+ OLA_ASSERT_EQ(0u, backend.Writes(1));
+ }
+@@ -421,7 +421,7 @@
+ OLA_ASSERT_DATA_EQUALS(EXPECTED4, arraysize(EXPECTED4), data, length);
+
+ // Check nothing changed on the other output.
+- OLA_ASSERT_EQ(reinterpret_cast<const uint8_t*>(NULL),
++ OLA_ASSERT_EQ(static_cast<const uint8_t*>(NULL),
+ backend.GetData(1, &length));
+ OLA_ASSERT_EQ(0u, backend.Writes(1));
+ }
+@@ -517,7 +517,7 @@
+
+ // test6
+ // Check nothing changed on the other output.
+- OLA_ASSERT_EQ(reinterpret_cast<const uint8_t*>(NULL),
++ OLA_ASSERT_EQ(static_cast<const uint8_t*>(NULL),
+ backend.GetData(1, &length));
+ OLA_ASSERT_EQ(0u, backend.Writes(1));
+
+@@ -707,7 +707,7 @@
+
+ // test6
+ // Check nothing changed on the other output.
+- OLA_ASSERT_EQ(reinterpret_cast<const uint8_t*>(NULL),
++ OLA_ASSERT_EQ(static_cast<const uint8_t*>(NULL),
+ backend.GetData(1, &length));
+ OLA_ASSERT_EQ(0u, backend.Writes(1));
+
diff --git a/app-misc/ola/ola-0.10.9.ebuild b/app-misc/ola/ola-0.10.9.ebuild
index 5cdbca6899a9..2ee3011b7098 100644
--- a/app-misc/ola/ola-0.10.9.ebuild
+++ b/app-misc/ola/ola-0.10.9.ebuild
@@ -3,7 +3,8 @@
EAPI=8
-PYTHON_COMPAT=( python3_{9..11} )
+# py3.12 blocked by protobuf-python
+PYTHON_COMPAT=( python3_{10..11} )
inherit autotools python-single-r1
@@ -61,6 +62,10 @@ BDEPEND="sys-devel/bison
)
)"
+PATCHES=(
+ "${FILESDIR}"/${PN}-0.10.9-nullptr.patch
+)
+
src_prepare() {
default
# Upstream recommends doing this even for tarball builds