Skip to content

Commit b51a5d1

Browse files
authored
fix(c/driver/postgresql): Fix warning when compiling PostgreSQL driver on RTools/msys2 (#3903)
When submitting ADBC 22 to CRAN I get: ``` * checking whether package 'adbcpostgresql' can be installed ... WARNING Found the following significant warnings: D:/rtools45/x86_64-w64-mingw32.static.posix/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp] See 'd:/RCompile/CRANguest/R-devel/adbcpostgresql.Rcheck/00install.out' for details. ``` The full install log is at https://win-builder.r-project.org/Ao3b73sGP2Mq/00install.out <details> ``` * installing *source* package 'adbcpostgresql' ... ** this is package 'adbcpostgresql' version '0.22.0' ** using staged installation ********************************************** WARNING: this package has a configure script It probably needs manual configuration ********************************************** ** libs specified C++17 using C++ compiler: 'g++.exe (GCC) 14.3.0' using C++17 g++ -std=gnu++17 -I"D:/RCompile/recent/R/include" -DNDEBUG -I../src/c -I../src/c/include -I../src/c/vendor/ -I../src/c/vendor/portable-snippets/include/ -I../src/c/vendor/fmt/include -DADBC_EXPORT="" -D__USE_MINGW_ANSI_STDIO -DFMT_HEADER_ONLY=1 -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c init.cc -o init.o gcc -I"D:/RCompile/recent/R/include" -DNDEBUG -I../src/c -I../src/c/include -I../src/c/vendor/ -I../src/c/vendor/portable-snippets/include/ -I../src/c/vendor/fmt/include -DADBC_EXPORT="" -D__USE_MINGW_ANSI_STDIO -DFMT_HEADER_ONLY=1 -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include" -pedantic -Wstrict-prototypes -O2 -Wall -std=gnu2x -mfpmath=sse -msse2 -mstackrealign -c c/driver/common/utils.c -o c/driver/common/utils.o g++ -std=gnu++17 -I"D:/RCompile/recent/R/include" -DNDEBUG -I../src/c -I../src/c/include -I../src/c/vendor/ -I../src/c/vendor/portable-snippets/include/ -I../src/c/vendor/fmt/include -DADBC_EXPORT="" -D__USE_MINGW_ANSI_STDIO -DFMT_HEADER_ONLY=1 -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c c/driver/framework/objects.cc -o c/driver/framework/objects.o In file included from D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/vector:66, from ../src/c/driver/framework/objects.h:22, from c/driver/framework/objects.cc:18: In member function 'void std::_Vector_base<_Tp, _Alloc>::_M_deallocate(pointer, std::size_t) [with _Tp = adbc::driver::GetObjectsHelper::ConstraintUsage; _Alloc = std::allocator<adbc::driver::GetObjectsHelper::ConstraintUsage>]', inlined from 'std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = adbc::driver::GetObjectsHelper::ConstraintUsage; _Alloc = std::allocator<adbc::driver::GetObjectsHelper::ConstraintUsage>]' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/bits/stl_vector.h:371:15, inlined from 'std::vector<_Tp, _Alloc>::~vector() [with _Tp = adbc::driver::GetObjectsHelper::ConstraintUsage; _Alloc = std::allocator<adbc::driver::GetObjectsHelper::ConstraintUsage>]' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/bits/stl_vector.h:751:7, inlined from 'constexpr void std::_Optional_payload_base<_Tp>::_M_destroy() [with _Tp = std::vector<adbc::driver::GetObjectsHelper::ConstraintUsage>]' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:283:35, inlined from 'constexpr void std::_Optional_payload_base<_Tp>::_M_reset() [with _Tp = std::vector<adbc::driver::GetObjectsHelper::ConstraintUsage>]' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:314:14, inlined from 'std::_Optional_payload<_Tp, false, _Copy, _Move>::~_Optional_payload() [with _Tp = std::vector<adbc::driver::GetObjectsHelper::ConstraintUsage>; bool _Copy = false; bool _Move = false]' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:437:65, inlined from 'std::_Optional_base<std::vector<adbc::driver::GetObjectsHelper::ConstraintUsage>, false, false>::~_Optional_base()' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:508:12, inlined from 'std::optional<std::vector<adbc::driver::GetObjectsHelper::ConstraintUsage> >::~optional()' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:703:11, inlined from 'adbc::driver::GetObjectsHelper::Constraint::~Constraint()' at ../src/c/driver/framework/objects.h:91:10, inlined from 'constexpr void std::_Optional_payload_base<_Tp>::_M_destroy() [with _Tp = adbc::driver::GetObjectsHelper::Constraint]' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:283:35, inlined from 'constexpr void std::_Optional_payload_base<_Tp>::_M_reset() [with _Tp = adbc::driver::GetObjectsHelper::Constraint]' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:314:14, inlined from 'std::_Optional_payload<_Tp, false, _Copy, _Move>::~_Optional_payload() [with _Tp = adbc::driver::GetObjectsHelper::Constraint; bool _Copy = false; bool _Move = false]' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:437:65, inlined from 'std::_Optional_base<adbc::driver::GetObjectsHelper::Constraint, false, false>::~_Optional_base()' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:508:12, inlined from 'std::optional<adbc::driver::GetObjectsHelper::Constraint>::~optional()' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:703:11, inlined from 'adbc::driver::Status adbc::driver::{anonymous}::GetObjectsBuilder::AppendConstraints(std::string_view, std::string_view, std::string_view)' at c/driver/framework/objects.cc:467:5, inlined from 'adbc::driver::Status adbc::driver::{anonymous}::GetObjectsBuilder::AppendTables(std::string_view, std::string_view)' at c/driver/framework/objects.cc:341:9, inlined from 'adbc::driver::Status adbc::driver::{anonymous}::GetObjectsBuilder::AppendSchemas(std::string_view)' at c/driver/framework/objects.cc:317:9, inlined from 'adbc::driver::Status adbc::driver::{anonymous}::GetObjectsBuilder::AppendCatalogs()' at c/driver/framework/objects.cc:298:9, inlined from 'adbc::driver::Status adbc::driver::{anonymous}::GetObjectsBuilder::Build()' at c/driver/framework/objects.cc:274:5, inlined from 'adbc::driver::Status adbc::driver::BuildGetObjects(GetObjectsHelper*, GetObjectsDepth, std::optional<std::basic_string_view<char> >, std::optional<std::basic_string_view<char> >, std::optional<std::basic_string_view<char> >, std::optional<std::basic_string_view<char> >, const std::vector<std::basic_string_view<char> >&, ArrowArrayStream*)' at c/driver/framework/objects.cc:526:3: D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/bits/stl_vector.h:391:9: warning: '((std::_Vector_base<adbc::driver::GetObjectsHelper::ConstraintUsage, std::allocator<adbc::driver::GetObjectsHelper::ConstraintUsage> >::_Vector_impl_data*)((char*)&maybe_constraint + offsetof(std::optional<adbc::driver::GetObjectsHelper::Constraint>,std::optional<adbc::driver::GetObjectsHelper::Constraint>::<unnamed>.std::_Optional_base<adbc::driver::GetObjectsHelper::Constraint, false, false>::_M_payload.std::_Optional_payload<adbc::driver::GetObjectsHelper::Constraint, false, false, false>::<unnamed>.std::_Optional_payload<adbc::driver::GetObjectsHelper::Constraint, true, false, false>::<unnamed>.std::_Optional_payload_base<adbc::driver::GetObjectsHelper::Constraint>::_M_payload) + 16))[2].std::_Vector_base<adbc::driver::GetObjectsHelper::ConstraintUsage, std::allocator<adbc::driver::GetObjectsHelper::ConstraintUsage> >::_Vector_impl_data::_M_start' may be used uninitialized [-Wmaybe-uninitialized] 391 | if (__p) | ^~ In file included from ../src/c/driver/framework/objects.h:25: c/driver/framework/objects.cc: In function 'adbc::driver::Status adbc::driver::BuildGetObjects(GetObjectsHelper*, GetObjectsDepth, std::optional<std::basic_string_view<char> >, std::optional<std::basic_string_view<char> >, std::optional<std::basic_string_view<char> >, std::optional<std::basic_string_view<char> >, const std::vector<std::basic_string_view<char> >&, ArrowArrayStream*)': c/driver/framework/objects.cc:418:26: note: '((std::_Vector_base<adbc::driver::GetObjectsHelper::ConstraintUsage, std::allocator<adbc::driver::GetObjectsHelper::ConstraintUsage> >::_Vector_impl_data*)((char*)&maybe_constraint + offsetof(std::optional<adbc::driver::GetObjectsHelper::Constraint>,std::optional<adbc::driver::GetObjectsHelper::Constraint>::<unnamed>.std::_Optional_base<adbc::driver::GetObjectsHelper::Constraint, false, false>::_M_payload.std::_Optional_payload<adbc::driver::GetObjectsHelper::Constraint, false, false, false>::<unnamed>.std::_Optional_payload<adbc::driver::GetObjectsHelper::Constraint, true, false, false>::<unnamed>.std::_Optional_payload_base<adbc::driver::GetObjectsHelper::Constraint>::_M_payload) + 16))[2].std::_Vector_base<adbc::driver::GetObjectsHelper::ConstraintUsage, std::allocator<adbc::driver::GetObjectsHelper::ConstraintUsage> >::_Vector_impl_data::_M_start' was declared here 418 | UNWRAP_RESULT(auto maybe_constraint, helper->NextConstraint()); | ^~~~~~~~~~~~~~~~ ../src/c/driver/framework/status.h:265:3: note: in definition of macro 'UNWRAP_RESULT_IMPL' 265 | lhs = std::move((name).value()); | ^~~ c/driver/framework/objects.cc:418:7: note: in expansion of macro 'UNWRAP_RESULT' 418 | UNWRAP_RESULT(auto maybe_constraint, helper->NextConstraint()); | ^~~~~~~~~~~~~ In destructor 'std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = adbc::driver::GetObjectsHelper::ConstraintUsage; _Alloc = std::allocator<adbc::driver::GetObjectsHelper::ConstraintUsage>]', inlined from 'std::vector<_Tp, _Alloc>::~vector() [with _Tp = adbc::driver::GetObjectsHelper::ConstraintUsage; _Alloc = std::allocator<adbc::driver::GetObjectsHelper::ConstraintUsage>]' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/bits/stl_vector.h:751:7, inlined from 'constexpr void std::_Optional_payload_base<_Tp>::_M_destroy() [with _Tp = std::vector<adbc::driver::GetObjectsHelper::ConstraintUsage>]' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:283:35, inlined from 'constexpr void std::_Optional_payload_base<_Tp>::_M_reset() [with _Tp = std::vector<adbc::driver::GetObjectsHelper::ConstraintUsage>]' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:314:14, inlined from 'std::_Optional_payload<_Tp, false, _Copy, _Move>::~_Optional_payload() [with _Tp = std::vector<adbc::driver::GetObjectsHelper::ConstraintUsage>; bool _Copy = false; bool _Move = false]' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:437:65, inlined from 'std::_Optional_base<std::vector<adbc::driver::GetObjectsHelper::ConstraintUsage>, false, false>::~_Optional_base()' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:508:12, inlined from 'std::optional<std::vector<adbc::driver::GetObjectsHelper::ConstraintUsage> >::~optional()' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:703:11, inlined from 'adbc::driver::GetObjectsHelper::Constraint::~Constraint()' at ../src/c/driver/framework/objects.h:91:10, inlined from 'constexpr void std::_Optional_payload_base<_Tp>::_M_destroy() [with _Tp = adbc::driver::GetObjectsHelper::Constraint]' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:283:35, inlined from 'constexpr void std::_Optional_payload_base<_Tp>::_M_reset() [with _Tp = adbc::driver::GetObjectsHelper::Constraint]' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:314:14, inlined from 'std::_Optional_payload<_Tp, false, _Copy, _Move>::~_Optional_payload() [with _Tp = adbc::driver::GetObjectsHelper::Constraint; bool _Copy = false; bool _Move = false]' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:437:65, inlined from 'std::_Optional_base<adbc::driver::GetObjectsHelper::Constraint, false, false>::~_Optional_base()' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:508:12, inlined from 'std::optional<adbc::driver::GetObjectsHelper::Constraint>::~optional()' at D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/optional:703:11, inlined from 'adbc::driver::Status adbc::driver::{anonymous}::GetObjectsBuilder::AppendConstraints(std::string_view, std::string_view, std::string_view)' at c/driver/framework/objects.cc:467:5, inlined from 'adbc::driver::Status adbc::driver::{anonymous}::GetObjectsBuilder::AppendTables(std::string_view, std::string_view)' at c/driver/framework/objects.cc:341:9, inlined from 'adbc::driver::Status adbc::driver::{anonymous}::GetObjectsBuilder::AppendSchemas(std::string_view)' at c/driver/framework/objects.cc:317:9, inlined from 'adbc::driver::Status adbc::driver::{anonymous}::GetObjectsBuilder::AppendCatalogs()' at c/driver/framework/objects.cc:298:9, inlined from 'adbc::driver::Status adbc::driver::{anonymous}::GetObjectsBuilder::Build()' at c/driver/framework/objects.cc:274:5, inlined from 'adbc::driver::Status adbc::driver::BuildGetObjects(GetObjectsHelper*, GetObjectsDepth, std::optional<std::basic_string_view<char> >, std::optional<std::basic_string_view<char> >, std::optional<std::basic_string_view<char> >, std::optional<std::basic_string_view<char> >, const std::vector<std::basic_string_view<char> >&, ArrowArrayStream*)' at c/driver/framework/objects.cc:526:3: D:/rtools45/x86_64-w64-mingw32.static.posix/lib/gcc/x86_64-w64-mingw32.static.posix/14.3.0/include/c++/bits/stl_vector.h:372:49: warning: '((std::_Vector_base<adbc::driver::GetObjectsHelper::ConstraintUsage, std::allocator<adbc::driver::GetObjectsHelper::ConstraintUsage> >::_Vector_impl_data*)((char*)&maybe_constraint + offsetof(std::optional<adbc::driver::GetObjectsHelper::Constraint>,std::optional<adbc::driver::GetObjectsHelper::Constraint>::<unnamed>.std::_Optional_base<adbc::driver::GetObjectsHelper::Constraint, false, false>::_M_payload.std::_Optional_payload<adbc::driver::GetObjectsHelper::Constraint, false, false, false>::<unnamed>.std::_Optional_payload<adbc::driver::GetObjectsHelper::Constraint, true, false, false>::<unnamed>.std::_Optional_payload_base<adbc::driver::GetObjectsHelper::Constraint>::_M_payload) + 16))[2].std::_Vector_base<adbc::driver::GetObjectsHelper::ConstraintUsage, std::allocator<adbc::driver::GetObjectsHelper::ConstraintUsage> >::_Vector_impl_data::_M_end_of_storage' may be used uninitialized [-Wmaybe-uninitialized] 372 | _M_impl._M_end_of_storage - _M_impl._M_start); | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ c/driver/framework/objects.cc: In function 'adbc::driver::Status adbc::driver::BuildGetObjects(GetObjectsHelper*, GetObjectsDepth, std::optional<std::basic_string_view<char> >, std::optional<std::basic_string_view<char> >, std::optional<std::basic_string_view<char> >, std::optional<std::basic_string_view<char> >, const std::vector<std::basic_string_view<char> >&, ArrowArrayStream*)': c/driver/framework/objects.cc:418:26: note: '((std::_Vector_base<adbc::driver::GetObjectsHelper::ConstraintUsage, std::allocator<adbc::driver::GetObjectsHelper::ConstraintUsage> >::_Vector_impl_data*)((char*)&maybe_constraint + offsetof(std::optional<adbc::driver::GetObjectsHelper::Constraint>,std::optional<adbc::driver::GetObjectsHelper::Constraint>::<unnamed>.std::_Optional_base<adbc::driver::GetObjectsHelper::Constraint, false, false>::_M_payload.std::_Optional_payload<adbc::driver::GetObjectsHelper::Constraint, false, false, false>::<unnamed>.std::_Optional_payload<adbc::driver::GetObjectsHelper::Constraint, true, false, false>::<unnamed>.std::_Optional_payload_base<adbc::driver::GetObjectsHelper::Constraint>::_M_payload) + 16))[2].std::_Vector_base<adbc::driver::GetObjectsHelper::ConstraintUsage, std::allocator<adbc::driver::GetObjectsHelper::ConstraintUsage> >::_Vector_impl_data::_M_end_of_storage' was declared here 418 | UNWRAP_RESULT(auto maybe_constraint, helper->NextConstraint()); | ^~~~~~~~~~~~~~~~ ../src/c/driver/framework/status.h:265:3: note: in definition of macro 'UNWRAP_RESULT_IMPL' 265 | lhs = std::move((name).value()); | ^~~ c/driver/framework/objects.cc:418:7: note: in expansion of macro 'UNWRAP_RESULT' 418 | UNWRAP_RESULT(auto maybe_constraint, helper->NextConstraint()); | ^~~~~~~~~~~~~ g++ -std=gnu++17 -I"D:/RCompile/recent/R/include" -DNDEBUG -I../src/c -I../src/c/include -I../src/c/vendor/ -I../src/c/vendor/portable-snippets/include/ -I../src/c/vendor/fmt/include -DADBC_EXPORT="" -D__USE_MINGW_ANSI_STDIO -DFMT_HEADER_ONLY=1 -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c c/driver/framework/utility.cc -o c/driver/framework/utility.o g++ -std=gnu++17 -I"D:/RCompile/recent/R/include" -DNDEBUG -I../src/c -I../src/c/include -I../src/c/vendor/ -I../src/c/vendor/portable-snippets/include/ -I../src/c/vendor/fmt/include -DADBC_EXPORT="" -D__USE_MINGW_ANSI_STDIO -DFMT_HEADER_ONLY=1 -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c c/driver/postgresql/connection.cc -o c/driver/postgresql/connection.o In file included from c/driver/postgresql/copy/../postgres_util.h:25, from c/driver/postgresql/copy/reader.h:32, from c/driver/postgresql/result_helper.h:32, from c/driver/postgresql/connection.cc:43: D:/rtools45/x86_64-w64-mingw32.static.posix/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp] 15 | #warning Please include winsock2.h before windows.h | ^~~~~~~ g++ -std=gnu++17 -I"D:/RCompile/recent/R/include" -DNDEBUG -I../src/c -I../src/c/include -I../src/c/vendor/ -I../src/c/vendor/portable-snippets/include/ -I../src/c/vendor/fmt/include -DADBC_EXPORT="" -D__USE_MINGW_ANSI_STDIO -DFMT_HEADER_ONLY=1 -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c c/driver/postgresql/database.cc -o c/driver/postgresql/database.o In file included from c/driver/postgresql/copy/../postgres_util.h:25, from c/driver/postgresql/copy/reader.h:32, from c/driver/postgresql/result_helper.h:32, from c/driver/postgresql/database.cc:34: D:/rtools45/x86_64-w64-mingw32.static.posix/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp] 15 | #warning Please include winsock2.h before windows.h | ^~~~~~~ g++ -std=gnu++17 -I"D:/RCompile/recent/R/include" -DNDEBUG -I../src/c -I../src/c/include -I../src/c/vendor/ -I../src/c/vendor/portable-snippets/include/ -I../src/c/vendor/fmt/include -DADBC_EXPORT="" -D__USE_MINGW_ANSI_STDIO -DFMT_HEADER_ONLY=1 -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c c/driver/postgresql/error.cc -o c/driver/postgresql/error.o g++ -std=gnu++17 -I"D:/RCompile/recent/R/include" -DNDEBUG -I../src/c -I../src/c/include -I../src/c/vendor/ -I../src/c/vendor/portable-snippets/include/ -I../src/c/vendor/fmt/include -DADBC_EXPORT="" -D__USE_MINGW_ANSI_STDIO -DFMT_HEADER_ONLY=1 -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c c/driver/postgresql/postgresql.cc -o c/driver/postgresql/postgresql.o In file included from c/driver/postgresql/copy/../postgres_util.h:25, from c/driver/postgresql/copy/reader.h:32, from c/driver/postgresql/statement.h:29, from c/driver/postgresql/postgresql.cc:29: D:/rtools45/x86_64-w64-mingw32.static.posix/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp] 15 | #warning Please include winsock2.h before windows.h | ^~~~~~~ g++ -std=gnu++17 -I"D:/RCompile/recent/R/include" -DNDEBUG -I../src/c -I../src/c/include -I../src/c/vendor/ -I../src/c/vendor/portable-snippets/include/ -I../src/c/vendor/fmt/include -DADBC_EXPORT="" -D__USE_MINGW_ANSI_STDIO -DFMT_HEADER_ONLY=1 -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c c/driver/postgresql/result_helper.cc -o c/driver/postgresql/result_helper.o In file included from c/driver/postgresql/copy/../postgres_util.h:25, from c/driver/postgresql/copy/reader.h:32, from c/driver/postgresql/result_helper.h:32, from c/driver/postgresql/result_helper.cc:18: D:/rtools45/x86_64-w64-mingw32.static.posix/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp] 15 | #warning Please include winsock2.h before windows.h | ^~~~~~~ g++ -std=gnu++17 -I"D:/RCompile/recent/R/include" -DNDEBUG -I../src/c -I../src/c/include -I../src/c/vendor/ -I../src/c/vendor/portable-snippets/include/ -I../src/c/vendor/fmt/include -DADBC_EXPORT="" -D__USE_MINGW_ANSI_STDIO -DFMT_HEADER_ONLY=1 -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c c/driver/postgresql/result_reader.cc -o c/driver/postgresql/result_reader.o g++ -std=gnu++17 -I"D:/RCompile/recent/R/include" -DNDEBUG -I../src/c -I../src/c/include -I../src/c/vendor/ -I../src/c/vendor/portable-snippets/include/ -I../src/c/vendor/fmt/include -DADBC_EXPORT="" -D__USE_MINGW_ANSI_STDIO -DFMT_HEADER_ONLY=1 -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c c/driver/postgresql/statement.cc -o c/driver/postgresql/statement.o In file included from c/driver/postgresql/copy/../postgres_util.h:25, from c/driver/postgresql/copy/reader.h:32, from c/driver/postgresql/statement.h:29, from c/driver/postgresql/statement.cc:21: D:/rtools45/x86_64-w64-mingw32.static.posix/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp] 15 | #warning Please include winsock2.h before windows.h | ^~~~~~~ gcc -I"D:/RCompile/recent/R/include" -DNDEBUG -I../src/c -I../src/c/include -I../src/c/vendor/ -I../src/c/vendor/portable-snippets/include/ -I../src/c/vendor/fmt/include -DADBC_EXPORT="" -D__USE_MINGW_ANSI_STDIO -DFMT_HEADER_ONLY=1 -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include" -pedantic -Wstrict-prototypes -O2 -Wall -std=gnu2x -mfpmath=sse -msse2 -mstackrealign -c c/vendor/nanoarrow/nanoarrow.c -o c/vendor/nanoarrow/nanoarrow.o g++ -shared -s -static-libgcc -o adbcpostgresql.dll tmp.def init.o c/driver/common/utils.o c/driver/framework/objects.o c/driver/framework/utility.o c/driver/postgresql/connection.o c/driver/postgresql/database.o c/driver/postgresql/error.o c/driver/postgresql/postgresql.o c/driver/postgresql/result_helper.o c/driver/postgresql/result_reader.o c/driver/postgresql/statement.o c/vendor/nanoarrow/nanoarrow.o -lpq -lpgcommon -lpgport -lssl -lcrypto -lz -lsecur32 -lws2_32 -lwldap32 -lcrypt32 -Ld:/rtools45/x86_64-w64-mingw32.static.posix/lib/x64 -Ld:/rtools45/x86_64-w64-mingw32.static.posix/lib -LD:/RCompile/recent/R/bin/x64 -lR installing to d:/RCompile/CRANguest/R-devel/lib/00LOCK-adbcpostgresql/00new/adbcpostgresql/libs/x64 ** R ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * MD5 sums packaged installation of 'adbcpostgresql' as adbcpostgresql_0.22.0.zip * DONE (adbcpostgresql) ``` </details> I think on msys2 one of the system headers includes `windows.h`, so our use of `winsock2.h` in `postgres_utils.h` causes the warning. I'm not sure if this is a particularly clean solution (we could also just inline byte swapping on Windows instead of using the helpers in winsock2).
1 parent 9d92be9 commit b51a5d1

File tree

8 files changed

+32
-0
lines changed

8 files changed

+32
-0
lines changed

c/driver/postgresql/connection.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
// For #warning Please include winsock2.h before windows.h on RTools/msys2
19+
#ifdef _WIN32
20+
#include <winsock2.h>
21+
#endif
22+
1823
#include "connection.h"
1924

2025
#include <array>

c/driver/postgresql/database.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
// For #warning Please include winsock2.h before windows.h on RTools/msys2
19+
#ifdef _WIN32
20+
#include <winsock2.h>
21+
#endif
22+
1823
#include "database.h"
1924

2025
#include <array>

c/driver/postgresql/postgresql.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717

1818
// A libpq-based PostgreSQL driver for ADBC.
1919

20+
// For #warning Please include winsock2.h before windows.h on RTools/msys2
21+
#ifdef _WIN32
22+
#include <winsock2.h>
23+
#endif
24+
2025
#include <cstring>
2126
#include <memory>
2227

c/driver/postgresql/result_helper.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
// For #warning Please include winsock2.h before windows.h on RTools/msys2
19+
#ifdef _WIN32
20+
#include <winsock2.h>
21+
#endif
22+
1823
#include "result_helper.h"
1924

2025
#include <charconv>

c/driver/postgresql/result_reader.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
// For #warning Please include winsock2.h before windows.h on RTools/msys2
19+
#ifdef _WIN32
20+
#include <winsock2.h>
21+
#endif
22+
1823
#include "result_reader.h"
1924

2025
#include <memory>

c/driver/postgresql/statement.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
// Windows
1919
#define NOMINMAX
2020

21+
// For #warning Please include winsock2.h before windows.h on RTools/msys2
22+
#ifdef _WIN32
23+
#include <winsock2.h>
24+
#endif
25+
2126
#include "statement.h"
2227

2328
#include <algorithm>

r/adbcsqlite/.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111
^cran-comments\.md$
1212
^compile_commands\.json$
1313
^\.cache$
14+
^CRAN-SUBMISSION$

r/adbcsqlite/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717

1818
.Rproj.user
1919
docs
20+
CRAN-SUBMISSION

0 commit comments

Comments
 (0)