Skip to content

Commit ead61bd

Browse files
authored
Merge pull request cpputest#1137 from jgonzalezdr/fixClangErrors2
Fix clang 5.0.0 errors
2 parents 886a525 + 87a6909 commit ead61bd

File tree

85 files changed

+500
-483
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+500
-483
lines changed

‎appveyor.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ environment:
2424
PlatformToolset: v90
2525
- Platform: Win32
2626
PlatformToolset: v100
27+
- Platform: Win32
28+
PlatformToolset: v110
29+
- Platform: Win32
30+
PlatformToolset: v120
2731
- Platform: Win32
2832
PlatformToolset: v140
2933
- Platform: x64

‎include/CppUTest/CommandLineArguments.h‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class TestPlugin;
3737
class CommandLineArguments
3838
{
3939
public:
40-
explicit CommandLineArguments(int ac, const char** av);
40+
explicit CommandLineArguments(int ac, const char *const *av);
4141
virtual ~CommandLineArguments();
4242

4343
bool parse(TestPlugin* plugin);
@@ -63,7 +63,7 @@ class CommandLineArguments
6363
OUTPUT_ECLIPSE, OUTPUT_JUNIT, OUTPUT_TEAMCITY
6464
};
6565
int ac_;
66-
const char** av_;
66+
const char *const *av_;
6767

6868
bool verbose_;
6969
bool color_;
@@ -77,19 +77,19 @@ class CommandLineArguments
7777
OutputType outputType_;
7878
SimpleString packageName_;
7979

80-
SimpleString getParameterField(int ac, const char** av, int& i, const SimpleString& parameterName);
81-
void SetRepeatCount(int ac, const char** av, int& index);
82-
void AddGroupFilter(int ac, const char** av, int& index);
83-
void AddStrictGroupFilter(int ac, const char** av, int& index);
84-
void AddExcludeGroupFilter(int ac, const char** av, int& index);
85-
void AddExcludeStrictGroupFilter(int ac, const char** av, int& index);
86-
void AddNameFilter(int ac, const char** av, int& index);
87-
void AddStrictNameFilter(int ac, const char** av, int& index);
88-
void AddExcludeNameFilter(int ac, const char** av, int& index);
89-
void AddExcludeStrictNameFilter(int ac, const char** av, int& index);
90-
void AddTestToRunBasedOnVerboseOutput(int ac, const char** av, int& index, const char* parameterName);
91-
bool SetOutputType(int ac, const char** av, int& index);
92-
void SetPackageName(int ac, const char** av, int& index);
80+
SimpleString getParameterField(int ac, const char *const *av, int& i, const SimpleString& parameterName);
81+
void SetRepeatCount(int ac, const char *const *av, int& index);
82+
void AddGroupFilter(int ac, const char *const *av, int& index);
83+
void AddStrictGroupFilter(int ac, const char *const *av, int& index);
84+
void AddExcludeGroupFilter(int ac, const char *const *av, int& index);
85+
void AddExcludeStrictGroupFilter(int ac, const char *const *av, int& index);
86+
void AddNameFilter(int ac, const char *const *av, int& index);
87+
void AddStrictNameFilter(int ac, const char *const *av, int& index);
88+
void AddExcludeNameFilter(int ac, const char *const *av, int& index);
89+
void AddExcludeStrictNameFilter(int ac, const char *const *av, int& index);
90+
void AddTestToRunBasedOnVerboseOutput(int ac, const char *const *av, int& index, const char* parameterName);
91+
bool SetOutputType(int ac, const char *const *av, int& index);
92+
void SetPackageName(int ac, const char *const *av, int& index);
9393

9494
CommandLineArguments(const CommandLineArguments&);
9595
CommandLineArguments& operator=(const CommandLineArguments&);

