Skip to content

Commit d8033d3

Browse files
committed
refactor: Fix static analysis warnings about function prototypes
Newer version of clang enable the -Wstrict-prototypes flag by default. This commit adds the needed prototype on functions where it was missing.
1 parent 2d84150 commit d8033d3

File tree

11 files changed

+44
-44
lines changed

11 files changed

+44
-44
lines changed

src/config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#define DEFAULT_CGROUP_BASEPATH "/sys/fs/cgroup/perf_event"
4545

4646
struct config *
47-
config_create()
47+
config_create(void)
4848
{
4949
struct config *config = malloc(sizeof(struct config));
5050

@@ -337,7 +337,7 @@ config_setup_from_file(struct config *config, bson_t * doc)
337337
}
338338

339339
static void
340-
print_usage()
340+
print_usage(void)
341341
{
342342
// TODO: write an usage text
343343
}

src/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ struct config
8383
/*
8484
* config_create allocate the required resources and setup the default config.
8585
*/
86-
struct config *config_create();
86+
struct config *config_create(void);
8787

8888
/*
8989
* parse_config_file extract the config file path from command line arguments.

src/hwinfo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "util.h"
3838

3939
static struct hwinfo_pkg *
40-
hwinfo_pkg_create()
40+
hwinfo_pkg_create(void)
4141
{
4242
struct hwinfo_pkg *pkg = malloc(sizeof(struct hwinfo_pkg));
4343

@@ -222,7 +222,7 @@ hwinfo_detect(struct hwinfo *hwinfo)
222222
}
223223

224224
struct hwinfo *
225-
hwinfo_create()
225+
hwinfo_create(void)
226226
{
227227
struct hwinfo *hw = malloc(sizeof(struct hwinfo));
228228

src/hwinfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct hwinfo
5959
/*
6060
* hwinfo_create allocate the needed ressources.
6161
*/
62-
struct hwinfo *hwinfo_create();
62+
struct hwinfo *hwinfo_create(void);
6363

6464
/*
6565
* hwinfo_detect discover and store the machine hardware topology.

src/payload.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include "payload.h"
3737

3838
struct payload_cpu_data *
39-
payload_cpu_data_create()
39+
payload_cpu_data_create(void)
4040
{
4141
struct payload_cpu_data *data = malloc(sizeof(struct payload_cpu_data));
4242

@@ -62,7 +62,7 @@ payload_cpu_data_destroy(struct payload_cpu_data **data_ptr)
6262
}
6363

6464
struct payload_pkg_data *
65-
payload_pkg_data_create()
65+
payload_pkg_data_create(void)
6666
{
6767
struct payload_pkg_data *data = malloc(sizeof(struct payload_pkg_data));
6868

@@ -87,7 +87,7 @@ payload_pkg_data_destroy(struct payload_pkg_data **data_ptr)
8787
}
8888

8989
struct payload_group_data *
90-
payload_group_data_create()
90+
payload_group_data_create(void)
9191
{
9292
struct payload_group_data *data = malloc(sizeof(struct payload_group_data));
9393

src/payload.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void payload_destroy(struct payload *payload);
8181
/*
8282
* payload_group_data_create allocate the resources of an events group data container.
8383
*/
84-
struct payload_group_data *payload_group_data_create();
84+
struct payload_group_data *payload_group_data_create(void);
8585

8686
/*
8787
* payload_group_data_destroy free the allocated resources of the events group data container.
@@ -91,7 +91,7 @@ void payload_group_data_destroy(struct payload_group_data **data_ptr);
9191
/*
9292
* payload_pkg_data_create allocate the resources of a package data container.
9393
*/
94-
struct payload_pkg_data *payload_pkg_data_create();
94+
struct payload_pkg_data *payload_pkg_data_create(void);
9595

