Snapshot of upstream SQLite 3.43.2
[sqlcipher.git] / tool / warnings.sh
blob2b962d15ed890c5044420dc64fffff8a5a1ab907
1 #/bin/sh
3 # Run this script in a directory with a working makefile to check for
4 # compiler warnings in SQLite.
7 if uname | grep -i openbsd ; then
8 # Use these for testing on OpenBSD:
9 WARNING_OPTS=-Wall
10 WARNING_ANDROID_OPTS=-Wall
11 else
12 # Use these for testing on Linux and Mac OSX:
13 WARNING_OPTS="-Wshadow -Wall -Wextra -pedantic-errors -Wno-long-long"
14 gccvers=`gcc -v 2>&1 | grep '^gcc version'`
15 if test "$gccvers" '<' 'gcc version 6'
16 then
17 WARNING_ANDROID_OPTS="-Wshadow -Wall -Wextra"
18 else
19 WARNING_ANDROID_OPTS="-Wshadow -Wall -Wextra -Wimplicit-fallthrough=0"
23 rm -f sqlite3.c
24 make sqlite3.c
25 echo '********** No optimizations. Includes FTS4/5, GEOPOLY, JSON1 ***'
26 echo '********** ' Options: $WARNING_OPTS
27 gcc -c $WARNING_OPTS -std=c89 \
28 -ansi -DHAVE_STDINT_H -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_GEOPOLY \
29 -DSQLITE_ENABLE_FTS5 \
30 sqlite3.c
31 if test x`uname` = 'xLinux'; then
32 echo '********** Android configuration ******************************'
33 echo '********** ' Options: $WARNING_ANDROID_OPTS
34 gcc -c \
35 -DSQLITE_HAVE_ISNAN \
36 -DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576 \
37 -DSQLITE_THREADSAFE=2 \
38 -DSQLITE_TEMP_STORE=3 \
39 -DSQLITE_POWERSAFE_OVERWRITE=1 \
40 -DSQLITE_DEFAULT_FILE_FORMAT=4 \
41 -DSQLITE_DEFAULT_AUTOVACUUM=1 \
42 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 \
43 -DSQLITE_ENABLE_FTS3 \
44 -DSQLITE_ENABLE_FTS3_BACKWARDS \
45 -DSQLITE_ENABLE_FTS4 \
46 -DSQLITE_OMIT_BUILTIN_TEST \
47 -DSQLITE_OMIT_COMPILEOPTION_DIAGS \
48 -DSQLITE_OMIT_LOAD_EXTENSION \
49 -DSQLITE_DEFAULT_FILE_PERMISSIONS=0600 \
50 -DSQLITE_ENABLE_ICU \
51 -DUSE_PREAD64 \
52 $WARNING_ANDROID_OPTS \
53 -Os sqlite3.c shell.c
55 echo '********** No optimizations. ENABLE_STAT4. THREADSAFE=0 *******'
56 echo '********** ' Options: $WARNING_OPTS
57 gcc -c $WARNING_OPTS -std=c89 \
58 -ansi -DSQLITE_ENABLE_STAT4 -DSQLITE_THREADSAFE=0 \
59 sqlite3.c
60 echo '********** Optimized -O3. Includes FTS4/5, GEOPOLY, JSON1 ******'
61 echo '********** ' Options: $WARNING_OPTS
62 gcc -O3 -c $WARNING_OPTS -std=c89 \
63 -ansi -DHAVE_STDINT_H -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_GEOPOLY \
64 -DSQLITE_ENABLE_FTS5 \
65 sqlite3.c