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
base: master
from

Conversation

Projects
None yet
4 participants
@MarcelRaad
Member

MarcelRaad commented Jun 16, 2017

  • 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.

MarcelRaad added some commits Jun 14, 2017

curl-compilers.m4: enable vla warning for clang
Previously, that warning was only implicitly active in C90 mode.
Enable it unconditionally as already done for GCC.
curl-compilers.m4: enable double-promotion warning
Enable -Wdouble-promotion for both GCC and clang. It warns on implicit
promotion from float to double.
curl-compilers.m4: enable missing-variable-declarations clang warning
It usually warns when forgetting to declare TU-local variables static.
curl-compilers.m4: enable comma clang warning
It usually warns when using commas instead of semicolons or other
operators by accident.
Makefile.m32: enable -W for MinGW32 build
The configure-based build also has this in addition to -Wall.
@coveralls

This comment has been minimized.

coveralls commented Jun 16, 2017

Coverage Status

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

@bagder

bagder approved these changes Jun 16, 2017

I'm 👍 on more warning options!

@MarcelRaad

This comment has been minimized.

Member

MarcelRaad commented Jun 16, 2017

Thanks!

@MarcelRaad

This comment has been minimized.

Member

MarcelRaad commented Jun 16, 2017

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 MarcelRaad:enable_warnings branch Jun 16, 2017

MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Jun 16, 2017

curl-compilers.m4: enable vla warning for clang
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

curl-compilers.m4: enable double-promotion warning
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

curl-compilers.m4: enable missing-variable-declarations clang warning
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

curl-compilers.m4: enable comma clang warning
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

Makefile.m32: enable -W for MinGW32 build
The configure-based build also has this in addition to -Wall.

Closes curl#1578
@jay

This comment has been minimized.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment