Merge pull request #3945 from comex/warning-fixes-2016

Warning fixes 2016
This commit is contained in:
Mat M 2016-06-26 02:16:35 -04:00 committed by GitHub
commit 8d1a70af9a
3 changed files with 15 additions and 6 deletions

View File

@ -31,10 +31,13 @@
// Uncomment the following line to be able to run Dolphin in Valgrind. // Uncomment the following line to be able to run Dolphin in Valgrind.
//#undef MAP_32BIT //#undef MAP_32BIT
#if !defined(_WIN32) && defined(_M_X86_64) && !defined(MAP_32BIT) #if !defined(_WIN32)
#include <unistd.h> #include <unistd.h>
#define PAGE_MASK (getpagesize() - 1) static uintptr_t RoundPage(uintptr_t addr)
#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK)) {
uintptr_t mask = getpagesize() - 1;
return (addr + mask) & ~mask;
}
#endif #endif
// This is purposely not a full wrapper for virtualalloc/mmap, but it // This is purposely not a full wrapper for virtualalloc/mmap, but it
@ -54,7 +57,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
// effect of discarding already mapped pages that happen to be in the // effect of discarding already mapped pages that happen to be in the
// requested virtual memory range (such as the emulated RAM, sometimes). // requested virtual memory range (such as the emulated RAM, sometimes).
if (low && (!map_hint)) if (low && (!map_hint))
map_hint = (char*)round_page(512 * 1024 * 1024); /* 0.5 GB rounded up to the next page */ map_hint = (char*)RoundPage(512 * 1024 * 1024); /* 0.5 GB rounded up to the next page */
#endif #endif
void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE
#if defined(_M_X86_64) && defined(MAP_32BIT) #if defined(_M_X86_64) && defined(MAP_32BIT)
@ -81,7 +84,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
if (low) if (low)
{ {
map_hint += size; map_hint += size;
map_hint = (char*)round_page(map_hint); /* round up to the next page */ map_hint = (char*)RoundPage((uintptr_t)map_hint); /* round up to the next page */
} }
} }
#endif #endif

View File

@ -154,9 +154,15 @@ void DolphinAnalytics::MakeBaseBuilder()
builder.AddData("os-type", "osx"); builder.AddData("os-type", "osx");
SInt32 osxmajor, osxminor, osxbugfix; SInt32 osxmajor, osxminor, osxbugfix;
// Gestalt is deprecated, but the replacement (NSProcessInfo
// operatingSystemVersion) is only available on OS X 10.10, so we need to use
// it anyway. Change this someday when Dolphin depends on 10.10+.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
Gestalt(gestaltSystemVersionMajor, &osxmajor); Gestalt(gestaltSystemVersionMajor, &osxmajor);
Gestalt(gestaltSystemVersionMinor, &osxminor); Gestalt(gestaltSystemVersionMinor, &osxminor);
Gestalt(gestaltSystemVersionBugFix, &osxbugfix); Gestalt(gestaltSystemVersionBugFix, &osxbugfix);
#pragma GCC diagnostic pop
builder.AddData("osx-ver-major", osxmajor); builder.AddData("osx-ver-major", osxmajor);
builder.AddData("osx-ver-minor", osxminor); builder.AddData("osx-ver-minor", osxminor);

View File

@ -18,7 +18,7 @@ public:
void ResetQuery() override {} void ResetQuery() override {}
u32 GetQueryResult(PerfQueryType type) override { return 0; } u32 GetQueryResult(PerfQueryType type) override { return 0; }
void FlushResults() override {} void FlushResults() override {}
bool IsFlushed() const { return true; } bool IsFlushed() const override { return true; }
}; };
} // namespace } // namespace