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

Warnings about extra tokens #537

Closed patlefort closed 4 years ago

patlefort commented 4 years ago

Hi, when compiling my code with icecream and 2 machines, I get the following strange warnings:

/home/elrick/Projects/PhotoRT/patlib/include/PatLib/Tasks.hpp:273:8: warning: extra tokens at end of #else directive [-Wendif-labels]
  273 |    }
      |        ^
/home/elrick/Projects/PhotoRT/patlib/include/PatLib/Tasks.hpp:309:10: warning: extra tokens at end of #endif directive [-Wendif-labels]
  309 |       }
      |          ^
/home/elrick/Projects/PhotoRT/patlib/include/PatLib/Tasks.hpp:325:10: warning: extra tokens at end of #endif directive [-Wendif-labels]
  325 |    #ifndef PL_USE_OPENMP_TASK
      |          ^
/home/elrick/Projects/PhotoRT/patlib/include/PatLib/Tasks.hpp:435:10: warning: extra tokens at end of #endif directive [-Wendif-labels]
  435 |      {
      |          ^
/home/elrick/Projects/PhotoRT/patlib/include/PatLib/Tasks.hpp:487:29: warning: extra tokens at end of #ifdef directive
  487 | 
      |                             ^
/home/elrick/Projects/PhotoRT/patlib/include/PatLib/Tasks.hpp:516:10: warning: extra tokens at end of #endif directive [-Wendif-labels]
  516 |         else
      |          ^
/home/elrick/Projects/PhotoRT/patlib/include/PatLib/Tasks.hpp:716:8: warning: extra tokens at end of #endif directive [-Wendif-labels]
  716 | 
      |        ^

It does not however happen if I compile without icecream. Is icecream doing something to the source code?

coolo commented 4 years ago

Not exactly. But it splits preprocessing and compiling - which might trigger other bugs. You should see the same if you "compiled" with -E

llunak commented 4 years ago

You can compile with ICECC_DEBUG=debug and run iceccd with "-v -v -v" and then you'll see all the actual compiler invocations, so you can try the same yourself without involving icecream. Until you provide information to reproduce the problem, there's nothing to do about the problem.

patlefort commented 4 years ago

Upon further digging, I don't think the problem is related to icecream but to gcc. The only constant I could find is OpenMP pragma directives triggering these strange warnings only when compiling with -E. I even managed to trigger an internal compiler error with unspellable token PRAGMA_EOL.

I have also noticed an error when compiling with ICECC_DEBUG=debug:

command needs stdout/stderr workaround, recompiling locally
(set ICECC_CARET_WORKAROUND=0 to override)
local build forced by remote exception: Error 102 - command needs stdout/stderr workaround, recompiling locally

If I compile with ICECC_CARET_WORKAROUND=0, I get new warnings:

<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for '__type' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for '__type' [-Wpedantic]
In file included from /usr/include/c++/10.1.0/chrono:41,
                 from /home/elrick/Projects/PhotoRT/patlib/include/PatLib/base.hpp:29,
                 from /home/elrick/Projects/PhotoRT/engine/build/cmake/../../include/PhotoRT/Config/prtbase.hpp:28,
                 from /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp:20:
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
In file included from /usr/include/c++/10.1.0/chrono:41,
                 from /home/elrick/Projects/PhotoRT/patlib/include/PatLib/base.hpp:29,
                 from /home/elrick/Projects/PhotoRT/engine/build/cmake/../../include/PhotoRT/Config/prtbase.hpp:28,
                 from /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp:20:
<built-in>: warning: ISO C++ does not support '__int128' for 'min' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'max' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'epsilon' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'round_error' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'lowest' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'infinity' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'quiet_NaN' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'signaling_NaN' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'denorm_min' [-Wpedantic]
In file included from /usr/include/c++/10.1.0/chrono:41,
                 from /home/elrick/Projects/PhotoRT/patlib/include/PatLib/base.hpp:29,
                 from /home/elrick/Projects/PhotoRT/engine/build/cmake/../../include/PhotoRT/Config/prtbase.hpp:28,
                 from /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp:20:
/usr/include/c++/10.1.0/limits: In static member function 'static constexpr __int128 std::numeric_limits<__int128>::min()':
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
/usr/include/c++/10.1.0/limits: In static member function 'static constexpr __int128 std::numeric_limits<__int128>::max()':
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
In file included from /usr/include/c++/10.1.0/chrono:41,
                 from /home/elrick/Projects/PhotoRT/patlib/include/PatLib/base.hpp:29,
                 from /home/elrick/Projects/PhotoRT/engine/build/cmake/../../include/PhotoRT/Config/prtbase.hpp:28,
                 from /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp:20:
/usr/include/c++/10.1.0/limits: In static member function 'static constexpr __int128 std::numeric_limits<__int128>::infinity()':
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
/usr/include/c++/10.1.0/limits: In static member function 'static constexpr __int128 std::numeric_limits<__int128>::quiet_NaN()':
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
/usr/include/c++/10.1.0/limits: In static member function 'static constexpr __int128 std::numeric_limits<__int128>::signaling_NaN()':
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
/usr/include/c++/10.1.0/limits: In static member function 'static constexpr __int128 std::numeric_limits<__int128>::denorm_min()':
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
/usr/include/c++/10.1.0/limits: At global scope:
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'min' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'max' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'lowest' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'epsilon' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'round_error' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'infinity' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'quiet_NaN' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'signaling_NaN' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'denorm_min' [-Wpedantic]
In file included from /usr/include/c++/10.1.0/chrono:41,
                 from /home/elrick/Projects/PhotoRT/patlib/include/PatLib/base.hpp:29,
                 from /home/elrick/Projects/PhotoRT/engine/build/cmake/../../include/PhotoRT/Config/prtbase.hpp:28,
                 from /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp:20:
/usr/include/c++/10.1.0/limits: In static member function 'static constexpr __int128 unsigned std::numeric_limits<__int128 unsigned>::max()':
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
In file included from /usr/include/c++/10.1.0/chrono:41,
                 from /home/elrick/Projects/PhotoRT/patlib/include/PatLib/base.hpp:29,
                 from /home/elrick/Projects/PhotoRT/engine/build/cmake/../../include/PhotoRT/Config/prtbase.hpp:28,
                 from /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp:20:
/usr/include/c++/10.1.0/limits: In static member function 'static constexpr __int128 unsigned std::numeric_limits<__int128 unsigned>::infinity()':
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
/usr/include/c++/10.1.0/limits: In static member function 'static constexpr __int128 unsigned std::numeric_limits<__int128 unsigned>::quiet_NaN()':
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
/usr/include/c++/10.1.0/limits: In static member function 'static constexpr __int128 unsigned std::numeric_limits<__int128 unsigned>::signaling_NaN()':
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
/usr/include/c++/10.1.0/limits: In static member function 'static constexpr __int128 unsigned std::numeric_limits<__int128 unsigned>::denorm_min()':
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
/usr/include/c++/10.1.0/bits/std_abs.h: At global scope:
<built-in>: warning: ISO C++ does not support '__int128' for '__x' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'abs' [-Wpedantic]
In file included from /usr/include/c++/10.1.0/bits/stl_algobase.h:61,
                 from /usr/include/c++/10.1.0/bits/char_traits.h:39,
                 from /usr/include/c++/10.1.0/string:40,
                 from /home/elrick/Software/Shared/include/boost/stacktrace/frame.hpp:16,
                 from /home/elrick/Software/Shared/include/boost/stacktrace.hpp:15,
                 from /home/elrick/Projects/PhotoRT/patlib/include/PatLib/base.hpp:38,
                 from /home/elrick/Projects/PhotoRT/engine/build/cmake/../../include/PhotoRT/Config/prtbase.hpp:28,
                 from /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp:20:
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
In file included from /usr/include/c++/10.1.0/bits/stl_algobase.h:61,
                 from /usr/include/c++/10.1.0/bits/char_traits.h:39,
                 from /usr/include/c++/10.1.0/string:40,
                 from /home/elrick/Software/Shared/include/boost/stacktrace/frame.hpp:16,
                 from /home/elrick/Software/Shared/include/boost/stacktrace.hpp:15,
                 from /home/elrick/Projects/PhotoRT/patlib/include/PatLib/base.hpp:38,
                 from /home/elrick/Projects/PhotoRT/engine/build/cmake/../../include/PhotoRT/Config/prtbase.hpp:28,
                 from /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp:20:
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for '__n' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for '__size_to_integer' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for '__n' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for '__size_to_integer' [-Wpedantic]
In file included from /usr/include/c++/10.1.0/string_view:42,
                 from /usr/include/c++/10.1.0/bits/basic_string.h:48,
                 from /usr/include/c++/10.1.0/string:55,
                 from /home/elrick/Software/Shared/include/boost/stacktrace/frame.hpp:16,
                 from /home/elrick/Software/Shared/include/boost/stacktrace.hpp:15,
                 from /home/elrick/Projects/PhotoRT/patlib/include/PatLib/base.hpp:38,
                 from /home/elrick/Projects/PhotoRT/engine/build/cmake/../../include/PhotoRT/Config/prtbase.hpp:28,
                 from /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp:20:
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
In file included from /usr/include/c++/10.1.0/string_view:42,
                 from /usr/include/c++/10.1.0/bits/basic_string.h:48,
                 from /usr/include/c++/10.1.0/string:55,
                 from /home/elrick/Software/Shared/include/boost/stacktrace/frame.hpp:16,
                 from /home/elrick/Software/Shared/include/boost/stacktrace.hpp:15,
                 from /home/elrick/Projects/PhotoRT/patlib/include/PatLib/base.hpp:38,
                 from /home/elrick/Projects/PhotoRT/engine/build/cmake/../../include/PhotoRT/Config/prtbase.hpp:28,
                 from /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp:20:
<built-in>: warning: ISO C++ does not support '__int128' for '__val' [-Wpedantic]
In file included from /usr/include/c++/10.1.0/string_view:42,
                 from /usr/include/c++/10.1.0/bits/basic_string.h:48,
                 from /usr/include/c++/10.1.0/string:55,
                 from /home/elrick/Software/Shared/include/boost/stacktrace/frame.hpp:16,
                 from /home/elrick/Software/Shared/include/boost/stacktrace.hpp:15,
                 from /home/elrick/Projects/PhotoRT/patlib/include/PatLib/base.hpp:38,
                 from /home/elrick/Projects/PhotoRT/engine/build/cmake/../../include/PhotoRT/Config/prtbase.hpp:28,
                 from /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp:20:
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
In file included from /usr/include/c++/10.1.0/string_view:42,
                 from /usr/include/c++/10.1.0/bits/basic_string.h:48,
                 from /usr/include/c++/10.1.0/string:55,
                 from /home/elrick/Software/Shared/include/boost/stacktrace/frame.hpp:16,
                 from /home/elrick/Software/Shared/include/boost/stacktrace.hpp:15,
                 from /home/elrick/Projects/PhotoRT/patlib/include/PatLib/base.hpp:38,
                 from /home/elrick/Projects/PhotoRT/engine/build/cmake/../../include/PhotoRT/Config/prtbase.hpp:28,
                 from /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp:20:
<built-in>: warning: ISO C++ does not support '__int128' for '__val' [-Wpedantic]
In file included from /home/elrick/Projects/PhotoRT/patlib/include/PatLib/base.hpp:34,
                 from /home/elrick/Projects/PhotoRT/engine/build/cmake/../../include/PhotoRT/Config/prtbase.hpp:28,
                 from /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp:20:
/home/elrick/Software/Shared/include/boost/detail/iterator.hpp:13:1: note: '#pragma message: This header is deprecated. Use <iterator> instead.'
In file included from /home/elrick/Projects/PhotoRT/patlib/include/PatLib/io.hpp:42,
                 from /home/elrick/Projects/PhotoRT/engine/build/cmake/../../include/PhotoRT/Config/prtbase.hpp:33,
                 from /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp:20:
<built-in>: warning: ISO C++ does not support '__int128' for '__value' [-Wpedantic]
In file included from /home/elrick/Projects/PhotoRT/patlib/include/PatLib/io.hpp:42,
                 from /home/elrick/Projects/PhotoRT/engine/build/cmake/../../include/PhotoRT/Config/prtbase.hpp:33,
                 from /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp:20:
/usr/include/c++/10.1.0/charconv: In function 'std::to_chars_result std::to_chars(char*, char*, __int128, int)':
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
In file included from /home/elrick/Projects/PhotoRT/patlib/include/PatLib/io.hpp:42,
                 from /home/elrick/Projects/PhotoRT/engine/build/cmake/../../include/PhotoRT/Config/prtbase.hpp:33,
                 from /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp:20:
/usr/include/c++/10.1.0/charconv: At global scope:
<built-in>: warning: ISO C++ does not support '__int128' for '__value' [-Wpedantic]
In file included from /home/elrick/Projects/PhotoRT/patlib/include/PatLib/io.hpp:42,
                 from /home/elrick/Projects/PhotoRT/engine/build/cmake/../../include/PhotoRT/Config/prtbase.hpp:33,
                 from /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp:20:
/usr/include/c++/10.1.0/charconv: In function 'std::to_chars_result std::to_chars(char*, char*, __int128 unsigned, int)':
<built-in>: warning: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]

