Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default warnings level for compiling should be "default" #684

Open
nerdralph opened this issue May 5, 2020 · 5 comments
Open

Default warnings level for compiling should be "default" #684

nerdralph opened this issue May 5, 2020 · 5 comments
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@nerdralph
Copy link

Bug Report

DEFAULT_WARNINGS_LEVEL is "none"

Current behavior

DEFAULT_WARNINGS_LEVEL is set to "none"

const DEFAULT_WARNINGS_LEVEL = "none"

Expected behavior

const DEFAULT_WARNINGS_LEVEL = "default"

Environment

Version: 0.10.0 Commit: ec5c3ed

Additional context

The Arduino IDE has four preferences options for warnings: None, Default, More, All
based on the selection, "none", "default", "more", or "all" gets concatenated with compiler.warning_flags. and the corresponding option from platform.txt is used in the build flags.
https://github.com/arduino/ArduinoCore-avr/blob/master/platform.txt#L16

@matthijskooijman
Copy link
Collaborator

One complication of enabling warnings by default is that you get warnings for all compiled code, including code you are not actually working on (e.g. warnings in the Arduino core and libraries) and not in a good position to fix. This can be especially confusing to novice users.

IMHO, having warnings enabled for the sketch, but not other parts, would be ideal.

See also arduino/arduino-ide#1630 for previous discussion of this issue for the Java IDE, with some alternative proposals too.

@cmaglie
Copy link
Member

cmaglie commented May 18, 2020

related to arduino/arduino-builder#301

@per1234
Copy link
Contributor

per1234 commented Jun 12, 2020

One thing to consider is that the target user of Arduino CLI is different from the target user of Arduino IDE. Although I'm a big fan of always enabling and paying attention to compiler warnings, I can somewhat understand the reasoning behind disabling them by default in the Arduino IDE. After all, we regularly get posts on the forum:

Something is wrong with my Arduino. It says

Sketch uses 444 bytes (1%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. >Maximum is 2048 bytes.

and much more often than that get posts from people freaked out by innocuous warnings from libraries, thinking they are "errors".

However, that level of beginner should not be using Arduino CLI, so we don't need to cater to them.

@matthijskooijman
Copy link
Collaborator

One thing to consider is that the target user of Arduino CLI is different from the target user of Arduino IDE.

Fair point. However, would this work technically? Does arduino-cli have a completely separate configuration from the IDE? Once the arduino-cli is used as a backend for the IDE, would it pass all options explicitly? Would people expect to configure the cli and the IDE completely separately (especially when the IDE includes the cli)? Just some thoughts :-)

@per1234 per1234 reopened this Mar 30, 2021
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Mar 31, 2022
@per1234 per1234 changed the title DEFAULT_WARNINGS_LEVEL should be "default" Default warnings level for compiling should be "default" Nov 3, 2022
@per1234
Copy link
Contributor

per1234 commented Nov 3, 2022

Does arduino-cli have a completely separate configuration from the IDE?

Yes. Arduino IDE always specifies the warning level in the compile request. That warning level is set according to the user's preferences. The default value of the preference is set in the Arduino IDE codebase:

https://github.com/arduino/arduino-ide/blob/260227e79a05fefeb87ba1400c14215b358cc20c/arduino-ide-extension/src/browser/arduino-preferences.ts#L93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

4 participants