Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
erofs-utils: fix compilation error due to const static init
Browse files Browse the repository at this point in the history
gcc-7 and earlier versions fail to infer the initial value of a
const global variable from another const global variable.  Therefore,
compiling with gcc-7 and below will result in failure.  In fact, for
global const variables, using macros is a better choice.

Signed-off-by: Li Yiyan <lyy0627@sjtu.edu.cn>
Link: https://lore.kernel.org/r/20230725085020.904884-1-lyy0627@sjtu.edu.cn
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
  • Loading branch information
iyenli authored and hsiangkao committed Jul 25, 2023
1 parent c9a01ba commit 7c81cf4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/kite_deflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ unsigned long erofs_memcmp2(const u8 *s1, const u8 *s2,
#define kMatchMinLen 3
#define kMatchMaxLen32 kNumLenSymbols32 + kMatchMinLen - 1

#define kTableDirectLevels 16
#define kBitLensRepNumber_3_6 kTableDirectLevels
#define kBitLens0Number_3_10 (kBitLensRepNumber_3_6 + 1)
#define kBitLens0Number_11_138 (kBitLens0Number_3_10 + 1)

static u32 kstaticHuff_mainCodes[kFixedLenTableSize];
static const u8 kstaticHuff_litLenLevels[kFixedLenTableSize] = {
[0 ... 143] = 8, [144 ... 255] = 9,
Expand Down Expand Up @@ -75,11 +80,6 @@ const u8 kCodeLengthAlphabetOrder[kLensTableSize] =

const u8 kLevelExtraBits[3] = {2, 3, 7};

const unsigned int kTableDirectLevels = 16;
const unsigned int kBitLensRepNumber_3_6 = kTableDirectLevels;
const unsigned int kBitLens0Number_3_10 = kBitLensRepNumber_3_6 + 1;
const unsigned int kBitLens0Number_11_138 = kBitLens0Number_3_10 + 1;

#define kStored 0
#define kFixedHuffman 1
#define kDynamicHuffman 2
Expand Down

0 comments on commit 7c81cf4

Please sign in to comment.