The compiler need not obey the static keyword, so to avoid linker

problems, whole functions in .h files need to also be static in
case they are included in several .cpp files.

Also a few other minor LTO fixes.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7082 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2011-02-05 16:06:05 +00:00
parent 04fcd9499a
commit 98e24f5873
15 changed files with 43 additions and 60 deletions

View File

@ -3,9 +3,6 @@
Import('env')
import sys
if sys.platform == 'darwin':
Return()
if env.has_key('shared_zlib') and env['shared_zlib']:
env['LIBS'] += 'z'
Return()

View File

@ -120,12 +120,12 @@ if sys.platform == 'darwin':
env['CCFLAGS'] += ['-march=core2', '-mdynamic-no-pic']
env['CCFLAGS'] += ['-Xarch_i386', '-msse3', '-Xarch_x86_64', '-mssse3']
env['CXXFLAGS'] += ['-x', 'objective-c++']
env['FRAMEWORKS'] += ['AppKit', 'Carbon', 'CoreFoundation', 'CoreServices']
env['FRAMEWORKS'] += ['AudioToolbox', 'AudioUnit', 'CoreAudio', 'WebKit']
env['FRAMEWORKS'] += ['IOBluetooth', 'IOKit', 'OpenGL']
env['FRAMEWORKS'] += ['AudioToolbox', 'AudioUnit', 'Carbon', 'Cocoa']
env['FRAMEWORKS'] += ['CoreAudio', 'CoreFoundation', 'CoreServices']
env['FRAMEWORKS'] += ['IOBluetooth', 'IOKit', 'OpenGL', 'WebKit']
env['LIBPATH'] += ['/usr/lib'] # XXX clang
env['LINKFLAGS'] += ccld
env['LINKFLAGS'] += ['-Wl,-dead_strip', '-Wl,-dead_strip_dylibs']
env['LINKFLAGS'] += ['-Wl,-dead_strip,-dead_strip_dylibs']
env['LINKFLAGS'] += ['-Wl,-pagezero_size,0x1000']
env['LINKFLAGS'] += ['-Wl,-search_paths_first']
@ -156,11 +156,8 @@ if sys.platform == 'darwin':
env['CPPPATH'] += wxenv['CPPPATH']
env['wxconfiglibs'] = wxenv['LIBS']
env['CPPPATH'] += ['#Externals']
env['FRAMEWORKPATH'] += ['Externals/Cg']
env['FRAMEWORKS'] += ['Cg']
env['data_dir'] = '#' + env['prefix'] + '/Dolphin.app/Contents/Resources'
env['shared_zlib'] = True
if env['bundle']:
app = env['prefix'] + '/Dolphin.app'

View File

