1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Fix for 155096 by Martin Oberhuber, additional switches for gcc scanner discovery.

This commit is contained in:
Markus Schorn 2006-11-10 11:46:38 +00:00
parent 68fce7ef7c
commit 9350190911
3 changed files with 46 additions and 10 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* IBM - Initial API and implementation * IBM - Initial API and implementation
* Martin Oberhuber (Wind River Systems) - bug 155096
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.make.internal.core.scannerconfig.gnu; package org.eclipse.cdt.make.internal.core.scannerconfig.gnu;
@ -127,15 +128,36 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
/** /**
* @param genericLine * @param genericLine
* @param cppFileType * @param cppFileType
* @return CCommandDSC compile command description
*/ */
public CCommandDSC getNewCCommandDSC(String genericLine, boolean cppFileType) { public CCommandDSC getNewCCommandDSC(String genericLine, boolean cppFileType) {
CCommandDSC command = new CCommandDSC(cppFileType); CCommandDSC command = new CCommandDSC(cppFileType);
String[] tokens = genericLine.split("\\s+"); //$NON-NLS-1$ String[] tokens = genericLine.split("\\s+"); //$NON-NLS-1$
command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), tokens[0])); command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), tokens[0]));
for (int i = 1; i < tokens.length; ++i) { for (int i = 1; i < tokens.length; ++i) {
String token = tokens[i];
//Target specific options: see GccScannerInfoConsoleParser
if (token.startsWith("-m") || //$NON-NLS-1$
token.equals("-ansi") || //$NON-NLS-1$
token.equals("-posix") || //$NON-NLS-1$
token.equals("-pthread") || //$NON-NLS-1$
token.startsWith("-O") || //$NON-NLS-1$
token.equals("-fno-inline") || //$NON-NLS-1$
token.startsWith("-finline") || //$NON-NLS-1$
token.equals("-fno-exceptions") || //$NON-NLS-1$
token.equals("-fexceptions") || //$NON-NLS-1$
token.equals("-fshort-wchar") || //$NON-NLS-1$
token.equals("-fshort-double") || //$NON-NLS-1$
token.equals("-fno-signed-char") || //$NON-NLS-1$
token.equals("-fsigned-char") || //$NON-NLS-1$
token.startsWith("-fabi-version=") //$NON-NLS-1$
) {
command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), token));
continue;
}
for (int j = SCDOptionsEnum.MIN; j <= SCDOptionsEnum.MAX; ++j) { for (int j = SCDOptionsEnum.MIN; j <= SCDOptionsEnum.MAX; ++j) {
if (tokens[i].startsWith(SCDOptionsEnum.getSCDOptionsEnum(j).toString())) { if (token.startsWith(SCDOptionsEnum.getSCDOptionsEnum(j).toString())) {
String option = tokens[i].substring( String option = token.substring(
SCDOptionsEnum.getSCDOptionsEnum(j).toString().length()).trim(); SCDOptionsEnum.getSCDOptionsEnum(j).toString().length()).trim();
if (option.length() > 0) { if (option.length() > 0) {
// ex. -I/dir // ex. -I/dir
@ -220,8 +242,9 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
// } // }
/** /**
* Returns all CCommandDSC collected so far * Returns all CCommandDSC collected so far.
* @return * Currently this list is not filled, so it will always return an empty list.
* @return List of CCommandDSC
*/ */
public List getCCommandDSCList() { public List getCCommandDSCList() {
return new ArrayList(commandsList2); return new ArrayList(commandsList2);

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* IBM - Initial API and implementation * IBM - Initial API and implementation
* Martin Oberhuber (Wind River Systems) - bug 155096
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.make.internal.core.scannerconfig.gnu; package org.eclipse.cdt.make.internal.core.scannerconfig.gnu;
@ -89,7 +90,7 @@ public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser {
symbol = defineParts[1] + "=" + defineParts[2]; //$NON-NLS-1$ symbol = defineParts[1] + "=" + defineParts[2]; //$NON-NLS-1$
break; break;
} }
if (symbol != null && !symbols.contains(symbol)) { //$NON-NLS-1$ if (symbol != null && !symbols.contains(symbol)) {
symbols.add(symbol); symbols.add(symbol);
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* IBM - Initial API and implementation * IBM - Initial API and implementation
* Martin Oberhuber (Wind River Systems) - bug 155096
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.make.internal.core.scannerconfig.gnu; package org.eclipse.cdt.make.internal.core.scannerconfig.gnu;
@ -100,7 +101,18 @@ public class GCCScannerInfoConsoleParser extends AbstractGCCBOPConsoleParser {
token.equals("-ansi") || //$NON-NLS-1$ token.equals("-ansi") || //$NON-NLS-1$
token.equals("-nostdinc") || //$NON-NLS-1$ token.equals("-nostdinc") || //$NON-NLS-1$
token.equals("-posix") || //$NON-NLS-1$ token.equals("-posix") || //$NON-NLS-1$
token.equals("-pthread")) { //$NON-NLS-1$ token.equals("-pthread") || //$NON-NLS-1$
token.startsWith("-O") || //$NON-NLS-1$
token.equals("-fno-inline") || //$NON-NLS-1$
token.startsWith("-finline") || //$NON-NLS-1$
token.equals("-fno-exceptions") || //$NON-NLS-1$
token.equals("-fexceptions") || //$NON-NLS-1$
token.equals("-fshort-wchar") || //$NON-NLS-1$
token.equals("-fshort-double") || //$NON-NLS-1$
token.equals("-fno-signed-char") || //$NON-NLS-1$
token.equals("-fsigned-char") || //$NON-NLS-1$
token.startsWith("-fabi-version=") //$NON-NLS-1$
) {
if (!targetSpecificOptions.contains(token)) if (!targetSpecificOptions.contains(token))
targetSpecificOptions.add(token); targetSpecificOptions.add(token);
} }