VC2017 compilation

This commit is contained in:
Jief L 2020-02-21 12:44:15 +03:00
parent c6499afa83
commit 82aaf09e74
14 changed files with 36 additions and 18 deletions

View File

@ -682,7 +682,7 @@ DEFINE EXIT_USBKB_FLAG = -DEXIT_USBKB
DEFINE BUILD_OPTIONS=-DMDEPKG_NDEBUG -DCLOVER_BUILD $(VBIOS_PATCH_CLOVEREFI_FLAG) $(ONLY_SATA_0_FLAG) $(BLOCKIO_FLAG) $(NOUSB_FLAG) $(NOUDMA_FLAG) $(AMD_FLAG) $(SECURE_BOOT_FLAG) $(ANDX86_FLAG) $(LODEPNG_FLAG) $(PS2MOUSE_LEGACYBOOT_FLAG) $(DEBUG_ON_SERIAL_PORT_FLAG) $(EXIT_USBKB_FLAG)
#MSFT:*_*_*_CC_FLAGS = /FAcs /FR$(@R).SBR /wd4701 /wd4703 $(BUILD_OPTIONS)
MSFT:*_*_*_CC_FLAGS = /FAcs $(BUILD_OPTIONS) -Dinline=__inline
MSFT:*_*_*_CC_FLAGS = /FAcs $(BUILD_OPTIONS) -Dinline=__inline /Zi
XCODE:*_*_*_CC_FLAGS = -fno-unwind-tables -Wno-msvc-include -Os $(BUILD_OPTIONS) $(DISABLE_LTO_FLAG)
GCC:*_*_*_CC_FLAGS = $(BUILD_OPTIONS) $(DISABLE_LTO_FLAG)

View File

