This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Undef min/max in test_macros.h
AbandonedPublic

Authored by EricWF on May 31 2017, 3:56 PM.

Details

Summary

After changing libc++ to push/pop the min/max macros on Windows we have a bunch of new test failures, caused by tests using min/max. I would like to use test_macros.h to undefine it.

Would this work for you? How have you been dealing with these failures?

Diff Detail

Event Timeline

EricWF created this revision.May 31 2017, 3:56 PM
STL_MSFT edited edge metadata.May 31 2017, 4:00 PM

I haven't seen min/max test failures, probably because our CRT/STL headers never drag in Windows.h.

I have no objection to undeffing min/max although I wouldn't do this myself (it creates order dependencies which I think are totally evil).

I haven't seen min/max test failures, probably because our CRT/STL headers never drag in Windows.h.

Ah, that makes sense. Libc++ currently does although the plan is to fix that eventually. :-S

I have no objection to undeffing min/max although I wouldn't do this myself (it creates order dependencies which I think are totally evil).

Yeah, the header order is super evil. Agreed.

CaseyCarter edited edge metadata.May 31 2017, 4:18 PM

I haven't seen min/max test failures, probably because our CRT/STL headers never drag in Windows.h.

Ah, that makes sense. Libc++ currently does although the plan is to fix that eventually. :-S

Are you aware that Windows.h won't define min and max if you define NOMINMAX before including it? You could solve the problem by adding -DNOMINMAX to your test compile parameters.

EricWF abandoned this revision.May 31 2017, 4:25 PM

I haven't seen min/max test failures, probably because our CRT/STL headers never drag in Windows.h.

Ah, that makes sense. Libc++ currently does although the plan is to fix that eventually. :-S

Are you aware that Windows.h won't define min and max if you define NOMINMAX before including it? You could solve the problem by adding -DNOMINMAX to your test compile parameters.

I want to avoid modifying how Windows.h is included in the libc++ headers, in case people actually depend on that macro.

However passing -DNOMINMAX as a test compiler parameter is a much better solution. Thanks!