aboutsummaryrefslogtreecommitdiff
path: root/tool/lemon.c
diff options
context:
space:
mode:
authordrh <>2024-06-19 16:38:17 +0000
committerdrh <>2024-06-19 16:38:17 +0000
commit199f091a9508ff117326e0f81dc6e4573be1ac6c (patch)
treea5b5f6b3c93ee76e131ed82fa66898c4d38f600f /tool/lemon.c
parentd8295c86749ec89c68e9df47fb9b8f03f6032c52 (diff)
downloadsqlite-199f091a9508ff117326e0f81dc6e4573be1ac6c.tar.gz
sqlite-199f091a9508ff117326e0f81dc6e4573be1ac6c.zip
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
Diffstat (limited to 'tool/lemon.c')
-rw-r--r--tool/lemon.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tool/lemon.c b/tool/lemon.c
index 06b9109a1..a919f447c 100644
--- a/tool/lemon.c
+++ b/tool/lemon.c
@@ -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++;