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:
parent
08f217e22c
commit
704cfa4051
3 changed files with 26 additions and 2 deletions
|
@ -22,6 +22,7 @@
|
|||
#include "sdlmain.hpp"
|
||||
#include "physicsfswrapper.hpp"
|
||||
#include "compatibility.h"
|
||||
#include "casts.hpp"
|
||||
#include <SDL2/SDL.h>
|
||||
#include <stdexcept>
|
||||
#include <cassert>
|
||||
|
@ -151,7 +152,7 @@ namespace cloonel {
|
|||
parSize.x(),
|
||||
parSize.y(),
|
||||
bpp,
|
||||
static_cast<int>(stride),
|
||||
checked_numcast<int>(stride),
|
||||
redMask,
|
||||
greenMask,
|
||||
blueMask,
|
||||
|
@ -185,7 +186,7 @@ namespace cloonel {
|
|||
return;
|
||||
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))
|
||||
return;
|
||||
|
||||
|
|
|
@ -30,14 +30,24 @@
|
|||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#if defined(__INTEL_COMPILER)
|
||||
# define DONT_GUESS_NOEXCEPT
|
||||
#endif
|
||||
|
||||
namespace cloonel {
|
||||
template <typename T, uint32_t S>
|
||||
class Vector {
|
||||
template <typename U, uint32_t R> friend class Vector;
|
||||
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;
|
||||
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()));
|
||||
#endif
|
||||
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 == 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
|
||||
#include "vector.inl"
|
||||
|
||||
#if defined(DONT_GUESS_NOEXCEPT)
|
||||
#undef DONT_GUESS_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -21,7 +21,11 @@ namespace cloonel {
|
|||
///-------------------------------------------------------------------------
|
||||
///-------------------------------------------------------------------------
|
||||
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)) {
|
||||
#endif
|
||||
std::fill(m_mem, m_mem + S, parValue);
|
||||
}
|
||||
|
||||
|
@ -29,7 +33,11 @@ namespace cloonel {
|
|||
///-------------------------------------------------------------------------
|
||||
template <typename T, uint32_t S>
|
||||
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())) {
|
||||
#endif
|
||||
std::copy(parOther.m_mem, parOther.m_mem + S, m_mem);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue