RFR: 8264346: nullptr_t undefined in global namespace for clang+libstdc++

Kim Barrett kbarrett at openjdk.java.net
Wed Mar 31 01:08:29 UTC 2021


On Tue, 30 Mar 2021 14:46:43 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

> There's a mismatch in some toolchains about what part should provide the nullptr_t definition. This patch takes the easy way out and include cstddef and changes the two usages nullptr_t to std::nullptr_t.
> 
> See the bug report for more details.
> 
> We could have redefined nullptr_t to resolve this, but that would have required more extensive testing, so I left that as a potential future cleanup.
> 
> I've tested this by compiling with clang on linux. I'm going to let GHA testing testing run, and will also run our tier1 testing.

Changes requested by kbarrett (Reviewer).

src/hotspot/share/utilities/globalDefinitions_gcc.hpp line 34:

> 32: // declarations and a few frequently used utility functions.
> 33: 
> 34: #include <cstddef>

This should be in globalDefinitions.hpp, not globalDefinitions_gcc.hpp.  There's no guarantee that the inclusion of <stddef.h> on other platforms is sufficient to provide the std-qualified name.  In fact, that's explicitly unspecified and deprecated behavior.  (Unqualified nullptr_t being provided by <stddef.h> is deprecated, BTW.)

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

PR: https://git.openjdk.java.net/jdk/pull/3269


More information about the hotspot-dev mailing list