logological / gpp

GPP, a generic preprocessor
https://logological.org/gpp
GNU Lesser General Public License v3.0
192 stars 33 forks source link

gpp parameter -D<var>=<value> appears to always be 1 #18

Open mofosyne opened 7 years ago

mofosyne commented 7 years ago

Input testfile input.md

<#ifdef vara>testa<#else>testb<#endif>
<#if varb>x<#else>y<#endif>

Terminal Output

$ cat input.md | gpp -H -Dvara -Dvarb=1
testa
x
$ cat input.md | gpp -H -Dvarb=0
testb
x
$ gpp --version
GPP 2.24
Copyright (C) 1996-2001 Denis Auroux
Copyright (C) 2003, 2004 Tristan Miller
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
logological commented 6 years ago

Thanks for the report. I think I understand what you are saying about the behaviour of <#if varb>x<#else>y<#endif>, but what is the problem with <#ifdef vara>testa<#else>testb<#endif>? Could you please tell me the expected behaviour for both invocations?

mofosyne commented 6 years ago

Been a while, but I think there is no issues with #ifdef commands, just #if only. I was only posting it to contrast its behaviour with eachother I think