Browse Source

Clang: Remove -fms-extensions -fms-compatibility

pull/280/head
Gleb Mazovetskiy 7 years ago committed by Anders Jenbo
parent
commit
2cc0c2cfbb
  1. 2
      CMakeLists.txt
  2. 8
      Source/engine.cpp
  3. 2
      Source/mpqapi.cpp
  4. 2
      Source/multi.cpp
  5. 10
      SourceS/miniwin.h
  6. 16
      SourceX/miniwin/misc.cpp

2
CMakeLists.txt

@ -301,8 +301,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(devilutionx PRIVATE -Wno-parentheses -Wno-logical-op-parentheses -Wno-bitwise-op-parentheses)
# Silence warnings about __int64 alignment hack not always being applicable
target_compile_options(devilutionx PRIVATE -Wno-ignored-attributes)
# Fix: error: cast from pointer to smaller type 'unsigned char' loses information
target_compile_options(devilution PRIVATE -fms-extensions -fms-compatibility -fms-compatibility-version=19.00)
# Silence appfat.cpp warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing")
endif()

8
Source/engine.cpp

@ -264,14 +264,14 @@ void CelDecDatLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nW
dst = pDecodeTo;
tbl = &pLightTbl[light_table_index * 256];
w = nWidth;
shift = (BYTE)dst & 1;
shift = (BYTE)(size_t)dst & 1;
for (; src != &pRLEBytes[nDataSize]; dst -= BUFFER_WIDTH + w, shift = (shift + 1) & 1) {
for (i = w; i;) {
width = *src++;
if (!(width & 0x80)) {
i -= width;
if (((BYTE)dst & 1) == shift) {
if (((BYTE)(size_t)dst & 1) == shift) {
if (!(width & 1)) {
goto L_ODD;
} else {
@ -733,7 +733,7 @@ void Cel2DecDatLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int n
dst = pDecodeTo;
tbl = &pLightTbl[light_table_index * 256];
w = nWidth;
shift = (BYTE)dst & 1;
shift = (BYTE)(size_t)dst & 1;
for (; src != &pRLEBytes[nDataSize]; dst -= BUFFER_WIDTH + w, shift = (shift + 1) & 1) {
for (i = w; i;) {
@ -741,7 +741,7 @@ void Cel2DecDatLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int n
if (!(width & 0x80)) {
i -= width;
if (dst < gpBufEnd) {
if (((BYTE)dst & 1) == shift) {
if (((BYTE)(size_t)dst & 1) == shift) {
if (!(width & 1)) {
goto L_ODD;
} else {

2
Source/mpqapi.cpp

@ -88,7 +88,7 @@ void mpqapi_xor_buf(char *pbData)
for (i = 0; i < 8; i++) {
*pbCurrentData ^= mask;
pbCurrentData++;
mask = _rotl(mask, 1);
mask = (mask << 1) | (mask >> 31); // _rotl(mask, 1)
}
}

2
Source/multi.cpp

@ -353,7 +353,7 @@ void multi_mon_seeds()
DWORD l;
sgdwGameLoops++;
l = _rotr(sgdwGameLoops, 8);
l = (sgdwGameLoops >> 8) | (sgdwGameLoops << 24); // _rotr(sgdwGameLoops, 8)
for (i = 0; i < 200; i++)
monster[i]._mAISeed = l + i;
}

10
SourceS/miniwin.h

@ -13,16 +13,6 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
// For _rotr()
// _rotl and _rotr are predeclared in Clang.
#if !defined(_MSC_VER) && !defined(__clang__) && defined(DEVILUTION_ENGINE)
#if defined(__x86_64__) || defined(__i386__)
#include <x86intrin.h>
#else
unsigned int _rotl(unsigned int value, int shift);
unsigned int _rotr(unsigned int value, int shift);
#endif
#endif
#ifndef _WIN32
#define __int8 char

16
SourceX/miniwin/misc.cpp

@ -11,22 +11,6 @@
#define strncasecmp _strnicmp
#endif
#if !defined(_MSC_VER) && !defined(__x86_64__) && !defined(__i386__)
unsigned int _rotl(unsigned int value, int shift)
{
if ((shift &= 31) == 0)
return value;
return (value << shift) | (value >> (32 - shift));
}
unsigned int _rotr(unsigned int value, int shift)
{
if ((shift &= 31) == 0)
return value;
return (value >> shift) | (value << (32 - shift));
}
#endif
namespace dvl {
DWORD last_error;

Loading…
Cancel
Save