2018-04-13 22:19:47 +02:00
|
|
|
// To test:
|
2018-04-16 13:55:12 +02:00
|
|
|
// ~/cppcheck/cppcheck --dump misc-test.cpp && python ../misc.py -verify misc-test.cpp.dump
|
2018-04-13 22:19:47 +02:00
|
|
|
|
2020-11-15 12:46:12 +01:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2018-04-16 13:55:12 +02:00
|
|
|
// Warn about string concatenation in array initializers..
|
2018-04-20 08:18:49 +02:00
|
|
|
const char *a[] = {"a" "b"}; // stringConcatInArrayInit
|
2018-04-16 10:53:29 +02:00
|
|
|
const char *b[] = {"a","b" "c"}; // stringConcatInArrayInit
|
2018-04-28 23:01:29 +02:00
|
|
|
#define MACRO "MACRO"
|
|
|
|
const char *c[] = { MACRO "text" }; // stringConcatInArrayInit
|
2018-04-16 13:16:53 +02:00
|
|
|
|
2018-04-16 13:55:12 +02:00
|
|
|
|
|
|
|
// Function is implicitly virtual
|
2018-04-16 13:16:53 +02:00
|
|
|
class base {
|
|
|
|
virtual void dostuff(int);
|
|
|
|
};
|
|
|
|
|
|
|
|
class derived : base {
|
|
|
|
void dostuff(int); // implicitlyVirtual
|
|
|
|
};
|
2018-04-16 13:55:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
// Pass struct to ellipsis function
|
|
|
|
struct {int x;int y;} s;
|
|
|
|
void ellipsis(int x, ...);
|
2018-04-19 22:23:34 +02:00
|
|
|
void foo(std::vector<std::string> v) {
|
2018-04-16 13:55:12 +02:00
|
|
|
ellipsis(321, s); // ellipsisStructArg
|
2018-04-19 22:23:34 +02:00
|
|
|
ellipsis(321, v[0]); // ellipsisStructArg
|
2018-04-16 13:55:12 +02:00
|
|
|
}
|