Files
Khem Raj 9c02e30bef usbguard: fix bundled PEGTL demangle static_assert with GCC 16
The bundled PEGTL parses __PRETTY_FUNCTION__ at compile time and trips a
static_assert under GCC 16:

  src/ThirdParty/PEGTL/include/tao/pegtl/demangle.hpp:118:23:
  error: static assertion failed

usbguard demangles PEGTL rules built from ascii::one<'\000', '\012'>,
i.e. types with a char non-type template parameter whose value is '\0'.
GCC 16 renders such a parameter as a literal NUL byte and truncates
__PRETTY_FUNCTION__ there:

  constexpr std::string_view demangle() [with T = seq<one<'

so the trailing "; std::string_view = ...]" and even the closing ']' are
gone, and rfind(';')/rfind(']') both return npos.

Patch demangle() to fall back to the remainder of the string when no
';'/']' terminator survives, instead of failing the build; the demangled
name is only used for tracing diagnostics. Type names without a '\0' char
parameter are unaffected.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-06-28 00:59:28 -07:00
..