1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Enhance lemon so that it accepts the -U command-line option that undefines

a preprocessor macro.

FossilOrigin-Name: e2188a3edf3576963b45e9ffe6ef53e2a85aa68ea3dfb3243b4943d06ffaf829
This commit is contained in:
drh
2024-12-19 13:36:36 +00:00
parent 2dcd4fad6b
commit 543ee479eb
3 changed files with 25 additions and 7 deletions

View File

@ -1628,6 +1628,23 @@ static void handle_D_option(char *z){
*z = 0;
}
/* This routine is called with the argument to each -U command-line option.
** Omit a previously defined macro.
*/
static void handle_U_option(char *z){
int i;
for(i=0; i<nDefine; i++){
if( strcmp(azDefine[i],z)==0 ){
nDefine--;
if( i<nDefine ){
azDefine[i] = azDefine[nDefine];
bDefineUsed[i] = bDefineUsed[nDefine];
}
break;
}
}
}
/* Rember the name of the output directory
*/
static char *outputDir = NULL;
@ -1754,6 +1771,7 @@ int main(int argc, char **argv){
"Generate the *.sql file describing the parser tables."},
{OPT_FLAG, "x", (char*)&version, "Print the version number."},
{OPT_FSTR, "T", (char*)handle_T_option, "Specify a template file."},
{OPT_FSTR, "U", (char*)handle_U_option, "Undefine a macro."},
{OPT_FSTR, "W", 0, "Ignored. (Placeholder for '-W' compiler options.)"},
{OPT_FLAG,0,0,0}
};