Hi all,

I just found out that I was too quick upgrading libfossil to use
the latest SQLite 3.8.4.1 amalgamation:
      
<http://fossil.wanderinghorse.net/repos/libfossil/index.cgi/info/2de81ae7b6>
this broke the Cygwin build  ;-(. The reason is that libfossil is very
strict, considering any warning as error, otherwise I wouldn't even
have noticed this.
    CC [obj/sqlite3.o] ...
    src/sqlite3.c:52986:20: error: 'sqlite3BtreeSetMmapLimit' defined
but not used [-Werror=unused-function]
     SQLITE_PRIVATE int sqlite3BtreeSetMmapLimit(Btree *p,
sqlite3_int64 szMmap){
                        ^
    cc1: all warnings being treated as errors
    sqlite3.make:18: recipe for target 'obj/sqlite3.o' failed
    make: *** [obj/sqlite3.o] Error 1

The problem is that the default SQLITE_MAX_MMAP_SIZE for any
platform not listed is 0. Proposed patch below. Any other platform
with SQLITE_MAX_MMAP_SIZE=0 will give the same warning/error.

I'm sure this change will make more mmap-related test-cases
in the Cygwin test-suite pass, but didn't try that yet......

With this patch, libfossil compiles fine on Cygwin again.
    <http://fossil.wanderinghorse.net/repos/libfossil/index.cgi/info/1dff0493d2>

Regards,
       Jan Nijtmans

Index: src/btree.c
==================================================================
--- src/btree.c
+++ src/btree.c
@@ -2163,18 +2163,20 @@

 /*
 ** Change the limit on the amount of the database file that may be
 ** memory mapped.
 */
+#if SQLITE_MAX_MMAP_SIZE>0
 int sqlite3BtreeSetMmapLimit(Btree *p, sqlite3_int64 szMmap){
   BtShared *pBt = p->pBt;
   assert( sqlite3_mutex_held(p->db->mutex) );
   sqlite3BtreeEnter(p);
   sqlite3PagerSetMmapLimit(pBt->pPager, szMmap);
   sqlite3BtreeLeave(p);
   return SQLITE_OK;
 }
+#endif

 /*
 ** Change the way data is synced to disk in order to increase or decrease
 ** how well the database resists damage due to OS crashes and power
 ** failures.  Level 1 is the same as asynchronous (no syncs() occur and

Index: src/btree.h
==================================================================
--- src/btree.h
+++ src/btree.h
@@ -61,11 +61,13 @@
 #define BTREE_SINGLE        4  /* The file contains at most 1 b-tree */
 #define BTREE_UNORDERED     8  /* Use of a hash implementation is OK */

 int sqlite3BtreeClose(Btree*);
 int sqlite3BtreeSetCacheSize(Btree*,int);
+#if SQLITE_MAX_MMAP_SIZE>0
 int sqlite3BtreeSetMmapLimit(Btree*,sqlite3_int64);
+#endif
 int sqlite3BtreeSetPagerFlags(Btree*,unsigned);
 int sqlite3BtreeSyncDisabled(Btree*);
 int sqlite3BtreeSetPageSize(Btree *p, int nPagesize, int nReserve, int eFix);
 int sqlite3BtreeGetPageSize(Btree*);
 int sqlite3BtreeMaxPageCount(Btree*,int);

Index: src/sqliteInt.h
==================================================================
--- src/sqliteInt.h
+++ src/sqliteInt.h
@@ -616,11 +616,11 @@
 #   define SQLITE_MAX_MMAP_SIZE 0
 # endif
 #endif
 #ifndef SQLITE_MAX_MMAP_SIZE
 # if defined(__linux__) \
-  || defined(_WIN32) \
+  || defined(_WIN32) || defined(__CYGWIN__) \
   || (defined(__APPLE__) && defined(__MACH__)) \
   || defined(__sun)
 #   define SQLITE_MAX_MMAP_SIZE 0x7fff0000  /* 2147418112 */
 # else
 #   define SQLITE_MAX_MMAP_SIZE 0
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to