Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8293088: Fix compilation with the new Visual Studio preprocessor #10080

Closed
wants to merge 1 commit into from

Conversation

djelinski
Copy link
Member

@djelinski djelinski commented Aug 30, 2022

Fix compilation with Zc:preprocessor enabled.

The flag itself will be enabled in JDK-8247283; I enabled the flag using instructions found in Magnus's comment on that issue.

Windows 10 SDK version 2104 (10.0.20348.0) is required for successful compilation. Compilation fails with a warning (treated as error by default) with older versions of Windows 10 SDK.

I verified that the compilation completes successfully with this patch, both in debug and in release mode, both with and without Zc:preprocessor.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8293088: Fix compilation with the new Visual Studio preprocessor

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10080/head:pull/10080
$ git checkout pull/10080

Update a local copy of the PR:
$ git checkout pull/10080
$ git pull https://git.openjdk.org/jdk pull/10080/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10080

View PR using the GUI difftool:
$ git pr show -t 10080

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10080.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 30, 2022

👋 Welcome back djelinski! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot changed the title 8293088 8293088: Fix compilation with the new Visual Studio preprocessor Aug 30, 2022
@openjdk
Copy link

openjdk bot commented Aug 30, 2022

@djelinski The following labels will be automatically applied to this pull request:

  • client
  • security

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added security security-dev@openjdk.org client client-libs-dev@openjdk.org labels Aug 30, 2022
@djelinski djelinski marked this pull request as ready for review August 30, 2022 12:21
@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 30, 2022
@mlbridge
Copy link

mlbridge bot commented Aug 30, 2022

Webrevs

@openjdk
Copy link

openjdk bot commented Aug 30, 2022

@djelinski This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8293088: Fix compilation with the new Visual Studio preprocessor

Reviewed-by: ihse

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 6 new commits pushed to the master branch:

  • b3450e9: 8292850: Unused field 'expiredTimersKey' in javax.swing.TimerQueue
  • 6b7d4b1: 8293028: Remove GenCollectedHeap::handle_failed_promotion
  • 21a7369: 8292575: riscv: Represent Registers as values
  • 4a28f37: 8291792: DefaultStyledDocument.setCharacterAttributes accepts negative length
  • f766d92: 8290344: Start/stop displaysync affects performance in metal rendering pipeline
  • afa5d4c: 8290451: Incorrect result when switching to C2 OSR compilation from C1

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Aug 30, 2022
@prrace
Copy link
Contributor

prrace commented Sep 1, 2022

Fixing the compilation is one thing. But did you verify that it actually works as intended ?

@djelinski
Copy link
Member Author

I verified that client tests still pass. I also verified on a separate project that merging strings with and without ## is equivalent when Zc:preprocessor is absent. When it is present, merging with ## is an error.

I did not verify the output of the changed macros, but I'm pretty confident that their behavior will not change. If you could suggest a test, I'll be happy to perform it.

@djelinski
Copy link
Member Author

FWIW, here's the test that I used:

#include <stdio.h>

#define PRINTERR(res) \
  PRINT(res, " " ## #res ## " in file " __FILE__);
  
#define PRINT(res, msg) \
  printf("- " ## msg ## " val=%d\n", res);
  
int main() {
	for (int i = 0; i < 2; i++) {
		PRINTERR(i);
	}
}

Output:

-  i in file test.c val=0
-  i in file test.c val=1

removing ## does not change the output.

@djelinski
Copy link
Member Author

I verified the preprocessor output on D3DResourceManager.cpp file, which uses 3 of the 4 changed macros in D3DPipeline.h (RETURN_STATUS_IF_EXP_FAILED is not used anywhere). The generated files have only cosmetic differences - ## removes whitespace between the concatenated string literals, and without ## the whitespace is preserved. This whitespace is ignored by the compiler.

@djelinski
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Sep 5, 2022

Going to push as commit e945619.
Since your change was applied there have been 78 commits pushed to the master branch:

  • 730ced9: 8292660: C2: blocks made unreachable by NeverBranch-to-Goto conversion are removed incorrectly
  • 3464019: 8292899: CustomTzIDCheckDST.java testcase failed on AIX platform
  • e92b9e4: 8293325: Minor improvements to macos catch_mach_exception_raise() error handling
  • 767262e: 8292201: serviceability/sa/ClhsdbThreadContext.java fails with "'Thread "Common-Cleaner"' missing from stdout/stderr"
  • a366e82: 7113208: Incorrect javadoc on java.net.DatagramPacket.setLength()
  • ac05bc8: 8293293: Move archive heap loading code out of heapShared.cpp
  • e1e6732: 8293319: [C2 cleanup] Remove unused other_path arg in Parse::adjust_map_after_if
  • 5757e21: 8292385: assert(ctrl == kit.control()) failed: Control flow was added although the intrinsic bailed out
  • 3993a1f: 8292067: Convert test/sun/management/jmxremote/bootstrap shell tests to java version
  • 83a3408: 8293315: Add back logging for Placeholders
  • ... and 68 more: https://git.openjdk.org/jdk/compare/bc6ac6f7af7a41a7f045c9f2e443e6d204197051...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 5, 2022
@openjdk openjdk bot closed this Sep 5, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 5, 2022
@openjdk
Copy link

openjdk bot commented Sep 5, 2022

@djelinski Pushed as commit e945619.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@djelinski djelinski deleted the preprocessor-fixes branch October 20, 2022 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client-libs-dev@openjdk.org integrated Pull request has been integrated security security-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

3 participants