Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/gnu/dist/toolchain/gcc Add support for the %j format length ...
details: https://anonhg.NetBSD.org/src/rev/499a876bf187
branches: trunk
changeset: 544213:499a876bf187
user: thorpej <thorpej%NetBSD.org@localhost>
date: Fri Mar 14 21:24:44 2003 +0000
description:
Add support for the %j format length modifier (intmax_t). We have to
add intmax_type_node and uintmax_type_node globals to support this.
diffstat:
gnu/dist/toolchain/gcc/c-common.c | 87 +++++++++++++++++++++-----------------
gnu/dist/toolchain/gcc/c-decl.c | 24 ++++++++++
gnu/dist/toolchain/gcc/c-tree.h | 2 +
gnu/dist/toolchain/gcc/cp/decl.c | 24 ++++++++++
4 files changed, 97 insertions(+), 40 deletions(-)
diffs (243 lines):
diff -r e23c2d2d9da7 -r 499a876bf187 gnu/dist/toolchain/gcc/c-common.c
--- a/gnu/dist/toolchain/gcc/c-common.c Fri Mar 14 20:41:38 2003 +0000
+++ b/gnu/dist/toolchain/gcc/c-common.c Fri Mar 14 21:24:44 2003 +0000
@@ -1062,6 +1062,8 @@
#define T_W &wchar_type_node
#define T_ST &sizetype
#define T_PDT &ptrdiff_type_node
+#define T_IMT &intmax_type_node
+#define T_UIMT &uintmax_type_node
typedef struct {
const char *format_chars;
@@ -1089,38 +1091,41 @@
/* Type of argument if length modifier `t' is used.
If NULL, then this modifier is not allowed. */
tree *tlen;
+ /* Type of argument if length modifier `j' is used.
+ If NULL, then this modifier is not allowed. */
+ tree *jlen;
/* List of other modifier characters allowed with these options. */
const char *flag_chars;
} format_char_info;
static format_char_info print_char_table[] = {
- { "di", 0, T_I, T_I, T_I, T_L, T_LL, T_LL, T_ST, T_PDT, "-wp0 +" },
- { "oxX", 0, T_UI, T_UI, T_UI, T_UL, T_ULL, T_ULL, T_ST, T_PDT, "-wp0#" },
- { "u", 0, T_UI, T_UI, T_UI, T_UL, T_ULL, T_ULL, T_ST, T_PDT, "-wp0" },
+ { "di", 0, T_I, T_I, T_I, T_L, T_LL, T_LL, T_ST, T_PDT, T_IMT, "-wp0 +" },
+ { "oxX", 0, T_UI, T_UI, T_UI, T_UL, T_ULL, T_ULL, T_ST, T_PDT, T_UIMT, "-wp0#" },
+ { "u", 0, T_UI, T_UI, T_UI, T_UL, T_ULL, T_ULL, T_ST, T_PDT, T_UIMT, "-wp0" },
/* A GNU extension. */
- { "m", 0, T_V, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-wp" },
- { "feEgGaA", 0, T_D, NULL, NULL, NULL, NULL, T_LD, NULL, NULL, "-wp0 +#" },
- { "c", 0, T_I, NULL, NULL, T_W, NULL, NULL, NULL, NULL, "-w" },
- { "C", 0, T_W, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-w" },
- { "s", 1, T_C, NULL, NULL, T_W, NULL, NULL, NULL, NULL, "-wp" },
- { "S", 1, T_W, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-wp" },
- { "p", 1, T_V, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-w" },
- { "n", 1, T_I, NULL, T_S, T_L, T_LL, NULL, NULL, NULL, "" },
- { NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+ { "m", 0, T_V, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-wp" },
+ { "feEgGaA", 0, T_D, NULL, NULL, NULL, NULL, T_LD, NULL, NULL, NULL, "-wp0 +#" },
+ { "c", 0, T_I, NULL, NULL, T_W, NULL, NULL, NULL, NULL, NULL, "-w" },
+ { "C", 0, T_W, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-w" },
+ { "s", 1, T_C, NULL, NULL, T_W, NULL, NULL, NULL, NULL, NULL, "-wp" },
+ { "S", 1, T_W, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-wp" },
+ { "p", 1, T_V, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-w" },
+ { "n", 1, T_I, NULL, T_S, T_L, T_LL, NULL, NULL, NULL, NULL, "" },
+ { NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
};
static format_char_info scan_char_table[] = {
- { "di", 1, T_I, T_C, T_S, T_L, T_LL, T_LL, T_ST, T_PDT, "*" },
- { "ouxX", 1, T_UI, T_UC, T_US, T_UL, T_ULL, T_ULL, T_ST, T_PDT, "*" },
- { "efgEGaA", 1, T_F, NULL, NULL, T_D, NULL, T_LD, NULL, NULL, "*" },
- { "c", 1, T_C, NULL, NULL, T_W, NULL, NULL, NULL, NULL, "*" },
- { "s", 1, T_C, NULL, NULL, T_W, NULL, NULL, NULL, NULL, "*a" },
- { "[", 1, T_C, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "*a" },
- { "C", 1, T_W, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "*" },
- { "S", 1, T_W, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "*a" },
- { "p", 2, T_V, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "*" },
- { "n", 1, T_I, T_C, T_S, T_L, T_LL, NULL, NULL, NULL, "" },
- { NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+ { "di", 1, T_I, T_C, T_S, T_L, T_LL, T_LL, T_ST, T_PDT, T_IMT, "*" },
+ { "ouxX", 1, T_UI, T_UC, T_US, T_UL, T_ULL, T_ULL, T_ST, T_PDT, T_UIMT, "*" },
+ { "efgEGaA", 1, T_F, NULL, NULL, T_D, NULL, T_LD, NULL, NULL, NULL, "*" },
+ { "c", 1, T_C, NULL, NULL, T_W, NULL, NULL, NULL, NULL, NULL, "*" },
+ { "s", 1, T_C, NULL, NULL, T_W, NULL, NULL, NULL, NULL, NULL, "*a" },
+ { "[", 1, T_C, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "*a" },
+ { "C", 1, T_W, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "*" },
+ { "S", 1, T_W, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "*a" },
+ { "p", 2, T_V, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "*" },
+ { "n", 1, T_I, T_C, T_S, T_L, T_LL, NULL, NULL, NULL, NULL, "" },
+ { NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
};
/* Handle format characters recognized by glibc's strftime.c.
@@ -1132,20 +1137,20 @@
'G' - other GNU extensions */
static format_char_info time_char_table[] = {
- { "y", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "2EO-_0w" },
- { "D", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "2" },
- { "g", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "2O-_0w" },
- { "cx", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "3E" },
- { "%FRTXnrt", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "" },
- { "P", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "G" },
- { "HIMSUWdemw", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Ow" },
- { "Vju", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Oow" },
- { "Gklsz", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0OGw" },
- { "ABZa", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "^#" },
- { "p", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "#" },
- { "bh", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "^" },
- { "CY", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0EOw" },
- { NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+ { "y", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "2EO-_0w" },
+ { "D", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "2" },
+ { "g", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "2O-_0w" },
+ { "cx", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "3E" },
+ { "%FRTXnrt", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "" },
+ { "P", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "G" },
+ { "HIMSUWdemw", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Ow" },
+ { "Vju", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Oow" },
+ { "Gklsz", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0OGw" },
+ { "ABZa", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "^#" },
+ { "p", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "#" },
+ { "bh", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "^" },
+ { "CY", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0EOw" },
+ { NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
};
typedef struct function_format_info
@@ -1629,10 +1634,11 @@
{
if (*format_chars == 'h' || *format_chars == 'l')
length_char = *format_chars++;
- else if (*format_chars == 'z' || *format_chars == 't')
+ else if (*format_chars == 'z' || *format_chars == 't'
+ || *format_chars == 'j')
{
- /* ISO C99 size_t and ptrdiff_t. We don't bother warning
- about this if in pedantic mode. */
+ /* ISO C99 size_t, ptrdiff_t, and intmax_t. We don't bother
+ warning about this if in pedantic mode. */
length_char = *format_chars++;
}
else if (*format_chars == 'q' || *format_chars == 'L')
@@ -1788,6 +1794,7 @@
case 'z': /* FALLTHROUGH */
case 'Z': wanted_type = fci->zlen ? *fci->zlen : 0; break;
case 't': wanted_type = fci->tlen ? *fci->tlen : 0; break;
+ case 'j': wanted_type = fci->jlen ? *fci->jlen : 0; break;
}
if (wanted_type == 0)
warning ("use of `%c' length character with `%c' type character",
diff -r e23c2d2d9da7 -r 499a876bf187 gnu/dist/toolchain/gcc/c-decl.c
--- a/gnu/dist/toolchain/gcc/c-decl.c Fri Mar 14 20:41:38 2003 +0000
+++ b/gnu/dist/toolchain/gcc/c-decl.c Fri Mar 14 21:24:44 2003 +0000
@@ -103,6 +103,22 @@
#ifndef WCHAR_TYPE
#define WCHAR_TYPE "int"
#endif
+
+#ifndef INTMAX_TYPE
+#define INTMAX_TYPE ((INT_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
+ ? "int" \
+ : ((LONG_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
+ ? "long int" \
+ : "long long int"))
+#endif
+
+#ifndef UINTMAX_TYPE
+#define UINTMAX_TYPE ((INT_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
+ ? "unsigned int" \
+ : ((LONG_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
+ ? "long unsigned int" \
+ : "long long unsigned int"))
+#endif
/* a node which has tree code ERROR_MARK, and whose type is itself.
All erroneous expressions are replaced with this node. All functions
@@ -130,6 +146,9 @@
tree ptrdiff_type_node;
+tree intmax_type_node;
+tree uintmax_type_node;
+
tree unsigned_char_type_node;
tree signed_char_type_node;
tree char_type_node;
@@ -3096,6 +3115,11 @@
if (flag_traditional && TREE_UNSIGNED (sizetype))
set_sizetype (signed_type (sizetype));
+ intmax_type_node
+ = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (INTMAX_TYPE)));
+ uintmax_type_node
+ = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (UINTMAX_TYPE)));
+
ptrdiff_type_node
= TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE)));
diff -r e23c2d2d9da7 -r 499a876bf187 gnu/dist/toolchain/gcc/c-tree.h
--- a/gnu/dist/toolchain/gcc/c-tree.h Fri Mar 14 20:41:38 2003 +0000
+++ b/gnu/dist/toolchain/gcc/c-tree.h Fri Mar 14 21:24:44 2003 +0000
@@ -255,6 +255,8 @@
extern tree complex_long_double_type_node;
extern tree ptr_type_node;
extern tree ptrdiff_type_node;
+extern tree intmax_type_node;
+extern tree uintmax_type_node;
extern tree short_integer_type_node;
extern tree short_unsigned_type_node;
extern tree signed_char_type_node;
diff -r e23c2d2d9da7 -r 499a876bf187 gnu/dist/toolchain/gcc/cp/decl.c
--- a/gnu/dist/toolchain/gcc/cp/decl.c Fri Mar 14 20:41:38 2003 +0000
+++ b/gnu/dist/toolchain/gcc/cp/decl.c Fri Mar 14 21:24:44 2003 +0000
@@ -131,6 +131,22 @@
#define WCHAR_TYPE "int"
#endif
+#ifndef INTMAX_TYPE
+#define INTMAX_TYPE ((INT_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
+ ? "int" \
+ : ((LONG_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
+ ? "long int" \
+ : "long long int"))
+#endif
+
+#ifndef UINTMAX_TYPE
+#define UINTMAX_TYPE ((INT_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
+ ? "unsigned int" \
+ : ((LONG_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
+ ? "long unsigned int" \
+ : "long long unsigned int"))
+#endif
+
static tree grokparms PROTO((tree, int));
static tree lookup_nested_type PROTO((tree, tree));
static const char *redeclaration_error_message PROTO((tree, tree));
@@ -224,6 +240,9 @@
tree ptrdiff_type_node;
+tree intmax_type_node;
+tree uintmax_type_node;
+
tree unsigned_char_type_node;
tree signed_char_type_node;
tree char_type_node;
@@ -6357,6 +6376,11 @@
set_sizetype
(TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE))));
+ intmax_type_node
+ = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (INTMAX_TYPE)));
+ uintmax_type_node
+ = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (UINTMAX_TYPE)));
+
ptrdiff_type_node
= TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE)));
Home |
Main Index |
Thread Index |
Old Index