Skip to content

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

Choose a reason for hiding this comment

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

Mystery tabs.

/*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

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

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

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

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

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 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
@Headline Headline deleted the add-#warning branch October 30, 2018 09:13
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

Successfully merging this pull request may close these issues.

3 participants