1 $DragonFly: src/gnu/usr.bin/cc41/cc_prep/patches/c-format.c.patch,v 1.1 2006/09/27 12:10:34 corecode Exp $
2 --- c-format.c 2006-09-16 20:11:29.000000000 +0200
3 +++ c-format.c 2006-09-26 01:05:46.000000000 +0200
5 { "S", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "R", NULL },
6 /* GNU conversion specifiers. */
7 { "m", 0, STD_EXT, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "", NULL },
8 + /* BSD conversion specifiers. */
9 + /* DragonFly kernel extensions (src/sys/kern/subr_prf.c).
10 + The format %b is supported to decode error registers.
11 + Its usage is: printf("reg=%b\n", regval, "<base><arg>*");
12 + which produces: reg=3<BITTWO,BITONE>
13 + The format %D provides a hexdump given a pointer and separator string:
14 + ("%6D", ptr, ":") -> XX:XX:XX:XX:XX:XX
15 + ("%*D", len, ptr, " ") -> XX XX XX XX ...
17 + { "D", 1, STD_EXT, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR", NULL },
18 + { "b", 1, STD_EXT, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "", NULL },
19 + { "ry", 0, STD_EXT, { T89_I, BADLEN, BADLEN, T89_L, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0 +#", "i", NULL },
20 + { "z", 0, STD_EXT, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM }, "-wp0#", "i", NULL },
21 { NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL }
24 @@ -1800,6 +1813,56 @@
28 + if (*format_chars == 'b')
30 + /* There should be an int arg to control the string arg. */
33 + warning (OPT_Wformat, "too few arguments for format");
36 + if (info->first_arg_num != 0)
38 + cur_param = TREE_VALUE (params);
39 + params = TREE_CHAIN (params);
41 + if ((TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
42 + != integer_type_node)
44 + (TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
45 + != unsigned_type_node))
47 + warning (OPT_Wformat, "bitmap is not type int (arg %d)",
52 + if (*format_chars == 'D')
54 + /* There should be an unsigned char * arg before the string arg. */
57 + warning (OPT_Wformat, "too few arguments for format");
60 + if (info->first_arg_num != 0)
64 + cur_param = TREE_VALUE (params);
65 + params = TREE_CHAIN (params);
67 + cur_type = TREE_TYPE (cur_param);
68 + if (TREE_CODE (cur_type) != POINTER_TYPE
69 + || TYPE_MAIN_VARIANT (TREE_TYPE (cur_type))
70 + != unsigned_char_type_node)
72 + warning (OPT_Wformat, "ethernet address is not type unsigned char * (arg %d)",
78 format_char = *format_chars;
80 || (!(fki->flags & (int) FMT_FLAG_FANCY_PERCENT_OK)
84 warning (OPT_Wformat_y2k, "%<%%%c%> yields only last 2 digits of "
85 - "year in some locales", format_char);
86 + "year in some locales on non-BSD systems", format_char);
87 else if (y2k_level == 2)
88 warning (OPT_Wformat_y2k, "%<%%%c%> yields only last 2 digits of "