Maybe one day GCC will stop being shit at handling __attribute__s

This commit is contained in:
Lior Halphon 2021-11-07 14:13:52 +02:00
parent 1650820edb
commit 02f55d12d3
16 changed files with 49 additions and 49 deletions

View File

@ -171,14 +171,14 @@ void GB_set_interference_volume(GB_gameboy_t *gb, double volume);
void GB_apu_set_sample_callback(GB_gameboy_t *gb, GB_sample_callback_t callback);
#ifdef GB_INTERNAL
bool internal GB_apu_is_DAC_enabled(GB_gameboy_t *gb, unsigned index);
void internal GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value);
uint8_t internal GB_apu_read(GB_gameboy_t *gb, uint8_t reg);
void internal GB_apu_div_event(GB_gameboy_t *gb);
void internal GB_apu_div_secondary_event(GB_gameboy_t *gb);
void internal GB_apu_init(GB_gameboy_t *gb);
void internal GB_apu_run(GB_gameboy_t *gb);
void internal GB_apu_update_cycles_per_sample(GB_gameboy_t *gb);
internal bool GB_apu_is_DAC_enabled(GB_gameboy_t *gb, unsigned index);
internal void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value);
internal uint8_t GB_apu_read(GB_gameboy_t *gb, uint8_t reg);
internal void GB_apu_div_event(GB_gameboy_t *gb);
internal void GB_apu_div_secondary_event(GB_gameboy_t *gb);
internal void GB_apu_init(GB_gameboy_t *gb);
internal void GB_apu_run(GB_gameboy_t *gb);
internal void GB_apu_update_cycles_per_sample(GB_gameboy_t *gb);
#endif
#endif /* apu_h */

View File

@ -20,7 +20,7 @@ int GB_save_cheats(GB_gameboy_t *gb, const char *path);
#ifdef GB_DISABLE_CHEATS
#define GB_apply_cheat(...)
#else
void internal GB_apply_cheat(GB_gameboy_t *gb, uint16_t address, uint8_t *value);
internal void GB_apply_cheat(GB_gameboy_t *gb, uint16_t address, uint8_t *value);
#endif
#endif

View File

@ -17,14 +17,14 @@
#define GB_debugger_add_symbol(gb, bank, address, symbol) ((void)bank, (void)address, (void)symbol)
#else
void internal GB_debugger_run(GB_gameboy_t *gb);
void internal GB_debugger_handle_async_commands(GB_gameboy_t *gb);
void internal GB_debugger_call_hook(GB_gameboy_t *gb, uint16_t call_addr);
void internal GB_debugger_ret_hook(GB_gameboy_t *gb);
void internal GB_debugger_test_write_watchpoint(GB_gameboy_t *gb, uint16_t addr, uint8_t value);
void internal GB_debugger_test_read_watchpoint(GB_gameboy_t *gb, uint16_t addr);
const GB_bank_symbol_t *internal GB_debugger_find_symbol(GB_gameboy_t *gb, uint16_t addr);
void internal GB_debugger_add_symbol(GB_gameboy_t *gb, uint16_t bank, uint16_t address, const char *symbol);
internal void GB_debugger_run(GB_gameboy_t *gb);
internal void GB_debugger_handle_async_commands(GB_gameboy_t *gb);
internal void GB_debugger_call_hook(GB_gameboy_t *gb, uint16_t call_addr);
internal void GB_debugger_ret_hook(GB_gameboy_t *gb);
internal void GB_debugger_test_write_watchpoint(GB_gameboy_t *gb, uint16_t addr, uint8_t value);
internal void GB_debugger_test_read_watchpoint(GB_gameboy_t *gb, uint16_t addr);
internal const GB_bank_symbol_t *GB_debugger_find_symbol(GB_gameboy_t *gb, uint16_t addr);
internal void GB_debugger_add_symbol(GB_gameboy_t *gb, uint16_t bank, uint16_t address, const char *symbol);
#endif /* GB_DISABLE_DEBUGGER */
#endif

View File

