SQLite Forum

Incorrect C code in sqlite3.c
Login

Incorrect C code in sqlite3.c

(1) By albert on 2020-05-24 12:15:31 [source]

In the file sqlite3.c (version sqlite-autoconf-3320000) we see at line 494 the code:

    #if SQLITE_MUTEX_PTHREADS
and at line 503:
    #if SQLITE_NOINLINE
though when these values are set through the defines at line 16509 and 13514 as:
    #    define SQLITE_MUTEX_PTHREADS 
and
    #  define SQLITE_NOINLINE

this results in invalid C code. It is suggested to replace the #if statements with #ifdef statements and remove the

  #else
    #    define SQLITE_MUTEX_PTHREADS

Same accounts also for line 497:

  #if SQLITE_MUTEX_W32
and line 485:
  #if SQLITE_MUTEX_NOOP

this might also be necessary on other places where empty defines are defined.

(2) By Richard Hipp (drh) on 2020-05-24 12:43:20 in reply to 1 [link] [source]

What C compiler are you using that this causes problems for?

(3) By albert on 2020-05-24 12:47:31 in reply to 2 [link] [source]

I didn't use a compiler, but I used doxygen to create some documentation and here I got an error message.

When looking into the issue I realized that the used construct could give the incorrect C code (an alternative to removing the code might be to issue an #error).