Skip to content

Commit

Permalink
Use strict prototypes for functions without arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
bvschaik committed Nov 4, 2018
1 parent fedbffd commit d8e7b33
Show file tree
Hide file tree
Showing 371 changed files with 1,785 additions and 1,773 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if (CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror=implicit-function-declaration")

if (CMAKE_C_COMPILER_VERSION VERSION_GREATER 5.0)
set(CMAKE_C_FLAGS "-Werror=incompatible-pointer-types -Werror=int-conversion ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "-Werror=incompatible-pointer-types -Werror=int-conversion -Wstrict-prototypes ${CMAKE_C_FLAGS}")
endif()
endif()

Expand Down
6 changes: 3 additions & 3 deletions src/building/barracks.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,19 @@ int building_barracks_create_tower_sentry(building *barracks, int x, int y)
return 1;
}

void building_barracks_request_tower_sentry()
void building_barracks_request_tower_sentry(void)
{
tower_sentry_request = 2;
}

void building_barracks_decay_tower_sentry_request()
void building_barracks_decay_tower_sentry_request(void)
{
if (tower_sentry_request > 0) {
tower_sentry_request--;
}
}

int building_barracks_has_tower_sentry_request()
int building_barracks_has_tower_sentry_request(void)
{
return tower_sentry_request;
}
Expand Down
6 changes: 3 additions & 3 deletions src/building/barracks.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ int building_barracks_create_soldier(building *barracks, int x, int y);

int building_barracks_create_tower_sentry(building *barracks, int x, int y);

void building_barracks_request_tower_sentry();
void building_barracks_request_tower_sentry(void);

void building_barracks_decay_tower_sentry_request();
void building_barracks_decay_tower_sentry_request(void);

int building_barracks_has_tower_sentry_request();
int building_barracks_has_tower_sentry_request(void);

void building_barracks_save_state(buffer *buf);

Expand Down
10 changes: 5 additions & 5 deletions src/building/building.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void building_clear_related_data(building *b)
}
}

void building_update_state()
void building_update_state(void)
{
int land_recalc = 0;
int wall_recalc = 0;
Expand Down Expand Up @@ -235,7 +235,7 @@ void building_update_state()
}
}

void building_update_desirability()
void building_update_desirability(void)
{
for (int i = 1; i < MAX_BUILDINGS; i++) {
building *b = &all_buildings[i];
Expand All @@ -262,12 +262,12 @@ int building_is_house(building_type type)
return type >= BUILDING_HOUSE_VACANT_LOT && type <= BUILDING_HOUSE_LUXURY_PALACE;
}

int building_get_highest_id()
int building_get_highest_id(void)
{
return extra.highest_id_in_use;
}

void building_update_highest_id()
void building_update_highest_id(void)
{
extra.highest_id_in_use = 0;
for (int i = 1; i < MAX_BUILDINGS; i++) {
Expand All @@ -288,7 +288,7 @@ void building_totals_add_corrupted_house(int unfixable)
}
}

void building_clear_all()
void building_clear_all(void)
{
for (int i = 0; i < MAX_BUILDINGS; i++) {
memset(&all_buildings[i], 0, sizeof(building));
Expand Down
10 changes: 5 additions & 5 deletions src/building/building.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,19 @@ building *building_create(building_type type, int x, int y);

void building_clear_related_data(building *b);

void building_update_state();
void building_update_state(void);

void building_update_desirability();
void building_update_desirability(void);

int building_is_house(building_type type);

int building_get_highest_id();
int building_get_highest_id(void);

void building_update_highest_id();
void building_update_highest_id(void);

void building_totals_add_corrupted_house(int unfixable);

void building_clear_all();
void building_clear_all(void);

void building_save_state(buffer *buf, buffer *highest_id, buffer *highest_id_ever,
buffer *sequence, buffer *corrupt_houses);
Expand Down
18 changes: 9 additions & 9 deletions src/building/construction.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,23 +459,23 @@ void building_construction_set_type(building_type type)
}
}

void building_construction_clear_type()
void building_construction_clear_type(void)
{
data.cost = 0;
data.type = BUILDING_NONE;
}

building_type building_construction_type()
building_type building_construction_type(void)
{
return data.type;
}

int building_construction_cost()
int building_construction_cost(void)
{
return data.cost;
}

int building_construction_in_progress()
int building_construction_in_progress(void)
{
return data.in_progress;
}
Expand Down Expand Up @@ -615,7 +615,7 @@ static int has_nearby_enemy(int x_start, int y_start, int x_end, int y_end)
return 0;
}

