Skip to content

Ensure consistent compiler warn/error flags #688

@alex-chew

Description

@alex-chew

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions