Cleanup: Fix one-definition-rule violations for various structs
This fixes most "One Definition Rule" violations inside blender proper resulting from duplicate structures of the same name. The fixes were made similar to that of !135491. See also #120444 for how this has come up in the past. These were found by using the following compile options: -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing Note: There are still various ODR issues remaining that require more / different fixes than what was done here. Pull Request: https://projects.blender.org/blender/blender/pulls/136371
This commit is contained in:
committed by
Jesse Yurkovich
parent
6935ec2fa7
commit
f60c528c48
@@ -107,6 +107,8 @@ typedef struct localListBase {
|
||||
void *first, *last;
|
||||
} localListBase;
|
||||
|
||||
namespace {
|
||||
|
||||
/* NOTE(@hos): keep this struct aligned (e.g., IRIX/GCC). */
|
||||
typedef struct MemHead {
|
||||
int tag1;
|
||||
@@ -137,6 +139,8 @@ static_assert(MEM_MIN_CPP_ALIGNMENT <= sizeof(MemHead), "Bad size of MemHead");
|
||||
|
||||
typedef MemHead MemHeadAligned;
|
||||
|
||||
} // namespace
|
||||
|
||||
/* #MemHead::flag. */
|
||||
enum MemHeadFlag {
|
||||
/**
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
|
||||
using namespace mem_guarded::internal;
|
||||
|
||||
namespace {
|
||||
|
||||
typedef struct MemHead {
|
||||
/* Length of allocated memory block. */
|
||||
size_t len;
|
||||
@@ -45,6 +47,8 @@ typedef struct MemHeadAligned {
|
||||
static_assert(MEM_MIN_CPP_ALIGNMENT <= alignof(MemHeadAligned), "Bad alignment of MemHeadAligned");
|
||||
static_assert(MEM_MIN_CPP_ALIGNMENT <= sizeof(MemHeadAligned), "Bad size of MemHeadAligned");
|
||||
|
||||
} // namespace
|
||||
|
||||
static bool malloc_debug_memset = false;
|
||||
|
||||
static void (*error_callback)(const char *) = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user