void building_construction_place()
void building_construction_place(void)
{
data.in_progress = 0;
int x_start = data.start.x;
Expand Down Expand Up @@ -777,7 +777,7 @@ int building_construction_can_place_on_terrain(int x, int y, int *warning_id)
return 1;
}

void building_construction_update_road_orientation()
void building_construction_update_road_orientation(void)
{
if (data.road_orientation > 0) {
if (time_get_millis() - data.road_last_update > 1500) {
Expand All @@ -787,7 +787,7 @@ void building_construction_update_road_orientation()
}
}

int building_construction_road_orientation()
int building_construction_road_orientation(void)
{
return data.road_orientation;
}
Expand All @@ -806,12 +806,12 @@ void building_construction_get_view_position(int *view_x, int *view_y)
*view_y = data.start_offset_y_view;
}

void building_construction_reset_draw_as_constructing()
void building_construction_reset_draw_as_constructing(void)
{
data.draw_as_constructing = 0;
}

int building_construction_draw_as_constructing()
int building_construction_draw_as_constructing(void)
{
return data.draw_as_constructing;
}
18 changes: 9 additions & 9 deletions src/building/construction.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@

void building_construction_set_type(building_type type);

void building_construction_clear_type();
void building_construction_clear_type(void);

building_type building_construction_type();
building_type building_construction_type(void);

int building_construction_cost();
int building_construction_cost(void);

int building_construction_in_progress();
int building_construction_in_progress(void);

void building_construction_start(int x, int y, int grid_offset);

void building_construction_update(int x, int y, int grid_offset);

void building_construction_place();
void building_construction_place(void);

int building_construction_can_place_on_terrain(int x, int y, int *warning_id);

void building_construction_update_road_orientation();
int building_construction_road_orientation();
void building_construction_update_road_orientation(void);
int building_construction_road_orientation(void);

void building_construction_record_view_position(int view_x, int view_y, int grid_offset);
void building_construction_get_view_position(int *view_x, int *view_y);

void building_construction_reset_draw_as_constructing();
int building_construction_draw_as_constructing();
void building_construction_reset_draw_as_constructing(void);
int building_construction_draw_as_constructing(void);

#endif // BUILDING_CONSTRUCTION_H
2 changes: 1 addition & 1 deletion src/building/construction_warning.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

static int has_warning = 0;

void building_construction_warning_reset()
void building_construction_warning_reset(void)
{
has_warning = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/building/construction_warning.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "building/type.h"

void building_construction_warning_reset();
void building_construction_warning_reset(void);
void building_construction_warning_check_food_stocks(building_type type);
void building_construction_warning_check_reservoir(building_type type);
void building_construction_warning_check_all(building_type type, int x, int y, int size);
Expand Down
6 changes: 3 additions & 3 deletions src/building/count.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static struct {
struct record industry[RESOURCE_MAX];
} data;

static void clear_counters()
static void clear_counters(void)
{
memset(&data, 0, sizeof(data));
}
Expand All @@ -38,7 +38,7 @@ static void increase_industry_count(resource_type resource, int active)
}
}

static void limit_hippodrome()
static void limit_hippodrome(void)
{
if (data.buildings[BUILDING_HIPPODROME].total > 1) {
data.buildings[BUILDING_HIPPODROME].total = 1;
Expand All @@ -48,7 +48,7 @@ static void limit_hippodrome()
}
}

