icecc / icecream

Distributed compiler with a central scheduler to share build load
GNU General Public License v2.0
1.58k stars 250 forks source link

GCC -Wcpp diagnostic pragmas not handled correctly #569

Open zevweiss opened 3 years ago

zevweiss commented 3 years ago

In setting up icecream to help accelerate the build of a large software project, I encountered a problem with GCC diagnostic pragma directives involving -Wcpp. The following illustrates a minimized reproduction:

$ cat warn.c
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcpp"
#warning foo
#pragma GCC diagnostic pop
$ gcc -c -Werror -o warn.o warn.c; echo $?
0
$ ICECC_TEST_REMOTEBUILD=1 ICECC_REMOTE_CPP=0 icecc gcc -c -o warn.o -Werror warn.c; echo $?
warn.c:3:2: error: #warning foo [-Werror=cpp]
 #warning foo
  ^
cc1: all warnings being treated as errors
1

With remote preprocessing enabled (as is the default) the problem is partially masked by local recompilation, but still ultimately present:

$ ICECC_TEST_REMOTEBUILD=1 icecc gcc -c -o warn.o -Werror warn.c; echo $?
warn.c:3:2: error: #warning foo [-Werror=cpp]
 #warning foo
  ^
cc1: all warnings being treated as errors
ICECC[20613] 2020-11-21 21:52:06: local build forced by remote exception: Error 103 - local cpp invocation failed, trying to recompile locally
0

This is with icecream compiled from commit 9d877aaa9d7ab69a64b04b939e10f8cb6ef45375 (1.3.91, a.k.a. 1.4rc1).