1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Enhance lemon.c so that when it shows the compile-time options in the header

comment of the generated output file, it shows all options, even those not
used, and it shows them in sorted order.

FossilOrigin-Name: eed76e6698eabe47c6bf9696599ce1c2f7aa428cf60f39d0566fbd0d1f6c4c62
This commit is contained in:
drh
2024-06-19 16:38:17 +00:00
parent d8295c8674
commit 199f091a95
3 changed files with 19 additions and 9 deletions

View File

@ -1709,6 +1709,15 @@ static void stats_line(const char *zLabel, int iValue){
iValue);
}
/*
** Comparison function used by qsort() to sort the azDefine[] array.
*/
static int defineCmp(const void *pA, const void *pB){
const char *zA = *(const char**)pA;
const char *zB = *(const char**)pB;
return strcmp(zA,zB);
}
/* The main program. Parse the command line and do it... */
int main(int argc, char **argv){
static int version = 0;
@ -1764,6 +1773,7 @@ int main(int argc, char **argv){
}
memset(&lem, 0, sizeof(lem));
lem.errorcnt = 0;
qsort(azDefine, nDefine, sizeof(azDefine[0]), defineCmp);
/* Initialize the machine */
Strsafe_init();
@ -4498,7 +4508,7 @@ void ReportTable(
}else{
fprintf(out, " with these options:\n**\n"); lineno += 2;
for(i=0; i<nDefine; i++){
if( !bDefineUsed[i] ) continue;
/* if( !bDefineUsed[i] ) continue; */
fprintf(out, "** -D%s\n", azDefine[i]); lineno++;
}
fprintf(out, "*/\n"); lineno++;