Example compile command:

/usr/bin/c++ -I/home/elrick/Projects/PhotoRT/engine/build/cmake/../../include -I/home/elrick/Projects/PhotoRT/patlib/include -isystem /home/elrick/Software/Shared/include -MD -MT photort_all/engine/CMakeFiles/PhotoRT_Core.dir/__/__/src/Light/Edf.cpp.o -MF photort_all/engine/CMakeFiles/PhotoRT_Core.dir/__/__/src/Light/Edf.cpp.o.d -DBOOST_ALL_NO_LIB -DBOOST_CONTAINER_DYN_LINK -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_IOSTREAMS_DYN_LINK -DBOOST_RANDOM_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DPL_ASSERT_BACKTRACE -DPL_HAS_HUGETLBFS -DPL_USE_OPENMP_TASK -DPL_WITH_NUMA -DPRT_DEFAULT_PORT="58492" -DPRT_IO_BUFFER_SIZE=104857600 -DPRT_MAX_SUBSTANCES=100 -DPRT_MINIMAL_SAFE_INC_FACTOR=500.0 -DPRT_REJECT_INVALID_SAMPLES -DPRT_SAMPLE_RECT_SIZE_MAX=16 -DPRT_USE_64BITS_INDEX -DPRT_USE_COMPRESSION -DPRT_USE_FASTEXP2 -DPRT_USE_FASTLOG2 -DPRT_WITH_COMPRESSION_BZIP2 -DPRT_WITH_COMPRESSION_GZIP -DPRT_WITH_COMPRESSION_ZLIB -DPRT_WITH_IPC -DPRT_WITH_NETWORKING -DPRT_WITH_XML_PARSER -DPRT_WITH_XML_PARSER_XALAN -DPhotoRT_Core_EXPORTS -march=znver1 -mmmx -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha -mpclmul -mpopcnt -mabm -mfma -mbmi -mbmi2 -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt -mclflushopt -mxsavec -mxsaves -mmwaitx -mclzero -mtune=znver1 -fdiagnostics-color=always -Wall -Wextra -Wpedantic -Wno-unknown-pragmas -Wno-vla-extension -Wno-vla -Wno-missing-field-initializers -ftemplate-backtrace-limit=50 -O3 -DNDEBUG -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fconcepts -fopenmp -std=gnu++2a -E /home/elrick/Projects/PhotoRT/engine/src/Light/Edf.cpp -fdirectives-only

This is with GCC 10. Normally these warnings are supressed in a system header. Once again it might be another GCC problem.

llunak commented 4 years ago

You use -Wpedantic, which is problematic with GCC's -fdirectives-only if you compile with GNU extensions (which sort of contradicts -Wpedantic, doesn't it?). Either drop it, or use -std=c++2a, or use ICECC_REMOTE_CPP=0 (which has its own set of problems).