sourcepawn icon indicating copy to clipboard operation
sourcepawn copied to clipboard

#pragma warning

Open deathscore13 opened this issue 3 years ago • 5 comments

I make include with macros that use an overload (which oddly enough in SP works fine) which results in a 201 warning, so I suggest adding a #pragma warning like in msvc https://learn.microsoft.com/en-us/cpp/preprocessor/warning?view=msvc-170

deathscore13 avatar Nov 29 '22 23:11 deathscore13

A code example demonstrating what you mean might help

sirdigbot avatar Nov 30 '22 10:11 sirdigbot

A code example demonstrating what you mean might help

At the moment I am using different names: https://github.com/deathscore13/Macros/blob/9da6f5a2cb62f2f5a898a89735b166fbf6f4ff21/macros.inc#L173-L175

But after I noticed the possibility of overloading, I want to change it to one name, which will differ only in the number of parameters

deathscore13 avatar Nov 30 '22 12:11 deathscore13

I don't think macros are getting any additional support--bail would remove them given the chance. I'm not sure overloaded macros are supposed to exist.

I also can't think of any other use case where suppressing warnings is a good idea for SP. Usually its a strong indicator of problems in the code unlike in C/C++ where it's not uncommon to run into warnings that you just have to live with because the codebase is built around them.

sirdigbot avatar Dec 12 '22 22:12 sirdigbot

I don't think macros are getting any additional support--bail would remove them given the chance. I'm not sure overloaded macros are supposed to exist.

I also can't think of any other use case where suppressing warnings is a good idea for SP. Usually its a strong indicator of problems in the code unlike in C/C++ where it's not uncommon to run into warnings that you just have to live with because the codebase is built around them.

Yes, you seem to be right. I recently tried to make 3 macros with the same name, and for some reason it was destroyed, although with 2 macros with the same name everything works fine. It was very strange. Tested on spider.limetech.org

deathscore13 avatar Dec 13 '22 11:12 deathscore13

Can you show an example of what you're looking for here?

dvander avatar Jul 03 '23 07:07 dvander