diff options
| author | J08nY | 2025-03-27 11:59:41 +0100 |
|---|---|---|
| committer | J08nY | 2025-03-27 11:59:41 +0100 |
| commit | e9c6d35a6efa5541cac33398ceb04e7fb721d6cd (patch) | |
| tree | a65c049be90df52772d129a15fa4f8755463f598 | |
| parent | 0684f9dc440a4909d89392aa0c16fd9ba5249e76 (diff) | |
| download | ecgen-e9c6d35a6efa5541cac33398ceb04e7fb721d6cd.tar.gz ecgen-e9c6d35a6efa5541cac33398ceb04e7fb721d6cd.tar.zst ecgen-e9c6d35a6efa5541cac33398ceb04e7fb721d6cd.zip | |
Fixup issues in clang with pedantic.
38 files changed, 81 insertions, 81 deletions
diff --git a/src/cm/anomalous.c b/src/cm/anomalous.c index 70df8e4..36d6890 100644 --- a/src/cm/anomalous.c +++ b/src/cm/anomalous.c @@ -8,7 +8,7 @@ static disc_t **disc_table; -void anomalous_init() { +void anomalous_init(void) { disc_table = try_calloc(sizeof(disc_t *) * 5); for (int i = 0; i < 5; ++i) { disc_table[i] = try_calloc(sizeof(disc_t)); @@ -128,7 +128,7 @@ GENERATOR(anomalous_gen_order) { return 1; } -void anomalous_quit() { +void anomalous_quit(void) { if (disc_table) { for (int i = 0; i < 5; ++i) { if (disc_table[i]) { diff --git a/src/cm/anomalous.h b/src/cm/anomalous.h index 73b84fd..6e897d5 100644 --- a/src/cm/anomalous.h +++ b/src/cm/anomalous.h @@ -49,12 +49,12 @@ GENERATOR(anomalous_gen_order); /** * @brief Initialize anomalous generation, allocate and set the disc_table. */ -void anomalous_init(); +void anomalous_init(void); /** * @brief Deinitialize anomalous generation, free the discriminants from the * disc_table. */ -void anomalous_quit(); +void anomalous_quit(void); #endif // ECGEN_CM_ANOMALOUS_H diff --git a/src/cm/cm.c b/src/cm/cm.c index 9845500..4690ed8 100644 --- a/src/cm/cm.c +++ b/src/cm/cm.c @@ -237,7 +237,7 @@ static void cm_quit(exhaustive_t *setup) { exhaustive_clear(setup); } -int cm_do() { +int cm_do(void) { debug_log_start("Starting Complex Multiplication method"); gen_f generators[OFFSET_END] = {NULL}; diff --git a/src/cm/cm.h b/src/cm/cm.h index b80d987..a130366 100644 --- a/src/cm/cm.h +++ b/src/cm/cm.h @@ -15,6 +15,6 @@ * * @return */ -int cm_do(); +int cm_do(void); #endif // ECGEN_CM_CM_H diff --git a/src/cm/cm_any.c b/src/cm/cm_any.c index c5f8410..5e4bab2 100644 --- a/src/cm/cm_any.c +++ b/src/cm/cm_any.c @@ -461,7 +461,7 @@ GENERATOR(cm_gen_order) { return 1; } -void cm_any_quit() { +void cm_any_quit(void) { if (min_d) { if (min_d->d && isclone(min_d->d)) { gunclone(min_d->d); diff --git a/src/cm/cm_any.h b/src/cm/cm_any.h index 05e5103..873b68f 100644 --- a/src/cm/cm_any.h +++ b/src/cm/cm_any.h @@ -90,6 +90,6 @@ GENERATOR(cm_gen_order); /** * @brief Deinitialize. */ -void cm_any_quit(); +void cm_any_quit(void); #endif // ECGEN_CM_ANY_H diff --git a/src/cm/cm_prime.c b/src/cm/cm_prime.c index 64ba72e..fa4d6f5 100644 --- a/src/cm/cm_prime.c +++ b/src/cm/cm_prime.c @@ -160,4 +160,4 @@ GENERATOR(cm_gen_curve_prime) { curve->b = ell_get_a6(e); curve->curve = e; return 1; -}
\ No newline at end of file +} diff --git a/src/cm/p1363.c b/src/cm/p1363.c index fad2a05..90dcfd2 100644 --- a/src/cm/p1363.c +++ b/src/cm/p1363.c @@ -449,4 +449,4 @@ GEN p1363_polclass(GEN D) { GEN WD = p1363_poly(D, forms, nforms); p1363_free(&forms, nforms); return gerepileupto(ltop, WD); -}
\ No newline at end of file +} diff --git a/src/exhaustive/ansi.c b/src/exhaustive/ansi.c index e369fb2..196a0a3 100644 --- a/src/exhaustive/ansi.c +++ b/src/exhaustive/ansi.c @@ -11,7 +11,7 @@ #include "util/memory.h" #include "util/str.h" -static seed_t *ansi_new() { +static seed_t *ansi_new(void) { seed_t *result = seed_new(); result->type = SEED_ANSI; return result; diff --git a/src/exhaustive/brainpool.c b/src/exhaustive/brainpool.c index 56c095d..584ef5b 100644 --- a/src/exhaustive/brainpool.c +++ b/src/exhaustive/brainpool.c @@ -13,7 +13,7 @@ #include "util/bits.h" #include "util/str.h" -static seed_t *brainpool_new() { +static seed_t *brainpool_new(void) { seed_t *result = seed_new(); result->type = SEED_BRAINPOOL; return result; @@ -272,4 +272,4 @@ CHECK(brainpool_check_order) { } else { return -4; } -}
\ No newline at end of file +} diff --git a/src/exhaustive/check.c b/src/exhaustive/check.c index 5fa1c17..050b430 100644 --- a/src/exhaustive/check.c +++ b/src/exhaustive/check.c @@ -32,4 +32,4 @@ void check_free(check_t **check) { try_free(*check); *check = NULL; } -}
\ No newline at end of file +} diff --git a/src/exhaustive/exhaustive.c b/src/exhaustive/exhaustive.c index 243754c..7833740 100644 --- a/src/exhaustive/exhaustive.c +++ b/src/exhaustive/exhaustive.c @@ -487,7 +487,7 @@ int exhaustive_generate(exhaustive_t *setup) { return result; } -int exhaustive_do() { +int exhaustive_do(void) { debug_log_start("Starting Exhaustive method"); gen_f generators[OFFSET_END] = {NULL}; diff --git a/src/exhaustive/exhaustive.h b/src/exhaustive/exhaustive.h index 5abd03d..926836f 100644 --- a/src/exhaustive/exhaustive.h +++ b/src/exhaustive/exhaustive.h @@ -66,6 +66,6 @@ int exhaustive_generate(exhaustive_t *setup); * * @return */ -int exhaustive_do(); +int exhaustive_do(void); #endif // ECGEN_EXHAUSTIVE_EXHAUSTIVE_H diff --git a/src/exhaustive/family.c b/src/exhaustive/family.c index 05433f7..2dcc24c 100644 --- a/src/exhaustive/family.c +++ b/src/exhaustive/family.c @@ -20,7 +20,7 @@ static GEN tz_store[FAMILIES] = {0}; static GEN D_store[FAMILIES] = {0}; // clang-format off -void family_init() { +void family_init(void) { pari_sp ltop = avma; nz_store[FAMILY_BN] = gclone(closure_evalgen(compile_str("(z) -> z"))); pz_store[FAMILY_BN] = gclone(closure_evalgen(compile_str("(z) -> 36*z^4 + 36*z^3 + 24*z^2 + 6*z + 1"))); @@ -68,7 +68,7 @@ void family_init() { } // clang-format on -static seed_t *family_new_seed() { +static seed_t *family_new_seed(void) { seed_t *result = seed_new(); result->type = SEED_FAMILY; return result; @@ -173,7 +173,7 @@ GENERATOR(family_gen_order) { } } -void family_quit() { +void family_quit(void) { for (int i = 0; i < FAMILIES; i++) { if (nz_store[i]) { gunclone(nz_store[i]); @@ -194,4 +194,4 @@ void family_quit() { if (b) { gunclone(b); } -}
\ No newline at end of file +} diff --git a/src/exhaustive/family.h b/src/exhaustive/family.h index 11e9104..5b398dc 100644 --- a/src/exhaustive/family.h +++ b/src/exhaustive/family.h @@ -22,8 +22,8 @@ GENERATOR(family_gen_equation_cm); GENERATOR(family_gen_order); -void family_init(); +void family_init(void); -void family_quit(); +void family_quit(void); #endif // ECGEN_EXHAUSTIVE_FAMILY_H diff --git a/src/exhaustive/nums.c b/src/exhaustive/nums.c index 0db8d75..1d3ae2a 100644 --- a/src/exhaustive/nums.c +++ b/src/exhaustive/nums.c @@ -107,4 +107,4 @@ void nums_quit(void) { if (b && isclone(b)) { gunclone(b); } -}
\ No newline at end of file +} diff --git a/src/exhaustive/nums.h b/src/exhaustive/nums.h index 40cb1b4..142f96a 100644 --- a/src/exhaustive/nums.h +++ b/src/exhaustive/nums.h @@ -55,6 +55,6 @@ GENERATOR(nums_gen_order); */ GENERATOR(nums_gen_gens); -void nums_quit(); +void nums_quit(void); #endif // ECGEN_EXHAUSTIVE_NUMS_H diff --git a/src/gen/hex.c b/src/gen/hex.c index 58250a0..559e86c 100644 --- a/src/gen/hex.c +++ b/src/gen/hex.c @@ -121,4 +121,4 @@ CHECK(hex_check_param) { } try_free(search_hex); return result; -}
\ No newline at end of file +} diff --git a/src/gen/order.c b/src/gen/order.c index a9d22b2..64ef665 100644 --- a/src/gen/order.c +++ b/src/gen/order.c @@ -158,4 +158,4 @@ CHECK(order_check_discriminant) { } avma = ltop; return 1; -}
\ No newline at end of file +} diff --git a/src/invalid/invalid.c b/src/invalid/invalid.c index e7870a5..6742148 100644 --- a/src/invalid/invalid.c +++ b/src/invalid/invalid.c @@ -327,7 +327,7 @@ curve_t *invalid_original_curve(exhaustive_t *setup) { return curve; } -int invalid_do() { +int invalid_do(void) { debug_log_start("Starting Invalid curve method"); gen_f original_gens[OFFSET_END] = {NULL}; diff --git a/src/invalid/invalid.h b/src/invalid/invalid.h index 15d6441..41bea15 100644 --- a/src/invalid/invalid.h +++ b/src/invalid/invalid.h @@ -14,6 +14,6 @@ * * @return */ -int invalid_do(); +int invalid_do(void); #endif // ECGEN_INVALID_INVALID_H diff --git a/src/io/cli.c b/src/io/cli.c index 16d3559..65524c9 100644 --- a/src/io/cli.c +++ b/src/io/cli.c @@ -97,7 +97,7 @@ struct argp_option cli_options[] = { static regex_t re_cm_order; -bool cli_init() { +bool cli_init(void) { int error = regcomp( &re_cm_order, "((0[xX][0-9a-fA-F]+)|([0-9]+))(,((0[xX][0-9a-fA-F]+)|([0-9]+)))*", @@ -540,4 +540,4 @@ char *cli_filter(int key, const char *text, void *input) { return (char *)text; } -void cli_quit() { regfree(&re_cm_order); } +void cli_quit(void) { regfree(&re_cm_order); } diff --git a/src/io/cli.h b/src/io/cli.h index abeb6e6..a712c44 100644 --- a/src/io/cli.h +++ b/src/io/cli.h @@ -19,7 +19,7 @@ extern struct argp_option cli_options[]; /** * @brief */ -bool cli_init(); +bool cli_init(void); /** * @brief @@ -42,6 +42,6 @@ char *cli_filter(int key, const char *text, void *input); /** * */ -void cli_quit(); +void cli_quit(void); #endif // ECGEN_IO_CLI_H diff --git a/src/io/input.c b/src/io/input.c index 507bd59..4c23c28 100644 --- a/src/io/input.c +++ b/src/io/input.c @@ -93,7 +93,7 @@ GEN input_string(const char *prompt) { return result; } -bool input_init() { +bool input_init(void) { if (cfg->input) { in = fopen(cfg->input, "r"); delim = ','; diff --git a/src/io/input.h b/src/io/input.h index a56347a..c1ac88e 100644 --- a/src/io/input.h +++ b/src/io/input.h @@ -50,7 +50,7 @@ extern FILE *in; * @brief Initialize input based on cfg. * @return whether the initialization was successful */ -bool input_init(); +bool input_init(void); /** * @brief Deinitialize input. diff --git a/src/io/output.c b/src/io/output.c index 4984515..a625446 100644 --- a/src/io/output.c +++ b/src/io/output.c @@ -10,9 +10,9 @@ #include "util/memory.h" char *(*output_s)(curve_t *curve); -char *(*output_s_separator)(); -char *(*output_s_begin)(); -char *(*output_s_end)(); +char *(*output_s_separator)(void); +char *(*output_s_begin)(void); +char *(*output_s_end)(void); FILE *out; FILE *err; @@ -182,11 +182,11 @@ char *output_sjson(curve_t *curve) { return result; } -char *output_sjson_separator() { return output_malloc(",\n"); } +char *output_sjson_separator(void) { return output_malloc(",\n"); } -char *output_sjson_begin() { return output_malloc("[\n"); } +char *output_sjson_begin(void) { return output_malloc("[\n"); } -char *output_sjson_end() { return output_malloc("]\n"); } +char *output_sjson_end(void) { return output_malloc("]\n"); } void output_f(FILE *output, curve_t *curve) { char *s = output_s(curve); @@ -206,7 +206,7 @@ void output_f_separator(FILE *output) { } } -void output_o_separator() { output_f_separator(out); } +void output_o_separator(void) { output_f_separator(out); } void output_f_begin(FILE *output) { char *s = output_s_begin(); @@ -216,7 +216,7 @@ void output_f_begin(FILE *output) { } } -void output_o_begin() { output_f_begin(out); } +void output_o_begin(void) { output_f_begin(out); } void output_f_end(FILE *output) { char *s = output_s_end(); @@ -226,9 +226,9 @@ void output_f_end(FILE *output) { } } -void output_o_end() { output_f_end(out); } +void output_o_end(void) { output_f_end(out); } -bool output_init() { +bool output_init(void) { json_set_allocation_functions(try_malloc, try_free); if (cfg->output) { diff --git a/src/io/output.h b/src/io/output.h index f68acfc..477def4 100644 --- a/src/io/output.h +++ b/src/io/output.h @@ -89,21 +89,21 @@ char *output_sjson(curve_t *curve); * format. * @return */ -char *output_sjson_separator(); +char *output_sjson_separator(void); /** * @brief Output JSON output header(a "[") to a malloc'ed string in CSV * format. * @return */ -char *output_sjson_begin(); +char *output_sjson_begin(void); /** * @brief Output JSON output footer(a "]") to a malloc'ed string in CSV * format. * @return */ -char *output_sjson_end(); +char *output_sjson_end(void); /** * @brief Output curve to a malloc'ed string in configured format. @@ -129,7 +129,7 @@ void output_o(curve_t *curve); * @brief Output separator to a malloc'ed string in configured format. * @return */ -extern char *(*output_s_separator)(); +extern char *(*output_s_separator)(void); /** * @brief Output separator to a FILE *out in configured format. @@ -140,13 +140,13 @@ void output_f_separator(FILE *out); /** * @brief Output separator to configured output in configured format. */ -void output_o_separator(); +void output_o_separator(void); /** * @brief Output header to a malloc'ed string in configured format. * @return */ -extern char *(*output_s_begin)(); +extern char *(*output_s_begin)(void); /** * @brief Output header to a FILE *out in configured format. @@ -157,13 +157,13 @@ void output_f_begin(FILE *out); /** * @brief Output header to configured output in configured format. */ -void output_o_begin(); +void output_o_begin(void); /** * @brief Output footer to a malloc'ed string in configured format. * @return */ -extern char *(*output_s_end)(); +extern char *(*output_s_end)(void); /** * @brief Output footer to a FILE *out in configured format. @@ -174,7 +174,7 @@ void output_f_end(FILE *out); /** * @brief Output header to configured output in configured format. */ -void output_o_end(); +void output_o_end(void); /** * @brief Configured output FILE*. @@ -195,7 +195,7 @@ extern FILE *verbose; * @brief Initialize output based on cfg. * @return whether the initialization was successful */ -bool output_init(); +bool output_init(void); /** * @brief Deinitialize output. diff --git a/src/math/koblitz.c b/src/math/koblitz.c index ca91160..903b4f7 100644 --- a/src/math/koblitz.c +++ b/src/math/koblitz.c @@ -70,4 +70,4 @@ GEN koblitz_get_order(unsigned long m, unsigned long a) { } else { return NULL; } -}
\ No newline at end of file +} diff --git a/src/math/subgroup.c b/src/math/subgroup.c index 0b5c515..cdf7acb 100644 --- a/src/math/subgroup.c +++ b/src/math/subgroup.c @@ -146,4 +146,4 @@ static GEN subgroups_2n(const curve_t *curve, size_t min_bits) { return subgroups_2n_gens(curve, min_bits); } -*/
\ No newline at end of file +*/ diff --git a/src/math/twists.c b/src/math/twists.c index 0d4b14c..a4ae2b9 100644 --- a/src/math/twists.c +++ b/src/math/twists.c @@ -33,4 +33,4 @@ void twist_rand(curve_t *what) { twist_rand_to(what, what); seed_free(&what->seed); subgroups_free_deep(&what->generators, what->ngens); -}
\ No newline at end of file +} diff --git a/src/misc/config.c b/src/misc/config.c index 155cbb4..9f66b51 100644 --- a/src/misc/config.c +++ b/src/misc/config.c @@ -15,7 +15,7 @@ config_names_t *cfg_used = &cfg_used_s; config_names_t cfg_set_s = {0}; config_names_t *cfg_set = &cfg_set_s; -void config_report_unused() { +void config_report_unused(void) { bool unused = false; if (cfg_set->field && !cfg_used->field) { fprintf( @@ -120,4 +120,4 @@ void config_report_unused() { #else (void)unused; #endif -}
\ No newline at end of file +} diff --git a/src/misc/config.h b/src/misc/config.h index 26e0610..b4fbc79 100644 --- a/src/misc/config.h +++ b/src/misc/config.h @@ -191,6 +191,6 @@ extern config_names_t *cfg_set; #define GET_BOOL(x) ((cfg_used->x = true) && cfg->x) #define SET(x) cfg_set->x = true -void config_report_unused(); +void config_report_unused(void); #endif // ECGEN_MISC_CONFIG_H diff --git a/src/obj/curve.c b/src/obj/curve.c index 4821442..10b720e 100644 --- a/src/obj/curve.c +++ b/src/obj/curve.c @@ -62,4 +62,4 @@ void curve_free(curve_t **curve) { try_free(*curve); *curve = NULL; } -}
\ No newline at end of file +} diff --git a/src/obj/obj.h b/src/obj/obj.h index 5a7f9ab..86a8d1d 100644 --- a/src/obj/obj.h +++ b/src/obj/obj.h @@ -5,15 +5,15 @@ #include "misc/types.h" #include "util/memory.h" -#define OBJ(obj_name, obj_type, copy_func, clone_func) \ - obj_type *obj_name##_new() { return try_calloc(sizeof(obj_type)); } \ - obj_type *obj_name##_new_copy(const obj_type *src) { \ - obj_type *result = obj_name##_new(); \ - return copy_func(src, result); \ - } \ - obj_type *obj_name##_new_clone(const obj_type *src) { \ - obj_type *result = obj_name##_new(); \ - return clone_func(src, result); \ +#define OBJ(obj_name, obj_type, copy_func, clone_func) \ + obj_type *obj_name##_new(void) { return try_calloc(sizeof(obj_type)); } \ + obj_type *obj_name##_new_copy(const obj_type *src) { \ + obj_type *result = obj_name##_new(); \ + return copy_func(src, result); \ + } \ + obj_type *obj_name##_new_clone(const obj_type *src) { \ + obj_type *result = obj_name##_new(); \ + return clone_func(src, result); \ } #define OBJS(obj_name, obj_type, copy_func, clone_func) \ @@ -44,7 +44,7 @@ } #define OBJ_H(obj_name, obj_type) \ - obj_type *obj_name##_new(); \ + obj_type *obj_name##_new(void); \ obj_type *obj_name##_new_copy(const obj_type *src); \ obj_type *obj_name##_new_clone(const obj_type *src); diff --git a/src/obj/point.c b/src/obj/point.c index 2b709dd..4722bad 100644 --- a/src/obj/point.c +++ b/src/obj/point.c @@ -48,4 +48,4 @@ void points_free_deep(point_t ***points, unsigned long npoints) { } points_free(points); } -}
\ No newline at end of file +} diff --git a/src/util/memory.c b/src/util/memory.c index f05efae..b84a4c4 100644 --- a/src/util/memory.c +++ b/src/util/memory.c @@ -72,4 +72,4 @@ void set_mem_funcs(void *(*malloc_fun)(size_t), void *(*calloc_fun)(size_t), calloc_func = calloc_fun; realloc_func = realloc_fun; free_func = free_fun; -}
\ No newline at end of file +} diff --git a/src/util/timeout.c b/src/util/timeout.c index 6fdbf16..5cfa552 100644 --- a/src/util/timeout.c +++ b/src/util/timeout.c @@ -19,17 +19,17 @@ void timeout_handle(int signum, siginfo_t *siginfo, void *other) { if (timeout_in) siglongjmp(timeout_ptr, 1); } -void timeout_thread_init() { +void timeout_thread_init(void) { timeout_timer = try_calloc(sizeof(timer_t)); sevp = try_calloc(sizeof(struct sigevent)); } -void timeout_thread_quit() { +void timeout_thread_quit(void) { try_free(timeout_timer); try_free(sevp); } -bool timeout_init() { +bool timeout_init(void) { // init for the main thread. timeout_thread_init(); struct sigaction new_action; @@ -42,7 +42,7 @@ bool timeout_init() { return true; } -void timeout_quit() { +void timeout_quit(void) { // deinit the main thread. timeout_thread_quit(); } diff --git a/src/util/timeout.h b/src/util/timeout.h index 57e3d22..6f6805b 100644 --- a/src/util/timeout.h +++ b/src/util/timeout.h @@ -69,19 +69,19 @@ extern __thread struct sigevent *sevp; } \ } -void timeout_thread_init(); +void timeout_thread_init(void); -void timeout_thread_quit(); +void timeout_thread_quit(void); /** * @brief Initialize the timeout system. * @return whether the initalization was successful */ -bool timeout_init(); +bool timeout_init(void); /** * @brief Deinitialize the timeout system. */ -void timeout_quit(); +void timeout_quit(void); #endif // ECGEN_UTIL_TIMEOUT_H |
