Skip to content

Commit

Permalink
chore: Add and fix -Wmissing-prototypes
Browse files Browse the repository at this point in the history
  • Loading branch information
robinlinden committed Feb 1, 2024
1 parent 84bec64 commit d6a77d0
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 62 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CFG_DIR = $(BASE_DIR)/cfg

LIBS = toxcore ncursesw libconfig libcurl

CFLAGS ?= -std=c11 -pthread -Wall -Wpedantic -Wunused -fstack-protector-all -Wvla -Wno-missing-braces
CFLAGS ?= -std=c11 -pthread -Wall -Wpedantic -Wunused -fstack-protector-all -Wvla -Wno-missing-braces -Wmissing-prototypes
CFLAGS += '-DTOXICVER="$(VERSION)"' -DHAVE_WIDECHAR -D_XOPEN_SOURCE_EXTENDED -D_FILE_OFFSET_BITS=64
CFLAGS += '-DPACKAGE_DATADIR="$(abspath $(DATADIR))"'
CFLAGS += ${USER_CFLAGS}
Expand Down
2 changes: 1 addition & 1 deletion src/audio_call.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ ToxAV *init_audio(Toxic *toxic)
return toxic->av;
}

void read_device_callback(const int16_t *captured, uint32_t size, void *data)
static void read_device_callback(const int16_t *captured, uint32_t size, void *data)
{
UNUSED_VAR(size);

Expand Down
2 changes: 1 addition & 1 deletion src/audio_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ DeviceError write_out(uint32_t device_idx, const int16_t *data, uint32_t sample_
*
* return normalized volume of buffer in range 0.0-100.0
*/
float volume(int16_t *frame, uint32_t samples)
static float volume(int16_t *frame, uint32_t samples)
{
float sum_of_squares = 0;

Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ static int extract_node(const char *line, struct Node *node)
}

/* Loads the DHT nodeslist to memory from json encoded nodes file. */
void *load_nodeslist_thread(void *data)
static void *load_nodeslist_thread(void *data)
{

const Toxic *toxic = (Toxic *) data;
Expand Down
20 changes: 10 additions & 10 deletions src/chat.c
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ static void chat_onGroupInvite(ToxWindow *self, Toxic *toxic, uint32_t friendnum
}

#ifdef GAMES
void chat_onGameInvite(ToxWindow *self, Toxic *toxic, uint32_t friend_number, const uint8_t *data, size_t length)
static void chat_onGameInvite(ToxWindow *self, Toxic *toxic, uint32_t friend_number, const uint8_t *data, size_t length)
{
if (toxic == NULL || self == NULL) {
return;
Expand Down Expand Up @@ -986,7 +986,7 @@ void chat_onGameInvite(ToxWindow *self, Toxic *toxic, uint32_t friend_number, co
/* AV Stuff */
#ifdef AUDIO

void chat_onInvite(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state)
static void chat_onInvite(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state)
{
UNUSED_VAR(state);

Expand Down Expand Up @@ -1018,7 +1018,7 @@ void chat_onInvite(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int st
}
}

void chat_onRinging(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state)
static void chat_onRinging(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state)
{
UNUSED_VAR(state);

Expand All @@ -1044,7 +1044,7 @@ void chat_onRinging(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int s
#endif /* SOUND_NOTIFY */
}

void chat_onStarting(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state)
static void chat_onStarting(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state)
{
UNUSED_VAR(state);

Expand All @@ -1070,7 +1070,7 @@ void chat_onStarting(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int
#endif /* SOUND_NOTIFY */
}

void chat_onError(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state)
static void chat_onError(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state)
{
UNUSED_VAR(state);

Expand All @@ -1090,7 +1090,7 @@ void chat_onError(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int sta
#endif /* SOUND_NOTIFY */
}

void chat_onStart(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state)
static void chat_onStart(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state)
{
UNUSED_VAR(state);

Expand All @@ -1116,7 +1116,7 @@ void chat_onStart(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int sta
#endif /* SOUND_NOTIFY */
}

void chat_onCancel(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state)
static void chat_onCancel(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state)
{
UNUSED_VAR(state);

Expand All @@ -1137,7 +1137,7 @@ void chat_onCancel(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int st
#endif /* SOUND_NOTIFY */
}

void chat_onReject(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state)
static void chat_onReject(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state)
{
UNUSED_VAR(state);

Expand All @@ -1157,7 +1157,7 @@ void chat_onReject(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int st
#endif /* SOUND_NOTIFY */
}

void chat_onEnd(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state)
static void chat_onEnd(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state)
{
UNUSED_VAR(state);

Expand Down Expand Up @@ -1294,7 +1294,7 @@ static void send_action(ToxWindow *self, ChatContext *ctx, Toxic *toxic, char *a
/*
* Return true if input is recognized by handler
*/
bool chat_onKey(ToxWindow *self, Toxic *toxic, wint_t key, bool ltr)
static bool chat_onKey(ToxWindow *self, Toxic *toxic, wint_t key, bool ltr)
{
if (toxic == NULL || self == NULL) {
return false;
Expand Down
8 changes: 4 additions & 4 deletions src/game_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ static void game_update_state(GameData *game)
}
}

void game_onDraw(ToxWindow *self, Toxic *toxic)
static void game_onDraw(ToxWindow *self, Toxic *toxic)
{
UNUSED_VAR(toxic); // Note: This function is not thread safe if we ever need to use `toxic`

Expand Down Expand Up @@ -787,7 +787,7 @@ void game_onDraw(ToxWindow *self, Toxic *toxic)
game_draw_messages(game, true);
}

bool game_onKey(ToxWindow *self, Toxic *toxic, wint_t key, bool is_printable)
static bool game_onKey(ToxWindow *self, Toxic *toxic, wint_t key, bool is_printable)
{
UNUSED_VAR(is_printable);

Expand Down Expand Up @@ -828,7 +828,7 @@ bool game_onKey(ToxWindow *self, Toxic *toxic, wint_t key, bool is_printable)
return true;
}

void game_onInit(ToxWindow *self, Toxic *toxic)
static void game_onInit(ToxWindow *self, Toxic *toxic)
{
UNUSED_VAR(toxic);

Expand All @@ -853,7 +853,7 @@ void game_onInit(ToxWindow *self, Toxic *toxic)
* Byte 2-5: Game ID
* Byte 6-* Game data
*/
void game_onPacket(ToxWindow *self, Toxic *toxic, uint32_t friendnumber, const uint8_t *data, size_t length)
static void game_onPacket(ToxWindow *self, Toxic *toxic, uint32_t friendnumber, const uint8_t *data, size_t length)
{
UNUSED_VAR(toxic);

Expand Down
12 changes: 6 additions & 6 deletions src/game_centipede.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ static void cent_bullet_move(const GameData *game, CentState *state, TIME_MS cur
}
}

void cent_bullet_spawn(CentState *state)
static void cent_bullet_spawn(CentState *state)
{
Projectile *bullet = &state->bullet;

Expand Down Expand Up @@ -1505,7 +1505,7 @@ static void cent_mushrooms_draw(WINDOW *win, const CentState *state)
}
}

void cent_cb_update_game_state(GameData *game, void *cb_data)
static void cent_cb_update_game_state(GameData *game, void *cb_data)
{
CentState *state = (CentState *)cb_data;

Expand All @@ -1529,7 +1529,7 @@ void cent_cb_update_game_state(GameData *game, void *cb_data)
cent_do_scorpion(game, state, cur_time);
}

void cent_cb_render_window(GameData *game, WINDOW *win, void *cb_data)
static void cent_cb_render_window(GameData *game, WINDOW *win, void *cb_data)
{
CentState *state = (CentState *)cb_data;

Expand All @@ -1544,7 +1544,7 @@ void cent_cb_render_window(GameData *game, WINDOW *win, void *cb_data)
cent_centipede_draw(game, win, state);
}

void cent_cb_on_keypress(GameData *game, int key, void *cb_data)
static void cent_cb_on_keypress(GameData *game, int key, void *cb_data)
{
CentState *state = (CentState *)cb_data;

Expand All @@ -1564,7 +1564,7 @@ void cent_cb_on_keypress(GameData *game, int key, void *cb_data)
}
}

void cent_cb_pause(GameData *game, bool is_paused, void *cb_data)
static void cent_cb_pause(GameData *game, bool is_paused, void *cb_data)
{
CentState *state = (CentState *)cb_data;

Expand All @@ -1581,7 +1581,7 @@ void cent_cb_pause(GameData *game, bool is_paused, void *cb_data)
}
}

void cent_cb_kill(GameData *game, void *cb_data)
static void cent_cb_kill(GameData *game, void *cb_data)
{
CentState *state = (CentState *)cb_data;

Expand Down
14 changes: 7 additions & 7 deletions src/game_chess.c
Original file line number Diff line number Diff line change
Expand Up @@ -1484,25 +1484,25 @@ static int chess_get_display_colour(ChessColour p_colour, int tile_colour)
}
}

void chess_move_curs_up_left(ChessState *state)
static void chess_move_curs_up_left(ChessState *state)
{
chess_move_curs_left(state);
chess_move_curs_up(state);
}

void chess_move_curs_up_right(ChessState *state)
static void chess_move_curs_up_right(ChessState *state)
{
chess_move_curs_right(state);
chess_move_curs_up(state);
}

void chess_move_curs_down_left(ChessState *state)
static void chess_move_curs_down_left(ChessState *state)
{
chess_move_curs_left(state);
chess_move_curs_down(state);
}

void chess_move_curs_down_right(ChessState *state)
static void chess_move_curs_down_right(ChessState *state)
{
chess_move_curs_right(state);
chess_move_curs_down(state);
Expand Down Expand Up @@ -1714,7 +1714,7 @@ static void chess_draw_interface(const GameData *game, WINDOW *win, ChessState *
chess_print_captured(game, win, state);
}

void chess_cb_render_window(GameData *game, WINDOW *win, void *cb_data)
static void chess_cb_render_window(GameData *game, WINDOW *win, void *cb_data)
{
ChessState *state = (ChessState *)cb_data;

Expand All @@ -1730,7 +1730,7 @@ void chess_cb_render_window(GameData *game, WINDOW *win, void *cb_data)
chess_draw_interface(game, win, state);
}

void chess_cb_on_keypress(GameData *game, int key, void *cb_data)
static void chess_cb_on_keypress(GameData *game, int key, void *cb_data)
{
ChessState *state = (ChessState *)cb_data;

Expand Down Expand Up @@ -1793,7 +1793,7 @@ void chess_cb_on_keypress(GameData *game, int key, void *cb_data)
}
}

void chess_cb_kill(GameData *game, void *cb_data)
static void chess_cb_kill(GameData *game, void *cb_data)
{
ChessState *state = (ChessState *)cb_data;

Expand Down
10 changes: 5 additions & 5 deletions src/game_life.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ static void life_start(GameData *game, LifeState *state)
state->generation = 1;
}

void life_cb_update_game_state(GameData *game, void *cb_data)
static void life_cb_update_game_state(GameData *game, void *cb_data)
{
LifeState *state = (LifeState *)cb_data;

Expand All @@ -357,7 +357,7 @@ void life_cb_update_game_state(GameData *game, void *cb_data)
life_cycle(game, state);
}

void life_cb_render_window(GameData *game, WINDOW *win, void *cb_data)
static void life_cb_render_window(GameData *game, WINDOW *win, void *cb_data)
{
LifeState *state = (LifeState *)cb_data;

Expand Down Expand Up @@ -442,7 +442,7 @@ static void life_move_curs_down_left(LifeState *state)
life_move_curs_left(state);
}

void life_cb_on_keypress(GameData *game, int key, void *cb_data)
static void life_cb_on_keypress(GameData *game, int key, void *cb_data)
{
LifeState *state = (LifeState *)cb_data;

Expand Down Expand Up @@ -555,7 +555,7 @@ static void life_free_cells(LifeState *state)
free(state->cells);
}

void life_cb_pause(GameData *game, bool is_paused, void *cb_data)
static void life_cb_pause(GameData *game, bool is_paused, void *cb_data)
{
LifeState *state = (LifeState *)cb_data;

Expand All @@ -566,7 +566,7 @@ void life_cb_pause(GameData *game, bool is_paused, void *cb_data)
state->paused = is_paused;
}

void life_cb_kill(GameData *game, void *cb_data)
static void life_cb_kill(GameData *game, void *cb_data)
{
LifeState *state = (LifeState *)cb_data;

Expand Down
10 changes: 5 additions & 5 deletions src/game_snake.c
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ static void snake_draw_powerup(WINDOW *win, const SnakeState *state)
}
}

void snake_cb_update_game_state(GameData *game, void *cb_data)
static void snake_cb_update_game_state(GameData *game, void *cb_data)
{
SnakeState *state = (SnakeState *)cb_data;

Expand All @@ -1014,7 +1014,7 @@ void snake_cb_update_game_state(GameData *game, void *cb_data)
}
}

void snake_cb_render_window(GameData *game, WINDOW *win, void *cb_data)
static void snake_cb_render_window(GameData *game, WINDOW *win, void *cb_data)
{
SnakeState *state = (SnakeState *)cb_data;

Expand All @@ -1034,7 +1034,7 @@ void snake_cb_render_window(GameData *game, WINDOW *win, void *cb_data)
snake_draw_snake(win, state->snake, state->snake_length);
}

void snake_cb_kill(GameData *game, void *cb_data)
static void snake_cb_kill(GameData *game, void *cb_data)
{
SnakeState *state = (SnakeState *)cb_data;

Expand All @@ -1058,7 +1058,7 @@ void snake_cb_kill(GameData *game, void *cb_data)
game_set_cb_on_pause(game, NULL, NULL);
}

void snake_cb_on_keypress(GameData *game, int key, void *cb_data)
static void snake_cb_on_keypress(GameData *game, int key, void *cb_data)
{
SnakeState *state = (SnakeState *)cb_data;

Expand All @@ -1069,7 +1069,7 @@ void snake_cb_on_keypress(GameData *game, int key, void *cb_data)
snake_set_key_press(state, key);
}

void snake_cb_pause(GameData *game, bool is_paused, void *cb_data)
static void snake_cb_pause(GameData *game, bool is_paused, void *cb_data)
{
SnakeState *state = (SnakeState *)cb_data;

Expand Down
3 changes: 2 additions & 1 deletion src/groupchats.c
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,8 @@ static void groupchat_onGroupPrivacyState(ToxWindow *self, Toxic *toxic, uint32_
write_to_log(ctx->log, c_config, tmp_event, "The founder", true);
}

void groupchat_onGroupVoiceState(ToxWindow *self, Toxic *toxic, uint32_t groupnumber, Tox_Group_Voice_State voice_state)
static void groupchat_onGroupVoiceState(ToxWindow *self, Toxic *toxic, uint32_t groupnumber,
Tox_Group_Voice_State voice_state)
{
if (toxic == NULL || self == NULL) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/name_lookup.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ static int process_response(struct Recv_Curl_Data *recv_data)
return 0;
}

void *lookup_thread_func(void *data)
static void *lookup_thread_func(void *data)
{
struct curl_slist *headers = NULL;
CURL *c_handle = NULL;
Expand Down
Loading

0 comments on commit d6a77d0

Please sign in to comment.