From 2314fb700814075525ad6873ecd907d0fe429177 Mon Sep 17 00:00:00 2001 From: Charles Hannum Date: Mon, 19 Sep 1994 12:46:40 +0000 Subject: [PATCH] Add format checking for `q' (quad) modifier. From-SVN: r8093 --- gcc/c-common.c | 51 ++++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/gcc/c-common.c b/gcc/c-common.c index a0b7fd36fac..efc5fcbcdf7 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -483,9 +483,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 @@ -506,6 +508,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; @@ -514,32 +519,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, T_LL, 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, T_LL, NULL, "" }, { NULL } }; @@ -885,7 +890,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; @@ -994,6 +1000,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)