re PR c/54381 (-Wsizeof-pointer-memaccess refers to "destination" for strncmp)
PR c/54381 * c-common.h (sizeof_pointer_memaccess_warning): Adjust prototype. * c-common.c (sizeof_pointer_memaccess_warning): Take array of 3 locs and array of 3 trees instead of just single loc and single sizeof_arg tree. Handle __builtin___*_chk builtins too, and also stpncpy, bcopy, bcmp, bzero, snprintf and vsnprintf builtins. For *cmp* builtins that take two sources strings report warnings about first and second source, not about destination and source. * c-parser.c (struct c_tree_loc_pair): Removed. (c_parser_expr_list): Remove struct c_tree_loc_pair * argument, add location_t * and tree * arguments, fill in array of 3 sizeof_arg trees and corresponding locs. (c_parser_attributes, c_parser_objc_keywordexpr): Adjust c_parser_expr_list callers. (c_parser_postfix_expression_after_primary): Likewise. Pass array of 3 sizeof_arg trees and locs (corresponding to first 3 arguments) to sizeof_pointer_memaccess_warning. * semantics.c (finish_call_expr): Pass array of 3 sizeof_arg trees and locs (corresponding to first 3 arguments) to sizeof_pointer_memaccess_warning. * c-c++-common/Wsizeof-pointer-memaccess1.c: New test. * c-c++-common/Wsizeof-pointer-memaccess2.c: New test. * gcc.dg/Wsizeof-pointer-memaccess1.c: New test. * gcc.dg/torture/Wsizeof-pointer-memaccess1.c: Test also stpncpy. Adjust expected wording of warnings for *cmp* builtins. * g++.dg/torture/Wsizeof-pointer-memaccess1.C: Likewise. * g++.dg/torture/Wsizeof-pointer-memaccess2.C: Likewise. From-SVN: r192406
Showing
- gcc/c-family/ChangeLog 11 additions, 0 deletionsgcc/c-family/ChangeLog
- gcc/c-family/c-common.c 152 additions, 16 deletionsgcc/c-family/c-common.c
- gcc/c-family/c-common.h 2 additions, 2 deletionsgcc/c-family/c-common.h
- gcc/c/ChangeLog 13 additions, 0 deletionsgcc/c/ChangeLog
- gcc/c/c-parser.c 36 additions, 35 deletionsgcc/c/c-parser.c
- gcc/cp/ChangeLog 7 additions, 0 deletionsgcc/cp/ChangeLog
- gcc/cp/semantics.c 21 additions, 7 deletionsgcc/cp/semantics.c
- gcc/testsuite/ChangeLog 11 additions, 0 deletionsgcc/testsuite/ChangeLog
- gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess1.c 161 additions, 0 deletionsgcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess1.c
- gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess2.c 482 additions, 0 deletionsgcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess2.c
- gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess1.C 63 additions, 49 deletionsgcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess1.C
- gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess2.C 65 additions, 51 deletionsgcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess2.C
- gcc/testsuite/gcc.dg/Wsizeof-pointer-memaccess1.c 456 additions, 0 deletionsgcc/testsuite/gcc.dg/Wsizeof-pointer-memaccess1.c
- gcc/testsuite/gcc.dg/torture/Wsizeof-pointer-memaccess1.c 63 additions, 49 deletionsgcc/testsuite/gcc.dg/torture/Wsizeof-pointer-memaccess1.c
Loading
Please register or sign in to comment