1 |
commit: 5346802bc7ca09955020d265b4a15e8ecf67a28f |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Sep 12 09:26:26 2014 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Fri Sep 26 01:22:13 2014 +0000 |
6 |
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5346802b |
7 |
|
8 |
Update gcc warning checks to work with colored output |
9 |
|
10 |
Use -W indicators whenever possible, or more flexible regular |
11 |
expressions so that our checks correctly match output with |
12 |
-fdiagnostics-color. Also, enable a few extra warnings with some |
13 |
of the currently used -W flags. |
14 |
|
15 |
Based on the patch from Ryan Hill <rhill <AT> gentoo.org>. |
16 |
|
17 |
--- |
18 |
bin/install-qa-check.d/90gcc-warnings | 85 +++++++++++++++++++++-------------- |
19 |
1 file changed, 52 insertions(+), 33 deletions(-) |
20 |
|
21 |
diff --git a/bin/install-qa-check.d/90gcc-warnings b/bin/install-qa-check.d/90gcc-warnings |
22 |
index ae39485..48c11e4 100644 |
23 |
--- a/bin/install-qa-check.d/90gcc-warnings |
24 |
+++ b/bin/install-qa-check.d/90gcc-warnings |
25 |
@@ -13,44 +13,63 @@ gcc_warn_check() { |
26 |
reset_debug=1 |
27 |
fi |
28 |
local m msgs=( |
29 |
- ": warning: dereferencing type-punned pointer will break strict-aliasing rules" |
30 |
- ": warning: dereferencing pointer .* does break strict-aliasing rules" |
31 |
- ": warning: implicit declaration of function" |
32 |
- ": warning: incompatible implicit declaration of built-in function" |
33 |
- ": warning: is used uninitialized in this function" # we'll ignore "may" and "might" |
34 |
- ": warning: comparisons like X<=Y<=Z do not have their mathematical meaning" |
35 |
- ": warning: null argument where non-null required" |
36 |
- ": warning: array subscript is below array bounds" |
37 |
- ": warning: array subscript is above array bounds" |
38 |
- ": warning: attempt to free a non-heap object" |
39 |
- ": warning: .* called with .*bigger.* than .* destination buffer" |
40 |
- ": warning: call to .* will always overflow destination buffer" |
41 |
- ": warning: assuming pointer wraparound does not occur when comparing" |
42 |
- ": warning: hex escape sequence out of range" |
43 |
- ": warning: [^ ]*-hand operand of comma .*has no effect" |
44 |
- ": warning: converting to non-pointer type .* from NULL" |
45 |
- ": warning: NULL used in arithmetic" |
46 |
- ": warning: passing NULL to non-pointer argument" |
47 |
- ": warning: the address of [^ ]* will always evaluate as" |
48 |
- ": warning: the address of [^ ]* will never be NULL" |
49 |
- ": warning: too few arguments for format" |
50 |
- ": warning: reference to local variable .* returned" |
51 |
- ": warning: returning reference to temporary" |
52 |
- ": warning: function returns address of local variable" |
53 |
- ": warning: .*\\[-Wsizeof-pointer-memaccess\\]" |
54 |
- ": warning: .*\\[-Waggressive-loop-optimizations\\]" |
55 |
+ # only will and does, no might :) |
56 |
+ 'warning: .*will.*\[-Wstrict-aliasing\]' |
57 |
+ 'warning: .*does.*\[-Wstrict-aliasing\]' |
58 |
+ # implicit declaration of function ‘...’ |
59 |
+ 'warning: .*\[-Wimplicit-function-declaration\]' |
60 |
+ # with -Wall, goes in pair with -Wimplicit-function-declaration |
61 |
+ # but without -Wall, we need to assert for it alone |
62 |
+ 'warning: .*incompatible implicit declaration of built-in function' |
63 |
+ # 'is used uninitialized in this function' and some more |
64 |
+ 'warning: .*\[-Wuninitialized\]' |
65 |
+ # comparisons like ‘X<=Y<=Z’ do not have their mathematical meaning |
66 |
+ 'warning: .*mathematical meaning*\[-Wparentheses\]' |
67 |
+ # null argument where non-null required |
68 |
+ 'warning: .*\[-Wnonnull\]' |
69 |
+ # array subscript is above/below/outside array bounds |
70 |
+ 'warning: .*\[-Warray-bounds\]' |
71 |
+ # attempt to free a non-heap object |
72 |
+ 'warning: .*\[-Wfree-nonheap-object\]' |
73 |
+ # those three do not have matching -W flags, it seems |
74 |
+ 'warning: .*will always overflow destination buffer' |
75 |
+ 'warning: .*assuming pointer wraparound does not occur' |
76 |
+ 'warning: .*escape sequence out of range' |
77 |
+ # left/right-hand operand of comma expression has no effect |
78 |
+ 'warning: .*comma.*\[-Wunused-value\]' |
79 |
+ # converting to non-pointer type ... from NULL and likes |
80 |
+ 'warning: .*\[-Wconversion-null\]' |
81 |
+ # NULL used in arithmetic |
82 |
+ 'warning: .*NULL.*\[-Wpointer-arith\]' |
83 |
+ # pointer to a function used in arithmetic and likes |
84 |
+ 'warning: .*function.*\[-Wpointer-arith\]' |
85 |
+ # the address of ... will never be NULL and likes |
86 |
+ # (uses of function refs & string constants in conditionals) |
87 |
+ 'warning: .*\[-Waddress\]' |
88 |
+ # outdated? |
89 |
+ 'warning: .*too few arguments for format' |
90 |
+ # format ... expects a matching ... argument |
91 |
+ # (iow, too few arguments for format in new wording :)) |
92 |
+ 'warning: .*matching.*\[-Wformat=\]' |
93 |
+ # function returns address of local variable |
94 |
+ 'warning: .*\[-Wreturn-local-addr\]' |
95 |
+ # argument to sizeof ... is the same expression as the source |
96 |
+ 'warning: .*\[-Wsizeof-pointer-memaccess\]' |
97 |
+ # iteration invokes undefined behavior |
98 |
+ 'warning: .*\[-Waggressive-loop-optimizations\]' |
99 |
+ |
100 |
# this may be valid code :/ |
101 |
- #": warning: multi-character character constant" |
102 |
+ #': warning: multi-character character constant' |
103 |
# need to check these two ... |
104 |
- #": warning: assuming signed overflow does not occur when" |
105 |
- #": warning: comparison with string literal results in unspecified behav" |
106 |
+ #': warning: assuming signed overflow does not occur when' |
107 |
+ #': warning: comparison with string literal results in unspecified behav' |
108 |
# yacc/lex likes to trigger this one |
109 |
- #": warning: extra tokens at end of .* directive" |
110 |
+ #': warning: extra tokens at end of .* directive' |
111 |
# only gcc itself triggers this ? |
112 |
- #": warning: .*noreturn.* function does return" |
113 |
+ #': warning: .*noreturn.* function does return' |
114 |
# these throw false positives when 0 is used instead of NULL |
115 |
- #": warning: missing sentinel in function call" |
116 |
- #": warning: not enough variable arguments to fit a sentinel" |
117 |
+ #': warning: missing sentinel in function call' |
118 |
+ #': warning: not enough variable arguments to fit a sentinel' |
119 |
) |
120 |
local abort="no" |
121 |
local i=0 |