SQLite Forum

Missing comma in ctime.c
Login

Missing comma in ctime.c

(1) By Keith Medcalf (kmedcalf) on 2020-12-28 21:11:55 [link] [source]

Index: src/ctime.c
==================================================================
--- src/ctime.c
+++ src/ctime.c
@@ -255,11 +255,11 @@
 #endif
 #ifdef SQLITE_ENABLE_LOCKING_STYLE
   "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
 #endif
 #if SQLITE_ENABLE_MATH_FUNCTIONS
-  "ENABLE_MATH_FUNCTIONS"
+  "ENABLE_MATH_FUNCTIONS",
 #endif
 #if SQLITE_ENABLE_MEMORY_MANAGEMENT
   "ENABLE_MEMORY_MANAGEMENT",
 #endif
 #if SQLITE_ENABLE_MEMSYS3

(2) By Roland Illig (rillig) on 2020-12-28 22:07:55 in reply to 1 [link] [source]

How could this happen at all?

The code says that this section of the file is auto-generated, and it's obviously a good idea to do this, since it's tedious to manually review all the redundancy in that part of the code.

This would also mean that both the commit from 2020-12-28 that fixed this bug and the commit from 2020-12-07 that caused the bug are wrong since no commit should ever modify generated source code.

(3) By Larry Brasfield (LarryBrasfield) on 2020-12-28 23:47:57 in reply to 2 [link] [source]

The sources in src/* are not auto-generated. You must be looking at some code which is auto-extracted and amalgamated from those sources where comments are auto-placed warning against edits.

(4) By Keith Medcalf (kmedcalf) on 2020-12-29 00:24:24 in reply to 3 [source]

No, tool/mkctimec.tcl makes the declarations part of the src/ctime.c code. Unfortunately you have to manually "stuff" the output of the script into the middle of the ctime.c code replacing the autogenerated declaration part.

This is unlike tool/mksqlite3c.tcl and tool/mksqlite3h.tcl which make the entire sqlite3.c and sqlite3.h files or mkpragmatab.tcl which makes the pragma.h file for you.

(5) By Roland Illig (rillig) on 2020-12-29 01:08:02 in reply to 4 [link] [source]

No, tool/mkctimec.tcl makes the declarations part of the src/ctime.c code. Unfortunately you have to manually "stuff" the output of the script into the middle of the ctime.c code replacing the autogenerated declaration part.

But then, shouldn't tool/mkctimec.tcl generate ctime.c in a completely automatic fashion, based on a template file and the actual compile-time options? This would make any manual editing of that file wrong and the whole process less error prone.

mkctime.tcl looks great by the way, it's as simple and straight-forward as I would expect it.