Some fixes for the intel compiler.

A few warnings are still there, but it should be safe to ignore them.
This commit is contained in:
King_DuckZ 2014-08-14 12:54:18 +02:00
parent 08f217e22c
commit 704cfa4051
3 changed files with 26 additions and 2 deletions

View file

@ -22,6 +22,7 @@
#include "sdlmain.hpp" #include "sdlmain.hpp"
#include "physicsfswrapper.hpp" #include "physicsfswrapper.hpp"
#include "compatibility.h" #include "compatibility.h"
#include "casts.hpp"
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <stdexcept> #include <stdexcept>
#include <cassert> #include <cassert>
@ -151,7 +152,7 @@ namespace cloonel {
parSize.x(), parSize.x(),
parSize.y(), parSize.y(),
bpp, bpp,
static_cast<int>(stride), checked_numcast<int>(stride),
redMask, redMask,
greenMask, greenMask,
blueMask, blueMask,
@ -185,7 +186,7 @@ namespace cloonel {
return; return;
PhysicsFSFile& rawfile = *static_cast<PhysicsFSFile*>(png_get_io_ptr(parPngPtr)); PhysicsFSFile& rawfile = *static_cast<PhysicsFSFile*>(png_get_io_ptr(parPngPtr));
const int64_t read = rawfile.Read(static_cast<void*>(parOutBytes), static_cast<uint32_t>(parByteCountToRead), 1); const int64_t read = rawfile.Read(static_cast<void*>(parOutBytes), checked_numcast<uint32_t>(parByteCountToRead), 1);
if (read != static_cast<int64_t>(parByteCountToRead)) if (read != static_cast<int64_t>(parByteCountToRead))
return; return;

View file

@ -30,14 +30,24 @@
#include <iostream> #include <iostream>
#endif #endif
#if defined(__INTEL_COMPILER)
# define DONT_GUESS_NOEXCEPT
#endif
namespace cloonel { namespace cloonel {
template <typename T, uint32_t S> template <typename T, uint32_t S>
class Vector { class Vector {
template <typename U, uint32_t R> friend class Vector; template <typename U, uint32_t R> friend class Vector;
public: public:
#if defined(DONT_GUESS_NOEXCEPT)
Vector ( void ) = default;
explicit Vector ( T parValue );
template <typename U> explicit Vector ( const Vector<U, S>& parOther );
#else
Vector ( void ) noexcept(noexcept(T())) = default; Vector ( void ) noexcept(noexcept(T())) = default;
explicit Vector ( T parValue ) noexcept(noexcept(T()) && noexcept(parValue=parValue)); explicit Vector ( T parValue ) noexcept(noexcept(T()) && noexcept(parValue=parValue));
template <typename U> explicit Vector ( const Vector<U, S>& parOther ) noexcept(noexcept(T()) && noexcept(const_cast<U&>(parOther.m_mem[0])=T())); template <typename U> explicit Vector ( const Vector<U, S>& parOther ) noexcept(noexcept(T()) && noexcept(const_cast<U&>(parOther.m_mem[0])=T()));
#endif
template <typename = std::enable_if<S == 2> > Vector ( T parX, T parY ) noexcept : m_mem {parX, parY} {} template <typename = std::enable_if<S == 2> > Vector ( T parX, T parY ) noexcept : m_mem {parX, parY} {}
template <typename = std::enable_if<S == 3> > Vector ( T parX, T parY, T parZ ) noexcept : m_mem {parX, parY, parZ} {} template <typename = std::enable_if<S == 3> > Vector ( T parX, T parY, T parZ ) noexcept : m_mem {parX, parY, parZ} {}
template <typename = std::enable_if<S == 4> > Vector ( T parX, T parY, T parZ, T parW ) noexcept : m_mem {parX, parY, parZ, parW} {} template <typename = std::enable_if<S == 4> > Vector ( T parX, T parY, T parZ, T parW ) noexcept : m_mem {parX, parY, parZ, parW} {}
@ -132,4 +142,9 @@ namespace cloonel {
} //namespace cloonel } //namespace cloonel
#include "vector.inl" #include "vector.inl"
#if defined(DONT_GUESS_NOEXCEPT)
#undef DONT_GUESS_NOEXCEPT
#endif
#endif #endif

View file

@ -21,7 +21,11 @@ namespace cloonel {
///------------------------------------------------------------------------- ///-------------------------------------------------------------------------
///------------------------------------------------------------------------- ///-------------------------------------------------------------------------
template <typename T, uint32_t S> template <typename T, uint32_t S>
#if defined(DONT_GUESS_NOEXCEPT)
Vector<T, S>::Vector (T parValue) {
#else
Vector<T, S>::Vector (T parValue) noexcept(noexcept(T()) && noexcept(parValue=parValue)) { Vector<T, S>::Vector (T parValue) noexcept(noexcept(T()) && noexcept(parValue=parValue)) {
#endif
std::fill(m_mem, m_mem + S, parValue); std::fill(m_mem, m_mem + S, parValue);
} }
@ -29,7 +33,11 @@ namespace cloonel {
///------------------------------------------------------------------------- ///-------------------------------------------------------------------------
template <typename T, uint32_t S> template <typename T, uint32_t S>
template <typename U> template <typename U>
#if defined(DONT_GUESS_NOEXCEPT)
Vector<T, S>::Vector (const Vector<U, S>& parOther) {
#else
Vector<T, S>::Vector (const Vector<U, S>& parOther) noexcept(noexcept(T()) && noexcept(const_cast<U&>(parOther.m_mem[0])=T())) { Vector<T, S>::Vector (const Vector<U, S>& parOther) noexcept(noexcept(T()) && noexcept(const_cast<U&>(parOther.m_mem[0])=T())) {
#endif
std::copy(parOther.m_mem, parOther.m_mem + S, m_mem); std::copy(parOther.m_mem, parOther.m_mem + S, m_mem);
} }