@ -30,10 +30,6 @@ namespace AudioCommon
{
SoundStream *InitSoundStream(CMixer *mixer, void *hWnd)
{
// This looks evil.
if (!mixer)
mixer = new CMixer();
std::string backend = ac_Config.sBackend;
if (backend == BACKEND_OPENAL && OpenALStream::isValid())
soundStream = new OpenALStream(mixer);
@ -57,12 +53,11 @@ namespace AudioCommon
ac_Config.Update();
if (soundStream->Start())
{
#if 0
// Start the sound recording
/*
if (ac_Config.record) {
if (ac_Config.record)
soundStream->StartLogAudio(FULL_DUMP_DIR g_Config.recordFile);
}
*/
#endif
return soundStream;
}
PanicAlertT("Could not initialize backend %s.", backend.c_str());
@ -81,7 +76,10 @@ namespace AudioCommon
if (soundStream)
{
soundStream->Stop();
#if 0
if (ac_Config.record)
soundStream->StopLogAudio();
#endif
delete soundStream;
soundStream = NULL;
}

View File

@ -449,7 +449,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples)
makes identical hashes, this is just a c/p of the 64-bit one. */
u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
{
const u64 m = 0xc6a4a7935bd1e995;
const u64 m = 0xc6a4a7935bd1e995ULL;
u64 h = len * m;
const int r = 47;
u32 Step = (len / 8);

View File

@ -68,7 +68,7 @@ bool TryParse(const std::string &str, bool *output);
bool TryParse(const std::string &str, u32 *output);
template <typename N>
bool TryParse(const std::string &str, N *const output)
static bool TryParse(const std::string &str, N *const output)
{
std::istringstream iss(str);

View File

@ -38,12 +38,12 @@
// --- SR
// ---------------------------------------------------------------------------------------
inline void dsp_SR_set_flag(int flag)
static inline void dsp_SR_set_flag(int flag)
{
g_dsp.r.sr |= flag;
}
inline bool dsp_SR_is_flag_set(int flag)
static inline bool dsp_SR_is_flag_set(int flag)
{
return (g_dsp.r.sr & flag) != 0;
}
@ -52,7 +52,7 @@ inline bool dsp_SR_is_flag_set(int flag)
// --- AR increments, decrements
// ---------------------------------------------------------------------------------------
inline u16 dsp_increase_addr_reg(u16 reg, s16 _ix)
static inline u16 dsp_increase_addr_reg(u16 reg, s16 _ix)
{
u32 ar = g_dsp.r.ar[reg];
u32 wr = g_dsp.r.wr[reg];
@ -75,7 +75,7 @@ inline u16 dsp_increase_addr_reg(u16 reg, s16 _ix)
return nar;
}
inline u16 dsp_decrease_addr_reg(u16 reg, s16 _ix)
static inline u16 dsp_decrease_addr_reg(u16 reg, s16 _ix)
{
u32 ar = g_dsp.r.ar[reg];
u32 wr = g_dsp.r.wr[reg];
@ -98,7 +98,7 @@ inline u16 dsp_decrease_addr_reg(u16 reg, s16 _ix)
return nar;
}
inline u16 dsp_increment_addr_reg(u16 reg)
static inline u16 dsp_increment_addr_reg(u16 reg)
{
u32 ar = g_dsp.r.ar[reg];
u32 wr = g_dsp.r.wr[reg];
@ -110,7 +110,7 @@ inline u16 dsp_increment_addr_reg(u16 reg)
return nar;
}
inline u16 dsp_decrement_addr_reg(u16 reg)
static inline u16 dsp_decrement_addr_reg(u16 reg)
{
u32 ar = g_dsp.r.ar[reg];
u32 wr = g_dsp.r.wr[reg];
@ -127,7 +127,7 @@ inline u16 dsp_decrement_addr_reg(u16 reg)
// --- reg
// ---------------------------------------------------------------------------------------
inline u16 dsp_op_read_reg(int reg)
static inline u16 dsp_op_read_reg(int reg)
{
switch (reg & 0x1f) {
case DSP_REG_ST0:
@ -177,7 +177,7 @@ inline u16 dsp_op_read_reg(int reg)
}
}
inline void dsp_op_write_reg(int reg, u16 val)
static inline void dsp_op_write_reg(int reg, u16 val)
{
switch (reg & 0x1f) {
// 8-bit sign extended registers. Should look at prod.h too...
@ -238,7 +238,7 @@ inline void dsp_op_write_reg(int reg, u16 val)
}
}
inline void dsp_conditional_extend_accum(int reg)
static inline void dsp_conditional_extend_accum(int reg)
{
switch (reg)
{
@ -258,7 +258,7 @@ inline void dsp_conditional_extend_accum(int reg)
// --- prod
// ---------------------------------------------------------------------------------------
inline s64 dsp_get_long_prod()
static inline s64 dsp_get_long_prod()
{
#if PROFILE
ProfilerAddDelta(g_dsp.err_pc, 1);
@ -274,7 +274,7 @@ inline s64 dsp_get_long_prod()
return val;
}
inline s64 dsp_get_long_prod_round_prodl()
static inline s64 dsp_get_long_prod_round_prodl()
{
s64 prod = dsp_get_long_prod();

View File

@ -20,7 +20,7 @@
#include "../../DSP.h"
inline s16 ADPCM_Step(PBADPCMInfo &adpcm, u32& samplePos, u32 newSamplePos, u16 frac)
static inline s16 ADPCM_Step(PBADPCMInfo &adpcm, u32& samplePos, u32 newSamplePos, u16 frac)
{
while (samplePos < newSamplePos)
{
@ -63,7 +63,7 @@ inline s16 ADPCM_Step(PBADPCMInfo &adpcm, u32& samplePos, u32 newSamplePos, u16
// TODO: WTF is going on here?!?
// Volume control (ramping)
inline u16 ADPCM_Vol(u16 vol, u16 delta)
static inline u16 ADPCM_Vol(u16 vol, u16 delta)
{
int x = vol;
if (delta && delta < 0x5000)

View File

@ -37,7 +37,7 @@
// A shortcut to access the bitmaps
#define wxGetBitmapFromMemory(name) _wxGetBitmapFromMemory(name, sizeof(name))
inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length)
static inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length)
{
wxMemoryInputStream is(data, length);
return(wxBitmap(wxImage(is, wxBITMAP_TYPE_ANY, -1), -1));

View File

@ -46,8 +46,12 @@ else:
if sys.platform == 'win32':
files += ["stdafx.cpp"]
elif sys.platform == 'darwin':
frameworksflags += ['-Wl,-framework,QuickTime', '-Wl,-no_arch_warnings']
frameworksflags += ['-weak_framework', 'OpenCL']
env['CPPPATH'] += ['#Externals']
env['FRAMEWORKPATH'] += ['Externals/Cg']
frameworksflags += ['-Wl,-weak_framework,Cg']
frameworksflags += ['-Wl,-weak_framework,OpenCL']
frameworksflags += ['-Wl,-weak_framework,QuickTime']
frameworksflags += ['-Wl,-no_arch_warnings']
exe = '#' + env['prefix'] + '/Dolphin.app/Contents/MacOS/Dolphin'

View File

@ -8,7 +8,6 @@ files = [
'BPStructs.cpp',
'CPMemory.cpp',
'CommandProcessor.cpp',
'Debugger.cpp',
'DLCache.cpp',
'Fifo.cpp',
'FramebufferManagerBase.cpp',
@ -44,4 +43,7 @@ files = [
'memcpy_amd.cpp',
]
if env['HAVE_WX']:
files += ['Debugger.cpp']
env['LIBS'] += env.StaticObject(files)

View File

@ -296,7 +296,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
unsigned int newWidth = width;
unsigned int newHeight = height;
sprintf(texPathTemp, "%s_%08lx_%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32) (texHash & 0x00000000FFFFFFFFLL), texformat);
sprintf(texPathTemp, "%s_%08x_%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32) (texHash & 0x00000000FFFFFFFFLL), texformat);
pcfmt = HiresTextures::GetHiresTex(texPathTemp, &newWidth, &newHeight, texformat, temp);
if (pcfmt != PC_TEX_FMT_NONE)
@ -397,7 +397,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
if (false == File::Exists(szDir) || false == File::IsDirectory(szDir))
File::CreateDir(szDir);
sprintf(szTemp, "%s/%s_%08lx_%i.png", szDir, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32) (texHash & 0x00000000FFFFFFFFLL), texformat);
sprintf(szTemp, "%s/%s_%08x_%i.png", szDir, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32) (texHash & 0x00000000FFFFFFFFLL), texformat);
if (false == File::Exists(szTemp))
entry->Save(szTemp);

View File

@ -12,9 +12,4 @@ libs = [
env['dspcore'],
]
if sys.platform == 'darwin':
frames = ['CoreFoundation']
else:
frames = []
env.Program('dsptool', files, LIBS = libs, FRAMEWORKS = frames)
env.Program('dsptool', files, LIBS = libs)

View File

@ -108,7 +108,7 @@ unsigned int VideoBackend::PeekMessages()
void VideoBackend::UpdateFPSDisplay(const char *text)
{
char temp[100];
snprintf(temp, sizeof temp, "%s | OpenGL | %s", svn_rev_str, text);
snprintf(temp, sizeof temp, "%s | Software | %s", svn_rev_str, text);
OpenGL_SetWindowText(temp);
}

View File

@ -87,11 +87,6 @@ void VideoBackend::EmuStateChange(EMUSTATE_CHANGE newState)
}
//bool IsD3D()
//{
// return false;
//}
void VideoBackend::Shutdown()
{
SWRenderer::Shutdown();

View File

@ -14,9 +14,4 @@ libs = [
env['dspcore'],
]
if sys.platform == 'darwin':
frames = ['CoreFoundation']
else:
frames = []
env.Program('tester', files, LIBS = libs, FRAMEWORKS = frames)
env.Program('tester', files, LIBS = libs)