Skip to content

Commit 1d34c12

Browse files
bors[bot]CastilloDeltschwinge
authored
Merge #1026
1026: Enable -Werror r=tschwinge a=CastilloDel Fixes #694 - \[x] GCC development requires copyright assignment or the Developer's Certificate of Origin sign-off, see https://gcc.gnu.org/contribute.html or https://gcc.gnu.org/dco.html - \[x] Read contributing guidelines - \[ ] `make check-rust` passes locally - \[ ] Run `clang-format` - \[ ] Added any relevant test cases to `gcc/testsuite/rust/` The last three ones shouldn't be necessary for this change. --- Update the CI to use the bootstrap build process and enable -Werror Signed-off-by: Daniel del Castillo <delcastillodelarosadaniel@gmail.com> Co-authored-by: CastilloDel <delcastillodelarosadaniel@gmail.com> Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
2 parents fb88673 + f0b5ac2 commit 1d34c12

File tree

3 files changed

+184
-1
lines changed

3 files changed

+184
-1
lines changed

.github/bors_log_expected_warnings

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
../../../../libffi/src/x86/ffi.c:612:1: warning: label ‘out’ defined but not used [-Wunused-label]
2+
../../../../libssp/ssp.c:172:11: warning: array subscript 0 is outside array bounds of ‘volatile int[0]’ [-Warray-bounds]
3+
../../../libcpp/expr.cc:808:18: warning: format not a string literal and no format arguments [-Wformat-security]
4+
../../../libcpp/expr.cc:811:39: warning: format not a string literal and no format arguments [-Wformat-security]
5+
../../../libcpp/expr.cc:821:34: warning: format not a string literal and no format arguments [-Wformat-security]
6+
../../../libcpp/macro.cc:186:23: warning: format not a string literal and no format arguments [-Wformat-security]
7+
../../../libcpp/macro.cc:215:24: warning: format not a string literal and no format arguments [-Wformat-security]
8+
../../../libcpp/macro.cc:3701:58: warning: format not a string literal and no format arguments [-Wformat-security]
9+
../../../libcpp/macro.cc:3716:58: warning: format not a string literal and no format arguments [-Wformat-security]
10+
../../../libffi/src/java_raw_api.c:317:3: warning: ‘ffi_java_raw_to_ptrarray’ is deprecated [-Wdeprecated-declarations]
11+
../../../libffi/src/java_raw_api.c:328:3: warning: ‘ffi_java_raw_size’ is deprecated [-Wdeprecated-declarations]
12+
../../../libffi/src/java_raw_api.c:331:3: warning: ‘ffi_java_ptrarray_to_raw’ is deprecated [-Wdeprecated-declarations]
13+
../../../libffi/src/java_raw_api.c:369:3: warning: ‘ffi_prep_java_raw_closure_loc’ is deprecated [-Wdeprecated-declarations]
14+
../../../libffi/src/x86/ffi64.c:783:1: warning: label ‘out’ defined but not used [-Wunused-label]
15+
../../../libffi/src/x86/ffiw64.c:250:1: warning: label ‘out’ defined but not used [-Wunused-label]
16+
../../../libssp/ssp.c:172:11: warning: array subscript 0 is outside array bounds of ‘volatile int[0]’ [-Warray-bounds]
17+
../../c++tools/server.cc:486:11: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
18+
../../c++tools/server.cc:616:10: warning: ignoring return value of ‘int pipe(int*)’, declared with attribute warn_unused_result [-Wunused-result]
19+
../../gcc/../libgcc/libgcov-util.c:465:9: warning: ignoring return value of ‘int chdir(const char*)’, declared with attribute warn_unused_result [-Wunused-result]
20+
../../gcc/analyzer/engine.cc:1521:3: warning: too many arguments for format [-Wformat-extra-args]
21+
../../gcc/analyzer/engine.cc:1521:60: warning: unknown conversion type character ‘@’ in format [-Wformat=]
22+
../../gcc/analyzer/program-state.cc:1252:20: warning: format not a string literal and no format arguments [-Wformat-security]
23+
../../gcc/analyzer/sm-file.cc:181:34: warning: too many arguments for format [-Wformat-extra-args]
24+
../../gcc/analyzer/sm-file.cc:181:70: warning: unknown conversion type character ‘@’ in format [-Wformat=]
25+
../../gcc/analyzer/sm-file.cc:231:31: warning: too many arguments for format [-Wformat-extra-args]
26+
../../gcc/analyzer/sm-file.cc:231:63: warning: unknown conversion type character ‘@’ in format [-Wformat=]
27+
../../gcc/analyzer/sm-file.cc:234:31: warning: too many arguments for format [-Wformat-extra-args]
28+
../../gcc/analyzer/sm-file.cc:234:59: warning: unknown conversion type character ‘@’ in format [-Wformat=]
29+
../../gcc/analyzer/sm-malloc.cc:1023:36: warning: too many arguments for format [-Wformat-extra-args]
30+
../../gcc/analyzer/sm-malloc.cc:1023:61: warning: unknown conversion type character ‘@’ in format [-Wformat=]
31+
../../gcc/analyzer/sm-malloc.cc:1193:31: warning: too many arguments for format [-Wformat-extra-args]
32+
../../gcc/analyzer/sm-malloc.cc:1193:67: warning: unknown conversion type character ‘@’ in format [-Wformat=]
33+
../../gcc/analyzer/sm-malloc.cc:1196:31: warning: too many arguments for format [-Wformat-extra-args]
34+
../../gcc/analyzer/sm-malloc.cc:1196:69: warning: unknown conversion type character ‘@’ in format [-Wformat=]
35+
../../gcc/analyzer/sm-malloc.cc:1199:31: warning: too many arguments for format [-Wformat-extra-args]
36+
../../gcc/analyzer/sm-malloc.cc:1200:28: warning: unknown conversion type character ‘@’ in format [-Wformat=]
37+
../../gcc/analyzer/sm-malloc.cc:1269:31: warning: too many arguments for format [-Wformat-extra-args]
38+
../../gcc/analyzer/sm-malloc.cc:1269:66: warning: unknown conversion type character ‘@’ in format [-Wformat=]
39+
../../gcc/analyzer/sm-malloc.cc:1277:31: warning: too many arguments for format [-Wformat-extra-args]
40+
../../gcc/analyzer/sm-malloc.cc:1277:66: warning: unknown conversion type character ‘@’ in format [-Wformat=]
41+
../../gcc/analyzer/sm-malloc.cc:795:7: warning: too many arguments for format [-Wformat-extra-args]
42+
../../gcc/analyzer/sm-malloc.cc:796:24: warning: unknown conversion type character ‘@’ in format [-Wformat=]
43+
../../gcc/analyzer/sm-malloc.cc:796:54: warning: format ‘%s’ expects argument of type ‘char*’, but argument 4 has type ‘diagnostic_event_id_t*’ [-Wformat=]
44+
../../gcc/analyzer/sm-malloc.cc:801:7: warning: too many arguments for format [-Wformat-extra-args]
45+
../../gcc/analyzer/sm-malloc.cc:802:23: warning: unknown conversion type character ‘@’ in format [-Wformat=]
46+
../../gcc/analyzer/sm-malloc.cc:859:34: warning: too many arguments for format [-Wformat-extra-args]
47+
../../gcc/analyzer/sm-malloc.cc:859:70: warning: unknown conversion type character ‘@’ in format [-Wformat=]
48+
../../gcc/analyzer/sm-malloc.cc:930:34: warning: too many arguments for format [-Wformat-extra-args]
49+
../../gcc/analyzer/sm-malloc.cc:930:76: warning: unknown conversion type character ‘@’ in format [-Wformat=]
50+
../../gcc/analyzer/sm-sensitive.cc:138:34: warning: too many arguments for format [-Wformat-extra-args]
51+
../../gcc/analyzer/sm-sensitive.cc:139:22: warning: unknown conversion type character ‘@’ in format [-Wformat=]
52+
../../gcc/c-family/c-common.cc:6580:30: warning: format not a string literal and no format arguments [-Wformat-security]
53+
../../gcc/c-family/c-common.cc:6584:33: warning: format not a string literal and no format arguments [-Wformat-security]
54+
../../gcc/c/c-convert.cc:84:31: warning: format not a string literal and no format arguments [-Wformat-security]
55+
../../gcc/c/c-typeck.cc:11850:42: warning: format not a string literal and no format arguments [-Wformat-security]
56+
../../gcc/c/c-typeck.cc:3689:28: warning: format not a string literal and no format arguments [-Wformat-security]
57+
../../gcc/c/c-typeck.cc:4448:42: warning: format not a string literal and no format arguments [-Wformat-security]
58+
../../gcc/c/c-typeck.cc:6616:43: warning: format not a string literal and no format arguments [-Wformat-security]
59+
../../gcc/collect-utils.cc:237:37: warning: format not a string literal and no format arguments [-Wformat-security]
60+
../../gcc/collect2.cc:2397:37: warning: format not a string literal and no format arguments [-Wformat-security]
61+
../../gcc/config/i386/i386.cc:21446:32: warning: too many arguments for format [-Wformat-extra-args]
62+
../../gcc/config/i386/i386.cc:21446:32: warning: unknown conversion type character ‘{’ in format [-Wformat=]
63+
../../gcc/config/i386/i386.cc:21446:32: warning: unknown conversion type character ‘}’ in format [-Wformat=]
64+
../../gcc/config/i386/i386.cc:2535:8: warning: too many arguments for format [-Wformat-extra-args]
65+
../../gcc/config/i386/i386.cc:2535:8: warning: unknown conversion type character ‘{’ in format [-Wformat=]
66+
../../gcc/config/i386/i386.cc:2535:8: warning: unknown conversion type character ‘}’ in format [-Wformat=]
67+
../../gcc/diagnostic.cc:2021:52: warning: format not a string literal and no format arguments [-Wformat-security]
68+
../../gcc/fold-const.cc:305:42: warning: format not a string literal and no format arguments [-Wformat-security]
69+
../../gcc/gcc.cc:10560:12: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
70+
../../gcc/gcc.cc:7776:9: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
71+
../../gcc/gcc.cc:7779:13: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
72+
../../gcc/gcc.cc:7780:13: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
73+
../../gcc/gcc.cc:7782:9: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
74+
../../gcc/genhooks.cc:112:17: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
75+
../../gcc/genhooks.cc:121:14: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
76+
../../gcc/genhooks.cc:174:14: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
77+
../../gcc/genhooks.cc:180:14: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
78+
../../gcc/gimple-range-gori.cc:411:22: warning: format not a string literal and no format arguments [-Wformat-security]
79+
../../gcc/gimple-ssa-warn-access.cc:3954:15: warning: too many arguments for format [-Wformat-extra-args]
80+
../../gcc/gimple-ssa-warn-access.cc:3962:11: warning: too many arguments for format [-Wformat-extra-args]
81+
../../gcc/ipa-devirt.cc:951:47: warning: format not a string literal and no format arguments [-Wformat-security]
82+
../../gcc/lto-wrapper.cc:1131:8: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
83+
../../gcc/lto-wrapper.cc:1376:52: warning: format not a string literal and no format arguments [-Wformat-security]
84+
../../gcc/lto-wrapper.cc:1957:35: warning: format not a string literal and no format arguments [-Wformat-security]
85+
../../gcc/lto/lto-common.cc:2072:10: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
86+
../../gcc/lto/lto-common.cc:2074:9: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
87+
../../gcc/lto/lto-common.cc:2094:10: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
88+
../../gcc/omp-low.cc:10527:19: warning: ‘T’ conversion used within a quoted sequence [-Wformat=]
89+
../../gcc/omp-offload.cc:2241:22: warning: ‘T’ conversion used within a quoted sequence [-Wformat=]
90+
../../gcc/omp-offload.cc:2279:22: warning: ‘T’ conversion used within a quoted sequence [-Wformat=]
91+
../../gcc/tree-diagnostic-path.cc:177:21: warning: too many arguments for format [-Wformat-extra-args]
92+
../../gcc/tree-diagnostic-path.cc:177:24: warning: unknown conversion type character ‘@’ in format [-Wformat=]
93+
../../gcc/tree-diagnostic-path.cc:177:28: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘diagnostic_event_id_t*’ [-Wformat=]
94+
../../gcc/tree-diagnostic-path.cc:467:12: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘diagnostic_event_id_t*’ [-Wformat=]
95+
../../gcc/tree-diagnostic-path.cc:467:7: warning: too many arguments for format [-Wformat-extra-args]
96+
../../gcc/tree-diagnostic-path.cc:467:9: warning: unknown conversion type character ‘@’ in format [-Wformat=]
97+
../../gcc/tree-diagnostic-path.cc:68:21: warning: too many arguments for format [-Wformat-extra-args]
98+
../../gcc/tree-diagnostic-path.cc:68:23: warning: unknown conversion type character ‘@’ in format [-Wformat=]
99+
../../gcc/tree-diagnostic-path.cc:68:26: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘diagnostic_event_id_t*’ [-Wformat=]
100+
../../gcc/tree-ssa-sccvn.cc:280:67: warning: format not a string literal and no format arguments [-Wformat-security]
101+
../../libcpp/expr.cc:808:18: warning: format not a string literal and no format arguments [-Wformat-security]
102+
../../libcpp/expr.cc:811:39: warning: format not a string literal and no format arguments [-Wformat-security]
103+
../../libcpp/expr.cc:821:34: warning: format not a string literal and no format arguments [-Wformat-security]
104+
../../libcpp/macro.cc:186:23: warning: format not a string literal and no format arguments [-Wformat-security]
105+
../../libcpp/macro.cc:215:24: warning: format not a string literal and no format arguments [-Wformat-security]
106+
../../libcpp/macro.cc:3701:58: warning: format not a string literal and no format arguments [-Wformat-security]
107+
../../libcpp/macro.cc:3716:58: warning: format not a string literal and no format arguments [-Wformat-security]
108+
/home/runner/work/gccrs/gccrs/gccrs-build/x86_64-pc-linux-gnu/32/libssp/../../../../libssp/gets-chk.c:74: warning: the `gets' function is dangerous and should not be used.
109+
/home/runner/work/gccrs/gccrs/gccrs-build/x86_64-pc-linux-gnu/libssp/../../../libssp/gets-chk.c:74: warning: the `gets' function is dangerous and should not be used.
110+
Makefile:864: warning: ignoring old recipe for target 'all-multi'
111+
Makefile:864: warning: ignoring old recipe for target 'all-multi'
112+
Makefile:864: warning: ignoring old recipe for target 'all-multi'
113+
Makefile:864: warning: ignoring old recipe for target 'all-multi'
114+
Makefile:864: warning: ignoring old recipe for target 'all-multi'
115+
Makefile:864: warning: ignoring old recipe for target 'all-multi'
116+
Makefile:864: warning: ignoring old recipe for target 'all-multi'
117+
Makefile:873: warning: overriding recipe for target 'all-multi'
118+
Makefile:873: warning: overriding recipe for target 'all-multi'
119+
Makefile:873: warning: overriding recipe for target 'all-multi'
120+
Makefile:873: warning: overriding recipe for target 'all-multi'
121+
Makefile:873: warning: overriding recipe for target 'all-multi'
122+
Makefile:873: warning: overriding recipe for target 'all-multi'
123+
Makefile:873: warning: overriding recipe for target 'all-multi'
124+
gengtype-lex.cc:357:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
125+
gengtype-lex.cc:357:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
126+
gengtype-lex.cc:357:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
127+
gengtype-lex.cc:357:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
128+
libtool: install: warning: remember to run `libtool --finish /usr/local/libexec/gcc/x86_64-pc-linux-gnu/12.0.1'

.github/workflows/ccpp.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
jobs:
1212
build-and-check:
1313

14+
env:
15+
# Force locale, in particular for reproducible results re '.github/bors_log_expected_warnings' (see below).
16+
LC_ALL: C.UTF-8
17+
1418
runs-on: ubuntu-latest
1519

1620
steps:
@@ -44,9 +48,21 @@ jobs:
4448
--enable-multilib
4549
4650
- name: Build
51+
shell: bash
4752
run: |
4853
cd gccrs-build; \
49-
make -j $(nproc)
54+
make -j $(nproc) 2>&1 | tee log
55+
56+
- name: Check for new warnings
57+
run: |
58+
cd gccrs-build
59+
< log grep 'warning: ' | sort > log_warnings
60+
if diff -U0 ../.github/bors_log_expected_warnings log_warnings; then
61+
:
62+
else
63+
echo 'See <https://github.com/Rust-GCC/gccrs/pull/1026>.'
64+
exit 1
65+
fi >&2
5066
5167
- name: Run Tests
5268
run: |

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,45 @@ Please see the [Contributing to GCC](https://gcc.gnu.org/contribute.html) guide
202202
Not all contributions must be code; we would love to see new test cases or bugs and issues to be reported.
203203
Feel free to add any comments on open PRs
204204

205+
206+
## Continuous Integration
207+
208+
When submitting (or updating) a [GitHub Pull Request](https://github.com/Rust-GCC/gccrs/pull/),
209+
several automated checks are run.
210+
Generally, a "green status" is necessary before merge.
211+
212+
213+
### Compiler Diagnostics
214+
215+
That is, here, diagnostics emitted by the "initial" compiler used to build GCC/Rust.
216+
217+
If building a native toolchain,
218+
GCC by default does a 3-stage bootstrap build (<https://gcc.gnu.org/install/configure.html>).
219+
In addition to making sure that GCC is able to reproduce itself bit-by-bit,
220+
this also means that stages 2+ are built with `-Werror`
221+
(turning most _warning_ into _error_ diagnostics; see `--enable-werror`,
222+
possibly enabled by default).
223+
This helps to catch a good number of bugs, because it enforces that GCC compiles without compiler diagnostics;
224+
it's a requirement for upstream patch submission (<https://gcc.gnu.org/contribute.html#testing>).
225+
226+
GCC generally is only expected to be "warning-clean" without `--disable-bootstrap`
227+
(that is, default `--enable-bootstrap` for a native build),
228+
and not for the initial stage where it's using the "initial" compiler -- otherwise
229+
we're at the mercy of whatever "initial" compiler we're using.
230+
Doing a `--disable-bootstrap` build is much faster, of course, so we're often doing that:
231+
for example, per the instructions above, or in the standard CI.
232+
With that, we're missing out on the aspect that _enforces that GCC compiles without compiler diagnostics_.
233+
234+
To encounter that, the default CI has a [_check for new warnings_ step](https://github.com/Rust-GCC/gccrs/pull/1026)
235+
that verifies in the CI `--disable-bootstrap` build configuration that no new warnings are introduced.
236+
If that step fails, it usually points out a new _warning_ you've introduced erroneously, and should address.
237+
Occasionally it means that simply the `.github/bors_log_expected_warnings` file needs to be updated,
238+
for example if due to any kind of "environmental changes" (for example, CI "initial" compiler changes).
239+
Unless diligently reproducing the CI configuration (in particular "initial" compiler, GCC version),
240+
it's not really feasible to reproduce this check locally.
241+
If in doubt, do a local `--enable-bootstrap` build, or submit your changes, and wait for the CI system's results.
242+
243+
205244
## Community
206245

207246
We can be found on all usual Rust channels such as Zulip, but we also have our own channels:

0 commit comments

Comments
 (0)