Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
COMMON: Silence MSVC warning for Common::gcd calls with an unsigned type
- Loading branch information
Showing
1 changed file
with
7 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
89e954c
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.
Shouldn't these pragmas only be used for MSVC, it seems a bit risky to enable them for all compilers.
89e954c
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 already disable unknown pragmas warnings for both GCC and Visual Studio (we have GCC specific pragmas in the code).
I don't mind marking those as MSVC specific, but then we should really update the scumm engine code too and add back the warnings.
89e954c
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.
What gcc specific pragmas do we use for all compilers?
89e954c
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.
mark is used quite a lot in the scumm engine code (and I also use region quite a bit in ring, which is sort of the MSVC equivalent, but it's not a concern as it's not in master)
MSVC will happily ignore all those when silencing warning 4068 (the same way GCC does with -Wno-unknown-pragmas).
89e954c
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.
89e954c
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.
Reading through it yes, it looks like pragma mark is used by Xcode to add labels.
Anyway unlike "mark" (which is probably a no-op for gcc+darwin) "warning" is also used as a pragma in icc for example. Since I don't think icc and msvc have the same warning numbers it seems not that good to have such code enabled by default. In this case it might be harmless, but to avoid other people copying the same code I am strongly against having this without guards in our common code.
89e954c
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.
The "#pragma mark" are probably all by me. This pragma still seems from the day of MacOS classic, where many editors and IDEs used it to enrich the "function popups" they usually offered. That is, at the top of the window, you had a button that when pressed shows a menu with all global symbols defined in the file, in order, intermixed with any "#pragma mark" values.
On Mac OS X, many editors support this till this day, e.g. BBEdit, my primary editor.
For me, it just helped to structure various files and make them more "accessible". Alas, if they bother people a lot, we can remove them, although I am pretty sure they are 100% harmless.