@ -1765,7 +1765,7 @@ typedef struct {
UINT16 TotalWidth;
UINT16 DataWidth;
UINT16 Size;
UINT8 FormFactor; ///< The enumeration value from MEMORY_FORM_FACTOR.
MEMORY_FORM_FACTOR FormFactor; ///< The enumeration value from MEMORY_FORM_FACTOR.
UINT8 DeviceSet;
SMBIOS_TABLE_STRING DeviceLocator;
SMBIOS_TABLE_STRING BankLocator;

View File

@ -371,7 +371,7 @@ GetBootOrder (
//
// Get gEfiGlobalVariableGuid:BootOrder and it's length
//
*BootOrder = (UINT16*)GetNvramVariable (BOOT_ORDER_VAR, &gEfiGlobalVariableGuid, NULL, &BootOrderSize);
*BootOrder = (__typeof_am__(*BootOrder))GetNvramVariable (BOOT_ORDER_VAR, &gEfiGlobalVariableGuid, NULL, &BootOrderSize);
if (*BootOrder == NULL) {
DBG(" EFI_NOT_FOUND\n");
return EFI_NOT_FOUND;

View File

@ -483,7 +483,6 @@ UINT8 darwin[] =
};
UINT8 ClassFix[] = { 0x00, 0x00, 0x03, 0x00 };
BOOLEAN CmpNum(UINT8 *dsdt, INT32 i, BOOLEAN Sure)
{

2
rEFIt_UEFI/Platform/gma.cpp Normal file → Executable file
View File

@ -81,7 +81,7 @@
CONST CHAR16 *CFLFBPath = L"/System/Library/Extensions/AppleIntelCFLGraphicsFramebuffer.kext";
extern CHAR8* gDeviceProperties;
extern CHAR8 ClassFix[];
CONST UINT8 ClassFix[] = { 0x00, 0x00, 0x03, 0x00 };
UINT8 common_vals[3][4] = {

1
rEFIt_UEFI/Platform/sound.cpp Normal file → Executable file
View File

@ -1,3 +1,4 @@
#include <Platform.h>
UINT8 EmbeddedSound[] = {
0x52, 0x49, 0x46, 0x46, 0x24, 0x64, 0x00, 0x00, 0x57, 0x41, 0x56, 0x45,
0x66, 0x6d, 0x74, 0x20, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00,

View File

@ -16,9 +16,9 @@
extern "C" {
#include <Library/MemoryAllocationLib.h>
#include <Library/BaseMemoryLib.h>
#include "Platform/Platform.h"
#include "refit/IO.h"
}
#include "Platform/Platform.h"
#include "refit/IO.h"
UINTN XStringWGrowByDefault = 1024;
//const XStringW NullXStringW;
@ -51,13 +51,13 @@ XStringW::XStringW(const XStringW &aString)
{
DBG("Constructor(const XStringW &aString) : %s\n", aString.data());
Init(aString.length());
XStringW::StrnCpy((const CHAR16*)aString.data(), aString.length());
StrnCpy(aString.data(), aString.length());
}
XStringW::XStringW(const wchar_t *S)
{
DBG("Constructor(const wchar_t *S) : %s, StrLen(S)=%d\n", S, StrLen(S));
Init(StrLen((const CHAR16*)S));
Init(StrLen(S));
if ( S ) StrCpy(S);
}
@ -65,7 +65,7 @@ XStringW::XStringW(const wchar_t *S, UINTN count)
{
DBG("Constructor(const wchar_t *S, UINTN count) : %s, %d\n", S, count);
Init(count);
XStringW::StrnCpy(S, count);
StrnCpy(S, count);
}
XStringW::XStringW(const wchar_t aChar)

View File

@ -15,7 +15,7 @@
extern "C" {
#include <stddef.h>
}
#include "globals_ctor.h"
#include <Platform/Platform.h>
@ -93,4 +93,10 @@ void construct_globals_objects() {
#elif defined(_MSC_VER)
void construct_globals_objects()
{
DBG("Work in progress\n");
}
#endif

11
rEFIt_UEFI/cpp_util/globals_dtor.cpp Normal file → Executable file
View File

@ -12,6 +12,9 @@
typedef void (destructor_func_t)();
#elif defined(__GNUC__)
typedef void (destructor_func_t)(void*);
#elif defined(_MSC_VER)
typedef void (__cdecl destructor_func_t)(void);
extern "C" int _fltused = 0; // it should be a single underscore since the double one is the mangled name
#else
# error compiler not supported
#endif
@ -46,8 +49,14 @@ extern "C" int __cxa_atexit(destructor_func_ptr_t destructor_func, void *objptr,
{
DBG("atexit(%p, %p, %p, %d)\n", destructor_func, objptr, dso, sizeof(atexit_func_entry_t));
#endif
#elif defined(_MSC_VER)
extern "C" int atexit(void(__cdecl *)(void));
extern "C" int atexit(void(__cdecl *destructor_func)(void))
{
DBG("atexit(%p, %p, %p, %d)\n", destructor_func, objptr, dso, sizeof(atexit_func_entry_t));
#endif
if ( !atexit_func_entry_array )
{
DBG("atexit : allocate\n");

2
rEFIt_UEFI/cpp_util/memory.cpp Normal file → Executable file
View File

@ -7,6 +7,7 @@ extern "C" {
* memset and memcpy has to be provided for clang
*/
#if !defined(_MSC_VER)
void* memset(void* dst, int ch, UINT64 count) __attribute__ ((used));
void* memcpy(void* dst, const void* src, UINT64 count) __attribute__ ((used));
@ -22,6 +23,7 @@ void* memcpy(void* dst, const void* src, UINT64 count)
CopyMem(dst, src, count);
return dst;
}
#endif
} // extern "C"

7
rEFIt_UEFI/cpp_util/operatorNewDelete.cpp Normal file → Executable file
View File

@ -6,8 +6,11 @@
#define DBG(...)
#endif
void* operator new ( unsigned long count )
#if defined(_MSC_VER)
void* operator new (size_t count)
#else
void* operator new (unsigned long count)
#endif
{
void* ptr = AllocatePool(count);
if ( !ptr ) {

View File

@ -319,4 +319,4 @@
XCODE:*_*_*_CC_FLAGS = -fsigned-char -O2 -fno-omit-frame-pointer -ffreestanding -fno-rtti -fno-exceptions -Wno-deprecated -Wno-writable-strings -Wno-unused-const-variable -DJCONST=const
GCC:*_*_*_CC_FLAGS = -std=c99 -Os -fno-omit-frame-pointer -maccumulate-outgoing-args
GCC:*_*_*_CXX_FLAGS = -std=c++11 -Os -fno-omit-frame-pointer -maccumulate-outgoing-args -ffreestanding -fno-rtti -fno-exceptions -Wno-deprecated -Wno-write-strings -Wno-unused-const-variable -Wno-pointer-arith -DJCONST=const
MSFT:*_*_*_CC_FLAGS = /Os /wd4201
MSFT:*_*_*_CC_FLAGS = /Os /wd4201 /D JCONST=const

View File

@ -1014,7 +1014,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
{
VOID *Instance;
if (!EFI_ERROR (gBS->HandleProtocol(Volume->DeviceHandle, &gEfiPartTypeSystemPartGuid, &Instance))) {
Volume->VolName = EfiStrDuplicate(L"EFI"); \
Volume->VolName = L"EFI"; \
}
}
if (!Volume->VolName) {

View File

@ -40,8 +40,6 @@
//#include "../Platform/Platform.h"
#include "../cpp_util/XStringW.h"
#include "../cpp_util/globals_ctor.h"
#include "../cpp_util/globals_dtor.h"
#include "Version.h"
//#include "colors.h"