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

Set warnings to "default" by default #1792

Closed
3 tasks done
roboter-basteln opened this issue Dec 29, 2022 · 3 comments
Closed
3 tasks done

Set warnings to "default" by default #1792

roboter-basteln opened this issue Dec 29, 2022 · 3 comments
Assignees
Labels
conclusion: duplicate Has already been submitted topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@roboter-basteln
Copy link

roboter-basteln commented Dec 29, 2022

Describe the request

I'd appreciate if the warning level would be set to "default" after a fresh installation, so that it produces similar warnings as Arduino IDE version 1.

Describe the current behavior

Currently, the warning level is set to "none" after a fresh install, not producing any warning.

With the code

void setup() {
  // put your setup code here, to run once:
  Serial.begin(100000000000000000000000000000000000000000000000);
}

Arduino IDE 1.8.18 gives the warning

...\HelloWorld.ino:3:16: warning: integer constant is too large for its type
   Serial.begin(100000000000000000000000000000000000000000000000);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...\HelloWorld.ino: In function 'void setup()':
...\HelloWorld.ino:3:64: warning: large integer implicitly truncated to unsigned type [-Woverflow]
   Serial.begin(100000000000000000000000000000000000000000000000);

when set to warning level "none", while Arduino IDE 2.0.4 does not give any warnings.

Arduino IDE version

2.0.4-nightly-20221229

Operating system

Windows

Operating system version

Windows 10 22H2

Additional context

I am working with children at the age of 10, who like experimenting much. It's not uncommon to see such high baud rates. Children love huge numbers. I'd prefer if they get some warnings when they compile their code.
Probably not much different for adults. They should get some warnings, too. You don't want to rely on undefined behavior.

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the latest nightly build
  • My request contains all necessary details
@roboter-basteln roboter-basteln added the type: enhancement Proposed improvement label Dec 29, 2022
@per1234 per1234 added the topic: code Related to content of the project itself label Dec 30, 2022
@per1234
Copy link
Contributor

per1234 commented Dec 30, 2022

Thanks for your suggestion @roboter-basteln.

Arduino IDE 1.8.18 gives the warning

This is actually a bug in Arduino IDE 1.x. After a fresh installation, the preferences are uninitialized. This state causes no warning flags to be added to the compilation commands. You can verify this by performing the following procedure:

  1. Select File > Preferences from the Arduino IDE menus.
    Note that the default value of the "Compiler warnings" preference is "None".
  2. Without changing any of the preferences (leaving them in their default states), click the "OK" button.
  3. Select Tools > Board > Arduino AVR Boards > Arduino Uno from the Arduino IDE menus.
    This is only an arbitrary choice intended to ensure we run the compilation under the same conditions, since the author of each boards platform can decide which flags should be set at any "Compiler warnings" preference level.
  4. Compile your demonstration sketch.

You will now see that no warnings are printed, as would be expected with a "Compiler warnings" preference setting of "None". This is because the -w flag was added to the compilation commands, as intended by the author of the boards platform:

https://github.com/arduino/ArduinoCore-avr/blob/1.8.6/platform.txt#L15

compiler.warning_flags.none=-w

So we can not use Arduino IDE 1.x's behavior as an argument in favor of your proposal, but that does not invalidate the proposal.


Related (but to be evaluated and implemented independently): arduino/arduino-cli#684

@roboter-basteln
Copy link
Author

@per1234 Thank you for the detailed feedback. I appreciate that someone cares.
While I was writing the issue, I also thought "It's a bit odd that I get warnings at warning level 'none'". But I didn't want to open an issue for Arduino IDE 1 any more.

@per1234
Copy link
Contributor

per1234 commented Jan 1, 2024

Closing as duplicate of #1630

@per1234 per1234 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 1, 2024
@per1234 per1234 added the conclusion: duplicate Has already been submitted label Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: duplicate Has already been submitted topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

2 participants