ignored invalid preprocessor commands in ignored blocks
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4909 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
60c3a6165e
commit
910ed492ab
4 changed files with 12 additions and 1 deletions
|
@ -10,6 +10,8 @@ this should not be executed, so no error should be raised
|
||||||
code inside comments should not be executed
|
code inside comments should not be executed
|
||||||
!ifdef
|
!ifdef
|
||||||
*/
|
*/
|
||||||
|
# invalid preprocessor should be ignored
|
||||||
|
!hello
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!ifdef d1
|
!ifdef d1
|
||||||
|
|
|
@ -140,6 +140,7 @@ class CEXEBuild {
|
||||||
void update_exehead(const unsigned char *new_exehead, size_t new_size);
|
void update_exehead(const unsigned char *new_exehead, size_t new_size);
|
||||||
|
|
||||||
// tokens.cpp
|
// tokens.cpp
|
||||||
|
bool is_valid_token(char *s);
|
||||||
int get_commandtoken(char *s, int *np, int *op, int *pos);
|
int get_commandtoken(char *s, int *np, int *op, int *pos);
|
||||||
int GetCurrentTokenPlace();
|
int GetCurrentTokenPlace();
|
||||||
int IsTokenPlacedRight(int pos, char *tok);
|
int IsTokenPlacedRight(int pos, char *tok);
|
||||||
|
|
|
@ -305,7 +305,7 @@ int CEXEBuild::doParse(const char *str)
|
||||||
{
|
{
|
||||||
bool ignore_line = cur_ifblock && (cur_ifblock->ignore || cur_ifblock->inherited_ignore);
|
bool ignore_line = cur_ifblock && (cur_ifblock->ignore || cur_ifblock->inherited_ignore);
|
||||||
char first_char = *(char *) m_linebuild.get();
|
char first_char = *(char *) m_linebuild.get();
|
||||||
if (ignore_line && first_char!='!')
|
if (ignore_line && (first_char!='!' || !is_valid_token(line.gettoken_str(0))))
|
||||||
{
|
{
|
||||||
m_linebuild.resize(0);
|
m_linebuild.resize(0);
|
||||||
return PS_OK;
|
return PS_OK;
|
||||||
|
|
|
@ -297,6 +297,14 @@ void CEXEBuild::print_help(char *commandname)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CEXEBuild::is_valid_token(char *s)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < TOK__LAST; x ++)
|
||||||
|
if (!stricmp(tokenlist[x].name,s))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int CEXEBuild::get_commandtoken(char *s, int *np, int *op, int *pos)
|
int CEXEBuild::get_commandtoken(char *s, int *np, int *op, int *pos)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue