Adaptation of Issues Introduced by -Werror
Error Information
When the compilation option -Werror is enabled, the compiler converts all warnings into errors. Unlike warnings, errors block the build. The format of such error is as follows:
1 | test.c:6:1: error: non-void function does not return a value [-Werror,-Wreturn-type] |
Issue
BiSheng compiler and GNU compiler process warnings differently. Therefore, if BiSheng compiler is used, a warning may be added and converted to an error by the -Werror option, which blocks the build.
Solution
You can add the -Wno option to disable the corresponding warning. For example, in the preceding example, if the warning is from the -Wreturn-type option, you can add the -Wno-return-type option (add no- after W) to disable the warning, you can run the grep -Werror command in the root directory of the source code to find the location where the -Werror option is set and add the corresponding -Wno option. In 4.1.0 and later versions, you can enable the -fGNU-warning-compatibility option to prevent all warnings that are different from GNU compiler from being upgraded by the -Werror option. In this way, this issue can be solved in batches.