[PATCH] D130800: [clang][Headers] Avoid compiler warnings in builtin headers
Ian Anderson via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 2 16:57:20 PDT 2022
iana added inline comments.
Comment at: clang/lib/Headers/stdint.h:99-100
typedef __UINT64_TYPE__ uint64_t;
+# undef __int_least64_t
# define __int_least64_t int64_t
+# undef __uint_least64_t
> What are you seeing that's defining `__int_least64_t` and all these other ones by the time you get here? It's surprising to me that so much preprocessor state exists when you hit this point considering that this file doesn't include anything else. Is this some kind of artifact with how the OS module map is making a module for stdint.h?
Oh I see, it's not these ones that are the problem, it's the redefinitions below. I guess it's a bigger change, but I wonder if flipping the order would be cleaner? e.g.
# define __int_least32_t int32_t
# ifndef __int_least32_t
# define __int_least32_t int64_t
I guess it's an extra line per type doing it that way, but maybe it's more obvious? (Maybe I just don't do a lot of preprocessor programming, but `#undef` feels like a code smell to me)
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the cfe-commits