-
Notifications
You must be signed in to change notification settings - Fork 1k
mingw I64 warnings #4073
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
Merged
Merged
mingw I64 warnings #4073
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,4 @@ | ||
| #include "data.table.h" | ||
| #include <Rdefines.h> | ||
| #include <Rmath.h> | ||
|
|
||
| static void finalizer(SEXP p) | ||
| { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
|
|
||
| // It seems that latest min64-w64 compiler needs some help to avoid warnings; #4064 | ||
| // It appears that its inttypes.h defines PRId64 to be I64 on Windows but then warns that | ||
| // I64 is not C99 too. Which is correct, but we know, and we don't want any warnings, and | ||
| // we can't control settings on CRAN. So here we try and isolate ourselves from all scenarios. | ||
| // There is a lot online about this, but these were a few that were most useful: | ||
| // https://stackoverflow.com/questions/23718110/error-unknown-conversion-type-character-l-in-format-scanning-long-long | ||
| // https://gitlab.freedesktop.org/nacho.garglez/cerbero/commit/4ec6bfdc1db1e4bc8d4278f53ad295af1efe89fb | ||
| // https://github.com/GNOME/glib/commit/98a0ab929d8c59ee27e5f470f11d077bb6a56749#diff-969b60ad3d206fd45c208e266ccfed38 | ||
| // https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/ | ||
| // Warning that __USE_MINGW_ANSI_STDIO could be deprecated: | ||
| // https://mingw-w64-public.narkive.com/aQDJHqCv/how-to-printf-64-bit-integer-in-64-bit-compiler-in-strict-iso-mode-with-all-warnings-enabled | ||
| // and then actual deprecation (with complaints) earlier in 2019 here: | ||
| // https://osdn.net/projects/mingw/lists/archive/users/2019-January/000202.html | ||
| // But I can't find _mingw.h. I can find mingw.h but not advice within it: | ||
| // https://github.com/git/git/blob/master/compat/mingw.h#L448 | ||
| // The deprecation about I64 doesn't seem to take into account that lld throws the warning in MinGW: | ||
| // warning: unknown conversion type character 'l' in format [-Wformat=] | ||
| // So let's see if the approach below works for now. | ||
| // If we need to make changes in future, we can do it here in one place. | ||
|
|
||
| #ifndef DT_STDIO_H | ||
| #define DT_STDIO_H | ||
| #if defined(__MINGW32__) || (defined __MINGW64__) | ||
| #define __USE_MINGW_ANSI_STDIO 1 | ||
| #include <stdio.h> | ||
| #define PRId64 "lld" | ||
| #define PRIu64 "llu" | ||
| #else | ||
| #include <stdio.h> | ||
| #include <inttypes.h> | ||
| // let inttypes.h decide: lld on Linux/C99; I64 on Windows Visual Studio for example | ||
| #endif | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 translation purposes, it will be simpler to replace
__func__with"frollmeanFast", then only the format message has to be translated, rather than translating essentially the same things a bunch of times.Took the idea from
basewhich does this often.I'll update this in the
translationbranch shortlyUh oh!
There was an error while loading. Please reload this page.
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.
Ok. But does that pass the new mingw-w64 compiler in rtools4 (win-builder ATC)? The potential compiler glitch might pertain to the
%sand be unrelated to the__func__. Which is why I went straight for not using%sat all to save time to see if that passed, and it did to my surprise. Before putting back the %s we have to check whether the problem is%sor__func__and raise the issue with mingw-w64 team.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.
makes sense. is there such a test in our GL CI pipeline?
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.
not sure how hard that is to setup, @jangorecki? Maybe it's just a case of pointing to (new) rtools40, or could be more involved.
Uh oh!
There was an error while loading. Please reload this page.
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.
Update: #3935 (comment); i.e. yes it's specifically the
__func__with the problem and not the%s.Uh oh!
There was an error while loading. Please reload this page.
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.
@mattdowle I missed your previous comment. Good we know that
__func__was causing problem when used with int64 printing. If rtools40 would help about this, do we want to use__func__together with int64 printing again? It is just a windows specific compilation warning so not really an issue.Uh oh!
There was an error while loading. Please reload this page.
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.
@jangorecki by 'if rtools40 would help about this' do you mean if we report to mingw-w64 team, they accept it as bug, they fix the bug, and then Rtools4.0 upgrades to the fixed version of gcc, do we then want to put the
__func__back? If so, I guess yes, because the code in this file is currently confusing because it uses__func__everywhere except those 4 calls that include the int64 too. It's strange to have that difference so it has to be commented to explain, and I suppose we need something in CRAN_Release.cmd too to catch that from coming back in future. Is GLCI using Rtools4.0 yet and does GLCI search the install log on windows to catch compiler warnings like this one?Uh oh!
There was an error while loading. Please reload this page.
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.
We use 3.5.0.4 on gitlab builds. rtools40 is still experimental, will just test how it works but not yet upgrade our environment.