gcc warning: braces around scalar initializer

You should remove the braces: { and } around single values. struct TECH lut_model_1[2] = {{296.001465, 74.216972, 2.025908, 1.516384, 1, {0.001746, 0.000256, 0.006216, 0.005249, -0.001668, -0.001377, 0.009865, 0.010454, -0.000288, -0.005853, 0.010584, 0.015440, 0.000465, -0.000602, 0.004330, 0.005700, 0.017120, 0.233015, 0.034154, 0.244022, 0.007644, 0.385683, 0.042960, 0.406633, -0.007811, 0.346931, 0.040123, 0.387361, 0.007030, 0.225309, 0.017897, 0.241024, 0.003700, 0.103601, 0.060748, … Read more

Is there a way to get warned about unused functions?

Caolan Mc Namara, a LibreOffice developer, has made a small tool to detect this type of thing in LibreOffice source code. They had around thousands functions & methods unused in LibreOffice. His tool is a key element for removing them. It’s called callcatcher. It can collect functions/methods defined and subtract called/referenced It works directly on … Read more

Compiler warning for function defined without prototype in scope?

If you need an option which works on both gcc and clang, your best bet is probably -Wmissing-prototypes. As indicated in the gcc documentation, this will trigger if a global function is defined and either: There was no previous declaration; or The previous declaration had no prototype. It does not complain if the previous declaration … Read more

GCC -Wuninitialized / -Wmaybe-uninitialized issues

Indeed this is a known problem in gcc. gcc is notorious for reporting incorrect uninitialized variables. The shortcomings have been duly noted and there is a initiative to overcome the shortcomings: Better Uninitialized Warnings: The GNU Compiler Collection warns about the use of uninitialized variables with the option -Wuninitialized. However, the current implementation has some … Read more

Why does GCC not warn for unreachable code?

gcc 4.4 will give you warning. In the later versions of gcc this feature (-Wunreachable-code) has been removed. See here: http://gcc.gnu.org/ml/gcc-help/2011-05/msg00360.html The -Wunreachable-code has been removed, because it was unstable: it relied on the optimizer, and so different versions of gcc would warn about different code. The compiler still accepts and ignores the command line … Read more