explicit void params declarations, add warnings to keep it correct

thx http://nickdesaulniers.github.io/blog/2019/05/12/f-vs-f-void-in-c-vs-c-plus-plus/
This commit is contained in:
cathugger 2019-05-14 20:29:27 +03:00
parent d03798bece
commit 92b36121b6
No known key found for this signature in database
GPG Key ID: 9BADDA2DAF6F01A8
6 changed files with 28 additions and 10 deletions

View File

@ -233,6 +233,23 @@ then
)
fi
CFLAGS="$cstd -Wmissing-prototypes -Werror"
AC_MSG_CHECKING([whether CC supports -Wmissing-prototypes])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])]
[cstd="$cstd -Wmissing-prototypes"],
[AC_MSG_RESULT([no])]
)
# XXX AC_LANG_PROGRAM produces unsuitable prototype so this check must be last one
CFLAGS="$cstd -Wstrict-prototypes -Werror"
AC_MSG_CHECKING([whether CC supports -Wstrict-prototypes])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int main(void) { return 0; }]])],
[AC_MSG_RESULT([yes])]
[cstd="$cstd -Wstrict-prototypes"],
[AC_MSG_RESULT([no])]
)
CFLAGS="$oldcflags"
AC_ARG_ENABLE([binfilterlen],

View File

@ -36,7 +36,7 @@ static const ge_cached ge_eightpoint = {
11267669, -24569594, 14624995
}
};
inline static void ge_initeightpoint() {}
inline static void ge_initeightpoint(void) {}
#endif
@ -105,7 +105,7 @@ static const ge25519_pniels ge_eightpoint = {
// t2d
{{ 1700965895112270, 372560131616985, 329575203620664, 756160485635107, 981466775886086 }},
};
inline static void ge_initeightpoint() {}
inline static void ge_initeightpoint(void) {}
#endif
@ -129,7 +129,7 @@ static const ge25519_pniels ge_eightpoint = {
// t2d
{{ 9713713562319586894U, 4328467261753610859U, 8262494979546083277U, 4020087914029409631U }},
};
inline static void ge_initeightpoint() {}
inline static void ge_initeightpoint(void) {}
#endif
@ -232,7 +232,7 @@ static u8 fe_t2d[32] = {
};
// initialize from packed representation
static void ge_initeightpoint()
static void ge_initeightpoint(void)
{
memset(&ge_eightpoint,0,sizeof(ge_eightpoint));
curve25519_expand(ge_eightpoint.ysubx,fe_ysubx);

View File

@ -92,4 +92,5 @@ extern struct pfiltervec filters;
extern int flattened;
extern void filters_init(void);
extern void filters_add(const char *filter);
extern size_t filters_count(void);

4
main.c
View File

@ -114,14 +114,14 @@ static void printhelp(FILE *out,const char *progname)
fflush(out);
}
static void e_additional()
static void e_additional(void)
{
fprintf(stderr,"additional argument required\n");
exit(1);
}
#ifndef STATISTICS
static void e_nostatistics()
static void e_nostatistics(void)
{
fprintf(stderr,"statistics support not compiled in\n");
exit(1);

4
yaml.c
View File

@ -49,12 +49,12 @@ static const char keys_field_time[] = "time: ";
static pthread_mutex_t tminfo_mutex;
void yamlout_init()
void yamlout_init(void)
{
pthread_mutex_init(&tminfo_mutex,0);
}
void yamlout_clean()
void yamlout_clean(void)
{
pthread_mutex_destroy(&tminfo_mutex);
}

4
yaml.h
View File

@ -1,4 +1,4 @@
extern void yamlout_init();
extern void yamlout_clean();
extern void yamlout_init(void);
extern void yamlout_clean(void);
extern void yamlout_writekeys(const char *hostname,const u8 *formated_public,const u8 *formated_secret);
extern int yamlin_parseandcreate(FILE *fin,char *sname,const char *hostname);