Skip to contentSkip to conversation

lzma: fix compilation error under clang-10

PATCH In review Daniel Axtens 2 participants 2 messages Jul 20, 2020 – Oct 27, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lzma: fix compilation error under clang-10

Compiling under clang-10 gives:

grub-core/lib/LzmaEnc.c:1362:9: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]

        {
        ^
grub-core/lib/LzmaEnc.c:1358:7: note: previous statement is here
      if (repIndex == 0)
      ^

1 error generated.

It's not really that unclear in context: there's a commented-out if-statement. But tweak the alignment anyway so that clang is happy.

---

With this and Patrick's patch 'json: Remove invalid typedef redefinition', grub-emu compiles under clang-10.

---
 grub-core/lib/LzmaEnc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
grub-core/lib/LzmaEnc.c +2 -2
index f2ec04a8c281..edd92b772d34 100644
@@ -1359,7 +1359,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
         startLen = lenTest + 1;
 
       /* if (_maxMode) */
-        {
+      {
           UInt32 lenTest2 = lenTest + 1;
           UInt32 limit = lenTest2 + p->numFastBytes;
           UInt32 nextRepMatchPrice;
@@ -1403,7 +1403,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
               }
             }
           }
-        }
+      }
     }
     }
     /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Daniel Axtens

Compiling under clang-10 gives:

grub-core/lib/LzmaEnc.c:1362:9: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]

        {
        ^
grub-core/lib/LzmaEnc.c:1358:7: note: previous statement is here
      if (repIndex == 0)
      ^
Quoted 6 lines

1 error generated.

It's not really that unclear in context: there's a commented-out if-statement. But tweak the alignment anyway so that clang is happy.

Daniel