From 026982244c45177fc251c4d670d4463d7cb879d6 Mon Sep 17 00:00:00 2001 From: BevapDin Date: Tue, 31 Dec 2019 02:00:47 +0100 Subject: [PATCH 1/2] Fix building with ccache. When building with ccache enabled, it removes the comments before passing them to the compiler. So the `/* fallthrough */` comment that prevents certain warnings is removed as well. Adding the `-C` switch prevents that removal and the comments remains and the warning from the compiler does not appear. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5de0d18afdd6a..fbe226cfb1243 100644 --- a/Makefile +++ b/Makefile @@ -209,7 +209,7 @@ ifdef CLANG LDFLAGS += -stdlib=libc++ endif ifdef CCACHE - CXX = CCACHE_CPP2=1 ccache $(CROSS)$(CLANGCMD) + CXX = CCACHE_CPP2=1 ccache $(CROSS)$(CLANGCMD) -C LD = CCACHE_CPP2=1 ccache $(CROSS)$(CLANGCMD) else CXX = $(CROSS)$(CLANGCMD) @@ -227,7 +227,7 @@ else # Appears that the default value of $LD is unsuitable on most systems OS_LINKER := $(CXX) ifdef CCACHE - CXX = ccache $(CROSS)$(OS_COMPILER) + CXX = ccache $(CROSS)$(OS_COMPILER) -C LD = ccache $(CROSS)$(OS_LINKER) else CXX = $(CROSS)$(OS_COMPILER) From 44c66e86c1c72eb7f1dd6a3cd173f1ba6087d896 Mon Sep 17 00:00:00 2001 From: BevapDin Date: Tue, 31 Dec 2019 02:22:51 +0100 Subject: [PATCH 2/2] Fix exporting comments through ccache in a different way: This instructs ccache directly. The former version relied on gcc to interpret the "-C" flag, but clang apparently does not understand it. --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fbe226cfb1243..a99c7e495562e 100644 --- a/Makefile +++ b/Makefile @@ -101,6 +101,9 @@ DEBUGSYMS = -g #OTHERS = -O3 #DEFINES = -DNDEBUG +# Tells ccache to keep comments, as they can be meaningful to the compiler (as to suppress warnings). +export CCACHE_COMMENTS=1 + # Disable debug. Comment this out to get logging. #DEFINES = -DENABLE_LOGGING @@ -209,7 +212,7 @@ ifdef CLANG LDFLAGS += -stdlib=libc++ endif ifdef CCACHE - CXX = CCACHE_CPP2=1 ccache $(CROSS)$(CLANGCMD) -C + CXX = CCACHE_CPP2=1 ccache $(CROSS)$(CLANGCMD) LD = CCACHE_CPP2=1 ccache $(CROSS)$(CLANGCMD) else CXX = $(CROSS)$(CLANGCMD) @@ -227,7 +230,7 @@ else # Appears that the default value of $LD is unsuitable on most systems OS_LINKER := $(CXX) ifdef CCACHE - CXX = ccache $(CROSS)$(OS_COMPILER) -C + CXX = ccache $(CROSS)$(OS_COMPILER) LD = ccache $(CROSS)$(OS_LINKER) else CXX = $(CROSS)$(OS_COMPILER)