Skip to content

#warning is removed #4

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

Open
per1234 opened this issue Dec 4, 2017 · 5 comments
Open

#warning is removed #4

per1234 opened this issue Dec 4, 2017 · 5 comments

Comments

@per1234
Copy link
Contributor

per1234 commented Dec 4, 2017

Using Arduino IDE 1.9.0-beta build 25 with Windows 7 64 bit

  1. File > Preferences > Compiler warnings: > any setting above "None"
  2. Compile the following sketch:
    #warning foo
    void setup() {}
    void loop() {}
    
  3. Examine the output in the console for the expected warning. It is not there.

The line #warning foo is missing from the preprocessed .ino.cpp file in the temporary build folder.

arduino-preprocessor -debug output:
https://gist.githubusercontent.com/per1234/4a355c6872fbca648378aaf3974fffd4/raw/5a775baad27a738b21abbc57a6682fd863b31a75/arduino-preprocessor_debug_output.txt

The issue does not occur with Arduino IDE 1.8.6 Hourly Build 2017/11/13 or Arduino IDE 1.8.5.

@PaulStoffregen
Copy link

Well, what did you expect when you set "Compiler warnings" to "None"?

@matthijskooijman
Copy link
Collaborator

@PaulStoffregen, he said "any setting above "None"

What I believe happens here, is that the sketch sources are preprocessed before the prototypes are inserted (to prevent inserting the prototypes in a place that is removed by preprocessing). However, this means that when compiling the sketch code, it is already preprocessed. I can see three fixes:

  1. Tell gcc to only process #include, #if, etc., but leave #warning and #error in the source when preprocessing (I vaguely recall there is an option for this, but I'm not sure). The downside is that this requires modifying recipes.
  2. Insert the prototypes into the unpreprocessed source, using the preprocessed source only to figure out the correct position (using the line directives to translate back to the unpreprocessed source).
  3. Show any compiler output from the preprocessing stage. I believe this is output is now redirected to /dev/null, but it might actually make sense to just show it. It might be slightly confusing that these warnings are then shown a bit further up than actual errors, but that's just a minor issue.

Option #3 is probably the easiest and most portable of these, and even though the output is slightly mixed up, all relevant warnings should at least be shown.

@LEKPHET-KUNSUE

This comment was marked as abuse.

@LEKPHET-KUNSUE

This comment was marked as abuse.

@per1234
Copy link
Contributor Author

per1234 commented Jan 27, 2024

@LEKPHET-KUNSUE AKA "Phetdanai" I see you have created a new account to circumvent your GitHub ban and are continuing your previous pattern of adding pointless comments in our repositories. I'll give you the same warning as I did last time:

Please stop leaving these pointless comments. These generate noise that waste the time of the contributors who provide the development work that benefits the entire Arduino community so they are very harmful.

If I see any more abusive behavior from you then I am going to block you from accessing any of Arduino's repositories and report your account to GitHub.

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

No branches or pull requests

4 participants