summaryrefslogtreecommitdiffstats
path: root/multimedia/rtpmidid/patches/001-fix-32bit-compilation.patch
blob: 59d840bcfb5779905dc8bb0ea86340bd63f01815 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From: Daniel Golle <daniel@makrotopia.org>
Date: Tue, 11 Feb 2026 00:00:00 +0000
Subject: [PATCH] formatterhelper: fix compilation on 32-bit platforms

On 32-bit platforms, size_t and ssize_t are typically typedefs for
unsigned int and int respectively, which already have built-in
formatters in std::format and fmt::format.

Defining duplicate formatters causes compile-time format string
checking to fail with errors like:
  error: call to non-'constexpr' function
    'void std::__format::__unmatched_left_brace_in_format_string()'

Fix this by only defining the custom size_t/ssize_t formatters on
64-bit platforms where they are distinct types.

Fixes: https://github.com/davidmoreno/rtpmidid/issues/138

--- a/include/rtpmidid/formatterhelper.hpp
+++ b/include/rtpmidid/formatterhelper.hpp
@@ -80,5 +80,11 @@
     }                                                                          \
   }
 
+// Only define size_t and ssize_t formatters on 64-bit platforms.
+// On 32-bit platforms, size_t is unsigned int and ssize_t is int,
+// which already have built-in formatters in std::format/fmt::format.
+// Defining duplicate formatters causes compile-time format checking errors.
+#if __SIZEOF_POINTER__ == 8
 BASIC_FORMATTER(size_t, "{}", (uint32_t)v);
 BASIC_FORMATTER(ssize_t, "{}", (int32_t)v);
+#endif