diff options
author | obrien <obrien@FreeBSD.org> | 2002-05-26 16:04:37 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2002-05-26 16:04:37 +0000 |
commit | c63b7df4ec746f8704bf62b1a247052e01686a6a (patch) | |
tree | c970563fa48d83a2453a920369ebf0333a95d547 /contrib | |
parent | e8d149b2f764dc40d5530a9deac9d39ccfcb1d30 (diff) | |
download | FreeBSD-src-c63b7df4ec746f8704bf62b1a247052e01686a6a.zip FreeBSD-src-c63b7df4ec746f8704bf62b1a247052e01686a6a.tar.gz |
The special checks for %b and %D in rev 1.1 were done before skipping over
any characters between the % and the [bD], so only plain %b and %B worked.
This may un-1/2ass our -fformat-extensions support.
Submitted by: bde
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/gcc/c-format.c | 105 |
1 files changed, 54 insertions, 51 deletions
diff --git a/contrib/gcc/c-format.c b/contrib/gcc/c-format.c index 9791746..18ba218 100644 --- a/contrib/gcc/c-format.c +++ b/contrib/gcc/c-format.c @@ -797,9 +797,9 @@ static const format_char_info print_char_table[] = ("%6D", ptr, ":") -> XX:XX:XX:XX:XX:XX ("%*D", len, ptr, " ") -> XX XX XX XX ... */ - { "D", 1, STD_EXT, { T89_C, T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR" }, - { "b", 1, STD_EXT, { T89_C, T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "" }, - { "rz", 0, STD_EXT, { BADLEN, T89_I, T89_I, T89_L, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0 +#", "i" }, + { "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", "" }, + { "rz", 0, STD_EXT, { T89_I, BADLEN, BADLEN, T89_L, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0 +#", "i" }, { NULL, 0, 0, NOLENGTHS, NULL, NULL } }; @@ -1740,54 +1740,6 @@ check_format_info_main (status, res, info, format_chars, format_length, main_arg_num = opnum + info->first_arg_num - 1; } } - 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); - } - } - } /* Read any format flags, but do not yet validate them beyond removing duplicates, since in general validation depends on the rest of @@ -2065,6 +2017,57 @@ check_format_info_main (status, res, info, format_chars, format_length, } } + 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) |