Re: [PATCH] autofs-5.1.9 - cast sasl_callback_t function pointers

David Disseldorp <[email protected]>
Newsgroups org.kernel.vger.autofs
Message-ID <20240417002716.5f7fb670@echidna>
Hi,

On Thu, 21 Mar 2024 12:39:47 +1100, David Disseldorp wrote:

> GCC 14+ uses -Werror=incompatible-pointer-types by default.
> sasl.h:sasl_callback_t doesn't offer a type-safe mechanism for setting
> @proc callback functions, so a cast is necessary.
> 
> Signed-off-by: David Disseldorp <[email protected]>
> ---
>  modules/cyrus-sasl.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/modules/cyrus-sasl.c b/modules/cyrus-sasl.c
> index e742eaf..107e182 100644
> --- a/modules/cyrus-sasl.c
> +++ b/modules/cyrus-sasl.c
> @@ -109,17 +109,17 @@ static int getpass_func(sasl_conn_t *, void *, int, sasl_secret_t **);
>  static int getuser_func(void *, int, const char **, unsigned *);
>  
>  static sasl_callback_t callbacks[] = {
> -	{ SASL_CB_USER, &getuser_func, NULL },
> -	{ SASL_CB_AUTHNAME, &getuser_func, NULL },
> -	{ SASL_CB_PASS, &getpass_func, NULL },
> +	{ SASL_CB_USER, (int (*)(void))&getuser_func, NULL },
> +	{ SASL_CB_AUTHNAME, (int (*)(void))&getuser_func, NULL },
> +	{ SASL_CB_PASS, (int (*)(void))&getpass_func, NULL },
>  	{ SASL_CB_LIST_END, NULL, NULL },
>  };
>  
>  static sasl_callback_t debug_callbacks[] = {
> -	{ SASL_CB_LOG, &sasl_log_func, NULL },
> -	{ SASL_CB_USER, &getuser_func, NULL },
> -	{ SASL_CB_AUTHNAME, &getuser_func, NULL },
> -	{ SASL_CB_PASS, &getpass_func, NULL },
> +	{ SASL_CB_LOG, (int (*)(void))&sasl_log_func, NULL },
> +	{ SASL_CB_USER, (int (*)(void))&getuser_func, NULL },
> +	{ SASL_CB_AUTHNAME, (int (*)(void))&getuser_func, NULL },
> +	{ SASL_CB_PASS, (int (*)(void))&getpass_func, NULL },
>  	{ SASL_CB_LIST_END, NULL, NULL },
>  };
>  

Does anyone have feedback on this proposed change?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.