Add g++/clang warnings to match some enabled by /W4 in MSVC.
This commit is contained in:
parent
83768cb541
commit
6d478956ac
@ -19,8 +19,14 @@ else(WIN32)
|
|||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
add_definitions(-Wall -Wmaybe-uninitialized -Wuninitialized -Wunused -Wunused-local-typedefs
|
||||||
|
-Wunused-parameter -Wunused-value -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable)
|
||||||
|
add_definitions(-Wno-reorder) # disable this from -Wall, since it happens all over.
|
||||||
add_definitions(-std=c++11)
|
add_definitions(-std=c++11)
|
||||||
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
||||||
|
add_definitions(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs
|
||||||
|
-Wunused-parameter -Wunused-value -Wunused-variable)
|
||||||
|
add_definitions(-Wno-reorder) # disable this from -Wall, since it happens all over.
|
||||||
add_definitions(-std=c++11)
|
add_definitions(-std=c++11)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -197,19 +197,24 @@ template <class T> T Max(const T a, const T b) { return a > b ? a : b; }
|
|||||||
//
|
//
|
||||||
// Create a TString object from an integer.
|
// Create a TString object from an integer.
|
||||||
//
|
//
|
||||||
|
#if defined _MSC_VER || defined MINGW_HAS_SECURE_API
|
||||||
inline const TString String(const int i, const int base = 10)
|
inline const TString String(const int i, const int base = 10)
|
||||||
{
|
{
|
||||||
char text[16]; // 32 bit ints are at most 10 digits in base 10
|
char text[16]; // 32 bit ints are at most 10 digits in base 10
|
||||||
|
|
||||||
#if defined _MSC_VER || defined MINGW_HAS_SECURE_API
|
|
||||||
_itoa_s(i, text, sizeof(text), base);
|
_itoa_s(i, text, sizeof(text), base);
|
||||||
#else
|
return text;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
inline const TString String(const int i, const int /*base*/ = 10)
|
||||||
|
{
|
||||||
|
char text[16]; // 32 bit ints are at most 10 digits in base 10
|
||||||
|
|
||||||
// we assume base 10 for all cases
|
// we assume base 10 for all cases
|
||||||
snprintf(text, sizeof(text), "%d", i);
|
snprintf(text, sizeof(text), "%d", i);
|
||||||
#endif
|
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct TSourceLoc {
|
struct TSourceLoc {
|
||||||
void init() { name = nullptr; string = 0; line = 0; column = 0; }
|
void init() { name = nullptr; string = 0; line = 0; column = 0; }
|
||||||
|
@ -170,16 +170,16 @@ void InitGlobalLock() { }
|
|||||||
void GetGlobalLock() { }
|
void GetGlobalLock() { }
|
||||||
void ReleaseGlobalLock() { }
|
void ReleaseGlobalLock() { }
|
||||||
|
|
||||||
void* OS_CreateThread(TThreadEntrypoint entry)
|
void* OS_CreateThread(TThreadEntrypoint /*entry*/)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OS_WaitForAllThreads(void* threads, int numThreads)
|
void OS_WaitForAllThreads(void* /*threads*/, int /*numThreads*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void OS_Sleep(int milliseconds)
|
void OS_Sleep(int /*milliseconds*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,14 +69,14 @@ const char* BaseTypeName(const char argOrder, const char* scalarName, const char
|
|||||||
|
|
||||||
bool IsTextureType(const char argOrder) { return argOrder == '%' || argOrder == '@'; }
|
bool IsTextureType(const char argOrder) { return argOrder == '%' || argOrder == '@'; }
|
||||||
bool IsTextureArrayed(const char argOrder) { return argOrder == '@'; }
|
bool IsTextureArrayed(const char argOrder) { return argOrder == '@'; }
|
||||||
bool IsTextureMS(const char /*argOrder*/) { return false; } // TODO: ...
|
// bool IsTextureMS(const char /*argOrder*/) { return false; } // TODO: ...
|
||||||
|
|
||||||
// Reject certain combinations that are illegal sample methods. For example,
|
// Reject certain combinations that are illegal sample methods. For example,
|
||||||
// 3D arrays.
|
// 3D arrays.
|
||||||
bool IsIllegalSample(const glslang::TString& name, const char* argOrder, int dim0)
|
bool IsIllegalSample(const glslang::TString& name, const char* argOrder, int dim0)
|
||||||
{
|
{
|
||||||
const bool isArrayed = IsTextureArrayed(*argOrder);
|
const bool isArrayed = IsTextureArrayed(*argOrder);
|
||||||
const bool isMS = IsTextureMS(*argOrder);
|
// const bool isMS = IsTextureMS(*argOrder);
|
||||||
|
|
||||||
// there are no 3D arrayed textures, or 3D SampleCmp(LevelZero)
|
// there are no 3D arrayed textures, or 3D SampleCmp(LevelZero)
|
||||||
if (dim0 == 3 && (isArrayed || name == "SampleCmp" || name == "SampleCmpLevelZero"))
|
if (dim0 == 3 && (isArrayed || name == "SampleCmp" || name == "SampleCmpLevelZero"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user