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

#if when #ifdef should be used - inconsistent with AWS SDK C++ #330

Closed
M-Pixel opened this issue Feb 9, 2022 · 8 comments
Closed

#if when #ifdef should be used - inconsistent with AWS SDK C++ #330

M-Pixel opened this issue Feb 9, 2022 · 8 comments
Assignees
Labels
bug This issue is a bug. CRT/SDK

Comments

@M-Pixel
Copy link

M-Pixel commented Feb 9, 2022

The include headers contain a mix of #if _MSC_VER and #ifdef _MSC_VER. When compiled with strict warning-as-error settings, this produces the error '_MSC_VER' is not defined, evaluates to 0. The problem cannot be solved by defining _MSC_VER=0 in the build system, because this would cause the #ifdef statements to produce false-positives. The #ifs should be replaced with #ifdefs. This occurs with at least one other symbol in addition to _MSC_VER.

@jmklix
Copy link
Member

jmklix commented Feb 28, 2023

Thanks for pointing this out. Looking into making these changes

@jmklix
Copy link
Member

jmklix commented Feb 28, 2023

All of the changes have been merged. Please allow for a few days before all of the dependencies are updated. Or you can manually update them yourself if you would like to test the changes now.

@graebm
Copy link
Contributor

graebm commented Mar 1, 2023

aws-crt-cpp v0.19.8 contains all fixes

@JBakamovic
Copy link

JBakamovic commented Mar 14, 2023

@graebm Unfortunately the same happens with a few other symbols and which makes it incredibly easy to miss the actual important warnings because the build output is quite bloated with these warnings.

Could you please address the following symbols as well, please?

  • __clang_analyzer__
  • __APPLE__
  • __linux__
  • AWS_DEEP_CHECKS

P.S. I would do it myself but looks more involved than what I would expect for s/#if /#ifdef /g look alike change so there must be a context I am missing.

@graebm
Copy link
Contributor

graebm commented Mar 16, 2023

what compiler version, and what warning level are you setting?

Are you setting this warning level on your application? (valid)

Or are you setting it globally via CFLAGS and CXXFLAGS environment variables before compiling aws-crt-cpp? (workaround: don't do that)

@graebm graebm reopened this Mar 16, 2023
@graebm
Copy link
Contributor

graebm commented Mar 17, 2023

Ah, you're using MSVC
You can disable warnings from external headers via:
https://learn.microsoft.com/en-us/cpp/build/reference/external-external-headers-diagnostics

@JBakamovic
Copy link

The warning level is set on the application level - through cmake. The code is built with GCC (11.1.0, 12.1.0), clang (14.0.5, 15.0.6) and MSVC (19.32) and described issues persist on all of those compilers.

@jmklix
Copy link
Member

jmklix commented Aug 28, 2023

This was fixed with the above pr. Please let us know if you notice any other inconsistencies with these repo's

@jmklix jmklix closed this as completed Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. CRT/SDK
Projects
None yet
Development

No branches or pull requests

4 participants