mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-29 10:24:12 +01:00
New preference: enable all compiler warnings, off by default. Fixes #1728 and #2415. Also affects #2634 and #2207
This commit is contained in:
parent
37e2a1994a
commit
61592d78fa
@ -203,10 +203,9 @@ public class Preferences {
|
||||
JCheckBox verboseCompilationBox;
|
||||
JCheckBox verboseUploadBox;
|
||||
JCheckBox displayLineNumbersBox;
|
||||
JCheckBox enableCompilerWarningsBox;
|
||||
JCheckBox verifyUploadBox;
|
||||
JCheckBox externalEditorBox;
|
||||
JCheckBox memoryOverrideBox;
|
||||
JTextField memoryField;
|
||||
JCheckBox checkUpdatesBox;
|
||||
JTextField fontSizeField;
|
||||
JCheckBox updateExtensionBox;
|
||||
@ -352,6 +351,15 @@ public class Preferences {
|
||||
pane.add(box);
|
||||
d = box.getPreferredSize();
|
||||
box.setBounds(left, top, d.width, d.height);
|
||||
top += d.height + GUI_BETWEEN;
|
||||
|
||||
// [ ] Enable all compiler warnings
|
||||
|
||||
enableCompilerWarningsBox = new JCheckBox(_("Enable all compiler warnings"));
|
||||
pane.add(enableCompilerWarningsBox);
|
||||
d = enableCompilerWarningsBox.getPreferredSize();
|
||||
enableCompilerWarningsBox.setBounds(left, top, d.width + 10, d.height);
|
||||
right = Math.max(right, left + d.width);
|
||||
top += d.height + GUI_BETWEEN;
|
||||
|
||||
// [ ] Display line numbers
|
||||
@ -674,6 +682,7 @@ public class Preferences {
|
||||
PreferencesData.setBoolean("editor.linenumbers", displayLineNumbersBox.isSelected());
|
||||
PreferencesData.setBoolean("upload.verify", verifyUploadBox.isSelected());
|
||||
PreferencesData.setBoolean("editor.save_on_verify", saveVerifyUploadBox.isSelected());
|
||||
PreferencesData.setBoolean("build.allwarnings", enableCompilerWarningsBox.isSelected());
|
||||
|
||||
// setBoolean("sketchbook.closing_last_window_quits",
|
||||
// closingLastQuitsBox.isSelected());
|
||||
@ -758,6 +767,7 @@ public class Preferences {
|
||||
verboseUploadBox.setSelected(PreferencesData.getBoolean("upload.verbose"));
|
||||
displayLineNumbersBox.setSelected(PreferencesData.getBoolean("editor.linenumbers"));
|
||||
verifyUploadBox.setSelected(PreferencesData.getBoolean("upload.verify"));
|
||||
enableCompilerWarningsBox.setSelected(PreferencesData.getBoolean("build.allwarnings"));
|
||||
|
||||
//closingLastQuitsBox.
|
||||
// setSelected(getBoolean("sketchbook.closing_last_window_quits"));
|
||||
|
@ -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
|
||||
|
@ -311,7 +311,7 @@ public class PreferencesMap extends LinkedHashMap<String, String> {
|
||||
* insensitive compared), <b>false</b> in any other case
|
||||
*/
|
||||
public boolean getBoolean(String key) {
|
||||
return new Boolean(get(key));
|
||||
return Boolean.valueOf(get(key));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user