-
-
Notifications
You must be signed in to change notification settings - Fork 427
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
Fix Clang Compile Warnings/Errors (and Typos) #386
Conversation
@geometrian Thanks! I didn't realized there are so much typos in comments 😅 For header filename capitalization, IIRC it was an annoying issue of the combination of compiler front-end's (virtual) filesystem and underlying OS' filesystem(especially emerges when cross-compiling). For example MinGW uses all lower-case header filenames. So I gave up using Capitalized header file name.
so possible solution may be...
|
Yah; I noticed it failed on MinGW when the CI check failed, and pushed another commit up, which fixes it. It works similarly to what you just now suggested: it normally uses Another solution to consider for Clang particularly would be to temporarily disable the warning for |
@geometrian Thanks! Merged!
Since tinygltf uses few WIn32 API, how about declare it explicitly in tiny_gltf.h and do not include |
Not sure what you mean? Like, making the user include
Just to clarify, the idea there was to make Clang be quiet about the nonportability of the filename. The warning is correct, but not fixable by anyone for this particular file now that MS has defined different cases, nor relevant to actual portability given that it's a platform-specific header. Disabling the warning to ignore fundamental brokenness is just as good in my head as patching around the brokenness. |
Yes I meant it: e.g.
This would be also an solution. Additional PR to suppress clang warning for |
Err, the solutions are orthogonal; only one is required. If you really wanted to, you could do both: #ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonportable-system-include-path"
#endif
//(Windows.h include stuff here.)
#ifdef __clang__
#pragma clang diagnostic pop
#endif but again there's no point, since the header is now being included more portably. If you're just using it for |
Clang (e.g. 14.0.5) issues compile errors for several issues when compiled with strict settings. Specifically, the capitalization of the Windows header file is incorrect,
NULL
is accidentally used in some places, and there are some implicit casts and signedness comparisons that should be clarified.There are also a lot of typos both in the comments and in error messages.
This PR fixes all identified issues, separated into two commits which can be cherrypicked as the repository manager desires.