Skip to content

#warn vs #warning vs preprocessor's wiki page #33

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

Closed
drawkula opened this issue May 10, 2017 · 8 comments
Closed

#warn vs #warning vs preprocessor's wiki page #33

drawkula opened this issue May 10, 2017 · 8 comments

Comments

@drawkula
Copy link

Summary: #warn or #warning?

(yeti@kumari:22)/opt/openspin/src/test$ cat PreProcessorTestWARN.spin 
#warn Testing WARN

pub main
        ' empty main to keep the compiler happy
(yeti@kumari:22)/opt/openspin/src/test$ /opt/openspin/bin/openspin -q PreProcessorTestWARN.spin 
PreProcessorTestWARN.spin(1:6) : error : Expected "," or end of line
Line:
#warn Testing WARN
Offending Item: Testing
(yeti@kumari:22)/opt/openspin/src/test$ cat PreProcessorTestWARNING.spin 
#warning Testing WARNING

pub main
        ' empty main to keep the compiler happy
(yeti@kumari:22)/opt/openspin/src/test$ /opt/openspin/bin/openspin -q PreProcessorTestWARNING.spin 
PreProcessorTestWARNING.spin:1: warning: #warn:  Testing WARNING

...so it seems to be #warning.

The preprocessor's wiki page mentiones #warn.

And...

PreProcessorTestWARNING.spin:1: warning: #warn:  Testing WARNING

...probably would be...

PreProcessorTestWARNING.spin:1: warning: #warning:  Testing WARNING

...if the text constant in the code would reflect the choice of #warning.

@PropGit
Copy link

PropGit commented May 10, 2017

Thanks @drawkula.

@reltham - I'm voting for the message to be: warning: Testing WARNING i.e.: no repeating of the '#warning: ' directive at all, just the message provided by it (unless I'm misunderstanding the context here).

@PropGit
Copy link

PropGit commented May 10, 2017

Updated wiki to say #warning.

@drawkula
Copy link
Author

\o/
I prefer #warning too...

If you strip #warning from the shown runtime output, I think #error should get the same treatment...

(yeti@kumari:13)/opt/openspin/src/test$ cat PreProcessorTestERROR.spin 
#error Testing ERROR

pub main
        ' empty main to keep the compiler happy
(yeti@kumari:13)/opt/openspin/src/test$ /opt/openspin/bin/openspin -q PreProcessorTestERROR.spin 
PreProcessorTestERROR.spin:1: error: #error:  Testing ERROR

Maybe keeping the # in both cases makes sense because someone might search the output for #error or #warning?

@PropGit
Copy link

PropGit commented May 10, 2017

Okay, I see your point, but it still seems so redundant. It's always going to lead with error: #error: or warning: #warning:

Anyone else want to share their thoughts on keeping/removing the directive (#error or #warning) from the output messages?

@drawkula
Copy link
Author

@PropGit ... maybe repeating error and warning makes sense to distinguish them from not user generated errors and warnings.

#include xyzzy
#error no string found for include

pub main
        ' empty main to keep the compiler happy
(yeti@kumari:13)/opt/openspin/src/test$ /opt/openspin/bin/openspin -q PreProcessorTestERROR-2.spin 
PreProcessorTestERROR-2.spin:1: error: no string found for include
PreProcessorTestERROR-2.spin:2: error: #error:  no string found for include

@drawkula
Copy link
Author

error/warning for normal errors/warnings of parser and compiler and #error/#warning for the user chiseled ones?

@drawkula
Copy link
Author

drawkula commented May 14, 2017

bst_manual_0.04 page 27:

bstc also supports #info / #warn / #error to allow comments to be inserted in the list file, or compilation to be halted with a user definable error message. Unlike the conditional statements, the #info / #warn / #error lines accept any message and will continue until the end of line.

Maybe BST(C)'s existence is a reason to allow #warn too and to add #info?

@PropGit
Copy link

PropGit commented May 15, 2017

error/warning for normal errors/warnings of parser and compiler and #error/#warning for the user chiseled ones?

Okay, that's a good point. We can leave the #error / #warning content as-is.

Maybe BST(C)'s existence is a reason to allow #warn too and to add #info?

This wouldn't take too much to implement- I like it. Closing this issue and creating two more for #warn and #info.

@PropGit PropGit closed this as completed May 15, 2017
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

2 participants