-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
8263136: C4530 was reported from VS 2019 at access bridge #2859
Conversation
👋 Welcome back ysuenaga! A progress list of the required criteria for merging this PR into |
Webrevs
|
/label add swing |
@prrace |
translate.google.com says the error in (almost) English is : |
Yes, including c++ standard library headers like means you need to deal with C++ exceptions thrown from library functions, and the code needs to be compiled with unwind capabilities. If its not switched on, and a C++ exception happens, the behavior is undefined. In my experience it results in the process being terminated. I wondered why C++ std headers are even used. The source code looks C-ish; but "8196681: Java Access Bridge logging and debug flags dynamically controlled" added some coding, adding a bunch of C++11x semantics and included C++ std headers. Using "/Ehsc" had even been discussed: https://mail.openjdk.java.net/pipermail/awt-dev/2018-December/014847.html but not done. Adding /Ehsc is fine of course, but I think thats not enough. Now C++ exceptions can pass through the code, but if they do, then what? E.g. this function
calls into the C++ standard library to get a time stamp. Can't these function not throw C++ exceptions? Is that not what the compiler is warning about? If they throw, exceptions propagate through the code unbounded, until they either end the process or cause havoc at the next upper C-only-interface. Or, maybe, rewrite this coding to use standard C- and Windows-APIs. I think 8196681 could had been done with traditional windows- or standard C APIs. In particular, Cheers, Thomas |
After that discussion the usage of "string.h"/etc was dropped and "C string manipulation API" was used instead, and that suppressed the warning. I do not know why it was not complaining about "getTimeStamp". I think the fix should refactor the code again. |
Thank you for comments! I refactored
|
Ah, I missed that part. Thanks for clarifying the history :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Yasumasa,
small nits below. But this looks fine to me as it is already so I leave it up to you and the others whether to change anything. Thank you for taking my suggestion.
Cheers, Thomas
GetSystemTimeAsFileTime(&ft); | ||
uli.LowPart = ft.dwLowDateTime; | ||
uli.HighPart = ft.dwHighDateTime; | ||
return (uli.QuadPart / 10000ULL) - 11644473600000ULL; // Rebase Epoch from 1601 to 1970 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good and true to the original change;
I am not even sure the epoch rebase is needed. All 8196681 did was to print out the timestamps verbatim. I do not know enough about how that debug trace is used, and if the timestamps really have to be 1970 based.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to be fine not to use UNIX epoch at first glance as long as we can know the timing of events, but I'm not sure (Thus I rewrote to comply with the original code). So I want to hear from the others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you check via some a11y tool that the new code actually works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, can you help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks fine, I was able to see the proper logs in the java_access_bridge.log, but I cannot find the logs from the windows_access_bridge.log. It seems unrelated to this fix. @pankaj-bansal please take a look at why the windows log might be missed if "JAVA_ACCESSBRIDGE_LOGDIR" is set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record: the jaws J2021.2102.34.400 was used for testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mrserb for the test!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrserb Did you close the JAWS after running the program. I have seen that the logs for windows_access_bridge are flushed only after the JAWS is closed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope! thank you for confirmation that win logs it works as well.
@@ -32,7 +32,6 @@ | |||
#include <stdio.h> | |||
#include <windows.h> | |||
#include <cstdlib> | |||
#include <chrono> | |||
#include <cstring> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Matter of taste, but I would prefer stdlib.h and string.h instead of cxxx. Just to keep in line with the rest of the coding. Weird mix of styles otherwise (I mean this code still uses 16bit era Windows APIs).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AccessBridgeDebug has .cpp
in its extension, so the compiler can handle it as C++ code, and also "cstring" seems to be prefer to "string.h" in @mrserb 's comment. It's nature to use "cstring" in C++ source code IMHO. Let's see comments from the others.
@YaSuenag 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:
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 93 new commits pushed to the
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 |
/label remove build |
@YaSuenag |
/integrate |
@YaSuenag Since your change was applied there have been 95 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit d339320. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
I saw C4530 with VS 2019 (16.9.0) as following (on Japanese locale):
/EHsc
has been already passed in other makefiles, and also AccessBridgeDebug.cpp uses some STL classes (e.g.chrono
namespace). So/EHsc
is a solution for this problem.Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/2859/head:pull/2859
$ git checkout pull/2859