]> git.eshelyaron.com Git - emacs.git/commitdiff
* src/bidi.c: Add comments to uses of INT_PROMOTE (bug#75964).
authorEli Zaretskii <eliz@gnu.org>
Tue, 11 Feb 2025 13:42:26 +0000 (15:42 +0200)
committerEshel Yaron <me@eshelyaron.com>
Wed, 12 Feb 2025 10:44:55 +0000 (11:44 +0100)
(cherry picked from commit 326593c88dfb98639f76a1b99c0b22958aae0e25)

src/bidi.c

index 773513143d659ea6e201574577cc3b9a9c373711..bad67fbb8a34be0e39c960551d12c517207122f8 100644 (file)
@@ -289,6 +289,8 @@ bidi_get_type (int ch, bidi_dir_t override)
   if (default_type == UNKNOWN_BT)
     emacs_abort ();
 
+  /* Promote default_type to int to allow not enumerating all the values
+     without compiler warnings.  */
   switch (INT_PROMOTE (default_type))
     {
       case WEAK_BN:
@@ -2010,7 +2012,7 @@ bidi_resolve_explicit (struct bidi_it *bidi_it)
         embedding level of the _following_ characters, so we must
         first look at the type of the previous character to support
         that.  */
-      switch (INT_PROMOTE (prev_type))
+      switch (INT_PROMOTE (prev_type)) /* promote to int to avoid warnings */
        {
        case RLI:       /* X5a */
          if (current_level < BIDI_MAXDEPTH
@@ -2074,7 +2076,7 @@ bidi_resolve_explicit (struct bidi_it *bidi_it)
 
   bidi_it->type_after_wn = UNKNOWN_BT;
 
-  switch (INT_PROMOTE (type))
+  switch (INT_PROMOTE (type)) /* promote to int to avoid warnings */
     {
     case RLE:  /* X2 */
     case RLO:  /* X4 */
@@ -2707,7 +2709,7 @@ bidi_find_bracket_pairs (struct bidi_it *bidi_it)
 
              /* Whenever we see a strong type, update the flags of
                 all the slots on the stack.  */
-             switch (INT_PROMOTE (bidi_it->type))
+             switch (INT_PROMOTE (bidi_it->type)) /* avoid warnings */
                {
                case STRONG_L:
                  flag = ((embedding_level & 1) == 0
@@ -2979,7 +2981,7 @@ bidi_resolve_brackets (struct bidi_it *bidi_it)
 
          if (prev_type_for_neutral == UNKNOWN_BT)
            prev_type_for_neutral = embedding_type;
-         switch (INT_PROMOTE (prev_type_for_neutral))
+         switch (INT_PROMOTE (prev_type_for_neutral)) /* avoid warnings */
            {
            case STRONG_R:
            case WEAK_EN:
@@ -3175,7 +3177,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it)
            }
          else
            {
-             switch (INT_PROMOTE (type))
+             switch (INT_PROMOTE (type)) /* promotion to int avoids warnings */
                {
                case STRONG_L:
                case STRONG_R: