[libcxx] r194870 - Windows.h is not required.

Yaron Keren yaron.keren at gmail.com
Fri Nov 15 15:40:37 PST 2013


It may be ok for the library (I did not check yet if ntdef.h or minwindef.h
are not included indirectly somehow) but will pose a possible problem for
the libcxx user:
if he  includes libcxx header followed by <windows.h> without NOMINMAX defined
he would get min and max defined and trouble.

So to be on the safe side, we would like to get NOMINMAX always defined.

What do you think about moving the code to  __config:

#ifdef _WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#endif

It will work if the library user includes libcxx before window.h.

In the reverse case we can't avoid getting min and max defined but
__undef_min_max will warn and undef them.

Yaron





2013/11/16 Marshall Clow <mclow.lists at gmail.com>

> On Nov 15, 2013, at 2:54 PM, Yaron Keren <yaron.keren at gmail.com> wrote:
>
> > Author: yrnkrn
> > Date: Fri Nov 15 16:54:15 2013
> > New Revision: 194870
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=194870&view=rev
> > Log:
> > Windows.h is not required.
> >
> > Modified:
> >    libcxx/trunk/include/support/win32/support.h
> >
> > Modified: libcxx/trunk/include/support/win32/support.h
> > URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/win32/support.h?rev=194870&r1=194869&r2=194870&view=diff
> >
> ==============================================================================
> > --- libcxx/trunk/include/support/win32/support.h (original)
> > +++ libcxx/trunk/include/support/win32/support.h Fri Nov 15 16:54:15 2013
> > @@ -23,7 +23,6 @@
> > #ifndef NOMINMAX
> > #define NOMINMAX
> > #endif
> > -#include <Windows.h>
> >
> > extern "C" {
>
> If <windows.h> is not required, is the whole "#ifndef NOMINMAX" stuff not
> required either?
>
>
> -- Marshall
>
> Marshall Clow     Idio Software   <mailto:mclow.lists at gmail.com>
>
> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is
> promptly moderated down to (-1, Flamebait).
>         -- Yu Suzuki
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131116/e24d1aa7/attachment.html>


More information about the cfe-commits mailing list