1
0
forked from 0ad/0ad

parallel studio 2011 warning fixes

This was SVN commit r8484.
This commit is contained in:
janwas 2010-10-28 12:22:11 +00:00
parent af235da6f4
commit 825bbf8f51
12 changed files with 80 additions and 62 deletions

View File

@ -78,7 +78,7 @@ T bit_mask(size_t numBits)
return allBits;
// (note: the previous allBits >> (bitsInT-numBits) is not safe
// because right-shifts of negative numbers are undefined.)
const T mask = T(T(1) << numBits)-1;
const T mask = (T)((T(1) << numBits)-1);
return mask;
}

View File

@ -1,45 +0,0 @@
/* Copyright (c) 2010 Wildfire Games
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* bring in Boost filesystem library
*/
#ifndef INCLUDED_BOOST_FILESYSTEM
#define INCLUDED_BOOST_FILESYSTEM
// not W4-clean
#if MSC_VERSION
# pragma warning(push, 3)
#endif
#define BOOST_FILESYSTEM_VERSION 2
// TODO: port our code to work with the v3 API too
#include "boost/filesystem.hpp"
namespace fs = boost::filesystem;
#if MSC_VERSION
# pragma warning(pop)
#endif
#endif // #ifndef INCLUDED_BOOST_FILESYSTEM

View File

@ -113,9 +113,21 @@ enum DataKind
//-----------------------------------------------------------------------------
#if ICC_VERSION
# pragma warning(push)
# pragma warning(disable:94) // the size of an array must be greater than zero
# pragma warning(disable:271) // trailing comma is nonstandard
# pragma warning(disable:418) // declaration requires a typedef name
# pragma warning(disable:791) // calling convention specified more than once
#endif
#define _NO_CVCONST_H // request SymTagEnum be defined
#include <dbghelp.h> // must come after win.h and the above definitions
#if ICC_VERSION
# pragma warning(pop)
#endif
//-----------------------------------------------------------------------------

View File

