diff --git a/clients/upsclient.c b/clients/upsclient.c index 22604a9ada..74290cd26f 100644 --- a/clients/upsclient.c +++ b/clients/upsclient.c @@ -909,6 +909,10 @@ static int upscli_sslinit(UPSCONN_t *ups, int verifycert) return -1; } +#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_FUNCTION_TYPE_STRICT) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-function-type-strict" +#endif if (verifycert) { status = SSL_AuthCertificateHook(ups->ssl, (SSLAuthCertificate)AuthCertificate, CERT_GetDefaultCertDB()); @@ -938,6 +942,9 @@ static int upscli_sslinit(UPSCONN_t *ups, int verifycert) nss_error("upscli_sslinit / SSL_HandshakeCallback"); return -1; } +#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_FUNCTION_TYPE_STRICT) +#pragma GCC diagnostic pop +#endif cert = upscli_find_host_cert(ups->host); if (cert != NULL && cert->certname != NULL) { diff --git a/m4/ax_c_pragmas.m4 b/m4/ax_c_pragmas.m4 index 14ecd596d3..070d82beee 100644 --- a/m4/ax_c_pragmas.m4 +++ b/m4/ax_c_pragmas.m4 @@ -674,6 +674,33 @@ dnl ### [CFLAGS="${CFLAGS_SAVED} -Werror=pragmas -Werror=unknown-warning" AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wcast-align" (outside functions)]) ]) + AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wcast-function-type-strict"], + [ax_cv__pragma__gcc__diags_ignored_cast_function_type_strict], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[void func(void) { +#pragma GCC diagnostic ignored "-Wcast-function-type-strict" +} +]], [])], + [ax_cv__pragma__gcc__diags_ignored_cast_function_type_strict=yes], + [ax_cv__pragma__gcc__diags_ignored_cast_function_type_strict=no] + )] + ) + AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cast_function_type_strict" = "yes"],[ + AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_FUNCTION_TYPE_STRICT], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wcast-function-type-strict"]) + ]) + + AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wcast-function-type-strict" (outside functions)], + [ax_cv__pragma__gcc__diags_ignored_cast_function_type_strict_besidefunc], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wcast-function-type-strict"]], [])], + [ax_cv__pragma__gcc__diags_ignored_cast_function_type_strict_besidefunc=yes], + [ax_cv__pragma__gcc__diags_ignored_cast_function_type_strict_besidefunc=no] + )] + ) + AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cast_function_type_strict_besidefunc" = "yes"],[ + AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_FUNCTION_TYPE_STRICT_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wcast-function-type-strict" (outside functions)]) + ]) + AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wstrict-prototypes"], [ax_cv__pragma__gcc__diags_ignored_strict_prototypes], [AC_COMPILE_IFELSE( diff --git a/server/netssl.c b/server/netssl.c index 7557f26624..79c5d3175f 100644 --- a/server/netssl.c +++ b/server/netssl.c @@ -356,6 +356,10 @@ void net_starttls(nut_ctype_t *client, size_t numarg, const char **arg) return; } +#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_FUNCTION_TYPE_STRICT) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-function-type-strict" +#endif /* Note cast to SSLAuthCertificate to prevent warning due to * bad function prototype in NSS. */ @@ -386,6 +390,9 @@ void net_starttls(nut_ctype_t *client, size_t numarg, const char **arg) nss_error("net_starttls / SSL_ConfigSecureServer"); return; } +#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_FUNCTION_TYPE_STRICT) +#pragma GCC diagnostic pop +#endif status = SSL_ResetHandshake(client->ssl, PR_TRUE); if (status != SECSuccess) {