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

Bug 341374

Summary: [Scanner Discovery] The build output parser does not work with Mozilla preincluded files (-include)
Product: [Tools] CDT Reporter: Jonathan Watt <jwatt>
Component: cdt-buildAssignee: Project Inbox <cdt-core-inbox>
Status: NEW --- QA Contact: Jonah Graham <jonah>
Severity: normal    
Priority: P3 CC: cdtdoug, jamesblackburn+eclipse, yevshif
Version: 7.0.2   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Jonathan Watt CLA 2011-03-30 10:44:54 EDT
The build output parser does not appear to work with Mozilla preincluded files. (Bug 160281 being fixed suggests that the build output parser should be able to handle -include.)

The build output parser does seem to handle -D defines correctly. I used "Create Parser Log File" from the "Index" item in the context menu for one of the source files in Project Explorer. The defines passed on the command line to build that file show up with the correct values under the "Macro definitions (option -D):" section of the log file.

The section "Preincluded files (option -include):" in the log file is empty though, whereas it should include a single .h file.

Also under |C/C++ General > Paths & Symbols > Include Files| with "show built-in values" ticked there is nothing listed.
Comment 1 Jonathan Watt CLA 2011-03-30 10:50:37 EDT
For example, if I have my Mozilla source code in the directory '/src', the objdir is '/src/obj', the file I'm interested in is '/src/content/svg/content/src/nsSVGSVGElement.cpp', and its object file is built at /src/obj/content/svg/content/src/nsSVGSVGElement.o, then the build output for this file is:

nsSVGOuterSVGFrame.cpp
g++-4.2 -o nsSVGOuterSVGFrame.o -c  -fvisibility=hidden -DMOZILLA_INTERNAL_API -D_IMPL_NS_COM -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET -DIMPL_XREAPI -DIMPL_NS_NET -DIMPL_THEBES  -DSTATIC_EXPORTABLE_JS_API -DOSTYPE=\"Darwin10.6.0\" -DOSARCH=Darwin -D_IMPL_NS_LAYOUT -I/src/layout/svg/base/src/../../../base -I/src/layout/svg/base/src/../../../generic -I/src/layout/svg/base/src/../../../style -I/src/layout/svg/base/src/../../../xul/base/src -I/src/layout/svg/base/src/../../../../content/svg/content/src -I/src/layout/svg/base/src/../../../../content/base/src  -I/src/layout/svg/base/src -I. -I../../../../dist/include -I../../../../dist/include/nsprpub  -I/src/obj/dist/include/nspr -I/src/obj/dist/include/nss       -fPIC -fmessage-length=0 -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -fno-strict-aliasing -fpascal-strings -fno-common -fshort-wchar -pthread -DNO_X11 -pipe  -DDEBUG -D_DEBUG -DTRACING -g  -fmessage-length=0 -DMOZILLA_CLIENT -include ../../../../mozilla-config.h -MD -MF .deps/nsSVGOuterSVGFrame.pp /src/layout/svg/base/src/nsSVGOuterSVGFrame.cpp

The |-include ../../../../mozilla-config.h| part is what's failing to be handled.
Comment 2 Jonathan Watt CLA 2011-03-30 10:52:35 EDT
Changing it to |-include /src/obj/mozilla-config.h| to get rid of the relative path stuff does not help.
Comment 3 Andrew Gvozdev CLA 2011-03-30 11:38:46 EDT
I believe this functionality was working in earlier CDT but got lost with the massive changes done to MBS for 4.0.
Comment 4 James Blackburn CLA 2011-03-30 11:45:27 EDT
-incldue is known to work... So there may be two bugs here:
  1) Scanner discovery detection of -include
  2) Indexer parsing a provided -include
Comment 5 Markus Schorn CLA 2011-03-30 12:43:12 EDT
(In reply to comment #4)
> -incldue is known to work... So there may be two bugs here:
>   1) Scanner discovery detection of -include
>   2) Indexer parsing a provided -include

Or 3) the data from the scanner discovery does not make it from there to the indexer. (I have trouble making this work with the PerFileScannerDiscovery, it looks like the individual settings per file are merged into a common configuration that is then used for all files??).

In any way, this is relatively easy to check: The result of the discovery is written to a file in '<workspace>/.metadata/.plugins/org.eclipse.cdt.make.core'. What's being passed to the indexer can be seen via a parser log (context menu of file in project explorer - Index - Create Parser Log).
Comment 6 Jonathan Watt CLA 2011-03-30 13:13:17 EDT
For me, that log has nothing listed under the "Preincluded files (option -include):" section, as mentioned in comment 0.

As for the result of the discovery being written to a file in
'<workspace>/.metadata/.plugins/org.eclipse.cdt.make.core', there is a 4 MB .sc file containing XML in that directory with the preinclude file mentioned at various places. Unfortunately the preinclude file is prefixed with a variety of paths, none of which are correct.

Is it possible that if the path doesn't exist that Eclipse just throws away that preinclude, and that's why nothing shows up (with or without correct paths)?