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

8301443: Clean broken comments from Windows code #12305

Closed
wants to merge 10 commits into from

Conversation

TheShermanTanker
Copy link
Contributor

@TheShermanTanker TheShermanTanker commented Jan 31, 2023

Several comments are technically broken in Windows code, this change cleans up the broken comments that managed to slip past reviewers during Integration


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

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12305

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 31, 2023

👋 Welcome back jwaters! 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 8301443 8301443: Clean broken comments from Windows code Jan 31, 2023
@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 31, 2023
@openjdk
Copy link

openjdk bot commented Jan 31, 2023

@TheShermanTanker 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 Jan 31, 2023
@mlbridge
Copy link

mlbridge bot commented Jan 31, 2023

@TheShermanTanker
Copy link
Contributor Author

TheShermanTanker commented Jan 31, 2023

@wangweij Sorry for the abrupt tag, but would the sspi.cpp change be fine with you? It seems like the comment is intended to signal a newline so the compile command's second half on the next line is read properly, but Visual C++ will simply interpret it as the object file \.o, which isn't correct, but I don't quite know the context behind that comment so I thought I'd ask first (On top of the fact that cmd doesn't allow newline formatted commands at all)

Copy link
Member

@aivanov-jdk aivanov-jdk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for the change in sspi.cpp, it looks good to me.

Comment on lines 30 to 31
// cl -I %OPENJDK%\src\java.security.jgss\share\native\libj2gss\ sspi.cpp \
// cl -I %OPENJDK%\src\java.security.jgss\share\native\libj2gss\ sspi.cpp
// -link -dll -out:sspi_bridge.dll
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the backslash \ should remain there: it's a command line and \ is used to wrap the long line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did think about that too when I first saw it, but the command this is often run from is the Windows CMD, which does not accept \ to escape to the next line. MSYS bash does not have the required environment set up outside of configure time to run cl either, but I have not tested with WSL yet. I suppose one could do the complicated setup required to be able to run this from the winenv provided bash, but that seems like a lot of hassle, enough that to me someone trying to compile sspi_bridge.dll by itself wouldn't really bother with the process. On top of that cl.exe will actually interpret the backslash as the literal object file \.o for some weird reason. I've already pinged the original author of the file @wangweij above to ask for guidance on this as such

Copy link
Contributor

@wangweij wangweij Feb 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no objection to the code change. Or maybe you can change it to the windows line extension character ^.

I was using this command for quick recompiling while writing this code, and it's in a cmd.exe window launched with a start menu item named something like "Visual Studio Developing Environment". I wrote it inside here to remind myself if I need to rework on it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used to have Visual Studio compilers available in my Cygwin environment. Now I don't, I just point the configure script to the batch file which configures the environment.

If this command is supposed to be run in cmd.exe, then ^ makes more sense: one could just copy & paste the command.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just tried copying and pasting the command with ^ instead of \ and cmd doesn't seem to be correctly reading the compile command either even with ^, is there something I'm missing here?

Copy link
Contributor

@wangweij wangweij Feb 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. I'm quite sure I was using the full command in cmd.exe after calling some vcvars64.bat. I added the \ character because it's a little long to be recorded here. I don't really care which separator is used. You can remove the \ character. We don't need to spend too much time on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, with all of this confusion around the command line, I think I'd rather just avoid the issue entirely by turning this into a multiline comment so the backslash doesn't cause compiler warnings

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what the error message you get, but ^ definitely works for me as continuation line marker in cmd.exe.

C:\dev\jdk-dev>cl -I %OPENJDK%\src\java.security.jgss\share\native\libj2gss\ sspi.cpp ^
More?    -link -dll -out:sspi_bridge.dll
'cl' is not recognized as an internal or external command,
operable program or batch file.

This More? prompt identifies the continuation line.

Anyway, we decided to leave it as is but convert to multi-line comment, which is fine with me.

@openjdk
Copy link

openjdk bot commented Feb 6, 2023

@TheShermanTanker 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:

8301443: Clean broken comments from Windows code

Reviewed-by: aivanov

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 11 new commits pushed to the master branch:

  • 873558e: 8300914: Allow @ as an escape in documentation comments
  • 8a9e383: 8301717: Remove obsolete jib profiles
  • 631a279: 8301567: The test/jdk/java/awt/AppContext/ApplicationThreadsStop/java.policy is unused
  • 638d612: 8298478: (fs) Path.of should allow input to include long path prefix
  • 10dd98d: 8301462: Convert Permission files to use lambda after JDK-8076596
  • 8d4c76d: 8302072: Parallel: Remove unimplemented ParCompactionManager::stack_push
  • ecf21a9: 8301767: Convert virtual thread tests to JUnit
  • 9af2ea2: 8301828: Avoid unnecessary array fill after creation in javax.swing.text
  • 3db352d: 8302047: G1: Remove unused G1RegionToSpaceMapper::_region_granularity
  • c92a7de: 8301380: jdk/jfr/api/consumer/streaming/TestCrossProcessStreaming.java
  • ... and 1 more: https://git.openjdk.org/jdk/compare/4de2d3c3b61ee15967fcefbc4d38cac27dce633a...master

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 Feb 6, 2023
Comment on lines 174 to 183
/*
HWND hList = GetListHandle();
if (hList != NULL) {
long flags = SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOCOPYBITS;
/*
* Fix for bug 4046446.
* /
SetWindowPos(hList, 0, 0, 0, w, h, flags);
}
*/
//
// HWND hList = GetListHandle();
// if (hList != NULL) {
// long flags = SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOCOPYBITS;
// /*
// * Fix for bug 4046446.
// */
// SetWindowPos(hList, 0, 0, 0, w, h, flags);
// }
//
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's time to remove this commented out code? It's been commented out since 2007 when the code moved to Mercurial.

If you decide to remove it, please submit a new issue to communicate the intention clearly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, but I'll leave that to the discretion of the client libs group. Are the new changes fine with you though?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather remove the offending commented out code than change its formatting.

Could you submit a bug, please, and assign it to me?

There's a closed test associated with JDK-4046446, it can be open-sourced. Then it'll be safe to remove the commented out code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright here you go :) https://bugs.openjdk.org/browse/JDK-8301994

