Fix warning: a function definition without a prototype is deprecated (#3259)
This commit is contained in:
1 parent
9f6bcdc321
commit
a8f27cc4db
11 files changed
+27
-27
No files matched your search
+1
-1
@@ -20,7 +20,7 @@ LIBJQ_SRC = src/builtin.c src/bytecode.c src/compile.c src/execute.c \
|
||||
### C build options
|
||||
|
||||
AM_CFLAGS = -Wextra -Wall -Wno-unused-parameter -Wno-unused-function \
|
||||
-Woverlength-strings
|
||||
-Woverlength-strings -Wstrict-prototypes
|
||||
|
||||
if WIN32
|
||||
AM_CFLAGS += -municode
|
||||
|
||||
+1
-1
@@ -1957,7 +1957,7 @@ BINOPS
|
||||
|
||||
// This is a hack to make last(g) yield no output values,
|
||||
// if g yields no output values, without using boxing.
|
||||
static block gen_last_1() {
|
||||
static block gen_last_1(void) {
|
||||
block last_var = gen_op_var_fresh(STOREV, "last");
|
||||
block is_empty_var = gen_op_var_fresh(STOREV, "is_empty");
|
||||
block init = BLOCK(gen_op_simple(DUP),
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ block gen_location(location loc, struct locfile* l, block b) {
|
||||
return b;
|
||||
}
|
||||
|
||||
block gen_noop() {
|
||||
block gen_noop(void) {
|
||||
block b = {0,0};
|
||||
return b;
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ typedef struct block {
|
||||
|
||||
block gen_location(location, struct locfile*, block);
|
||||
|
||||
block gen_noop();
|
||||
block gen_noop(void);
|
||||
int block_is_noop(block b);
|
||||
block gen_op_simple(opcode op);
|
||||
block gen_error(jv constant);
|
||||
|
||||
+6
-6
@@ -8,11 +8,11 @@
|
||||
#include "jv.h"
|
||||
#include "jq.h"
|
||||
|
||||
static void jv_test();
|
||||
static void jv_test(void);
|
||||
static void run_jq_tests(jv, int, FILE *, int, int);
|
||||
static void run_jq_start_state_tests();
|
||||
static void run_jq_start_state_tests(void);
|
||||
#ifdef HAVE_PTHREAD
|
||||
static void run_jq_pthread_tests();
|
||||
static void run_jq_pthread_tests(void);
|
||||
#endif
|
||||
|
||||
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) {
|
||||
jq_teardown(&jq);
|
||||
}
|
||||
|
||||
static void run_jq_start_state_tests() {
|
||||
static void run_jq_start_state_tests(void) {
|
||||
test_jq_start_resets_state(".[]", "[1,2,3]");
|
||||
test_jq_start_resets_state(".[] | if .%2 == 0 then halt_error else . end", "[1,2,3]");
|
||||
}
|
||||
@@ -365,7 +365,7 @@ static void *test_pthread_run(void *ptr) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void run_jq_pthread_tests() {
|
||||
static void run_jq_pthread_tests(void) {
|
||||
pthread_t threads[NUMBER_OF_THREADS];
|
||||
struct test_pthread_data data[NUMBER_OF_THREADS];
|
||||
int createerror;
|
||||
@@ -399,7 +399,7 @@ static void run_jq_pthread_tests() {
|
||||
#endif // HAVE_PTHREAD
|
||||
|
||||
|
||||
static void jv_test() {
|
||||
static void jv_test(void) {
|
||||
/// JSON parser regression tests
|
||||
{
|
||||
jv v = jv_parse("{\"a':\"12\"}");
|
||||
|
||||
@@ -119,15 +119,15 @@ const jv JV_INVALID = {JVP_FLAGS_INVALID, 0, 0, 0, {0}};
|
||||
const jv JV_FALSE = {JVP_FLAGS_FALSE, 0, 0, 0, {0}};
|
||||
const jv JV_TRUE = {JVP_FLAGS_TRUE, 0, 0, 0, {0}};
|
||||
|
||||
jv jv_true() {
|
||||
jv jv_true(void) {
|
||||
return JV_TRUE;
|
||||
}
|
||||
|
||||
jv jv_false() {
|
||||
jv jv_false(void) {
|
||||
return JV_FALSE;
|
||||
}
|
||||
|
||||
jv jv_null() {
|
||||
jv jv_null(void) {
|
||||
return JV_NULL;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ jv jv_invalid_with_msg(jv err) {
|
||||
return x;
|
||||
}
|
||||
|
||||
jv jv_invalid() {
|
||||
jv jv_invalid(void) {
|
||||
return JV_INVALID;
|
||||
}
|
||||
|
||||
@@ -492,12 +492,12 @@ static pthread_once_t dec_ctx_once = PTHREAD_ONCE_INIT;
|
||||
|
||||
// atexit finalizer to clean up the tsd dec contexts if main() exits
|
||||
// without having called pthread_exit()
|
||||
void jv_tsd_dec_ctx_fini() {
|
||||
void jv_tsd_dec_ctx_fini(void) {
|
||||
jv_mem_free(pthread_getspecific(dec_ctx_key));
|
||||
pthread_setspecific(dec_ctx_key, NULL);
|
||||
}
|
||||
|
||||
void jv_tsd_dec_ctx_init() {
|
||||
void jv_tsd_dec_ctx_init(void) {
|
||||
if (pthread_key_create(&dec_ctx_key, jv_mem_free) != 0) {
|
||||
fprintf(stderr, "error: cannot create thread specific key");
|
||||
abort();
|
||||
@@ -991,7 +991,7 @@ jv jv_array_sized(int n) {
|
||||
return jvp_array_new(n);
|
||||
}
|
||||
|
||||
jv jv_array() {
|
||||
jv jv_array(void) {
|
||||
return jv_array_sized(16);
|
||||
}
|
||||
|
||||
@@ -1801,7 +1801,7 @@ static int jvp_object_contains(jv a, jv b) {
|
||||
* Objects (public interface)
|
||||
*/
|
||||
#define DEFAULT_OBJECT_SIZE 8
|
||||
jv jv_object() {
|
||||
jv jv_object(void) {
|
||||
return jvp_object_new(8);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -34,7 +34,7 @@ void jv_nomem_handler(jv_nomem_handler_f handler, void *data) {
|
||||
nomem_handler.handler = handler;
|
||||
}
|
||||
|
||||
static void memory_exhausted() {
|
||||
static void memory_exhausted(void) {
|
||||
if (nomem_handler.handler)
|
||||
nomem_handler.handler(nomem_handler.data); // Maybe handler() will longjmp() to safety
|
||||
// Or not
|
||||
@@ -105,7 +105,7 @@ void jv_nomem_handler(jv_nomem_handler_f handler, void *data) {
|
||||
nomem_handler->data = data;
|
||||
}
|
||||
|
||||
static void memory_exhausted() {
|
||||
static void memory_exhausted(void) {
|
||||
struct nomem_handler *nomem_handler;
|
||||
|
||||
pthread_once(&mem_once, tsd_init);
|
||||
@@ -129,7 +129,7 @@ void jv_nomem_handler(jv_nomem_handler_f handler, void *data) {
|
||||
nomem_handler.data = data;
|
||||
}
|
||||
|
||||
static void memory_exhausted() {
|
||||
static void memory_exhausted(void) {
|
||||
fprintf(stderr, "jq: error: cannot allocate memory\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@ static void tsd_dtoa_ctx_dtor(void *ctx) {
|
||||
#ifndef WIN32
|
||||
static
|
||||
#endif
|
||||
void jv_tsd_dtoa_ctx_fini() {
|
||||
void jv_tsd_dtoa_ctx_fini(void) {
|
||||
struct dtoa_context *ctx = pthread_getspecific(dtoa_ctx_key);
|
||||
tsd_dtoa_ctx_dtor(ctx);
|
||||
pthread_setspecific(dtoa_ctx_key, NULL);
|
||||
@@ -28,7 +28,7 @@ void jv_tsd_dtoa_ctx_fini() {
|
||||
#ifndef WIN32
|
||||
static
|
||||
#endif
|
||||
void jv_tsd_dtoa_ctx_init() {
|
||||
void jv_tsd_dtoa_ctx_init(void) {
|
||||
if (pthread_key_create(&dtoa_ctx_key, tsd_dtoa_ctx_dtor) != 0) {
|
||||
fprintf(stderr, "error: cannot create thread specific key");
|
||||
abort();
|
||||
@@ -36,7 +36,7 @@ void jv_tsd_dtoa_ctx_init() {
|
||||
atexit(jv_tsd_dtoa_ctx_fini);
|
||||
}
|
||||
|
||||
inline struct dtoa_context *tsd_dtoa_context_get() {
|
||||
inline struct dtoa_context *tsd_dtoa_context_get(void) {
|
||||
pthread_once(&dtoa_ctx_once, jv_tsd_dtoa_ctx_init); // cannot fail
|
||||
struct dtoa_context *ctx = (struct dtoa_context*)pthread_getspecific(dtoa_ctx_key);
|
||||
if (!ctx) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#ifndef JV_DTOA_TSD_H
|
||||
#define JV_DTOA_TSD_H
|
||||
struct dtoa_context *tsd_dtoa_context_get();
|
||||
struct dtoa_context *tsd_dtoa_context_get(void);
|
||||
#endif
|
||||
+1
-1
@@ -112,7 +112,7 @@ static void usage(int code, int keep_it_short) {
|
||||
exit((ret < 0 && code == 0) ? 2 : code);
|
||||
}
|
||||
|
||||
static void die() {
|
||||
static void die(void) {
|
||||
fprintf(stderr, "Use jq --help for help with command-line options,\n");
|
||||
fprintf(stderr, "or see the jq manpage, or online docs at https://jqlang.org\n");
|
||||
exit(2);
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ jv expand_path(jv path) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
jv get_home() {
|
||||
jv get_home(void) {
|
||||
jv ret;
|
||||
char *home = getenv("HOME");
|
||||
if (!home) {
|
||||
|
||||
Reference in new issue
Block a user