MSVC build fixes

This commit is contained in:
Jack Andersen
2015-06-19 21:40:15 -07:00
parent 687a7eef64
commit 5a0f2e8ed4
8 changed files with 69 additions and 39 deletions

View File

@@ -62,6 +62,13 @@ struct DNA
void read(Athena::io::IStreamReader&); \
void write(Athena::io::IStreamWriter&) const; \
/** Macro to supply count variable to atdna and mute it for other compilers */
#ifdef __clang__
#define DNA_COUNT(cnt) sizeof(cnt)
#else
#define DNA_COUNT(cnt) 0
#endif
}
}

View File

@@ -4,6 +4,10 @@
#include "Athena/FileInfo.hpp"
#include <stdio.h>
#if _WIN32
typedef int mode_t;
#endif
namespace Athena
{
class Dir

View File

@@ -7,6 +7,21 @@
#ifdef _MSC_VER
#pragma warning(disable : 4996)
#include <sys/stat.h>
#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
#if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
#if !defined(S_ISLNK)
#define S_ISLNK(m) 0
#endif
#endif
#ifndef AT_PRETTY_FUNCTION
@@ -30,6 +45,8 @@
#include "gekko_support.h"
typedef struct stat stat64_t;
#define stat64 stat
#elif _WIN32
typedef struct _stat64 stat64_t;
#else
typedef struct stat64 stat64_t;
#endif

View File

@@ -37,14 +37,11 @@ public:
#ifdef _MSC_VER
#define THROW_IO_EXCEPTION(args, ...) \
do { \
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, __VA_ARGS__); return; \
} else {
std::string msg = Athena::utility::sprintf(args, __VA_ARGS__);
\
throw Athena::error::IOException(std::string("IOException: ") + msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__);
\
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, args, __VA_ARGS__); return; \
} else { \
std::string msg = Athena::utility::sprintf(args, __VA_ARGS__); \
throw Athena::error::IOException(std::string("IOException: ") + msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
} \
} while (0)
#elif defined(__GNUC__)
#define THROW_IO_EXCEPTION(args...) \
@@ -59,15 +56,11 @@ throw Athena::error::IOException(std::string("IOException: ") + msg, __FILE__, A
#ifdef _MSC_VER
#define THROW_IO_EXCEPTION_RETURN(ret, args, ...) \
do { \
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, __VA_ARGS__); return ret; \
} else {
std::string msg = Athena::utility::sprintf(args, __VA_ARGS__);
\
throw Athena::error::IOException(std::string("IOException: ") + msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__);
\
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, args, __VA_ARGS__); return ret; \
} else { \
std::string msg = Athena::utility::sprintf(args, __VA_ARGS__); \
throw Athena::error::IOException(std::string("IOException: ") + msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
} \
} while (0)
#elif defined(__GNUC__)
#define THROW_IO_EXCEPTION_RETURN(ret, args...) \

View File

@@ -32,7 +32,7 @@ public:
#ifdef _MSC_VER
#define THROW_INVALID_DATA_EXCEPTION(args, ...) \
do { \
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, __VA_ARGS__); return; } \
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, args, __VA_ARGS__); return; } \
else { std::string msg = Athena::utility::sprintf(args, __VA_ARGS__); \
throw Athena::error::InvalidDataException(msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
} \
@@ -47,9 +47,9 @@ public:
#endif
#ifdef _MSC_VER
#define THROW_INVALID_DATA_EXCEPTION(args, ...) \
#define THROW_INVALID_DATA_EXCEPTION_RETURN(ret, args, ...) \
do { \
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, __VA_ARGS__); return; } \
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, args, __VA_ARGS__); return ret; } \
else { std::string msg = Athena::utility::sprintf(args, __VA_ARGS__); \
throw Athena::error::InvalidDataException(msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
} \

View File

@@ -36,14 +36,13 @@ public:
#ifdef _MSC_VER
#define THROW_INVALID_OPERATION_EXCEPTION(args, ...) \
do { \
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, __VA_ARGS__); return; \
} else {
std::string msg = Athena::utility::sprintf(args, __VA_ARGS__);
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, args, __VA_ARGS__); return; \
} else { \
std::string msg = Athena::utility::sprintf(args , __VA_ARGS__); \
\
throw Athena::error::InvalidOperationException(std::string("InvalidOperationException: ") + msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__);
throw Athena::error::InvalidOperationException(std::string("InvalidOperationException: ") + msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
\
} \
} while (0)
#elif defined (__GNUC__)
#define THROW_INVALID_OPERATION_EXCEPTION(args...) \
@@ -56,17 +55,14 @@ throw Athena::error::InvalidOperationException(std::string("InvalidOperationExce
#endif
#ifdef _MSC_VER
#define THROW_INVALID_OPERATION_EXCEPTIONRETURN(ret, args, ...) \
#define THROW_INVALID_OPERATION_EXCEPTION_RETURN(ret, args, ...) \
do { \
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, __VA_ARGS__); return ret; \
} else {
std::string msg = Athena::utility::sprintf(args, __VA_ARGS__);
\
throw Athena::error::InvalidOperationException(std::string("InvalidOperationException: ") + msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__);
if (atGetExceptionHandler()) {atGetExceptionHandler()(__FILE__, AT_PRETTY_FUNCTION, __LINE__, args, __VA_ARGS__); return ret; \
} else { \
std::string msg = Athena::utility::sprintf(args, __VA_ARGS__); \
\
throw Athena::error::InvalidOperationException(std::string("InvalidOperationException: ") + msg, __FILE__, AT_PRETTY_FUNCTION, __LINE__); \
} \
} while (0)
#elif defined(__GNUC__)
#define THROW_INVALID_OPERATION_EXCEPTION_RETURN(ret, args...) \