9

In my project, I am getting many warnings of the form "note: parameter passing for argument of type 'SomeClass<int, float>' when C++17 is enabled changed to match C++14 in GCC 10.1". This occurred after I updated to using a compiler that uses the C++17 standard instead of C++14 (gcc-arm-none-eabi from Arm GNU toolchain v11.2) .

As far as I can tell, this note is referring to changes to correct a bug involving the passing of particular C++ template objects. Please correct my understanding if I am wrong, but I don't think I need to pay any attention to the note because I compile all my dependencies in the project with the sample compiler (gcc 11.2) therefore there shouldn't be any ABI differences. I therefore want to get rid of these notes that come up as they swamp the terminal. I have found some possible solutions:

Set the -Wno-psabi flag

This works and will disable all psABI warnings. However, there may be times where I do want to be notified of ABI changes as explained here (What exactly does GCC's -Wpsabi option do? What are the implications of supressing it?). The answer to that question however also notes that I never need to be concerned with ABI changes if all parts of my program are built with the same compiler. I think this is the case in my project and want to confirm - all libraries and the application itself are compiled with gcc 11.2 except for libstd++ and newlib.

-fcompare-debug-second

This magically make notes go away, however I am unsure how or why. The man page states ' When this option is passed to the compiler driver, it causes the first compilation to be skipped, which makes it useful for little other than debugging the compiler proper.' (https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html) This appears to cause the first compilation pass to be skipped and will only display output from the second, which means that warnings and other output I do want to see may not appear? Hence I am apprehensive about using this also.

Find some way to silence all notes about the ABI parameter passing change between C++14 and C++17 but still leave other notes enabled

This is what I actually want to do but am unsure if there's a way.

aduke202050
  • 101
  • 2

0 Answers0