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

Enable more compiler warnings #1578

Closed
wants to merge 5 commits into from

Conversation

MarcelRaad
Copy link
Member

  • enable -Wvla also for clang; it was previously only enabled for GCC
  • enable -W also for mingw32-make based build
  • enable -Wdouble-promotion for both GCC and clang (typically warns when mixing float and double by accident)
  • enable -Wmissing-variable-declarations for clang (typically warns when forgetting to declare variables static)
  • enable -Wcomma for clang (see b875250 for a typical case)

All of these are fixed and trivial to fix. Tested with all possible combinations of

  • clang 3.5 to 5.0, GCC 5 to 7
  • native Ubuntu, Cygwin64 on Windows, MinGW on Windows (MSYS), MinGW-w64 on Windows (MSYS2 and native), MinGW-w64 on Ubuntu
  • 32 bit and 64 bit targets
  • OpenSSL, GnuTLS, NSS, CyaSSL/WolfSSL, mbedTLS, PolarSSL, and WinSSL backends

I could also push a subset if anyone feels that some of these warnings make no sense.

Previously, that warning was only implicitly active in C90 mode.
Enable it unconditionally as already done for GCC.
Enable -Wdouble-promotion for both GCC and clang. It warns on implicit
promotion from float to double.
It usually warns when forgetting to declare TU-local variables static.
It usually warns when using commas instead of semicolons or other
operators by accident.
The configure-based build also has this in addition to -Wall.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.004%) to 73.402% when pulling b56caa8 on MarcelRaad:enable_warnings into e9422bc on curl:master.

Copy link
Member

@bagder bagder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm 👍 on more warning options!

@MarcelRaad
Copy link
Member Author

Thanks!

@MarcelRaad
Copy link
Member Author

Strange, why didn't the "Closes #1578" work, can only one commit have that?
Merged in ce2cc56.

@MarcelRaad MarcelRaad closed this Jun 16, 2017
@MarcelRaad MarcelRaad deleted the enable_warnings branch June 16, 2017 20:38
MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Jun 16, 2017
Previously, that warning was only implicitly active in C90 mode.
Enable it unconditionally as already done for GCC.

Closes curl#1578
MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Jun 16, 2017
Enable -Wdouble-promotion for both GCC and clang. It warns on implicit
promotion from float to double.

Closes curl#1578
MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Jun 16, 2017
It usually warns when forgetting to declare TU-local variables static.

Closes curl#1578
MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Jun 16, 2017
It usually warns when using commas instead of semicolons or other
operators by accident.

Closes curl#1578
MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Jun 16, 2017
The configure-based build also has this in addition to -Wall.

Closes curl#1578
@jay
Copy link
Member

jay commented Jun 16, 2017

Strange, why didn't the "Closes #1578" work, can only one commit have that?

It seems odd that it would be limited in that way. Probably there was some lag and you just beat it to the punch.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants