Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

how to config compiler warning level #1508

Closed
resos1 opened this issue Jun 3, 2022 · 4 comments
Closed

how to config compiler warning level #1508

resos1 opened this issue Jun 3, 2022 · 4 comments

Comments

@resos1
Copy link

resos1 commented Jun 3, 2022

Hello,
I'm looking for the setting to change the compiler warning level, equivalent config in preferences window of arduino ide (attached image)
1

I've already tried #1392 but it doesn't worked for me, that kept adding -w parameter and ignoring the -Wall parameter.
I Prefer to set this setting to "Default", does it means that I just need to remove -w parameter, right? how can I do that?

@github-actions github-actions bot added the triage New issues that have not been reviewed. label Jun 3, 2022
@benmcmorran
Copy link
Member

Hi @resos1! #1392 is almost right, but you just need to set a different preference. Try adding this to your arduino.json. You can see all the preferences by viewing %LOCALAPPDATA%\Arduino15\preferences.txt.

    "buildPreferences": [["compiler.warning_level", "default"]]

@benmcmorran benmcmorran added needs-more-info More details about this issue are needed for it to be actionable. and removed triage New issues that have not been reviewed. labels Jun 6, 2022
@resos1
Copy link
Author

resos1 commented Jun 7, 2022

thanks a lot, it works now.

@resos1 resos1 closed this as completed Jun 7, 2022
@github-actions github-actions bot removed the needs-more-info More details about this issue are needed for it to be actionable. label Jun 7, 2022
@Benik3
Copy link

Benik3 commented Aug 25, 2023

Does this should still works?
I tried it and still got the same output. Maybe it doesn't work with the new CLI?
I tried to add into arduino.json:

"buildPreferences": [
        ["build.extra_flags", "-Wall"],
        ["compiler.cpp.extra_flags", "-Wall"],
        ["compiler.warning_level", "all"]
    ]

Also output say: "Please see the build logs in output path: f:\Dokumenty\Arduino\ArduinoOutput"
but there is no log, only compiled files.

I see that CLI has option --warnings string Optional, can be: none, default, more, all. Used to tell gcc which warning level to use (-W flag). (default "none") but I don't know how to set it.

@da-phil
Copy link

da-phil commented Jun 4, 2024

@Benik3

Does this should still works?

At least not for me, and it's clear why not, you already explained it:
The buildPreferences list is getting translated to --build-property STRING arduino CLI arguments, and the actual config to change the warnings level is a separate CLI option --warnings STRING.

It would be really cool if vscode-arduino would expose the same config option in the main config, otherwise it's impossible to append this CLI option to the internal arduino CLI invocations.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants