aws / aws/aws-encryption-sdk-c
Ensure consistent compiler warn/error flags
- Dominant language
- C
- Stars
- 63
- Forks
- 59
- PR merge metrics
- No merged PRs in 30d
Description
In finding https://github.com/aws/aws-encryption-sdk-c/pull/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.
Contributor guide
Research direction
Start with source/default_cmm.c:55 and the changes or discussion in pull request 687. Compare the compiler warning and error flags shown in the issue with the configuration that reports the tautological comparison error. Done means identifying the cause of the discrepancy and documenting or implementing a consistent compiler-flag behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100