mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
compilation warnings
This commit is contained in:
parent
6aaacce746
commit
068c62ae83
6 changed files with 35 additions and 20 deletions
|
@ -63,8 +63,9 @@ public abstract class BaseBOPConsoleParserTests extends BaseTestCase {
|
|||
fOutputParser.processLine("-c test.c"); // multiline //$NON-NLS-1$
|
||||
fOutputParser.processLine("gcc -D 'SUM(x, y) = (x) + (y)' -c test.c"); // more complex macro definition //$NON-NLS-1$
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
|
||||
assertTrue(sumSymbols.contains("MACRO1=1")); //$NON-NLS-1$
|
||||
assertTrue(sumSymbols.contains("MACRO1=1")); //$NON-NLS-1$
|
||||
assertTrue(sumSymbols.contains("MACRO2=value2")); //$NON-NLS-1$
|
||||
assertTrue(sumSymbols.contains("MACRO3=")); //$NON-NLS-1$
|
||||
assertTrue(sumSymbols.contains("MACRO4=value4")); //$NON-NLS-1$
|
||||
|
@ -85,7 +86,8 @@ public abstract class BaseBOPConsoleParserTests extends BaseTestCase {
|
|||
public void testParsingSymbolDefinitions_bug80271() {
|
||||
fOutputParser.processLine("gcc -DMACRO1 -I ..\\inc -c ..\\perfilescdtest\\source.c"); // PR 80271 //$NON-NLS-1$
|
||||
|
||||
List<String> sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
|
||||
assertTrue(sumSymbols.contains("MACRO1=1")); //$NON-NLS-1$
|
||||
assertTrue(sumSymbols.size() == 1);
|
||||
}
|
||||
|
@ -94,7 +96,8 @@ public abstract class BaseBOPConsoleParserTests extends BaseTestCase {
|
|||
fOutputParser.processLine("../src/bug186065.cc:8: error: missing terminating \" character"); // PR 80271 //$NON-NLS-1$
|
||||
fOutputParser.processLine("gcc -DBUG186065_IS_FIXED test.c"); //$NON-NLS-1$
|
||||
|
||||
List<String> sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
|
||||
assertTrue(sumSymbols.contains("BUG186065_IS_FIXED=1")); //$NON-NLS-1$
|
||||
assertTrue(sumSymbols.size() == 1);
|
||||
}
|
||||
|
@ -107,7 +110,8 @@ public abstract class BaseBOPConsoleParserTests extends BaseTestCase {
|
|||
fOutputParser.processLine("/usr/gcc-tool-x -DE test5.c"); //$NON-NLS-1$
|
||||
fOutputParser.processLine("/usr/gcc/something_else -DF test6.c"); //$NON-NLS-1$
|
||||
|
||||
List<String> sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
|
||||
assertTrue(sumSymbols.contains("A=1")); //$NON-NLS-1$
|
||||
assertTrue(sumSymbols.contains("B=1")); //$NON-NLS-1$
|
||||
assertTrue(sumSymbols.contains("C=1")); //$NON-NLS-1$
|
||||
|
@ -121,7 +125,8 @@ public abstract class BaseBOPConsoleParserTests extends BaseTestCase {
|
|||
fOutputParser.processLine("gcc -DA test1.c; gcc -DB test2.c"); //$NON-NLS-1$
|
||||
fOutputParser.processLine("nix -DC; gcc -DD test2.c"); //$NON-NLS-1$
|
||||
|
||||
List<String> sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
|
||||
assertTrue(sumSymbols.contains("A=1")); //$NON-NLS-1$
|
||||
assertTrue(sumSymbols.contains("B=1")); //$NON-NLS-1$
|
||||
assertFalse(sumSymbols.contains("C=1")); //$NON-NLS-1$
|
||||
|
@ -141,7 +146,8 @@ public abstract class BaseBOPConsoleParserTests extends BaseTestCase {
|
|||
fOutputParser.processLine("sh -c 'gcc -DAA test1.c; gcc -DBB test2.c'"); //$NON-NLS-1$
|
||||
fOutputParser.processLine("sh -c 'nix -DCC; gcc -DDD test2.c'"); //$NON-NLS-1$
|
||||
|
||||
List<String> sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
|
||||
assertTrue(sumSymbols.contains("A=1")); //$NON-NLS-1$
|
||||
assertTrue(sumSymbols.contains("B=1")); //$NON-NLS-1$
|
||||
assertTrue(sumSymbols.contains("C=1")); //$NON-NLS-1$
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2007 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -69,8 +69,9 @@ public class GCCScannerInfoConsoleParserTests extends BaseBOPConsoleParserTests
|
|||
fOutputParser.processLine("-Imultiline3\\"); //$NON-NLS-1$
|
||||
fOutputParser.processLine(" -DAA=\"BB\" test.c"); //$NON-NLS-1$
|
||||
|
||||
List sumIncludes = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.INCLUDE_PATHS);
|
||||
assertTrue(sumIncludes.contains("/dir/include")); //$NON-NLS-1$
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> sumIncludes = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.INCLUDE_PATHS);
|
||||
assertTrue(sumIncludes.contains("/dir/include")); //$NON-NLS-1$
|
||||
assertTrue(sumIncludes.contains("c:\\dir\\include")); //$NON-NLS-1$
|
||||
assertTrue(sumIncludes.contains("D:/dir/include")); //$NON-NLS-1$
|
||||
assertTrue(sumIncludes.contains("/dir2/include")); //$NON-NLS-1$
|
||||
|
|
|
@ -20,22 +20,27 @@ import java.util.Map;
|
|||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public interface IScannerInfoCollector {
|
||||
/**
|
||||
* Contribute to resource's scanner configuration
|
||||
*
|
||||
* @param resource - if used from within Eclipse it is expected that resource is a
|
||||
* member of <code>org.eclipse.core.resources.IResource</code> hierarchy.
|
||||
* If used outside of Eclipse then resource is expected to be a
|
||||
* <code>java.io.File<code> type.
|
||||
* @param resource
|
||||
* <li> {@link org.eclipse.core.resources.IResource} if used from within Eclipse.</li>
|
||||
* <li> {@link java.io.File} if used outside of Eclipse.</li>
|
||||
* <li> {@code Integer} if represents command ID.</li>
|
||||
* @param scannerInfo - a map of key - list pairs, where key is the type of extra info
|
||||
* i.e. target specific options or imacros commands,...
|
||||
* i.e. target specific options or imacros commands, for example
|
||||
* <li>{@code Map<ScannerInfoTypes, List<String>>}</li>
|
||||
* <li>{@code Map<ScannerInfoTypes, List<CCommandDSC>>}</li>
|
||||
*/
|
||||
public void contributeToScannerConfig(Object resource, Map scannerInfo);
|
||||
|
||||
/**
|
||||
* @return specific piece of discovered scanner info for a resource
|
||||
* discovered during the last collection cycle
|
||||
* discovered during the last collection cycle, can be:
|
||||
* <li>{@code List<String>}</li>
|
||||
* <li>{@code List<CCommandDSC>}</li>
|
||||
*/
|
||||
public List getCollectedScannerInfo(Object resource, ScannerInfoTypes type);
|
||||
|
||||
|
|
|
@ -63,11 +63,12 @@ public class GCCSpecsRunSIProvider extends DefaultRunSIProvider {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#prepareArguments(boolean)
|
||||
*/
|
||||
@Override
|
||||
@Override
|
||||
protected String[] prepareArguments(boolean isDefaultCommand) {
|
||||
if (collector == null)
|
||||
return fCompileArguments;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> tso = collector.getCollectedScannerInfo(resource.getProject(), ScannerInfoTypes.TARGET_SPECIFIC_OPTION);
|
||||
if (tso == null || tso.size() == 0) {
|
||||
return fCompileArguments;
|
||||
|
|
|
@ -95,7 +95,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
this.context = new InfoContext(project);
|
||||
}
|
||||
|
||||
public synchronized void contributeToScannerConfig(Object resource, Map scannerInfo, boolean isBuiltinConfig) {
|
||||
public synchronized void contributeToScannerConfig(Object resource, @SuppressWarnings("rawtypes") Map scannerInfo, boolean isBuiltinConfig) {
|
||||
this.isBuiltinConfig= isBuiltinConfig;
|
||||
try {
|
||||
contributeToScannerConfig(resource, scannerInfo);
|
||||
|
@ -108,7 +108,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#contributeToScannerConfig(java.lang.Object, java.util.Map)
|
||||
*/
|
||||
public synchronized void contributeToScannerConfig(Object resource, Map scannerInfo) {
|
||||
public synchronized void contributeToScannerConfig(Object resource, @SuppressWarnings("rawtypes") Map scannerInfo) {
|
||||
// check the resource
|
||||
String errorMessage = null;
|
||||
if (resource == null) {
|
||||
|
@ -141,6 +141,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
|
||||
for (Object name : scannerInfo.keySet()) {
|
||||
ScannerInfoTypes siType = (ScannerInfoTypes) name;
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> delta = (List<String>) scannerInfo.get(siType);
|
||||
|
||||
List<String> discovered = discoveredSI.get(siType);
|
||||
|
@ -344,7 +345,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
if (errorMessage != null) {
|
||||
TraceUtil.outputError("PerProjectSICollector.getCollectedScannerInfo : ", errorMessage); //$NON-NLS-1$
|
||||
}
|
||||
else if (project.equals(((IResource)resource).getProject())) {
|
||||
else if (resource!=null && project.equals(((IResource)resource).getProject())) {
|
||||
rv = discoveredSI.get(type);
|
||||
}
|
||||
return rv;
|
||||
|
|
|
@ -61,10 +61,11 @@ public class SCDMakefileGenerator extends DefaultRunSIProvider {
|
|||
return generateMakefile(resource.getProject().getName());
|
||||
}
|
||||
|
||||
private boolean generateMakefile(String projectName) {
|
||||
private boolean generateMakefile(String projectName) {
|
||||
boolean rc = false;
|
||||
if (collector instanceof IScannerInfoCollector2) {
|
||||
IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector;
|
||||
@SuppressWarnings("unchecked")
|
||||
List<CCommandDSC> commands = collector2.getCollectedScannerInfo(
|
||||
resource.getProject(), ScannerInfoTypes.UNDISCOVERED_COMPILER_COMMAND);
|
||||
if (commands != null && commands.size() > 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue