Skip to content

Fix warning: a function definition without a prototype is deprecated #3259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,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),
Expand Down
2 changes: 1 addition & 1 deletion src/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/compile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions src/jq_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[]) {
Expand Down Expand Up @@ -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]");
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -395,7 +395,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\"}");
Expand Down
16 changes: 8 additions & 8 deletions src/jv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -155,7 +155,7 @@ jv jv_invalid_with_msg(jv err) {
return x;
}

jv jv_invalid() {
jv jv_invalid(void) {
return JV_INVALID;
}

Expand Down Expand Up @@ -495,12 +495,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();
Expand Down Expand Up @@ -971,7 +971,7 @@ jv jv_array_sized(int n) {
return jvp_array_new(n);
}

jv jv_array() {
jv jv_array(void) {
return jv_array_sized(16);
}

Expand Down Expand Up @@ -1755,7 +1755,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);
}

Expand Down
6 changes: 3 additions & 3 deletions src/jv_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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
Expand Down Expand Up @@ -104,7 +104,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);
Expand All @@ -128,7 +128,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();
}
Expand Down
6 changes: 3 additions & 3 deletions src/jv_dtoa_tsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -28,15 +28,15 @@ 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();
}
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) {
Expand Down
2 changes: 1 addition & 1 deletion src/jv_dtoa_tsd.h
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,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 %s --help for help with command-line options,\n", progname);
fprintf(stderr, "or see the jq manpage, or online docs at https://jqlang.org\n");
exit(2);
Expand Down
2 changes: 1 addition & 1 deletion src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading