From 088aa7dcb93a5edabe44d7ccaa7254f9ffed1c55 Mon Sep 17 00:00:00 2001 From: Jamiras <32680403+Jamiras@users.noreply.github.com> Date: Thu, 4 Nov 2021 17:05:13 -0600 Subject: [PATCH] add github action for c89 build (#13186) * add retroarch.yml * fix c89 errors * attempt to add dependencies * update comments --- .github/workflows/retroarch.yml | 25 +++++++++++++++++++++++++ Makefile | 2 +- input/connect/connect_ps3.c | 8 ++++---- input/connect/connect_wiiugca.c | 3 ++- input/drivers/udev_input.c | 8 +++++--- input/input_driver.c | 8 ++++---- input/input_driver.h | 6 +++--- libretro-common/streams/file_stream.c | 4 ++++ tasks/task_powerstate.h | 2 ++ 9 files changed, 50 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/retroarch.yml diff --git a/.github/workflows/retroarch.yml b/.github/workflows/retroarch.yml new file mode 100644 index 0000000000..6855f9a7db --- /dev/null +++ b/.github/workflows/retroarch.yml @@ -0,0 +1,25 @@ +# Validates compilation of RetroArch binary + +name: RetroArch CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + linux-c89: # Smoketest build using most restrictive compiler and default options + runs-on: ubuntu-latest + steps: + - name: Dependencies + run: sudo apt-get install build-essential libxkbcommon-dev libx11-xcb-dev zlib1g-dev libfreetype6-dev libegl1-mesa-dev libgles2-mesa-dev libgbm-dev nvidia-cg-toolkit nvidia-cg-dev libavcodec-dev libsdl2-dev libsdl-image1.2-dev libxml2-dev yasm + - name: Checkout + uses: actions/checkout@v2 + - name: Configure + run: ./configure + - name: Build + run: make C89_BUILD=1 + diff --git a/Makefile b/Makefile index 005ad6bd80..63c7eda4aa 100644 --- a/Makefile +++ b/Makefile @@ -110,7 +110,7 @@ endif ifneq ($(CXX_BUILD), 1) ifneq ($(C89_BUILD),) - CFLAGS += -std=c89 -ansi -pedantic -Werror=pedantic -Wno-long-long + CFLAGS += -std=c89 -ansi -pedantic -Werror=pedantic -Wno-long-long -Werror=declaration-after-statement else ifeq ($(HAVE_C99), 1) CFLAGS += $(C99_CFLAGS) endif diff --git a/input/connect/connect_ps3.c b/input/connect/connect_ps3.c index 6df3fc61c2..c60d2eee93 100644 --- a/input/connect/connect_ps3.c +++ b/input/connect/connect_ps3.c @@ -72,17 +72,17 @@ struct __attribute__((__packed__)) sixaxis_activation_report { }; union sixaxis_activation_report_f4 { - struct sixaxis_activation_report data; uint8_t buf[5]; + struct sixaxis_activation_report data; }; union sixaxis_output_report_01 { - struct sixaxis_output_report data; uint8_t buf[49]; + struct sixaxis_output_report data; }; static const union sixaxis_output_report_01 default_report = { - .buf = { + { 0x01, /* report ID */ 0x00, /* padding */ 0xff, 0x00, /* right rumble */ @@ -101,7 +101,7 @@ static const union sixaxis_output_report_01 default_report = { }; static const union sixaxis_activation_report_f4 ds3_activation_packet = { - .buf = { 0xF4, 0x42, 0x0c, 0x00, 0x00 } + { 0xF4, 0x42, 0x0c, 0x00, 0x00 } }; /* forward declarations */ diff --git a/input/connect/connect_wiiugca.c b/input/connect/connect_wiiugca.c index 5f314a0b76..ab02d0720f 100644 --- a/input/connect/connect_wiiugca.c +++ b/input/connect/connect_wiiugca.c @@ -128,6 +128,7 @@ static int16_t hidpad_wiiugca_get_axis(void *pad_data, unsigned axis) { axis_data axis_data; gca_pad_data_t *pad = (gca_pad_data_t *)pad_data; + gca_device_data_t *device = (gca_device_data_t *)pad_data; gamepad_read_axis_data(axis, &axis_data); @@ -136,7 +137,7 @@ static int16_t hidpad_wiiugca_get_axis(void *pad_data, unsigned axis) if(pad->datatype == GCA_TYPE_PAD) return gamepad_get_axis_value(pad->analog, &axis_data); - gca_device_data_t *device = (gca_device_data_t *)pad_data; + return gamepad_get_axis_value(device->pad_data[0].analog, &axis_data); } diff --git a/input/drivers/udev_input.c b/input/drivers/udev_input.c index b34ef560b5..636eaaccdc 100644 --- a/input/drivers/udev_input.c +++ b/input/drivers/udev_input.c @@ -746,11 +746,12 @@ static void udev_input_handle_hotplug(udev_input_t *udev) if ( dev_type != UDEV_INPUT_KEYBOARD) { /*first clear all */ - for (int i = 0; i < MAX_USERS; i++) + int i; + for (i = 0; i < MAX_USERS; i++) input_config_set_mouse_display_name(i, "N/A"); /* Add what devices we have now */ - for (int i = 0; i < udev->num_devices; ++i) + for (i = 0; i < udev->num_devices; ++i) { if (udev->devices[i]->type != UDEV_INPUT_KEYBOARD) { @@ -1373,6 +1374,7 @@ static void *udev_input_init(const char *joypad_driver) int mouse = 0; int keyboard=0; int fd; + int i; #ifdef UDEV_XKB_HANDLING gfx_ctx_ident_t ctx_ident; #endif @@ -1437,7 +1439,7 @@ static void *udev_input_init(const char *joypad_driver) RARCH_WARN("[udev]: Full-screen pointer won't be available.\n"); #endif - for (int i = 0; i < udev->num_devices; ++i) + for (i = 0; i < udev->num_devices; ++i) { if (udev->devices[i]->type != UDEV_INPUT_KEYBOARD) { diff --git a/input/input_driver.c b/input/input_driver.c index e3a22cf699..8d6bd0198c 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -2682,7 +2682,7 @@ void input_config_reset(void) input_config_reset_autoconfig_binds(i); - input_st->libretro_input_binds[i] = &input_config_binds[i]; + input_st->libretro_input_binds[i] = (const retro_keybind_set *)&input_config_binds[i]; } } @@ -3483,7 +3483,7 @@ void input_keys_pressed( bool is_menu, int input_hotkey_block_delay, input_bits_t *p_new_state, - retro_keybind_set *binds, + const retro_keybind_set *binds, const struct retro_keybind *binds_norm, const struct retro_keybind *binds_auto, const input_device_driver_t *joypad, @@ -5348,7 +5348,7 @@ void input_driver_collect_system_input(input_driver_state_t *input_st, menu_input_active, block_delay, loop_bits, - input_config_binds, + (const retro_keybind_set *)input_config_binds, binds_norm, binds_auto, joypad, @@ -5435,7 +5435,7 @@ void input_driver_collect_system_input(input_driver_state_t *input_st, input_st->current_data, joypad, sec_joypad, - &joypad_info, input_config_binds, + &joypad_info, (const retro_keybind_set *)input_config_binds, input_st->keyboard_mapping_blocked, 0, RETRO_DEVICE_KEYBOARD, 0, ids[i][0])) diff --git a/input/input_driver.h b/input/input_driver.h index d33807b079..fa51473e73 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -132,8 +132,8 @@ struct input_keyboard_line bool enabled; }; -extern struct retro_keybind input_config_binds[MAX_USERS][RARCH_BIND_LIST_END]; -extern struct retro_keybind input_autoconf_binds[MAX_USERS][RARCH_BIND_LIST_END]; +extern retro_keybind_set input_config_binds[MAX_USERS]; +extern retro_keybind_set input_autoconf_binds[MAX_USERS]; struct rarch_joypad_info { @@ -1029,7 +1029,7 @@ void input_keys_pressed( bool is_menu, int input_hotkey_block_delay, input_bits_t *p_new_state, - retro_keybind_set *binds, + const retro_keybind_set *binds, const struct retro_keybind *binds_norm, const struct retro_keybind *binds_auto, const input_device_driver_t *joypad, diff --git a/libretro-common/streams/file_stream.c b/libretro-common/streams/file_stream.c index 3543dcc095..2ac5dbb83f 100644 --- a/libretro-common/streams/file_stream.c +++ b/libretro-common/streams/file_stream.c @@ -241,7 +241,11 @@ int filestream_vscanf(RFILE *stream, const char* format, va_list *args) * cause the va_list to have an indeterminate value * in the function calling filestream_vscanf(), * leading to unexpected behaviour */ +#ifdef __va_copy + __va_copy(args_copy, *args); +#else va_copy(args_copy, *args); +#endif while (*format) { diff --git a/tasks/task_powerstate.h b/tasks/task_powerstate.h index a3f7270faf..8b479d2f0e 100644 --- a/tasks/task_powerstate.h +++ b/tasks/task_powerstate.h @@ -22,6 +22,8 @@ #include #include +#include + #ifdef HAVE_CONFIG_H #include "../config.h" #endif