eclipse-cdt / cdt

Eclipse CDT™ C/C++ Development Tools
http://eclipse.org/cdt
Eclipse Public License 2.0
295 stars 192 forks source link

Problems view: "infos" lines lack context - should allow to go to accompanying error or warning message #588

Open herrmanthegerman opened 9 months ago

herrmanthegerman commented 9 months ago

Is your feature request related to a problem? Please describe. The "Problems" view collects important compiler messages and sorts them out into "errors", "warnings" and "infos" categories. So when a c/c++ build fails with errors, the "Problems" view list the error messages in the "error" category. Clicking on the entry opens the relevant line in the source editor. Same holds true for messages from other categories.

However, messages in the "infos" category are often missing context. For example, when a macro is involved in an error message, a messages similar to the following one appears in the "infos" category:

"in definition of macro 'configASSERT'"

Double clicking on the entry opens the macro definition. This is not helpful as the context is missing.

The full context, in this example, would be the following compiler error message:

In file included from C:\Users\Dad\Documents\MCUXpressoIDE_11.8.0_1165\workspace\LPC5536_TICv3\freertos\freertos-kernel\include/FreeRTOS.h:59,
                 from C:/Users/Dad/Documents/MCUXpressoIDE_11.8.0_1165/workspace/xiton-shared/MessageDispatcher.h:15,
                 from C:/Users/Dad/Documents/MCUXpressoIDE_11.8.0_1165/workspace/xiton-shared/PwmDriver.h:15:
C:/Users/Dad/Documents/MCUXpressoIDE_11.8.0_1165/workspace/xiton-shared/PwmDriver.h:82:36: error: 'timers_number' was not declared in this scope
   82 |                 configASSERT(idx < timers_number);
      |                                    ^~~~~~~~~~~~~
C:\Users\Dad\Documents\MCUXpressoIDE_11.8.0_1165\workspace\LPC5536_TICv3\source/FreeRTOSConfig.h:122:29: note: in definition of macro 'configASSERT'
  122 | #define configASSERT(x) if((x) == 0) { __asm volatile ("cpsid i");  __asm("BKPT #0\n");  for (;;);}

Describe the solution you'd like From the infos entry, I'd like to be able to open the full compiler error or warning message which accompanies the info message.

Describe alternatives you've considered Search through the "build console" view manually using the "description" of the infos entry.

Additional context Screenshot "Problems" view: image

Similar report here: https://www.eclipse.org/forums/index.php/t/781865/

jonahgraham commented 9 months ago

Thanks @herrmanthegerman for the bug report.

cc: @Torbjorn-Svensson because I think you know this part of the code pretty well and you may be able to comment on the below.

I think that there is a drawback of the current implementation in CDT in that it only considers a single line of output of the compiler per error (info/warning) marker.

I don't know what it would take to properly capture multiple lines of output into a single error. The "in expansion" type info really goes with some error (or warning)