11#pragma once
22
3+ // Clang has the annoying habit of warning about future C++ features that it claims to support through a feature macro.
4+ #ifdef __clang__
5+ #pragma clang diagnostic push
6+ #pragma clang diagnostic ignored "-Wc++20-extensions"
7+ #pragma clang diagnostic ignored "-Wc++23-extensions"
8+ #pragma clang diagnostic ignored "-Wc++26-extensions"
9+ #endif
10+
311#if defined(_MSC_VER)
412__pragma(push_macro("min"))
513#undef min
@@ -8,9 +16,6 @@ __pragma(push_macro("max"))
816#endif // defined(_MSC_VER)
917#pragma once
1018
11- #include <sqlite3.h>
12- #pragma once
13-
1419// #include "cxx_universal.h"
1520
1621/*
@@ -158,6 +163,16 @@ using std::nullptr_t;
158163#define SQLITE_ORM_CLANG_SUPPRESS(warnoption, ...) __VA_ARGS__
159164#endif
160165
166+ #if defined(_MSC_VER) && !defined(__clang__)
167+ #define SQLITE_ORM_DO_PRAGMA(...) __pragma(__VA_ARGS__)
168+ #endif
169+
170+ #if defined(_MSC_VER) && !defined(__clang__)
171+ #define SQLITE_ORM_MSVC_SUPPRESS(warncode, ...) SQLITE_ORM_DO_PRAGMA(warning(suppress : warncode))
172+ #else
173+ #define SQLITE_ORM_MSVC_SUPPRESS(warcode, ...) __VA_ARGS__
174+ #endif
175+
161176// clang has the bad habit of diagnosing missing brace-init-lists when constructing aggregates with base classes.
162177// This is a false positive, since the C++ standard is quite clear that braces for nested or base objects may be omitted,
163178// see https://en.cppreference.com/w/cpp/language/aggregate_initialization:
@@ -168,6 +183,9 @@ using std::nullptr_t;
168183// Because we know what we are doing, we suppress the diagnostic message
169184#define SQLITE_ORM_CLANG_SUPPRESS_MISSING_BRACES(...) SQLITE_ORM_CLANG_SUPPRESS("-Wmissing-braces", __VA_ARGS__)
170185
186+ // msvc has the bad habit of diagnosing overalignment of types with an explicit alignment specifier.
187+ #define SQLITE_ORM_MSVC_SUPPRESS_OVERALIGNMENT(...) SQLITE_ORM_MSVC_SUPPRESS(4324, __VA_ARGS__)
188+
171189#if defined(_MSC_VER) && (_MSC_VER < 1920)
172190#define SQLITE_ORM_BROKEN_VARIADIC_PACK_EXPANSION
173191// Type replacement may fail if an alias template has a non-type template parameter from a dependent expression in it,
@@ -238,6 +256,11 @@ using std::nullptr_t;
238256#error "Unknown target platform detected"
239257#endif
240258
259+ // pull in SQLite3 configuration early, such that version and feature macros are globally available in sqlite_orm
260+ // #include "sqlite3_config.h"
261+
262+ #include <sqlite3.h>
263+
241264#ifdef BUILD_SQLITE_ORM_MODULE
242265#define SQLITE_ORM_EXPORT export
243266#else
@@ -1826,8 +1849,6 @@ namespace sqlite_orm {
18261849#endif
18271850#endif
18281851
1829- // #include "functional/cxx_core_features.h"
1830-
18311852// #include "functional/cxx_type_traits_polyfill.h"
18321853
18331854namespace sqlite_orm {
@@ -14676,12 +14697,6 @@ namespace sqlite_orm {
1467614697 this->table_names.emplace(lookup_table_name<T>(this->db_objects), "");
1467714698 }
1467814699 };
14679-
14680- template<class DBOs, satisfies<is_db_objects, DBOs> = true>
14681- table_name_collector<DBOs> make_table_name_collector(const DBOs& dbObjects) {
14682- return {dbObjects};
14683- }
14684-
1468514700 }
1468614701
1468714702}
@@ -18948,7 +18963,7 @@ namespace sqlite_orm {
1894818963 *other.connection,
1894918964 std::bind(&storage_base::on_open_internal, this, std::placeholders::_1))),
1895018965 cachedForeignKeysCount(other.cachedForeignKeysCount),
18951- executor{std::move( other.executor.will_run_query), std::move( other.executor.did_run_query) } {
18966+ executor{other.executor.will_run_query, other.executor.did_run_query} {
1895218967 if (this->inMemory) {
1895318968 this->connection->retain();
1895418969 }
@@ -21932,7 +21947,7 @@ namespace sqlite_orm {
2193221947
2193321948 template<class Ctx, class... Args>
2193421949 std::set<std::pair<std::string, std::string>> collect_table_names(const set_t<Args...>& set, const Ctx& ctx) {
21935- auto collector = make_table_name_collector( ctx.db_objects) ;
21950+ table_name_collector collector{ ctx.db_objects} ;
2193621951 // note: we are only interested in the table name on the left-hand side of the assignment operator expression
2193721952 iterate_tuple(set.assigns, [&collector](const auto& assignmentOperator) {
2193821953 iterate_ast(assignmentOperator.lhs, collector);
@@ -21948,7 +21963,7 @@ namespace sqlite_orm {
2194821963
2194921964 template<class Ctx, class T, satisfies<is_select, T> = true>
2195021965 std::set<std::pair<std::string, std::string>> collect_table_names(const T& sel, const Ctx& ctx) {
21951- auto collector = make_table_name_collector( ctx.db_objects) ;
21966+ table_name_collector collector{ ctx.db_objects} ;
2195221967 iterate_ast(sel, collector);
2195321968 return std::move(collector.table_names);
2195421969 }
@@ -26449,7 +26464,11 @@ SQLITE_ORM_EXPORT namespace sqlite_orm {
2644926464#endif
2645026465#pragma once
2645126466
26467+ #ifdef __clang__
26468+ #pragma clang diagnostic pop
26469+ #endif
26470+
2645226471#if defined(_MSC_VER)
2645326472__pragma(pop_macro("max"))
2645426473__pragma(pop_macro("min"))
26455- #endif // defined(_MSC_VER)
26474+ #endif
0 commit comments