From 59b4c623c93c506a8ea3de39f7d3b51ccc52bef1 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 13 Jul 2020 10:53:19 +1000 Subject: [PATCH] nouveau: avoid LTO ODR warning (v2) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ../src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp:69:8: warning: type ‘struct opProperties’ violates the C++ One Definition Rule [-Wodr] 69 | struct opProperties | ^ ../src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp:88:8: note: a different type is defined in another translation unit 88 | struct opProperties | ^ ../src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp:77:17: note: the first difference of corresponding definitions is field ‘fShared’ 77 | unsigned int fShared : 3; | ^ ../src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp:96:17: note: a field with different name is defined in another translation unit 96 | unsigned int fImmd : 4; // last bit indicates if full immediate is suppoted nvc0 code also has the same thing. v2: rename both paths (Karol) Reviewed-by: Karol Herbst Part-of: --- .../drivers/nouveau/codegen/nv50_ir_target_nv50.cpp | 6 +++--- .../drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp | 12 ++++++------ .../drivers/nouveau/codegen/nv50_ir_target_nvc0.h | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp index ec94590a3f8..0f041bac3c8 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp @@ -66,7 +66,7 @@ TargetNV50::getBuiltinOffset(int builtin) const return 0; } -struct opProperties +struct nv50_opProperties { operation op; unsigned int mNeg : 4; @@ -79,7 +79,7 @@ struct opProperties unsigned int fImm : 3; }; -static const struct opProperties _initProps[] = +static const struct nv50_opProperties _initProps[] = { // neg abs not sat c[] s[], a[], imm { OP_ADD, 0x3, 0x0, 0x0, 0x8, 0x2, 0x1, 0x1, 0x2 }, @@ -172,7 +172,7 @@ void TargetNV50::initOpInfo() opInfo[noPredList[i]].predicate = 0; for (i = 0; i < ARRAY_SIZE(_initProps); ++i) { - const struct opProperties *prop = &_initProps[i]; + const struct nv50_opProperties *prop = &_initProps[i]; for (int s = 0; s < 3; ++s) { if (prop->mNeg & (1 << s)) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp index ed5b343ccba..727801b9d4b 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp @@ -85,7 +85,7 @@ TargetNVC0::getBuiltinOffset(int builtin) const } } -struct opProperties +struct nvc0_opProperties { operation op; unsigned int mNeg : 4; @@ -96,7 +96,7 @@ struct opProperties unsigned int fImmd : 4; // last bit indicates if full immediate is suppoted }; -static const struct opProperties _initProps[] = +static const struct nvc0_opProperties _initProps[] = { // neg abs not sat c[] imm { OP_ADD, 0x3, 0x3, 0x0, 0x8, 0x2, 0x2 | 0x8 }, @@ -146,7 +146,7 @@ static const struct opProperties _initProps[] = { OP_PINTERP, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0 }, }; -static const struct opProperties _initPropsNVE4[] = { +static const struct nvc0_opProperties _initPropsNVE4[] = { { OP_SULDB, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0 }, { OP_SUSTB, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0 }, { OP_SUSTP, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0 }, @@ -155,7 +155,7 @@ static const struct opProperties _initPropsNVE4[] = { { OP_SUEAU, 0x0, 0x0, 0x0, 0x0, 0x6, 0x2 } }; -static const struct opProperties _initPropsGM107[] = { +static const struct nvc0_opProperties _initPropsGM107[] = { { OP_SULDB, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2 }, { OP_SULDP, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2 }, { OP_SUSTB, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4 }, @@ -165,10 +165,10 @@ static const struct opProperties _initPropsGM107[] = { { OP_XMAD, 0x0, 0x0, 0x0, 0x0, 0x6, 0x2 }, }; -void TargetNVC0::initProps(const struct opProperties *props, int size) +void TargetNVC0::initProps(const struct nvc0_opProperties *props, int size) { for (int i = 0; i < size; ++i) { - const struct opProperties *prop = &props[i]; + const struct nvc0_opProperties *prop = &props[i]; for (int s = 0; s < 3; ++s) { if (prop->mNeg & (1 << s)) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.h b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.h index 2077207bb23..7808164f451 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.h +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.h @@ -31,14 +31,14 @@ namespace nv50_ir { #define NVC0_BUILTIN_COUNT 4 -struct opProperties; +struct nvc0_opProperties; class TargetNVC0 : public Target { public: TargetNVC0(unsigned int chipset); - void initProps(const struct opProperties *props, int size); + void initProps(const struct nvc0_opProperties *props, int size); virtual CodeEmitter *getCodeEmitter(Program::Type); -- 2.30.2