Browse Source

Fix C4273 warnings about inconsistent dll linkage (#1491)

pull/1493/head
josetr 5 years ago committed by GitHub
parent
commit
bc8fb5caeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      tests/CLI/CLI.cpp
  2. 2
      tests/CLI/CLI.h
  3. 90
      tests/Common/Common.cpp
  4. 83
      tests/Common/Common.h

2
tests/CLI/CLI.cpp

@ -5,6 +5,8 @@ int Types::AttributedSum(int A, int B) @@ -5,6 +5,8 @@ int Types::AttributedSum(int A, int B)
return A + B;
}
TestProtectedDestructors::~TestProtectedDestructors() {}
std::string Date::testStdString(std::string s)
{
return s + "_test";

2
tests/CLI/CLI.h

@ -32,8 +32,6 @@ class DLL_API TestProtectedDestructors @@ -32,8 +32,6 @@ class DLL_API TestProtectedDestructors
~TestProtectedDestructors();
};
TestProtectedDestructors::~TestProtectedDestructors() {}
// Tests the insertion operator (<<) to ToString method pass
class DLL_API Date
{

90
tests/Common/Common.cpp

@ -358,6 +358,10 @@ Bar indirectReturn() @@ -358,6 +358,10 @@ Bar indirectReturn()
return Bar();
}
TestDelegates::TestDelegates() : A(Double), B(Double), C(&TestDelegates::Triple)
{
}
int TestDelegates::Double(int N)
{
return N * 2;
@ -449,6 +453,10 @@ int operator *(TestMoveOperatorToClass klass, int b) @@ -449,6 +453,10 @@ int operator *(TestMoveOperatorToClass klass, int b)
return klass.A * b;
}
TestMoveOperatorToClass::TestMoveOperatorToClass()
{
}
TestMoveOperatorToClass operator-(const TestMoveOperatorToClass& b)
{
TestMoveOperatorToClass nb;
@ -835,6 +843,32 @@ void HasOverridenSetter::setVirtualGetter(int value) @@ -835,6 +843,32 @@ void HasOverridenSetter::setVirtualGetter(int value)
{
}
TestIndexedProperties::TestIndexedProperties() : p(1), f()
{
}
foo_t& TestIndexedProperties::operator[](int i) { return p; }
const TestProperties& TestIndexedProperties::operator[](short b) { return f; }
foo_t TestIndexedProperties::operator[](const char* name) { return p; }
foo_t* TestIndexedProperties::operator[](float f) { return &p; }
TestProperties* TestIndexedProperties::operator[](unsigned char b) { return &f; }
Bar& TestIndexedProperties::operator[](unsigned long i)
{
return bar;
}
Bar& TestIndexedProperties::operator[](const TypeMappedIndex& key)
{
return bar;
}
const foo_t& TestIndexedProperties::operator[](double f) { return p; }
foo_t TestIndexedProperties::operator[](TestProperties b) { return p; }
int TestIndexedProperties::operator[](CS_OUT char key)
{
return key;
}
TypeMappedIndex::TypeMappedIndex()
{
}
@ -855,6 +889,12 @@ TestWideStrings::TestWideStrings() @@ -855,6 +889,12 @@ TestWideStrings::TestWideStrings()
{
}
LPCWSTR TestWideStrings::GetWidePointer() { return L"Hello"; }
LPCWSTR TestWideStrings::GetWideNullPointer() { return 0; }
TestFixedArrays::TestFixedArrays() {}
InternalCtorAmbiguity::InternalCtorAmbiguity(void* param)
{
// cause a crash to indicate this is the incorrect ctor to invoke
@ -1166,11 +1206,27 @@ void sMallFollowedByCapital() @@ -1166,11 +1206,27 @@ void sMallFollowedByCapital()
{
}
TestNotStaticClass::TestNotStaticClass()
{
}
TestNotStaticClass TestNotStaticClass::StaticFunction()
{
return TestNotStaticClass();
}
int TestStaticClass::Add(int a, int b) { return a + b; }
int TestStaticClass::GetOneTwoThree() { return 123; }
int TestStaticClass::_Mult(int a, int b) { return a * b; }
int TestStaticClass::GetFourFiveSix() { return 456; }
TestStaticClass& TestStaticClass::operator=(const TestStaticClass& oth)
{
return *this;
}
int TestStaticClassDerived::Foo() { return 0; }
HasCopyAndMoveConstructor::HasCopyAndMoveConstructor(int value)
{
field = value;
@ -1358,6 +1414,9 @@ TestGetterSetterToProperties::TestGetterSetterToProperties() @@ -1358,6 +1414,9 @@ TestGetterSetterToProperties::TestGetterSetterToProperties()
{
}
int TestGetterSetterToProperties::getWidth() { return 640; }
int TestGetterSetterToProperties::getHeight() { return 480; }
PointerToTypedefPointerTest::PointerToTypedefPointerTest()
{
}
@ -1371,3 +1430,34 @@ void DLL_API PointerToPrimitiveTypedefPointerTestMethod(LPINT lp, int valToSet) @@ -1371,3 +1430,34 @@ void DLL_API PointerToPrimitiveTypedefPointerTestMethod(LPINT lp, int valToSet)
{
*lp = valToSet;
}
TestArraysPointers::TestArraysPointers(MyEnum* values, int count)
{
if (values && count) Value = values[0];
}
TestCopyConstructorRef::TestCopyConstructorRef()
{
}
TestCopyConstructorRef::TestCopyConstructorRef(const TestCopyConstructorRef& other)
{
A = other.A;
B = other.B;
}
SomeStruct::SomeStruct() : p(1) {}
ClassWithOverloadedOperators::ClassWithOverloadedOperators() {
}
ClassWithOverloadedOperators::ClassWithOverloadedOperators::operator char() { return 1; }
ClassWithOverloadedOperators::operator int() { return 2; }
ClassWithOverloadedOperators::operator short() { return 3; }
bool ClassWithOverloadedOperators::operator<(const ClassWithOverloadedOperators& other) const {
return true;
}
int TestIndexedPropertiesInValueType::operator[](int i) { return i; }

83
tests/Common/Common.h

@ -344,8 +344,6 @@ struct DLL_API TestMoveOperatorToClass @@ -344,8 +344,6 @@ struct DLL_API TestMoveOperatorToClass
int B;
};
TestMoveOperatorToClass::TestMoveOperatorToClass() {}
DLL_API int operator *(TestMoveOperatorToClass klass, int b);
DLL_API TestMoveOperatorToClass operator-(const TestMoveOperatorToClass& b);
@ -392,10 +390,6 @@ struct DLL_API TestDelegates @@ -392,10 +390,6 @@ struct DLL_API TestDelegates
MemberDelegate C;
};
TestDelegates::TestDelegates() : A(Double), B(Double), C(&TestDelegates::Triple)
{
}
namespace DelegateNamespace
{
namespace Nested
@ -437,14 +431,6 @@ private: @@ -437,14 +431,6 @@ private:
TestStaticClass();
};
int TestStaticClass::Add(int a, int b) { return a + b; }
int TestStaticClass::GetOneTwoThree() { return 123; }
int TestStaticClass::_Mult(int a, int b) { return a * b; }
int TestStaticClass::GetFourFiveSix() { return 456; }
struct DLL_API TestStaticClassDerived : TestStaticClass
{
static int Foo();
@ -453,8 +439,6 @@ private: @@ -453,8 +439,6 @@ private:
TestStaticClassDerived();
};
int TestStaticClassDerived::Foo() { return 0; }
class DLL_API TestNotStaticClass
{
public:
@ -463,15 +447,6 @@ private: @@ -463,15 +447,6 @@ private:
TestNotStaticClass();
};
TestNotStaticClass::TestNotStaticClass()
{
}
TestNotStaticClass TestNotStaticClass::StaticFunction()
{
return TestNotStaticClass();
}
class HasIgnoredField
{
Base<Derived> fieldOfIgnoredType;
@ -498,16 +473,6 @@ public: @@ -498,16 +473,6 @@ public:
float B;
};
TestCopyConstructorRef::TestCopyConstructorRef()
{
}
TestCopyConstructorRef::TestCopyConstructorRef(const TestCopyConstructorRef& other)
{
A = other.A;
B = other.B;
}
template <class T>
struct EmptyNamedNestedEnum
{
@ -521,8 +486,6 @@ typedef struct DLL_API SomeStruct @@ -521,8 +486,6 @@ typedef struct DLL_API SomeStruct
foo_t p;
} SomeStruct;
SomeStruct::SomeStruct() : p(1) {}
class DLL_API SomeClassExtendingTheStruct : public SomeStruct
{
};
@ -550,15 +513,6 @@ public: @@ -550,15 +513,6 @@ public:
virtual bool operator<(const ClassWithOverloadedOperators &other) const;
};
ClassWithOverloadedOperators::ClassWithOverloadedOperators() {}
ClassWithOverloadedOperators::operator char() { return 1; }
ClassWithOverloadedOperators::operator int() { return 2; }
ClassWithOverloadedOperators::operator short() { return 3; }
bool ClassWithOverloadedOperators::
operator<(const ClassWithOverloadedOperators &other) const {
return true;
}
// Tests global static function generation
DLL_API int Function();
@ -696,36 +650,12 @@ private: @@ -696,36 +650,12 @@ private:
Bar bar;
};
TestIndexedProperties::TestIndexedProperties() : p(1), f() {}
foo_t& TestIndexedProperties::operator[](int i) { return p; }
foo_t TestIndexedProperties::operator[](const char* name) { return p; }
foo_t* TestIndexedProperties::operator[](float f) { return &p; }
const foo_t& TestIndexedProperties::operator[](double f) { return p; }
TestProperties* TestIndexedProperties::operator[](unsigned char b) { return &f; }
const TestProperties& TestIndexedProperties::operator[](short b) { return f; }
foo_t TestIndexedProperties::operator[](TestProperties b) { return p; }
Bar& TestIndexedProperties::operator[](unsigned long i)
{
return bar;
}
Bar& TestIndexedProperties::operator[](const TypeMappedIndex& key)
{
return bar;
}
int TestIndexedProperties::operator[](CS_OUT char key)
{
return key;
}
struct DLL_API TestIndexedPropertiesInValueType
{
public:
int operator[](int i);
};
int TestIndexedPropertiesInValueType::operator[](int i) { return i; }
// Tests variables
struct DLL_API TestVariables
{
@ -742,9 +672,6 @@ struct DLL_API TestWideStrings @@ -742,9 +672,6 @@ struct DLL_API TestWideStrings
LPCWSTR GetWideNullPointer();
};
LPCWSTR TestWideStrings::GetWidePointer() { return L"Hello"; }
LPCWSTR TestWideStrings::GetWideNullPointer() { return 0; }
enum struct MyEnum { A, B, C };
typedef void (*VoidPtrRetFunctionTypedef) ();
@ -761,8 +688,6 @@ public: @@ -761,8 +688,6 @@ public:
int ZeroSizedArray[0];
};
TestFixedArrays::TestFixedArrays() {}
class DLL_API TestArraysPointers
{
public:
@ -771,11 +696,6 @@ public: @@ -771,11 +696,6 @@ public:
MyEnum Value;
};
TestArraysPointers::TestArraysPointers(MyEnum *values, int count)
{
if (values && count) Value = values[0];
}
class DLL_API NonPrimitiveType
{
public:
@ -799,9 +719,6 @@ struct DLL_API TestGetterSetterToProperties @@ -799,9 +719,6 @@ struct DLL_API TestGetterSetterToProperties
int getHeight();
};
int TestGetterSetterToProperties::getWidth() { return 640; }
int TestGetterSetterToProperties::getHeight() { return 480; }
// Tests conversion operators of classes
class DLL_API ClassA
{

Loading…
Cancel
Save