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 -Wstrict-prototypes 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
Note that the majority of errors will be functions that take no arguments that weren't declared/defined as (void). Be careful to not add a 'void' where it's actually an old kr empty argument declaration, though. Submit you work as a single patch file, see http://brlcad.org/wiki/Patches
There are about 99 unique places in the code that need fixing.
File name/URL | File size | Date submitted | |
---|---|---|---|
prototypes.patch | 71.2 KB | January 14 2013 03:33 UTC | |
prototypes2.patch | 71.2 KB | January 15 2013 01:08 UTC |
I would like to work on this task.
This task has been assigned to SB9595. You have 72 hours to complete this task, good luck!
The claim on this task has been removed, someone else can claim it now.
Why would you do that?
I would like to work on this task.
This task has been assigned to javamonn. You have 72 hours to complete this task, good luck!
Well, this task has taken me far longer than I had originally anticipated. I started with compiling with the -Wstrict-prototypes flag, and saved the warnings to a log. I then used a script to go through the log and change all the places where a warning was thrown and added in a void into the prototype, since I figured these were the vast majority of cases and that I could go back and do the final edits by hand.
For some reason, the vast majority of the cases are not that the prototypes lack a void in the definition, It seems like whoever coded some of these header files just got lazy. I'm having to go through and grep each function to find the original signature so I can correctly write the prototype. Note that this is certainly not hard work, just extremely tedious and time consuming.
I've spent well over 10 hours on this so far, and I've worked my way up to ~70% compile. I don't think I'll be able to finish it in time with gci ending tommorow, but I'd be happy to submit what I have now as a proof of concept or whatever, and then submit the whole patch to the tracker later in the week. Let me know what you want me to do.
Thanks,
Daniel
Melange has detected that the initial deadline has passed and it has set the task status to ActionNeeded. The student has 24 hours to submit the work before the task is reopened and sent back to the pool for other students to claim.
if you think you did enough for a GCi task.
The work on this task is ready to be reviewed.
with standard CMake generated make files (no -Wstrict-prototypes):
/home/rossberg/Devel/brlcad/src/libdm/tcl.c: In function ‘dm_validXType_tcl’:
/home/rossberg/Devel/brlcad/src/libdm/tcl.c:65:5: error: passing argument 1 of ‘dm_validXType’ discards ‘const’ qualifier from pointer target type [-Werror]
/home/rossberg/Devel/brlcad/src/libdm/tcl.c:41:12: note: expected ‘char *’ but argument is of type ‘const char *’
/home/rossberg/Devel/brlcad/src/libdm/tcl.c:65:5: error: passing argument 2 of ‘dm_validXType’ discards ‘const’ qualifier from pointer target type [-Werror]
/home/rossberg/Devel/brlcad/src/libdm/tcl.c:41:12: note: expected ‘char *’ but argument is of type ‘const char *’
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
The deadline of the task has been extended with 1 days and 0 hours.
Javamonn, Since there's only two hours remaining, go ahead and mark the task as needing review (again) so we can mark it complete. We'll need to fix the const errors but I think you probably invested more than a couple hours on this task already.. :)
The work on this task is ready to be reviewed.
I removed the line from the patch that was causing the problem. It's still an old style prototype but at least it will compile now. I wasn't getting that error on my end, oddly enough.
Thanks for all the help though, with everything. The mentors for this project have been extremely helpful. GCI has been alot of fun. Whats the best way to stay involved, going forward? Is there somewhere where bugs or other requests for code changes and fixes are posted? I enjoy having something to do, and its a great exercise as far as getting better with C.
Congratulations, this task has been completed successfully.