Skip to content

Commit 5e7331a

Browse files
committed
Fix warning: a function definition without a prototype is deprecated
1 parent 4350637 commit 5e7331a

File tree

11 files changed

+27
-27
lines changed

11 files changed

+27
-27
lines changed

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ LIBJQ_SRC = src/builtin.c src/bytecode.c src/compile.c src/execute.c \
2020
### C build options
2121

2222
AM_CFLAGS = -Wextra -Wall -Wno-unused-parameter -Wno-unused-function \
23-
-Woverlength-strings
23+
-Woverlength-strings -Wstrict-prototypes
2424

2525
if WIN32
2626
AM_CFLAGS += -municode

src/builtin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1957,7 +1957,7 @@ BINOPS
19571957

19581958
// This is a hack to make last(g) yield no output values,
19591959
// if g yields no output values, without using boxing.
1960-
static block gen_last_1() {
1960+
static block gen_last_1(void) {
19611961
block last_var = gen_op_var_fresh(STOREV, "last");
19621962
block is_empty_var = gen_op_var_fresh(STOREV, "is_empty");
19631963
block init = BLOCK(gen_op_simple(DUP),

src/compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ block gen_location(location loc, struct locfile* l, block b) {
128128
return b;
129129
}
130130

131-
block gen_noop() {
131+
block gen_noop(void) {
132132
block b = {0,0};
133133
return b;
134134
}

src/compile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ typedef struct block {
1616

1717
block gen_location(location, struct locfile*, block);
1818

19-
block gen_noop();
19+
block gen_noop(void);
2020
int block_is_noop(block b);
2121
block gen_op_simple(opcode op);
2222
block gen_error(jv constant);

src/jq_test.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
#include "jv.h"
99
#include "jq.h"
1010

11-
static void jv_test();
11+
static void jv_test(void);
1212
static void run_jq_tests(jv, int, FILE *, int, int);
13-
static void run_jq_start_state_tests();
13+
static void run_jq_start_state_tests(void);
1414
#ifdef HAVE_PTHREAD
15-
static void run_jq_pthread_tests();
15+
static void run_jq_pthread_tests(void);
1616
#endif
1717

1818
int jq_testsuite(jv libdirs, int verbose, int argc, char* argv[]) {
@@ -307,7 +307,7 @@ static void test_jq_start_resets_state(char *prog, const char *input) {
307307
jq_teardown(&jq);
308308
}
309309

310-
static void run_jq_start_state_tests() {
310+
static void run_jq_start_state_tests(void) {
311311
test_jq_start_resets_state(".[]", "[1,2,3]");
312312
test_jq_start_resets_state(".[] | if .%2 == 0 then halt_error else . end", "[1,2,3]");
313313
}
@@ -365,7 +365,7 @@ static void *test_pthread_run(void *ptr) {
365365
return NULL;
366366
}
367367

368-
static void run_jq_pthread_tests() {
368+
static void run_jq_pthread_tests(void) {
369369
pthread_t threads[NUMBER_OF_THREADS];
370370
struct test_pthread_data data[NUMBER_OF_THREADS];
371371
int createerror;
@@ -399,7 +399,7 @@ static void run_jq_pthread_tests() {
399399
#endif // HAVE_PTHREAD
400400

401401

402-
static void jv_test() {
402+
static void jv_test(void) {
403403
/// JSON parser regression tests
404404
{
405405
jv v = jv_parse("{\"a':\"12\"}");

src/jv.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,15 @@ const jv JV_INVALID = {JVP_FLAGS_INVALID, 0, 0, 0, {0}};
119119
const jv JV_FALSE = {JVP_FLAGS_FALSE, 0, 0, 0, {0}};
120120
const jv JV_TRUE = {JVP_FLAGS_TRUE, 0, 0, 0, {0}};
121121

122-
jv jv_true() {
122+
jv jv_true(void) {
123123
return JV_TRUE;
124124
}
125125

126-
jv jv_false() {
126+
jv jv_false(void) {
127127
return JV_FALSE;
128128
}
129129

130-
jv jv_null() {
130+
jv jv_null(void) {
131131
return JV_NULL;
132132
}
133133

@@ -155,7 +155,7 @@ jv jv_invalid_with_msg(jv err) {
155155
return x;
156156
}
157157

158-
jv jv_invalid() {
158+
jv jv_invalid(void) {
159159
return JV_INVALID;
160160
}
161161

@@ -492,12 +492,12 @@ static pthread_once_t dec_ctx_once = PTHREAD_ONCE_INIT;
492492

493493
// atexit finalizer to clean up the tsd dec contexts if main() exits
494494
// without having called pthread_exit()
495-
void jv_tsd_dec_ctx_fini() {
495+
void jv_tsd_dec_ctx_fini(void) {
496496
jv_mem_free(pthread_getspecific(dec_ctx_key));
497497
pthread_setspecific(dec_ctx_key, NULL);
498498
}
499499

500-
void jv_tsd_dec_ctx_init() {
500+
void jv_tsd_dec_ctx_init(void) {
501501
if (pthread_key_create(&dec_ctx_key, jv_mem_free) != 0) {
502502
fprintf(stderr, "error: cannot create thread specific key");
503503
abort();
@@ -991,7 +991,7 @@ jv jv_array_sized(int n) {
991991
return jvp_array_new(n);
992992
}
993993

994-
jv jv_array() {
994+
jv jv_array(void) {
995995
return jv_array_sized(16);
996996
}
997997

@@ -1801,7 +1801,7 @@ static int jvp_object_contains(jv a, jv b) {
18011801
* Objects (public interface)
18021802
*/
18031803
#define DEFAULT_OBJECT_SIZE 8
1804-
jv jv_object() {
1804+
jv jv_object(void) {
18051805
return jvp_object_new(8);
18061806
}
18071807

src/jv_alloc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void jv_nomem_handler(jv_nomem_handler_f handler, void *data) {
3434
nomem_handler.handler = handler;
3535
}
3636

37-
static void memory_exhausted() {
37+
static void memory_exhausted(void) {
3838
if (nomem_handler.handler)
3939
nomem_handler.handler(nomem_handler.data); // Maybe handler() will longjmp() to safety
4040
// Or not
@@ -105,7 +105,7 @@ void jv_nomem_handler(jv_nomem_handler_f handler, void *data) {
105105
nomem_handler->data = data;
106106
}
107107

108-
static void memory_exhausted() {
108+
static void memory_exhausted(void) {
109109
struct nomem_handler *nomem_handler;
110110

111111
pthread_once(&mem_once, tsd_init);
@@ -129,7 +129,7 @@ void jv_nomem_handler(jv_nomem_handler_f handler, void *data) {
129129
nomem_handler.data = data;
130130
}
131131

132-
static void memory_exhausted() {
132+
static void memory_exhausted(void) {
133133
fprintf(stderr, "jq: error: cannot allocate memory\n");
134134
abort();
135135
}

src/jv_dtoa_tsd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static void tsd_dtoa_ctx_dtor(void *ctx) {
1919
#ifndef WIN32
2020
static
2121
#endif
22-
void jv_tsd_dtoa_ctx_fini() {
22+
void jv_tsd_dtoa_ctx_fini(void) {
2323
struct dtoa_context *ctx = pthread_getspecific(dtoa_ctx_key);
2424
tsd_dtoa_ctx_dtor(ctx);
2525
pthread_setspecific(dtoa_ctx_key, NULL);
@@ -28,15 +28,15 @@ void jv_tsd_dtoa_ctx_fini() {
2828
#ifndef WIN32
2929
static
3030
#endif
31-
void jv_tsd_dtoa_ctx_init() {
31+
void jv_tsd_dtoa_ctx_init(void) {
3232
if (pthread_key_create(&dtoa_ctx_key, tsd_dtoa_ctx_dtor) != 0) {
3333
fprintf(stderr, "error: cannot create thread specific key");
3434
abort();
3535
}
3636
atexit(jv_tsd_dtoa_ctx_fini);
3737
}
3838

39-
inline struct dtoa_context *tsd_dtoa_context_get() {
39+
inline struct dtoa_context *tsd_dtoa_context_get(void) {
4040
pthread_once(&dtoa_ctx_once, jv_tsd_dtoa_ctx_init); // cannot fail
4141
struct dtoa_context *ctx = (struct dtoa_context*)pthread_getspecific(dtoa_ctx_key);
4242
if (!ctx) {

src/jv_dtoa_tsd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#ifndef JV_DTOA_TSD_H
22
#define JV_DTOA_TSD_H
3-
struct dtoa_context *tsd_dtoa_context_get();
3+
struct dtoa_context *tsd_dtoa_context_get(void);
44
#endif

src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static void usage(int code, int keep_it_short) {
112112
exit((ret < 0 && code == 0) ? 2 : code);
113113
}
114114

115-
static void die() {
115+
static void die(void) {
116116
fprintf(stderr, "Use jq --help for help with command-line options,\n");
117117
fprintf(stderr, "or see the jq manpage, or online docs at https://jqlang.org\n");
118118
exit(2);

src/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jv expand_path(jv path) {
9898
return ret;
9999
}
100100

101-
jv get_home() {
101+
jv get_home(void) {
102102
jv ret;
103103
char *home = getenv("HOME");
104104
if (!home) {

0 commit comments

Comments
 (0)