icecc / icecream

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

gcc unhappy when handling #pragma #436

Closed dothan009 closed 5 years ago

dothan009 commented 5 years ago

My project has c++ source code with #pragma 。An simple example is

#ifndef BBB
#pragma message("hello")
#endif

int func1() {
  return 0;
}

These code can compile directly using g++, but will complain "extra tokens at end of #endif directive [-Wendif-labels]" when using icecc 1.2

Another case is

#pragma message("hello")
#define BBB 1

int func2() {
  return 0;
}

It will complain "internal compiler error: unspellable token PRAGMA_EOL" when using icecc.

These complain make icecc break the distribute build process.

dothan009 commented 5 years ago

I found the reason is icecc 1.2 add -fdirectives-only when source code preprocessing. It seems like gcc -E -fdirectives-only is not compatible with #pragma.

dothan009 commented 5 years ago

When meet this problem, I use ICECC_CARET_WORKAROUND=0 ICECC_REMOTE_CPP=1 . Following #336 , I change ICECC_REMOTE_CPP to 0 to bypass this bug.

Any one could give a better solution ?

HenryMiller1 commented 5 years ago

I suspect that this is a bug with gcc. Can you run the example code with - fdirectives-only and then compile that output? If you get the same error it is gcc.

Henry Miller hank@millerfarm.com

On Thu, Nov 29, 2018, at 7:12 AM, dothan009 wrote:

I found the reason is icecc 1.2 add -fdirectives-only when source code processing.> It seems like gcc -E -fdirectives-only is not compatible with

pragma.> — You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub[1], or mute the thread[2]. Links:

  1. https://github.com/icecc/icecream/issues/436#issuecomment-442828553
  2. https://github.com/notifications/unsubscribe-auth/AI8oErUi2PDQpn1vcmUfEdsZXNaECb90ks5uz91VgaJpZM4Y5jFb
dothan009 commented 5 years ago

I suspect that this is a bug with gcc. Can you run the example code with - fdirectives-only and then compile that output? If you get the same error it is gcc. -- Henry Miller hank@millerfarm.com On Thu, Nov 29, 2018, at 7:12 AM, dothan009 wrote: I found the reason is icecc 1.2 add -fdirectives-only when source code processing.> It seems like gcc -E -fdirectives-only is not compatible with #pragma.> — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub[1], or mute the thread[2]. Links: 1. #436 (comment) 2. https://github.com/notifications/unsubscribe-auth/AI8oErUi2PDQpn1vcmUfEdsZXNaECb90ks5uz91VgaJpZM4Y5jFb

Yes, I test "g++ -E -fdirectives-only" with my code, and result the same error message. So this is the problem of gcc.