Skip to content

Commit 20a3978

Browse files
authored
chore: ignore warnings from DuckDB header definitions (#6909)
Push/pop diagnostics to suppress warnings from DuckDB headers we include but do not own. Works on both GCC and Clang via #pragma GCC diagnostic. --------- Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
1 parent 2a92893 commit 20a3978

33 files changed

Lines changed: 173 additions & 19 deletions

vortex-duckdb/build.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,6 @@ fn main() {
504504
.flag("-Wall")
505505
.flag("-Wextra")
506506
.flag("-Wpedantic")
507-
// Unused parameter warnings are disabled as we include DuckDB
508-
// headers with implementations that have unused parameters.
509-
.flag("-Wno-unused-parameter")
510507
.cpp(true)
511508
.include(&duckdb_include_path)
512509
.include("cpp/include")

vortex-duckdb/cpp/client_context.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33

44
#include "duckdb_vx.h"
55

6+
#include "duckdb_vx/duckdb_diagnostics.h"
7+
DUCKDB_INCLUDES_BEGIN
68
#include <duckdb/main/client_context.hpp>
79
#include <duckdb/main/connection.hpp>
810
#include <duckdb/storage/object_cache.hpp>
11+
DUCKDB_INCLUDES_END
912

1013
extern "C" duckdb_client_context duckdb_vx_connection_get_client_context(duckdb_connection conn) {
1114
try {

vortex-duckdb/cpp/config.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

44
#include "include/duckdb_vx/config.h"
5+
6+
#include "duckdb_vx/duckdb_diagnostics.h"
7+
DUCKDB_INCLUDES_BEGIN
58
#include "duckdb.hpp"
69
#include "duckdb/main/capi/capi_internal.hpp"
710
#include "duckdb/main/config.hpp"
11+
DUCKDB_INCLUDES_END
12+
813
#include <string>
914
#include <memory>
1015
#include <cstdlib>

vortex-duckdb/cpp/copy_function.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33

44
#include "duckdb_vx.h"
55
#include "duckdb_vx/data.hpp"
6+
#include "duckdb_vx/error.hpp"
7+
8+
#include "duckdb_vx/duckdb_diagnostics.h"
9+
DUCKDB_INCLUDES_BEGIN
610
#include "duckdb/function/copy_function.hpp"
711
#include "duckdb/main/capi/capi_internal.hpp"
812
#include "duckdb/main/client_context.hpp"
913
#include "duckdb/main/connection.hpp"
1014
#include "duckdb/parser/parsed_data/create_copy_function_info.hpp"
11-
#include "duckdb_vx/error.hpp"
15+
DUCKDB_INCLUDES_END
1216

1317
using namespace duckdb;
1418

@@ -39,7 +43,7 @@ struct CCopyLocalData final : LocalFunctionData {
3943

4044
static duckdb_vx_copy_func_vtab_t copy_vtab_one;
4145

42-
unique_ptr<FunctionData> c_bind_one(ClientContext &context,
46+
unique_ptr<FunctionData> c_bind_one(ClientContext & /*context*/,
4347
CopyFunctionBindInput &info,
4448
const vector<string> &column_names,
4549
const vector<LogicalType> &column_types) {
@@ -90,7 +94,7 @@ c_init_global(ClientContext &context, FunctionData &bind_data, const string &fil
9094
return make_uniq<CCopyGlobalData>(unique_ptr<CData>(reinterpret_cast<CData *>(global_data)));
9195
}
9296

93-
unique_ptr<LocalFunctionData> c_init_local(ExecutionContext &context, FunctionData &bind_data) {
97+
unique_ptr<LocalFunctionData> c_init_local(ExecutionContext & /*context*/, FunctionData &bind_data) {
9498
auto &bind = bind_data.Cast<CCopyBindData>();
9599
duckdb_vx_error error_out = nullptr;
96100
auto data = bind.vtab.init_local(bind.ffi_data->DataPtr(), &error_out);
@@ -101,7 +105,7 @@ unique_ptr<LocalFunctionData> c_init_local(ExecutionContext &context, FunctionDa
101105
return make_uniq<CCopyLocalData>(unique_ptr<CData>(reinterpret_cast<CData *>(data)));
102106
}
103107

104-
void c_copy_to_sink(ExecutionContext &context,
108+
void c_copy_to_sink(ExecutionContext & /*context*/,
105109
FunctionData &bind_data,
106110
GlobalFunctionData &gstate,
107111
LocalFunctionData &lstate,
@@ -120,7 +124,7 @@ void c_copy_to_sink(ExecutionContext &context,
120124
}
121125
}
122126

123-
void copy_to_finalize(ClientContext &context, FunctionData &bind_data, GlobalFunctionData &gstate) {
127+
void copy_to_finalize(ClientContext & /*context*/, FunctionData &bind_data, GlobalFunctionData &gstate) {
124128
auto &bind = bind_data.Cast<CCopyBindData>();
125129
auto &global = gstate.Cast<CCopyGlobalData>();
126130
duckdb_vx_error error_out = nullptr;
@@ -152,7 +156,7 @@ extern "C" duckdb_state duckdb_vx_copy_func_register_vtab_one(duckdb_database ff
152156
copy_function.extension = copy_vtab_one.extension;
153157

154158
// TODO(joe): expose this via c our api
155-
copy_function.execution_mode = [](bool preserve_insertion_order, bool supports_batch_index) {
159+
copy_function.execution_mode = [](bool /*preserve_insertion_order*/, bool /*supports_batch_index*/) {
156160
return CopyFunctionExecutionMode::REGULAR_COPY_TO_FILE;
157161
};
158162
// TODO(joe): handle parameters as in table_function

vortex-duckdb/cpp/data.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4+
#include "duckdb_vx/duckdb_diagnostics.h"
5+
DUCKDB_INCLUDES_BEGIN
46
#include "duckdb.h"
7+
DUCKDB_INCLUDES_END
58

69
#include "duckdb_vx/data.hpp"
710

vortex-duckdb/cpp/data_chunk.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4+
#include "duckdb_vx/duckdb_diagnostics.h"
5+
DUCKDB_INCLUDES_BEGIN
46
#include "duckdb/common/types/data_chunk.hpp"
7+
DUCKDB_INCLUDES_END
58

69
#include "duckdb_vx.h"
710

vortex-duckdb/cpp/error.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
#include <cassert>
55
#include <exception>
66

7+
#include "duckdb_vx/duckdb_diagnostics.h"
8+
DUCKDB_INCLUDES_BEGIN
79
#include "duckdb/common/exception.hpp"
810
#include "duckdb/common/types/vector_buffer.hpp"
911
#include "duckdb/common/types/vector.hpp"
12+
DUCKDB_INCLUDES_END
1013

1114
#include "duckdb_vx.h"
1215

vortex-duckdb/cpp/expr.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

44
#include "duckdb_vx.h"
5+
6+
#include "duckdb_vx/duckdb_diagnostics.h"
7+
DUCKDB_INCLUDES_BEGIN
58
#include "duckdb/planner/expression/bound_between_expression.hpp"
69
#include "duckdb/planner/expression/bound_columnref_expression.hpp"
710
#include "duckdb/planner/expression/bound_comparison_expression.hpp"
811
#include "duckdb/planner/expression/bound_constant_expression.hpp"
912
#include "duckdb/planner/expression/bound_function_expression.hpp"
1013
#include "duckdb/planner/expression/bound_operator_expression.hpp"
1114
#include "duckdb/planner/expression/bound_conjunction_expression.hpp"
15+
DUCKDB_INCLUDES_END
1216

1317
using namespace duckdb;
1418

vortex-duckdb/cpp/file_system.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
#include "duckdb_vx.h"
55
#include "duckdb_vx/error.hpp"
66

7+
#include "duckdb_vx/duckdb_diagnostics.h"
8+
DUCKDB_INCLUDES_BEGIN
79
#include <duckdb/common/exception.hpp>
810
#include <duckdb/common/file_system.hpp>
911
#include <duckdb/common/helper.hpp>
1012
#include <duckdb/main/client_context.hpp>
13+
DUCKDB_INCLUDES_END
1114

1215
#include <memory>
1316
#include <string>

vortex-duckdb/cpp/include/duckdb_vx/client_context.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
#pragma once
55

6+
#include "duckdb_vx/duckdb_diagnostics.h"
7+
8+
DUCKDB_INCLUDES_BEGIN
69
#include "duckdb.h"
10+
DUCKDB_INCLUDES_END
711

812
#ifdef __cplusplus /* If compiled as C++, use C ABI */
913
extern "C" {

0 commit comments

Comments
 (0)