-
Notifications
You must be signed in to change notification settings - Fork 9.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
Compiler Warnings #1036
Comments
I addressed the reported and some more warnings in pull request #1039. |
See also #584 |
@stweil Can this be closed now? |
We still get lots of warnings, for example 1370 warnings with Visual Studio. This issue can be closed if we agree that all those warnings can be ignored. If we care for warnings, we also have to decide which compiler warnings should be enabled for the GNU compiler or for CLANG. |
Is there a way to list unique what the warnings are? I looked at the console output, most seem related to type conversion, but there are some similar to
Some related discussion at |
C4018: '<': signed/unsigned mismatch |
|
CC: @egorpugin About C4566 ... |
Pull request #1554 adds |
Warnings sorted by frequency:
The most common warning is for conversions from |
True, I also build packages with cppan with |
Some source files contain pragmas to suppress msvc's warnings. |
BTW: clang on windows reports these warnings variables:
|
Citing @db4 (from issue #2816):
Travis CI should work for 4.1.1, of course. |
@db4, this is the latest Travis build for 4.1: https://travis-ci.org/tesseract-ocr/tesseract/builds/613358145. We don't use MSVC there. MSVC is used with Appveyor CI: https://ci.appveyor.com/project/zdenop/tesseract/builds/28928329. |
Sure. Of course, I meant Appveyor CI. Here is my failing build: |
And a successful build after |
@zdenop, what do you think? Can we remove |
IMO: Yes, we can remove it from 4.1.1 (e.g. as part of release process ;-) ) and keep it for master/devel. |
I sorted the compiler warnings by their frequency, and 99 % (12924) of all warnings are C4514 (unreferenced inline function has been removed). Is there a command line switch which only suppresses C4514? Then I'd suggest to add that to 4.1 and master. |
/wd4514 iirc |
Thank you, @egorpugin. @db4, could you please test whether |
No:
|
It should be |
@stweil |
@db4, that protocol lists 9557 warnings. The most frequent ones are 3864 times C4820 and 1088 times C4625. So |
Maybe you need also |
@stweil |
I'd disable those warnings in master, too. Not every warning indicates a problem which has to be fixed (for example C4514 is normal), and other warnings are very low priority or shown by gcc or clang compiler, too, so there is no harm when they are disabled for MSVC. As there are still backports of fixes from master to 4.1, disabling all warnings would give us no indicator of any progress or potential new problems. |
Well,
|
https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level?view=vs-2019 MSVC's /Wall seems like Clang's -Weverything. /W<n> should be used instead. |
Yes. |
@db4, branch 4.1 and master now use |
Yes, it is. Thank you very much. |
I am seeing a number of messages like:
Would it be possible to switch the 'debug' flag from 'configure' to include '-Wall -pedantic', or to at least require all patches and changes to compile without any warnings and errors?
It's not unusual for contracts to include a provision that all code must compile without warnings, and it's generally a good practice to at the very least test enough to make sure that you're not getting compiler warnings before heading to production.
It's also much easier for the person who wrote the code to decide if the compiler warnings matter, or, for example, if simply using a cast will result in the same logic if certain bounds are impossible.
I can submit a one time cleanup once #995 is resolved, but in the future it'd be great if reducing compiler warnings would be encouraged.
Environment
The text was updated successfully, but these errors were encountered: