0

In my code, I occasionally use recursive macros as helpers to generate boiler-plate code. If a compiler error occurs in some code generated by the macro, I get something like the following:

In file included from ../../include/pw/hsm/macros.hpp:8,
                 from ../../include/pw/hsm/includes.hpp:7,
                 from ../common.hpp:6,
                 from common.hpp:9,
                 from StateMachine.hpp:4,
                 from main.cpp:1:
../../include/pw/hsm/macros.hpp:74:33: note: candidate: 'virtual pw::hsm::return_type lamp::_StateMachine_VISITOR::visit(const lamp::EPowerButtonPressed&)'
  virtual ::pw::hsm::return_type visit(const name_& e) { return ::pw::hsm::PASS; }
                                 ^~~~~
../../lib/map-macro/map.h:16:20: note: in definition of macro 'EVAL0'
 #define EVAL0(...) __VA_ARGS__
                    ^~~~~~~~~~~
../../lib/map-macro/map.h:17:26: note: in expansion of macro 'EVAL0'
 #define EVAL1(...) EVAL0(EVAL0(EVAL0(__VA_ARGS__)))
                          ^~~~~
../../lib/map-macro/map.h:17:32: note: in expansion of macro 'EVAL0'
 #define EVAL1(...) EVAL0(EVAL0(EVAL0(__VA_ARGS__)))
                                ^~~~~
../../lib/map-macro/map.h:18:20: note: in expansion of macro 'EVAL1'
 #define EVAL2(...) EVAL1(EVAL1(EVAL1(__VA_ARGS__)))
                    ^~~~~
../../lib/map-macro/map.h:17:20: note: in expansion of macro 'EVAL0'
 #define EVAL1(...) EVAL0(EVAL0(EVAL0(__VA_ARGS__)))
                    ^~~~~
../../lib/map-macro/map.h:17:26: note: in expansion of macro 'EVAL0'
 #define EVAL1(...) EVAL0(EVAL0(EVAL0(__VA_ARGS__)))
                          ^~~~~
../../lib/map-macro/map.h:17:32: note: in expansion of macro 'EVAL0'
 #define EVAL1(...) EVAL0(EVAL0(EVAL0(__VA_ARGS__)))
                                ^~~~~
../../lib/map-macro/map.h:18:26: note: in expansion of macro 'EVAL1'
 #define EVAL2(...) EVAL1(EVAL1(EVAL1(__VA_ARGS__)))

...

Where the above "in expansion of" notes are repeated dozens of times.

Since this information is completely useless in actually determining the source of the problem (I only need the first few lines) does anyone know if it is possible to suppress these notes in GCC?

I am using GCC 8.2.0 (MinGW.org GCC-8.2.0-3)

Patrick Wright
  • 1,401
  • 7
  • 13

0 Answers0