Skip to content

fix(seekdb): Fix Windows SDK OPTIONAL macro naming conflict with C++ enum value#917

Open
ep-12221 wants to merge 5 commits into
masterfrom
issue/2026061800116825248
Open

fix(seekdb): Fix Windows SDK OPTIONAL macro naming conflict with C++ enum value#917
ep-12221 wants to merge 5 commits into
masterfrom
issue/2026061800116825248

Conversation

@ep-12221

Copy link
Copy Markdown
Contributor

Task Description

Fix a compilation error on Windows caused by a naming conflict between a Windows SDK macro and a C++ enumerator.

Solution Description

Root Cause: The Windows SDK header file winnt.h defines an empty macro OPTIONAL for SAL annotations, such as _In_opt_. When the C++ code in ob_req_packet_code.h uses OPTIONAL as an enumerator in enum class ObReqCheckSumCheckLevel, the MSVC/clang-cl preprocessor expands it into an empty string.
Error File: deps/oblib/src/rpc/frame/ob_req_packet_code.h:102
Error Line

enum class ObReqCheckSumCheckLevel
{
INVALID
FORCE
OPTIONAL, // ← Expanded to empty by the macro, causing a syntax error
DISABLE
};

Impact Scope: All compilation units that directly or indirectly #include ob_req_packet_code.h (approximately 200+ .cpp files). This only occurs when building on Windows; Linux/macOS are not affected.

Passed Regressions

  • Original failing file compilation: ob_geo_func_covered_by2.cpp.obj and 15+ related geo files in the same include chain compiled successfully, with no further OPTIONAL-related syntax errors.
  • Macro conflict verification: After #undef OPTIONAL, the enum expands correctly, and references to ObReqCheckSumCheckLevel::OPTIONAL resolve normally.
  • Linked library correction: The removed zstd_objs.lib and lz4-all.lib entries in CMakeLists.txt have been confirmed to be covered by zstd_1_3_8_objs.lib; no additional linking is required.
  • Note: proto file generation (protoc.exe) cannot be executed due to CI sandbox restrictions. This is an existing environment issue and was not introduced by this change.

Upgrade Compatibility

Other Information

DIMA: 2026061800116825248

Release Note

ep-12221 added 5 commits June 18, 2026 11:11
…cro (SAL annotation). This caused the OPTIONAL enum value in the `enum class ObReqCheckSumCheckLevel` within ob_req_packet_code.h to be expanded to nothing by the preprocessor, resulting in a syntax error (expected identifier). Additionally, CMakeLists.txt had duplicate links to zstd_objs.lib and lz4-all.lib.

Fix: Added `#ifdef`/`#undef OPTIONAL` before the enum definition to resolve the macro conflict. Removed the duplicate library references in CMakeLists.txt (which were already covered by zstd_1_3_8_objs.lib).

Impact: Affects only Windows platform compilation; no impact on Linux/macOS.
DIMA: 2026061800116825248
The zstd target was replaced by zstd_1_3_8; the stale link reference
broke clean builds (ninja: missing and no known rule to make it).
Existing dirty build dirs masked the issue via a leftover .lib file.

Co-Authored-By: Claude Opus 4.6 <[REDACTED_EMAIL]>
@ep-12221

Copy link
Copy Markdown
Contributor Author

The mapping Dima issue is [[windows] Windows compilation failure]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants