Skip to content

Commit

Permalink
Suppress warnings reported by -Wstrict-prototypes
Browse files Browse the repository at this point in the history
A function declaration without a prototype is deprecated in all versions
of C.
  • Loading branch information
jserv committed Dec 12, 2023
1 parent 90b42a6 commit ec914f4
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct elf_internal {
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

elf_t *elf_new()
elf_t *elf_new(void)
{
elf_t *e = malloc(sizeof(elf_t));
e->hdr = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ struct Elf32_Sym {

typedef struct elf_internal elf_t;

elf_t *elf_new();
elf_t *elf_new(void);
void elf_delete(elf_t *e);

/* Open an ELF file from specified path */
Expand Down
2 changes: 1 addition & 1 deletion src/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static uint8_t *data_memory_base;
*/
#define MEM_SIZE 0xFFFFFFFFULL

memory_t *memory_new()
memory_t *memory_new(void)
{
memory_t *mem = malloc(sizeof(memory_t));
#if HAVE_MMAP
Expand Down
2 changes: 1 addition & 1 deletion src/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ typedef struct {
uint64_t mem_size;
} memory_t;

memory_t *memory_new();
memory_t *memory_new(void);
void memory_delete(memory_t *m);

/* read a C-style string from memory */
Expand Down
2 changes: 1 addition & 1 deletion src/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ typedef struct {
map_t fd_map;
} state_t;

static inline state_t *state_new()
static inline state_t *state_new(void)
{
state_t *s = malloc(sizeof(state_t));
s->mem = memory_new();
Expand Down
2 changes: 1 addition & 1 deletion src/syscall_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ static void set_music_volume(riscv_t *rv)
Mix_VolumeMusic(volume * 8);
}

static void init_audio()
static void init_audio(void)
{
if (!(SDL_WasInit(-1) & SDL_INIT_AUDIO)) {
if (SDL_Init(SDL_INIT_AUDIO) != 0) {
Expand Down
10 changes: 4 additions & 6 deletions tests/map/mt19937.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,21 @@ void mt19937_init(uint64_t seed)
}
}

static void generate_numbers()
static void generate_numbers(void)
{
for (int i = 0; i < 624; i++) {
uint64_t y =
(MT[i] & 0x80000000ULL) + (MT[(i + 1) % 624] & 0x7fffffffULL);
MT[i] = MT[(i + 397) % 624] ^ (y >> 1);
if (y % 2 != 0) {
if (y % 2 != 0)
MT[i] = MT[i] ^ 0x9908b0dfULL;
}
}
}

uint64_t mt19937_extract()
uint64_t mt19937_extract(void)
{
if (index == 0) {
if (index == 0)
generate_numbers();
}

uint64_t y = MT[index];
y = y ^ (y >> 11);
Expand Down
2 changes: 1 addition & 1 deletion tests/map/mt19937.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
void mt19937_init(uint64_t seed);

/* Generate and extract a 32-bit random number */
uint64_t mt19937_extract();
uint64_t mt19937_extract(void);
2 changes: 1 addition & 1 deletion tests/map/test-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static void swap(int *x, int *y)
enum { N_NODES = 10000 };

/* return 0 on success; non-zero values on failure */
static int test_map_mixed_operations()
static int test_map_mixed_operations(void)
{
int ret = 0;
map_t tree = map_init(int, int, map_cmp_int);
Expand Down
4 changes: 2 additions & 2 deletions tests/path/test-path.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void compare(char *input, char *expected_output)
free(input_sanitized);
}

void sanitize_path_test()
void sanitize_path_test(void)
{
/* Already clean */
compare("", ".");
Expand Down Expand Up @@ -71,7 +71,7 @@ void sanitize_path_test()
compare("abc/../../././../def", "../../def");
}

int main()
int main(void)
{
sanitize_path_test();

Expand Down
4 changes: 2 additions & 2 deletions tools/rv_histogram.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static int cmp_asc(const void *a, const void *b)
}

/* used to adjust the length of histogram bar */
static unsigned short get_win_max_col()
static unsigned short get_win_max_col(void)
{
#if defined(_WIN32)
CONSOLE_SCREEN_BUFFER_INFO csbi;
Expand All @@ -84,7 +84,7 @@ static void find_max_freq(const rv_hist_t *stats, size_t stats_size)
static const char *fmt = "%3d. %-10s%5.2f%% [%-10zu] %s\n";

/* get columns used by the fmt string */
static unsigned short get_used_col()
static unsigned short get_used_col(void)
{
unsigned short used_col = 0;

Expand Down

0 comments on commit ec914f4

Please sign in to comment.