KWSys 2016-03-08 (6b60c184)

Code extracted from:

    http://public.kitware.com/KWSys.git

at commit 6b60c1843dbba9d4929496f9292cc78dab945c68 (master).

Upstream Shortlog
-----------------

Mariusz Pluciński (1):
      6b60c184 SystemInformation: Fix compilation on VS Clang/C2 toolset

Sean McBride (3):
      6ea22e65 Suppressed clang -Wcomma warnings with void cast
      8d9d489d Fixed clang-tidy warnings about macros missing defensive parens
      1c544330 Made private method static to silence warning
This commit is contained in:
KWSys Upstream 2016-03-08 09:25:26 -05:00 committed by Brad King
parent a132064b48
commit 4ba9b473a2
4 changed files with 14 additions and 13 deletions

8
MD5.c
View File

@ -254,7 +254,7 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */
#define F(x, y, z) (((x) & (y)) | (~(x) & (z))) #define F(x, y, z) (((x) & (y)) | (~(x) & (z)))
#define SET(a, b, c, d, k, s, Ti)\ #define SET(a, b, c, d, k, s, Ti)\
t = a + F(b,c,d) + X[k] + Ti;\ t = a + F(b,c,d) + X[k] + (Ti);\
a = ROTATE_LEFT(t, s) + b a = ROTATE_LEFT(t, s) + b
/* Do the following 16 operations. */ /* Do the following 16 operations. */
SET(a, b, c, d, 0, 7, T1); SET(a, b, c, d, 0, 7, T1);
@ -280,7 +280,7 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */
#define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) #define G(x, y, z) (((x) & (z)) | ((y) & ~(z)))
#define SET(a, b, c, d, k, s, Ti)\ #define SET(a, b, c, d, k, s, Ti)\
t = a + G(b,c,d) + X[k] + Ti;\ t = a + G(b,c,d) + X[k] + (Ti);\
a = ROTATE_LEFT(t, s) + b a = ROTATE_LEFT(t, s) + b
/* Do the following 16 operations. */ /* Do the following 16 operations. */
SET(a, b, c, d, 1, 5, T17); SET(a, b, c, d, 1, 5, T17);
@ -306,7 +306,7 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */
#define H(x, y, z) ((x) ^ (y) ^ (z)) #define H(x, y, z) ((x) ^ (y) ^ (z))
#define SET(a, b, c, d, k, s, Ti)\ #define SET(a, b, c, d, k, s, Ti)\
t = a + H(b,c,d) + X[k] + Ti;\ t = a + H(b,c,d) + X[k] + (Ti);\
a = ROTATE_LEFT(t, s) + b a = ROTATE_LEFT(t, s) + b
/* Do the following 16 operations. */ /* Do the following 16 operations. */
SET(a, b, c, d, 5, 4, T33); SET(a, b, c, d, 5, 4, T33);
@ -332,7 +332,7 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */
#define I(x, y, z) ((y) ^ ((x) | ~(z))) #define I(x, y, z) ((y) ^ ((x) | ~(z)))
#define SET(a, b, c, d, k, s, Ti)\ #define SET(a, b, c, d, k, s, Ti)\
t = a + I(b,c,d) + X[k] + Ti;\ t = a + I(b,c,d) + X[k] + (Ti);\
a = ROTATE_LEFT(t, s) + b a = ROTATE_LEFT(t, s) + b
/* Do the following 16 operations. */ /* Do the following 16 operations. */
SET(a, b, c, d, 0, 6, T49); SET(a, b, c, d, 0, 6, T49);

View File

