1 $DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/c-format.c.patch,v 1.1 2004/07/02 16:42:19 joerg Exp $
3 --- c-format.c.orig 2004-06-20 04:14:48.000000000 +0200
4 +++ c-format.c 2004-07-02 16:58:22.000000000 +0200
6 { "S", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "R" },
7 /* GNU conversion specifiers. */
8 { "m", 0, STD_EXT, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "" },
9 + /* BSD conversion specifiers. */
10 + /* DragonFly kernel extensions (src/sys/kern/subr_prf.c).
11 + The format %b is supported to decode error registers.
12 + Its usage is: printf("reg=%b\n", regval, "<base><arg>*");
13 + which produces: reg=3<BITTWO,BITONE>
14 + The format %D provides a hexdump given a pointer and separator string:
15 + ("%6D", ptr, ":") -> XX:XX:XX:XX:XX:XX
16 + ("%*D", len, ptr, " ") -> XX XX XX XX ...
18 + { "D", 1, STD_EXT, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR" },
19 + { "b", 1, STD_EXT, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "" },
20 + { "ry", 0, STD_EXT, { T89_I, BADLEN, BADLEN, T89_L, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0 +#", "i" },
21 + { "z", 0, STD_EXT, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM }, "-wp0#", "i" },
22 { NULL, 0, 0, NOLENGTHS, NULL, NULL }
25 @@ -1998,6 +2011,57 @@
29 + if (*format_chars == 'b')
31 + /* There should be an int arg to control the string arg. */
34 + status_warning (status, "too few arguments for format");
37 + if (info->first_arg_num != 0)
39 + cur_param = TREE_VALUE (params);
40 + params = TREE_CHAIN (params);
42 + if ((TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
43 + != integer_type_node)
45 + (TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
46 + != unsigned_type_node))
48 + status_warning (status, "bitmap is not type int (arg %d)",
53 + if (*format_chars == 'D')
55 + /* There should be an unsigned char * arg before the string arg. */
58 + status_warning (status, "too few arguments for format");
61 + if (info->first_arg_num != 0)
65 + cur_param = TREE_VALUE (params);
66 + params = TREE_CHAIN (params);
68 + cur_type = TREE_TYPE (cur_param);
69 + if (TREE_CODE (cur_type) != POINTER_TYPE
70 + || TYPE_MAIN_VARIANT (TREE_TYPE (cur_type))
71 + != unsigned_char_type_node)
73 + status_warning (status,
74 + "ethernet address is not type unsigned char * (arg %d)",
80 format_char = *format_chars;
82 || (!(fki->flags & (int) FMT_FLAG_FANCY_PERCENT_OK)
84 else if (strchr (fci->flags2, '2') != 0)
87 - status_warning (status, "`%%%c' yields only last 2 digits of year in some locales",
88 + status_warning (status, "`%%%c' yields only last 2 digits of year in some locals on non-BSD systems",
90 else if (y2k_level == 2)
91 status_warning (status, "`%%%c' yields only last 2 digits of year", format_char);