From 005d3a59817374b19a824a13991509e9a3c096b9 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 29 Jan 2021 18:16:00 +0100 Subject: [PATCH] Enable strict-aliasing and implicit-fallthrough warnings GCC needs to have the comment *right before* the case label... blergh --- CMakeLists.txt | 3 +-- src/reader.cpp | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e740087bc..c63b308b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,7 @@ if (CMAKE_GENERATOR STREQUAL "Ninja" AND set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always") endif() + # Enable a whole bunch of warnings, but turn off: # - implicit fallthrough because that does not recognize some cases where it's desired (and I *really* want this one!) # - comment because we use a bunch of those, and they're not really all that harmful. @@ -46,10 +47,8 @@ endif() # - strict-aliasing, because on old GCCs (*Travis*) those are triggered by maybe.h, so you get it every time it is included. # - redundant-move, because we have one that is required on old libc set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra \ --Wno-implicit-fallthrough \ -Wno-comment \ -Wno-address \ --Wno-strict-aliasing \ ") # Disable exception handling. diff --git a/src/reader.cpp b/src/reader.cpp index 79135c80a..56d2a99e3 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -2941,9 +2941,9 @@ void reader_data_t::handle_readline_command(readline_cmd_t c, readline_loop_stat parser().libdata().is_repaint = false; break; } - // Else we repaint as normal. - /* fallthrough */ + // Else we repaint as normal } + /* fallthrough */ case rl::force_repaint: case rl::repaint: { parser().libdata().is_repaint = true;