1/* sqlite3wrapper.c
2 *
3 * ====================================================================
4 *    Licensed to the Apache Software Foundation (ASF) under one
5 *    or more contributor license agreements.  See the NOTICE file
6 *    distributed with this work for additional information
7 *    regarding copyright ownership.  The ASF licenses this file
8 *    to you under the Apache License, Version 2.0 (the
9 *    "License"); you may not use this file except in compliance
10 *    with the License.  You may obtain a copy of the License at
11 *
12 *      http://www.apache.org/licenses/LICENSE-2.0
13 *
14 *    Unless required by applicable law or agreed to in writing,
15 *    software distributed under the License is distributed on an
16 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 *    KIND, either express or implied.  See the License for the
18 *    specific language governing permissions and limitations
19 *    under the License.
20 * ====================================================================
21 */
22
23#include "svn_private_config.h"
24
25/* Include sqlite3 inline, making all symbols private. */
26#ifdef SVN_SQLITE_INLINE
27#  define SQLITE_OMIT_DEPRECATED 1
28#  define SQLITE_DEFAULT_MEMSTATUS 0
29#  define SQLITE_OMIT_WAL 1
30#  define SQLITE_API static
31#  if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
32#    pragma GCC diagnostic ignored "-Wunreachable-code"
33#    pragma GCC diagnostic ignored "-Wunused-function"
34#    pragma GCC diagnostic ignored "-Wcast-qual"
35#    pragma GCC diagnostic ignored "-Wunused"
36#    pragma GCC diagnostic ignored "-Wshadow"
37#    if defined(__APPLE_CC__) || defined(__clang__)
38#      pragma GCC diagnostic ignored "-Wshorten-64-to-32"
39#    endif
40#    if defined(__clang__)
41#      pragma clang diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers"
42#      pragma clang diagnostic ignored "-Wmissing-variable-declarations"
43#    endif
44#  endif
45#  ifdef __APPLE__
46     /* SQLite uses OSAtomicCompareAndSwapPtrBarrier from libkern/OSAtomic.h,
47        which has been deprecated since macOS 10.12. This will silence the
48        warning. */
49#    if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
50#      pragma GCC diagnostic ignored "-Wdeprecated-declarations"
51#    endif
52#    include <Availability.h>
53#    if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
54       /* <libkern/OSAtomic.h> is included on OS X by sqlite3.c, and
55          on old systems (Leopard or older), it cannot be compiled
56          with -std=c89 because it uses inline. This is a work-around. */
57#      define inline __inline__
58#      include <libkern/OSAtomic.h>
59#      undef inline
60#    endif
61#  endif
62#  define SQLITE_DEFAULT_FILE_PERMISSIONS 0666
63#  include <sqlite3.c>
64
65/* Expose the sqlite API vtable and the two missing functions */
66const sqlite3_api_routines *const svn_sqlite3__api_funcs = &sqlite3Apis;
67int (*const svn_sqlite3__api_initialize)(void) = sqlite3_initialize;
68int (*const svn_sqlite3__api_config)(int, ...)  = sqlite3_config;
69
70#else  /* !SVN_SQLITE_INLINE */
71
72/* Silence OSX ranlib warnings about object files with no symbols. */
73#include <apr.h>
74extern const apr_uint32_t svn__fake__sqlite3wrapper;
75const apr_uint32_t svn__fake__sqlite3wrapper = 0xdeadbeef;
76
77#endif /* SVN_SQLITE_INLINE */
78