如何禁用启用源代码强化后出现的警告消息

时间:2017-01-18 11:13:26

标签: c compiler-errors

我们最近在项目中添加了以下编译器标志,作为代码强化的一部分。

2017/01/18 11:35:17 [debug] 19626#19626: *67 event timer: 18, old: 1484739321930, new: 1484739322088
2017/01/18 11:35:17 [debug] 19626#19626: *67 http empty handler
2017/01/18 11:35:17 [debug] 19626#19626: *67 http lingering close handler
2017/01/18 11:35:17 [debug] 19626#19626: *67 SSL_read: 0
2017/01/18 11:35:17 [debug] 19626#19626: *67 SSL_get_error: 5
2017/01/18 11:35:17 [debug] 19626#19626: *67 peer shutdown SSL cleanly
2017/01/18 11:35:17 [debug] 19626#19626: *67 lingering read: 0
2017/01/18 11:35:17 [debug] 19626#19626: *67 http request count:1 blk:0
2017/01/18 11:35:17 [debug] 19626#19626: *67 http close request
2017/01/18 11:35:17 [debug] 19626#19626: *67 http log handler
2017/01/18 11:35:17 [debug] 19626#19626: *67 free: 000055FE7759C630
2017/01/18 11:35:17 [debug] 19626#19626: *67 free: 000055FE77598150
2017/01/18 11:35:17 [debug] 19626#19626: *67 free: 000055FE775C43F0, unused: 4
2017/01/18 11:35:17 [debug] 19626#19626: *67 free: 000055FE77539DB0, unused: 8
2017/01/18 11:35:17 [debug] 19626#19626: *67 free: 000055FE775AB400, unused: 2446
2017/01/18 11:35:17 [debug] 19626#19626: *67 close http connection: 18
2017/01/18 11:35:17 [debug] 19626#19626: *67 SSL_shutdown: 1
2017/01/18 11:35:17 [debug] 19626#19626: *67 event timer del: 18: 1484739321930
2017/01/18 11:35:17 [debug] 19626#19626: *67 reusable connection: 0
2017/01/18 11:35:17 [debug] 19626#19626: *67 free: 000055FE775A0A80
2017/01/18 11:35:17 [debug] 19626#19626: *67 free: 000055FE775D1BE0
2017/01/18 11:35:17 [debug] 19626#19626: *67 free: 000055FE775AF660, unused: 16
2017/01/18 11:35:17 [debug] 19626#19626: *67 free: 000055FE775E9CC0, unused: 400

对于某些版本,也启用了Werror。

我的问题是,在添加上面的标志之后,我们正在获得潜在缓冲区溢出的编译器警告。

ARCH_CFLAGS+= -fstack-protector
ARCH_CFLAGS+= -D_FORTIFY_SOURCE=2

这会在构建过程中触发失败。我们必须根本导致失败,修补它,重新触发构建只是为了让它继续前进并在其他位置失败。

是否有任何方法可以防止这些缓冲区溢出相关的警告在编译期间出现(不删除强化标记)。简而言之,我想避免Ex. In function ‘memset’, inlined from ‘some_function’ at some_file.c:436:13: /usr/include/i386-linux-gnu/bits/string3.h:84:3: error: call to __builtin___memset_chk will always overflow destination buffer [-Werror] return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest)); 标志行为。

提前致谢。

0 个答案:

没有答案