We hold BRL-CAD to a rather high standard of code quality. We compile with nearly every useful warning that GCC is capable of producing and consider all warnings as errors that stop compilation. This is done because many/most warnings are "code smells" that are eventually usually costly to ignore over time.
This task involves adding the -Wold-style-definition warning to our compilation and fixing the issues that result. You can add the flag by editing misc/CMake/BRLCAD_CompilerFlags.cmake
Make sure you compile cleanly before beginning. Make sure you're using a fresh SVN checkout. See http://brlcad.org/wiki/Compiling for help.
Protip: run this to save all errors to a file so you can work on them in bulk: make -k 21 | tee build.log
Submit you work as a single patch file, see http://brlcad.org/wiki/Patches
File name/URL | File size | Date submitted | |
---|---|---|---|
Wold-style-definition.patch | 54.6 KB | December 27 2012 04:13 UTC |
I would like to work on this task.
This task has been assigned to javamonn. You have 48 hours to complete this task, good luck!
The work on this task is ready to be reviewed.
I was able to fix all warnings except for one function in termio.c. I couldn't figure out what type to set the parameters and still retain the portability, since C doesn't allow for overloading. I left it how it was. Let me know if I need to make any other changes.
Thanks,
Daniel
What issue in termio? Can you also provide the compilation log? Thanks!
Congratulations, this task has been completed successfully.
Where can I submit the build log, and also a revised patch? I made a couple tweaks to the patch, it wouldn't compile before apparently. As far as termio, it has two functions in which the parameter types are system dependent. In the old c fasion, it was defined:
static void
copy_Tio(to, from)
#ifdef BSD
struct sgttyb *to, *from;
#endif
#ifdef SYSV
struct termio *to, *from;
#endif
#ifdef HAVE_TERMIOS_H
struct termios *to, *from;
#endif
{
//function body
}
Now, im unsure as to how to convert this into a single method signature so it doesn't throw a warning? I mean you could use a void pointer and just cast it, but it still throws a warning. Could a union possibly be used for this?
You can submit your updated files to our Sourceforget patches tracker and just leave a comment here with the URL. You can attach files to the tracker item you create.
As for the crazy ifdef logic, just create three copies of the copy_Tio() declaration line protected by the same/similar three ifdefs.