‎include/CppUTest/CommandLineTestRunner.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ class TestRegistry;
4141
class CommandLineTestRunner
4242
{
4343
public:
44-
static int RunAllTests(int ac, const char** av);
44+
static int RunAllTests(int ac, const char *const *av);
4545
static int RunAllTests(int ac, char** av);
4646

47-
CommandLineTestRunner(int ac, const char** av, TestRegistry* registry);
47+
CommandLineTestRunner(int ac, const char *const *av, TestRegistry* registry);
4848
virtual ~CommandLineTestRunner();
4949

5050
int runAllTestsMain();

‎include/CppUTest/CppUTestConfig.h‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,17 @@ typedef struct cpputest_ulonglong cpputest_ulonglong;
267267
#if defined(__cplusplus) && ((__cplusplus >= 201103L) || (defined(_MSC_VER) && (_MSC_VER >= 1600)))
268268
#define CPPUTEST_COMPILER_FULLY_SUPPORTS_CXX11
269269
#define _override override
270+
#define NULLPTR nullptr
270271
#else
271272
#define _override
273+
#define NULLPTR NULL
274+
#endif
275+
276+
/* Visual C++ 11.0+ (2012+) supports the override keyword on destructors */
277+
#if defined(__cplusplus) && ((__cplusplus >= 201103L) || (defined(_MSC_VER) && (_MSC_VER >= 1700)))
278+
#define _destructor_override override
279+
#else
280+
#define _destructor_override
272281
#endif
273282

274283
/* MinGW-w64 prefers to act like Visual C++, but we want the ANSI behaviors instead */
@@ -279,4 +288,5 @@ typedef struct cpputest_ulonglong cpputest_ulonglong;
279288
#pragma clang diagnostic pop
280289
#endif
281290

291+
282292
#endif

‎include/CppUTest/JUnitTestOutput.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class JUnitTestOutput: public TestOutput
3838
{
3939
public:
4040
JUnitTestOutput();
41-
virtual ~JUnitTestOutput();
41+
virtual ~JUnitTestOutput() _destructor_override;
4242

4343
virtual void printTestsStarted() _override;
4444
virtual void printTestsEnded(const TestResult& result) _override;

‎include/CppUTest/MemoryLeakDetector.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class MemoryLeakOutputStringBuffer
117117
struct MemoryLeakDetectorNode
118118
{
119119
MemoryLeakDetectorNode() :
120-
size_(0), number_(0), memory_(0), file_(0), line_(0), allocator_(0), period_(mem_leak_period_enabled), next_(0)
120+
size_(0), number_(0), memory_(NULLPTR), file_(NULLPTR), line_(0), allocator_(NULLPTR), period_(mem_leak_period_enabled), next_(NULLPTR)
121121
{
122122
}
123123

@@ -139,7 +139,7 @@ struct MemoryLeakDetectorNode
139139
struct MemoryLeakDetectorList
140140
{
141141
MemoryLeakDetectorList() :
142-
head_(0)
142+
head_(NULLPTR)
143143
{}
144144

145145
void addNewNode(MemoryLeakDetectorNode* node);

‎include/CppUTest/MemoryLeakWarningPlugin.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class MemoryLeakFailure;
4242
class MemoryLeakWarningPlugin: public TestPlugin
4343
{
4444
public:
45-
MemoryLeakWarningPlugin(const SimpleString& name, MemoryLeakDetector* localDetector = 0);
46-
virtual ~MemoryLeakWarningPlugin();
45+
MemoryLeakWarningPlugin(const SimpleString& name, MemoryLeakDetector* localDetector = NULLPTR);
46+
virtual ~MemoryLeakWarningPlugin() _destructor_override;
4747

4848
virtual void preTestAction(UtestShell& test, TestResult& result) _override;
4949
virtual void postTestAction(UtestShell& test, TestResult& result) _override;

‎include/CppUTest/SimpleString.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class SimpleString
9797
static size_t StrLen(const char*);
9898
static int StrNCmp(const char* s1, const char* s2, size_t n);
9999
static char* StrNCpy(char* s1, const char* s2, size_t n);
100-
static char* StrStr(const char* s1, const char* s2);
100+
static const char* StrStr(const char* s1, const char* s2);
101101
static char ToLower(char ch);
102102
static int MemCmp(const void* s1, const void *s2, size_t n);
103103
static char* allocStringBuffer(size_t size, const char* file, int line);

‎include/CppUTest/TeamCityTestOutput.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class TeamCityTestOutput: public ConsoleTestOutput
88
{
99
public:
1010
TeamCityTestOutput(void);
11-
virtual ~TeamCityTestOutput(void);
11+
virtual ~TeamCityTestOutput(void) _destructor_override;
1212

1313
virtual void printCurrentTestStarted(const UtestShell& test) _override;
1414
virtual void printCurrentTestEnded(const TestResult& res) _override;

‎include/CppUTest/TestMemoryAllocator.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ class TestMemoryAllocator
5656
virtual char* alloc_memory(size_t size, const char* file, int line);
5757
virtual void free_memory(char* memory, const char* file, int line);
5858

59-
virtual const char* name();
60-
virtual const char* alloc_name();
61-
virtual const char* free_name();
59+
virtual const char* name() const;
60+
virtual const char* alloc_name() const;
61+
virtual const char* free_name() const;
6262

6363
virtual bool isOfEqualType(TestMemoryAllocator* allocator);
6464

0 commit comments

Comments
 (0)