-
- Downloads
c-common.c (c_format_attribute_table): Make format and format_arg attributes...
c-common.c (c_format_attribute_table): Make format and format_arg attributes apply to function types rather than to decls. * 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. From-SVN: r45945
Showing
- gcc/ChangeLog 39 additions, 0 deletionsgcc/ChangeLog
- gcc/c-common.c 14 additions, 5 deletionsgcc/c-common.c
- gcc/c-common.h 1 addition, 1 deletiongcc/c-common.h
- gcc/c-decl.c 4 additions, 0 deletionsgcc/c-decl.c
- gcc/c-format.c 142 additions, 218 deletionsgcc/c-format.c
- gcc/c-typeck.c 2 additions, 2 deletionsgcc/c-typeck.c
- gcc/cp/ChangeLog 7 additions, 0 deletionsgcc/cp/ChangeLog
- gcc/cp/call.c 3 additions, 3 deletionsgcc/cp/call.c
- gcc/cp/typeck.c 2 additions, 2 deletionsgcc/cp/typeck.c
- gcc/testsuite/ChangeLog 8 additions, 0 deletionsgcc/testsuite/ChangeLog
- gcc/testsuite/g++.dg/warn/format2.C 32 additions, 0 deletionsgcc/testsuite/g++.dg/warn/format2.C
- gcc/testsuite/gcc.dg/format/attr-3.c 6 additions, 14 deletionsgcc/testsuite/gcc.dg/format/attr-3.c
- gcc/testsuite/gcc.dg/format/attr-7.c 34 additions, 0 deletionsgcc/testsuite/gcc.dg/format/attr-7.c
- gcc/testsuite/gcc.dg/format/multattr-1.c 50 additions, 0 deletionsgcc/testsuite/gcc.dg/format/multattr-1.c
- gcc/testsuite/gcc.dg/format/multattr-2.c 39 additions, 0 deletionsgcc/testsuite/gcc.dg/format/multattr-2.c
- gcc/testsuite/gcc.dg/format/multattr-3.c 28 additions, 0 deletionsgcc/testsuite/gcc.dg/format/multattr-3.c
Loading
Please register or sign in to comment