Fix validator xcode 12.5 compilation problem.

This commit is contained in:
jief666 2021-05-06 10:55:11 +03:00
parent 54bddb2fa9
commit 243f6d7b36
8 changed files with 35 additions and 39 deletions

View File

@ -565,7 +565,7 @@ extern uint32_t getUptimeInMilliseconds(void);
#include <mach/mach_time.h>
#include <time.h>
uint32_t getUptimeInMilliseconds()
uint32_t getUptimeInMilliseconds(void)
{
static mach_timebase_info_data_t s_timebase_info;

View File

@ -126,7 +126,7 @@
9A8792EA261886F5000B9362 /* abort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = abort.h; sourceTree = "<group>"; };
9A8792EC261886F5000B9362 /* printlib-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printlib-test-cpp_conf.h"; sourceTree = "<group>"; };
9A8792ED261886F5000B9362 /* printf_lite-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printf_lite-test-cpp_conf.h"; sourceTree = "<group>"; };
9A8792EE261886F5000B9362 /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = "<group>"; };
9A8792EE261886F5000B9362 /* Platform.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = Platform.h; sourceTree = "<group>"; };
9A8792EF261886F5000B9362 /* XToolsConf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XToolsConf.h; sourceTree = "<group>"; };
9A8792F0261886F5000B9362 /* BootLog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BootLog.cpp; sourceTree = "<group>"; };
9A8792F1261886F5000B9362 /* BasicIO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BasicIO.cpp; sourceTree = "<group>"; };
@ -715,7 +715,7 @@
9A9223252402FD1000483CBA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1120;
LastUpgradeCheck = 1250;
ORGANIZATIONNAME = Jief_Machak;
TargetAttributes = {
9A92232C2402FD1000483CBA = {
@ -847,7 +847,6 @@
"wcsncmp=wcsncmp_fixed",
"wcsstr=wcsstr_fixed",
NO_DEBUG_TRACE,
_UINTPTR_T,
);
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
@ -893,7 +892,7 @@
);
INCLUDED_SOURCE_FILE_NAMES = "";
LLVM_LTO = NO;
MACOSX_DEPLOYMENT_TARGET = 10.7;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
@ -976,7 +975,6 @@
"wcsncmp=wcsncmp_fixed",
"wcsstr=wcsstr_fixed",
NO_DEBUG_TRACE,
_UINTPTR_T,
);
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
@ -1022,7 +1020,7 @@
);
INCLUDED_SOURCE_FILE_NAMES = "";
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
OTHER_CFLAGS = (

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1120"
LastUpgradeVersion = "1250"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1120"
LastUpgradeVersion = "1250"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -57,10 +57,6 @@
9A3D2C58261855D000F0D7A1 /* BootLog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D2C4B261855D000F0D7A1 /* BootLog.cpp */; };
9A3D2C59261855D000F0D7A1 /* BootLog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D2C4B261855D000F0D7A1 /* BootLog.cpp */; };
9A3D2C5A261855D000F0D7A1 /* BootLog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D2C4B261855D000F0D7A1 /* BootLog.cpp */; };
9A3D2C5B261855D000F0D7A1 /* posix_additions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D2C4D261855D000F0D7A1 /* posix_additions.cpp */; };
9A3D2C5C261855D000F0D7A1 /* posix_additions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D2C4D261855D000F0D7A1 /* posix_additions.cpp */; };
9A3D2C5D261855D000F0D7A1 /* posix_additions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D2C4D261855D000F0D7A1 /* posix_additions.cpp */; };
9A3D2C5E261855D000F0D7A1 /* posix_additions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D2C4D261855D000F0D7A1 /* posix_additions.cpp */; };
9A3D2C5F261855D000F0D7A1 /* abort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D2C4E261855D000F0D7A1 /* abort.cpp */; };
9A3D2C60261855D000F0D7A1 /* abort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D2C4E261855D000F0D7A1 /* abort.cpp */; };
9A3D2C61261855D000F0D7A1 /* abort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D2C4E261855D000F0D7A1 /* abort.cpp */; };
@ -346,10 +342,8 @@
9A2755432639CE540095D456 /* platformdata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = platformdata.h; sourceTree = "<group>"; };
9A2A7C8624576CCE00422263 /* cpp_tests UTF32 c++17 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "cpp_tests UTF32 c++17"; sourceTree = BUILT_PRODUCTS_DIR; };
9A3D2C4B261855D000F0D7A1 /* BootLog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BootLog.cpp; sourceTree = "<group>"; };
9A3D2C4D261855D000F0D7A1 /* posix_additions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = posix_additions.cpp; sourceTree = "<group>"; };
9A3D2C4E261855D000F0D7A1 /* abort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = abort.cpp; sourceTree = "<group>"; };
9A3D2C4F261855D000F0D7A1 /* posix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = posix.h; sourceTree = "<group>"; };
9A3D2C50261855D000F0D7A1 /* posix_additions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = posix_additions.h; sourceTree = "<group>"; };
9A3D2C51261855D000F0D7A1 /* abort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = abort.h; sourceTree = "<group>"; };
9A3D2C52261855D000F0D7A1 /* BasicIO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BasicIO.cpp; sourceTree = "<group>"; };
9A3D2C54261855D000F0D7A1 /* globals_dtor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = globals_dtor.h; sourceTree = "<group>"; };
@ -4739,8 +4733,6 @@
9A3D2C4E261855D000F0D7A1 /* abort.cpp */,
9A3D2C51261855D000F0D7A1 /* abort.h */,
9AB73A1C261DAD1D00EEBB9F /* clover_strlen.cpp */,
9A3D2C4D261855D000F0D7A1 /* posix_additions.cpp */,
9A3D2C50261855D000F0D7A1 /* posix_additions.h */,
9A3D2C4F261855D000F0D7A1 /* posix.h */,
);
path = posix;
@ -13396,7 +13388,6 @@
9A82FE2E26184688006F973B /* XBuffer_tests.cpp in Sources */,
9A82FE9626184688006F973B /* base64.cpp in Sources */,
9A3D2C64261855D000F0D7A1 /* BasicIO.cpp in Sources */,
9A3D2C5C261855D000F0D7A1 /* posix_additions.cpp in Sources */,
9A3D2C60261855D000F0D7A1 /* abort.cpp in Sources */,
9A0B08742403B08400E2B470 /* main.cpp in Sources */,
9A071C2D26196CA40007CC44 /* xml_lite-reapeatingdict-test.cpp in Sources */,
@ -13471,7 +13462,6 @@
9A82FE3026184688006F973B /* XBuffer_tests.cpp in Sources */,
9A82FE9826184688006F973B /* base64.cpp in Sources */,
9A3D2C66261855D000F0D7A1 /* BasicIO.cpp in Sources */,
9A3D2C5E261855D000F0D7A1 /* posix_additions.cpp in Sources */,
9A3D2C62261855D000F0D7A1 /* abort.cpp in Sources */,
9A2A7C7324576CCE00422263 /* main.cpp in Sources */,
9A071C2E26196CA40007CC44 /* xml_lite-reapeatingdict-test.cpp in Sources */,
@ -13546,7 +13536,6 @@
9A82FE2F26184688006F973B /* XBuffer_tests.cpp in Sources */,
9A82FE9726184688006F973B /* base64.cpp in Sources */,
9A3D2C65261855D000F0D7A1 /* BasicIO.cpp in Sources */,
9A3D2C5D261855D000F0D7A1 /* posix_additions.cpp in Sources */,
9A3D2C61261855D000F0D7A1 /* abort.cpp in Sources */,
9A57C21B2418B9A00029A39F /* main.cpp in Sources */,
9A071C2C26196CA40007CC44 /* xml_lite-reapeatingdict-test.cpp in Sources */,
@ -13622,7 +13611,6 @@
9A8200A526184688006F973B /* unicode_conversions.cpp in Sources */,
9A82FE8D26184688006F973B /* TagFloat.cpp in Sources */,
9A82FE4D26184688006F973B /* strcmp_test.cpp in Sources */,
9A3D2C5B261855D000F0D7A1 /* posix_additions.cpp in Sources */,
9A82FE5126184688006F973B /* printlib-test.cpp in Sources */,
9A071C2B26196CA40007CC44 /* xml_lite-reapeatingdict-test.cpp in Sources */,
9A87876E26186302000B9362 /* MemoryAllocationLib.c in Sources */,
@ -13796,7 +13784,6 @@
UNIT_TESTS_MACOS,
"JCONST=const",
"___NOT___ENABLE_SECURE_BOOT",
_UINTPTR_T,
"sprintf=__sprintf_is_disabled__",
"wcscmp=__wcsncmp_is_disabled__",
);
@ -13913,7 +13900,14 @@
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREFIX_HEADER = "";
GCC_PREPROCESSOR_DEFINITIONS = UNIT_TESTS;
GCC_PREPROCESSOR_DEFINITIONS = (
UNIT_TESTS,
UNIT_TESTS_MACOS,
"JCONST=const",
"___NOT___ENABLE_SECURE_BOOT",
"sprintf=__sprintf_is_disabled__",
"wcscmp=__wcsncmp_is_disabled__",
);
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;

