1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

bug 319512: compilation warnings

This commit is contained in:
Andrew Gvozdev 2010-07-21 04:42:33 +00:00
parent b64329ba17
commit 007e46e51f
7 changed files with 39 additions and 50 deletions

View file

@ -18,8 +18,6 @@ import org.eclipse.cdt.managedbuilder.internal.core.Builder;
import org.eclipse.cdt.managedbuilder.internal.core.Configuration; import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.variables.IStringVariableManager;
import org.eclipse.core.variables.VariablesPlugin;
public class BuildBuildData extends CBuildData { public class BuildBuildData extends CBuildData {
private Builder fBuilder; private Builder fBuilder;
@ -35,11 +33,11 @@ public class BuildBuildData extends CBuildData {
return new Path(fBuilder.getBuildPath());//ManagedBuildManager.getBuildLocation(fCfg, fBuilder); return new Path(fBuilder.getBuildPath());//ManagedBuildManager.getBuildLocation(fCfg, fBuilder);
} }
private IPath createAbsolutePathFromWorkspacePath(IPath path){ // private IPath createAbsolutePathFromWorkspacePath(IPath path){
IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager(); // IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
String locationString = mngr.generateVariableExpression("workspace_loc", path.toString()); //$NON-NLS-1$ // String locationString = mngr.generateVariableExpression("workspace_loc", path.toString()); //$NON-NLS-1$
return new Path(locationString); // return new Path(locationString);
} // }
@Override @Override
public String[] getErrorParserIDs() { public String[] getErrorParserIDs() {

View file

@ -147,7 +147,9 @@ public class BuildEntryStorage extends AbstractEntryStorage {
uei = new UserEntryInfo(infos[i].getEntry(), null, null, null); uei = new UserEntryInfo(infos[i].getEntry(), null, null, null);
userInfos[i] = uei; userInfos[i] = uei;
} }
setUserEntries(userInfos, (List<EmptyEntryInfo>)level.getContext()); @SuppressWarnings("unchecked")
List<EmptyEntryInfo> context = (List<EmptyEntryInfo>)level.getContext();
setUserEntries(userInfos, context);
setUserUndefinedStringSet(level.containsOverrideInfo() ? level.getOverrideSet() : null); setUserUndefinedStringSet(level.containsOverrideInfo() ? level.getOverrideSet() : null);
} }
break; break;
@ -193,9 +195,7 @@ public class BuildEntryStorage extends AbstractEntryStorage {
} }
/** /**
* Return scanner discovered entries (level 2) * @return scanner discovered entries (level 2)
* @param flags
* @return
*/ */
private ICLanguageSettingEntry[] getDiscoveredEntries(int flags){ private ICLanguageSettingEntry[] getDiscoveredEntries(int flags){
ICLanguageSettingEntry[] entries = ProfileInfoProvider.getInstance().getEntryValues(fLangData, getKind(), flags); ICLanguageSettingEntry[] entries = ProfileInfoProvider.getInstance().getEntryValues(fLangData, getKind(), flags);
@ -225,8 +225,6 @@ public class BuildEntryStorage extends AbstractEntryStorage {
* *
* The UserEntryInfo[] is an array of all user entries from all the options * The UserEntryInfo[] is an array of all user entries from all the options
* applicable to the language setting entry kind. * applicable to the language setting entry kind.
* @param flags
* @param usr
* @param emptyValuesInfos list to which unresolved entries are added * @param emptyValuesInfos list to which unresolved entries are added
* @return UserEntryInfo[] (never null) * @return UserEntryInfo[] (never null)
*/ */
@ -236,6 +234,7 @@ public class BuildEntryStorage extends AbstractEntryStorage {
List<UserEntryInfo> entryList = new ArrayList<UserEntryInfo>(); List<UserEntryInfo> entryList = new ArrayList<UserEntryInfo>();
for (IOption opt : options) { for (IOption opt : options) {
Option option = (Option)opt; Option option = (Option)opt;
@SuppressWarnings("unchecked")
List<OptionStringValue> list = usr ? (List<OptionStringValue>)option.getExactValue() : (List<OptionStringValue>)option.getExactBuiltinsList(); List<OptionStringValue> list = usr ? (List<OptionStringValue>)option.getExactValue() : (List<OptionStringValue>)option.getExactBuiltinsList();
if(list != null){ if(list != null){
SupplierBasedCdtVariableSubstitutor subst = createSubstitutor(option, false); SupplierBasedCdtVariableSubstitutor subst = createSubstitutor(option, false);
@ -291,6 +290,7 @@ public class BuildEntryStorage extends AbstractEntryStorage {
private HashSet<String> getUserUndefinedStringSet(){ private HashSet<String> getUserUndefinedStringSet(){
HashSet<String> set = null; HashSet<String> set = null;
for (IOption option : fLangData.getUndefOptionsForKind(getKind())) { for (IOption option : fLangData.getUndefOptionsForKind(getKind())) {
@SuppressWarnings("unchecked")
List<String> list = (List<String>)option.getValue(); List<String> list = (List<String>)option.getValue();
if(list.size() != 0){ if(list.size() != 0){
if(set == null) if(set == null)
@ -303,8 +303,6 @@ public class BuildEntryStorage extends AbstractEntryStorage {
/** /**
* Makes non-absolute paths relative to the build directory * Makes non-absolute paths relative to the build directory
* @param info
* @return
*/ */
private PathInfo fromBuildToProj(PathInfo info){ private PathInfo fromBuildToProj(PathInfo info){
if(info.isAbsolute()) if(info.isAbsolute())
@ -363,9 +361,7 @@ public class BuildEntryStorage extends AbstractEntryStorage {
} }
/** /**
* Return env envtries (level 1) * @return env entries (level 1)
* @param flags
* @return
*/ */
private ICLanguageSettingEntry[] getEnvEntries(int flags){ private ICLanguageSettingEntry[] getEnvEntries(int flags){
String paths[] = null; String paths[] = null;
@ -396,11 +392,6 @@ public class BuildEntryStorage extends AbstractEntryStorage {
/** /**
* Create an ICLanguageSettingEntry based on the passed in Option * Create an ICLanguageSettingEntry based on the passed in Option
* @param option
* @param optionValue
* @param flags
* @param subst
* @return
*/ */
private ICLanguageSettingEntry createUserEntry(Option option, OptionStringValue optionValue, int flags, SupplierBasedCdtVariableSubstitutor subst){ private ICLanguageSettingEntry createUserEntry(Option option, OptionStringValue optionValue, int flags, SupplierBasedCdtVariableSubstitutor subst){
final int kind = getKind(); final int kind = getKind();
@ -536,7 +527,6 @@ public class BuildEntryStorage extends AbstractEntryStorage {
} }
/** /**
* @param option
* @return the option type for the option * @return the option type for the option
*/ */
private static int getOptionType(IOption option) { private static int getOptionType(IOption option) {
@ -671,8 +661,6 @@ public class BuildEntryStorage extends AbstractEntryStorage {
* *
* FIXME: As far as I can see info.fSequense only ever has a single entry in it... * FIXME: As far as I can see info.fSequense only ever has a single entry in it...
* see UserEntryInfo constructor => this method doesn't accomplish anything useful * see UserEntryInfo constructor => this method doesn't accomplish anything useful
* @param infos
* @return
*/ */
private UserEntryInfo[] combineSequenses(UserEntryInfo infos[]){ private UserEntryInfo[] combineSequenses(UserEntryInfo infos[]){
if(infos.length == 0) if(infos.length == 0)

View file

@ -61,7 +61,7 @@ public class BuildEnvironmentContributor implements IEnvironmentContributor {
EnvironmentCollector collector = new EnvironmentCollector(); EnvironmentCollector collector = new EnvironmentCollector();
ExternalExtensionEnvironmentSupplier extSupplier = new ExternalExtensionEnvironmentSupplier(provider); ExternalExtensionEnvironmentSupplier extSupplier = new ExternalExtensionEnvironmentSupplier(provider);
Set set = null; Set<String> set = null;
IEnvironmentVariable vars[] = extSupplier.getVariables(fCfg.getManagedProject()); IEnvironmentVariable vars[] = extSupplier.getVariables(fCfg.getManagedProject());
set = processVariables(vars, collector, provider, set); set = processVariables(vars, collector, provider, set);
@ -89,11 +89,11 @@ public class BuildEnvironmentContributor implements IEnvironmentContributor {
return varFound; return varFound;
} }
private Set processVariables(IEnvironmentVariable vars[], EnvironmentCollector collector, IEnvironmentVariableManager provider, Set set){ private Set<String> processVariables(IEnvironmentVariable vars[], EnvironmentCollector collector, IEnvironmentVariableManager provider, Set<String> set){
boolean checkSet = true; boolean checkSet = true;
if(vars != null && vars.length != 0){ if(vars != null && vars.length != 0){
if(set == null){ if(set == null){
set = new HashSet(); set = new HashSet<String>();
checkSet = false; checkSet = false;
} }

View file

@ -12,8 +12,8 @@ package org.eclipse.cdt.managedbuilder.internal.enablement;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Map.Entry;
import java.util.Map; import java.util.Set;
public class AdjustmentContext { public class AdjustmentContext {
@ -49,10 +49,10 @@ public class AdjustmentContext {
// return fType; // return fType;
// } // }
private HashMap fMap = new HashMap(); private HashMap<String, Boolean> fMap = new HashMap<String, Boolean>();
public void addAdjustedState(String attr, boolean adjusted){ public void addAdjustedState(String attr, boolean adjusted){
Boolean b = (Boolean)fMap.get(attr); Boolean b = fMap.get(attr);
if(b == null || if(b == null ||
(adjusted && (adjusted &&
!b.booleanValue())){ !b.booleanValue())){
@ -64,14 +64,14 @@ public class AdjustmentContext {
if(fMap.size() == 0) if(fMap.size() == 0)
return new String[0]; return new String[0];
ArrayList list = new ArrayList(fMap.size()); ArrayList<String> list = new ArrayList<String>(fMap.size());
for(Iterator iter = fMap.entrySet().iterator(); iter.hasNext();){ Set<Entry<String, Boolean>> entrySet = fMap.entrySet();
Map.Entry entry = (Map.Entry)iter.next(); for (Entry<String, Boolean> entry : entrySet) {
Boolean b = (Boolean)entry.getValue(); Boolean b = entry.getValue();
if(!b.booleanValue()){ if(!b.booleanValue()){
list.add(entry.getKey()); list.add(entry.getKey());
} }
} }
return (String[])list.toArray(new String[list.size()]); return list.toArray(new String[list.size()]);
} }
} }

View file

@ -123,8 +123,9 @@ public class CheckOptionExpression implements IBooleanExpression {
case IOption.UNDEF_LIBRARY_PATHS: case IOption.UNDEF_LIBRARY_PATHS:
case IOption.UNDEF_LIBRARY_FILES: case IOption.UNDEF_LIBRARY_FILES:
case IOption.UNDEF_MACRO_FILES:{ case IOption.UNDEF_MACRO_FILES:{
List list = (List)option.getValue(); @SuppressWarnings("unchecked")
String listValue = provider.convertStringListToString((String[])list.toArray(new String[list.size()]),delimiter); List<String> list = (List<String>)option.getValue();
String listValue = provider.convertStringListToString(list.toArray(new String[list.size()]),delimiter);
listValue = provider.resolveValue(listValue, inexVal, delimiter, listValue = provider.resolveValue(listValue, inexVal, delimiter,
IBuildMacroProvider.CONTEXT_OPTION, IBuildMacroProvider.CONTEXT_OPTION,
@ -188,11 +189,13 @@ public class CheckOptionExpression implements IBooleanExpression {
case IOption.UNDEF_LIBRARY_PATHS: case IOption.UNDEF_LIBRARY_PATHS:
case IOption.UNDEF_LIBRARY_FILES: case IOption.UNDEF_LIBRARY_FILES:
case IOption.UNDEF_MACRO_FILES:{ case IOption.UNDEF_MACRO_FILES:{
List list = (List)option.getValue(); @SuppressWarnings("unchecked")
String listValue[] = (String[])list.toArray(new String[list.size()]); List<String> list = (List<String>)option.getValue();
String listValue[] = list.toArray(new String[list.size()]);
list = (List)otherOption.getValue(); @SuppressWarnings("unchecked")
String otherValue[] = (String[])list.toArray(new String[list.size()]); List<String> otherList = (List<String>)otherOption.getValue();
String otherValue[] = otherList.toArray(new String[otherList.size()]);
IMacroContextInfo info = provider.getMacroContextInfo(IBuildMacroProvider.CONTEXT_OPTION, IMacroContextInfo info = provider.getMacroContextInfo(IBuildMacroProvider.CONTEXT_OPTION,
new OptionContextData(option,holder)); new OptionContextData(option,holder));

View file

@ -64,10 +64,10 @@ public abstract class CompositeExpression implements IBooleanExpression {
return fChildren; return fChildren;
} }
public Map getReferencedProperties(Map map){ public Map<String, Set<String>> getReferencedProperties(Map<String, Set<String>> map){
IBooleanExpression children[] = getChildren(); IBooleanExpression children[] = getChildren();
if(map == null) if(map == null)
map = new HashMap(); map = new HashMap<String, Set<String>>();
for(int i = 0; i < children.length; i++){ for(int i = 0; i < children.length; i++){
IBooleanExpression child = children[i]; IBooleanExpression child = children[i];
@ -79,9 +79,9 @@ public abstract class CompositeExpression implements IBooleanExpression {
String val = bp.getValueId(); String val = bp.getValueId();
if(prop != null && prop.length() != 0 if(prop != null && prop.length() != 0
&& val != null && val.length() != 0){ && val != null && val.length() != 0){
Set set = (Set)map.get(prop); Set<String> set = map.get(prop);
if(set == null){ if(set == null){
set = new HashSet(); set = new HashSet<String>();
map.put(prop, set); map.put(prop, set);
} }
set.add(val); set.add(val);

View file

@ -129,7 +129,7 @@ public class OptionEnablementExpression extends AndExpression{
} }
public String[] convertToList(String value, String delimiter){ public String[] convertToList(String value, String delimiter){
List list = new ArrayList(); List<String> list = new ArrayList<String>();
int delLength = delimiter.length(); int delLength = delimiter.length();
int valLength = value.length(); int valLength = value.length();
@ -149,7 +149,7 @@ public class OptionEnablementExpression extends AndExpression{
} }
} }
return (String[])list.toArray(new String[list.size()]); return list.toArray(new String[list.size()]);
} }
protected int calculateFlags(String flagsString){ protected int calculateFlags(String flagsString){