void building_count_update()
void building_count_update(void)
{
clear_counters();
city_buildings_reset_dock_wharf_counters();
Expand Down
2 changes: 1 addition & 1 deletion src/building/count.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* Updates the building counts and does some extra work on the side
*/
void building_count_update();
void building_count_update(void);

/**
* Returns the active building count for the type
Expand Down
2 changes: 1 addition & 1 deletion src/building/destruction.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ int building_destroy_first_of_type(building_type type)
return 0;
}

void building_destroy_last_placed()
void building_destroy_last_placed(void)
{
int highest_sequence = 0;
building *last_building = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/building/destruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void building_destroy_by_rioter(building *b);

int building_destroy_first_of_type(building_type type);

void building_destroy_last_placed();
void building_destroy_last_placed(void);

void building_destroy_increase_enemy_damage(int grid_offset, int max_damage);

Expand Down
2 changes: 1 addition & 1 deletion src/building/dock.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int building_dock_count_idle_dockers(const building *dock)
return num_idle;
}

void building_dock_update_open_water_access()
void building_dock_update_open_water_access(void)
{
map_point river_entry = scenario_map_river_entry();
map_routing_calculate_distances_water_boat(river_entry.x, river_entry.y);
Expand Down
2 changes: 1 addition & 1 deletion src/building/dock.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

int building_dock_count_idle_dockers(const building *dock);

void building_dock_update_open_water_access();
void building_dock_update_open_water_access(void);

int building_dock_is_connected_to_open_water(int x, int y);

Expand Down
2 changes: 1 addition & 1 deletion src/building/figure.c
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ static void update_native_crop_progress(building *b)
}


void building_figure_generate()
void building_figure_generate(void)
{
int patrician_generated = 0;
building_barracks_decay_tower_sentry_request();
Expand Down
2 changes: 1 addition & 1 deletion src/building/figure.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef BUILDING_FIGURE_H
#define BUILDING_FIGURE_H

void building_figure_generate();
void building_figure_generate(void);

#endif // BUILDING_FIGURE_H
2 changes: 1 addition & 1 deletion src/building/government.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "building/count.h"
#include "city/finance.h"

void building_government_distribute_treasury()
void building_government_distribute_treasury(void)
{
int units =
5 * building_count_active(BUILDING_SENATE) +
Expand Down
2 changes: 1 addition & 1 deletion src/building/government.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef BUILDING_GOVERNMENT_H
#define BUILDING_GOVERNMENT_H

void building_government_distribute_treasury();
void building_government_distribute_treasury(void);

#endif // BUILDING_GOVERNMENT_H
4 changes: 2 additions & 2 deletions src/building/granary.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ int building_granary_determine_worker_task(building *granary)
return GRANARY_TASK_NONE;
}

void building_granaries_calculate_stocks()
void building_granaries_calculate_stocks(void)
{
non_getting_granaries.num_items = 0;
for (int i = 0; i < MAX_GRANARIES; i++) {
Expand Down Expand Up @@ -363,7 +363,7 @@ int building_granary_for_getting(building *src, int *x_dst, int *y_dst)
return min_building_id;
}

void building_granary_bless()
void building_granary_bless(void)
{
int min_stored = 10000;
building *min_building = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/building/granary.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ int building_granary_remove_for_getting_deliveryman(building *src, building *dst

int building_granary_determine_worker_task(building *granary);

void building_granaries_calculate_stocks();
void building_granaries_calculate_stocks(void);

int building_granary_for_storing(int x, int y, int resource, int distance_from_entry, int road_network_id,
int force_on_stockpile, int *understaffed, int *x_dst, int *y_dst);
Expand All @@ -28,7 +28,7 @@ int building_getting_granary_for_storing(int x, int y, int resource, int distanc

int building_granary_for_getting(building *src, int *x_dst, int *y_dst);

void building_granary_bless();
void building_granary_bless(void);

void building_granary_warehouse_curse(int big);

Expand Down
2 changes: 1 addition & 1 deletion src/building/house_evolution.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ static int (*evolve_callback[])(building *, house_demands *) = {
evolve_small_palace, evolve_medium_palace, evolve_large_palace, evolve_luxury_palace
};

void building_house_process_evolve_and_consume_goods()
void building_house_process_evolve_and_consume_goods(void)
{
city_houses_reset_demands();
house_demands *demands = city_houses_demands();
Expand Down
Loading

0 comments on commit d8e7b33

Please sign in to comment.