Add q modifier (for long longs) support to -Wformat.

Reviewed by:	bde
This commit is contained in:
Rodney W. Grimes 1994-09-18 21:25:02 +00:00
parent 6f2d50c0d0
commit a861b63c28
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2863

View file

@ -470,9 +470,11 @@ found_attr:;
#define T_I &integer_type_node
#define T_L &long_integer_type_node
#define T_LL &long_long_integer_type_node
#define T_S &short_integer_type_node
#define T_UI &unsigned_type_node
#define T_UL &long_unsigned_type_node
#define T_ULL &long_long_unsigned_type_node
#define T_US &short_unsigned_type_node
#define T_F &float_type_node
#define T_D &double_type_node
@ -493,6 +495,9 @@ typedef struct {
/* Type of argument if length modifier `l' is used.
If NULL, then this modifier is not allowed. */
tree *llen;
/* Type of argument if length modifier `q' is used.
If NULL, then this modifier is not allowed. */
tree *qlen;
/* Type of argument if length modifier `L' is used.
If NULL, then this modifier is not allowed. */
tree *bigllen;
@ -501,32 +506,32 @@ typedef struct {
} format_char_info;
static format_char_info print_char_table[] = {
{ "di", 0, T_I, T_I, T_L, NULL, "-wp0 +" },
{ "oxX", 0, T_UI, T_UI, T_UL, NULL, "-wp0#" },
{ "u", 0, T_UI, T_UI, T_UL, NULL, "-wp0" },
{ "di", 0, T_I, T_I, T_L, T_LL, NULL, "-wp0 +" },
{ "oxX", 0, T_UI, T_UI, T_UL, T_ULL, NULL, "-wp0#" },
{ "u", 0, T_UI, T_UI, T_UL, T_ULL, NULL, "-wp0" },
/* Two GNU extensions. */
{ "Z", 0, T_ST, NULL, NULL, NULL, "-wp0" },
{ "m", 0, T_UI, T_UI, T_UL, NULL, "-wp" },
{ "feEgG", 0, T_D, NULL, NULL, T_LD, "-wp0 +#" },
{ "c", 0, T_I, NULL, T_W, NULL, "-w" },
{ "C", 0, T_W, NULL, NULL, NULL, "-w" },
{ "s", 1, T_C, NULL, T_W, NULL, "-wp" },
{ "S", 1, T_W, NULL, NULL, NULL, "-wp" },
{ "p", 1, T_V, NULL, NULL, NULL, "-w" },
{ "n", 1, T_I, T_S, T_L, NULL, "" },
{ "Z", 0, T_ST, NULL, NULL, NULL, NULL, "-wp0" },
{ "m", 0, T_UI, T_UI, T_UL, NULL, NULL, "-wp" },
{ "feEgG", 0, T_D, NULL, NULL, NULL, T_LD, "-wp0 +#" },
{ "c", 0, T_I, NULL, T_W, NULL, NULL, "-w" },
{ "C", 0, T_W, NULL, NULL, NULL, NULL, "-w" },
{ "s", 1, T_C, NULL, T_W, NULL, NULL, "-wp" },
{ "S", 1, T_W, NULL, NULL, NULL, NULL, "-wp" },
{ "p", 1, T_V, NULL, NULL, NULL, NULL, "-w" },
{ "n", 1, T_I, T_S, T_L, NULL, NULL, "" },
{ NULL }
};
static format_char_info scan_char_table[] = {
{ "di", 1, T_I, T_S, T_L, NULL, "*" },
{ "ouxX", 1, T_UI, T_US, T_UL, NULL, "*" },
{ "efgEG", 1, T_F, NULL, T_D, T_LD, "*" },
{ "sc", 1, T_C, NULL, T_W, NULL, "*a" },
{ "[", 1, T_C, NULL, NULL, NULL, "*a" },
{ "C", 1, T_W, NULL, NULL, NULL, "*" },
{ "S", 1, T_W, NULL, NULL, NULL, "*" },
{ "p", 2, T_V, NULL, NULL, NULL, "*" },
{ "n", 1, T_I, T_S, T_L, NULL, "" },
{ "di", 1, T_I, T_S, T_L, T_LL, NULL, "*" },
{ "ouxX", 1, T_UI, T_US, T_UL, T_ULL, NULL, "*" },
{ "efgEG", 1, T_F, NULL, T_D, NULL, T_LD, "*" },
{ "sc", 1, T_C, NULL, T_W, NULL, NULL, "*a" },
{ "[", 1, T_C, NULL, NULL, NULL, NULL, "*a" },
{ "C", 1, T_W, NULL, NULL, NULL, NULL, "*" },
{ "S", 1, T_W, NULL, NULL, NULL, NULL, "*" },
{ "p", 2, T_V, NULL, NULL, NULL, NULL, "*" },
{ "n", 1, T_I, T_S, T_L, NULL, NULL, "" },
{ NULL }
};
@ -872,7 +877,8 @@ check_format_info (info, params)
}
}
}
if (*format_chars == 'h' || *format_chars == 'l' || *format_chars == 'L')
if (*format_chars == 'h' || *format_chars == 'l' || *format_chars == 'q' ||
*format_chars == 'L')
length_char = *format_chars++;
else
length_char = 0;
@ -981,6 +987,7 @@ check_format_info (info, params)
default: wanted_type = fci->nolen ? *(fci->nolen) : 0; break;
case 'h': wanted_type = fci->hlen ? *(fci->hlen) : 0; break;
case 'l': wanted_type = fci->llen ? *(fci->llen) : 0; break;
case 'q': wanted_type = fci->qlen ? *(fci->qlen) : 0; break;
case 'L': wanted_type = fci->bigllen ? *(fci->bigllen) : 0; break;
}
if (wanted_type == 0)