$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/c-format.c.patch,v 1.1 2004/07/02 16:42:19 joerg Exp $
--- c-format.c.orig 2004-06-20 04:14:48.000000000 +0200
+++ c-format.c 2004-07-02 16:58:22.000000000 +0200
@@ -772,6 +772,19 @@
{ "S", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "R" },
/* GNU conversion specifiers. */
{ "m", 0, STD_EXT, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "" },
+ /* BSD conversion specifiers. */
+ /* DragonFly kernel extensions (src/sys/kern/subr_prf.c).
+ The format %b is supported to decode error registers.
+ Its usage is: printf("reg=%b\n", regval, "*");
+ which produces: reg=3
+ The format %D provides a hexdump given a pointer and separator string:
+ ("%6D", ptr, ":") -> XX:XX:XX:XX:XX:XX
+ ("%*D", len, ptr, " ") -> XX XX XX XX ...
+ */
+ { "D", 1, STD_EXT, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR" },
+ { "b", 1, STD_EXT, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "" },
+ { "ry", 0, STD_EXT, { T89_I, BADLEN, BADLEN, T89_L, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0 +#", "i" },
+ { "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, 0, 0, NOLENGTHS, NULL, NULL }
};
@@ -1998,6 +2011,57 @@
}
}
+ if (*format_chars == 'b')
+ {
+ /* There should be an int arg to control the string arg. */
+ if (params == 0)
+ {
+ status_warning (status, "too few arguments for format");
+ return;
+ }
+ if (info->first_arg_num != 0)
+ {
+ cur_param = TREE_VALUE (params);
+ params = TREE_CHAIN (params);
+ ++arg_num;
+ if ((TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
+ != integer_type_node)
+ &&
+ (TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
+ != unsigned_type_node))
+ {
+ status_warning (status, "bitmap is not type int (arg %d)",
+ arg_num);
+ }
+ }
+ }
+ if (*format_chars == 'D')
+ {
+ /* There should be an unsigned char * arg before the string arg. */
+ if (params == 0)
+ {
+ status_warning (status, "too few arguments for format");
+ return;
+ }
+ if (info->first_arg_num != 0)
+ {
+ tree cur_type;
+
+ cur_param = TREE_VALUE (params);
+ params = TREE_CHAIN (params);
+ ++arg_num;
+ cur_type = TREE_TYPE (cur_param);
+ if (TREE_CODE (cur_type) != POINTER_TYPE
+ || TYPE_MAIN_VARIANT (TREE_TYPE (cur_type))
+ != unsigned_char_type_node)
+ {
+ status_warning (status,
+ "ethernet address is not type unsigned char * (arg %d)",
+ arg_num);
+ }
+ }
+ }
+
format_char = *format_chars;
if (format_char == 0
|| (!(fki->flags & (int) FMT_FLAG_FANCY_PERCENT_OK)
@@ -2124,7 +2188,7 @@
else if (strchr (fci->flags2, '2') != 0)
y2k_level = 2;
if (y2k_level == 3)
- status_warning (status, "`%%%c' yields only last 2 digits of year in some locales",
+ status_warning (status, "`%%%c' yields only last 2 digits of year in some locals on non-BSD systems",
format_char);
else if (y2k_level == 2)
status_warning (status, "`%%%c' yields only last 2 digits of year", format_char);