From 5be91b6e509c288b4e1cda6e3e991cc915bbb271 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Wed, 25 Aug 2021 14:09:28 -0700 Subject: [PATCH] Fix stringification of libx52_led_state A missing comma at the end of the STRINGIFY line was causing builds with clang to have segfaults with the default configuration. It turned out that due to the missing comma, the N_("Unknown LED state %d") and N_("off") parameters were getting merged into a single parameter by clang, but interestingly, not by GCC. As a result, when building with clang, the array is "on", "red", "amber", "green" - note the missing "off" at the beginning of the array. This causes clang generated builds to segfault when attemping to log a trace message when configuring LED A (which defaults to green, and the index of LIBX52_LED_STATE_GREEN exceeds the array bounds). --- libx52/x52_stringify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libx52/x52_stringify.c b/libx52/x52_stringify.c index 3daad2c..fecdc46 100644 --- a/libx52/x52_stringify.c +++ b/libx52/x52_stringify.c @@ -43,7 +43,7 @@ STRINGIFY(date_format, LIBX52_DATE_FORMAT_YYMMDD, N_("Unknown date format %d"), N_("YY-MM-DD"), ) -STRINGIFY(led_state, LIBX52_LED_STATE_GREEN, N_("Unknown LED state %d") +STRINGIFY(led_state, LIBX52_LED_STATE_GREEN, N_("Unknown LED state %d"), N_("off"), N_("on"), N_("red"),