fix: guard HAVE_MAT_LIVEEVENTINSPECTOR/PRIVACYGUARD against redefinition#1473
Merged
bmehta001 merged 3 commits intoJun 10, 2026
Merged
Conversation
Under -Werror on Linux/macOS, the modules-repo CI (build-posix-latest-exp)
has been failing for ~2 weeks with:
config-default.h:36: error: 'HAVE_MAT_LIVEEVENTINSPECTOR' macro redefined
[-Werror,-Wmacro-redefined]
config-default.h:37: error: 'HAVE_MAT_PRIVACYGUARD' macro redefined
tests/functests/CMakeLists.txt and tests/unittests/CMakeLists.txt add
-DHAVE_MAT_LIVEEVENTINSPECTOR / -DHAVE_MAT_PRIVACYGUARD on the command
line when BUILD_LIVEEVENTINSPECTOR / BUILD_PRIVACYGUARD (default YES) and
the respective module dir exists. The three config-default headers then
redefined them unconditionally, which is fatal under -Werror (added by
microsoft#1415).
Wrapping the two defines in #ifndef in all three config-default*.h
headers preserves all existing behavior:
- Without command-line -D: macros get defined here as before.
- With command-line -D: header skips the redefinition, no warning.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
75910a5 to
7b43dd4
Compare
Contributor
Author
|
Force-pushed to extend the fix to all three |
baijumeswani
approved these changes
Jun 10, 2026
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.
The modules-repo (
cpp_client_telemetry_modules) CI workflowbuild-posix-latest-exphas been failing on Linux and macOS for ~2 weeks with:Root cause
When
BUILD_LIVEEVENTINSPECTOR/BUILD_PRIVACYGUARD(defaultYES) is on and the respective module dir exists,tests/functests/CMakeLists.txtandtests/unittests/CMakeLists.txtadd-DHAVE_MAT_LIVEEVENTINSPECTOR/-DHAVE_MAT_PRIVACYGUARDto the compile command. The threeconfig-default*.hheaders then#definethe same macros unconditionally. With-Werror(added by #1415), the-Wmacro-redefinedwarning becomes fatal on GCC/Clang.Other macros in the same block (
HAVE_MAT_JSONHPP,HAVE_MAT_ZLIB,HAVE_MAT_STORAGE, etc.) are not added by CMake-Dflags, so this only affects these two.Fix
Wrap the two
#defines in#ifndefguards in all threeconfig-default*.hheaders (config-default.h,config-default-cs4.h,config-default-exp.h). Pure-additive:-D: header defines them as before. Unchanged.-D: header skips the redefine, no warning.Verification
cpp_client_telemetry_modulesopen PRs (Android unit test #277, Upgrade to more modern Visual Studio 2019 and Win 10 SDK #345, Update CONTRIBUTING.md #349) are all blocked by this regression on Linux/macOS — even master itself is red.