-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Resolve GCC/Clang Warnings #11687
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
Resolve GCC/Clang Warnings #11687
Conversation
|
Seems like the deprecation for Qt6 is just something on my end, those buildbots hated that change. |
See #11534 - this is a GCC bug (89038 → 53431) which will be fixed in GCC 13, but for now there's nothing that can be done about it. I couldn't resolve the ignored attributes one either. |
|
I was hesitant to touch the bignum arithmetic code, but all signs pointed towards size_t making sense. I could change it further to only use size_t instead of mixed int usage, but then I either have to add a (n == 0) condition at the start, or assume (perhaps with a __builtin_assume) that it can never be zero. |
|
Note that |
|
Yeah I stupidly did that the first time I went over that file and was told off by the compiler warnings. I think this other solution with post-increment will work, but I don't yet know what relevant code uses this function to see if it breaks. |
|
I appreciate the attempt to improve Dolphin's code, but please realize that the point of a warning is to look at the code in question to verify if the current behavior is correct and, if yes, acknowledge the behavior by adding a signifier for this (eg. a cast) and if no, rewrite the code in order to be correct. The point of a warning is not, as I'm often getting the impression with your changes, to change the code to get the warning to go away without thinking about what that code is doing. For example... |
|
I would also recommend, despite the low line count, to split this into a few separate PRs so the good changes can be merged without getting blocked by changes that might be more... controversial. |
|
The efficiency of the modified bignum functions was eating at me, so I threw it into Godbolt and chipped away until I found solutions even faster than the originals. For example, Edit: It could be two instructions faster if we always assume n > 0 and move the condition to the end of the loop body, but that would make the function unsafe. |
Source/Core/Common/HttpRequest.h
Outdated
| #include <string> | ||
| #include <vector> | ||
|
|
||
| #include <curl/curl.h> |
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.
Please revert this and the callback change. This causes curl to leak through and defeats the entire purpose of having an abstraction.
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.
Probably instead of using curl_off_t, ProgressCallback could be changed to use s64 (keeping the change in HttpRequest.cpp).
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 hope the new solution I came up with is satisfactory.
Pokechu22
left a comment
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.
Looks good to me. Still needs @leoetlino to review the new implementation where ProgressCallback uses s64.
I could not get the three
-Wignored-attributeswarnings across AES.cpp and SHA1.cpp to go away. I even briefly tried editing libstdc++, but it did not work. For GCC, the-Wunknown-pragmaswarning is still happening in CPUCull.cpp despite the pragmas trying to ignore that diagnostic. I tried moving them out of the #if #else #endif block to see if that would fix it, but it did not. There is room for debate whether the changes for-Wunused-const-variableare best. It's either that or changing to an unscoped enum.I am not situated to test MSVC quickly, so I have not bothered with it.