From 14e71f7eea7f98626d155e48a69ff4bb5410b0e2 Mon Sep 17 00:00:00 2001 From: correctmost <134317971+correctmost@users.noreply.github.com> Date: Thu, 4 Jun 2026 21:09:26 -0400 Subject: [PATCH] gtk.cfg: Remove extra semicolons from g_return* macros The extra semicolons caused unknownMacro errors when checking code like this: if (hadj) g_return_if_fail (GTK_IS_ADJUSTMENT (hadj)); else hadj = GTK_ADJUSTMENT (...) They were introduced in commit c0b530947, but they are not actually present in the upstream GLib macros. --- cfg/gtk.cfg | 8 ++++---- test/cfg/gtk.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/cfg/gtk.cfg b/cfg/gtk.cfg index 14cd032945e..71d0f3dee05 100644 --- a/cfg/gtk.cfg +++ b/cfg/gtk.cfg @@ -4,10 +4,10 @@ - - - - + + + + diff --git a/test/cfg/gtk.c b/test/cfg/gtk.c index cab41ffa1cd..4accf7b63ec 100644 --- a/test/cfg/gtk.c +++ b/test/cfg/gtk.c @@ -596,3 +596,43 @@ void gtk_widget_destroy_test() { // cppcheck-suppress mismatchAllocDealloc g_object_unref(widget); } + +void g_return_if_fail_test(const char *s) { + // cppcheck-suppress valueFlowBailout + g_return_if_fail(s); + + if (*s) + // cppcheck-suppress valueFlowBailout + g_return_if_fail(*s == 'a'); + else + g_info("Test the else branch can be parsed"); +} + +int g_return_val_if_fail_test(const char *s) { + // cppcheck-suppress valueFlowBailout + g_return_val_if_fail(s, 1); + + if (*s) + // cppcheck-suppress valueFlowBailout + g_return_val_if_fail(*s == 'a', 1); + else + g_info("Test the else branch can be parsed"); + + return 0; +} + +void g_return_if_reached_test(const char *s) { + if (s) + g_return_if_reached(); + else + g_info("Test the else branch can be parsed"); +} + +int g_return_val_if_reached_test(const char *s) { + if (s) + g_return_val_if_reached(1); + else + g_info("Test the else branch can be parsed"); + + return 0; +}