From e567e20f4dd0aa1fb0d98ca97a56321bc4fbb31e Mon Sep 17 00:00:00 2001 From: Nicholas Sielicki Date: Wed, 11 Sep 2024 17:41:21 -0700 Subject: [PATCH] fix(tracing/nvtx): silence -Wmissing-field-initializer warnings (#593) Signed-off-by: Nicholas Sielicki --- include/tracing_impl/nvtx.h | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/include/tracing_impl/nvtx.h b/include/tracing_impl/nvtx.h index 54f5d1779..aa63fa85b 100644 --- a/include/tracing_impl/nvtx.h +++ b/include/tracing_impl/nvtx.h @@ -12,26 +12,28 @@ static inline void nvtx_mark_domain(nvtxDomainHandle_t domain, const char* name, uint32_t color) { - const nvtxEventAttributes_t eventAttrib = { - .version = NVTX_VERSION, - .size = NVTX_EVENT_ATTRIB_STRUCT_SIZE, - .colorType = NVTX_COLOR_ARGB, - .color = color, - .messageType = NVTX_MESSAGE_TYPE_ASCII, - .message = { .ascii = name }, - }; + nvtxEventAttributes_t eventAttrib = {}; + + eventAttrib.version = NVTX_VERSION; + eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; + eventAttrib.colorType = NVTX_COLOR_ARGB; + eventAttrib.color = color; + eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; + eventAttrib.message.ascii = name; + nvtxDomainMarkEx(domain, &eventAttrib); } static inline nvtxRangeId_t nvtx_start_domain(bool have_domain, nvtxDomainHandle_t domain, const char* name, uint32_t color) { - const nvtxEventAttributes_t eventAttrib = { - .version = NVTX_VERSION, - .size = NVTX_EVENT_ATTRIB_STRUCT_SIZE, - .colorType = NVTX_COLOR_ARGB, - .color = color, - .messageType = NVTX_MESSAGE_TYPE_ASCII, - .message = { .ascii = name }, - }; + nvtxEventAttributes_t eventAttrib = {}; + + eventAttrib.version = NVTX_VERSION; + eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; + eventAttrib.colorType = NVTX_COLOR_ARGB; + eventAttrib.color = color; + eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; + eventAttrib.message.ascii = name; + if (have_domain) return nvtxDomainRangeStartEx(domain, &eventAttrib); else