[llvm] r290263 - Add missing includes on Windows.

Aaron Ballman via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 21 11:40:30 PST 2016


On Wed, Dec 21, 2016 at 2:18 PM, Zachary Turner <zturner at google.com> wrote:
> Adding more appropriate email address for Andrey.
>
> On Wed, Dec 21, 2016 at 11:17 AM Zachary Turner <zturner at google.com> wrote:
>>
>> I can't really reproduce Andrey's original problem (_byteswap_ushort
>> compiles for me just fine without this include), but if I change this to
>> <cstdlib> then I assume I have to change _byteswap_ushort to
>> std::_byteswap_ushort, and yet that fails.  So I'm not really sure

You shouldn't have to use std::_byteswap_ushort by including cstdlib;
it includes stdlib.h directly (without wrapping anything in namespace
std) and only introduces standard function names into namespace std.
However, it's purely a cosmetic request as the end results should be
identical.

~Aaron

>>
>>> > --- llvm/trunk/include/llvm/Support/SwapByteOrder.h (original)
>>> > +++ llvm/trunk/include/llvm/Support/SwapByteOrder.h Wed Dec 21 12:50:52
>>> > 2016
>>> > @@ -18,6 +18,9 @@
>>> >  #include "llvm/Support/Compiler.h"
>>> >  #include "llvm/Support/DataTypes.h"
>>> >  #include <cstddef>
>>> > +#if defined(_MSC_VER) && !defined(_DEBUG)
>>> > +#include <stdlib.h>
>>>
>>> <cstdlib> instead of <stdlib.h>?
>>>
>>> ~Aaron


More information about the llvm-commits mailing list