Skip to content

Fix building mimalloc with -Wundef compiler flag - #1507

Open
Victor Stinner (vstinner) wants to merge 3 commits into
microsoft:main3from
vstinner:wundef
Open

Victor Stinner (vstinner) wants to merge 3 commits into
microsoft:main3from
vstinner:wundef

Conversation

@vstinner

Copy link
Copy Markdown
  • Check some macros using #ifdef instead of #if.
  • Define undefined macros to 0.

These macros are only tested with "#if MACRO" instead of
"#ifdef MACRO".

* Move MI_DEBUG definition from types.h to decl.h since it's used by
  decl.h (and types.h includes decl.h).
* Replace "#ifdef MI_TRACK_ASAN" with "#if MI_TRACK_ASAN"
* Replace "#if defined(MI_TRACK_ASAN)" with "#if MI_TRACK_ASAN"
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@vstinner

Copy link
Copy Markdown
Author

With these commits, mimalloc built with -Wundef no longer emits compiler warnings:

mkdir -p out/release
cd out/release
cmake -E env CFLAGS="-Wundef" cmake ../.. 
make 2>&1|tee log

=> no warnings

@vstinner

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree [company="Red Hat"]

@vstinner

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Red Hat"

@vstinner

Copy link
Copy Markdown
Author

See #1506 (comment) for a longer description of this PR.

This branch has not been deployed

No deployments
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.

1 participant