Make compile-time warnings as errors
Created by: wangkuiyi
I tried to build on Mac using the following command line to capture warnings:
tools/build.sh mac > /tmp/o 2>/tmp/e
And the following command counts 419 compile-time warnings generated by Clang/LLVM:
tr ' ' '\n' < /tmp/e | grep 'warning:' | wc -l
419 is simply too much I am afraid.
I looked into a few cases. Most of them reveal some serious problems. For example
-
https://github.com/PaddlePaddle/paddle-mobile/blob/develop/src/common/type_define.h#L15 -- C++ directives shouldn't end with
;
. -
This function https://github.com/PaddlePaddle/paddle-mobile/blob/develop/src/framework/data_layout.h#L30-L45 is defined as returning a value, but it doesn't contain the
return
statement at all. -
Here is another case that should have returned a value, but not: https://github.com/PaddlePaddle/paddle-mobile/blob/develop/src/platform/data_type.h#L25