Real fix to XCode optimization bug.

This commit is contained in:
jief666 2021-04-16 12:55:51 +03:00
parent e7bb2bd3bd
commit 541762427a
6 changed files with 22 additions and 16 deletions

View File

@ -182,7 +182,7 @@ typedef union {
#define PRINTF_VA_ARG va_arg
#endif
#ifndef PRINTF_VA_END
#define PRINTF_VA_END VA_END
#define PRINTF_VA_END va_end
#endif
@ -268,7 +268,7 @@ typedef union {
void printf_with_callback_timestamp(const char* format, transmitBufCallBackType transmitBufCallBack, void* context, int* newline, int timestamp, ...);
inline void printf_with_callback(const char* format, transmitBufCallBackType transmitBufCallBack, void* context, ...) {
PRINTF_VA_LIST va;
va_start(va, context);
PRINTF_VA_START(va, context);
vprintf_with_callback_timestamp(format, va, transmitBufCallBack, context, NULL, 0);
PRINTF_VA_END(va);
}

View File

@ -2,10 +2,6 @@
Slice 2012
*/
#if defined(__clang__)
#pragma clang optimize off
#endif
#include <Platform.h>
#include "Settings.h"
#include "FixBiosDsdt.h"
@ -5065,9 +5061,8 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
// }
if ( arbProp == NULL ) {
arbProp = new SETTINGS_DATA::DevicesClass::ArbitraryPropertyClass();
DBG("new ArbitraryPropertyClass()=%lld\n", uintptr_t(arbProp));
arbProp->Label = Label;
arbProp->Device = (UINT32)DeviceAddr;
arbProp->Label = Label;
gSettings.Devices.ArbitraryArray.AddReference(arbProp, true);
}
arbProp->CustomPropertyArray.AddReference(newDevProp, true);

View File

@ -631,6 +631,8 @@ public:
MISC_SLOT_TYPE SlotType = MISC_SLOT_TYPE();
XString8 SlotName = XString8();
SLOT_DEVICE() {}
#if __cplusplus > 201703L
bool operator == (const SLOT_DEVICE&) const = default;
#endif
@ -1279,6 +1281,8 @@ public:
XString8 DevicePathAsString = XString8();
XString8 Label = XString8();
AddPropertyClass() {}
#if __cplusplus > 201703L
bool operator == (const AddPropertyClass&) const = default;
#endif
@ -1304,6 +1308,8 @@ public:
TAG_TYPE ValueType = kTagTypeNone; // only used in CreateMenuProps()
INPUT_ITEM MenuItem = INPUT_ITEM(); // Will get the Disabled value
SimplePropertyClass() {}
#if __cplusplus > 201703L
bool operator == (const SimplePropertyClass&) const = default;
#endif
@ -1330,6 +1336,8 @@ public:
// XString8 Label = XString8(); // Label is the same as DevicePathAsString, so it's not needed.
XObjArray<SimplePropertyClass> propertiesArray = XObjArray<SimplePropertyClass>();
PropertyClass() {}
EFI_DEVICE_PATH_PROTOCOL* getDevicePath() const
{
EFI_DEVICE_PATH_PROTOCOL* DevicePath;
@ -1376,6 +1384,7 @@ public:
XString8 Label = XString8();
XObjArray<SimplePropertyClass> CustomPropertyArray = XObjArray<SimplePropertyClass> ();
ArbitraryPropertyClass() {}
#if __cplusplus > 201703L
bool operator == (const ArbitraryPropertyClass&) const = default;
#endif

View File

@ -27,7 +27,9 @@ public:
XString8 SerialNo = XString8();
UINT8 Type = UINT8();
bool InUse = bool();
RAM_SLOT_INFO() {}
#if __cplusplus > 201703L
bool operator == (const RAM_SLOT_INFO&) const = default;
#endif

View File

@ -57,12 +57,12 @@ void construct_globals_objects(EFI_HANDLE ImageHandle)
{
ctor_ptr* currentCtor = (ctor_ptr*) (((UINTN) (LoadedImage->ImageBase)) + SectionHeader->PointerToRawData);
ctor_ptr* ctorend = (ctor_ptr*) (((UINTN) (LoadedImage->ImageBase)) + SectionHeader->PointerToRawData + SectionHeader->Misc.VirtualSize);
ctor_ptr* ctorEnd = (ctor_ptr*) (((UINTN) (LoadedImage->ImageBase)) + SectionHeader->PointerToRawData + SectionHeader->Misc.VirtualSize);
DBG("currentBegin %llX, ctorEnd %llX, %lld ctors to call\n", (UINTN)(currentCtor), (UINTN)(ctorEnd), (UINTN)(ctorEnd-currentCtor));
size_t i = 0;
while (currentCtor < ctorend)
while (currentCtor < ctorEnd)
{
DBG("&currentCtor[%zu] %llX %lld\n", i, (UINTN) (currentCtor), (UINTN) (currentCtor));
DBG("currentCtor[%zu] %llX %lld\n", i, (UINTN) (*currentCtor), (UINTN) (*currentCtor));
DBG("[%03zu] &ctor %08llX, will call %08llX\n", i, (UINTN)(currentCtor), (UINTN)(*currentCtor));
if (*currentCtor != NULL) (*currentCtor)();
currentCtor++;
i++;

View File

@ -9,7 +9,7 @@
#if defined(_MSC_VER)
void* operator new (size_t count)
#else
void* operator new (unsigned long count)
void* operator new(unsigned long count)
#endif
{
void* ptr = AllocatePool(count);
@ -21,9 +21,9 @@ void* operator new (unsigned long count)
}
#if defined(_MSC_VER)
void* operator new[] (size_t count)
void* operator new[](size_t count)
#else
void* operator new[] (unsigned long count)
void* operator new[](unsigned long count)
#endif
{
void* ptr = AllocatePool(count);