mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for 189909 by Gerhard Schaber, scanner discovery does not handle -iquote
This commit is contained in:
parent
fa5ff5f046
commit
02cf226a2b
4 changed files with 66 additions and 18 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2007 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Martin Oberhuber (Wind River Systems) - bug 155096
|
||||
* Gerhard Schaber (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.make.internal.core.scannerconfig.gnu;
|
||||
|
||||
|
@ -132,6 +133,8 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
|
|||
* @return CCommandDSC compile command description
|
||||
*/
|
||||
public CCommandDSC getNewCCommandDSC(String[] tokens, boolean cppFileType) {
|
||||
ArrayList dirafter = new ArrayList();
|
||||
ArrayList includes = new ArrayList();
|
||||
CCommandDSC command = new CCommandDSC(cppFileType, getProject());
|
||||
command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), tokens[0]));
|
||||
for (int i = 1; i < tokens.length; ++i) {
|
||||
|
@ -163,6 +166,12 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
|
|||
// ex. -I/dir
|
||||
}
|
||||
else if (SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.IDASH)) {
|
||||
for (Iterator iter=includes.iterator(); iter.hasNext(); ) {
|
||||
option = (String)iter.next();
|
||||
KVStringPair pair = new KVStringPair(SCDOptionsEnum.IQUOTE.toString(), option);
|
||||
command.addSCOption(pair);
|
||||
}
|
||||
includes = new ArrayList();
|
||||
// -I- has no parameter
|
||||
}
|
||||
else {
|
||||
|
@ -179,15 +188,34 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
|
|||
SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.INCLUDE_FILE) ||
|
||||
SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.IMACROS_FILE) ||
|
||||
SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.IDIRAFTER) ||
|
||||
SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.ISYSTEM))) {
|
||||
SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.ISYSTEM) ||
|
||||
SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.IQUOTE) )) {
|
||||
option = (getAbsolutePath(option)).toString();
|
||||
}
|
||||
// add the pair
|
||||
command.addSCOption(new KVStringPair(SCDOptionsEnum.getSCDOptionsEnum(j).toString(), option));
|
||||
if (SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.IDIRAFTER)) {
|
||||
KVStringPair pair = new KVStringPair(SCDOptionsEnum.INCLUDE.toString(), option);
|
||||
dirafter.add(pair);
|
||||
}
|
||||
else if (SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.INCLUDE)) {
|
||||
includes.add(option);
|
||||
}
|
||||
else { // add the pair
|
||||
KVStringPair pair = new KVStringPair(SCDOptionsEnum.getSCDOptionsEnum(j).toString(), option);
|
||||
command.addSCOption(pair);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
String option;
|
||||
for (Iterator iter=includes.iterator(); iter.hasNext(); ) {
|
||||
option = (String)iter.next();
|
||||
KVStringPair pair = new KVStringPair(SCDOptionsEnum.INCLUDE.toString(), option);
|
||||
command.addSCOption(pair);
|
||||
}
|
||||
for (Iterator iter=dirafter.iterator(); iter.hasNext(); ) {
|
||||
command.addSCOption((KVStringPair)iter.next());
|
||||
}
|
||||
return command;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Gerhard Schaber (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.make.internal.core.scannerconfig.util;
|
||||
|
||||
|
@ -80,7 +81,8 @@ public class CCommandDSC {
|
|||
(option.getKey().equals(SCDOptionsEnum.INCLUDE_FILE.toString()) ||
|
||||
option.getKey().equals(SCDOptionsEnum.INCLUDE.toString()) ||
|
||||
option.getKey().equals(SCDOptionsEnum.ISYSTEM.toString()) ||
|
||||
option.getKey().equals(SCDOptionsEnum.IMACROS_FILE.toString())))
|
||||
option.getKey().equals(SCDOptionsEnum.IMACROS_FILE.toString()) ||
|
||||
option.getKey().equals(SCDOptionsEnum.IQUOTE.toString())))
|
||||
{
|
||||
String value = option.getValue();
|
||||
value = (String)CygpathTranslator.translateIncludePaths(project, Collections.singletonList(value)).get(0);
|
||||
|
@ -142,12 +144,14 @@ public class CCommandDSC {
|
|||
continue;
|
||||
String value = optionPair.getValue();
|
||||
if (optionPair.getKey().equals(SCDOptionsEnum.INCLUDE.toString()) ||
|
||||
optionPair.getKey().equals(SCDOptionsEnum.ISYSTEM.toString())) {
|
||||
optionPair.getKey().equals(SCDOptionsEnum.ISYSTEM.toString()) ||
|
||||
optionPair.getKey().equals(SCDOptionsEnum.IQUOTE.toString())) {
|
||||
value = makeAbsolute(project, value);
|
||||
}
|
||||
if (quoteIncludePaths) {
|
||||
if (optionPair.getKey().equals(SCDOptionsEnum.INCLUDE.toString()) ||
|
||||
optionPair.getKey().equals(SCDOptionsEnum.ISYSTEM.toString())) {
|
||||
optionPair.getKey().equals(SCDOptionsEnum.ISYSTEM.toString()) ||
|
||||
optionPair.getKey().equals(SCDOptionsEnum.IQUOTE.toString())) {
|
||||
commandAsString += optionPair.getKey() + SINGLE_SPACE +
|
||||
"\"" + value + "\"" + SINGLE_SPACE; //$NON-NLS-1$//$NON-NLS-2$
|
||||
}
|
||||
|
@ -367,12 +371,12 @@ public class CCommandDSC {
|
|||
KVStringPair optionPair = (KVStringPair)options.next();
|
||||
String key = optionPair.getKey();
|
||||
String value = optionPair.getValue();
|
||||
if (key.equals(SCDOptionsEnum.INCLUDE.toString())) {
|
||||
quoteincludes.add(value);
|
||||
}
|
||||
else if (key.equals(SCDOptionsEnum.ISYSTEM.toString())) {
|
||||
if (key.equals(SCDOptionsEnum.INCLUDE.toString()) || key.equals(SCDOptionsEnum.ISYSTEM.toString())) {
|
||||
includes.add(value);
|
||||
}
|
||||
else if (key.equals(SCDOptionsEnum.IQUOTE.toString())) {
|
||||
quoteincludes.add(value);
|
||||
}
|
||||
else if (key.equals(SCDOptionsEnum.DEFINE.toString())) {
|
||||
symbols.add(value);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2005 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2007 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Gerhard Schaber (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.make.internal.core.scannerconfig.util;
|
||||
|
||||
|
@ -32,7 +33,8 @@ public final class SCDOptionsEnum {
|
|||
public static final SCDOptionsEnum IPREFIX = new SCDOptionsEnum(11); // -iprefix prefix
|
||||
public static final SCDOptionsEnum IWITHPREFIX = new SCDOptionsEnum(12); // -iwithprefix dir
|
||||
public static final SCDOptionsEnum IWITHPREFIXBEFORE = new SCDOptionsEnum(13); // -iwithprefixbefore dir
|
||||
public static final int MAX = 13;
|
||||
public static final SCDOptionsEnum IQUOTE = new SCDOptionsEnum(14); // -iquote dir
|
||||
public static final int MAX = 14;
|
||||
|
||||
private static final String[] SCDOPTION_STRING_VALS = {
|
||||
"cc", //$NON-NLS-1$
|
||||
|
@ -48,7 +50,8 @@ public final class SCDOptionsEnum {
|
|||
"-isystem", //$NON-NLS-1$
|
||||
"-iprefix", //$NON-NLS-1$
|
||||
"-iwithprefix", //$NON-NLS-1$
|
||||
"-iwithprefixbefore" //$NON-NLS-1$
|
||||
"-iwithprefixbefore", //$NON-NLS-1$
|
||||
"-iquote" //$NON-NLS-1$
|
||||
};
|
||||
private static final SCDOptionsEnum SCDOPTIONS[] = {
|
||||
COMMAND, DEFINE, UNDEFINE, IDASH, INCLUDE, NOSTDINC, NOSTDINCPP, INCLUDE_FILE, IMACROS_FILE,
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
package org.eclipse.cdt.make.internal.core.scannerconfig2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -273,11 +274,11 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
cmd.setSymbols(siItem);
|
||||
siItem = (List) scannerInfo.get(ScannerInfoTypes.INCLUDE_PATHS);
|
||||
siItem = CygpathTranslator.translateIncludePaths(project, siItem);
|
||||
siItem = CCommandDSC.makeAbsolute(project, siItem);
|
||||
siItem = CCommandDSC.makeRelative(project, siItem);
|
||||
cmd.setIncludes(siItem);
|
||||
siItem = (List) scannerInfo.get(ScannerInfoTypes.QUOTE_INCLUDE_PATHS);
|
||||
siItem = CygpathTranslator.translateIncludePaths(project, siItem);
|
||||
siItem = CCommandDSC.makeAbsolute(project, siItem);
|
||||
siItem = CCommandDSC.makeRelative(project, siItem);
|
||||
cmd.setQuoteIncludes(siItem);
|
||||
|
||||
cmd.setDiscovered(true);
|
||||
|
@ -603,7 +604,18 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
*/
|
||||
public IPath[] getIncludePaths() {
|
||||
// return new IPath[0];
|
||||
return getAllIncludePaths(INCLUDE_PATH);
|
||||
IPath[] includepaths = getAllIncludePaths(INCLUDE_PATH);
|
||||
IPath[] quotepaths = getAllIncludePaths(QUOTE_INCLUDE_PATH);
|
||||
if (quotepaths == null || quotepaths.length == 0) {
|
||||
return includepaths;
|
||||
}
|
||||
if (includepaths == null || includepaths.length == 0) {
|
||||
return quotepaths;
|
||||
}
|
||||
ArrayList result = new ArrayList(includepaths.length + quotepaths.length);
|
||||
result.addAll(Arrays.asList(includepaths));
|
||||
result.addAll(Arrays.asList(quotepaths));
|
||||
return (IPath[])result.toArray(new IPath[result.size()]);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -841,7 +853,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
String include = (String) j.next();
|
||||
// the following line degrades perfomance
|
||||
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=189127
|
||||
// include = CCommandDSC.makeRelative(project, new Path(include)).toPortableString();
|
||||
// it is not necessary for renaming projects anyway
|
||||
// include = CCommandDSC.makeRelative(project, new Path(include)).toPortableString();
|
||||
if (!allIncludes.contains(include)) {
|
||||
allIncludes.add(include);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue