From bcc6dbc771641246ec4a544e67e4dc3f03d578bd Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 8 May 2020 18:09:23 +0200 Subject: [PATCH] uniname/uniname: Use module 'attribute'. * lib/uniname/gen-uninames.lisp: Emit a reference to ATTRIBUTE_PACKED. * lib/uniname/uninames.h: Regenerated. * lib/uniname/uniname.c: Include attribute.h. * modules/uniname/uniname (Depends-on): Add attribute. --- ChangeLog | 8 ++++++++ lib/uniname/gen-uninames.lisp | 8 ++------ lib/uniname/uniname.c | 2 ++ lib/uniname/uninames.h | 12 ++---------- modules/uniname/uniname | 1 + 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 43946e0acf..56c15bce4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2020-05-08 Bruno Haible + + uniname/uniname: Use module 'attribute'. + * lib/uniname/gen-uninames.lisp: Emit a reference to ATTRIBUTE_PACKED. + * lib/uniname/uninames.h: Regenerated. + * lib/uniname/uniname.c: Include attribute.h. + * modules/uniname/uniname (Depends-on): Add attribute. + 2020-05-08 Bruno Haible c32rtomb: Use module 'attribute'. diff --git a/lib/uniname/gen-uninames.lisp b/lib/uniname/gen-uninames.lisp index ab46eaed59..38a798f09c 100755 --- a/lib/uniname/gen-uninames.lisp +++ b/lib/uniname/gen-uninames.lisp @@ -294,9 +294,7 @@ (incf i (length (unicode-char-word-indices uc))) ) ) (format ostream "};~%") - (format ostream "static const struct { uint16_t index; uint32_t name:24; }~%") - (format ostream "#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)~%__attribute__((__packed__))~%#endif~%") - (format ostream "unicode_name_to_index[~D] = {~%" + (format ostream "static const struct { uint16_t index; uint32_t name:24; } ATTRIBUTE_PACKED unicode_name_to_index[~D] = {~%" (length all-chars-and-aliases) ) (dolist (uc all-chars-and-aliases) @@ -310,9 +308,7 @@ (format ostream "~%") ) (format ostream "};~%") - (format ostream "static const struct { uint16_t index; uint32_t name:24; }~%") - (format ostream "#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)~%__attribute__((__packed__))~%#endif~%") - (format ostream "unicode_index_to_name[~D] = {~%" + (format ostream "static const struct { uint16_t index; uint32_t name:24; } ATTRIBUTE_PACKED unicode_index_to_name[~D] = {~%" (length all-chars) ) (dolist (uc (sort (copy-list all-chars) #'< :key #'unicode-char-index)) diff --git a/lib/uniname/uniname.c b/lib/uniname/uniname.c index 6f59bdb062..7cf1e2e132 100644 --- a/lib/uniname/uniname.c +++ b/lib/uniname/uniname.c @@ -25,6 +25,8 @@ #include #include +#include "attribute.h" + #define SIZEOF(a) (sizeof(a) / sizeof(a[0])) diff --git a/lib/uniname/uninames.h b/lib/uniname/uninames.h index 2906ec98f3..191b3538e8 100644 --- a/lib/uniname/uninames.h +++ b/lib/uniname/uninames.h @@ -41108,11 +41108,7 @@ static const uint16_t unicode_names[115981] = { 23557, 15672, 23563, 15672, }; -static const struct { uint16_t index; uint32_t name:24; } -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -__attribute__((__packed__)) -#endif -unicode_name_to_index[29282] = { +static const struct { uint16_t index; uint32_t name:24; } ATTRIBUTE_PACKED unicode_name_to_index[29282] = { { 0x1CA1, 0 }, { 0x2526, 4 }, { 0x1EB0, 7 }, @@ -70396,11 +70392,7 @@ unicode_name_to_index[29282] = { { 0x1F1B, 115977 }, { 0x1F1A, 115979 }, }; -static const struct { uint16_t index; uint32_t name:24; } -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -__attribute__((__packed__)) -#endif -unicode_index_to_name[29234] = { +static const struct { uint16_t index; uint32_t name:24; } ATTRIBUTE_PACKED unicode_index_to_name[29234] = { { 0x0000, 34710 }, { 0x0001, 105577 }, { 0x0002, 101766 }, diff --git a/modules/uniname/uniname b/modules/uniname/uniname index 852ba418d6..bbd8a997dd 100644 --- a/modules/uniname/uniname +++ b/modules/uniname/uniname @@ -8,6 +8,7 @@ lib/uniname/uniname.c Depends-on: uniname/base +attribute memcmp configure.ac: -- 2.39.5