View File

@ -242,7 +242,8 @@ EFI_STATUS ParseXML(const CHAR8* buffer, TagDict** dict, size_t bufSize)
return EFI_INVALID_PARAMETER;
}
configBuffer = (__typeof__(configBuffer))AllocateZeroPool(bufferSize+1);
configBuffer = (__typeof__(configBuffer))malloc(bufferSize+1);
memset(configBuffer, 0, bufferSize+1);
if(configBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@ -858,7 +859,7 @@ GetPropertyAsInteger(
UINTN Size = Prop->getData()->dataLenValue();
if (Size > 8) Size = 8;
INTN Data = 0;
CopyMem(&Data, Prop->getData()->dataValue(), Size);
memcpy(&Data, Prop->getData()->dataValue(), Size);
return Data;
}
return Default;

View File

@ -9,12 +9,21 @@
#ifndef Platform_h_h
#define Platform_h_h
#ifndef _UINTPTR_T
#define _UINTPTR_T // to prevent macOS/Clang definition of uintptr_t (map to a long). We prefer long long so we can use %llu on all platform (including microsoft)
#endif
#ifndef _PTRDIFF_T_DECLARED
#define _PTRDIFF_T_DECLARED // to prevent macOS/GCC definition of uintptr_t (map to a long). We prefer long long so we can use %llu on all platform (including microsoft)
#endif
// Replacing uintptr_t with unsigned long long doesn't work anymore with stdlic++ with xcode 12.5 (or probably some before)
//
//#ifndef _UINTPTR_T
//#define _UINTPTR_T // to prevent macOS/Clang definition of uintptr_t (map to a long). We prefer long long so we can use %llu on all platform (including microsoft)
//#endif
//#ifndef _PTRDIFF_T_DECLARED
//#define _PTRDIFF_T_DECLARED // to prevent macOS/GCC definition of uintptr_t (map to a long). We prefer long long so we can use %llu on all platform (including microsoft)
//#endif
//
//// Replacement of uintptr_t to avoid warning in printf. It needs macro _UINTPTR_T to avoid to standard definition
//typedef unsigned long long uintptr_t;
//#undef PRIuPTR
//#define PRIuPTR "llu"
////#define _UINTPTR_T
#ifdef _MSC_VER
#include <Windows.h>
@ -32,14 +41,12 @@ extern "C" {
//#include <Library/BaseMemoryLib.h>
//#include <Library/MemoryAllocationLib.h>
#include "../../../../rEFIt_UEFI/Platform/BootLog.h"
//#include "BootLog.h"
#include <Library/DebugLib.h> // this is just to define DEBUG, because Slice wrongly did some #ifdef DEBUG
#ifdef __cplusplus
}
#endif
#include <stdio.h>
#include <limits.h>
#include <stdarg.h>
@ -59,12 +66,6 @@ extern "C" {
//typedef uint8_t bool;
//#endif
// Replacement of uintptr_t to avoid warning in printf. It needs macro _UINTPTR_T to avoid to standard definition
typedef unsigned long long uintptr_t;
#undef PRIuPTR
#define PRIuPTR "llu"
//#define _UINTPTR_T
#include "./posix/abort.h"
#include "../../../rEFIt_UEFI/cpp_foundation/unicode_conversions.h"

View File

@ -39,11 +39,13 @@ void log_technical_bug(const char* format, ...) __attribute__((__format__(__prin
#endif
#ifndef assert
#ifdef _MSC_VER
# define assert(expr) _assert(expr, "Expression \"%s\" failed in %s", #expr, __FUNCSIG__)
#else
# define assert(expr) _assert(expr, "Expression \"%s\" failed in %s", #expr, __PRETTY_FUNCTION__)
#endif
#endif
#define assertf(...) _assert(__VA_ARGS__)
void _assert(bool b, const char* format, ...) __attribute__((__format__(__printf__, 2, 3)));