Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 360989

Summary: ($warning ...) directives in external makefiles are interpreted as errors
Product: [Tools] CDT Reporter: John Cortell <john.cortell>
Component: cdt-buildAssignee: cdt-build-inbox <cdt-build-inbox>
Status: REOPENED --- QA Contact: Jonah Graham <jonah>
Severity: normal    
Priority: P3 CC: cdtdoug
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description John Cortell CLA 2011-10-14 11:42:31 EDT
They should be interpreted as (duh) warnings.

To reproduce:
1. Create c:\somedir\makefile and give it the following content
$(warning The Redcoats are coming!)
all :
	echo "Done"

2. File > New > Makefile Project with Existing Code
3. Provide: project name, c:\somedir\makefile and choose Cygwin GCC toolchain (MinGW support is broken)
4. Build the project.
Note the error in the Problems view. Should be a warning.
Comment 1 Andrew Gvozdev CLA 2011-10-14 12:17:08 EDT
Generally speaking, error parser parsing console output won't be able to tell the difference between gcc compiler error messages and arbitrary warnings from makefile like that. I suggest to format your messages in makefile to indicate severity, i.e. $(warning warning: The Redcoats are coming!) or adjust error parser patterns to recognize them in Preferences->C/C++->Build->Settings->[Error Parsers] tab -> select GNU C/C++ Error Parser and add or edit patterns. See also bug 85264. If you have any other suggestions I am listening.

*** This bug has been marked as a duplicate of bug 85264 ***
Comment 2 John Cortell CLA 2011-10-14 12:24:00 EDT
Thanks, Andrew. Makes sense. In my head I was starting to wonder how we could even distinguish the output of ($warning) and was starting to write a follow up post when you beat me to it. Qualifying the text of the message is definitely a reasonable solution.
Comment 3 Andrew Gvozdev CLA 2011-10-14 13:10:13 EDT
You know what, I got an idea how we could do it. We can customize GNU Make Error Parser to check a content type on the file and if it is "Makefile" type then assign 'warning' severity.
Here is output on the console for reference:

build/GNUmakefile:1: The Redcoats are coming!
Comment 4 John Cortell CLA 2011-10-14 13:22:51 EDT
(In reply to comment #3)
> You know what, I got an idea how we could do it. We can customize GNU Make
> Error Parser to check a content type on the file and if it is "Makefile" type
> then assign 'warning' severity.
> Here is output on the console for reference:
> 
> build/GNUmakefile:1: The Redcoats are coming!

Do you mean GCCErrorParser? That's what the comments in bug 85264 say is doing the parsing. Regardless, providing a different default behavior for messages with file:linenumber for makefiles sounds reasonable to me. In the end, I will still qualify the messages with {info|warning|error} since $warning is not used exclusively for warning, but also for informational tracing.