Visual Studio doesn't provide strtok_r, which is a POSIX function. Instead, it provides the same function under the name strtok_s. Note that this is *not* the same as the C99 Annex K strtok_s. VS provides that function under the name strtok_s_l. Note that gcc doesn't provide C99 Annex K at all.
To work around this and allow the use of strtok_r in shared code, we have in os.hpp `#define strtok_r strtok_s` if _WINDOWS, with a FIXME comment that this (and a couple other macros) came from os_windows.hpp. It's not obvious why it wasn't left in os_windows.hpp. But a better place for it is probably globalDefinitions_visCPP.hpp. And it should be defined as an alias variable rather than as a macro, e.g. something like
const decltype(strtok_s) strtok_r = strtok_s;
or
const auto strtok_r = strtok_s;
To work around this and allow the use of strtok_r in shared code, we have in os.hpp `#define strtok_r strtok_s` if _WINDOWS, with a FIXME comment that this (and a couple other macros) came from os_windows.hpp. It's not obvious why it wasn't left in os_windows.hpp. But a better place for it is probably globalDefinitions_visCPP.hpp. And it should be defined as an alias variable rather than as a macro, e.g. something like
const decltype(strtok_s) strtok_r = strtok_s;
or
const auto strtok_r = strtok_s;
- links to
-
Commit(master) openjdk/jdk/e821d599
-
Review(master) openjdk/jdk/22597