PDA

View Full Version : detecting #pragma newdecls required


ddhoward
03-01-2016, 01:43
Wondering if there's a way I can tell if, from within my include, #pragma newdecls required or #pragma newdecls optional had been used in the other programmer's sp (which is including my include.)

I'm hoping to be able to do something like this:


//someone_elses_plugin.sp
#pragma newdecls required;
#include <my_include>
//rest of plugin's code


//my_include.inc

#if newdecls required
#pragma newdecls optional;
#include <some other include that isn't new syntax yet>
#pragma newdecls required;
#else
#include <some other include that isn't new syntax yet>
#endif

//insert rest of include's code here

Merudo
03-01-2016, 02:19
Just put the #include before #pragma newdecls required;

ddhoward
03-01-2016, 02:26
Just put the #include before #pragma newdecls required;

I have no control over the other person's plugin, nor do I have any control over updating stock Sourcemod includes to the new syntax.

Merudo
03-01-2016, 03:01
Sorry, I misunderstood.

It seems to be that you are bending over backward to accommodate users who really only have to do the #pragma newdecls after their own include.

Or am I missing something?

asherkin
03-01-2016, 07:00
No, this is a bug in the plugin with the pragma - not even all the SM include files are newdecls-safe yet.
newdecls should never be required before including 3rd party (to the plugin) include files.