Message ID | Zr+TF/9z1B30/wXP@tucnak |
---|---|
State | New |
Headers | show |
Series | libcpp: Adjust lang_defaults | expand |
On Fri, Aug 16, 2024 at 7:58 PM Jakub Jelinek <jakub@redhat.com> wrote: > > Hi! > > Here it is in patch form, at the same time I've turned it into bit-fields. > On x86_64-linux, this reduced .rodata by 532 bytes (so 5.75x reduction > of the variable) and grew the cpp_set_lang function by 26 bytes (8.4% > growth). > > So far smoke tested, ok for trunk if it passes full bootstrap/regtest? OK > --- libcpp/init.cc.jj 2024-08-15 12:03:35.880901322 +0200 > +++ libcpp/init.cc 2024-08-16 19:37:31.564755070 +0200 > @@ -77,61 +77,67 @@ END > requires. */ > struct lang_flags > { > - char c99; > - char cplusplus; > - char extended_numbers; > - char extended_identifiers; > - char c11_identifiers; > - char xid_identifiers; > - char std; > - char digraphs; > - char uliterals; > - char rliterals; > - char user_literals; > - char binary_constants; > - char digit_separators; > - char trigraphs; > - char utf8_char_literals; > - char va_opt; > - char scope; > - char dfp_constants; > - char size_t_literals; > - char elifdef; > - char warning_directive; > - char delimited_escape_seqs; > - char true_false; > + unsigned int c99 : 1; > + unsigned int cplusplus : 1; > + unsigned int extended_numbers : 1; > + unsigned int extended_identifiers : 1; > + unsigned int c11_identifiers : 1; > + unsigned int xid_identifiers : 1; > + unsigned int std : 1; > + unsigned int digraphs : 1; > + unsigned int uliterals : 1; > + unsigned int rliterals : 1; > + unsigned int user_literals : 1; > + unsigned int binary_constants : 1; > + unsigned int digit_separators : 1; > + unsigned int trigraphs : 1; > + unsigned int utf8_char_literals : 1; > + unsigned int va_opt : 1; > + unsigned int scope : 1; > + unsigned int dfp_constants : 1; > + unsigned int size_t_literals : 1; > + unsigned int elifdef : 1; > + unsigned int warning_directive : 1; > + unsigned int delimited_escape_seqs : 1; > + unsigned int true_false : 1; > }; > > -static const struct lang_flags lang_defaults[] = > -{ /* c99 c++ xnum xid c11 xidid std digr ulit rlit udlit bincst digsep trig u8chlit vaopt scope dfp szlit elifdef warndir delim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 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1 }, > - /* GNUCXX26 */ { 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1 }, > - /* CXX26 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1 }, > - /* ASM */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } > +static const struct lang_flags lang_defaults[] = { > + /* u e w > + b d 8 l a t > + x u i i c v s s i r d r > + x i d u r d n g t h a c z f n e u > + c c n x c d s i l l l c s r l o o d l d d l f > + 9 + u i 1 i t g i i i s e i i p p f i e i i a > + 9 + m d 1 d d r t t t t p g t t e p t f r m l */ > + /* GNUC89 */ { 0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0 }, > + /* GNUC99 */ { 1,0,1,1,0,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0 }, > + /* GNUC11 */ { 1,0,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0 }, > + /* GNUC17 */ { 1,0,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0 }, > + /* GNUC23 */ { 1,0,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,1,0,1,1,0,1 }, > + /* GNUC2Y */ { 1,0,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,1,0,1,1,0,1 }, > + /* STDC89 */ { 0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0 }, > + /* STDC94 */ { 0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0 }, > + /* STDC99 */ { 1,0,1,1,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0 }, > + /* STDC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1,1,0,1,1,1,0,1,1,1,1,1 }, > + /* CXX26 */ { 1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1 }, > + /* ASM */ { 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } > }; > > /* Sets internal flags correctly for a given language. */ > > Jakub >
--- libcpp/init.cc.jj 2024-08-15 12:03:35.880901322 +0200 +++ libcpp/init.cc 2024-08-16 19:37:31.564755070 +0200 @@ -77,61 +77,67 @@ END requires. */ struct lang_flags { - char c99; - char cplusplus; - char extended_numbers; - char extended_identifiers; - char c11_identifiers; - char xid_identifiers; - char std; - char digraphs; - char uliterals; - char rliterals; - char user_literals; - char binary_constants; - char digit_separators; - char trigraphs; - char utf8_char_literals; - char va_opt; - char scope; - char dfp_constants; - char size_t_literals; - char elifdef; - char warning_directive; - char delimited_escape_seqs; - char true_false; + unsigned int c99 : 1; + unsigned int cplusplus : 1; + unsigned int extended_numbers : 1; + unsigned int extended_identifiers : 1; + unsigned int c11_identifiers : 1; + unsigned int xid_identifiers : 1; + unsigned int std : 1; + unsigned int digraphs : 1; + unsigned int uliterals : 1; + unsigned int rliterals : 1; + unsigned int user_literals : 1; + unsigned int binary_constants : 1; + unsigned int digit_separators : 1; + unsigned int trigraphs : 1; + unsigned int utf8_char_literals : 1; + unsigned int va_opt : 1; + unsigned int scope : 1; + unsigned int dfp_constants : 1; + unsigned int size_t_literals : 1; + unsigned int elifdef : 1; + unsigned int warning_directive : 1; + unsigned int delimited_escape_seqs : 1; + unsigned int true_false : 1; }; -static const struct lang_flags lang_defaults[] = -{ /* c99 c++ xnum xid c11 xidid std digr ulit rlit udlit bincst digsep trig u8chlit vaopt scope dfp szlit elifdef warndir delim trufal */ - /* GNUC89 */ { 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 }, - /* GNUC99 */ { 1, 0, 1, 1, 0, 0, 0, 1, 1, 1,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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1 }, - /* ASM */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +static const struct lang_flags lang_defaults[] = { + /* u e w + b d 8 l a t + x u i i c v s s i r d r + x i d u r d n g t h a c z f n e u + c c n x c d s i l l l c s r l o o d l d d l f + 9 + u i 1 i t g i i i s e i i p p f i e i i a + 9 + m d 1 d d r t t t t p g t t e p t f r m l */ + /* GNUC89 */ { 0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0 }, + /* GNUC99 */ { 1,0,1,1,0,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0 }, + /* GNUC11 */ { 1,0,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0 }, + /* GNUC17 */ { 1,0,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0 }, + /* GNUC23 */ { 1,0,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,1,0,1,1,0,1 }, + /* GNUC2Y */ { 1,0,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,1,0,1,1,0,1 }, + /* STDC89 */ { 0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0 }, + /* STDC94 */ { 0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0 }, + /* STDC99 */ { 1,0,1,1,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0 }, + /* STDC11 */ { 1,0,1,1,1,0,1,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0 }, + /* STDC17 */ { 1,0,1,1,1,0,1,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0 }, + /* STDC23 */ { 1,0,1,1,1,1,1,1,1,0,0,1,1,0,1,1,1,1,0,1,1,0,1 }, + /* STDC2Y */ { 1,0,1,1,1,1,1,1,1,0,0,1,1,0,1,1,1,1,0,1,1,0,1 }, + /* GNUCXX */ { 0,1,1,1,0,1,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1 }, + /* CXX98 */ { 0,1,0,1,0,1,1,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1 }, + /* GNUCXX11 */ { 1,1,1,1,1,1,0,1,1,1,1,0,0,0,0,1,1,0,0,0,0,0,1 }, + /* CXX11 */ { 1,1,0,1,1,1,1,1,1,1,1,0,0,1,0,0,1,0,0,0,0,0,1 }, + /* GNUCXX14 */ { 1,1,1,1,1,1,0,1,1,1,1,1,1,0,0,1,1,0,0,0,0,0,1 }, + /* CXX14 */ { 1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0,0,0,0,1 }, + /* GNUCXX17 */ { 1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,0,0,0,0,0,1 }, + /* CXX17 */ { 1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,1 }, + /* GNUCXX20 */ { 1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,0,0,0,0,0,1 }, + /* CXX20 */ { 1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,0,0,0,0,1 }, + /* GNUCXX23 */ { 1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1 }, + /* CXX23 */ { 1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1 }, + /* GNUCXX26 */ { 1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1 }, + /* CXX26 */ { 1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1 }, + /* ASM */ { 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } }; /* Sets internal flags correctly for a given language. */