OSDN Git Service

* c-common.c (c_format_attribute_table): Make format and
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Oct 2001 07:19:47 +0000 (07:19 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Oct 2001 07:19:47 +0000 (07:19 +0000)
commite9a0f285818ea3e0f7f5630ecb22d4b358f7eeed
tree08f1b7a84cfb385dccaaf67b7162f37545d3fd09
parent0578fbbccf460796a8af7c0145f0a9630227c2ab
* c-common.c (c_format_attribute_table): Make format and
format_arg attributes apply to function types rather than to
decls.
(is_valid_printf_arglist): Construct an attribute list and pass
that to check_function_format rather than a name.
* c-common.h (check_function_format): Adjust prototype.
* c-decl.c (duplicate_decls): Preserve attributes from type of
built-in decl when allowing for harmless conflict in types.
* c-format.c (record_function_format,
record_international_format, function_format_list,
international_format_info, international_format_list): Remove.
(function_format_info): Remove next, name and assembler_name.
Make format_num and first_arg_num be unsigned HOST_WIDE_INT.
(decode_format_attr): New.
(handle_format_attribute): Handle receiving a type rather than a
decl.  Call decode_format_attr.  Store format information in a
function_format_info.
(handle_format_arg_attribute): Correct comment.  Handle receiving
a type rather than a decl.  Use unsigned HOST_WIDE_INT for
arg_num.
(check_format_info_recurse, check_format_info_main): Take argument
numbers as unsigned HOST_WIDE_INT.
(check_function_format): Take a list of attributes from the
function type rather than a name or assembler name.  Check for
format attributes in that list and the attributes on the type of
the current function rather than looking through
function_format_list.
(check_format_info): Use unsigned HOST_WIDE_INT for argument
numbers.
(check_format_info_recurse): Take format_arg attributes from the
type of the function calls rather than using
international_format_list.  Allow for multiple format_arg
attributes.
* c-typeck.c (build_function_call): Pass type attributes to
check_function_format rather than name or assembler name.  Don't
require there to be a name or assembler name to check formats.

cp:
* call.c (build_over_call), typeck.c (build_function_call_real):
Pass type attributes to check_function_format rather than name or
assembler name.  Don't require there to be a name or assembler
name to check formats.

testsuite:
* g++.dg/warn/format2.C, gcc.dg/format/attr-7.c,
gcc.dg/format/multattr-1.c, gcc.dg/format/multattr-2.c,
gcc.dg/format/multattr-3.c: New tests.
* gcc.dg/format/attr-3.c: Update expected error texts.  Remove
tests for format attributes on function pointers being rejected.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45945 138bc75d-0d04-0410-961f-82ee72b054a4
16 files changed:
gcc/ChangeLog
gcc/c-common.c
gcc/c-common.h
gcc/c-decl.c
gcc/c-format.c
gcc/c-typeck.c
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/format2.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/format/attr-3.c
gcc/testsuite/gcc.dg/format/attr-7.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/format/multattr-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/format/multattr-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/format/multattr-3.c [new file with mode: 0644]