[PATCH] D33080: [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows
Eric Fiselier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 11 23:33:20 PDT 2017
EricWF added a comment.
In https://reviews.llvm.org/D33080#752202, @bcraig wrote:
> I like the warning that you generate for min and max macros existing.
Only on warn on platforms where we don't have `#pragma push_macro/pop_macro`.
> Is the push_macro / pop_macro the right way to go though? You could throw extra parenthesis around the declaration and usages of min/max to avoid macro expansion.
I noticed that the Windows STL headers have to do this dance with `new` (even though they do `(foo)(...)` for `min` and `max`). If we're going to need
to guard against a bunch of macros I would like to use a single approach. Other than updating the `#if defined(min) || defined(max)` lines it's trivial to guard
against additional macros.
Also there are a lot of call sites and declarations for `min` and `max`. I think this approach is less invasive and more consistent. We're obviously not going to
use `(foo)(...)` syntax everywhere, so lets use it nowhere.
https://reviews.llvm.org/D33080
More information about the cfe-commits
mailing list