Packages can be compiled with some warnings enabled:
-Wformat
This option performs sanity checks on format strings.
-Wformat-security
This option performs additional sanity checks to printf() and scanf() functions.
-Wstack-protector
This option will warn about functions not protected against stack smashing.
-Werror
This option will cause warnings to be treated as errors.
-Wfatal-errors
This option will cause the compiler to abort on the first error.
The GCC man page contains more details about much more options.