Skip to content

Commit

Permalink
Fixes for clang + related bugfixes (sarah-walker-pcem#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
JosepMaJAZ authored Jun 22, 2024
1 parent e1fba7a commit 2e87d35
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 25 deletions.
2 changes: 1 addition & 1 deletion includes/private/cpu/x86.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ enum { ABRT_NONE = 0, ABRT_GEN, ABRT_TS = 0xA, ABRT_NP = 0xB, ABRT_SS = 0xC, ABR
This distinction is used by the dynarec; a block that hits an 'expected' exception
would be compiled, a block that hits an 'unexpected' exception would be rejected so
that we don't end up with an unnecessarily short block*/
#define ABRT_EXPECTED 0x80
#define ABRT_EXPECTED ((int8_t)0x80)
extern uint32_t abrt_error;

void x86_doabrt(int x86_abrt);
Expand Down
2 changes: 1 addition & 1 deletion includes/private/models/pit.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
extern uint64_t PITCONST;
void pit_init();
void pit_ps2_init();
void pit_reset();
void pit_reset(PIT *pit);
void pit_set_gate(PIT *pit, int channel, int gate);
void pit_set_using_timer(PIT *pit, int t, int using_timer);
void pit_set_out_func(PIT *pit, int t, void (*func)(int new_out, int old_out));
Expand Down
18 changes: 9 additions & 9 deletions src/codegen/codegen_timing_p6.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static const p6_instruction_t alu6_op = {.nr_uops = 6,
.uop[5] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}};
static const p6_instruction_t aluc_op = {.nr_uops = 2,
.uop[0] = {.type = UOP_ALU01, .throughput = 1, .latency = 1},
.uop[0] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}};
.uop[1] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}};
static const p6_instruction_t load_alu_op = {.nr_uops = 2,
.uop[0] = {.type = UOP_LOAD, .throughput = 1, .latency = 2},
.uop[1] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}};
Expand Down Expand Up @@ -89,7 +89,7 @@ static const p6_instruction_t store_op = {.nr_uops = 2,

static const p6_instruction_t bswap_op = {.nr_uops = 2,
.uop[0] = {.type = UOP_ALU0, .throughput = 1, .latency = 1},
.uop[0] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}};
.uop[1] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}};
static const p6_instruction_t leave_op = {.nr_uops = 3,
.uop[0] = {.type = UOP_LOAD, .throughput = 1, .latency = 2},
.uop[1] = {.type = UOP_ALU01, .throughput = 1, .latency = 1},
Expand Down Expand Up @@ -349,18 +349,18 @@ static const p6_instruction_t div16_op = {.nr_uops = 3,
.uop[2] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}};
static const p6_instruction_t div16_mem_op = {.nr_uops = 4,
.uop[0] = {.type = UOP_LOAD, .throughput = 1, .latency = 2},
.uop[0] = {.type = UOP_ALU0, .throughput = 21, .latency = 21},
.uop[1] = {.type = UOP_ALU0, .throughput = 1, .latency = 1},
.uop[2] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}};
.uop[1] = {.type = UOP_ALU0, .throughput = 21, .latency = 21},
.uop[2] = {.type = UOP_ALU0, .throughput = 1, .latency = 1},
.uop[3] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}};
static const p6_instruction_t div32_op = {.nr_uops = 3,
.uop[0] = {.type = UOP_ALU0, .throughput = 35, .latency = 35},
.uop[1] = {.type = UOP_ALU0, .throughput = 1, .latency = 1},
.uop[2] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}};
static const p6_instruction_t div32_mem_op = {.nr_uops = 4,
.uop[0] = {.type = UOP_LOAD, .throughput = 1, .latency = 2},
.uop[0] = {.type = UOP_ALU0, .throughput = 35, .latency = 35},
.uop[1] = {.type = UOP_ALU0, .throughput = 1, .latency = 1},
.uop[2] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}};
.uop[1] = {.type = UOP_ALU0, .throughput = 35, .latency = 35},
.uop[2] = {.type = UOP_ALU0, .throughput = 1, .latency = 1},
.uop[3] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}};
static const p6_instruction_t emms_op = {.nr_uops = 11,
.uop[0] = {.type = UOP_ALU0, .throughput = 1, .latency = 1},
.uop[1] = {.type = UOP_ALU0, .throughput = 1, .latency = 1},
Expand Down Expand Up @@ -393,7 +393,7 @@ static const p6_instruction_t ins_op = {.nr_uops = 4,
.uop[0] = {.type = UOP_ALU0, .throughput = 18, .latency = 18},
.uop[1] = {.type = UOP_STOREADDR, .throughput = 1, .latency = 1},
.uop[2] = {.type = UOP_STOREDATA, .throughput = 1, .latency = 1},
.uop[2] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}};
.uop[3] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}};
static const p6_instruction_t int_op = {
.nr_uops = 7,
.uop[0] = {.type = UOP_ALU0, .throughput = 20, .latency = 20},
Expand Down
2 changes: 1 addition & 1 deletion src/disc/disc.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ void disc_stop(int drive) {
drive ^= fdd_swap;

if (drive < 2 && drives[drive].stop)
drives[drive].stop(drive);
drives[drive].stop();
}

void disc_set_drivesel(int drive) {
Expand Down
4 changes: 2 additions & 2 deletions src/pc.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@
#include "hdd.h"
#include "x86.h"
#include "paths.h"
#include "plugin.h"

#ifdef USE_NETWORKING
#include "nethandler.h"
#include "plugin.h"
#include "wx-utils.h"
#define NE2000 1
uint8_t ethif;
Expand Down Expand Up @@ -369,7 +369,7 @@ void resetpchard() {
network_card_init(network_card_current);
#endif

sound_card_init(sound_card_current);
sound_card_init();
if (GUS)
device_add(&gus_device);
if (GAMEBLASTER)
Expand Down
6 changes: 4 additions & 2 deletions src/rtc_tc8521.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,10 @@ static void tc8521_set_nvrram(uint8_t *nvrram, struct tm *cur_time_tm) {
nvrram[TC8521_HOUR1] = cur_time_tm->tm_hour % 10;
nvrram[TC8521_HOUR10] = cur_time_tm->tm_hour / 10;
} else {
nvrram[TC8521_HOUR1] = (cur_time_tm->tm_hour % 12) % 10;
nvrram[TC8521_HOUR10] = ((cur_time_tm->tm_hour % 12) / 10) | (cur_time_tm->tm_hour >= 12) ? 2 : 0;
int hour12 = (cur_time_tm->tm_hour % 12);
if (hour12 == 0) hour12 = 12;
nvrram[TC8521_HOUR1] = hour12 % 10;
nvrram[TC8521_HOUR10] = hour12 / 10;
}
nvrram[TC8521_WEEKDAY] = cur_time_tm->tm_wday;
nvrram[TC8521_DAY1] = cur_time_tm->tm_mday % 10;
Expand Down
1 change: 1 addition & 0 deletions src/sound/sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ int sound_card_has_config(int card) {
char *sound_card_get_internal_name(int card) {
if (sound_cards[card] != NULL)
return sound_cards[card]->internal_name;
return "error-no-name";
}

int sound_card_get_from_internal_name(char *s) {
Expand Down
1 change: 0 additions & 1 deletion src/sound/sound_adlibgold.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ static int treble_cut[6] = {
(int)(0.354 * 16384) /*-3 dB - filter output is at +6 dB*/
};

void adgold_timer_poll();
void adgold_update(adgold_t *adgold);

void adgold_update_irq_status(adgold_t *adgold) {
Expand Down
2 changes: 1 addition & 1 deletion src/video/vid_s3.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ typedef struct s3_t {
#define INT_FIFO_EMP (1 << 3)
#define INT_MASK 0xf

void s3_updatemapping();
void s3_updatemapping(s3_t *s3);

void s3_accel_write(uint32_t addr, uint8_t val, void *p);
void s3_accel_write_w(uint32_t addr, uint16_t val, void *p);
Expand Down
7 changes: 5 additions & 2 deletions src/video/vid_t1000.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
/*Very rough estimate*/
#define VID_CLOCK (double)(651 * 216 * 60)

#define T1000_OUTPUT_DISPLAY_INTERNAL 1u
#define T1000_OUTPUT_DISPLAY_EXTERNAL 0u
#define T1000_OUTPUT_DISPLAY_UNSET 255u
/* Mapping of attributes to colours */
static uint32_t blue, grey;
static uint8_t boldcols[256]; /* Which attributes use the bold font */
Expand All @@ -31,7 +34,7 @@ static uint8_t language;
*/
static uint8_t st_video_options;
static uint8_t st_enabled = 1;
static uint8_t st_display_internal = -1;
static uint8_t st_display_internal = T1000_OUTPUT_DISPLAY_UNSET;

void t1000_video_options_set(uint8_t options) {
st_video_options = options & 1;
Expand Down Expand Up @@ -385,7 +388,7 @@ static void t1000_poll(void *p) {
mem_mapping_disable(&t1000->mapping);
}
/* Switch between internal plasma and external CRT display. */
if (st_display_internal != -1 && st_display_internal != t1000->internal) {
if (st_display_internal != T1000_OUTPUT_DISPLAY_UNSET && st_display_internal != t1000->internal) {
t1000->internal = st_display_internal;
t1000_recalctimings(t1000);
}
Expand Down
8 changes: 6 additions & 2 deletions src/video/vid_t3100e.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
#define T3100E_XSIZE 640
#define T3100E_YSIZE 400

#define T3100E_OUTPUT_DISPLAY_INTERNAL 1u
#define T3100E_OUTPUT_DISPLAY_EXTERNAL 0u
#define T3100E_OUTPUT_DISPLAY_UNSET 255u

/*Very rough estimate*/
#define VID_CLOCK (double)(651 * 416 * 60)

Expand Down Expand Up @@ -45,7 +49,7 @@ static uint32_t normcols[256][2];
* Bits 0,1: Font set (not currently implemented)
*/
static uint8_t st_video_options;
static uint8_t st_display_internal = -1;
static uint8_t st_display_internal = T3100E_OUTPUT_DISPLAY_UNSET;

void t3100e_video_options_set(uint8_t options) { st_video_options = options; }

Expand Down Expand Up @@ -402,7 +406,7 @@ void t3100e_poll(void *p) {
t3100e->cga.fontbase = (512 * (t3100e->video_options & 3)) + ((t3100e->video_options & 4) ? 256 : 0);
}
/* Switch between internal plasma and external CRT display. */
if (st_display_internal != -1 && st_display_internal != t3100e->internal) {
if (st_display_internal != T3100E_OUTPUT_DISPLAY_UNSET && st_display_internal != t3100e->internal) {
t3100e->internal = st_display_internal;
t3100e_recalctimings(t3100e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/wx-ui/wx-sdl2-display-win.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ int window_create() {
info.cch = 256;
info.dwTypeData = label;
if (GetMenuItemInfo(native_menu, i, 1, &info))
AppendMenu(menu, MF_STRING | MF_POPUP, (UINT)GetSubMenu(native_menu, i), info.dwTypeData);
AppendMenu(menu, MF_STRING | MF_POPUP, (UINT_PTR)GetSubMenu(native_menu, i), info.dwTypeData);
}

/* The class is registered, let's create the program*/
Expand Down
6 changes: 4 additions & 2 deletions src/wx-ui/wx-status.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,20 @@ void StatusPane::Render(wxDC &dc) {
if (emulation_state != EMULATION_STOPPED) {
// draw status text
if (show_status) {
char charMac = statusMachineText[0];
char charDev = statusDeviceText[0];
if (updatestatus) {
updatestatus = 0;
get_status(statusMachineText, statusDeviceText);
}
if (statusMachineText) {
if (charMac != 0 || statusMachineText[0] != charMac) {
int statusX = 5;
int statusY = height + 5;
wxSize size = dc.GetMultiLineTextExtent(statusMachineText);
dc.DrawText(statusMachineText, statusX, statusY);
width = MAX(width, statusX + size.GetWidth());
height = MAX(height, statusY + size.GetHeight());
if (statusDeviceText) {
if (charDev != 0 || statusDeviceText[0] != charDev) {
wxSize dSize = dc.GetMultiLineTextExtent(statusDeviceText);
dc.DrawText(statusDeviceText, statusX + ceil((size.GetWidth() + 50) / 100.0) * 100,
statusY);
Expand Down

0 comments on commit 2e87d35

Please sign in to comment.