| Summary: | Fast indexer fails due to NPE when a -I. option is present | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Martin Oberhuber <mober.at+eclipse> | ||||||
| Component: | cdt-parser | Assignee: | Markus Schorn <mschorn.eclipse> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | Markus Schorn <mschorn.eclipse> | ||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | cdtdoug, mober.at+eclipse, sandi_ro | ||||||
| Version: | 6.0.2 | ||||||||
| Target Milestone: | 7.0 | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Martin Oberhuber
Created attachment 175397 [details]
Patch (against 6.0.2) fixing the issue
Attached patch (against 6.0.2) fixes the issue for us. Essentially, any "-I." dirctive is replaced by the respective current scanning directory, or ignored.
(In reply to comment #1) > Created an attachment (id=175397) [details] > Patch (against 6.0.2) fixing the issue > > Attached patch (against 6.0.2) fixes the issue for us. Essentially, any "-I." > dirctive is replaced by the respective current scanning directory, or ignored. I'm not sure this is the correct fix, or even if this is a problem. -I. means the current directory when the compiler was invoked. Only the build system would know what that is. I'd like to get confirmation, but I believe "." is actually an invalid directory in the scanner info API. As would all other relative directory paths. Ad -I. option: ============== These options are made absolute by the shell before invoking the compiler. Therefore, as Doug wrote, it is recommended that the build system provides absolute paths for the include search path. The preprocessor does not know the current directory with which the compiler is invoked. In CDT 7.0, as a best guess the preprocessor assumes that it is the same as the directory of the source-file being parsed, still the build system should provide absolute paths. See bug 243170 for an extensive discussion. The NPE can be triggered with "." or "" on the include search path, also with "c:/" on the in include search path and the non-sense include directive #include "/" or #include "\" Created attachment 175700 [details]
fix
The correct fix for relative include search paths is done in 7.0, it uses the current directory of the source-file, rather than the current directory of the including file.
For 6.0.x I just ported the fix for the NPE.
Fixed in 6.0.x > 20100802. *** cdt cvs genie on behalf of mschorn *** Bug 321118: NPE in include file resolution. [*] FileExistsCache.java 1.2.2.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/FileExistsCache.java?root=Tools_Project&r1=1.2&r2=1.2.2.1 |