@ -176,13 +176,13 @@ typedef struct rlimit ResourceLimitType;
# if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG) # if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG)
# define iostreamLongLong(x) (x) # define iostreamLongLong(x) (x)
# else # else
# define iostreamLongLong(x) ((long)x) # define iostreamLongLong(x) ((long)(x))
# endif # endif
#elif defined(KWSYS_USE___INT64) #elif defined(KWSYS_USE___INT64)
# if defined(KWSYS_IOS_HAS_OSTREAM___INT64) # if defined(KWSYS_IOS_HAS_OSTREAM___INT64)
# define iostreamLongLong(x) (x) # define iostreamLongLong(x) (x)
# else # else
# define iostreamLongLong(x) ((long)x) # define iostreamLongLong(x) ((long)(x))
# endif # endif
#else #else
# error "No Long Long" # error "No Long Long"
@ -200,13 +200,13 @@ typedef struct rlimit ResourceLimitType;
# endif # endif
#endif #endif
#if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(_WIN64) #if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(_WIN64) && !defined(__clang__)
#define USE_ASM_INSTRUCTIONS 1 #define USE_ASM_INSTRUCTIONS 1
#else #else
#define USE_ASM_INSTRUCTIONS 0 #define USE_ASM_INSTRUCTIONS 0
#endif #endif
#if defined(_MSC_VER) && (_MSC_VER >= 1400) #if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__clang__)
#include <intrin.h> #include <intrin.h>
#define USE_CPUID_INTRINSICS 1 #define USE_CPUID_INTRINSICS 1
#else #else
@ -860,7 +860,7 @@ void SystemInformation::RunMemoryCheck()
// -------------------------------------------------------------- // --------------------------------------------------------------
// SystemInformationImplementation starts here // SystemInformationImplementation starts here
#define STORE_TLBCACHE_INFO(x,y) x = (x < y) ? y : x #define STORE_TLBCACHE_INFO(x,y) x = (x < (y)) ? (y) : x
#define TLBCACHE_INFO_UNITS (15) #define TLBCACHE_INFO_UNITS (15)
#define CLASSICAL_CPU_FREQ_LOOP 10000000 #define CLASSICAL_CPU_FREQ_LOOP 10000000
#define RDTSC_INSTRUCTION _asm _emit 0x0f _asm _emit 0x31 #define RDTSC_INSTRUCTION _asm _emit 0x0f _asm _emit 0x31
@ -4632,7 +4632,7 @@ std::string SystemInformationImplementation::RunProcess(std::vector<const char*>
double timeout = 255; double timeout = 255;
int pipe; // pipe id as returned by kwsysProcess_WaitForData() int pipe; // pipe id as returned by kwsysProcess_WaitForData()
while( ( pipe = kwsysProcess_WaitForData(gp,&data,&length,&timeout), while( ( static_cast<void>(pipe = kwsysProcess_WaitForData(gp,&data,&length,&timeout)),
(pipe == kwsysProcess_Pipe_STDOUT || pipe == kwsysProcess_Pipe_STDERR) ) ) // wait for 1s (pipe == kwsysProcess_Pipe_STDOUT || pipe == kwsysProcess_Pipe_STDERR) ) ) // wait for 1s
{ {
buffer.append(data, length); buffer.append(data, length);

View File

@ -4758,8 +4758,9 @@ bool SystemTools::GetLineFromStream(std::istream& is,
// been reached. Clear the fail bit just before reading. // been reached. Clear the fail bit just before reading.
while(!haveNewline && while(!haveNewline &&
leftToRead != 0 && leftToRead != 0 &&
(is.clear(is.rdstate() & ~std::ios::failbit), (static_cast<void>(is.clear(is.rdstate() & ~std::ios::failbit)),
is.getline(buffer, bufferSize), is.gcount() > 0)) static_cast<void>(is.getline(buffer, bufferSize)),
is.gcount() > 0))
{ {
// We have read at least one byte. // We have read at least one byte.
haveData = true; haveData = true;

View File

@ -53,7 +53,7 @@ static std::string GetLibName(const char* lname)
* r2: should GetSymbolAddress succeed ? * r2: should GetSymbolAddress succeed ?
* r3: should CloseLibrary succeed ? * r3: should CloseLibrary succeed ?
*/ */
int TestDynamicLoader(const char* libname, const char* symbol, int r1, int r2, int r3) static int TestDynamicLoader(const char* libname, const char* symbol, int r1, int r2, int r3)
{ {
std::cerr << "Testing: " << libname << std::endl; std::cerr << "Testing: " << libname << std::endl;
kwsys::DynamicLoader::LibraryHandle l kwsys::DynamicLoader::LibraryHandle l