If you have problems with your kernel ...

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Jarek Pelczar

If you have problems with your kernel ...

Post by Jarek Pelczar »

If you write kernel in C and using GCC, try passing options -Wall -Werror to compiler. I helped me today to catch many bugs in kernel (e.g. valued passed to function in wrong order).
Gnome

RE:If you have problems with your kernel ...

Post by Gnome »

Sound advice. I make it a policy to do this on all my code. The -Werror isn't necessary. I believe I have the -Werror turned off right now in my CFLAGS. I turn it on when I'm finishing up a section of code, and I want to clean it up before moving on.

One case where pedantic error checking can be a problem is when I put in debugging DIE statements (which expand to an __attribute__((noreturn)) function call), and GCC is too helpful, complaining about code that will never be executed.

Warnings are your friends. When I work in C++, I use flags like -Weffc++.

Gnome
Post Reply