RFR: 8313396: Portable implementation of FORBID_C_FUNCTION and ALLOW_C_FUNCTION [v2]

Kim Barrett kbarrett at openjdk.org
Sat Jan 4 10:36:35 UTC 2025


On Fri, 3 Jan 2025 22:42:44 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> src/hotspot/share/utilities/forbiddenFunctions.hpp line 33:
>> 
>>> 31: #include <stddef.h> // for size_t
>>> 32: 
>>> 33: #include OS_HEADER(forbiddenFunctions)
>> 
>> I thought there was an OS_VARIANT_HEADER to dispatch directly to the posix variant, but I guess it doesn't exist.  Using the semaphore example, this could save your dispatch header files, at the cost of an #ifdef.  Not sure which is worse:
>> 
>> 
>> #if defined(LINUX) || defined(AIX)
>> # include "semaphore_posix.hpp"
>> #else
>> # include OS_HEADER(semaphore)
>> #endif
>
> park.hpp has the same:
> 
> 
> #if defined(LINUX) || defined(AIX) || defined(BSD)
> # include "park_posix.hpp"
> #else
> # include OS_HEADER(park)
> #endif

If I was going to go that route, I'd be more inclined toward

#if !define(_WINDOWS)
#include "forbiddenFunctions_windows.hpp"
#else
#include "forbiddenFunctions_posix.hpp"
#endif

rather than list all (or maybe just a subset) of the posix-like ports.  My
inclination is to leave it as-is with OS_HEADERS, since I think that's the
"intended" idiom.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22890#discussion_r1903054016


More information about the graal-dev mailing list