summaryrefslogtreecommitdiffstats
path: root/gcc/c-format.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2003-09-21 05:07:20 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2003-09-21 05:07:20 +0000
commit9bc3739ff5286405148970f7ec7db806dc17440d (patch)
tree28f355780724c452ad42bb81a3672b2e8010c989 /gcc/c-format.c
parent27d8c9a2bd7e557d79e90f4821deb857bd0a1542 (diff)
downloadppe42-gcc-9bc3739ff5286405148970f7ec7db806dc17440d.tar.gz
ppe42-gcc-9bc3739ff5286405148970f7ec7db806dc17440d.zip
* c-format.c (gcc_diag_char_table): Add %J.
(gcc_cdiag_char_table, gcc_cxxdiag_char_table): Likewise. (check_format_types): Fix wanted_type name lookup. (init_dynamic_diag_info): Setup %J. * diagnostic.c (text_specifies_location): Implement %J. * c-common.c, c-decl.c, c-objc-common.c, c-pragma.c, calls.c, dwarfout.c, expr.c, function.c, stmt.c, stor-layout.c, toplev.c, tree-inline.c, tree-optimize.c, varasm.c, config/arm/pe.c, config/i386/winnt.c, config/ia64/ia64.c, config/mcore/mcore.c, config/v850/v850.c, objc/objc-act.c: Use %J in diagnostics. * tree-inline.c: Include intl.h (inline_forbidden_p_1): Fix i18n of inline_forbidden_reason. * Makefile.in (tree-inline.o): Update. cp/ * decl.c, decl2.c, pt.c: Use %J in diagnostics. java/ * check-init.c, class.c, decl.c, expr.c: Use %J in diagnostics. testsuite/ * gcc.dg/format/gcc_diag-1.c: Add tests for %J. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71619 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-format.c')
-rw-r--r--gcc/c-format.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/gcc/c-format.c b/gcc/c-format.c
index 665b6d1cdc9..82fb593f440 100644
--- a/gcc/c-format.c
+++ b/gcc/c-format.c
@@ -810,6 +810,9 @@ static const format_char_info gcc_diag_char_table[] =
/* %H will require "location_t" at runtime. */
{ "H", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" },
+ /* These will require a "tree" at runtime. */
+ { "J", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" },
+
{ "m", 0, STD_C89, NOARGUMENTS, "", "" },
{ NULL, 0, 0, NOLENGTHS, NULL, NULL }
};
@@ -830,7 +833,7 @@ static const format_char_info gcc_cdiag_char_table[] =
{ "H", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" },
/* These will require a "tree" at runtime. */
- { "DEFT", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" },
+ { "DEFJT", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" },
{ "m", 0, STD_C89, NOARGUMENTS, "", "" },
{ NULL, 0, 0, NOLENGTHS, NULL, NULL }
@@ -852,7 +855,7 @@ static const format_char_info gcc_cxxdiag_char_table[] =
{ "H", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" },
/* These will require a "tree" at runtime. */
- { "ADEFTV",0,STD_C89,{ T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "+#", "" },
+ { "ADEFJTV",0,STD_C89,{ T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "+#", "" },
/* These accept either an `int' or an `enum tree_code' (which is handled as an `int'.) */
{ "CLOPQ",0,STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" },
@@ -2401,19 +2404,24 @@ check_format_types (int *status, format_wanted_type *types)
{
const char *this;
const char *that;
+ tree tmp;
+
+ tmp = TYPE_NAME (wanted_type);
+ if (TREE_CODE (tmp) == TYPE_DECL)
+ tmp = DECL_NAME (tmp);
+ this = IDENTIFIER_POINTER (tmp);
- this = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (wanted_type)));
that = 0;
if (TYPE_NAME (orig_cur_type) != 0
&& TREE_CODE (orig_cur_type) != INTEGER_TYPE
&& !(TREE_CODE (orig_cur_type) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (orig_cur_type)) == INTEGER_TYPE))
{
- if (TREE_CODE (TYPE_NAME (orig_cur_type)) == TYPE_DECL
- && DECL_NAME (TYPE_NAME (orig_cur_type)) != 0)
- that = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (orig_cur_type)));
- else
- that = IDENTIFIER_POINTER (TYPE_NAME (orig_cur_type));
+ tmp = TYPE_NAME (orig_cur_type);
+ if (TREE_CODE (tmp) == TYPE_DECL)
+ tmp = DECL_NAME (tmp);
+ if (tmp)
+ that = IDENTIFIER_POINTER (tmp);
}
/* A nameless type can't possibly match what the format wants.
@@ -2471,7 +2479,6 @@ find_char_info_specifier_index (const format_char_info *fci, int c)
/* We shouldn't be looking for a non-existent specifier. */
abort ();
-
}
/* Given a format_length_info array FLI, and a character C, this
@@ -2604,6 +2611,12 @@ init_dynamic_diag_info (void)
diag_fci[i].types[0].type = &loc;
diag_fci[i].pointer_count = 1;
}
+ if (t)
+ {
+ i = find_char_info_specifier_index (diag_fci, 'J');
+ diag_fci[i].types[0].type = &t;
+ diag_fci[i].pointer_count = 1;
+ }
/* Handle the __gcc_cdiag__ format specifics. */
if (! cdiag_fci)
@@ -2623,6 +2636,9 @@ init_dynamic_diag_info (void)
i = find_char_info_specifier_index (cdiag_fci, 'D');
cdiag_fci[i].types[0].type = &t;
cdiag_fci[i].pointer_count = 1;
+ i = find_char_info_specifier_index (cdiag_fci, 'J');
+ cdiag_fci[i].types[0].type = &t;
+ cdiag_fci[i].pointer_count = 1;
}
/* Handle the __gcc_cxxdiag__ format specifics. */
@@ -2643,6 +2659,9 @@ init_dynamic_diag_info (void)
i = find_char_info_specifier_index (cxxdiag_fci, 'D');
cxxdiag_fci[i].types[0].type = &t;
cxxdiag_fci[i].pointer_count = 1;
+ i = find_char_info_specifier_index (cxxdiag_fci, 'J');
+ cxxdiag_fci[i].types[0].type = &t;
+ cxxdiag_fci[i].pointer_count = 1;
}
}
}
OpenPOWER on IntegriCloud