-
Notifications
You must be signed in to change notification settings - Fork 31
FIX: fix current cmake warnings in linux and add support to treat warnings as errors in linux #353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… as errors at build step
📊 Code Coverage Report
Diff CoverageDiff: main...HEAD, staged and unstaged changes
Summary
📋 Files Needing Attention📉 Files with overall lowest coverage (click to expand)mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.row.py: 66.2%
mssql_python.pybind.ddbc_bindings.cpp: 67.1%
mssql_python.helpers.py: 67.5%
mssql_python.pybind.connection.connection.cpp: 74.7%
mssql_python.pybind.ddbc_bindings.h: 76.9%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.pybind.connection.connection_pool.cpp: 79.6%
mssql_python.connection.py: 82.5%
mssql_python.cursor.py: 83.6%🔗 Quick Links
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request enhances build safety and cross-platform compatibility for the mssql_python pybind module by enabling stricter compiler warnings and fixing related issues in Linux builds. The PR adds support for treating warnings as errors on Linux/macOS and addresses casting issues that arose from enabling these strict checks.
- Enabled strict warning enforcement for GCC/Clang compilers with
-Werrorflag - Fixed integer-to-pointer casting issues in numeric parameter binding for ODBC calls
- Added targeted warning suppression for pybind11 struct visibility attributes on GCC
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| mssql_python/pybind/CMakeLists.txt | Added CMake deprecation warnings as errors and compiler flags for GCC/Clang to treat warnings as errors, though contains issues with invalid CMAKE variable and Clang-incompatible flag |
| mssql_python/pybind/ddbc_bindings.cpp | Added GCC pragma directives to suppress -Wattributes warnings for ParamInfo struct and updated type casting for numeric precision/scale values to use reinterpret_cast with intermediate integer types, though the scale casting has a signedness issue |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Work Item / Issue Reference
Summary
This pull request introduces improvements to the build configuration and code safety for the
mssql_python/pybindmodule. The main changes focus on enforcing stricter warning and error handling in the build system, improving cross-platform compatibility, and ensuring safe type casting in parameter binding.Build system improvements:
CMAKE_ERROR_DEPRECATEDandCMAKE_WARN_DEPRECATEDtoTRUEinCMakeLists.txt, ensuring deprecated usage is caught early.-Werror,-Wattributes,-Wint-to-pointer-cast) to treat warnings as errors and catch visibility and type casting issues inCMakeLists.txt.Code safety and compatibility:
ParamInfostruct on Linux using GCC diagnostic pragmas, while maintaining compatibility with Windows. [1] [2]BindParametersfunction to usereinterpret_castandstatic_castfor safe conversion of numeric precision and scale values toSQLPOINTER, preventing potential type safety issues.