RFR: 8363584: Sort share/utilities includes
Kim Barrett
kbarrett at openjdk.org
Tue Jul 22 19:42:56 UTC 2025
On Tue, 22 Jul 2025 14:45:30 GMT, Francesco Andreuzzi <duke at openjdk.org> wrote:
> This PR sorts the includes in hotspot/share/utilities using test/hotspot/jtreg/sources/SortIncludes.java. I'm also adding the directory to TestIncludesAreSorted.java.
>
> Passes tier1 tests and GHA.
Changes requested by kbarrett (Reviewer).
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp line 43:
> 41: # include <io.h> // for stream.cpp
> 42: # include <float.h> // for _isnan
> 43: # include <stdio.h> // for va_list
These aren't being flagged as out of order by the checker, because of the trailing comments.
And the comment for `<stdio.h>` is odd, since that's already being brought in by `<stdarg.h>`.
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp line 47:
> 45: # include <inttypes.h>
> 46: # include <limits.h>
> 47: # include <time.h>
And these were blocked from reordering across the "no reorder" commented includes.
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp line 50:
> 48: // Need this on windows to get the math constants (e.g., M_PI).
> 49: #define _USE_MATH_DEFINES
> 50: # include <math.h>
There's a separate problem, unrelated to include order cleanup, that `_USE_MATH_DEFINES` is being
defined here, as that's too late if `<math.h>` happened to be included already. I'll file a bug to address that.
(Apparently not causing problems currently, but include reorderings could trigger problems.)
-------------
PR Review: https://git.openjdk.org/jdk/pull/26428#pullrequestreview-3044533592
PR Review Comment: https://git.openjdk.org/jdk/pull/26428#discussion_r2223618579
PR Review Comment: https://git.openjdk.org/jdk/pull/26428#discussion_r2223640908
PR Review Comment: https://git.openjdk.org/jdk/pull/26428#discussion_r2223651965
More information about the hotspot-dev
mailing list