[libc-commits] [libc] [libc] Fix gcc warnings. (PR #240958)

Pavel Labath via libc-commits libc-commits at lists.llvm.org
Wed Nov 11 00:03:34 PST 2026


================
@@ -14,7 +14,7 @@
 #define __containerof(ptr, type, member)                                       \
   ({                                                                           \
     const __typeof(((type *)0)->member) *__ptr = (ptr);                        \
-    (type *)(void *)((const char *)__ptr - offsetof(type, member));            \
+    (type *)(__UINTPTR_TYPE__)((const char *)__ptr - offsetof(type, member));  \
----------------
labath wrote:

Which warning is this fixing? If it's something about aliasing or similar, I'm worried that this just sweeps something under the rug.

Even if we keep this, a comment explaining the situation would be useful.

https://github.com/llvm/llvm-project/pull/240958


More information about the libc-commits mailing list