9696
/*
9797
* payload_pkg_data_destroy free the allocated resources of the package data container.
@@ -101,7 +101,7 @@ void payload_pkg_data_destroy(struct payload_pkg_data **data_ptr);
101101
/*
102102
* payload_cpu_data_create allocate the resources of a cpu data container.
103103
*/
104-
struct payload_cpu_data *payload_cpu_data_create();
104+
struct payload_cpu_data *payload_cpu_data_create(void);
105105

106106
/*
107107
* payload_cpu_data_destroy free the allocated resources of the cpu data container.

src/perf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ perf_event_fd_destroy(int **fd_ptr)
8585
}
8686

8787
static struct perf_group_cpu_context *
88-
perf_group_cpu_context_create()
88+
perf_group_cpu_context_create(void)
8989
{
9090
struct perf_group_cpu_context *ctx = malloc(sizeof(struct perf_group_cpu_context));
9191

@@ -111,7 +111,7 @@ perf_group_cpu_context_destroy(struct perf_group_cpu_context **ctx)
111111
}
112112

113113
static struct perf_group_pkg_context *
114-
perf_group_pkg_context_create()
114+
perf_group_pkg_context_create(void)
115115
{
116116
struct perf_group_pkg_context *ctx = malloc(sizeof(struct perf_group_pkg_context));
117117

@@ -559,7 +559,7 @@ perf_monitoring_actor(zsock_t *pipe, void *args)
559559
}
560560

561561
int
562-
perf_try_global_counting_event_open()
562+
perf_try_global_counting_event_open(void)
563563
{
564564
struct perf_event_attr pe = {0};
565565
int fd;

src/perf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void perf_monitoring_actor(zsock_t *pipe, void *args);
123123
* perf_try_event_open try to open a global counting event using the perf_event_open syscall.
124124
* This is used to check if the perf_event_open syscall is working and the current process is allowed to use it.
125125
*/
126-
int perf_try_global_counting_event_open();
126+
int perf_try_global_counting_event_open(void);
127127

128128
#endif /* PERF_H */
129129

src/pmu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include "util.h"
3737

3838
int
39-
pmu_initialize()
39+
pmu_initialize(void)
4040
{
4141
if (pfm_initialize() != PFM_SUCCESS) {
4242
return -1;
@@ -46,13 +46,13 @@ pmu_initialize()
4646
}
4747

4848
void
49-
pmu_deinitialize()
49+
pmu_deinitialize(void)
5050
{
5151
pfm_terminate();
5252
}
5353

5454
struct pmu_info *
55-
pmu_info_create()
55+
pmu_info_create(void)
5656
{
5757
struct pmu_info *pmu = malloc(sizeof(struct pmu_info));
5858
return pmu;
@@ -83,7 +83,7 @@ pmu_info_destroy(struct pmu_info **pmu)
8383
}
8484

8585
struct pmu_topology *
86-
pmu_topology_create()
86+
pmu_topology_create(void)
8787
{
8888
struct pmu_topology *topology = malloc(sizeof(struct pmu_topology));
8989

src/pmu.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ struct pmu_topology
5454
/*
5555
* pmu_initialize allocate the resources needed to use the PMUs.
5656
*/
57-
int pmu_initialize();
57+
int pmu_initialize(void);
5858

5959
/*
6060
* pmu_deinitialize free the allocated resources needed to use the PMUs.
6161
*/
62-
void pmu_deinitialize();
62+
void pmu_deinitialize(void);
6363

6464
/*
6565
* pmu_info_create allocate the resources needed for a pmu info container.
6666
*/
67-
struct pmu_info *pmu_info_create();
67+
struct pmu_info *pmu_info_create(void);
6868

6969
/*
7070
* pmu_info_dup duplicate the given pmu info.
@@ -79,7 +79,7 @@ void pmu_info_destroy(struct pmu_info **pmu);
7979
/*
8080
* pmu_topology_create allocate the resource needed for a pmu topology container.
8181
*/
82-
struct pmu_topology *pmu_topology_create();
82+
struct pmu_topology *pmu_topology_create(void);
8383

8484
/*
8585
* pmu_topology_destroy free the allocated resource of the pmu topology container.

0 commit comments

Comments
 (0)