!undef now issues warnings instead of errors

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7039 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2018-11-02 19:51:54 +00:00
parent 931b06c782
commit 1afaca0e41
5 changed files with 23 additions and 6 deletions

View file

@ -1010,12 +1010,26 @@ int CEXEBuild::pp_define(LineParser&line)
int CEXEBuild::pp_undef(LineParser&line)
{
if (definedlist.del(line.gettoken_str(1)))
UINT noerr = false, stopswitch = false, ti = 1, handled = 0;
for (; ti < line.getnumtokens(); ++ti)
{
ERROR_MSG(_T("!undef: \"%") NPRIs _T("\" not defined!\n"), line.gettoken_str(1));
return PS_ERROR; // Should this be a warning?
const TCHAR *name = line.gettoken_str(ti);
if (!stopswitch && !_tcsicmp(name, _T("/noerrors")))
{
++noerr;
continue;
}
stopswitch = ++handled;
if (definedlist.del(name) && !noerr)
warning_fl(DW_PP_UNDEF_UNDEFINED, _T("!undef: \"%") NPRIs _T("\" not defined!"), name);
else
SCRIPT_MSG(_T("!undef: \"%") NPRIs _T("\"\n"), name);
}
if (!handled)
{
PRINTHELP();
return PS_ERROR;
}
SCRIPT_MSG(_T("!undef: \"%") NPRIs _T("\"\n"), line.gettoken_str(1));
return PS_OK;
}