component(developer/golang-123): Add Component
[oi-userland.git] / components / developer / gcc-13 / patches / 0036-cmn_err-supports-h-and-hh.patch
blob7e3c5ec4495c5b77b411df451a93828e4af15085
1 From 6f08c211bda1e86402b7d8aead900845bf245f9b Mon Sep 17 00:00:00 2001
2 From: Andy Fiddaman <illumos@fiddaman.net>
3 Date: Mon, 28 Nov 2022 11:52:58 +0000
4 Subject: cmn_err() supports 'h' and 'hh'
6 ---
7 gcc/config/sol2-c.cc | 21 ++++++++++++---------
8 gcc/testsuite/gcc.dg/format/cmn-err-1.c | 5 +++++
9 2 files changed, 17 insertions(+), 9 deletions(-)
11 diff --git a/gcc/config/sol2-c.cc b/gcc/config/sol2-c.cc
12 index 45d083c2ce00..0b3e88809a22 100644
13 --- a/gcc/config/sol2-c.cc
14 +++ b/gcc/config/sol2-c.cc
15 @@ -31,11 +31,13 @@ along with GCC; see the file COPYING3. If not see
17 #include "c-family/c-pragma.h"
19 -/* cmn_err only accepts "l" and "ll". */
20 +#define NO_FMT NULL, FMT_LEN_none, STD_C89
22 static const format_length_info cmn_err_length_specs[] =
24 + { "h", FMT_LEN_h, STD_C89, "hh", FMT_LEN_hh, STD_C99, 0 },
25 { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C89, 0 },
26 - { NULL, FMT_LEN_none, STD_C89, NULL, FMT_LEN_none, STD_C89, 0 }
27 + { NO_FMT, NO_FMT, 0 }
30 static const format_flag_spec cmn_err_flag_specs[] =
31 @@ -60,14 +62,15 @@ static const format_char_info bitfield_string_type =
33 static const format_char_info cmn_err_char_table[] =
35 + /* none hh h l ll L z t j H D DD */
36 /* C89 conversion specifiers. */
37 - { "dD", 0, STD_C89, { T89_I, BADLEN, BADLEN, T89_L, T9L_LL, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0", "", NULL },
38 - { "oOxX",0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, T9L_ULL, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0", "", NULL },
39 - { "u", 0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, T9L_ULL, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0", "", NULL },
40 - { "c", 0, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "", NULL },
41 - { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "c", NULL },
42 - { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR", NULL },
43 - { "b", 0, STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w0", "", &bitfield_string_type },
44 + { "dD", 0, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, BADLEN, BADLEN, BADLEN, BADLEN , BADLEN, BADLEN, BADLEN }, "-wp0", "", NULL },
45 + { "oOxX",0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, BADLEN, BADLEN, BADLEN, BADLEN , BADLEN, BADLEN, BADLEN }, "-wp0", "", NULL },
46 + { "u", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, BADLEN, BADLEN, BADLEN, BADLEN , BADLEN, BADLEN, BADLEN }, "-wp0", "", NULL },
47 + { "c", 0, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN , BADLEN, BADLEN, BADLEN }, "-w", "", NULL },
48 + { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN , BADLEN, BADLEN, BADLEN }, "-w", "c", NULL },
49 + { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN , BADLEN, BADLEN, BADLEN }, "-wp", "cR", NULL },
50 + { "b", 0, STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN , BADLEN, BADLEN, BADLEN }, "-w0", "", &bitfield_string_type },
51 { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL }
54 diff --git a/gcc/testsuite/gcc.dg/format/cmn-err-1.c b/gcc/testsuite/gcc.dg/format/cmn-err-1.c
55 index aea7779a2c3b..f6833c1723ad 100644
56 --- a/gcc/testsuite/gcc.dg/format/cmn-err-1.c
57 +++ b/gcc/testsuite/gcc.dg/format/cmn-err-1.c
58 @@ -17,12 +17,17 @@ int main()
59 int i = 1;
60 long l = 2;
61 llong ll = 3;
62 + char hh = 4;
63 + short h = 5;
65 cmn_err_func (0, "%s", string);
66 cmn_err_func (0, "%d %D %o %O %x %X %u", i, i, i, i, i, i, i);
67 cmn_err_func (0, "%ld %lD %lo %lO %lx %lX %lu", l, l, l, l, l, l, l);
68 cmn_err_func (0, "%lld %llD %llo %llO %llx %llX %llu",
69 ll, ll, ll, ll, ll, ll, ll);
70 + cmn_err_func (0, "%hd %hD %ho %hO %hx %hX %hu", h, h, h, h, h, h, h);
71 + cmn_err_func (0, "%hhd %hhD %hho %hhO %hhx %hhX %hhu",
72 + hh, hh, hh, hh, hh, hh, hh);
73 cmn_err_func (0, "%b %s", i, "\01Foo", string);
74 cmn_err_func (0, "%p", string);
75 cmn_err_func (0, "%16b", i, "\01Foo");