From de645ea16c441ca7364e030d2659e950ee540f74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Fri, 8 Jan 2021 12:24:44 +0100 Subject: ci: enable format attributes in ncurses headers Avoid format string issues like bfcb8ca0 by helping compilers spot such bogus usages. Also use LTO and O3 in the full-featured gcc job, which might trigger additional warnings on advanced inlining, like 3695cbd5d8dda27f99383437035450814463b633 and ad3acfc847e9d54f07a0684c19181d5f4c28fee4 --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3c0c62c..5de7c19e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,11 @@ name: CI on: [ push, pull_request ] +env: + # Enable format attributes in ncurses headers + # Enable fortified memory/string handling + CPPFLAGS: -DGCC_PRINTF -DGCC_SCANF -D_FORTIFY_SOURCE=2 + jobs: build-ubuntu-latest-minimal-gcc: runs-on: ubuntu-latest @@ -47,6 +52,10 @@ jobs: build-ubuntu-latest-full-featured-gcc: runs-on: ubuntu-latest + # Enable LTO, might trigger additional warnings on advanced inlining + env: + CFLAGS: -O3 -g -flto + LDFLAGS: -O3 -g -flto steps: - uses: actions/checkout@v2 - name: Install Dependencies -- cgit v1.2.3 From 2d2a2df6f22715e1d7a6518e186918ee642e7293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Fri, 8 Jan 2021 13:51:21 +0100 Subject: Refactor crash handler message to avoid embedded directive CRT.c:821:2: error: embedding a directive within macro arguments has undefined behavior [-Werror,-Wembedded-directive] #ifdef HAVE_EXECINFO_H ^ CRT.c:823:2: error: embedding a directive within macro arguments has undefined behavior [-Werror,-Wembedded-directive] #endif ^ CRT.c:858:2: error: embedding a directive within macro arguments has undefined behavior [-Werror,-Wembedded-directive] #ifdef HTOP_DARWIN ^ CRT.c:862:2: error: embedding a directive within macro arguments has undefined behavior [-Werror,-Wembedded-directive] #endif ^ CRT.c:864:2: error: embedding a directive within macro arguments has undefined behavior [-Werror,-Wembedded-directive] #ifdef HTOP_DARWIN ^ CRT.c:868:2: error: embedding a directive within macro arguments has undefined behavior [-Werror,-Wembedded-directive] #endif ^ --- CRT.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/CRT.c b/CRT.c index 7ae7c122..de123ca7 100644 --- a/CRT.c +++ b/CRT.c @@ -818,9 +818,13 @@ void CRT_handleSIGSEGV(int signal) { "- Your OS and kernel version (uname -a)\n" "- Your distribution and release (lsb_release -a)\n" "- Likely steps to reproduce (How did it happened?)\n" + ); + #ifdef HAVE_EXECINFO_H - "- Backtrace of the issue (see below)\n" + fprintf(stderr, "- Backtrace of the issue (see below)\n"); #endif + + fprintf(stderr, "\n" ); @@ -855,11 +859,15 @@ void CRT_handleSIGSEGV(int signal) { "you should provide a disassembly of your binary.\n" "This can usually be done by running the following command:\n" "\n" + ); + #ifdef HTOP_DARWIN - " otool -tvV `which htop` > ~/htop.otool\n" + fprintf(stderr, " otool -tvV `which htop` > ~/htop.otool\n"); #else - " objdump -d -S -w `which htop` > ~/htop.objdump\n" + fprintf(stderr, " objdump -d -S -w `which htop` > ~/htop.objdump\n"); #endif + + fprintf(stderr, "\n" "Please include the generated file in your report.\n" "\n" -- cgit v1.2.3