#32 Please add -Werror

closed
nobody
None
5
2009-06-23
2009-06-18
No

I'm pretty happy that you have -Wall turned on (report all warnings) and it would be great if you took the next step of using -Werror (treat warnings as errors).
In the last couple of years I've been using -Wall -Werror on my code and have been happier for it. It's worth it.

Discussion

  • Nick Mathewson

    Nick Mathewson - 2009-06-19

    If you use GCC, try configuring with --enable-gcc-warnings; you'll be pleasantly surprised:

    (example:

    gcc -DHAVE_CONFIG_H -I. -I./compat -I./include -g -O2 -Wall -fno-strict-aliasing -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wbad-function-cast -Wswitch-enum -Werror -Wno-unused-parameter -Wno-sign-compare -Wstrict-aliasing -Winit-self -Wmissing-field-initializers -Wdeclaration-after-statement -MT event.lo -MD -MP -MF .deps/event.Tpo -c event.c -fno-common -DPIC -o .libs/event.o )

     
  • Dave Schuyler

    Dave Schuyler - 2009-06-23

    Ahh, I see now where I confused the error messags: I was using g++ to compile the .c files and that is more strict with type conversion and such (such as the return value from malloc being a void* instead of a char* and so on).

    I can see reasons to and not to use g++ on the .c files so, I'll leave that to you to consider (or not). I'm ok with closing this feature request if you like.

    Thanks, by the way, for the tip on ./configure

     
  • Nick Mathewson

    Nick Mathewson - 2009-06-23
    • status: open --> closed
     
  • Nick Mathewson

    Nick Mathewson - 2009-09-14

    Closing. We'd like our code to remain valid C++ (at least in the header files), but there's no good reason to have the files be warning-free C++. To do so would require some terribly non-C idioms (like casting malloc(), apparently).