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:
parent
eb113d1aa4
commit
ec89889177
1 changed files with 28 additions and 41 deletions
|
@ -12,7 +12,6 @@ package org.eclipse.cdt.managedbuilder.internal.buildmodel;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -47,8 +46,8 @@ import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
public class BuildStep implements IBuildStep {
|
public class BuildStep implements IBuildStep {
|
||||||
private List fInputTypes = new ArrayList();
|
private List<BuildIOType> fInputTypes = new ArrayList<BuildIOType>();
|
||||||
private List fOutputTypes = new ArrayList();
|
private List<BuildIOType> fOutputTypes = new ArrayList<BuildIOType>();
|
||||||
private ITool fTool;
|
private ITool fTool;
|
||||||
private BuildGroup fBuildGroup;
|
private BuildGroup fBuildGroup;
|
||||||
private boolean fNeedsRebuild;
|
private boolean fNeedsRebuild;
|
||||||
|
@ -73,14 +72,14 @@ public class BuildStep implements IBuildStep {
|
||||||
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getInputIOTypes()
|
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getInputIOTypes()
|
||||||
*/
|
*/
|
||||||
public IBuildIOType[] getInputIOTypes() {
|
public IBuildIOType[] getInputIOTypes() {
|
||||||
return (BuildIOType[])fInputTypes.toArray(new BuildIOType[fInputTypes.size()]);
|
return fInputTypes.toArray(new BuildIOType[fInputTypes.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getOutputIOTypes()
|
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getOutputIOTypes()
|
||||||
*/
|
*/
|
||||||
public IBuildIOType[] getOutputIOTypes() {
|
public IBuildIOType[] getOutputIOTypes() {
|
||||||
return (BuildIOType[])fOutputTypes.toArray(new BuildIOType[fOutputTypes.size()]);
|
return fOutputTypes.toArray(new BuildIOType[fOutputTypes.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -179,35 +178,27 @@ public class BuildStep implements IBuildStep {
|
||||||
}
|
}
|
||||||
|
|
||||||
public BuildIOType[] getPrimaryTypes(boolean input){
|
public BuildIOType[] getPrimaryTypes(boolean input){
|
||||||
Iterator iter = input ?
|
List<BuildIOType> types = input ? fInputTypes : fOutputTypes;
|
||||||
fInputTypes.iterator() :
|
|
||||||
fOutputTypes.iterator();
|
|
||||||
|
|
||||||
List list = new ArrayList();
|
List<BuildIOType> list = new ArrayList<BuildIOType>();
|
||||||
while(iter.hasNext()){
|
for (BuildIOType arg : types) {
|
||||||
BuildIOType arg = (BuildIOType)iter.next();
|
|
||||||
if(arg.isPrimary())
|
if(arg.isPrimary())
|
||||||
list.add(arg);
|
list.add(arg);
|
||||||
}
|
}
|
||||||
return (BuildIOType[])list.toArray(new BuildIOType[list.size()]);
|
return list.toArray(new BuildIOType[list.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BuildIOType getIOTypeForType(IBuildObject ioType, boolean input){
|
public BuildIOType getIOTypeForType(IBuildObject ioType, boolean input){
|
||||||
List list;
|
List<BuildIOType> list = input ? fInputTypes : fOutputTypes;
|
||||||
if(input)
|
|
||||||
list = fInputTypes;
|
|
||||||
else
|
|
||||||
list = fOutputTypes;
|
|
||||||
|
|
||||||
if(ioType != null){
|
if(ioType != null){
|
||||||
for(Iterator iter = list.iterator();iter.hasNext();){
|
for (BuildIOType arg : list) {
|
||||||
BuildIOType arg = (BuildIOType)iter.next();
|
|
||||||
if(arg.getIoType() == ioType)
|
if(arg.getIoType() == ioType)
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(list.size() > 0)
|
if(list.size() > 0)
|
||||||
return (BuildIOType)list.get(0);
|
return list.get(0);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -231,19 +222,16 @@ public class BuildStep implements IBuildStep {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBuildResource[] getResources(boolean input){
|
public IBuildResource[] getResources(boolean input){
|
||||||
Iterator iter = input ?
|
List<BuildIOType> list = input ? fInputTypes : fOutputTypes;
|
||||||
fInputTypes.iterator() :
|
Set<IBuildResource> set = new HashSet<IBuildResource>();
|
||||||
fOutputTypes.iterator();
|
|
||||||
|
|
||||||
Set set = new HashSet();
|
for (BuildIOType arg : list) {
|
||||||
|
IBuildResource rcs[] = arg.getResources();
|
||||||
while(iter.hasNext()){
|
|
||||||
IBuildResource rcs[] = ((BuildIOType)iter.next()).getResources();
|
|
||||||
for(int j = 0; j < rcs.length; j++){
|
for(int j = 0; j < rcs.length; j++){
|
||||||
set.add(rcs[j]);
|
set.add(rcs[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (BuildResource[])set.toArray(new BuildResource[set.size()]);
|
return set.toArray(new BuildResource[set.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -288,14 +276,14 @@ public class BuildStep implements IBuildStep {
|
||||||
commands[commands.length - 1] = commands[commands.length - 1] + appendToLastStep;
|
commands[commands.length - 1] = commands[commands.length - 1] + appendToLastStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
List list = new ArrayList();
|
List<IBuildCommand> list = new ArrayList<IBuildCommand>();
|
||||||
for(int i = 0; i < commands.length; i++){
|
for(int i = 0; i < commands.length; i++){
|
||||||
IBuildCommand cmds[] = createCommandsFromString(commands[i], cwd, getEnvironment());
|
IBuildCommand cmds[] = createCommandsFromString(commands[i], cwd, getEnvironment());
|
||||||
for(int j = 0; j < cmds.length; j++){
|
for(int j = 0; j < cmds.length; j++){
|
||||||
list.add(cmds[j]);
|
list.add(cmds[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (IBuildCommand[])list.toArray(new BuildCommand[list.size()]);
|
return list.toArray(new BuildCommand[list.size()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new IBuildCommand[0];
|
return new IBuildCommand[0];
|
||||||
|
@ -379,16 +367,16 @@ public class BuildStep implements IBuildStep {
|
||||||
return cwd;
|
return cwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Map getEnvironment(){
|
protected Map<String, String> getEnvironment(){
|
||||||
return fBuildDescription.getEnvironment();
|
return fBuildDescription.getEnvironment();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IBuildCommand[] createCommandsFromString(String cmd, IPath cwd, Map env){
|
protected IBuildCommand[] createCommandsFromString(String cmd, IPath cwd, Map<String, String> env){
|
||||||
char arr[] = cmd.toCharArray();
|
char arr[] = cmd.toCharArray();
|
||||||
char expect = 0;
|
char expect = 0;
|
||||||
char prev = 0;
|
char prev = 0;
|
||||||
// int start = 0;
|
// int start = 0;
|
||||||
List list = new ArrayList();
|
List<String> list = new ArrayList<String>();
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
for(int i = 0; i < arr.length; i++){
|
for(int i = 0; i < arr.length; i++){
|
||||||
char ch = arr[i];
|
char ch = arr[i];
|
||||||
|
@ -431,8 +419,8 @@ public class BuildStep implements IBuildStep {
|
||||||
if(buf.length() > 0)
|
if(buf.length() > 0)
|
||||||
list.add(buf.toString());
|
list.add(buf.toString());
|
||||||
|
|
||||||
IPath c = new Path((String)list.remove(0));
|
IPath c = new Path(list.remove(0));
|
||||||
String[] args = (String[])list.toArray(new String[list.size()]);
|
String[] args = list.toArray(new String[list.size()]);
|
||||||
|
|
||||||
return new IBuildCommand[]{new BuildCommand(c, args, env, cwd, this)};
|
return new IBuildCommand[]{new BuildCommand(c, args, env, cwd, this)};
|
||||||
}
|
}
|
||||||
|
@ -441,7 +429,7 @@ public class BuildStep implements IBuildStep {
|
||||||
BuildIOType[] types = getPrimaryTypes(input);
|
BuildIOType[] types = getPrimaryTypes(input);
|
||||||
if(types.length == 0)
|
if(types.length == 0)
|
||||||
types = input ? (BuildIOType[])getInputIOTypes() : (BuildIOType[])getOutputIOTypes();
|
types = input ? (BuildIOType[])getInputIOTypes() : (BuildIOType[])getOutputIOTypes();
|
||||||
List list = new ArrayList();
|
List<BuildResource> list = new ArrayList<BuildResource>();
|
||||||
|
|
||||||
for(int i = 0; i < types.length; i++){
|
for(int i = 0; i < types.length; i++){
|
||||||
BuildResource [] rcs = (BuildResource[])types[i].getResources();
|
BuildResource [] rcs = (BuildResource[])types[i].getResources();
|
||||||
|
@ -451,18 +439,18 @@ public class BuildStep implements IBuildStep {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (BuildResource[])list.toArray(new BuildResource[list.size()]);
|
return list.toArray(new BuildResource[list.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] resourcesToStrings(IPath cwd, BuildResource rcs[], String prefixToRm){
|
private String[] resourcesToStrings(IPath cwd, BuildResource rcs[], String prefixToRm){
|
||||||
List list = new ArrayList(rcs.length);
|
List<String> list = new ArrayList<String>(rcs.length);
|
||||||
|
|
||||||
for(int i = 0; i < rcs.length; i++){
|
for(int i = 0; i < rcs.length; i++){
|
||||||
IPath path = BuildDescriptionManager.getRelPath(cwd, rcs[i].getLocation());
|
IPath path = BuildDescriptionManager.getRelPath(cwd, rcs[i].getLocation());
|
||||||
path = rmNamePrefix(path, prefixToRm);
|
path = rmNamePrefix(path, prefixToRm);
|
||||||
list.add(path.toOSString());
|
list.add(path.toOSString());
|
||||||
}
|
}
|
||||||
return (String[])list.toArray(new String[list.size()]);
|
return list.toArray(new String[list.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String resolveMacros(String str, IFileContextData fileData, boolean resolveAll){
|
private String resolveMacros(String str, IFileContextData fileData, boolean resolveAll){
|
||||||
|
@ -611,8 +599,7 @@ public class BuildStep implements IBuildStep {
|
||||||
|
|
||||||
IConfiguration cfg = fBuildDescription.getConfiguration();
|
IConfiguration cfg = fBuildDescription.getConfiguration();
|
||||||
|
|
||||||
for(Iterator iter = fInputTypes.iterator(); iter.hasNext();){
|
for (BuildIOType bType : fInputTypes) {
|
||||||
BuildIOType bType = (BuildIOType)iter.next();
|
|
||||||
IInputType type = (IInputType)bType.getIoType();
|
IInputType type = (IInputType)bType.getIoType();
|
||||||
|
|
||||||
if(type == null)
|
if(type == null)
|
||||||
|
|
Loading…
Add table
Reference in a new issue