brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.0 KiB · d02dd7e Raw
100 lines · cpp
1// RUN: %check_clang_tidy -std=c99 %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64-unknown-unknown -x c2// RUN: %check_clang_tidy %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64-unknown-unknown -x c++3 4// RUN: %check_clang_tidy -std=c99 %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64-unknown-unknown -x c -fsigned-char5// RUN: %check_clang_tidy %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64-unknown-unknown -x c++ -fsigned-char6 7// RUN: %check_clang_tidy -std=c99 %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64-unknown-unknown -x c -funsigned-char8// RUN: %check_clang_tidy %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64 c++ -funsigned-char9 10long t0(char a, char b) {11  return a * b;12  // CHECK-NOTES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'long' of a multiplication performed in type 'int'13  // CHECK-NOTES: :[[@LINE-2]]:10: note: make conversion explicit to silence this warning14  // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type15}16unsigned long t1(char a, char b) {17  return a * b;18  // CHECK-NOTES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'unsigned long' of a multiplication performed in type 'int'19  // CHECK-NOTES: :[[@LINE-2]]:10: note: make conversion explicit to silence this warning20  // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type21}22 23long t2(unsigned char a, char b) {24  return a * b;25  // CHECK-NOTES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'long' of a multiplication performed in type 'int'26  // CHECK-NOTES: :[[@LINE-2]]:10: note: make conversion explicit to silence this warning27  // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type28}29unsigned long t3(unsigned char a, char b) {30  return a * b;31  // CHECK-NOTES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'unsigned long' of a multiplication performed in type 'int'32  // CHECK-NOTES: :[[@LINE-2]]:10: note: make conversion explicit to silence this warning33  // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type34}35 36long t4(char a, unsigned char b) {37  return a * b;38  // CHECK-NOTES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'long' of a multiplication performed in type 'int'39  // CHECK-NOTES: :[[@LINE-2]]:10: note: make conversion explicit to silence this warning40  // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type41}42unsigned long t5(char a, unsigned char b) {43  return a * b;44  // CHECK-NOTES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'unsigned long' of a multiplication performed in type 'int'45  // CHECK-NOTES: :[[@LINE-2]]:10: note: make conversion explicit to silence this warning46  // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type47}48 49long t6(unsigned char a, unsigned char b) {50  return a * b;51  // CHECK-NOTES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'long' of a multiplication performed in type 'int'52  // CHECK-NOTES: :[[@LINE-2]]:10: note: make conversion explicit to silence this warning53  // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type54}55unsigned long t7(unsigned char a, unsigned char b) {56  return a * b;57  // CHECK-NOTES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'unsigned long' of a multiplication performed in type 'int'58  // CHECK-NOTES: :[[@LINE-2]]:10: note: make conversion explicit to silence this warning59  // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type60}61 62long t8(signed char a, char b) {63  return a * b;64  // CHECK-NOTES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'long' of a multiplication performed in type 'int'65  // CHECK-NOTES: :[[@LINE-2]]:10: note: make conversion explicit to silence this warning66  // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type67}68unsigned long t9(signed char a, char b) {69  return a * b;70  // CHECK-NOTES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'unsigned long' of a multiplication performed in type 'int'71  // CHECK-NOTES: :[[@LINE-2]]:10: note: make conversion explicit to silence this warning72  // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type73}74 75long t10(char a, signed char b) {76  return a * b;77  // CHECK-NOTES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'long' of a multiplication performed in type 'int'78  // CHECK-NOTES: :[[@LINE-2]]:10: note: make conversion explicit to silence this warning79  // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type80}81unsigned long t11(char a, signed char b) {82  return a * b;83  // CHECK-NOTES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'unsigned long' of a multiplication performed in type 'int'84  // CHECK-NOTES: :[[@LINE-2]]:10: note: make conversion explicit to silence this warning85  // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type86}87 88long t12(signed char a, signed char b) {89  return a * b;90  // CHECK-NOTES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'long' of a multiplication performed in type 'int'91  // CHECK-NOTES: :[[@LINE-2]]:10: note: make conversion explicit to silence this warning92  // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type93}94unsigned long t13(signed char a, signed char b) {95  return a * b;96  // CHECK-NOTES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'unsigned long' of a multiplication performed in type 'int'97  // CHECK-NOTES: :[[@LINE-2]]:10: note: make conversion explicit to silence this warning98  // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type99}100