clc: silence a warn_unused_result
Ignoring asprintf() return value leads to the following compiler warning: src/compiler/clc/liblibmesaclc.a.p/clc.c.o -MF src/compiler/clc/liblibmesaclc.a.p/clc.c.o.d -o src/compiler/clc/liblibmesaclc.a.p/clc.c.o -c ../src/compiler/clc/clc.c In file included from ../src/compiler/clc/clc.c:28: ../src/compiler/clc/clc.c: In function ‘clc_libclc_new’: ../src/compiler/clc/clc_helpers.h:99:7: warning: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 99 | asprintf(&_msg, fmt, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/compiler/clc/clc_helpers.h:105:37: note: in expansion of macro ‘clc_log’ 105 | #define clc_error(logger, fmt, ...) clc_log(logger, error, fmt, ##__VA_ARGS__) Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27140>
This commit is contained in:

committed by
Marge Bot

parent
338636a4ab
commit
f7e407213b
@@ -96,7 +96,8 @@ clc_free_spirv_binary(struct clc_binary *spvbin);
|
||||
#define clc_log(logger, level, fmt, ...) do { \
|
||||
if (!logger || !logger->level) break; \
|
||||
char *_msg = NULL; \
|
||||
asprintf(&_msg, fmt, ##__VA_ARGS__); \
|
||||
int r = asprintf(&_msg, fmt, ##__VA_ARGS__); \
|
||||
if (r < 0) break; \
|
||||
assert(_msg); \
|
||||
logger->level(logger->priv, _msg); \
|
||||
free(_msg); \
|
||||
|
Reference in New Issue
Block a user