[libobjc] Wrap CLASS_TABLE_HASH in do {} while (0)
authorTom de Vries <tom@codesourcery.com>
Thu, 23 Nov 2017 15:03:29 +0000 (15:03 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Thu, 23 Nov 2017 15:03:29 +0000 (15:03 +0000)
2017-11-23  Tom de Vries  <tom@codesourcery.com>

* class.c (CLASS_TABLE_HASH): Wrap in "do {} while (0)".

From-SVN: r255099

libobjc/ChangeLog
libobjc/class.c

index 2f9361ffe454b0e0ebfdb101ce9569bfd2e73aa4..e1d32b6171a5e0db519ee07bfe988df4dadf08c3 100644 (file)
@@ -1,3 +1,7 @@
+2017-11-23  Tom de Vries  <tom@codesourcery.com>
+
+       * class.c (CLASS_TABLE_HASH): Wrap in "do {} while (0)".
+
 2017-11-17  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
 
        * Makefile.in: Regenerate.
index 53fb5fe8efb58edbd9d8384fb426ed39616d829a..7a8f832e89bb40e19bfdb24068ebb91c9bfd194b 100644 (file)
@@ -153,14 +153,16 @@ static objc_mutex_t __class_table_lock = NULL;
    string, and HASH the computed hash of the string; CLASS_NAME is
    untouched.  */
 
-#define CLASS_TABLE_HASH(INDEX, HASH, CLASS_NAME)          \
-  HASH = 0;                                                  \
-  for (INDEX = 0; CLASS_NAME[INDEX] != '\0'; INDEX++)        \
-    {                                                        \
-      HASH = (HASH << 4) ^ (HASH >> 28) ^ CLASS_NAME[INDEX]; \
-    }                                                        \
-                                                             \
-  HASH = (HASH ^ (HASH >> 10) ^ (HASH >> 20)) & CLASS_TABLE_MASK;
+#define CLASS_TABLE_HASH(INDEX, HASH, CLASS_NAME)                      \
+  do {                                                                 \
+    HASH = 0;                                                          \
+    for (INDEX = 0; CLASS_NAME[INDEX] != '\0'; INDEX++)                        \
+      {                                                                        \
+       HASH = (HASH << 4) ^ (HASH >> 28) ^ CLASS_NAME[INDEX];          \
+      }                                                                        \
+                                                                       \
+    HASH = (HASH ^ (HASH >> 10) ^ (HASH >> 20)) & CLASS_TABLE_MASK;    \
+  } while (0)
 
 /* Setup the table.  */
 static void