[PATCH] D159312: [Headers] Remove a space in NULL define

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 1 05:01:29 PDT 2023


aaron.ballman added inline comments.


================
Comment at: clang/lib/Headers/__stddef_null.h:18-21
+// Don't add any whitespaces in ((void*)0) below!
+// musl (https://www.musl-libc.org/) redefines `NULL` as such and redefinition
+// with a different expression, even in terms of a single whitespace, causes a
+// warning.
----------------
My concern with this comment is that it implies we can never change our definition of `NULL` -- as the implementation, this is ours to define and if other C standard libraries (also part of the implementation!) are redefining the macro, IMO, they need to solve this themselves with either `#ifdef` or `#undef` as needed instead of expecting the definitions to stay in lock-step including whitespace. I don't expect us to change the definition of `NULL` any time soon, but this feels like a bad precedent to set. I'm not opposed (this is solving a real problem), but I'm wondering if musl would consider guarding their macro definitions so we don't have this fragility forever? We need to keep it for now so existing musl uses don't have this problem, but I don't really want to make the guarantees this comment is claiming.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159312/new/

https://reviews.llvm.org/D159312



More information about the cfe-commits mailing list