Skip to content

Commit 20855b8

Browse files
authored
Merge pull request #1463 from fnc12/tidy-up-warnings
Tidy up warnings
2 parents 4ab411b + 60eb531 commit 20855b8

File tree

17 files changed

+105
-68
lines changed

17 files changed

+105
-68
lines changed

appveyor.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ for:
108108
install:
109109
- |-
110110
cd C:\Tools\vcpkg
111-
git fetch --tags && git checkout 2025.08.27
111+
git fetch --tags && git checkout 2025.09.17
112112
cd %APPVEYOR_BUILD_FOLDER%
113113
C:\Tools\vcpkg\bootstrap-vcpkg.bat -disableMetrics
114114
C:\Tools\vcpkg\vcpkg integrate install
@@ -142,7 +142,7 @@ for:
142142
install:
143143
- |-
144144
pushd $HOME/vcpkg
145-
git fetch --tags && git checkout 2025.08.27
145+
git fetch --tags && git checkout 2025.09.17
146146
popd
147147
$HOME/vcpkg/bootstrap-vcpkg.sh -disableMetrics
148148
$HOME/vcpkg/vcpkg integrate install --overlay-triplets=vcpkg/triplets
@@ -170,7 +170,7 @@ for:
170170
# using custom vcpkg triplets for building and linking dynamic dependent libraries
171171
install:
172172
- |-
173-
git clone --depth 1 --branch 2025.08.27 https://github.com/microsoft/vcpkg.git $HOME/vcpkg
173+
git clone --depth 1 --branch 2025.09.17 https://github.com/microsoft/vcpkg.git $HOME/vcpkg
174174
$HOME/vcpkg/bootstrap-vcpkg.sh -disableMetrics
175175
$HOME/vcpkg/vcpkg integrate install --overlay-triplets=vcpkg/triplets
176176
vcpkg install sqlite3[core,dbstat,math,json1,fts5,rtree,soundex] catch2 --overlay-triplets=vcpkg/triplets

dev/functional/config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#include "cxx_universal.h"
44
#include "platform_definitions.h"
5+
// pull in SQLite3 configuration early, such that version and feature macros are globally available in sqlite_orm
6+
#include "sqlite3_config.h"
57

68
#ifdef BUILD_SQLITE_ORM_MODULE
79
#define SQLITE_ORM_EXPORT export

dev/functional/cxx_compiler_quirks.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@
2020
#define SQLITE_ORM_CLANG_SUPPRESS(warnoption, ...) __VA_ARGS__
2121
#endif
2222

23+
#if defined(_MSC_VER) && !defined(__clang__)
24+
#define SQLITE_ORM_DO_PRAGMA(...) __pragma(__VA_ARGS__)
25+
#endif
26+
27+
#if defined(_MSC_VER) && !defined(__clang__)
28+
#define SQLITE_ORM_MSVC_SUPPRESS(warncode, ...) SQLITE_ORM_DO_PRAGMA(warning(suppress : warncode))
29+
#else
30+
#define SQLITE_ORM_MSVC_SUPPRESS(warcode, ...) __VA_ARGS__
31+
#endif
32+
2333
// clang has the bad habit of diagnosing missing brace-init-lists when constructing aggregates with base classes.
2434
// This is a false positive, since the C++ standard is quite clear that braces for nested or base objects may be omitted,
2535
// see https://en.cppreference.com/w/cpp/language/aggregate_initialization:
@@ -30,6 +40,9 @@
3040
// Because we know what we are doing, we suppress the diagnostic message
3141
#define SQLITE_ORM_CLANG_SUPPRESS_MISSING_BRACES(...) SQLITE_ORM_CLANG_SUPPRESS("-Wmissing-braces", __VA_ARGS__)
3242

43+
// msvc has the bad habit of diagnosing overalignment of types with an explicit alignment specifier.
44+
#define SQLITE_ORM_MSVC_SUPPRESS_OVERALIGNMENT(...) SQLITE_ORM_MSVC_SUPPRESS(4324, __VA_ARGS__)
45+
3346
#if defined(_MSC_VER) && (_MSC_VER < 1920)
3447
#define SQLITE_ORM_BROKEN_VARIADIC_PACK_EXPANSION
3548
// Type replacement may fail if an alias template has a non-type template parameter from a dependent expression in it,

dev/functional/finish_macros.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#pragma once
22

3+
#ifdef __clang__
4+
#pragma clang diagnostic pop
5+
#endif
6+
37
#if defined(_MSC_VER)
48
__pragma(pop_macro("max"))
59
__pragma(pop_macro("min"))
6-
#endif // defined(_MSC_VER)
10+
#endif

dev/functional/start_macros.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
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

dev/statement_serializer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,7 @@ namespace sqlite_orm {
15111511

15121512
template<class Ctx, class... Args>
15131513
std::set<std::pair<std::string, std::string>> collect_table_names(const set_t<Args...>& set, const Ctx& ctx) {
1514-
auto collector = make_table_name_collector(ctx.db_objects);
1514+
table_name_collector collector{ctx.db_objects};
15151515
// note: we are only interested in the table name on the left-hand side of the assignment operator expression
15161516
iterate_tuple(set.assigns, [&collector](const auto& assignmentOperator) {
15171517
iterate_ast(assignmentOperator.lhs, collector);
@@ -1527,7 +1527,7 @@ namespace sqlite_orm {
15271527

15281528
template<class Ctx, class T, satisfies<is_select, T> = true>
15291529
std::set<std::pair<std::string, std::string>> collect_table_names(const T& sel, const Ctx& ctx) {
1530-
auto collector = make_table_name_collector(ctx.db_objects);
1530+
table_name_collector collector{ctx.db_objects};
15311531
iterate_ast(sel, collector);
15321532
return std::move(collector.table_names);
15331533
}

dev/storage_base.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ namespace sqlite_orm {
724724
*other.connection,
725725
std::bind(&storage_base::on_open_internal, this, std::placeholders::_1))),
726726
cachedForeignKeysCount(other.cachedForeignKeysCount),
727-
executor{std::move(other.executor.will_run_query), std::move(other.executor.did_run_query)} {
727+
executor{other.executor.will_run_query, other.executor.did_run_query} {
728728
if (this->inMemory) {
729729
this->connection->retain();
730730
}

dev/table_name_collector.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,6 @@ namespace sqlite_orm {
9292
this->table_names.emplace(lookup_table_name<T>(this->db_objects), "");
9393
}
9494
};
95-
96-
template<class DBOs, satisfies<is_db_objects, DBOs> = true>
97-
table_name_collector<DBOs> make_table_name_collector(const DBOs& dbObjects) {
98-
return {dbObjects};
99-
}
100-
10195
}
10296

10397
}

dev/type_traits.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#endif
1010
#endif
1111

12-
#include "functional/cxx_core_features.h"
1312
#include "functional/cxx_type_traits_polyfill.h"
1413

1514
namespace sqlite_orm {

include/sqlite_orm/sqlite_orm.h

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
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

18331854
namespace 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

Comments
 (0)