summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/cc
diff options
context:
space:
mode:
authorrgrimes <rgrimes@FreeBSD.org>1994-09-18 21:25:02 +0000
committerrgrimes <rgrimes@FreeBSD.org>1994-09-18 21:25:02 +0000
commit45a0fdee2d7cf27a73ca83d054dfab850067310c (patch)
treedb52d6aa81505458137be91bfbf51137b156f2a0 /gnu/usr.bin/cc
parent08e96f0a307aef20d43671d7fccabed256750cde (diff)
downloadFreeBSD-src-45a0fdee2d7cf27a73ca83d054dfab850067310c.zip
FreeBSD-src-45a0fdee2d7cf27a73ca83d054dfab850067310c.tar.gz
Add q modifier (for long longs) support to -Wformat.
Reviewed by: bde
Diffstat (limited to 'gnu/usr.bin/cc')
-rw-r--r--gnu/usr.bin/cc/cc_int/c-common.c51
1 files changed, 29 insertions, 22 deletions
diff --git a/gnu/usr.bin/cc/cc_int/c-common.c b/gnu/usr.bin/cc/cc_int/c-common.c
index f18c270..9d4cc2f 100644
--- a/gnu/usr.bin/cc/cc_int/c-common.c
+++ b/gnu/usr.bin/cc/cc_int/c-common.c
@@ -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)
OpenPOWER on IntegriCloud