From b106e3bb6c7fe99a53d12679db8a0315d051f955 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 5 Jul 2015 20:57:55 +0300 Subject: Update test 30. --- test/test30-01.txt | 308 +++++++++++++++++++++++++++++++++++++++++++++++++++++ test/test30-02.txt | 1 + test/test30-03.txt | 62 +++++++++++ test/test30-04.txt | 4 + test/test30-05.txt | 4 + test/test30.cpp | 14 +++ 6 files changed, 393 insertions(+) (limited to 'test') diff --git a/test/test30-01.txt b/test/test30-01.txt index b6f4090..a6ce56b 100644 --- a/test/test30-01.txt +++ b/test/test30-01.txt @@ -1497,3 +1497,311 @@ function_decl func3 test30.cpp 90:10 addr_expr - operand string_cst ptr1 - operand - stringLength: 5 +function_decl func4 test30.cpp 121:10 +- isPublic: 1 + method_type - function type + tree_list - attribute + identifier_node nonnull - purpose + tree_list - value + integer_cst 3 - value + void_type - method return type + type_decl void 0:0 - type name + - isAutogenerated: 1 + record_type - method base type + type_decl Object1 test30.cpp 18:7 - type name + - isAutogenerated: 1 + field_decl tmp1 test30.cpp 20:12 - field + - unsigned + integer_cst 64 - decl size + field_decl tmp2 test30.cpp 21:12 - field + - unsigned + integer_cst 64 - decl size + type_decl Object1 test30.cpp 19:1 - field + - isAutogenerated: 1 + tree_list - arg types + pointer_type - value + record_type - nested type + type_decl Object1 test30.cpp 18:7 - type name + - isAutogenerated: 1 + field_decl tmp1 test30.cpp 20:12 - field + - unsigned + integer_cst 64 - decl size + field_decl tmp2 test30.cpp 21:12 - field + - unsigned + integer_cst 64 - decl size + type_decl Object1 test30.cpp 19:1 - field + - isAutogenerated: 1 + tree_list - chain + pointer_type - value + record_type - nested type + type_decl Data1 test30.cpp 3:8 - type name + - isAutogenerated: 1 + field_decl val test30.cpp 5:9 - field + - signed + integer_cst 32 - decl size + field_decl ptrval test30.cpp 6:12 - field + - unsigned + integer_cst 64 - decl size + field_decl arr test30.cpp 7:14 - field + - signed + integer_cst 96 - decl size + type_decl Data1 test30.cpp 4:1 - field + - isAutogenerated: 1 + tree_list - chain + pointer_type - value + record_type - nested type + type_decl Data1 test30.cpp 3:8 - type name + - isAutogenerated: 1 + field_decl val test30.cpp 5:9 - field + - signed + integer_cst 32 - decl size + field_decl ptrval test30.cpp 6:12 - field + - unsigned + integer_cst 64 - decl size + field_decl arr test30.cpp 7:14 - field + - signed + integer_cst 96 - decl size + type_decl Data1 test30.cpp 4:1 - field + - isAutogenerated: 1 + tree_list - chain + void_type - value + type_decl void 0:0 - type name + - isAutogenerated: 1 + result_decl test30.cpp 122:5 - function result + - isAutogenerated: 1 + void_type - result type + type_decl void 0:0 - type name + - isAutogenerated: 1 + parm_decl this test30.cpp 121:69 - argument + - isAutogenerated: 1 + pointer_type - decl type + record_type - nested type + type_decl Object1 test30.cpp 18:7 - type name + - isAutogenerated: 1 + field_decl tmp1 test30.cpp 20:12 - field + - unsigned + integer_cst 64 - decl size + field_decl tmp2 test30.cpp 21:12 - field + - unsigned + integer_cst 64 - decl size + type_decl Object1 test30.cpp 19:1 - field + - isAutogenerated: 1 + integer_cst 64 - parm size + parm_decl ptr1 test30.cpp 121:23 - argument + pointer_type - decl type + record_type - nested type + type_decl Data1 test30.cpp 3:8 - type name + - isAutogenerated: 1 + field_decl val test30.cpp 5:9 - field + - signed + integer_cst 32 - decl size + field_decl ptrval test30.cpp 6:12 - field + - unsigned + integer_cst 64 - decl size + field_decl arr test30.cpp 7:14 - field + - signed + integer_cst 96 - decl size + type_decl Data1 test30.cpp 4:1 - field + - isAutogenerated: 1 + integer_cst 64 - parm size + - isUsed: 1 + parm_decl ptr2 test30.cpp 121:36 - argument + pointer_type - decl type + record_type - nested type + type_decl Data1 test30.cpp 3:8 - type name + - isAutogenerated: 1 + field_decl val test30.cpp 5:9 - field + - signed + integer_cst 32 - decl size + field_decl ptrval test30.cpp 6:12 - field + - unsigned + integer_cst 64 - decl size + field_decl arr test30.cpp 7:14 - field + - signed + integer_cst 96 - decl size + type_decl Data1 test30.cpp 4:1 - field + - isAutogenerated: 1 + integer_cst 64 - parm size + statement_list - code + cleanup_point_expr test30.cpp 123:62 - statement + expr_stmt test30.cpp 123:62 - operand + call_expr test30.cpp 123:31 - expresssion + addr_expr - function + function_decl paranuckerInternalTest test30.cpp 16:6 - operand + - isExternal: 1 + - isPublic: 1 + function_type - function type + nop_expr - arg + addr_expr - operand + string_cst = - operand + - stringLength: 2 + nop_expr - arg + addr_expr - operand + string_cst knownVars - operand + - stringLength: 10 + nop_expr - arg + addr_expr - operand + string_cst ptr1 ptr2 - operand + - stringLength: 10 + cleanup_point_expr test30.cpp 124:64 - statement + expr_stmt test30.cpp 124:64 - operand + call_expr test30.cpp 124:31 - expresssion + addr_expr - function + function_decl paranuckerInternalTest test30.cpp 16:6 - operand + - isExternal: 1 + - isPublic: 1 + function_type - function type + nop_expr - arg + addr_expr - operand + string_cst = - operand + - stringLength: 2 + nop_expr - arg + addr_expr - operand + string_cst knownNonNullVars - operand + - stringLength: 17 + nop_expr - arg + addr_expr - operand + string_cst ptr2 - operand + - stringLength: 5 + cleanup_point_expr test30.cpp 125:57 - statement + expr_stmt test30.cpp 125:57 - operand + call_expr test30.cpp 125:31 - expresssion + addr_expr - function + function_decl paranuckerInternalTest test30.cpp 16:6 - operand + - isExternal: 1 + - isPublic: 1 + function_type - function type + nop_expr - arg + addr_expr - operand + string_cst = - operand + - stringLength: 2 + nop_expr - arg + addr_expr - operand + string_cst knownNullVars - operand + - stringLength: 14 + nop_expr - arg + addr_expr - operand + string_cst - operand + - stringLength: 1 + cleanup_point_expr test30.cpp 126:65 - statement + expr_stmt test30.cpp 126:65 - operand + call_expr test30.cpp 126:31 - expresssion + addr_expr - function + function_decl paranuckerInternalTest test30.cpp 16:6 - operand + - isExternal: 1 + - isPublic: 1 + function_type - function type + nop_expr - arg + addr_expr - operand + string_cst = - operand + - stringLength: 2 + nop_expr - arg + addr_expr - operand + string_cst needCheckNullVars - operand + - stringLength: 18 + nop_expr - arg + addr_expr - operand + string_cst ptr1 - operand + - stringLength: 5 + if_stmt test30.cpp 127:9 - statement + eq_expr test30.cpp 127:14 - condition + - isUsed: 1 + parm_decl ptr2 test30.cpp 121:36 - operand + pointer_type - decl type + record_type - nested type + type_decl Data1 test30.cpp 3:8 - type name + - isAutogenerated: 1 + field_decl val test30.cpp 5:9 - field + - signed + integer_cst 32 - decl size + field_decl ptrval test30.cpp 6:12 - field + - unsigned + integer_cst 64 - decl size + field_decl arr test30.cpp 7:14 - field + - signed + integer_cst 96 - decl size + type_decl Data1 test30.cpp 4:1 - field + - isAutogenerated: 1 + integer_cst 64 - parm size + integer_cst 0 - operand + return_expr test30.cpp 128:13 - then + cleanup_point_expr test30.cpp 129:62 - statement + expr_stmt test30.cpp 129:62 - operand + call_expr test30.cpp 129:31 - expresssion + addr_expr - function + function_decl paranuckerInternalTest test30.cpp 16:6 - operand + - isExternal: 1 + - isPublic: 1 + function_type - function type + nop_expr - arg + addr_expr - operand + string_cst = - operand + - stringLength: 2 + nop_expr - arg + addr_expr - operand + string_cst knownVars - operand + - stringLength: 10 + nop_expr - arg + addr_expr - operand + string_cst ptr1 ptr2 - operand + - stringLength: 10 + cleanup_point_expr test30.cpp 130:64 - statement + expr_stmt test30.cpp 130:64 - operand + call_expr test30.cpp 130:31 - expresssion + addr_expr - function + function_decl paranuckerInternalTest test30.cpp 16:6 - operand + - isExternal: 1 + - isPublic: 1 + function_type - function type + nop_expr - arg + addr_expr - operand + string_cst = - operand + - stringLength: 2 + nop_expr - arg + addr_expr - operand + string_cst knownNonNullVars - operand + - stringLength: 17 + nop_expr - arg + addr_expr - operand + string_cst ptr2 - operand + - stringLength: 5 + cleanup_point_expr test30.cpp 131:57 - statement + expr_stmt test30.cpp 131:57 - operand + call_expr test30.cpp 131:31 - expresssion + addr_expr - function + function_decl paranuckerInternalTest test30.cpp 16:6 - operand + - isExternal: 1 + - isPublic: 1 + function_type - function type + nop_expr - arg + addr_expr - operand + string_cst = - operand + - stringLength: 2 + nop_expr - arg + addr_expr - operand + string_cst knownNullVars - operand + - stringLength: 14 + nop_expr - arg + addr_expr - operand + string_cst - operand + - stringLength: 1 + cleanup_point_expr test30.cpp 132:65 - statement + expr_stmt test30.cpp 132:65 - operand + call_expr test30.cpp 132:31 - expresssion + addr_expr - function + function_decl paranuckerInternalTest test30.cpp 16:6 - operand + - isExternal: 1 + - isPublic: 1 + function_type - function type + nop_expr - arg + addr_expr - operand + string_cst = - operand + - stringLength: 2 + nop_expr - arg + addr_expr - operand + string_cst needCheckNullVars - operand + - stringLength: 18 + nop_expr - arg + addr_expr - operand + string_cst ptr1 - operand + - stringLength: 5 diff --git a/test/test30-02.txt b/test/test30-02.txt index d047cbf..bcc5597 100644 --- a/test/test30-02.txt +++ b/test/test30-02.txt @@ -2,3 +2,4 @@ getData: func1: pointer_type ptr1, func2: pointer_type ptr1, func3: pointer_type ptr1, +func4: pointer_type ptr1, diff --git a/test/test30-03.txt b/test/test30-03.txt index a06b844..4290a8a 100644 --- a/test/test30-03.txt +++ b/test/test30-03.txt @@ -388,3 +388,65 @@ expr_stmt : ptr1, call_expr : ptr1, addr_expr : ptr1, function_decl paranuckerInternalTest: ptr1, +function_decl func4: +statement_list : ptr1, +cleanup_point_expr : ptr1, +expr_stmt : ptr1, +call_expr : ptr1, +addr_expr : ptr1, +function_decl paranuckerInternalTest: ptr1, +cleanup_point_expr : ptr1, +expr_stmt : ptr1, +call_expr : ptr1, +addr_expr : ptr1, +function_decl paranuckerInternalTest: ptr1, +cleanup_point_expr : ptr1, +expr_stmt : ptr1, +call_expr : ptr1, +addr_expr : ptr1, +function_decl paranuckerInternalTest: ptr1, +cleanup_point_expr : ptr1, +expr_stmt : ptr1, +call_expr : ptr1, +addr_expr : ptr1, +function_decl paranuckerInternalTest: ptr1, +if_stmt : ptr1, +eq_expr : ptr1, +test30.cpp: In member function 'void Object1::func4(Data1*, Data1*)': +test30.cpp:127:14: warning: Useless variable check 'ptr2'. It already was checked before + if (!ptr2) + ^ +parm_decl ptr2: ptr1, +pointer_type : ptr1, +record_type : ptr1, +type_decl Data1: ptr1, +field_decl val: ptr1, +integer_cst 32: ptr1, +field_decl ptrval: ptr1, +integer_cst 64: ptr1, +field_decl arr: ptr1, +integer_cst 96: ptr1, +type_decl Data1: ptr1, +integer_cst 64: ptr1, +integer_cst 0: ptr1, +return_expr : ptr1, +cleanup_point_expr : ptr1, +expr_stmt : ptr1, +call_expr : ptr1, +addr_expr : ptr1, +function_decl paranuckerInternalTest: ptr1, +cleanup_point_expr : ptr1, +expr_stmt : ptr1, +call_expr : ptr1, +addr_expr : ptr1, +function_decl paranuckerInternalTest: ptr1, +cleanup_point_expr : ptr1, +expr_stmt : ptr1, +call_expr : ptr1, +addr_expr : ptr1, +function_decl paranuckerInternalTest: ptr1, +cleanup_point_expr : ptr1, +expr_stmt : ptr1, +call_expr : ptr1, +addr_expr : ptr1, +function_decl paranuckerInternalTest: ptr1, diff --git a/test/test30-04.txt b/test/test30-04.txt index e06b836..a87c713 100644 --- a/test/test30-04.txt +++ b/test/test30-04.txt @@ -2,3 +2,7 @@ test30.cpp: In member function 'void Object1::func2(Data1*)': test30.cpp:69:28: warning: Using parameter 'ptr1' without checking for null pointer if (!ptr1 && ptr1->val == 10) ^ +test30.cpp: In member function 'void Object1::func4(Data1*, Data1*)': +test30.cpp:127:14: warning: Useless variable check 'ptr2'. It already was checked before + if (!ptr2) + ^ diff --git a/test/test30-05.txt b/test/test30-05.txt index e06b836..a87c713 100644 --- a/test/test30-05.txt +++ b/test/test30-05.txt @@ -2,3 +2,7 @@ test30.cpp: In member function 'void Object1::func2(Data1*)': test30.cpp:69:28: warning: Using parameter 'ptr1' without checking for null pointer if (!ptr1 && ptr1->val == 10) ^ +test30.cpp: In member function 'void Object1::func4(Data1*, Data1*)': +test30.cpp:127:14: warning: Useless variable check 'ptr2'. It already was checked before + if (!ptr2) + ^ diff --git a/test/test30.cpp b/test/test30.cpp index b2e049c..ce03b59 100644 --- a/test/test30.cpp +++ b/test/test30.cpp @@ -117,4 +117,18 @@ class Object1 paranuckerInternalTest("=", "knownNullVars", ""); paranuckerInternalTest("=", "needCheckNullVars", "ptr1"); } + + void func4(Data1 *ptr1, Data1 *ptr2) __attribute__((nonnull (3))) + { + paranuckerInternalTest("=", "knownVars", "ptr1 ptr2"); + paranuckerInternalTest("=", "knownNonNullVars", "ptr2"); + paranuckerInternalTest("=", "knownNullVars", ""); + paranuckerInternalTest("=", "needCheckNullVars", "ptr1"); + if (!ptr2) + return; + paranuckerInternalTest("=", "knownVars", "ptr1 ptr2"); + paranuckerInternalTest("=", "knownNonNullVars", "ptr2"); + paranuckerInternalTest("=", "knownNullVars", ""); + paranuckerInternalTest("=", "needCheckNullVars", "ptr1"); + } }; -- cgit v1.2.3-70-g09d2