This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Tolerate presence of __deallocate macro
ClosedPublic

Authored by EricWF on Jan 6 2017, 5:21 PM.

Details

Summary

On Windows the identifier __deallocate is defined as a macro by one of the Windows system headers. Previously libc++ worked around this by #undef __deallocate and generating a warning. However this causes the WIN32 version of __threading_support to always generate a warning on Windows. This is not OK.

This patch renames all usages of __deallocate internally as to not conflict with the macro.

Diff Detail

Event Timeline

EricWF updated this revision to Diff 83472.Jan 6 2017, 5:21 PM
EricWF retitled this revision from to [libc++] Tolerate presence of __deallocate macro.
EricWF updated this object.
EricWF added a subscriber: cfe-commits.
smeenai edited edge metadata.Jan 6 2017, 5:25 PM

I'm guessing always defining _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS on Windows isn't considered an acceptable workaround either?

EricWF added a comment.Jan 6 2017, 5:45 PM

I'm guessing always defining _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS on Windows isn't considered an acceptable workaround either?

Not really, since that still breaks users of the __deallocate since we #undef it.

PS. I think Windows is the only platform where __deallocate is an issue, so defining _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS on Windows just makes the warnings dead code on all platforms.

compnerd accepted this revision.Jan 6 2017, 7:06 PM
compnerd edited edge metadata.

This is a really nice cleanup!

This revision is now accepted and ready to land.Jan 6 2017, 7:06 PM
EricWF closed this revision.Jan 6 2017, 7:12 PM
include/__sso_allocator