Skip to content
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

Ensure consistent compiler warn/error flags #688

Open
alex-chew opened this issue Jan 15, 2021 · 1 comment
Open

Ensure consistent compiler warn/error flags #688

alex-chew opened this issue Jan 15, 2021 · 1 comment

Comments

@alex-chew
Copy link
Contributor

In finding #687 we found that, for some compiler configurations, the lines in question yielded compilation errors such as

/.../aws-encryption-sdk-c/source/default_cmm.c:55:31: error: result of comparison of constant 65535 with expression of type 'enum aws_cryptosdk_alg_id' is always false
      [-Werror,-Wtautological-constant-out-of-range-compare]
        if (self->default_alg == DEFAULT_ALG_UNSET) {
            ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~
1 error generated.

On the other hand, my compiler doesn't error on this; it uses the following warn/error flags:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -target x86_64-apple-macos10.15
-fmessage-length=118 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions
-DCMAKE_INTDIR=\"Debug\" -DAWS_ENCRYPTION_SDK_SHARED -DAWS_ENCRYPTION_SDK_TEST_SHARED -DAWS_COMMON_USE_IMPORT_EXPORT -DAWS_SDK_VERSION_MAJOR=1 -DAWS_SDK_VERSION_MINOR=8 -DAWS_SDK_VERSION_PATCH=32 -DAWS_EVENT_STREAM_USE_IMPORT_EXPORT -DAWS_ENCRYPTION_SDK_CPP_SHARED -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
-fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -g -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -Wno-semicolon-before-method-body (snip)

We should determine what causes this discrepancy.

@alex-chew
Copy link
Contributor Author

I'm running

$ clang --version
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant