On Sat, 27 May 2023 15:33:37 GMT, Kim Barrett <kbarr...@openjdk.org> wrote:
>> I am basically worried that undefining malloc, even if it seems harmless >> now, exposes us to difficult-to-investigate problems down the road, since it >> depends on how the libc devs will reform those macros in the future. I would >> prefer a simple solution that does not depend on how the libc includes >> evolve. > > Is it possible to see the stdlib.h source code that is being a problem? > Maybe more eyes can come up > with a better solution, or at least come to a better understanding of why we > have to go this way. Technically it's our fault. The standard library is permitted to provide a macro replacements for (nearly?) any function. (C99 7.1.3/1 3rd bullet) But it's really annoying. Presumably AIX is only doing so for a subset of the allocation functions, e.g. not "free" for example. Having "malloc" defined as a macro seems like it should raise all kinds of havoc, not just around log tags. Consider our "os::malloc" function? The preprocessor knows nothing about C++ namespace qualifiers. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14146#discussion_r1210388482