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

Add #warning directive #170

Merged
merged 4 commits into from Feb 3, 2018
Merged

Add #warning directive #170

merged 4 commits into from Feb 3, 2018

Conversation

@Headline
Copy link
Member

@Headline Headline commented Jan 16, 2018

Here's my test code along with compiler outputs. The first is how the current #error directive functions, and the second is the new #warning directive

/*
C:\Users\Micha\Desktop\New folder\sourcepawn\build\compiler\spcomp>spcomp test.sp
SourcePawn Compiler 1.10
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2017 AlliedModders LLC

test.sp(2) : fatal error 194: user error: testing 1 2 3


Compilation aborted.Code size:                0 bytes
Data size:                0 bytes
Stack/heap size:      16384 bytes
Total requirements:   16384 bytes

*/
#error testing 1 2 3 

int main()
{

}
/*
C:\Users\Micha\Desktop\New folder\sourcepawn\build\compiler\spcomp>spcomp test.sp
SourcePawn Compiler 1.10
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2017 AlliedModders LLC

test.sp(2) : warning 241: user warning: testing 1 2 3

Code size:               24 bytes
Data size:                0 bytes
Stack/heap size:      16384 bytes
Total requirements:   16408 bytes

1 Warning.
*/
#warning testing 1 2 3 

int main()
{

}

Fixes #169

compiler/sc2.cpp Outdated
"#endscript", "#error", "#file", "#if", "#include", "#line", "#pragma",
"#tryinclude", "#undef",
"#endscript", "#error", "#warning", "#file", "#if", "#include",
"#line", "#pragma", "#tryinclude", "#undef",
Copy link
Member

@asherkin asherkin Jan 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mystery tabs.

@@ -274,4 +274,5 @@ static const char *warnmsg[] = {
/*238*/ "'%s:' is an illegal cast; use view_as<%s>(expression)\n",
/*239*/ "'%s' is an illegal tag; use %s as a type\n",
/*240*/ "'%s:' is an old-style tag operation; use view_as<%s>(expression) instead\n",
/*241*/ "user warning: %s\n",
Copy link
Member

@asherkin asherkin Jan 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use one of the unused ones?

Copy link
Member Author

@Headline Headline Jan 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why not, is it generally preferred to use the lowest unused spot?

Copy link
Member

@asherkin asherkin Jan 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya, preferred, but isn't super important.

Copy link
Member

@KyleSanderson KyleSanderson Jan 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patching holes is definitely a nice to have.

Copy link
Member Author

@Headline Headline Jan 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do. I’ll probably commit in the coming days

@Headline
Copy link
Member Author

@Headline Headline commented Feb 3, 2018

Alright. Let me know if there's anything else.

@dvander

@asherkin asherkin changed the title Add #warning directive (#169) Add #warning directive (Fixes #169) Feb 3, 2018
@asherkin asherkin changed the title Add #warning directive (Fixes #169) Add #warning directive Feb 3, 2018
@asherkin asherkin merged commit a4a717f into alliedmodders:master Feb 3, 2018
2 checks passed
@Headline Headline deleted the add-#warning branch Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants