[Lldb-commits] [PATCH] Use SIZE_MAX instead of SIZE_T_MAX for portability.

Stephen Wilson wilsons at start.ca
Wed Feb 16 16:06:16 PST 2011


Chris Lattner <clattner at apple.com> writes:
> On Feb 15, 2011, at 8:05 PM, Stephen Wilson wrote:
>
>>
>> diff --git a/include/lldb/Core/ArchSpec.h b/include/lldb/Core/ArchSpec.h
>> index 198722c..3bb14ac 100644
>> --- a/include/lldb/Core/ArchSpec.h
>> +++ b/include/lldb/Core/ArchSpec.h
>> @@ -12,6 +12,8 @@
>>
>> #if defined(__cplusplus)
>>
>> +#include <stdint.h>
>
> stdint.h isn't portable.  Please use llvm/Support/DataTypes.h.  Alternatively you can just use something like "~(size_t)0".

We do have a bit of work to do if we want to purge non-portable use of
stdint.h and similar headers in lldb, but I totally agree we should not
make it any worse.

Since llvm/Support/DataTypes.h does not portably vend SIZE_MAX I simply
replaced our use with ~(size_t)0 for now.  Fixed in r125695.


Thanks!

>
> -Chris
>
>> +
>> #include "lldb/lldb-private.h"
>> #include "llvm/ADT/Triple.h"
>>
>> @@ -348,10 +350,10 @@ protected:
>> private:
>>
>>     void
>> -    MachOArchUpdated (size_t macho_idx = SIZE_T_MAX);
>> +    MachOArchUpdated (size_t macho_idx = SIZE_MAX);
>>
>>     void
>> -    ELFArchUpdated (size_t idx = SIZE_T_MAX);
>> +    ELFArchUpdated (size_t idx = SIZE_MAX);
>> };
>>
>>
>>
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>



--
steve



More information about the lldb-commits mailing list