From: Willy Tarreau Date: Wed, 24 May 2023 19:27:39 +0000 (+0200) Subject: BUILD: ist: do not put a cast in an array declaration X-Git-Tag: v2.8-dev13~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4e8720ab783504ec868cf8ca05388ba0e88a7193;p=thirdparty%2Fhaproxy.git BUILD: ist: do not put a cast in an array declaration TCC is upset by the declaration looking like: const unsigned char ist_lc[256] __attribute__((weak)) = ((const unsigned char[256]){ ... }); It was written like this because it's expanded from the _IST_LC macro but it's never used as-is, it's only used from ist_lc, which should be the one containing the cast so that the macro only contains the list of bytes that can be used in both places. And this assigns more consistent roles to the lower and upper case macro/variable now, one is typed and the other one not. No backport is needed. --- diff --git a/include/import/ist.h b/include/import/ist.h index 978fb3c722..1ac23c815d 100644 --- a/include/import/ist.h +++ b/include/import/ist.h @@ -38,7 +38,7 @@ #endif /* ASCII to lower case conversion table */ -#define _IST_LC ((const unsigned char[256]){ \ +#define _IST_LC { \ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, \ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, \ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, \ @@ -71,10 +71,10 @@ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, \ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, \ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, \ -}) +} /* ASCII to upper case conversion table */ -#define _IST_UC ((const unsigned char[256]){ \ +#define _IST_UC { \ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, \ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, \ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, \ @@ -107,14 +107,14 @@ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, \ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, \ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, \ -}) +} #ifdef USE_OBSOLETE_LINKER /* some old linkers and some non-ELF platforms have issues with the weak * attribute so we turn these arrays to literals there. */ -#define ist_lc _IST_LC -#define ist_uc _IST_UC +#define ist_lc ((const unsigned char[256])_IST_LC) +#define ist_uc ((const unsigned char[256])_IST_UC) #else const unsigned char ist_lc[256] __attribute__((weak)) = _IST_LC; const unsigned char ist_uc[256] __attribute__((weak)) = _IST_UC;