FIX: fix current cmake warnings in linux and add support to treat warnings as errors in linux #353
Merged
gargsaumya merged 2 commits intomainfrom Nov 28, 2025
Merged
FIX: fix current cmake warnings in linux and add support to treat warnings as errors in linux #353gargsaumya merged 2 commits intomainfrom
gargsaumya merged 2 commits intomainfrom
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
|
Contributor
There was a problem hiding this comment.
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.
bewithgaurav
approved these changes
Nov 28, 2025
sumitmsft
approved these changes
Nov 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.