Re: [sqlite] SQLITE_OMIT_TRIGGER compilation problems

2008-04-16 Thread Richard Klein
> On Apr 15, 2008, at 10:34 PM, Richard Klein wrote:
>> I compiled SQLite 3 (version 3.5.7), specifying
>> SQLITE_OMIT_TRIGGER to reduce the size of the
>> generated code.
>>
> 
> The OMIT macros are not supported in the preprocessed source
> code or in the amalgamation.  To use the OMIT macros you much
> compile from canonical sources using a unix-like development
> environment.
> 
> The reason for this is that SQLite includes several code files that
> contain automatically generated code.  And the generated code
> depends on which OMIT macros are present.
> 
> D. Richard Hipp
> [EMAIL PROTECTED]

Unfortunately, our build system doesn't support the notion
of source code that is automatically generated.  However,
it does support the ability to turn "capabilities" on or
off at build time, and to have these capabilities map to
compilation switches.

Thus, for example, the capability "CAP_SQL_TRIGGER = 0"
can map to -DSQLITE_OMIT_TRIGGER at compile time.  I plan
to create capabilities corresponding to most of the SQLITE_
OMIT_xxx options.

I think this will work just fine, even though I am using
the preprocessed source code.  All it means is that the
parser will be bigger than it needs to be.

By the way, I originally tried to use the amalgamation.
While it worked, it was unwieldy, for a number of reasons:

(1) Visual Studio has trouble generating line number info
for source files containing more than 64K lines.

(2) Perforce (the source control system that we use) has
trouble diff'ing two versions of a very large file.

(3) We have to make numerous small mods to SQLite in order
to get it to compile on all our target platforms (set-top
boxes), and it is simply easier to edit several small, pre-
processed source files instead of one huge amalgamation file.

There are several reasons we get many compilation warnings
(and even a few errors) when we compile SQLite:

(1) Each target has its own, often archaic, compiler,
which has probably not been tested by the SQLite develop-
ment team;

(2) We usually compile at a fairly high warning level,
so we get a lot of warnings about implicit type conversions.
Inserting an explicit type cast usually fixes these.

(3) We compile several targets using a C++, not C, compiler.
There are a few places in the SQLite source where this causes
problems.  Most notably, in sqliteInt.h a number of nested
structs are defined; these cause scoping problems in C++.
The workaround is to move the nested struct outside of (and
immediately preceding) the main struct.

- Richard

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLITE_OMIT_TRIGGER compilation problems

2008-04-16 Thread D. Richard Hipp

On Apr 15, 2008, at 10:34 PM, Richard Klein wrote:
> I compiled SQLite 3 (version 3.5.7), specifying
> SQLITE_OMIT_TRIGGER to reduce the size of the
> generated code.
>

The OMIT macros are not supported in the preprocessed source
code or in the amalgamation.  To use the OMIT macros you much
compile from canonical sources using a unix-like development
environment.

The reason for this is that SQLite includes several code files that
contain automatically generated code.  And the generated code
depends on which OMIT macros are present.

D. Richard Hipp
[EMAIL PROTECTED]



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SQLITE_OMIT_TRIGGER compilation problems

2008-04-15 Thread Richard Klein
I compiled SQLite 3 (version 3.5.7), specifying
SQLITE_OMIT_TRIGGER to reduce the size of the
generated code.

I got the following compilation warnings in
parse.c:

-
parse.y(990) : error C2220: warning treated as error - no object file generated
parse.y(990) : warning C4013: 'sqlite3DeleteTriggerStep' undefined; assuming 
extern returning int
parse.y(959) : warning C4013: 'sqlite3FinishTrigger' undefined; assuming extern 
returning int
parse.y(965) : warning C4013: 'sqlite3BeginTrigger' undefined; assuming extern 
returning int
parse.y(1006) : warning C4013: 'sqlite3TriggerUpdateStep' undefined; assuming 
extern returning int
parse.y(1006) : warning C4047: '=' : 'TriggerStep *' differs in levels of 
indirection from 'int'
parse.y(1011) : warning C4013: 'sqlite3TriggerInsertStep' undefined; assuming 
extern returning int
parse.y(1011) : warning C4047: '=' : 'TriggerStep *' differs in levels of 
indirection from 'int'
parse.y(1014) : warning C4047: '=' : 'TriggerStep *' differs in levels of 
indirection from 'int'
parse.y(1018) : warning C4013: 'sqlite3TriggerDeleteStep' undefined; assuming 
extern returning int
parse.y(1018) : warning C4047: '=' : 'TriggerStep *' differs in levels of 
indirection from 'int'
parse.y(1021) : warning C4013: 'sqlite3TriggerSelectStep' undefined; assuming 
extern returning int
parse.y(1021) : warning C4047: '=' : 'TriggerStep *' differs in levels of 
indirection from 'int'
parse.y(1049) : warning C4013: 'sqlite3DropTrigger' undefined; assuming extern 
returning int
-

The various trigger functions are declared in
sqliteInt.h as follows:

-
#ifndef SQLITE_OMIT_TRIGGER
   void sqlite3BeginTrigger(Parse*, Token*,Token*,int,int,IdList*,SrcList*,
Expr*,int, int);
   void sqlite3FinishTrigger(Parse*, TriggerStep*, Token*);
   void sqlite3DropTrigger(Parse*, SrcList*, int);
   void sqlite3DropTriggerPtr(Parse*, Trigger*);
   int sqlite3TriggersExist(Parse*, Table*, int, ExprList*);
   int sqlite3CodeRowTrigger(Parse*, int, ExprList*, int, Table *, int, int,
int, int, u32*, u32*);
   void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*);
   void sqlite3DeleteTriggerStep(TriggerStep*);
   TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*);
   TriggerStep *sqlite3TriggerInsertStep(sqlite3*,Token*, IdList*,
 ExprList*,Select*,int);
   TriggerStep *sqlite3TriggerUpdateStep(sqlite3*,Token*,ExprList*, Expr*, int);
   TriggerStep *sqlite3TriggerDeleteStep(sqlite3*,Token*, Expr*);
   void sqlite3DeleteTrigger(Trigger*);
   void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*);
   void sqlite3SelectMask(Parse *, Select *, u32);
#else
# define sqlite3TriggersExist(A,B,C,D,E,F) 0
# define sqlite3DeleteTrigger(A)
# define sqlite3DropTriggerPtr(A,B)
# define sqlite3UnlinkAndDeleteTrigger(A,B,C)
# define sqlite3CodeRowTrigger(A,B,C,D,E,F,G,H,I,J,K) 0
# define sqlite3SelectMask(A, B, C)
#endif
-

It would seem that, in the #else section, we just need to
add 9 more no-op macros for the undefined trigger functions.

- Richard
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users