@ -7,7 +7,7 @@
#define likely(x) __builtin_expect((x), 1)
#define unlikely(x) __builtin_expect((x), 0)
#define internal __attribute__((visibility("hidden")))
#define internal __attribute__((visibility("internal")))
#if __clang__
#define unrolled _Pragma("unroll")

View File

@ -6,10 +6,10 @@
#include <stdint.h>
#ifdef GB_INTERNAL
void internal GB_display_run(GB_gameboy_t *gb, uint8_t cycles);
void internal GB_palette_changed(GB_gameboy_t *gb, bool background_palette, uint8_t index);
void internal GB_STAT_update(GB_gameboy_t *gb);
void internal GB_lcd_off(GB_gameboy_t *gb);
internal void GB_display_run(GB_gameboy_t *gb, uint8_t cycles);
internal void GB_palette_changed(GB_gameboy_t *gb, bool background_palette, uint8_t index);
internal void GB_STAT_update(GB_gameboy_t *gb);
internal void GB_lcd_off(GB_gameboy_t *gb);
enum {
GB_OBJECT_PRIORITY_X,

View File

@ -856,7 +856,7 @@ void GB_get_rom_title(GB_gameboy_t *gb, char *title);
uint32_t GB_get_rom_crc32(GB_gameboy_t *gb);
#ifdef GB_INTERNAL
void internal GB_borrow_sgb_border(GB_gameboy_t *gb);
internal void GB_borrow_sgb_border(GB_gameboy_t *gb);
#endif
#endif /* GB_h */

View File

@ -20,6 +20,6 @@ void GB_set_key_state_for_player(GB_gameboy_t *gb, GB_key_t index, unsigned play
void GB_icd_set_joyp(GB_gameboy_t *gb, uint8_t value);
#ifdef GB_INTERNAL
void internal GB_update_joyp(GB_gameboy_t *gb);
internal void GB_update_joyp(GB_gameboy_t *gb);
#endif
#endif /* joypad_h */

View File

@ -26,8 +26,8 @@ typedef struct {
#ifdef GB_INTERNAL
extern const GB_cartridge_t GB_cart_defs[256];
void internal GB_update_mbc_mappings(GB_gameboy_t *gb);
void internal GB_configure_cart(GB_gameboy_t *gb);
internal void GB_update_mbc_mappings(GB_gameboy_t *gb);
internal void GB_configure_cart(GB_gameboy_t *gb);
#endif
#endif /* MBC_h */

View File

@ -9,9 +9,9 @@ void GB_set_read_memory_callback(GB_gameboy_t *gb, GB_read_memory_callback_t cal
uint8_t GB_read_memory(GB_gameboy_t *gb, uint16_t addr);
void GB_write_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value);
#ifdef GB_INTERNAL
void internal GB_dma_run(GB_gameboy_t *gb);
void internal GB_hdma_run(GB_gameboy_t *gb);
void internal GB_trigger_oam_bug(GB_gameboy_t *gb, uint16_t address);
internal void GB_dma_run(GB_gameboy_t *gb);
internal void GB_hdma_run(GB_gameboy_t *gb);
internal void GB_trigger_oam_bug(GB_gameboy_t *gb, uint16_t address);
#endif
#endif /* memory_h */

View File

@ -5,8 +5,8 @@
#include "defs.h"
#ifdef GB_INTERNAL
void internal GB_rewind_push(GB_gameboy_t *gb);
void internal GB_rewind_free(GB_gameboy_t *gb);
internal void GB_rewind_push(GB_gameboy_t *gb);
internal void GB_rewind_free(GB_gameboy_t *gb);
#endif
bool GB_rewind_pop(GB_gameboy_t *gb);
void GB_set_rewind_length(GB_gameboy_t *gb, double seconds);

View File

@ -10,7 +10,7 @@ typedef enum {
} GB_rumble_mode_t;
#ifdef GB_INTERNAL
void internal GB_handle_rumble(GB_gameboy_t *gb);
internal void GB_handle_rumble(GB_gameboy_t *gb);
#endif
void GB_set_rumble_mode(GB_gameboy_t *gb, GB_rumble_mode_t mode);

View File

@ -36,8 +36,8 @@ static inline uint32_t state_magic(void)
}
/* For internal in-memory save states (rewind, debugger) that do not need BESS */
size_t internal GB_get_save_state_size_no_bess(GB_gameboy_t *gb);
void internal GB_save_state_to_buffer_no_bess(GB_gameboy_t *gb, uint8_t *buffer);
internal size_t GB_get_save_state_size_no_bess(GB_gameboy_t *gb);
internal void GB_save_state_to_buffer_no_bess(GB_gameboy_t *gb, uint8_t *buffer);
#endif
#endif /* save_state_h */

View File

@ -58,9 +58,9 @@ struct GB_sgb_s {
uint8_t received_header[0x54];
};
void internal GB_sgb_write(GB_gameboy_t *gb, uint8_t value);
void internal GB_sgb_render(GB_gameboy_t *gb);
void internal GB_sgb_load_default_data(GB_gameboy_t *gb);
internal void GB_sgb_write(GB_gameboy_t *gb, uint8_t value);
internal void GB_sgb_render(GB_gameboy_t *gb);
internal void GB_sgb_load_default_data(GB_gameboy_t *gb);
#endif

View File

@ -5,7 +5,7 @@
void GB_cpu_disassemble(GB_gameboy_t *gb, uint16_t pc, uint16_t count);
#ifdef GB_INTERNAL
void internal GB_cpu_run(GB_gameboy_t *gb);
internal void GB_cpu_run(GB_gameboy_t *gb);
#endif
#endif /* sm83_cpu_h */

View File

@ -27,12 +27,12 @@ typedef struct {
} GB_reversed_symbol_map_t;
#ifdef GB_INTERNAL
void internal GB_reversed_map_add_symbol(GB_reversed_symbol_map_t *map, uint16_t bank, GB_bank_symbol_t *symbol);
const GB_symbol_t *internal GB_reversed_map_find_symbol(GB_reversed_symbol_map_t *map, const char *name);
GB_bank_symbol_t *internal GB_map_add_symbol(GB_symbol_map_t *map, uint16_t addr, const char *name);
const GB_bank_symbol_t *internal GB_map_find_symbol(GB_symbol_map_t *map, uint16_t addr);
GB_symbol_map_t *internal GB_map_alloc(void);
void internal GB_map_free(GB_symbol_map_t *map);
internal void GB_reversed_map_add_symbol(GB_reversed_symbol_map_t *map, uint16_t bank, GB_bank_symbol_t *symbol);
internal const GB_symbol_t *GB_reversed_map_find_symbol(GB_reversed_symbol_map_t *map, const char *name);
internal GB_bank_symbol_t *GB_map_add_symbol(GB_symbol_map_t *map, uint16_t addr, const char *name);
internal const GB_bank_symbol_t *GB_map_find_symbol(GB_symbol_map_t *map, uint16_t addr);
internal GB_symbol_map_t *GB_map_alloc(void);
internal void GB_map_free(GB_symbol_map_t *map);
#endif
#endif /* symbol_hash_h */

View File

@ -3,11 +3,11 @@
#include "defs.h"
#ifdef GB_INTERNAL
void internal GB_advance_cycles(GB_gameboy_t *gb, uint8_t cycles);
void internal GB_emulate_timer_glitch(GB_gameboy_t *gb, uint8_t old_tac, uint8_t new_tac);
bool internal GB_timing_sync_turbo(GB_gameboy_t *gb); /* Returns true if should skip frame */
void internal GB_timing_sync(GB_gameboy_t *gb);
void internal GB_set_internal_div_counter(GB_gameboy_t *gb, uint16_t value);
internal void GB_advance_cycles(GB_gameboy_t *gb, uint8_t cycles);
internal void GB_emulate_timer_glitch(GB_gameboy_t *gb, uint8_t old_tac, uint8_t new_tac);
internal bool GB_timing_sync_turbo(GB_gameboy_t *gb); /* Returns true if should skip frame */
internal void GB_timing_sync(GB_gameboy_t *gb);
internal void GB_set_internal_div_counter(GB_gameboy_t *gb, uint16_t value);
enum {
GB_TIMA_RUNNING = 0,