1 // To test: 2 // ~/cppcheck/cppcheck --dump misc-test.cpp && python ../misc.py -verify misc-test.cpp.dump 3 4 #include <string> 5 #include <vector> 6 7 // Warn about string concatenation in array initializers.. 8 const char *a[] = {"a" "b"}; // stringConcatInArrayInit 9 const char *b[] = {"a","b" "c"}; // stringConcatInArrayInit 10 #define MACRO "MACRO" 11 const char *c[] = { MACRO "text" }; // stringConcatInArrayInit 12 13 14 // Function is implicitly virtual 15 class base { 16 virtual void dostuff(int); 17 }; 18 19 class derived : base { 20 void dostuff(int); // implicitlyVirtual 21 }; 22 23 24 // Pass struct to ellipsis function 25 struct {int x;int y;} s; 26 void ellipsis(int x, ...); foo(std::vector<std::string> v)27void foo(std::vector<std::string> v) { 28 ellipsis(321, s); // ellipsisStructArg 29 ellipsis(321, v[0]); // ellipsisStructArg 30 } 31