1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

New preference: enable all compiler warnings, off by default. Fixes #1728 and #2415. Also affects #2634 and #2207

This commit is contained in:
Federico Fissore
2015-04-10 15:27:25 +02:00
parent 37e2a1994a
commit 61592d78fa
3 changed files with 27 additions and 3 deletions

View File

@ -559,6 +559,7 @@ public class Compiler implements MessageConsumer {
File objectFile = new File(outputPath, file.getName() + ".o");
objectPaths.add(objectFile);
String[] cmd = getCommandCompilerByRecipe(includeFolders, file, objectFile, "recipe.S.o.pattern");
cmd = enableWarnings(cmd, prefs.getBoolean("build.allwarnings"));
execAsynchronously(cmd);
}
@ -569,6 +570,7 @@ public class Compiler implements MessageConsumer {
if (isAlreadyCompiled(file, objectFile, dependFile, prefs))
continue;
String[] cmd = getCommandCompilerByRecipe(includeFolders, file, objectFile, "recipe.c.o.pattern");
cmd = enableWarnings(cmd, prefs.getBoolean("build.allwarnings"));
execAsynchronously(cmd);
}
@ -579,12 +581,24 @@ public class Compiler implements MessageConsumer {
if (isAlreadyCompiled(file, objectFile, dependFile, prefs))
continue;
String[] cmd = getCommandCompilerByRecipe(includeFolders, file, objectFile, "recipe.cpp.o.pattern");
cmd = enableWarnings(cmd, prefs.getBoolean("build.allwarnings"));
execAsynchronously(cmd);
}
return objectPaths;
}
private String[] enableWarnings(String[] cmd, boolean enable) {
if (!enable) {
return cmd;
}
List<String> cmdList = new ArrayList<String>(Arrays.asList(cmd));
cmdList.remove("-w");
return cmdList.toArray(new String[cmdList.size()]);
}
/**
* Strip escape sequences used in makefile dependency files (.d)
* https://github.com/arduino/Arduino/issues/2255#issuecomment-57645845