Browse Source

Fix C4251 warnings (#1487)

pull/1489/head
josetr 5 years ago committed by GitHub
parent
commit
be2bc1be5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      tests/CLI/CLI.h
  2. 10
      tests/CSharp/CSharp.h
  3. 12
      tests/CSharp/CSharpTemplates.h
  4. 5
      tests/Common/Common.h
  5. 5
      tests/Encodings/Encodings.h
  6. 26
      tests/StandardLib/StandardLib.h
  7. 8
      tests/Tests.h
  8. 5
      tests/VTables/VTables.h

4
tests/CLI/CLI.h

@ -70,7 +70,9 @@ public: @@ -70,7 +70,9 @@ public:
TestMappedTypeNonConstRefParam(const std::string);
const TestMappedTypeNonConstRefParam& operator=(const std::string);
std::string m_str;
DISABLE_WARNING_ONCE(4251,
std::string m_str;
)
};
class DLL_API TestMappedTypeNonConstRefParamConsumer

10
tests/CSharp/CSharp.h

@ -60,7 +60,10 @@ public: @@ -60,7 +60,10 @@ public:
protected:
int P;
TemplateInAnotherUnit<int> templateInAnotherUnit;
std::string _name;
DISABLE_WARNING_ONCE(4251,
std::string _name;
)
};
class DLL_API Quux
@ -1122,12 +1125,15 @@ public: @@ -1122,12 +1125,15 @@ public:
static const unsigned char UChr;
static const int Int;
static const float Float;
static const std::string String;
static const char ChrArray[2];
static const int IntArray[2];
static const float FloatArray[2];
static const bool BoolArray[2];
static const void* VoidPtrArray[2];
DISABLE_WARNING_ONCE(4251,
static const std::string String;
)
};
static constexpr double ConstexprCreateDoubleValue(double value) {

12
tests/CSharp/CSharpTemplates.h

@ -33,7 +33,7 @@ class DLL_API Ignored @@ -33,7 +33,7 @@ class DLL_API Ignored
};
template <typename T>
class IndependentFields : public T1
class DLL_API IndependentFields : public T1
{
typedef T Type;
public:
@ -122,7 +122,7 @@ T IndependentFields<T>::staticDependent(const T& t) @@ -122,7 +122,7 @@ T IndependentFields<T>::staticDependent(const T& t)
template <typename T>
int IndependentFields<T>::getIndependent()
{
return independent;
return static_cast<int>(independent);
}
template <typename X>
@ -143,7 +143,7 @@ class Base @@ -143,7 +143,7 @@ class Base
};
template <typename T>
class DependentValueFields : public Base<T>
class DLL_API DependentValueFields : public Base<T>
{
public:
class Nested;
@ -248,7 +248,7 @@ public: @@ -248,7 +248,7 @@ public:
};
template <typename T>
class DependentPointerFields
class DLL_API DependentPointerFields
{
public:
DependentPointerFields(T t = 0);
@ -318,7 +318,7 @@ void TwoTemplateArgs<K, V>::takeDependentPtrToSecondTemplateArg(const V& v) @@ -318,7 +318,7 @@ void TwoTemplateArgs<K, V>::takeDependentPtrToSecondTemplateArg(const V& v)
}
template <typename T, typename D = IndependentFields<T>>
class HasDefaultTemplateArgument
class DLL_API HasDefaultTemplateArgument
{
public:
HasDefaultTemplateArgument();
@ -688,7 +688,7 @@ enum class UsedInTemplatedIndexer @@ -688,7 +688,7 @@ enum class UsedInTemplatedIndexer
};
template <typename T>
class QFlags
class DLL_API QFlags
{
typedef int Int;
typedef int (*Zero);

5
tests/Common/Common.h

@ -892,8 +892,11 @@ public: @@ -892,8 +892,11 @@ public:
~HasStdString();
std::string testStdString(const std::string& s);
std::string testStdStringPassedByValue(std::string s);
std::string s;
std::string& getStdString();
DISABLE_WARNING_ONCE(4251,
std::string s;
)
};
class DLL_API InternalCtorAmbiguity

5
tests/Encodings/Encodings.h

@ -4,11 +4,14 @@ @@ -4,11 +4,14 @@
class DLL_API Foo
{
public:
DISABLE_WARNING_ONCE(4251,
static std::string StringVariable;
)
Foo();
~Foo();
const char* Unicode;
static std::string StringVariable;
// TODO: VC++ does not support char16
// char16 chr16;

26
tests/StandardLib/StandardLib.h

@ -20,18 +20,20 @@ struct DLL_API TestVectors @@ -20,18 +20,20 @@ struct DLL_API TestVectors
std::vector<int> GetIntVector();
int SumIntVector(std::vector<int>& vec);
// Should get mapped to List<int>
std::vector<int> IntVector;
// Should get mapped to List<IntPtr>
std::vector<int*> IntPtrVector;
// Should get mapped to List<IntWrapper>
std::vector<IntWrapper> IntWrapperVector;
// Should get mapped to List<IntWrapper>
std::vector<IntWrapper*> IntWrapperPtrVector;
// Should get mapped to List<IntWrapperValueType>
std::vector<IntWrapperValueType> IntWrapperValueTypeVector;
// Should get mapped to List<IntWrapperValueType>
VectorTypedef IntWrapperValueTypeVectorTypedef;
DISABLE_WARNING_ONCE(4251,
// Should get mapped to List<int>
std::vector<int> IntVector;
// Should get mapped to List<IntPtr>
std::vector<int*> IntPtrVector;
// Should get mapped to List<IntWrapper>
std::vector<IntWrapper> IntWrapperVector;
// Should get mapped to List<IntWrapper>
std::vector<IntWrapper*> IntWrapperPtrVector;
// Should get mapped to List<IntWrapperValueType>
std::vector<IntWrapperValueType> IntWrapperValueTypeVector;
// Should get mapped to List<IntWrapperValueType>
VectorTypedef IntWrapperValueTypeVectorTypedef;
)
};
struct DLL_API OStreamTest

8
tests/Tests.h

@ -20,6 +20,12 @@ @@ -20,6 +20,12 @@
#define THISCALL __thiscall
#endif
#define DISABLE_WARNING_ONCE(id, block) \
__pragma(warning(push)) \
__pragma(warning(disable: id)) \
block \
__pragma(warning(pop))
#else
#define DLL_API __attribute__ ((visibility ("default")))
@ -40,6 +46,8 @@ @@ -40,6 +46,8 @@
#define THISCALL
#endif
#define DISABLE_WARNING_ONCE(id, block) block
#endif
#define CS_OUT

5
tests/VTables/VTables.h

@ -17,7 +17,10 @@ public: @@ -17,7 +17,10 @@ public:
virtual int append();
virtual int append(int a);
int callVirtualWithParameter(int a);
std::string s;
DISABLE_WARNING_ONCE(4251,
std::string s;
)
};
DLL_API int FooCallFoo(Foo* foo);

Loading…
Cancel
Save