Thank you, @TheShermanTanker.

Do you still want to keep the changes?
If it's not too critical, I would rather prefer you revert the changes to awt_List.cpp.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, I'm fine with reverting awt_List.cpp, I can set my local branch up to avoid a rebase conflict when the commented code does get deleted rather easily

On the other hand, could I trouble you for a quick review of #12405? It's just a constructor from libawt that I happened to overlook in my previous Pull Request on initialization orders. Sorry for the trouble!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review! Are the other changes here ok with you in the meantime?

Comment on lines 30 to 31
// cl -I %OPENJDK%\src\java.security.jgss\share\native\libj2gss\ sspi.cpp \
// cl -I %OPENJDK%\src\java.security.jgss\share\native\libj2gss\ sspi.cpp
// -link -dll -out:sspi_bridge.dll
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what the error message you get, but ^ definitely works for me as continuation line marker in cmd.exe.

C:\dev\jdk-dev>cl -I %OPENJDK%\src\java.security.jgss\share\native\libj2gss\ sspi.cpp ^
More?    -link -dll -out:sspi_bridge.dll
'cl' is not recognized as an internal or external command,
operable program or batch file.

This More? prompt identifies the continuation line.

Anyway, we decided to leave it as is but convert to multi-line comment, which is fine with me.

@TheShermanTanker
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Feb 9, 2023

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

  • 5561c39: 8294484: MetalBorder's FrameBorder & DialogBorder have border rendering issues when scaled
  • c8cc7b6: 8301704: Shorten the number of GCs in UnloadingTest.java to verify a class loader not being unloaded
  • dc6d52c: 8301876: Crash in DumpTimeClassInfo::add_verification_constraint
  • 873558e: 8300914: Allow @ as an escape in documentation comments
  • 8a9e383: 8301717: Remove obsolete jib profiles
  • 631a279: 8301567: The test/jdk/java/awt/AppContext/ApplicationThreadsStop/java.policy is unused
  • 638d612: 8298478: (fs) Path.of should allow input to include long path prefix
  • 10dd98d: 8301462: Convert Permission files to use lambda after JDK-8076596
  • 8d4c76d: 8302072: Parallel: Remove unimplemented ParCompactionManager::stack_push
  • ecf21a9: 8301767: Convert virtual thread tests to JUnit
  • ... and 4 more: https://git.openjdk.org/jdk/compare/4de2d3c3b61ee15967fcefbc4d38cac27dce633a...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 9, 2023

@TheShermanTanker Pushed as commit 70f3150.

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

@TheShermanTanker TheShermanTanker deleted the comments branch February 9, 2023 03:21
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
3 participants