On Wed, 10 Apr 2024 09:40:16 GMT, Joachim Kern <jk...@openjdk.org> wrote:
>> Do we even need to include <alloca.h>? >> >> From the Linux man page for alloca: >> >> By necessity, alloca() is a compiler built-in, also known as >> __builtin_alloca(). By default, modern compilers automatically >> translate all uses of alloca() into the built-in, but this is >> forbidden if standards conformance is requested (-ansi, -std=c*), >> in which case <alloca.h> is required, lest a symbol dependency be >> emitted. >> >> There are uses of it in shared code where there isn't an applicable include, >> other than from globalDefinitions_xlc.hpp. So it appears all other supported >> compilers do treat it as a built-in with the options we are providing, and >> don't need the include. Maybe that's true for the new xlc compiler too? > > If I omit this #include <alloca.h> > I get compiler errors of the following kind > > .../src/hotspot/share/runtime/javaThread.cpp:2222:24: error: use of > undeclared identifier 'alloca' > char* p1 = (char*) alloca(1); > ^ > > > Of course I can do this include in every nagging file, but I thought it is > simpler to keep it in the central header. Is the comment in front of https://github.com/openjdk/jdk/blob/51ed69a586105b707ae616f9eba898449bf9fba7/src/hotspot/os/aix/os_aix.cpp#L28 still correct? Seems like it isn't followed everywhere. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/18536#discussion_r1559175426