RFR: 8323297: Fix incorrect placement of precompiled.hpp include lines
Stefan Karlsson
stefank at openjdk.org
Wed Jan 10 10:55:22 UTC 2024
On Tue, 9 Jan 2024 14:55:45 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:
> There are a few files that have include lines before the precompiled.hpp include line. I propose that we fix this.
>
> Testing: I'll let this run through GHA and Oracle's tier1 to see that this still compiles.
Thanks for reviewing!
> It is interesting the shared files did not cause an issue on Windows.
I was surprised by this as well. I dug some more into this and found this in the documentation:
The compiler treats all code occurring before the .h file as precompiled. It skips to just beyond the #include directive associated with the .h file, uses the code contained in the .pch file, and then compiles all code after filename.
I tested this by changing zCollectedHeap.cpp to have:
#error "COMPILATION_ERROR_1"
#include "gc/z/zAddress.hpp"
#include "precompiled.hpp"
#error "COMPILATION_ERROR_2"
The compilation error I then got was:
fatal error C1189: #error: "COMPILATION_ERROR_2"
So, it seems like the MS compiler previously just skipped the extra includes above the precompiled.hpp include line.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17326#issuecomment-1884616955
More information about the shenandoah-dev
mailing list