On 07/23/2018 06:36 PM, Dominique Devienne wrote:
On Mon, Jul 23, 2018 at 12:57 PM Dan Kennedy <danielk1...@gmail.com> wrote:
On 07/22/2018 07:48 PM, Victor Costan wrote:
In a custom SQLite build, SQLITE_DEFAULT_LOOKASIDE results in compilation
errors, unless used with SQLITE_OMIT_COMPILEOPTION_DIAGS.
This is because src/ctime.c includes the following block:
#ifdef SQLITE_DEFAULT_LOOKASIDE
"DEFAULT_LOOKASIDE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOOKASIDE),
#endif
However, CTIMEOPT_VAL (defined in the same file) is a one-argument macro:
#define CTIMEOPT_VAL_(opt) #opt
#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
I suspect that an easy fix would involve defining a 2-argument macro
as CTIMEOPT_VAL(arg1)
"," CTIMEOPT_VAL(arg2).
Thanks for reporting this. Now fixed here:
https://www.sqlite.org/src/info/1cc72845f92198f2
The diff adds:
#define CTIMEOPT_VAL2_(opt1,opt2) #opt1 "," #opt2
#define CTIMEOPT_VAL2(opt) CTIMEOPT_VAL2_(opt)
But don't you mean the below instead?
#define CTIMEOPT_VAL2_(opt1,opt2) #opt1 "," #opt2
#define CTIMEOPT_VAL2(opt) CTIMEOPT_VAL2_(opt, opt)
Thanks for reviewing. I acknowledge it is a bit iffy.
SQLITE_DEFAULT_LOOKASIDE should be defined as two comma-separated
integers. e.g.
-DSQLITE_DEFAULT_LOOKASIDE="100,100"
So CTIMEOPT_VAL2(SQLITE_DEFAULT_LOOKASIDE) expands to:
CTIMEOPT_VAL2_(100, 100)
and so it works. If anybody knows a better way to do this (I'm no
preprocessor expert!) that is ANSI-C compatible, I think we'd be happy
to change the code.
Dan.
From https://gcc.gnu.org/onlinedocs/cpp/Macro-Arguments.html :
The number of arguments you give must match the number of parameters in the
macro definition
I'm not sure though, possible I missed something. --DD
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users