summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author couriersud <couriersud@arcor.de>2015-05-25 19:32:16 +0200
committer couriersud <couriersud@arcor.de>2015-05-25 19:32:31 +0200
commite1e0e9edbd0e857997c4725703e562f715c9589b (patch)
tree2a6f3319ce7b9502b9323d6c183bcd5ad4b9e136 /src
parent1763f18b96bea0c595cb350626164e41cc8e301d (diff)
Fixed some clang 3.6 compilation errors and gcc -Wextra warnings. (nw)
Diffstat (limited to 'src')
-rw-r--r--src/emu/cpu/pdp1/tx0.c4
-rw-r--r--src/emu/sound/disc_mth.inc2
-rw-r--r--src/mame/drivers/atvtrack.c15
-rw-r--r--src/mame/machine/decocass_tape.c4
-rw-r--r--src/mame/video/carpolo.c6
-rw-r--r--src/mame/video/chihiro.c11
-rw-r--r--src/mess/drivers/x07.c17
-rw-r--r--src/osd/sdl/window.c4
-rw-r--r--src/tools/romcmp.c10
9 files changed, 48 insertions, 25 deletions
diff --git a/src/emu/cpu/pdp1/tx0.c b/src/emu/cpu/pdp1/tx0.c
index 8c2c9c33887..1a3ab230f4b 100644
--- a/src/emu/cpu/pdp1/tx0.c
+++ b/src/emu/cpu/pdp1/tx0.c
@@ -99,7 +99,9 @@ void tx0_device::tx0_write(offs_t address, int data)
else
/* toggle switch storage (TSS) */
/* TSS is read-only */
- ;
+ {
+ /* nothing */
+ }
}
diff --git a/src/emu/sound/disc_mth.inc b/src/emu/sound/disc_mth.inc
index 8474d08f5e5..8b743cc0b9e 100644
--- a/src/emu/sound/disc_mth.inc
+++ b/src/emu/sound/disc_mth.inc
@@ -1435,7 +1435,7 @@ DISCRETE_RESET(dst_ramp)
{
m_v_out = DST_RAMP__CLAMP;
m_step = DST_RAMP__GRAD / this->sample_rate();
- m_dir = ((DST_RAMP__END - DST_RAMP__START) == abs(DST_RAMP__END - DST_RAMP__START));
+ m_dir = ((DST_RAMP__END - DST_RAMP__START) == fabs(DST_RAMP__END - DST_RAMP__START));
m_last_en = 0;
}
diff --git a/src/mame/drivers/atvtrack.c b/src/mame/drivers/atvtrack.c
index 7b02148cdf9..4f03012a798 100644
--- a/src/mame/drivers/atvtrack.c
+++ b/src/mame/drivers/atvtrack.c
@@ -221,8 +221,9 @@ READ64_MEMBER(atvtrack_state::area2_r)
dat = (dat << 8) | 0xc0;
}
return dat;
- } else
- ;
+ } else {
+ /* nothing */
+ }
return 0;
}
@@ -280,8 +281,9 @@ WRITE64_MEMBER(atvtrack_state::area3_w)
data=data >> 8;
}
m_nandaddressstep = 0;
- } else
- ;
+ } else {
+ /* nothing */
+ }
}
READ64_MEMBER(atvtrack_state::area4_r)
@@ -316,8 +318,9 @@ WRITE64_MEMBER(atvtrack_state::area4_w)
data = data >> 8;
}
m_nandaddressstep++;
- } else
- ;
+ } else {
+ /* nothing */
+ }
}
READ64_MEMBER(atvtrack_state::ioport_r)
diff --git a/src/mame/machine/decocass_tape.c b/src/mame/machine/decocass_tape.c
index 2cc211f689b..74d777ab91d 100644
--- a/src/mame/machine/decocass_tape.c
+++ b/src/mame/machine/decocass_tape.c
@@ -315,7 +315,9 @@ UINT8 decocass_tape_device::get_status_bits()
/* everywhere else, the clock holds to 0 */
else
- ;
+ {
+ /* nothing */
+ }
/* lead-in and lead-out bytes are 0xAA */
if (m_bytenum == BYTE_HEADER || m_bytenum == BYTE_TRAILER)
diff --git a/src/mame/video/carpolo.c b/src/mame/video/carpolo.c
index 793cb4941f6..dbeb2e479e5 100644
--- a/src/mame/video/carpolo.c
+++ b/src/mame/video/carpolo.c
@@ -124,13 +124,13 @@ PALETTE_INIT_MEMBER(carpolo_state, carpolo)
pen = ((i - 0x38) & 0x01) ? ALPHA_COLOR_BASE + ((i - 0x38) >> 1) : 0;
/* red component */
- r = ((r_voltage[(color_prom[pen] >> 5) & 0x07] - MIN_VOLTAGE) / (MAX_VOLTAGE - MIN_VOLTAGE)) * 255.;
+ r = ((r_voltage[(color_prom[pen] >> 5) & 0x07] - MIN_VOLTAGE) / (MAX_VOLTAGE - MIN_VOLTAGE)) * 255.0f;
/* green component */
- g = ((g_voltage[(color_prom[pen] >> 2) & 0x07] - MIN_VOLTAGE) / (MAX_VOLTAGE - MIN_VOLTAGE)) * 255.;
+ g = ((g_voltage[(color_prom[pen] >> 2) & 0x07] - MIN_VOLTAGE) / (MAX_VOLTAGE - MIN_VOLTAGE)) * 255.0f;
/* blue component */
- b = ((b_voltage[(color_prom[pen] >> 0) & 0x03] - MIN_VOLTAGE) / (MAX_VOLTAGE - MIN_VOLTAGE)) * 255.;
+ b = ((b_voltage[(color_prom[pen] >> 0) & 0x03] - MIN_VOLTAGE) / (MAX_VOLTAGE - MIN_VOLTAGE)) * 255.0f;
palette.set_pen_color(i, rgb_t(r, g, b));
}
diff --git a/src/mame/video/chihiro.c b/src/mame/video/chihiro.c
index f3d8cfc2726..734c18853ec 100644
--- a/src/mame/video/chihiro.c
+++ b/src/mame/video/chihiro.c
@@ -826,8 +826,10 @@ void vertex_program_simulator::compute_scalar_operation(float t_out[4], int inst
t_out[0] = t_out[1] = t_out[2] = t_out[3] = 1.0f / par_in[p3_C + 0]; // ?
break;
case 4: // "RSQ"
- // FIXME: should this be really abs which is "int abs(int x)"?
- t_out[0] = t_out[1] = t_out[2] = t_out[3] = 1.0f / sqrtf(abs(par_in[p3_C + 0]));
+ /*
+ * NOTE: this was abs which is "int abs(int x)" - and changed to fabsf due to clang 3.6 warning
+ */
+ t_out[0] = t_out[1] = t_out[2] = t_out[3] = 1.0f / sqrtf(fabsf(par_in[p3_C + 0]));
break;
case 5: // "EXP"
t_out[0] = pow(2, floor(par_in[p3_C + 0]));
@@ -841,7 +843,10 @@ void vertex_program_simulator::compute_scalar_operation(float t_out[4], int inst
t_out[1] = frexp(par_in[p3_C + 0], &e)*2.0; // frexp gives mantissa as 0.5....1
t_out[0] = e - 1;
#ifndef __OS2__
- t.f = log2(abs(par_in[p3_C + 0]));
+ /*
+ * NOTE: this was abs which is "int abs(int x)" - and changed to fabsf due to clang 3.6 warning
+ */
+ t.f = log2(fabsf(par_in[p3_C + 0]));
#else
static double log_2 = 0.0;
if (log_2 == 0.0)
diff --git a/src/mess/drivers/x07.c b/src/mess/drivers/x07.c
index 14d75539e76..3c63ada1398 100644
--- a/src/mess/drivers/x07.c
+++ b/src/mess/drivers/x07.c
@@ -263,9 +263,20 @@ void x07_state::t6834_cmd (UINT8 cmd)
for(int x = 0, y = p3; x <= sqrt((double)(p3 * p3) / 2) ; x++)
{
- UINT32 d1 = (x * x + y * y) - p3 * p3;
- UINT32 d2 = (x * x + (y - 1) * (y - 1)) - p3 * p3;
- if(abs((double)d1) > abs((double)d2))
+ /*
+ * The old code produced results most likely not intended:
+ * UINT32 d1 = (x * x + y * y) - p3 * p3;
+ * UINT32 d2 = (x * x + (y - 1) * (y - 1)) - p3 * p3;
+ * if(abs((double)d1) > abs((double)d2))
+ *
+ * (double)(-1) = 4294967294.000000
+ * abs((double)(-1)) = -2147483648;
+ *
+ * Therefore changed.
+ */
+ INT32 d1 = (x * x + y * y) - p3 * p3;
+ INT32 d2 = (x * x + (y - 1) * (y - 1)) - p3 * p3;
+ if (abs(d1) > abs(d2))
y--;
draw_point(x + p1, y + p2, 0x01);
draw_point(x + p1, -y + p2, 0x01);
diff --git a/src/osd/sdl/window.c b/src/osd/sdl/window.c
index d63df91b912..0c262cc14c6 100644
--- a/src/osd/sdl/window.c
+++ b/src/osd/sdl/window.c
@@ -891,7 +891,7 @@ osd_dim sdl_window_info::pick_best_mode()
SDL_GetDisplayMode(*((UINT64 *)m_monitor->oshandle()), i, &mode);
// compute initial score based on difference between target and current
- size_score = 1.0f / (1.0f + fabsf((INT32)mode.w - target_width) + fabsf((INT32)mode.h - target_height));
+ size_score = 1.0f / (1.0f + abs((INT32)mode.w - target_width) + abs((INT32)mode.h - target_height));
// if the mode is too small, give a big penalty
if (mode.w < minimum_width || mode.h < minimum_height)
@@ -907,7 +907,7 @@ osd_dim sdl_window_info::pick_best_mode()
// refresh adds some points
if (m_win_config.refresh)
- size_score *= 1.0f / (1.0f + fabsf(m_win_config.refresh - mode.refresh_rate) / 10.0f);
+ size_score *= 1.0f / (1.0f + abs(m_win_config.refresh - mode.refresh_rate) / 10.0f);
osd_printf_verbose("%4dx%4d@%2d -> %f\n", (int)mode.w, (int)mode.h, (int) mode.refresh_rate, (double) size_score);
diff --git a/src/tools/romcmp.c b/src/tools/romcmp.c
index 205b6db2623..c916c41a505 100644
--- a/src/tools/romcmp.c
+++ b/src/tools/romcmp.c
@@ -443,9 +443,9 @@ static void freefile(fileinfo *file)
static void printname(const fileinfo *file1,const fileinfo *file2,float score,int mode1,int mode2)
{
printf("%-12s %s %-12s %s ",file1 ? file1->name : "",modenames[mode1],file2 ? file2->name : "",modenames[mode2]);
- if (score == 0.0) printf("NO MATCH\n");
- else if (score == 1.0) printf("IDENTICAL\n");
- else printf("%3.6f%%\n",score*100);
+ if (score == 0.0f) printf("NO MATCH\n");
+ else if (score == 1.0f) printf("IDENTICAL\n");
+ else printf("%3.6f%%\n",(double) (score*100));
}
@@ -613,7 +613,7 @@ int CLIB_DECL main(int argc,char *argv[])
{
for (mode2 = 0;mode2 < total_modes;mode2++)
{
- if (filecompare(&files[0][i],&files[0][j],mode1,mode2) == 1.0)
+ if (filecompare(&files[0][i],&files[0][j],mode1,mode2) == 1.0f)
printname(&files[0][i],&files[0][j],1.0,mode1,mode2);
}
}
@@ -658,7 +658,7 @@ int CLIB_DECL main(int argc,char *argv[])
for (j = 0;j < found[1];j++)
{
if (matchscore[i][j][mode1][mode2] > bestscore
- || (matchscore[i][j][mode1][mode2] == 1.0 && mode2 == 0 && bestmode2 > 0))
+ || (matchscore[i][j][mode1][mode2] == 1.0f && mode2 == 0 && bestmode2 > 0))
{
bestscore = matchscore[i][j][mode1][mode2];
besti = i;