forked from KindDragon/vld
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding tests for static initializers, and a fix that avoids false pos…
…itives from C++ statics
- Loading branch information
Showing
16 changed files
with
712 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
|
||
#define VLDVERSION L"2.5.5" | ||
#define VERSION_NUMBER 2,5,5,0 | ||
#define VERSION_STRING "2.5.5.0" | ||
#define VLDVERSION L"2.5.6" | ||
#define VERSION_NUMBER 2,5,6,0 | ||
#define VERSION_STRING "2.5.6.0" | ||
#define VERSION_COPYRIGHT "Copyright (C) 2005-2020" | ||
|
||
#ifndef __FILE__ | ||
!define VLD_VERSION "2.5.5" // NSIS Script | ||
!define VLD_VERSION "2.5.6" // NSIS Script | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
namespace my_string | ||
{ | ||
const std::string the_string("foobar"); | ||
} | ||
|
||
const std::string string_global("xyz1234567"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// static_string_test.cpp : Defines the entry point for the console application. | ||
// | ||
|
||
#include "stdafx.h" | ||
#include "vld.h" | ||
#include "static_string.h" | ||
|
||
void access_strings() | ||
{ | ||
// Just do something with the string so it isn't optimized away | ||
std::string copied_string = my_string::the_string; | ||
printf("Copied string %s\n", copied_string.c_str()); | ||
|
||
std::string copied_string2 = string_global; | ||
printf("Copied string %s\n", copied_string2.c_str()); | ||
} | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
access_strings(); | ||
|
||
int leaks = static_cast<int>(VLDGetLeaksCount()); | ||
if (0 != leaks) | ||
{ | ||
printf("!!! FAILED - Leaks detected: %i\n", leaks); | ||
VLDReportLeaks(); | ||
} | ||
else | ||
{ | ||
printf("PASSED\n"); | ||
} | ||
|
||
|
||
return leaks; | ||
} |
Oops, something went wrong.