Fix some cases of variables being used uninitialized. Also some unused

variables, writeable strings and dangerously shadowed variables.

index(), gamma(), exp() and y0() are POSIX functions and using those
names can cause namespace confusion.

A number of C files were missing the final newline required by ANSI C
and some versions of GCC are pedantic enough to complain about this.

These changes simply the scons build, allowing us to get rid of
filterWarnings which is simply more trouble than it's worth.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5574 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2010-06-02 20:35:12 +00:00
parent 03d1438be8
commit 30e437f9e3
85 changed files with 212 additions and 284 deletions

View File

@ -389,7 +389,7 @@ typedef unsigned int ppc_word;
{
const char *cnd;
if (cnd = trap_condition[PPCGETD(in)]) {
if ((cnd = trap_condition[PPCGETD(in)]) != NULL) {
dp->flags |= dmode;
sprintf(dp->opcode,"t%c%s",dmode?'d':'w',cnd);
imm(dp,in,0,2,0);
@ -408,7 +408,7 @@ typedef unsigned int ppc_word;
if (i)
dp->flags |= PPCF_64;
sprintf(dp->opcode,"%si",cmpname[uimm*2+i]);
if (i = (int)PPCGETCRD(in)) {
if ((i = (int)PPCGETCRD(in))) {
sprintf(oper,"cr%c,",'0'+i);
dp->operands += 4;
}
@ -491,7 +491,7 @@ typedef unsigned int ppc_word;
if (d & 0x8000) d |= 0xffff0000;
if (offs = branch(dp,in,"",(in&2)?1:0,d)) {
if ((offs = branch(dp,in,"",(in&2)?1:0,d))) {
oper += offs;
*oper++ = ',';
}
@ -619,7 +619,7 @@ typedef unsigned int ppc_word;
if (i)
dp->flags |= PPCF_64;
strcpy(dp->opcode,cmpname[((in&PPCIDX2MASK)?2:0)+i]);
if (i = (int)PPCGETCRD(in))
if ((i = (int)PPCGETCRD(in)))
oper += sprintf(oper,"cr%c,",'0'+i);
ra_rb(oper,in);
}
@ -633,7 +633,7 @@ typedef unsigned int ppc_word;
const char *cnd;
int to = (int)PPCGETD(in);
if (cnd = trap_condition[to]) {
if ((cnd = trap_condition[to])) {
dp->flags |= dmode;
sprintf(dp->opcode,"t%c%s",dmode?'d':'w',cnd);
ra_rb(dp->operands,in);
@ -991,7 +991,6 @@ typedef unsigned int ppc_word;
static void ps(struct DisasmPara_PPC *dp,ppc_word inst)
{
ppc_word pc = *dp->iaddr;
char *op = dp->opcode;
char *pr = dp->operands;
switch ((inst>>1)&0x1F)
@ -1015,7 +1014,7 @@ typedef unsigned int ppc_word;
return;
case 23:
strcpy(op, "ps_sel");
sprintf(pr, "p%u>=0?p%u:p%u", FD, FA, FC, FB);
sprintf(pr, "p%u>=0?p%u:p%u", FD, FA, FC);
return;
case 24:
strcpy(op, "ps_res");
@ -1094,19 +1093,19 @@ typedef unsigned int ppc_word;
return;
case 0:
strcpy(op, "ps_cmpu0");
sprintf(pr, "ps_cmpu0", FD);
sprintf(pr, "ps_cmpu0");
return;
case 32:
strcpy(op,"ps_cmpq0");
sprintf(pr, "ps_cmpo0", FD);
sprintf(pr, "ps_cmpo0");
return;
case 64:
strcpy(op,"ps_cmpu1");
sprintf(pr, "ps_cmpu1", FD);
sprintf(pr, "ps_cmpu1");
return;
case 96:
strcpy(op,"ps_cmpo1");
sprintf(pr, "ps_cmpo1", FD);
sprintf(pr, "ps_cmpo1");
return;
case 528:
strcpy(op,"ps_merge00");
@ -1126,7 +1125,7 @@ typedef unsigned int ppc_word;
return;
case 1014:
strcpy(op,"dcbz_l");
sprintf(pr, "");
*pr = '\0';
return;
}
@ -1138,7 +1137,6 @@ typedef unsigned int ppc_word;
static void ps_mem(struct DisasmPara_PPC *dp,ppc_word inst)
{
ppc_word pc = *dp->iaddr;
char *op = dp->opcode;
char *pr = dp->operands;
switch (PPCGETIDX(inst))
@ -1149,7 +1147,7 @@ typedef unsigned int ppc_word;
break;
case 57:
strcpy(op,"psq_lu");
sprintf(pr, "", FD);
*pr = '\0';
break;
case 60:
strcpy(op,"psq_st");

View File

@ -14,9 +14,4 @@ files = [
if sys.platform == 'win32':
files += [ "stdafx.cpp" ]
env_bochs = env.Clone(
CCFLAGS = env.filterWarnings(env['CCFLAGS']),
CXXFLAGS = env.filterWarnings(env['CXXFLAGS']),
)
env_bochs.StaticLibrary(env['local_libs'] + "bdisasm", files)
env.StaticLibrary(env['local_libs'] + "bdisasm", files)

View File

@ -6,8 +6,4 @@ files = [
"minilzo.c",
]
env_lzo = env.Clone(
CCFLAGS = env.filterWarnings(env['CCFLAGS']),
CXXFLAGS = env.filterWarnings(env['CXXFLAGS']),
)
env_lzo.StaticLibrary(env['local_libs'] + "lzo2", files)
env.StaticLibrary(env['local_libs'] + "lzo2", files)

View File

@ -29,16 +29,10 @@ files = [
'ltable.c',
'ltablib.c',
'ltm.c',
'lua.c',
'luac.c',
'lundump.c',
'lvm.c',
'lzio.c',
'print.c',
]
env_lua = env.Clone(
CCFLAGS = env.filterWarnings(env['CCFLAGS']),
CXXFLAGS = env.filterWarnings(env['CXXFLAGS']),
)
env_lua.StaticLibrary(env['local_libs'] + "lua", files)
env.StaticLibrary(env['local_libs'] + "lua", files)

View File

@ -114,7 +114,7 @@ typedef struct lua_TValue {
/* Macros to set values */
#define setnilvalue(obj) ((obj)->tt=LUA_TNIL)
#define setnilvalue(obj) ((obj)->value.n=0, (obj)->tt=LUA_TNIL)
#define setnvalue(obj,x) \
{ TValue *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; }

View File

@ -14,9 +14,4 @@ files = [
"SFML/Network/Unix/SocketHelper.cpp",
]
env_sfml = env.Clone(
CCFLAGS = env.filterWarnings(env['CCFLAGS']),
CXXFLAGS = env.filterWarnings(env['CXXFLAGS']),
)
env_sfml.StaticLibrary(env['local_libs'] + "sfml-network", files)
env.StaticLibrary(env['local_libs'] + "sfml-network", files)

View File

@ -209,7 +209,7 @@ Packet& Packet::operator >>(double& Data)
Packet& Packet::operator >>(char* Data)
{
// First extract string length
Uint32 Length;
Uint32 Length = 0;
*this >> Length;
if ((Length > 0) && CheckSize(Length))
@ -227,7 +227,7 @@ Packet& Packet::operator >>(char* Data)
Packet& Packet::operator >>(std::string& Data)
{
// First extract string length
Uint32 Length;
Uint32 Length = 0;
*this >> Length;
Data.clear();
@ -245,7 +245,7 @@ Packet& Packet::operator >>(std::string& Data)
Packet& Packet::operator >>(wchar_t* Data)
{
// First extract string length
Uint32 Length;
Uint32 Length = 0;
*this >> Length;
if ((Length > 0) && CheckSize(Length * sizeof(Int32)))
@ -253,7 +253,7 @@ Packet& Packet::operator >>(wchar_t* Data)
// Then extract characters
for (Uint32 i = 0; i < Length; ++i)
{
Uint32 c;
Uint32 c = 0;
*this >> c;
Data[i] = static_cast<wchar_t>(c);
}
@ -265,7 +265,7 @@ Packet& Packet::operator >>(wchar_t* Data)
Packet& Packet::operator >>(std::wstring& Data)
{
// First extract string length
Uint32 Length;
Uint32 Length = 0;
*this >> Length;
Data.clear();
@ -274,7 +274,7 @@ Packet& Packet::operator >>(std::wstring& Data)
// Then extract characters
for (Uint32 i = 0; i < Length; ++i)
{
Uint32 c;
Uint32 c = 0;
*this >> c;
Data += static_cast<wchar_t>(c);
}

View File

@ -9,10 +9,4 @@ files = [
'stb_image_aug.c'
]
env_soil = env.Clone(
CCFLAGS = env.filterWarnings(env['CCFLAGS']),
CXXFLAGS = env.filterWarnings(env['CXXFLAGS']),
parse_flags = ['-fPIC']
)
env_soil.StaticLibrary(env['local_libs'] + "SOIL", files)
env.StaticLibrary(env['local_libs'] + "SOIL", files)

18
Externals/SOIL/SOIL.c vendored
View File

@ -45,7 +45,7 @@
#include <string.h>
/* error reporting */
char *result_string_pointer = "SOIL initialized";
const char *result_string_pointer = "SOIL initialized";
/* for loading cube maps */
enum{
@ -54,7 +54,7 @@ enum{
SOIL_CAPABILITY_PRESENT = 1
};
static int has_cubemap_capability = SOIL_CAPABILITY_UNKNOWN;
/* static int has_cubemap_capability = SOIL_CAPABILITY_UNKNOWN; */
int query_cubemap_capability( void );
#define SOIL_TEXTURE_WRAP_R 0x8072
#define SOIL_CLAMP_TO_EDGE 0x812F
@ -71,15 +71,15 @@ int query_cubemap_capability( void );
#define SOIL_PROXY_TEXTURE_CUBE_MAP 0x851B
#define SOIL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
/* for non-power-of-two texture */
static int has_NPOT_capability = SOIL_CAPABILITY_UNKNOWN;
/* static int has_NPOT_capability = SOIL_CAPABILITY_UNKNOWN; */
int query_NPOT_capability( void );
/* for texture rectangles */
static int has_tex_rectangle_capability = SOIL_CAPABILITY_UNKNOWN;
/* static int has_tex_rectangle_capability = SOIL_CAPABILITY_UNKNOWN; */
int query_tex_rectangle_capability( void );
#define SOIL_TEXTURE_RECTANGLE_ARB 0x84F5
#define SOIL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8
/* for using DXT compression */
static int has_DXT_capability = SOIL_CAPABILITY_UNKNOWN;
/* static int has_DXT_capability = SOIL_CAPABILITY_UNKNOWN; */
int query_DXT_capability( void );
#define SOIL_RGB_S3TC_DXT1 0x83F0
#define SOIL_RGBA_S3TC_DXT1 0x83F1
@ -1434,7 +1434,7 @@ int
}
#endif
unsigned char*
unsigned char *
SOIL_load_image
(
const char *filename,
@ -1442,7 +1442,7 @@ unsigned char*
int force_channels
)
{
unsigned char *result = stbi_load( filename,
stbi_uc *result = stbi_load( filename,
width, height, channels, force_channels );
if( result == NULL )
{
@ -1454,7 +1454,7 @@ unsigned char*
return result;
}
unsigned char*
unsigned char *
SOIL_load_image_from_memory
(
const unsigned char *const buffer,
@ -1463,7 +1463,7 @@ unsigned char*
int force_channels
)
{
unsigned char *result = stbi_load_from_memory(
stbi_uc *result = stbi_load_from_memory(
buffer, buffer_length,
width, height, channels,
force_channels );

View File

@ -107,7 +107,7 @@ unsigned char* convert_image_to_DXT1(
int i, j, x, y;
unsigned char ublock[16*3];
unsigned char cblock[8];
int index = 0, chan_step = 1;
int cindex = 0, chan_step = 1;
int block_count = 0;
/* error check */
*out_size = 0;
@ -172,7 +172,7 @@ unsigned char* convert_image_to_DXT1(
/* copy the data from the block into the main block */
for( x = 0; x < 8; ++x )
{
compressed[index++] = cblock[x];
compressed[cindex++] = cblock[x];
}
}
}
@ -188,7 +188,7 @@ unsigned char* convert_image_to_DXT5(
int i, j, x, y;
unsigned char ublock[16*4];
unsigned char cblock[8];
int index = 0, chan_step = 1;
int cindex = 0, chan_step = 1;
int block_count = 0, has_alpha;
/* error check */
*out_size = 0;
@ -259,7 +259,7 @@ unsigned char* convert_image_to_DXT5(
/* copy the data from the compressed alpha block into the main buffer */
for( x = 0; x < 8; ++x )
{
compressed[index++] = cblock[x];
compressed[cindex++] = cblock[x];
}
/* then compress the color block */
++block_count;
@ -267,7 +267,7 @@ unsigned char* convert_image_to_DXT5(
/* copy the data from the compressed color block into the main buffer */
for( x = 0; x < 8; ++x )
{
compressed[index++] = cblock[x];
compressed[cindex++] = cblock[x];
}
}
}

View File

@ -117,14 +117,14 @@ typedef unsigned char validate_uint32[sizeof(uint32)==4];
//
// this is not threadsafe
static char *failure_reason;
static const char *failure_reason;
char *stbi_failure_reason(void)
const char *stbi_failure_reason(void)
{
return failure_reason;
}
static int e(char *str)
static int e(const char *str)
{
failure_reason = str;
return 0;
@ -333,10 +333,10 @@ extern int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, in
static float h2l_gamma_i=1.0f/2.2f, h2l_scale_i=1.0f;
static float l2h_gamma=2.2f, l2h_scale=1.0f;
void stbi_hdr_to_ldr_gamma(float gamma) { h2l_gamma_i = 1/gamma; }
void stbi_hdr_to_ldr_gamma(float gammafactor) { h2l_gamma_i = 1/gammafactor; }
void stbi_hdr_to_ldr_scale(float scale) { h2l_scale_i = 1/scale; }
void stbi_ldr_to_hdr_gamma(float gamma) { l2h_gamma = gamma; }
void stbi_ldr_to_hdr_gamma(float gammafactor) { l2h_gamma = gammafactor; }
void stbi_ldr_to_hdr_scale(float scale) { l2h_scale = scale; }
#endif
@ -368,6 +368,8 @@ typedef struct
static void start_file(stbi *s, FILE *f)
{
s->img_file = f;
s->img_buffer = NULL;
s->img_buffer_end = NULL;
}
#endif
@ -1128,14 +1130,14 @@ static int process_marker(jpeg *z, int m)
L = get16(&z->s)-2;
while (L > 0) {
uint8 *v;
int sizes[16],i,m=0;
int sizes[16],i,m2=0;
int q = get8(&z->s);
int tc = q >> 4;
int th = q & 15;
if (tc > 1 || th > 3) return e("bad DHT header","Corrupt JPEG");
for (i=0; i < 16; ++i) {
sizes[i] = get8(&z->s);
m += sizes[i];
m2 += sizes[i];
}
L -= 17;
if (tc == 0) {
@ -1145,9 +1147,9 @@ static int process_marker(jpeg *z, int m)
if (!build_huffman(z->huff_ac+th, sizes)) return 0;
v = z->huff_ac[th].values;
}
for (i=0; i < m; ++i)
for (i=0; i < m2; ++i)
v[i] = get8u(&z->s);
L -= m;
L -= m2;
}
return L==0;
}
@ -1671,10 +1673,10 @@ static int zbuild_huffman(zhuffman *z, uint8 *sizelist, int num)
z->size[c] = (uint8)s;
z->value[c] = (uint16)i;
if (s <= ZFAST_BITS) {
int k = bit_reverse(next_code[s],s);
while (k < (1 << ZFAST_BITS)) {
z->fast[k] = (uint16) c;
k += (1 << s);
int k2 = bit_reverse(next_code[s],s);
while (k2 < (1 << ZFAST_BITS)) {
z->fast[k2] = (uint16) c;
k2 += (1 << s);
}
}
++next_code[s];
@ -1947,12 +1949,12 @@ static int parse_zlib(zbuf *a, int parse_header)
return 1;
}
static int do_zlib(zbuf *a, char *obuf, int olen, int exp, int parse_header)
static int do_zlib(zbuf *a, char *obuf, int olen, int expandable, int parse_header)
{
a->zout_start = obuf;
a->zout = obuf;
a->zout_end = obuf + olen;
a->z_expandable = exp;
a->z_expandable = expandable;
return parse_zlib(a, parse_header);
}
@ -2092,10 +2094,13 @@ static int create_png_image_raw(png *a, uint8 *raw, uint32 raw_len, int out_n, u
a->out = (uint8 *) malloc(x * y * out_n);
if (!a->out) return e("outofmem", "Out of memory");
if (!stbi_png_partial) {
if (s->img_x == x && s->img_y == y)
if (raw_len != (img_n * x + 1) * y) return e("not enough pixels","Corrupt PNG");
else // interlaced:
if (raw_len < (img_n * x + 1) * y) return e("not enough pixels","Corrupt PNG");
if (s->img_x == x && s->img_y == y) {
if (raw_len != (img_n * x + 1) * y)
return e("not enough pixels","Corrupt PNG");
} else { // interlaced:
if (raw_len < (img_n * x + 1) * y)
return e("not enough pixels","Corrupt PNG");
}
}
for (j=0; j < y; ++j) {
uint8 *cur = a->out + stride*j;
@ -2861,7 +2866,7 @@ static stbi_uc *tga_load(stbi *s, int *x, int *y, int *comp, int req_comp)
unsigned char *tga_palette = NULL;
int i, j;
unsigned char raw_data[4];
unsigned char trans_data[4];
unsigned char trans_data[4] = {0,0,0,0};
int RLE_count = 0;
int RLE_repeating = 0;
int read_next_pixel = 1;
@ -2995,6 +3000,8 @@ static stbi_uc *tga_load(stbi *s, int *x, int *y, int *comp, int req_comp)
trans_data[2] = raw_data[0];
trans_data[3] = raw_data[3];
break;
default:
return NULL;
}
// clear the reading flag for the next pixel
read_next_pixel = 0;
@ -3305,7 +3312,7 @@ stbi_uc *stbi_psd_load_from_memory (stbi_uc const *buffer, int len, int *x, int
#ifndef STBI_NO_HDR
static int hdr_test(stbi *s)
{
char *signature = "#?RADIANCE\n";
const char *signature = "#?RADIANCE\n";
int i;
for (i=0; signature[i]; ++i)
if (get8(s) != signature[i])
@ -3335,10 +3342,10 @@ int stbi_hdr_test_file(FILE *f)
#define HDR_BUFLEN 1024
static char *hdr_gettoken(stbi *z, char *buffer)
{
int len=0;
char *s = buffer, c = '\0';
int len=0;
char c = '\0';
c = get8(z);
c = get8(z);
while (!at_eof(z) && c != '\n') {
buffer[len++] = c;
@ -3645,7 +3652,7 @@ stbi_uc *stbi_hdr_load_rgbe_memory(stbi_uc *buffer, int len, int *x, int *y, int
static void write8(FILE *f, int x) { uint8 z = (uint8) x; fwrite(&z,1,1,f); }
static void writefv(FILE *f, char *fmt, va_list v)
static void writefv(FILE *f, const char *fmt, va_list v)
{
while (*fmt) {
switch (*fmt++) {
@ -3661,7 +3668,7 @@ static void writefv(FILE *f, char *fmt, va_list v)
}
}
static void writef(FILE *f, char *fmt, ...)
static void writef(FILE *f, const char *fmt, ...)
{
va_list v;
va_start(v, fmt);
@ -3708,7 +3715,7 @@ static void write_pixels(FILE *f, int rgb_dir, int vdir, int x, int y, int comp,
}
}
static int outfile(char const *filename, int rgb_dir, int vdir, int x, int y, int comp, void *data, int alpha, int pad, char *fmt, ...)
static int outfile(char const *filename, int rgb_dir, int vdir, int x, int y, int comp, void *data, int alpha, int pad, const char *fmt, ...)
{
FILE *f = fopen(filename, "wb");
if (f) {

View File

@ -204,17 +204,17 @@ extern float *stbi_loadf_from_file (FILE *f, int *x, int *y, i
#endif
extern float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
extern void stbi_hdr_to_ldr_gamma(float gamma);
extern void stbi_hdr_to_ldr_gamma(float gammafactor);
extern void stbi_hdr_to_ldr_scale(float scale);
extern void stbi_ldr_to_hdr_gamma(float gamma);
extern void stbi_ldr_to_hdr_gamma(float gammafactor);
extern void stbi_ldr_to_hdr_scale(float scale);
#endif // STBI_NO_HDR
// get a VERY brief reason for failure
// NOT THREADSAFE
extern char *stbi_failure_reason (void);
extern const char *stbi_failure_reason (void);
// free the loaded image -- this is just free()
extern void stbi_image_free (void *retval_from_stbi_load);

View File

@ -25,22 +25,6 @@ if env['HAVE_BLUEZ']:
if sys.platform == 'darwin':
files += [ "io_osx.m", ]
if sys.platform == 'darwin':
env_wiiuse = env.Clone(
CCFLAGS = env.filterWarnings(env['CCFLAGS']) + ' -fvisibility=default -x objective-c++',
CXXFLAGS = env.filterWarnings(env['CXXFLAGS']) + ' -x objective-c++',
)
else:
env_wiiuse = env.Clone(
CCFLAGS = env.filterWarnings(env['CCFLAGS']) + ' -fvisibility=default',
CXXFLAGS = env.filterWarnings(env['CXXFLAGS']),
parse_flags = ['-fPIC']
)
libs = [
'm',
]
env_wiiuse.StaticLibrary(env['local_libs'] + "wiiuse", files, LIBS=libs)
env.StaticLibrary(env['local_libs'] + "wiiuse", files, LIBS='m')
env['HAVE_WIIUSE'] = 1

View File

@ -57,8 +57,6 @@ static void guitar_hero_3_pressed_buttons(struct guitar_hero_3_t* gh3, short now
* @return Returns 1 if handshake was successful, 0 if not.
*/
int guitar_hero_3_handshake(struct wiimote_t* wm, struct guitar_hero_3_t* gh3, byte* data, unsigned short len) {
int offset = 0;
/*
* The good fellows that made the Guitar Hero 3 controller
* failed to factory calibrate the devices. There is no

View File

@ -267,7 +267,6 @@ int wiiuse_io_read(struct wiimote_t* wm) {
struct timeval tv;
fd_set fds;
int r;
int i;
if (!wm)
return 0;

View File

@ -682,7 +682,7 @@ static float ir_distance(struct ir_dot_t* dot) {
* precision for a big increase in usability.
*/
static int ir_correct_for_bounds(int* x, int* y, enum aspect_t aspect, int offset_x, int offset_y) {
int x0, y0;
int xzero, yzero;
int xs, ys;
if (aspect == WIIUSE_ASPECT_16_9) {
@ -693,13 +693,13 @@ static int ir_correct_for_bounds(int* x, int* y, enum aspect_t aspect, int offse
ys = WM_ASPECT_4_3_Y;
}
x0 = ((1024 - xs) / 2) + offset_x;
y0 = ((768 - ys) / 2) + offset_y;
xzero = ((1024 - xs) / 2) + offset_x;
yzero = ((768 - ys) / 2) + offset_y;
if ((*x >= x0)
&& (*x <= (x0 + xs))
&& (*y >= y0)
&& (*y <= (y0 + ys)))
if ((*x >= xzero)
&& (*x <= (xzero + xs))
&& (*y >= yzero)
&& (*y <= (yzero + ys)))
{
*x -= offset_x;
*y -= offset_y;

View File

@ -26,10 +26,16 @@ warnings = [
'packed',
'no-conversion',
]
# XXX check for the availability of these (in GCC 4.3 or newer)
if sys.platform != 'darwin':
warnings.append('no-array-bounds')
warnings.append('no-unused-result')
compileFlags = [
'-fno-exceptions',
'-fno-strict-aliasing',
'-msse2',
'-fPIC',
]
cppDefines = [
@ -111,15 +117,18 @@ vars.AddVariables(
BoolVariable('shared_soil', 'Use system shared libSOIL', False),
BoolVariable('shared_lzo', 'Use system shared liblzo2', False),
BoolVariable('shared_sfml', 'Use system shared libsfml-network', False),
PathVariable('userdir', 'Set the name of the user data directory in home', '.dolphin-emu', PathVariable.PathAccept),
PathVariable('userdir', 'Set the name of the user data directory in home',
'.dolphin-emu', PathVariable.PathAccept),
EnumVariable('install', 'Choose a local or global installation', 'local',
allowed_values = ('local', 'global'),
ignorecase = 2
),
PathVariable('prefix', 'Installation prefix (only used for a global build)', '/usr', PathVariable.PathAccept),
PathVariable('destdir', 'Temporary install location (for package building)', None, PathVariable.PathAccept),
PathVariable('prefix', 'Installation prefix (only used for a global build)',
'/usr', PathVariable.PathAccept),
PathVariable('destdir', 'Temporary install location (for package building)',
None, PathVariable.PathAccept),
EnumVariable('flavor', 'Choose a build flavor', 'release',
allowed_values = ('release', 'devel', 'debug', 'fastlog', 'prof'),
allowed_values = ('release','devel','debug','fastlog','prof'),
ignorecase = 2
),
PathVariable('wxconfig', 'Path to the wxconfig', None),
@ -191,6 +200,7 @@ if (flavour == 'debug'):
cppDefines.append('NDEBUG')
elif (flavour == 'devel'):
compileFlags.append('-ggdb')
warnings.append('error')
elif (flavour == 'fastlog'):
compileFlags.append('-O3')
cppDefines.append('DEBUGFAST')
@ -200,8 +210,6 @@ elif (flavour == 'prof'):
elif (flavour == 'release'):
compileFlags.append('-O3')
compileFlags.append('-fomit-frame-pointer');
# XXX please test -Werror builds on Linux and Windows and remove this condition
if sys.platform == 'darwin':
warnings.append('error')
# more warnings
if env['lint']:
@ -238,7 +246,8 @@ tests = {'CheckWXConfig' : wxconfig.CheckWXConfig,
}
#object files
env['build_dir'] = os.path.join(basedir, 'Build', platform.system() + '-' + platform.machine() + '-' + env['flavor'] + os.sep)
env['build_dir'] = os.path.join(basedir, 'Build',
platform.system() + '-' + platform.machine() + '-' + env['flavor'] + os.sep)
# Static libs go here
env['local_libs'] = env['build_dir'] + os.sep + 'libs' + os.sep
@ -260,7 +269,8 @@ if (env['install'] == 'global'):
env['plugin_dir'] = env['prefix'] + 'lib/dolphin-emu/'
env['data_dir'] = env['prefix'] + "share/dolphin-emu/"
else:
env['prefix'] = os.path.join(env['base_dir'] + 'Binary', platform.system() + '-' + platform.machine() + extra + os.sep)
env['prefix'] = os.path.join(env['base_dir'] + 'Binary',
platform.system() + '-' + platform.machine() + extra + os.sep)
env['binary_dir'] = env['prefix']
env['plugin_dir'] = env['prefix'] + 'plugins/'
env['data_dir'] = env['prefix']
@ -333,7 +343,8 @@ if not env['SHARED_LZO']:
env['SHARED_SFML'] = 0;
if env['shared_sfml']:
# TODO: Check the version of sfml. It should be at least version 1.5
env['SHARED_SFML'] = conf.CheckPKG('sfml-network') and conf.CheckCXXHeader("SFML/Network/Ftp.hpp")
env['SHARED_SFML'] = conf.CheckPKG('sfml-network') and \
conf.CheckCXXHeader("SFML/Network/Ftp.hpp")
if not env['SHARED_SFML']:
print "shared sfml-network library not detected"
print "falling back to the static library"
@ -349,8 +360,7 @@ if sys.platform == 'darwin':
env['HAVE_X11'] = 0
env['CC'] = "gcc-4.2"
env['CXX'] = "g++-4.2"
env['CFLAGS'] += ['-arch' , 'x86_64' , '-arch' , 'i386']
env['CXXFLAGS'] += ['-arch' , 'x86_64' , '-arch' , 'i386']
env['CCFLAGS'] += ['-arch' , 'x86_64' , '-arch' , 'i386']
env['LINKFLAGS'] += ['-arch' , 'x86_64' , '-arch' , 'i386']
conf.Define('MAP_32BIT', 0)
else:
@ -449,14 +459,11 @@ if env['HAVE_WX']:
else:
print "WX not found or disabled, not building GUI"
# add methods from utils to env
env.AddMethod(utils.filterWarnings)
rev = utils.GenerateRevFile(env['flavor'],
"Source/Core/Common/Src/svnrev_template.h",
"Source/Core/Common/Src/svnrev.h")
# print a nice progress indication when not compiling
Progress(['-\r', '\\\r', '|\r', '/\r'], interval = 5)
Progress(['-\r', '\\\r', '|\r', '/\r'], file=open('/dev/tty', 'w'), interval=5)
# Setup destdir for package building
# Warning: The program will not run from this location. It is assumed the

View File

@ -1,14 +1,6 @@
import os
import platform
# methods that should be added to env
def filterWarnings(self, flags):
return ' '.join(
flag
for flag in flags
if not flag.startswith('-W')
)
# taken from scons wiki
def CheckPKGConfig(context, version):
context.Message( 'Checking for pkg-config version > %s... ' % version)
@ -28,8 +20,7 @@ def CheckFramework(context, name):
}
""", '.c')
if not ret:
context.env.Replace(FRAMEWORKS = lastFRAMEWORKS
)
context.env.Replace(FRAMEWORKS = lastFRAMEWORKS)
return ret

View File

@ -12,7 +12,6 @@ files = [
]
acenv = env.Clone()
acenv.Append(CXXFLAGS = [ '-fPIC' ])
if acenv['HAVE_OPENAL']:
files += [ 'OpenALStream.cpp', 'aldlist.cpp' ]

View File

@ -93,7 +93,7 @@ public:
x.clear();
while (number > 0)
{
unsigned int first;
unsigned int first = 0;
Do(first);
std::string second;
Do(second);

View File

@ -49,5 +49,4 @@ if sys.platform == 'win32':
files += [ "stdafx.cpp" ]
env_common = env.Clone()
env_common.Append(CXXFLAGS = [ '-fPIC' ])
env_common.StaticLibrary(env['local_libs'] + "common", files)

View File

@ -30,6 +30,5 @@ files = [
]
acenv = env.Clone()
acenv.Append(CXXFLAGS = [ '-fPIC' ])
acenv.StaticLibrary(env['local_libs'] + 'dspcore', files, LIBS = [ 'common'] )

View File

@ -13,6 +13,5 @@ files = [
]
acenv = env.Clone()
acenv.Append(CXXFLAGS = [ '-fPIC' ])
acenv.StaticLibrary(env['local_libs'] + 'debugger_ui_util', files)

View File

@ -21,8 +21,6 @@
#ifndef _WIN32
#include <sys/param.h>
#else
#endif
#include "Common.h"

View File

@ -238,8 +238,8 @@ ControlState ControllerInterface::InputReference::State( const ControlState igno
if ( NULL == device )
return 0;
ControlState state;
// this mode thing will be turned into a switch statement
ControlState state = 0;
switch ( mode )
{
// OR

View File

@ -172,3 +172,4 @@
{ kHIDUsage_KeyboardRightAlt, "Right Alt" },
{ kHIDUsage_KeyboardRightGUI, "Right GUI" },
/* 0x4E - 0xFFFF Reserved */

View File

@ -39,5 +39,4 @@ if sys.platform == 'linux2':
'ControllerInterface/Xlib/Xlib.cpp'
]
icenv.Append(CXXFLAGS = [ '-fPIC' ])
icenv.StaticLibrary(env['local_libs'] + "inputcommon", files)

View File

@ -45,5 +45,4 @@ if env_vcommon['HAVE_OPENCL']:
'OpenCL/OCLTextureDecoder.cpp',
]
env_vcommon.Append(CXXFLAGS = [ '-fPIC' ])
env_vcommon.StaticLibrary(env['local_libs'] + "videocommon", files)

View File

@ -15,8 +15,7 @@ libs = [
]
dtenv.Append(CXXFLAGS = [ '-fPIC' ],
LIBS = libs)
dtenv.Append(LIBS = libs)
if sys.platform == 'darwin':
dtenv['FRAMEWORKS'] = ['CoreFoundation', 'Cocoa', 'System']

View File

@ -17,5 +17,4 @@ if env['HAVE_WX']:
env_inputpc = env.Clone()
env_inputpc.Append(CXXFLAGS = [ '-fPIC' ])
env_inputpc.StaticLibrary(env['local_libs'] + "inputplugincommon", files)

View File

@ -79,11 +79,11 @@ void CMailHandler::DoState(PointerWrap &p)
if (p.GetMode() == PointerWrap::MODE_READ)
{
Clear();
int sz;
int sz = 0;
p.Do(sz);
for (int i = 0; i < sz; i++)
{
u32 mail;
u32 mail = 0;
p.Do(mail);
m_Mails.push(mail);
}

View File

@ -31,7 +31,6 @@ if dspenv['HAVE_WX']:
]
dspenv.Append(
CXXFLAGS = [ '-fPIC' ],
LIBS = [ 'common', 'audiocommon' ],
)
if sys.platform == 'darwin':

View File

@ -26,12 +26,10 @@ if env['HAVE_WX']:
lleenv = env.Clone()
if env['HAVE_WX']:
lleenv.Append(
CXXFLAGS = [ '-fPIC' ],
LIBS = [ 'dspcore', 'audiocommon', 'common', 'debugger_ui_util' ],
)
else:
lleenv.Append(
CXXFLAGS = [ '-fPIC' ],
LIBS = [ 'dspcore', 'audiocommon', 'common' ],
)
if sys.platform == 'darwin':

View File

@ -25,8 +25,7 @@ files = [
'PostProcessing.cpp',
'FramebufferManager.cpp',
]
compileFlags = [
'-fPIC',
compileFlags = [
]
linkFlags = [
]

View File

@ -226,7 +226,7 @@ inline void CalculateLOD(s32 &lod, bool &linear, u32 texmap, u32 texcoord)
bias >>= 1;
lod += bias;
linear = (lod > 0 && (tm0.min_filter & 4) || lod <= 0 && tm0.mag_filter);
linear = ((lod > 0 && (tm0.min_filter & 4)) || (lod <= 0 && tm0.mag_filter));
// order of checks matters
// should be:

View File

@ -36,9 +36,6 @@ files = [
'VideoConfig.cpp',
'XFMemLoader.cpp',
]
compileFlags = [
'-fPIC',
]
linkFlags = [
]
libs = [
@ -56,7 +53,7 @@ conf = gfxenv.Configure(custom_tests = tests,
if sys.platform == 'darwin':
gfxenv['FRAMEWORKS'] = ['CoreFoundation', 'System', 'OpenGL', 'Cocoa', 'Cg']
compileFlags += ['-x','objective-c++',]
compileFlags = ['-x','objective-c++',]
files += [ 'cocoaGL.m', ]
conf.CheckPKG('OpenGL')
@ -94,7 +91,6 @@ if gfxenv['USE_WX'] and not gfxenv['HAVE_WX']:
print "Must have wx to use wxgl"
Return()
gfxenv.Append(
CXXFLAGS = compileFlags,
LINKFLAGS = linkFlags,
)

View File

@ -30,8 +30,7 @@ if wmenv['HAVE_WX']:
]
libs = [ 'common', 'inputcommon' ]
cxxflags = [ '-fPIC' ]
cxxflags = [ ]
if wmenv['HAVE_WIIUSE']:
libs += [ 'wiiuse' ]

View File

@ -63,7 +63,7 @@ wiimote_t** g_WiiMotesFromWiiUse = NULL;
Common::Thread* g_pReadThread = NULL;
int g_NumberOfWiiMotes;
CWiiMote* g_WiiMotes[MAX_WIIMOTES];
bool g_Shutdown = false;
volatile bool g_Shutdown = false;
Common::Event g_StartThread;
Common::Event g_StopThreadTemporary;
bool g_LocalThread = true;

View File

@ -24,7 +24,6 @@ if padenv['HAVE_WX']:
]
padenv.Append(
CXXFLAGS = [ '-fPIC' ],
LIBS = [ 'common', 'inputcommon' ],
)

View File

@ -25,17 +25,6 @@
#include "asm_tables.h"
#include "Helpers.h"
#ifdef __APPLE__
void die(char *msg){}
void initialise_fat(){}
void init_crap(){}
void end(){}
#endif
FILE *f = NULL;
int main(int argc, char **argv) {
init_crap();