[PATCH] Change base mutex implementations to use STL-provided mutexes

Zachary Turner zturner at google.com
Fri Jun 6 10:52:02 PDT 2014


On Fri, Jun 6, 2014 at 8:52 AM, Aaron Ballman <aaron.ballman at gmail.com>
wrote:

>
> > Index: include/llvm/Support/Mutex.h
> > ===================================================================
> > --- include/llvm/Support/Mutex.h
> > +++ include/llvm/Support/Mutex.h
> > @@ -17,138 +17,169 @@
> >  #include "llvm/Support/Compiler.h"
> >  #include "llvm/Support/Threading.h"
> >  #include <cassert>
> > +#include <mutex>
> > +#if defined(WIN32)
> > +#define NOMINMAX
> > +#include <Windows.h>
>
> Please include "llvm/Support/Windows/WindowsSupport.h" instead (which
> I believe removes the need for NOMINMAX). Also, please guard with
> defined(LLVM_ON_WIN32).



Ack, this breaks everything.  WindowsSupport.h is in
src\llvm\lib\Support\Windows.  In other words, it's not in the include
path.  It's usually only included from source files, in which case it's in
the same tree, so it works.  It this kind of "don't put platform specific
stuff in header files" a universal policy?  It seems to me like the
WindowsSupport.h (and correspondingly, the Unix support headers), should be
in the include directories so other headers can use them.  I'm guessing a
lot of the reason that these void* impls are needed is precisely because of
this restriction, and could be done away with in many cases if header files
had access to platform specific types, even if only through other header
files which typedefed platformed specific types to a set of common,
platform-independent types.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140606/e4c4a8c3/attachment.html>


More information about the llvm-commits mailing list