mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-03 21:53:39 +02:00
Fixed Bug 90193 Scanner faililng on Local/User paths as provided in Std. Make
This commit is contained in:
parent
082daae88f
commit
60956bf10f
1 changed files with 39 additions and 15 deletions
|
@ -105,7 +105,8 @@ abstract class BaseScanner implements IScanner {
|
||||||
|
|
||||||
protected CharArrayObjectMap definitions = new CharArrayObjectMap(512);
|
protected CharArrayObjectMap definitions = new CharArrayObjectMap(512);
|
||||||
|
|
||||||
protected String[] includePaths;
|
protected String[] stdIncludePaths;
|
||||||
|
protected String[] locIncludePaths = null;
|
||||||
|
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
|
@ -1244,7 +1245,8 @@ abstract class BaseScanner implements IScanner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
includePaths = info.getIncludePaths();
|
stdIncludePaths = info.getIncludePaths();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1287,6 +1289,7 @@ abstract class BaseScanner implements IScanner {
|
||||||
&& einfo.getIncludeFiles().length > 0)
|
&& einfo.getIncludeFiles().length > 0)
|
||||||
preIncludeFiles = Arrays.asList(einfo.getIncludeFiles()).iterator();
|
preIncludeFiles = Arrays.asList(einfo.getIncludeFiles()).iterator();
|
||||||
|
|
||||||
|
locIncludePaths = einfo.getLocalIncludePath();
|
||||||
pushContext(reader.buffer, reader);
|
pushContext(reader.buffer, reader);
|
||||||
|
|
||||||
if (preIncludeFiles.hasNext())
|
if (preIncludeFiles.hasNext())
|
||||||
|
@ -1461,7 +1464,7 @@ abstract class BaseScanner implements IScanner {
|
||||||
* @see org.eclipse.cdt.core.parser.IScanner#getIncludePaths()
|
* @see org.eclipse.cdt.core.parser.IScanner#getIncludePaths()
|
||||||
*/
|
*/
|
||||||
public String[] getIncludePaths() {
|
public String[] getIncludePaths() {
|
||||||
return includePaths;
|
return stdIncludePaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2798,15 +2801,32 @@ abstract class BaseScanner implements IScanner {
|
||||||
endLine = getLineNumber(bufferPos[bufferStackPos]);
|
endLine = getLineNumber(bufferPos[bufferStackPos]);
|
||||||
skipToNewLine();
|
skipToNewLine();
|
||||||
|
|
||||||
|
findAndPushInclusion(filename, fileNameArray, local, include_next, startOffset, nameOffset, nameEndOffset, endOffset, startingLineNumber, nameLine, endLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param filename
|
||||||
|
* @param fileNameArray
|
||||||
|
* @param local
|
||||||
|
* @param include_next
|
||||||
|
* @param startOffset
|
||||||
|
* @param nameOffset
|
||||||
|
* @param nameEndOffset
|
||||||
|
* @param endOffset
|
||||||
|
* @param startingLine
|
||||||
|
* @param nameLine
|
||||||
|
* @param endLine
|
||||||
|
*/
|
||||||
|
protected void findAndPushInclusion(String filename, char[] fileNameArray, boolean local, boolean include_next, int startOffset, int nameOffset, int nameEndOffset, int endOffset, int startingLine, int nameLine, int endLine) {
|
||||||
if (parserMode == ParserMode.QUICK_PARSE) {
|
if (parserMode == ParserMode.QUICK_PARSE) {
|
||||||
Object inclusion = createInclusionConstruct(fileNameArray,
|
Object inclusion = createInclusionConstruct(fileNameArray,
|
||||||
EMPTY_CHAR_ARRAY, local, startOffset, startingLineNumber,
|
EMPTY_CHAR_ARRAY, local, startOffset, startingLine,
|
||||||
nameOffset, nameEndOffset, nameLine, endOffset, endLine,
|
nameOffset, nameEndOffset, nameLine, endOffset, endLine,
|
||||||
false);
|
false);
|
||||||
quickParsePushPopInclusion(inclusion);
|
quickParsePushPopInclusion(inclusion);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeReader reader = null;
|
CodeReader reader = null;
|
||||||
File currentDirectory = null;
|
File currentDirectory = null;
|
||||||
if (local || include_next) {
|
if (local || include_next) {
|
||||||
|
@ -2814,8 +2834,8 @@ abstract class BaseScanner implements IScanner {
|
||||||
// then we need to know what the current directory is!
|
// then we need to know what the current directory is!
|
||||||
File file = new File(String.valueOf(getCurrentFilename()));
|
File file = new File(String.valueOf(getCurrentFilename()));
|
||||||
currentDirectory = file.getParentFile();
|
currentDirectory = file.getParentFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (local && !include_next) {
|
if (local && !include_next) {
|
||||||
// Check to see if we find a match in the current directory
|
// Check to see if we find a match in the current directory
|
||||||
if (currentDirectory != null) {
|
if (currentDirectory != null) {
|
||||||
|
@ -2825,37 +2845,41 @@ abstract class BaseScanner implements IScanner {
|
||||||
pushContext(reader.buffer, new InclusionData(reader,
|
pushContext(reader.buffer, new InclusionData(reader,
|
||||||
createInclusionConstruct(fileNameArray,
|
createInclusionConstruct(fileNameArray,
|
||||||
reader.filename, local, startOffset,
|
reader.filename, local, startOffset,
|
||||||
startingLineNumber, nameOffset,
|
startingLine, nameOffset,
|
||||||
nameEndOffset, nameLine, endOffset,
|
nameEndOffset, nameLine, endOffset,
|
||||||
endLine, false)));
|
endLine, false)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we're not include_next, then we are looking for the
|
// if we're not include_next, then we are looking for the
|
||||||
// first occurance of the file, otherwise, we ignore all the paths
|
// first occurance of the file, otherwise, we ignore all the paths
|
||||||
// before
|
// before
|
||||||
// the
|
// the
|
||||||
// current directory
|
// current directory
|
||||||
if (includePaths != null) {
|
|
||||||
|
String [] includePathsToUse = stdIncludePaths;
|
||||||
|
if( local && locIncludePaths != null && locIncludePaths.length > 0 )
|
||||||
|
includePathsToUse = locIncludePaths;
|
||||||
|
|
||||||
|
if (includePathsToUse != null ) {
|
||||||
int startpos = 0;
|
int startpos = 0;
|
||||||
if (include_next)
|
if (include_next)
|
||||||
startpos = findIncludePos(includePaths, currentDirectory) + 1;
|
startpos = findIncludePos(includePathsToUse, currentDirectory) + 1;
|
||||||
for (int i = startpos; i < includePaths.length; ++i) {
|
for (int i = startpos; i < includePathsToUse.length; ++i) {
|
||||||
reader = createReader(includePaths[i], filename);
|
reader = createReader(includePathsToUse[i], filename);
|
||||||
if (reader != null) {
|
if (reader != null) {
|
||||||
pushContext(reader.buffer, new InclusionData(reader,
|
pushContext(reader.buffer, new InclusionData(reader,
|
||||||
createInclusionConstruct(fileNameArray,
|
createInclusionConstruct(fileNameArray,
|
||||||
reader.filename, local, startOffset,
|
reader.filename, local, startOffset,
|
||||||
startingLineNumber, nameOffset,
|
startingLine, nameOffset,
|
||||||
nameEndOffset, nameLine, endOffset,
|
nameEndOffset, nameLine, endOffset,
|
||||||
endLine, false)));
|
endLine, false)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleProblem(IProblem.PREPROCESSOR_INCLUSION_NOT_FOUND, startOffset,
|
handleProblem(IProblem.PREPROCESSOR_INCLUSION_NOT_FOUND, startOffset,
|
||||||
fileNameArray);
|
fileNameArray);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue