Skip to content

Commit 5ad8004

Browse files
Add strict prototypes for functions with no arguments. (#295)
Using compile flags `-Werror -Wstrict-prototypes` (with Clang at least), the "prototypes" of some functions are flagged as an error. This is because of the difference between: ``` int no_args_please(void); ``` and ``` int no_args_please(); ``` Where the former is a strict prototype that says "no arguments are allowed". With the compile flags mentioned, ReadStat fails to compile with error messages like this: ``` In file included from src/readstat_bits.c:9: src/readstat_bits.h:10:29: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] int machine_is_little_endian(); ``` This PR adds the missing `void` in a handful of places where Clang complains about it with those strict compile flags.
1 parent 6bb297c commit 5ad8004

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/readstat_bits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#undef READSTAT_MACHINE_IS_TWOS_COMPLEMENT
88
#define READSTAT_MACHINE_IS_TWOS_COMPLEMENT 0
99

10-
int machine_is_little_endian();
10+
int machine_is_little_endian(void);
1111

1212
char ones_to_twos_complement1(char num);
1313
int16_t ones_to_twos_complement2(int16_t num);

src/readstat_variable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <stdlib.h>
33
#include "readstat.h"
44

5-
static readstat_value_t make_blank_value();
5+
static readstat_value_t make_blank_value(void);
66
static readstat_value_t make_double_value(double dval);
77

88
static readstat_value_t make_blank_value() {

src/sas/ieee.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ static void ieee2xpt(unsigned char *ieee, unsigned char *xport);
1616

1717
#ifndef FLOATREP
1818
#define FLOATREP get_native()
19-
int get_native();
19+
int get_native(void);
2020
#endif
2121

2222
void memreverse(void *intp_void, int l) {

src/spss/readstat_por.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ typedef struct por_ctx_s {
3131
ck_hash_table_t *var_dict;
3232
} por_ctx_t;
3333

34-
por_ctx_t *por_ctx_init();
34+
por_ctx_t *por_ctx_init(void);
3535
void por_ctx_free(por_ctx_t *ctx);
3636
ssize_t por_utf8_encode(const unsigned char *input, size_t input_len,
3737
char *output, size_t output_len, uint16_t lookup[256]);

0 commit comments

Comments
 (0)