# fix warnings
more icc11 fixes - mostly type conversion and noncopyable (now made a macro) This was SVN commit r6536.
This commit is contained in:
parent
a4e12fc405
commit
16ccae10cd
@ -618,7 +618,7 @@ template<class Item, class Divider> struct CacheEntry
|
||||
{
|
||||
size = size_;
|
||||
cost = cost_;
|
||||
credit = cost;
|
||||
credit = (float)cost;
|
||||
|
||||
// else divider will fail
|
||||
debug_assert(size != 0);
|
||||
|
@ -127,7 +127,7 @@ switch(x % 2)
|
||||
*
|
||||
* @param expression that is expected to evaluate to non-zero at compile-time.
|
||||
**/
|
||||
#define cassert(expr) typedef detail::static_assert_<(expr)>::type UID__;
|
||||
#define cassert(expr) typedef detail::static_assert_<(expr)>::type UID__
|
||||
namespace detail
|
||||
{
|
||||
template<bool> struct static_assert_;
|
||||
@ -170,4 +170,11 @@ namespace noncopyable_ // protection from unintended ADL
|
||||
|
||||
typedef noncopyable_::noncopyable noncopyable;
|
||||
|
||||
// this form avoids ICC 11 W4 warnings about non-virtual dtors and
|
||||
// suppression of the copy assignment operator.
|
||||
#define NONCOPYABLE(className)\
|
||||
private:\
|
||||
className(const className&);\
|
||||
const className& operator=(const className&)
|
||||
|
||||
#endif // #ifndef INCLUDED_CODE_ANNOTATION
|
||||
|
@ -47,7 +47,7 @@ wchar_t* debug_log_pos = debug_log;
|
||||
// write to memory buffer (fast)
|
||||
void debug_wprintf_mem(const wchar_t* fmt, ...)
|
||||
{
|
||||
const ssize_t charsLeft = (ssize_t)LOG_CHARS - (debug_log_pos-debug_log);
|
||||
const ssize_t charsLeft = (ssize_t)(LOG_CHARS - (debug_log_pos-debug_log));
|
||||
debug_assert(charsLeft >= 0);
|
||||
|
||||
// potentially not enough room for the new string; throw away the
|
||||
@ -505,3 +505,4 @@ ErrorReaction debug_OnAssertionFailure(const char* expr, u8* suppress, const cha
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -45,14 +45,14 @@ u32 FAT_from_time_t(time_t time)
|
||||
struct tm* t = localtime(&time);
|
||||
|
||||
u16 fat_time = 0;
|
||||
fat_time |= (t->tm_sec/2); // 5
|
||||
fat_time |= (t->tm_min) << 5; // 6
|
||||
fat_time |= (t->tm_hour) << 11; // 5
|
||||
fat_time |= u16(t->tm_sec/2); // 5
|
||||
fat_time |= u16(t->tm_min) << 5; // 6
|
||||
fat_time |= u16(t->tm_hour) << 11; // 5
|
||||
|
||||
u16 fat_date = 0;
|
||||
fat_date |= (t->tm_mday); // 5
|
||||
fat_date |= (t->tm_mon+1) << 5; // 4
|
||||
fat_date |= (t->tm_year-80) << 9; // 7
|
||||
fat_date |= u16(t->tm_mday); // 5
|
||||
fat_date |= u16(t->tm_mon+1) << 5; // 4
|
||||
fat_date |= u16(t->tm_year-80) << 9; // 7
|
||||
|
||||
u32 fat_timedate = u32_from_u16(fat_date, fat_time);
|
||||
return fat_timedate;
|
||||
|
@ -536,7 +536,7 @@ public:
|
||||
const Path pathname = m_file->Pathname();
|
||||
m_file.reset();
|
||||
|
||||
m_fileSize += cd_size+sizeof(ECDR);
|
||||
m_fileSize += off_t(cd_size+sizeof(ECDR));
|
||||
truncate(pathname.external_directory_string().c_str(), m_fileSize);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
TraceEntry::TraceEntry(EAction action, const char* pathname, size_t size)
|
||||
: m_timestamp(timer_Time())
|
||||
: m_timestamp((float)timer_Time())
|
||||
, m_action(action)
|
||||
, m_pathname(strdup(pathname))
|
||||
, m_size(size)
|
||||
@ -52,7 +52,7 @@ TraceEntry::~TraceEntry()
|
||||
|
||||
void TraceEntry::EncodeAsText(char* text, size_t maxTextChars) const
|
||||
{
|
||||
const char action = m_action;
|
||||
const char action = (char)m_action;
|
||||
sprintf_s(text, maxTextChars, "%#010f: %c \"%s\" %d\n", m_timestamp, action, m_pathname, m_size);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
enum EAction
|
||||
{
|
||||
Load = 'L',
|
||||
Store = 'S',
|
||||
Store = 'S'
|
||||
};
|
||||
|
||||
TraceEntry(EAction action, const char* pathname, size_t size);
|
||||
|
@ -63,9 +63,9 @@ void fs_SortDirectories(DirectoryNames& directories)
|
||||
}
|
||||
|
||||
|
||||
LibError fs_ForEachFile(const PIVFS& fs, const VfsPath& path, FileCallback cb, uintptr_t cbData, const char* pattern, size_t flags)
|
||||
LibError fs_ForEachFile(const PIVFS& fs, const VfsPath& startPath, FileCallback cb, uintptr_t cbData, const char* pattern, size_t flags)
|
||||
{
|
||||
debug_assert(vfs_path_IsDirectory(path));
|
||||
debug_assert(vfs_path_IsDirectory(startPath));
|
||||
|
||||
// (declare here to avoid reallocations)
|
||||
FileInfos files; DirectoryNames subdirectoryNames;
|
||||
@ -73,7 +73,7 @@ LibError fs_ForEachFile(const PIVFS& fs, const VfsPath& path, FileCallback cb, u
|
||||
// (a FIFO queue is more efficient than recursion because it uses less
|
||||
// stack space and avoids seeks due to breadth-first traversal.)
|
||||
std::queue<VfsPath> pendingDirectories;
|
||||
pendingDirectories.push(path);
|
||||
pendingDirectories.push(startPath);
|
||||
while(!pendingDirectories.empty())
|
||||
{
|
||||
const VfsPath& path = pendingDirectories.front();
|
||||
|
@ -31,8 +31,8 @@ BlockId::BlockId(const Path& pathname, off_t ofs)
|
||||
m_id = fnv_hash64(pathname.string().c_str(), pathname.string().length());
|
||||
const size_t indexBits = 16;
|
||||
m_id <<= indexBits;
|
||||
const off_t blockIndex = ofs / BLOCK_SIZE;
|
||||
debug_assert(blockIndex < off_t(1ul << indexBits));
|
||||
const off_t blockIndex = off_t(ofs / BLOCK_SIZE);
|
||||
debug_assert(blockIndex < off_t(1) << indexBits);
|
||||
m_id |= blockIndex;
|
||||
}
|
||||
|
||||
|
@ -198,8 +198,9 @@ BlockCache BlockIo::s_blockCache;
|
||||
// IoSplitter
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class IoSplitter : noncopyable
|
||||
class IoSplitter
|
||||
{
|
||||
NONCOPYABLE(IoSplitter);
|
||||
public:
|
||||
IoSplitter(off_t ofs, u8* alignedBuf, off_t size)
|
||||
: m_ofs(ofs), m_alignedBuf(alignedBuf), m_size(size)
|
||||
|
@ -29,8 +29,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class UnalignedWriter : public noncopyable
|
||||
class UnalignedWriter
|
||||
{
|
||||
NONCOPYABLE(UnalignedWriter);
|
||||
public:
|
||||
UnalignedWriter(const PIFile& file, off_t ofs);
|
||||
~UnalignedWriter();
|
||||
|
@ -25,8 +25,9 @@ static size_t s_numArchivedFiles;
|
||||
|
||||
// helper class that allows breaking up the logic into sub-functions without
|
||||
// always having to pass directory/realDirectory as parameters.
|
||||
class PopulateHelper : noncopyable
|
||||
class PopulateHelper
|
||||
{
|
||||
NONCOPYABLE(PopulateHelper);
|
||||
public:
|
||||
PopulateHelper(VfsDirectory* directory, const PRealDirectory& realDirectory)
|
||||
: m_directory(directory), m_realDirectory(realDirectory)
|
||||
|
@ -7,8 +7,9 @@ static const double sensitivity = 0.10;
|
||||
/**
|
||||
* variable-width window for frequency determination
|
||||
**/
|
||||
class FrequencyEstimator : boost::noncopyable
|
||||
class FrequencyEstimator
|
||||
{
|
||||
NONCOPYABLE(FrequencyEstimator);
|
||||
public:
|
||||
FrequencyEstimator(double resolution)
|
||||
: m_minDeltaTime(4.0 * resolution) // chosen to reduce error but still yield rapid updates.
|
||||
@ -165,10 +166,11 @@ private:
|
||||
|
||||
class FrequencyFilter : public IFrequencyFilter
|
||||
{
|
||||
NONCOPYABLE(FrequencyFilter);
|
||||
public:
|
||||
FrequencyFilter(double resolution, double expectedFrequency)
|
||||
: m_controller(expectedFrequency), m_frequencyEstimator(resolution), m_iirFilter(sensitivity, expectedFrequency)
|
||||
, m_stableFrequency(expectedFrequency), m_smoothedFrequency(expectedFrequency)
|
||||
, m_stableFrequency((int)expectedFrequency), m_smoothedFrequency(expectedFrequency)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ extern int error_AddAssociation(LibErrorAssociation*);
|
||||
// Invoke this at file or function scope.
|
||||
#define ERROR_ASSOCIATE(err, description, errno_equivalent)\
|
||||
static LibErrorAssociation UID__ = { err, description, errno_equivalent };\
|
||||
static int UID2__ = error_AddAssociation(&UID__);
|
||||
static int UID2__ = error_AddAssociation(&UID__)
|
||||
|
||||
|
||||
/**
|
||||
|
@ -37,7 +37,7 @@ bool path_is_dir_sep(char c)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool path_is_dir_sepw(wchar_t c)
|
||||
static bool path_is_dir_sepw(wchar_t c)
|
||||
{
|
||||
// note: ideally path strings would only contain '/' or even SYS_DIR_SEP.
|
||||
// however, windows-specific code (e.g. the sound driver detection)
|
||||
@ -73,7 +73,7 @@ bool path_is_subpath(const char* s1, const char* s2)
|
||||
if(strlen(s1) > strlen(s2))
|
||||
std::swap(s1, s2);
|
||||
|
||||
int c1 = 0, last_c1, c2;
|
||||
char c1 = 0, last_c1, c2;
|
||||
for(;;)
|
||||
{
|
||||
last_c1 = c1;
|
||||
|
@ -32,6 +32,10 @@
|
||||
# pragma warning(disable:6246) // local declaration hides declaration of the same name in outer scope
|
||||
# endif
|
||||
# if ICC_VERSION
|
||||
# pragma warning(disable:383) // value copied to temporary, reference to temporary used
|
||||
# pragma warning(disable:981) // operands are evaluted in unspecified order
|
||||
# pragma warning(disable:1418) // external function definition with no prior declaration (raised for all non-static function templates)
|
||||
# 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
|
||||
# endif
|
||||
@ -62,7 +66,6 @@
|
||||
#ifndef LIB_STATIC_LINK
|
||||
# define BOOST_ALL_DYN_LINK
|
||||
#endif
|
||||
#include <boost/utility.hpp> // noncopyable
|
||||
// the following boost libraries have been included in TR1 and are
|
||||
// thus deemed usable:
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
@ -207,7 +207,7 @@ static bool VerifyTable(const AcpiTable* table, const char* signature = 0)
|
||||
// no specific signature is called for; just make sure it's 4 letters
|
||||
else
|
||||
{
|
||||
for(int i = 0; i < 4; i++)
|
||||
for(size_t i = 0; i < 4; i++)
|
||||
{
|
||||
if(!isalpha(table->signature[i]))
|
||||
return false;
|
||||
@ -255,7 +255,7 @@ struct RSDT
|
||||
|
||||
// avoid std::map et al. because we may be called before _cinit
|
||||
static const AcpiTable** tables;
|
||||
static int numTables;
|
||||
static size_t numTables;
|
||||
|
||||
static bool LatchAllTables()
|
||||
{
|
||||
@ -269,7 +269,7 @@ static bool LatchAllTables()
|
||||
numTables = (rsdt->header.size - sizeof(AcpiTable)) / sizeof(rsdt->tables[0]);
|
||||
debug_assert(numTables > 0);
|
||||
tables = new const AcpiTable*[numTables];
|
||||
for(int i = 0; i < numTables; i++)
|
||||
for(size_t i = 0; i < numTables; i++)
|
||||
tables[i] = GetTable(rsdt->tables[i]);
|
||||
|
||||
DeallocateTable(rsdt);
|
||||
@ -281,7 +281,7 @@ static void FreeAllTables()
|
||||
{
|
||||
if(tables)
|
||||
{
|
||||
for(int i = 0; i < numTables; i++)
|
||||
for(size_t i = 0; i < numTables; i++)
|
||||
DeallocateTable(tables[i]);
|
||||
delete[] tables;
|
||||
}
|
||||
@ -291,7 +291,7 @@ static void FreeAllTables()
|
||||
const AcpiTable* acpi_GetTable(const char* signature)
|
||||
{
|
||||
// (typically only a few tables, linear search is OK)
|
||||
for(int i = 0; i < numTables; i++)
|
||||
for(size_t i = 0; i < numTables; i++)
|
||||
{
|
||||
const AcpiTable* table = tables[i];
|
||||
if(!table)
|
||||
|
@ -33,7 +33,7 @@ enum AcpiAddressSpace
|
||||
ACPI_AS_MEMORY = 0,
|
||||
ACPI_AS_IO = 1,
|
||||
ACPI_AS_PCI_CONFIG = 2,
|
||||
ACPI_AS_SMBUS = 4,
|
||||
ACPI_AS_SMBUS = 4
|
||||
};
|
||||
|
||||
// address of a struct or register
|
||||
|
@ -47,7 +47,7 @@ enum x86_x64_Vendors
|
||||
{
|
||||
X86_X64_VENDOR_UNKNOWN,
|
||||
X86_X64_VENDOR_INTEL,
|
||||
X86_X64_VENDOR_AMD,
|
||||
X86_X64_VENDOR_AMD
|
||||
};
|
||||
|
||||
LIB_API x86_x64_Vendors x86_x64_Vendor();
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
{
|
||||
Created,
|
||||
Deleted,
|
||||
Changed,
|
||||
Changed
|
||||
};
|
||||
|
||||
// (default ctor is required because DirWatchNotification is returned
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "gfx.h"
|
||||
|
||||
#include "lib/external_libraries/sdl.h"
|
||||
#include "lib/ogl.h"
|
||||
|
||||
|
||||
char gfx_card[GFX_CARD_LEN] = "";
|
||||
@ -20,8 +21,6 @@ char gfx_drv_ver[GFX_DRV_VER_LEN] = "";
|
||||
int gfx_mem = -1; // [MiB]; approximate
|
||||
|
||||
|
||||
extern LibError ogl_get_gfx_info();
|
||||
|
||||
// detect graphics card and set the above information.
|
||||
void gfx_detect()
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ WINIT_REGISTER_LATE_SHUTDOWN2(wdbg_heap_Shutdown); // last - no leaks are detect
|
||||
|
||||
void wdbg_heap_Enable(bool enable)
|
||||
{
|
||||
#ifdef _DEBUG // (avoid "expression has no effect" warning in release builds)
|
||||
int flags = 0;
|
||||
if(enable)
|
||||
{
|
||||
@ -34,6 +35,9 @@ void wdbg_heap_Enable(bool enable)
|
||||
// the normal build process as well as when debugging the test .exe
|
||||
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
|
||||
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);
|
||||
#else
|
||||
UNUSED2(enable);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -577,7 +577,7 @@ static LibError out_check_limit()
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#define INDENT STMT(for(size_t i = 0; i <= state.level; i++) out(L" ");)
|
||||
#define INDENT STMT(for(size_t i__ = 0; i__ <= state.level; i__++) out(L" ");)
|
||||
#define UNINDENT STMT(out_erase((state.level+1)*4);)
|
||||
|
||||
|
||||
|
@ -80,10 +80,10 @@ public:
|
||||
// used on MP HAL systems and can be detected by comparing QPF with the
|
||||
// CPU clock. we consider it unsafe unless the user promises (via
|
||||
// command line) that it's patched and thus reliable on their system.
|
||||
bool usesTsc = IsSimilarMagnitude(m_frequency, os_cpu_ClockFrequency());
|
||||
bool usesTsc = IsSimilarMagnitude((double)m_frequency, os_cpu_ClockFrequency());
|
||||
// unconfirmed reports indicate QPC sometimes uses 1/3 of the
|
||||
// CPU clock frequency, so check that as well.
|
||||
usesTsc |= IsSimilarMagnitude(m_frequency, os_cpu_ClockFrequency()/3);
|
||||
usesTsc |= IsSimilarMagnitude((double)m_frequency, os_cpu_ClockFrequency()/3);
|
||||
if(usesTsc)
|
||||
{
|
||||
const bool isTscSafe = wutil_HasCommandLineArgument("-wQpcTscSafe");
|
||||
|
@ -117,29 +117,29 @@ Several methods of module init are possible: (see Large Scale C++ Design)
|
||||
|
||||
// very early init; must not fail, since error handling code *crashes*
|
||||
// if called before these have completed.
|
||||
#define WINIT_REGISTER_CRITICAL_INIT(func) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$I0")) LibError (*p##func)(void) = func; __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func))))
|
||||
#define WINIT_REGISTER_CRITICAL_INIT(func) __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func)))) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$I0")) LibError (*p##func)(void) = func
|
||||
|
||||
// meant for modules with dependents but whose init is complicated and may
|
||||
// raise error/warning messages (=> can't go in WINIT_REGISTER_CRITICAL_INIT)
|
||||
#define WINIT_REGISTER_EARLY_INIT(func) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$I1")) LibError (*p##func)(void) = func; __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func))))
|
||||
#define WINIT_REGISTER_EARLY_INIT(func) __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func)))) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$I1")) LibError (*p##func)(void) = func
|
||||
|
||||
// available for dependents of WINIT_REGISTER_EARLY_INIT-modules that
|
||||
// must still come before WINIT_REGISTER_MAIN_INIT.
|
||||
#define WINIT_REGISTER_EARLY_INIT2(func) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$I2")) LibError (*p##func)(void) = func; __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func))))
|
||||
#define WINIT_REGISTER_EARLY_INIT2(func) __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func)))) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$I2")) LibError (*p##func)(void) = func
|
||||
|
||||
// most modules will go here unless they are often used or
|
||||
// have many dependents.
|
||||
#define WINIT_REGISTER_MAIN_INIT(func) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$I6")) LibError (*p##func)(void) = func; __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func))))
|
||||
#define WINIT_REGISTER_MAIN_INIT(func) __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func)))) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$I6")) LibError (*p##func)(void) = func
|
||||
|
||||
// available for any modules that may need to come after
|
||||
// WINIT_REGISTER_MAIN_INIT (unlikely)
|
||||
#define WINIT_REGISTER_LATE_INIT(func) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$I7")) LibError (*p##func)(void) = func; __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func))))
|
||||
#define WINIT_REGISTER_LATE_INIT(func) __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func)))) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$I7")) LibError (*p##func)(void) = func
|
||||
|
||||
#define WINIT_REGISTER_EARLY_SHUTDOWN(func) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$S0")) LibError (*p##func)(void) = func; __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func))))
|
||||
#define WINIT_REGISTER_EARLY_SHUTDOWN2(func) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$S1")) LibError (*p##func)(void) = func; __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func))))
|
||||
#define WINIT_REGISTER_MAIN_SHUTDOWN(func) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$S6")) LibError (*p##func)(void) = func; __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func))))
|
||||
#define WINIT_REGISTER_LATE_SHUTDOWN(func) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$S7")) LibError (*p##func)(void) = func; __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func))))
|
||||
#define WINIT_REGISTER_LATE_SHUTDOWN2(func) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$S8")) LibError (*p##func)(void) = func; __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func))))
|
||||
#define WINIT_REGISTER_EARLY_SHUTDOWN(func) __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func)))) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$S0")) LibError (*p##func)(void) = func
|
||||
#define WINIT_REGISTER_EARLY_SHUTDOWN2(func) __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func)))) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$S1")) LibError (*p##func)(void) = func
|
||||
#define WINIT_REGISTER_MAIN_SHUTDOWN(func) __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func)))) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$S6")) LibError (*p##func)(void) = func
|
||||
#define WINIT_REGISTER_LATE_SHUTDOWN(func) __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func)))) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$S7")) LibError (*p##func)(void) = func
|
||||
#define WINIT_REGISTER_LATE_SHUTDOWN2(func) __pragma(comment(linker, "/include:" STRINGIZE(DECORATED_NAME(p##func)))) static LibError func(void); EXTERN_C __declspec(allocate(".WINIT$S8")) LibError (*p##func)(void) = func
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
@ -46,14 +46,18 @@ static void FillNodesProcessorMask(uintptr_t* nodesProcessorMask)
|
||||
if(pGetNumaNodeProcessorMask)
|
||||
{
|
||||
DWORD_PTR processAffinity, systemAffinity;
|
||||
const BOOL ok = GetProcessAffinityMask(GetCurrentProcess(), &processAffinity, &systemAffinity);
|
||||
debug_assert(ok);
|
||||
{
|
||||
const BOOL ok = GetProcessAffinityMask(GetCurrentProcess(), &processAffinity, &systemAffinity);
|
||||
debug_assert(ok);
|
||||
}
|
||||
|
||||
for(size_t node = 0; node < numa_NumNodes(); node++)
|
||||
{
|
||||
ULONGLONG affinity;
|
||||
const BOOL ok = pGetNumaNodeProcessorMask((UCHAR)node, &affinity);
|
||||
debug_assert(ok);
|
||||
{
|
||||
const BOOL ok = pGetNumaNodeProcessorMask((UCHAR)node, &affinity);
|
||||
debug_assert(ok);
|
||||
}
|
||||
const uintptr_t processorMask = wcpu_ProcessorMaskFromAffinity(processAffinity, (DWORD_PTR)affinity);
|
||||
nodesProcessorMask[node] = processorMask;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ int access(const char* path, int mode)
|
||||
}
|
||||
|
||||
|
||||
#if !HAVE_MKDIR
|
||||
#ifndef HAVE_MKDIR
|
||||
int mkdir(const char* path, mode_t UNUSED(mode))
|
||||
{
|
||||
if(!CreateDirectory(path, (LPSECURITY_ATTRIBUTES)NULL))
|
||||
@ -155,7 +155,7 @@ int mkdir(const char* path, mode_t UNUSED(mode))
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif // #if !HAVE_MKDIR
|
||||
#endif
|
||||
|
||||
|
||||
int rmdir(const char* path)
|
||||
@ -341,7 +341,7 @@ int readdir_stat_np(DIR* d_, struct stat* s)
|
||||
|
||||
memset(s, 0, sizeof(*s));
|
||||
s->st_size = (off_t)u64_from_u32(d->fd.nFileSizeHigh, d->fd.nFileSizeLow);
|
||||
s->st_mode = (d->fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)? S_IFDIR : S_IFREG;
|
||||
s->st_mode = (unsigned short)((d->fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)? S_IFDIR : S_IFREG);
|
||||
s->st_mtime = filetime_to_time_t(&d->fd.ftLastWriteTime);
|
||||
return 0;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ private:
|
||||
if(gamma == 1.0f)
|
||||
{
|
||||
for(u16 i = 0; i < 256; i++)
|
||||
ramp[i] = (i << 8);
|
||||
ramp[i] = u16(i << 8);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -411,7 +411,7 @@ static inline void queue_active_event(SdlActivationType type, size_t changed_app
|
||||
SDL_Event ev;
|
||||
ev.type = SDL_ACTIVEEVENT;
|
||||
ev.active.state = (u8)changed_app_state;
|
||||
ev.active.gain = (type == GAIN)? 1 : 0;
|
||||
ev.active.gain = (u8)((type == GAIN)? 1 : 0);
|
||||
queue_event(ev);
|
||||
}
|
||||
|
||||
@ -421,9 +421,9 @@ static inline void queue_active_event(SdlActivationType type, size_t changed_app
|
||||
// they control the main loop.
|
||||
static Uint8 app_state;
|
||||
|
||||
static void active_change_state(SdlActivationType type, size_t changed_app_state)
|
||||
static void active_change_state(SdlActivationType type, Uint8 changed_app_state)
|
||||
{
|
||||
size_t old_app_state = app_state;
|
||||
Uint8 old_app_state = app_state;
|
||||
|
||||
if(type == GAIN)
|
||||
app_state |= changed_app_state;
|
||||
@ -440,7 +440,7 @@ static void reset_all_keys();
|
||||
static LRESULT OnActivate(HWND hWnd, UINT state, HWND UNUSED(hWndActDeact), BOOL fMinimized)
|
||||
{
|
||||
SdlActivationType type;
|
||||
size_t changed_app_state;
|
||||
Uint8 changed_app_state;
|
||||
|
||||
// went active and not minimized
|
||||
if(state != WA_INACTIVE && !fMinimized)
|
||||
@ -939,11 +939,13 @@ static LRESULT OnDestroy(HWND hWnd)
|
||||
queue_quit_event();
|
||||
PostQuitMessage(0);
|
||||
|
||||
#ifdef _DEBUG
|
||||
// see http://www.adrianmccarthy.com/blog/?p=51
|
||||
// with WM_QUIT in the message queue, MessageBox will immediately
|
||||
// return IDABORT. to ensure any subsequent CRT error reports are
|
||||
// at least somewhat visible, we redirect them to debug output.
|
||||
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -300,15 +300,12 @@ LibError sys_error_description_r(int user_err, char* buf, size_t max_chars)
|
||||
void sys_get_module_filename(void* addr, wchar_t* path, size_t max_chars)
|
||||
{
|
||||
path[0] = '\0'; // in case either API call below fails
|
||||
wchar_t* module_filename = path;
|
||||
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
if(VirtualQuery(addr, &mbi, sizeof(mbi)))
|
||||
{
|
||||
HMODULE hModule = (HMODULE)mbi.AllocationBase;
|
||||
if(GetModuleFileNameW(hModule, path, (DWORD)max_chars))
|
||||
module_filename = wcsrchr(path, '\\')+1;
|
||||
// note: GetModuleFileName returns full path => a '\\' exists
|
||||
GetModuleFileNameW(hModule, path, (DWORD)max_chars);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -420,7 +420,7 @@ WinScopedDisableWow64Redirection::~WinScopedDisableWow64Redirection()
|
||||
|
||||
HMODULE wutil_LibModuleHandle;
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD reason, LPVOID reserved)
|
||||
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD UNUSED(reason), LPVOID UNUSED(reserved))
|
||||
{
|
||||
DisableThreadLibraryCalls(hInstance);
|
||||
wutil_LibModuleHandle = hInstance;
|
||||
|
@ -37,8 +37,9 @@ LIB_API double timer_Resolution(void);
|
||||
// scope timing
|
||||
|
||||
/// used by TIMER
|
||||
class ScopeTimer : noncopyable
|
||||
class ScopeTimer
|
||||
{
|
||||
NONCOPYABLE(ScopeTimer);
|
||||
public:
|
||||
ScopeTimer(const char* description)
|
||||
: m_t0(timer_Time()), m_description(description)
|
||||
@ -176,7 +177,6 @@ public:
|
||||
ss << m_ticks*scale;
|
||||
ss << unit;
|
||||
return ss.str();
|
||||
|
||||
}
|
||||
|
||||
double ToSeconds() const
|
||||
@ -228,7 +228,8 @@ public:
|
||||
std::stringstream ss;
|
||||
ss << m_seconds*scale;
|
||||
ss << unit;
|
||||
return ss.str(); }
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
double ToSeconds() const
|
||||
{
|
||||
@ -296,6 +297,7 @@ LIB_API void timer_DisplayClientTotals();
|
||||
/// used by TIMER_ACCRUE
|
||||
class ScopeTimerAccrue
|
||||
{
|
||||
NONCOPYABLE(ScopeTimerAccrue);
|
||||
public:
|
||||
ScopeTimerAccrue(TimerClient* tc)
|
||||
: m_tc(tc)
|
||||
|
Loading…
Reference in New Issue
Block a user