[SR-Users] Preprocessor define puzzle

Alex Balashov abalashov at evaristesys.com
Mon Nov 9 06:39:03 CET 2015


I traced this bizarre behaviour to an unbalanced number of 
ifdefs/endifs, although it's still bizarre.

On 11/08/2015 09:22 PM, Alex Balashov wrote:

> Hi,
>
> I've got:
>
> # define WITH_VENDOR_ROUTING_LNPOIP
>
> at the top of my config. This is intended to mean that this constant is
> commented out and disabled ('# define' vs. '#!define'), and tests
> correctly in a given request route.
>
> Later:
>
> route[STAGE_3] {
>     ...
>
> #!ifdef WITH_VENDOR_ROUTING_LNPOIP
>      xlog("L_INFO", "LNPOIP ENABLED STAGE 3\n");
> #!else
>      xlog("L_INFO", "LNPOIP NOT ENABLED STAGE 3\n");
> #!endif
>
>          route(OUTBOUND_VENDOR_SELECT);
> }
>
> This tests correctly:
>
> Nov  8 21:17:54 centosity6 /usr/local/sbin/kamailio[12296]: INFO: LNPOIP
> NOT ENABLED STAGE 3
>
> However, in route[OUTBOUND_VENDOR_SELECT]:
>
> #!ifdef WITH_VENDOR_ROUTING_LNPOIP
>          xlog("L_INFO", "LNPOIP ENABLED\n");
> #!else
>          xlog("L_INFO", "LNPOIP NOT ENABLED\n");
> #!endif
>
> This prints:
>
> Nov  8 21:17:54 centosity6 /usr/local/sbin/kamailio[12296]: INFO: LNPOIP
> ENABLED
> Nov  8 21:17:54 centosity6 /usr/local/sbin/kamailio[12296]: INFO: LNPOIP
> NOT ENABLED
>
> ... which I must admit is quite puzzling. Looks like it's both defined
> and not defined.
>
> Running 4.3:16be09c here.
>
> Thanks!
>
> -- Alex
>


-- 
Alex Balashov | Principal | Evariste Systems LLC
303 Perimeter Center North, Suite 300
Atlanta, GA 30346
United States

Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/



More information about the sr-users mailing list