Hi, this is the third version of this patch series that adapts one of our CI jobs to compile with `-Og` for improved coverage of warnings. Changes compared to v2: - Typo fixes for commit messages. - Replaced the `O` variable with `CFLAGS_APPEND`. If that isn't palatable to folks then I'll drop this altogether and will inline it into the CI script, duplicating the default CFLAGS there. - Start compiling with V=1 so that the change can actually be seen. It also shouldn't clutter the job output too much given that the build is in a collapsible section on both GitHub and GitLab. Patrick Patrick Steinhardt (4): ci: fix check for Ubuntu 20.04 Makefile: add ability to append to CFLAGS and LDFLAGS ci: compile code with V=1 ci: compile "linux-gcc-default" job with -Og Makefile | 2 ++ ci/lib.sh | 2 +- ci/run-build-and-tests.sh | 11 ++++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) Range-diff against v2: 1: f91004a438 = 1: 70fa755b4f ci: fix check for Ubuntu 20.04 -: ---------- > 2: d68539834f Makefile: add ability to append to CFLAGS and LDFLAGS -: ---------- > 3: a3dfb7092a ci: compile code with V=1 2: bdf0e40a77 ! 4: c7b5b62d9c ci: compile "linux-gcc-default" job with -Og @@ Commit message We have recently noticed that our CI does not always notice variables that may be used uninitialized. While it is expected that compiler - warnings aren't perfect, this one was a but puzzling because it was + warnings aren't perfect, this one was a bit puzzling because it was rather obvious that the variable can be uninitialized. Many compiler warnings unfortunately depend on the optimization level @@ Commit message Instead, adapt the "linux-gcc-default" job to compile with `-Og`. This job is chosen because it uses the "ubuntu:latest" image and should thus have a comparatively recent compiler toolchain, and because we have - other jobs that use "ubuntu:latest" so that we do not loose coverage for + other jobs that use "ubuntu:latest" so that we do not lose coverage for warnings diagnosed only on `-O2` level. To make it easier to set up the optimization level in our CI, add @@ Commit message Signed-off-by: Patrick Steinhardt <ps@xxxxxx> - ## Makefile ## -@@ Makefile: endif - # tweaked by config.* below as well as the command-line, both of - # which'll override these defaults. - # Older versions of GCC may require adding "-std=gnu99" at the end. --CFLAGS = -g -O2 -Wall -+O ?= 2 -+CFLAGS = -g -O$(O) -Wall - LDFLAGS = - CC_LD_DYNPATH = -Wl,-rpath, - BASIC_CFLAGS = -I. - ## ci/run-build-and-tests.sh ## @@ ci/run-build-and-tests.sh: esac run_tests=t @@ ci/run-build-and-tests.sh: esac + # `-O2` will mask others. We thus use `-Og` here just so that we have + # at least one job with a different optimization level so that we can + # overall surface more warnings. -+ export O=g ++ export CFLAGS_APPEND=-Og + ;; linux-gcc) export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main -- 2.45.2.436.gcd77e87115.dirty
Attachment:
signature.asc
Description: PGP signature