commit 121a8d0507522dfb7bfd05fc001b0f322c3f9000
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Wed Jul 2 12:57:59 2025 +0200
Avoid gcc warning about casting away const
The warning (spotted by Scott) is :
src/support/lassert.cpp:145:22: warning: cast from type ‘const char*’ to
type ‘void*’ casts away qualifiers [-Wcast-qual]
145 | free((void*)demangled);
| ^~~~~~~~~~~~~~~~
Actually the return value of __cxa_demangle is not const. With this
change, the (void*) cast is not needed anymore.
---
src/support/lassert.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/support/lassert.cpp b/src/support/lassert.cpp
index d48925f1a7..27be33f67d 100644
--- a/src/support/lassert.cpp
+++ b/src/support/lassert.cpp
@@ -138,11 +138,11 @@ docstring printCallStack()
}
}
int status = 0;
- const char* demangled =
+ char* demangled =
abi::__cxa_demangle(mangled, nullptr, nullptr, &status);
const QByteArray line = QString("(%1) %2: %3\n").arg(i,
3).arg(messages[i])
.arg(demangled
? demangled : orig.c_str()).toLocal8Bit();
- free((void*)demangled);
+ free(demangled);
fprintf(stderr, "%s", line.constData());
bt += from_local8bit(line.constData());
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs