configure: Add -Wstrict-prototypes and -Wold-style-definition

These are not covered by -Wall (nor -Wextra) but we want
to enforce them.

Change-Id: I6e08920e4cf4762b9f14a7461a29fa77df15255c
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20240620144230.19586-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28823.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
Frank Lichtenheld 2024-06-20 16:42:30 +02:00 committed by Gert Doering
parent c9f29e35cd
commit 56355924b4
15 changed files with 25 additions and 23 deletions

View File

@ -1408,6 +1408,8 @@ AC_DEFUN([ACL_CHECK_ADD_COMPILE_FLAGS], [
) )
ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-stringop-truncation]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-stringop-truncation])
ACL_CHECK_ADD_COMPILE_FLAGS([-Wstrict-prototypes])
ACL_CHECK_ADD_COMPILE_FLAGS([-Wold-style-definition])
ACL_CHECK_ADD_COMPILE_FLAGS([-Wall]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wall])
if test "${enable_pedantic}" = "yes"; then if test "${enable_pedantic}" = "yes"; then

View File

@ -247,7 +247,7 @@ int dco_get_peer_stats(struct context *c);
* *
* @return list of colon-separated ciphers * @return list of colon-separated ciphers
*/ */
const char *dco_get_supported_ciphers(); const char *dco_get_supported_ciphers(void);
#else /* if defined(ENABLE_DCO) */ #else /* if defined(ENABLE_DCO) */
@ -375,7 +375,7 @@ dco_get_peer_stats(struct context *c)
} }
static inline const char * static inline const char *
dco_get_supported_ciphers() dco_get_supported_ciphers(void)
{ {
return ""; return "";
} }

View File

@ -773,7 +773,7 @@ dco_get_peer_stats(struct context *c)
} }
const char * const char *
dco_get_supported_ciphers() dco_get_supported_ciphers(void)
{ {
return "none:AES-256-GCM:AES-192-GCM:AES-128-GCM:CHACHA20-POLY1305"; return "none:AES-256-GCM:AES-192-GCM:AES-128-GCM:CHACHA20-POLY1305";
} }

View File

@ -1053,7 +1053,7 @@ dco_event_set(dco_context_t *dco, struct event_set *es, void *arg)
} }
const char * const char *
dco_get_supported_ciphers() dco_get_supported_ciphers(void)
{ {
return "AES-128-GCM:AES-256-GCM:AES-192-GCM:CHACHA20-POLY1305"; return "AES-128-GCM:AES-256-GCM:AES-192-GCM:CHACHA20-POLY1305";
} }

View File

@ -35,7 +35,7 @@ pkcs11_initialize(
); );
void void
pkcs11_terminate(); pkcs11_terminate(void);
bool bool
pkcs11_addProvider( pkcs11_addProvider(
@ -46,10 +46,10 @@ pkcs11_addProvider(
); );
int int
pkcs11_logout(); pkcs11_logout(void);
int int
pkcs11_management_id_count(); pkcs11_management_id_count(void);
bool bool
pkcs11_management_id_get( pkcs11_management_id_get(

View File

@ -448,7 +448,7 @@ post_init_signal_catch(void)
} }
void void
halt_low_priority_signals() halt_low_priority_signals(void)
{ {
#ifndef _WIN32 #ifndef _WIN32
struct sigaction sa; struct sigaction sa;

View File

@ -277,7 +277,7 @@ static char *auth_challenge; /* GLOBAL */
#endif #endif
void void
enable_auth_user_pass() enable_auth_user_pass(void)
{ {
auth_user_pass_enabled = true; auth_user_pass_enabled = true;
} }

View File

@ -381,7 +381,7 @@ void tls_post_encrypt(struct tls_multi *multi, struct buffer *buf);
void pem_password_setup(const char *auth_file); void pem_password_setup(const char *auth_file);
/* Enables the use of user/password authentication */ /* Enables the use of user/password authentication */
void enable_auth_user_pass(); void enable_auth_user_pass(void);
/* /*
* Setup authentication username and password. If auth_file is given, use the * Setup authentication username and password. If auth_file is given, use the

View File

@ -49,7 +49,7 @@ static const char *const props = XKEY_PROV_PROPS;
XKEY_EXTERNAL_SIGN_fn xkey_management_sign; XKEY_EXTERNAL_SIGN_fn xkey_management_sign;
static void static void
print_openssl_errors() print_openssl_errors(void)
{ {
unsigned long e; unsigned long e;
while ((e = ERR_get_error())) while ((e = ERR_get_error()))

View File

@ -155,7 +155,7 @@ static int
keymgmt_import_helper(XKEY_KEYDATA *key, const OSSL_PARAM params[]); keymgmt_import_helper(XKEY_KEYDATA *key, const OSSL_PARAM params[]);
static XKEY_KEYDATA * static XKEY_KEYDATA *
keydata_new() keydata_new(void)
{ {
xkey_dmsg(D_XKEY, "entry"); xkey_dmsg(D_XKEY, "entry");

View File

@ -33,7 +33,7 @@
* methods * methods
*/ */
static inline void static inline void
openvpn_unit_test_setup() openvpn_unit_test_setup(void)
{ {
assert_int_equal(setvbuf(stdout, NULL, _IONBF, BUFSIZ), 0); assert_int_equal(setvbuf(stdout, NULL, _IONBF, BUFSIZ), 0);
assert_int_equal(setvbuf(stderr, NULL, _IONBF, BUFSIZ), 0); assert_int_equal(setvbuf(stderr, NULL, _IONBF, BUFSIZ), 0);

View File

@ -134,7 +134,7 @@ struct env_set *es;
/* Fill-in certs[] array */ /* Fill-in certs[] array */
void void
init_cert_data() init_cert_data(void)
{ {
struct test_cert certs_local[] = { struct test_cert certs_local[] = {
{cert1, key1, cname1, "OVPN TEST CA1", "OVPN Test Cert 1", {0}, NULL}, {cert1, key1, cname1, "OVPN TEST CA1", "OVPN Test Cert 1", {0}, NULL},

View File

@ -119,7 +119,7 @@ load_pubkey(const char *pem)
} }
static void static void
init_test() init_test(void)
{ {
openvpn_unit_test_setup(); openvpn_unit_test_setup();
prov[0] = OSSL_PROVIDER_load(NULL, "default"); prov[0] = OSSL_PROVIDER_load(NULL, "default");
@ -135,7 +135,7 @@ init_test()
} }
static void static void
uninit_test() uninit_test(void)
{ {
for (size_t i = 0; i < _countof(prov); i++) for (size_t i = 0; i < _countof(prov); i++)
{ {

View File

@ -81,7 +81,7 @@ const char *unittest_cert = "-----BEGIN CERTIFICATE-----\n"
"-----END CERTIFICATE-----\n"; "-----END CERTIFICATE-----\n";
static const char * static const char *
get_tmp_dir() get_tmp_dir(void)
{ {
const char *ret; const char *ret;
#ifdef _WIN32 #ifdef _WIN32

View File

@ -9,7 +9,7 @@
#include "utils.h" #include "utils.h"
static void static void
pass_any_null_param__returns_null() pass_any_null_param__returns_null(void **state)
{ {
char DUMMY[] = "DUMMY"; char DUMMY[] = "DUMMY";
@ -20,7 +20,7 @@ pass_any_null_param__returns_null()
} }
static void static void
pass_any_empty_string__returns_null() pass_any_empty_string__returns_null(void **state)
{ {
char DUMMY[] = "DUMMY"; char DUMMY[] = "DUMMY";
@ -32,7 +32,7 @@ pass_any_empty_string__returns_null()
} }
static void static void
replace_single_char__one_time__match_is_replaced() replace_single_char__one_time__match_is_replaced(void **state)
{ {
char *replaced = searchandreplace("X", "X", "Y"); char *replaced = searchandreplace("X", "X", "Y");
@ -43,7 +43,7 @@ replace_single_char__one_time__match_is_replaced()
} }
static void static void
replace_single_char__multiple_times__match_all_matches_are_replaced() replace_single_char__multiple_times__match_all_matches_are_replaced(void **state)
{ {
char *replaced = searchandreplace("XaX", "X", "Y"); char *replaced = searchandreplace("XaX", "X", "Y");
@ -54,7 +54,7 @@ replace_single_char__multiple_times__match_all_matches_are_replaced()
} }
static void static void
replace_longer_text__multiple_times__match_all_matches_are_replaced() replace_longer_text__multiple_times__match_all_matches_are_replaced(void **state)
{ {
char *replaced = searchandreplace("XXaXX", "XX", "YY"); char *replaced = searchandreplace("XXaXX", "XX", "YY");
@ -65,7 +65,7 @@ replace_longer_text__multiple_times__match_all_matches_are_replaced()
} }
static void static void
pattern_not_found__returns_original() pattern_not_found__returns_original(void **state)
{ {
char *replaced = searchandreplace("abc", "X", "Y"); char *replaced = searchandreplace("abc", "X", "Y");