@ -0,0 +1,41 @@
/* Copyright (c) 2010 Wildfire Games
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// rationale: boost is only included from the PCH, but warnings are still
// raised when templates are instantiated (e.g. vfs_lookup.cpp),
// so include this header from such source files as well.
#include "lib/sysdep/compiler.h" // ICC_VERSION
#if ICC_VERSION
# pragma warning(push)
# pragma warning(disable:82) // storage class is not first
# pragma warning(disable:193) // zero used for undefined preprocessing identifier
# pragma warning(disable:304) // access control not specified
# pragma warning(disable:367) // duplicate friend declaration
# pragma warning(disable:444) // destructor for base class is not virtual
# pragma warning(disable:522) // function redeclared inline after being called
# pragma warning(disable:811) // exception specification for implicitly declared virtual function is incompatible with that of overridden function
# pragma warning(disable:1879) // unimplemented pragma ignored
# pragma warning(disable:2270) // the declaration of the copy assignment operator has been suppressed
# pragma warning(disable:2273) // the declaration of the copy constructor has been suppressed
#endif

View File

@ -23,8 +23,6 @@
#ifndef INCLUDED_FILE_SYSTEM
#define INCLUDED_FILE_SYSTEM
#include "lib/external_libraries/boost_filesystem.h"
class FileInfo
{
public:

View File

@ -27,6 +27,8 @@
#include "precompiled.h"
#include "lib/file/vfs/file_cache.h"
#include "lib/external_libraries/suppress_boost_warnings.h"
#include "lib/file/common/file_stats.h"
#include "lib/file/io/io_align.h" // BLOCK_SIZE
#include "lib/cache_adt.h" // Cache

View File

@ -27,6 +27,8 @@
#include "precompiled.h"
#include "lib/file/vfs/vfs_lookup.h"
#include "lib/external_libraries/suppress_boost_warnings.h"
#include "lib/path_util.h" // path_foreach_component
#include "lib/file/vfs/vfs.h" // error codes
#include "lib/file/vfs/vfs_tree.h"

View File

@ -23,8 +23,6 @@
#ifndef INCLUDED_VFS_PATH
#define INCLUDED_VFS_PATH
#include "lib/external_libraries/boost_filesystem.h"
struct VfsPathTraits;
/**

View File

@ -191,7 +191,7 @@ class FrequencyFilter : public IFrequencyFilter
NONCOPYABLE(FrequencyFilter);
public:
FrequencyFilter(double resolution, double expectedFrequency)
: m_controller(expectedFrequency), m_frequencyEstimator(resolution), m_iirFilter(sensitivity, expectedFrequency)
: m_frequencyEstimator(resolution), m_controller(expectedFrequency), m_iirFilter(sensitivity, expectedFrequency)
, m_stableFrequency((int)expectedFrequency), m_smoothedFrequency(expectedFrequency)
{
}

View File

@ -37,8 +37,6 @@
#ifndef INCLUDED_PATH_UTIL
#define INCLUDED_PATH_UTIL
#include "lib/external_libraries/boost_filesystem.h"
namespace ERR
{
const LibError PATH_EMPTY = -100300;

View File

@ -38,6 +38,7 @@
#define _SECURE_SCL 0
#include "lib/config.h" // CONFIG_ENABLE_PCH
#include "lib/sysdep/compiler.h" // MSC_VERSION, HAVE_PCH
#include "lib/sysdep/os.h" // (must come before posix_types.h)
@ -69,6 +70,7 @@
# pragma warning(disable:1572) // floating-point equality and inequality comparisons are unreliable
# pragma warning(disable:1786) // function is deprecated (disabling 4996 isn't sufficient)
# pragma warning(disable:1684) // conversion from pointer to same-sized integral type
# pragma warning(disable:2415) // variable of static storage duration was declared but never referenced (raised by Boost)
# endif
#endif
@ -94,6 +96,8 @@ long double __cdecl abs(long double x); // required for Eigen
#include "lib/lib.h"
#include "lib/secure_crt.h"
#include "lib/external_libraries/suppress_boost_warnings.h"
// Boost
// .. if this package isn't going to be statically linked, we're better off
// using Boost via DLL. (otherwise, we would have to ensure the exact same
@ -104,22 +108,30 @@ long double __cdecl abs(long double x); // required for Eigen
// the following boost libraries have been included in TR1 and are
// thus deemed usable:
#include "lib/external_libraries/boost_filesystem.h"
#define BOOST_FILESYSTEM_VERSION 2
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#include <boost/shared_ptr.hpp>
using boost::shared_ptr;
#if !MINIMAL_PCH
// (these ones are used more rarely, so we don't enable them in minimal configurations)
#if !MINIMAL_PCH
#include <boost/array.hpp>
using boost::array;
#include <boost/mem_fn.hpp>
using boost::mem_fn;
#include <boost/function.hpp>
using boost::function;
#include <boost/bind.hpp>
using boost::bind;
#endif // !MINIMAL_PCH
#include "lib/posix/posix.h" // (must come after boost and common lib headers)
// (must come after boost and common lib headers, but before re-enabling
// warnings to avoid boost spew)
#include "lib/posix/posix.h"
//
@ -132,9 +144,6 @@ using boost::bind;
// they use. this policy ensures good compile performance whether or not
// PCHs are being used.
#include "lib/config.h" // CONFIG_ENABLE_PCH
#include "lib/sysdep/compiler.h" // HAVE_PCH
#if CONFIG_ENABLE_PCH && HAVE_PCH
// anything placed here won't need to be compiled in each translation unit,
@ -221,9 +230,12 @@ using boost::bind;
#endif
#endif // !MINIMAL_PCH
#endif // #if CONFIG_PCH
#endif // #if CONFIG_ENABLE_PCH && HAVE_PCH
// restore temporarily-disabled warnings
#if ICC_VERSION
# pragma warning(pop)
#endif
#if MSC_VERSION
# pragma warning(default:4702)
#endif

View File

@ -519,7 +519,7 @@ static SDLKey g_SDLKeyForVK[256]; // g_SDLKeyForVK[vk] == SDLK
static void key_Init()
{
// Map the VK keysyms
for(int i = 0; i < ARRAY_SIZE(g_SDLKeyForVK); i++)
for(size_t i = 0; i < ARRAY_SIZE(g_SDLKeyForVK); i++)
g_SDLKeyForVK[i] = SDLK_UNKNOWN;
g_SDLKeyForVK[VK_BACK] = SDLK_BACKSPACE;
@ -616,7 +616,7 @@ static void key_ResetAll()
spoofed_up_event.type = SDL_KEYUP;
spoofed_up_event.key.keysym.unicode = 0;
for(int i = 0; i < ARRAY_SIZE(keys); i++)
for(size_t i = 0; i < ARRAY_SIZE(keys); i++)
{
if(keys[i])
{