fix that the fallthrough attributes were not abstracted by the cx_attr macros default tip

Sat, 06 Sep 2025 11:57:17 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 06 Sep 2025 11:57:17 +0200
changeset 1364
556e4e7608b1
parent 1363
c9a86bd9e361

fix that the fallthrough attributes were not abstracted by the cx_attr macros

src/cx/common.h file | annotate | diff | comparison | revisions
src/hash_key.c file | annotate | diff | comparison | revisions
--- a/src/cx/common.h	Wed Sep 03 23:10:36 2025 +0200
+++ b/src/cx/common.h	Sat Sep 06 11:57:17 2025 +0200
@@ -131,6 +131,11 @@
 #endif
 
 /**
+ * Inform the compiler that falling through a switch case is intentional.
+ */
+#define cx_attr_fallthrough __attribute__((__fallthrough__))
+
+/**
  * All pointer arguments must be non-NULL.
  */
 #define cx_attr_nonnull __attribute__((__nonnull__))
--- a/src/hash_key.c	Wed Sep 03 23:10:36 2025 +0200
+++ b/src/hash_key.c	Sat Sep 06 11:57:17 2025 +0200
@@ -62,14 +62,14 @@
     switch (len) {
         case 3:
             h ^= (data[i + 2] & 0xFF) << 16;
-                    __attribute__((__fallthrough__));
+            cx_attr_fallthrough;
         case 2:
             h ^= (data[i + 1] & 0xFF) << 8;
-                    __attribute__((__fallthrough__));
+            cx_attr_fallthrough;
         case 1:
             h ^= (data[i + 0] & 0xFF);
             h *= m;
-                    __attribute__((__fallthrough__));
+            cx_attr_fallthrough;
         default: // do nothing
             ;
     }

mercurial