!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:
parent
931b06c782
commit
1afaca0e41
5 changed files with 23 additions and 6 deletions
|
@ -30,7 +30,7 @@ If \e{/file} is used, the entire text file specified (including whitespace and n
|
|||
|
||||
\S1{undef} !undef
|
||||
|
||||
\c gflag
|
||||
\c [/noerrors] gflag [...]
|
||||
|
||||
Removes an item from the global define list. Note that $\{SYMBOL\} where SYMBOL is undefined will be translated to "$\{SYMBOL\}".
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ Released on ??? ??th, 20??
|
|||
|
||||
\b Fixed !macroundef of last defined macro bug
|
||||
|
||||
\b !undef issues warnings instead of errors
|
||||
|
||||
\b MakeNSIS prints -CMDHELP to stdout (\W{http://sf.net/p/nsis/bugs/1203}{bug #1203})
|
||||
|
||||
\S2{} Translations
|
||||
|
|
|
@ -95,6 +95,7 @@ typedef enum {
|
|||
DW_PP_DELFILE_NOMATCH = DW_PP_DELFILE_DELERROR,
|
||||
DW_PP_VERBOSE_POP_EMPTY_STACK = 6150,
|
||||
//DW_PP_VERBOSE_BAD_LEVEL = 6151?, // 2.x failed to issue a warning. 3.x currently aborts with hard error.
|
||||
DW_PP_UNDEF_UNDEFINED = 6155,
|
||||
DW_INCLUDE_NONFATAL_NOT_FOUND = 7000, // reserved ..7009
|
||||
DW_FILE_NONFATAL_NOT_FOUND = 7010, // reserved ..7019
|
||||
DW_LANGSTRING_OVERLONGLENGTH = 7020, // reserved ..7024
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -271,7 +271,7 @@ static tokenType tokenlist[TOK__LAST] =
|
|||
{TOK_P_IFNDEF,_T("!ifndef"),1,-1,_T("symbol [| symbol2 [& symbol3 [...]]]"),TP_ALL},
|
||||
{TOK_P_ENDIF,_T("!endif"),0,0,_T(""),TP_ALL},
|
||||
{TOK_P_DEFINE,_T("!define"),1,5,_T("[/ifndef | /redef] ([/date|/utcdate] symbol [value]) | (/file symbol filename) | (/math symbol val1 OP val2)\n OP=(+ - * / % << >> >>> & | ^ ~ ! && ||)"),TP_ALL},
|
||||
{TOK_P_UNDEF,_T("!undef"),1,0,_T("symbol"),TP_ALL},
|
||||
{TOK_P_UNDEF,_T("!undef"),1,-1,_T("[/noerrors] symbol"),TP_ALL},
|
||||
{TOK_P_ELSE,_T("!else"),0,-1,_T("[if[macro][n][def] ...]"),TP_ALL},
|
||||
{TOK_P_ECHO,_T("!echo"),1,0,_T("message"),TP_ALL},
|
||||
{TOK_P_WARNING,_T("!warning"),0,1,_T("[warning_message]"),TP_ALL},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue