Skip to content

Commit

Permalink
Merge pull request #1380 from Azaezel/C4946
Browse files Browse the repository at this point in the history
partly addresses C4946 warnings
  • Loading branch information
Areloch committed Sep 5, 2015
2 parents 0074453 + 4bba5d8 commit 5874b8d
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 17 deletions.
8 changes: 8 additions & 0 deletions Engine/source/console/dynamicTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ const EngineTypeInfo* _MAPTYPE() { return TYPE< T >(); }
DECLARE_ENUM( type ); \
DefineConsoleType( Type ## type, type );

#define DefineEnumType_R( type ) \
DECLARE_ENUM_R( type ); \
DefineConsoleType( Type ## type, type );

#define _ConsoleEnumType( typeName, type, nativeType ) \
S32 type; \
ImplementConsoleTypeCasters( type, nativeType ) \
Expand Down Expand Up @@ -347,6 +351,10 @@ const EngineTypeInfo* _MAPTYPE() { return TYPE< T >(); }
DECLARE_BITFIELD( type ); \
DefineConsoleType( Type ## type, type );

#define DefineBitfieldType_R( type ) \
DECLARE_BITFIELD_R( type ); \
DefineConsoleType( Type ## type, type );

#define _ConsoleBitfieldType( typeName, type, nativeType ) \
S32 type; \
ImplementConsoleTypeCasters( type, nativeType ) \
Expand Down
18 changes: 9 additions & 9 deletions Engine/source/console/enginePrimitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@



DECLARE_PRIMITIVE( bool );
DECLARE_PRIMITIVE( S8 );
DECLARE_PRIMITIVE( U8 );
DECLARE_PRIMITIVE( S32 );
DECLARE_PRIMITIVE( U32 );
DECLARE_PRIMITIVE( F32 );
DECLARE_PRIMITIVE( F64 );
DECLARE_PRIMITIVE( void* );
DECLARE_PRIMITIVE_R( bool );
DECLARE_PRIMITIVE_R(S8);
DECLARE_PRIMITIVE_R(U8);
DECLARE_PRIMITIVE_R(S32);
DECLARE_PRIMITIVE_R(U32);
DECLARE_PRIMITIVE_R(F32);
DECLARE_PRIMITIVE_R(F64);
DECLARE_PRIMITIVE_R(void*);


//FIXME: this allows String to be used as a struct field type
Expand All @@ -52,7 +52,7 @@ DECLARE_PRIMITIVE( void* );
// are considered to be owned by the API layer itself. The rule here is that such
// a string is only valid until the next API call is made. Usually, control layers
// will immediately copy and convert strings to their own string type.
_DECLARE_TYPE( String );
_DECLARE_TYPE_R(String);
template<>
struct EngineTypeTraits< String > : public _EnginePrimitiveTypeTraits< String >
{
Expand Down
12 changes: 6 additions & 6 deletions Engine/source/console/engineStructs.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ class ColorI;
class ColorF;


DECLARE_STRUCT( Vector< bool > );
DECLARE_STRUCT( Vector< S32 > );
DECLARE_STRUCT( Vector< F32 > );
DECLARE_STRUCT( Torque::UUID );
DECLARE_STRUCT( ColorI );
DECLARE_STRUCT( ColorF );
DECLARE_STRUCT_R(Vector< bool >);
DECLARE_STRUCT_R(Vector< S32 >);
DECLARE_STRUCT_R(Vector< F32 >);
DECLARE_STRUCT_R(Torque::UUID);
DECLARE_STRUCT_R(ColorI);
DECLARE_STRUCT_R(ColorF);

#endif // !_ENGINESTRUCTS_H_
2 changes: 1 addition & 1 deletion Engine/source/console/engineTypeInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ enum EngineTypeKind
EngineTypeKindClass ///< Pointer to opaque EngineObject.
};

DECLARE_ENUM( EngineTypeKind );
DECLARE_ENUM_R( EngineTypeKind );

/// Flags for an EngineTypeInfo.
enum EngineTypeFlags
Expand Down
48 changes: 47 additions & 1 deletion Engine/source/console/engineTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,16 @@ namespace _Private {


#define _DECLARE_TYPE( type ) \
template<> const EngineTypeInfo* TYPE< type >(); \
template<> struct _SCOPE< type > { \
EngineExportScope& operator()() const { \
return *static_cast< EngineExportScope* >( \
const_cast< EngineTypeInfo* >( ( TYPE< type >() ) ) \
); \
} \
};

#define _DECLARE_TYPE_R( type ) \
template<> const EngineTypeInfo* TYPE< type >(); \
template<> struct _SCOPE< type > { \
EngineExportScope& operator()() const { \
Expand All @@ -432,22 +442,42 @@ namespace _Private {
_DECLARE_TYPE( type ) \
template<> \
struct EngineTypeTraits< type > : public _EnginePrimitiveTypeTraits< type > {};

#define _DECLARE_PRIMITIVE_R( type ) \
_DECLARE_TYPE_R( type ) \
template<> \
struct EngineTypeTraits< type > : public _EnginePrimitiveTypeTraits< type > {};

#define _DECLARE_ENUM( type ) \
_DECLARE_TYPE( type ) \
template<> \
struct _EngineTypeTraits< type > : public _EngineEnumTypeTraits< type > {};


#define _DECLARE_ENUM_R( type ) \
_DECLARE_TYPE_R( type ) \
template<> \
struct _EngineTypeTraits< type > : public _EngineEnumTypeTraits< type > {};

#define _DECLARE_BITFIELD( type ) \
_DECLARE_TYPE( type ) \
template<> \
struct _EngineTypeTraits< type > : public _EngineBitfieldTypeTraits< type > {};

#define _DECLARE_BITFIELD_R( type ) \
_DECLARE_TYPE_R( type ) \
template<> \
struct _EngineTypeTraits< type > : public _EngineBitfieldTypeTraits< type > {};


#define _DECLARE_STRUCT( type ) \
_DECLARE_TYPE( type ) \
template<> \
struct _EngineTypeTraits< type > : public _EngineStructTypeTraits< type > {};

#define _DECLARE_STRUCT_R( type ) \
_DECLARE_TYPE_R( type ) \
template<> \
struct _EngineTypeTraits< type > : public _EngineStructTypeTraits< type > {};

#define _IMPLEMENT_TYPE( type, exportName ) \
template<> \
Expand Down Expand Up @@ -524,18 +554,30 @@ namespace _Private {
#define DECLARE_PRIMITIVE( type ) \
_DECLARE_PRIMITIVE( type )

///
#define DECLARE_PRIMITIVE_R( type ) \
_DECLARE_PRIMITIVE_R( type )

///
#define IMPLEMENT_PRIMITIVE( type, exportName, scope, doc ) \
_IMPLEMENT_PRIMITIVE( type, exportName, scope, doc )

///
#define DECLARE_ENUM( type ) \
_DECLARE_ENUM( type )

///
#define DECLARE_ENUM_R( type ) \
_DECLARE_ENUM_R( type )

///
#define DECLARE_BITFIELD( type ) \
_DECLARE_BITFIELD( type )

///
#define DECLARE_BITFIELD_R( type ) \
_DECLARE_BITFIELD_R( type )

///
#define IMPLEMENT_ENUM( type, exportName, scope, doc ) \
_IMPLEMENT_ENUM( type, exportName, scope, doc )
Expand All @@ -556,6 +598,10 @@ namespace _Private {
#define DECLARE_STRUCT( type ) \
_DECLARE_STRUCT( type )

///
#define DECLARE_STRUCT_R( type ) \
_DECLARE_STRUCT_R( type )

///
#define IMPLEMENT_STRUCT( type, exportName, scope, doc ) \
_IMPLEMENT_STRUCT( type, exportName, scope, doc )
Expand Down

0 comments on commit 5874b8d

Please sign in to comment.