119 lines
4.7 KiB
Diff
119 lines
4.7 KiB
Diff
|
From 449d1faf87e2841e80be38cf2b4a5cf5ff4df2d8 Mon Sep 17 00:00:00 2001
|
|||
|
From: Cheyenne Wills <cwills@sinenomine.net>
|
|||
|
Date: Fri, 28 Jan 2022 14:10:46 -0700
|
|||
|
Subject: [PATCH] Linux-5.17: Kernel build uses -Wcast-function-type
|
|||
|
|
|||
|
The linux 5.17 commit:
|
|||
|
"Makefile: Enable -Wcast-function-type" (552a23a0)
|
|||
|
added the -Wcast-function-type compiler flag for kernel module builds.
|
|||
|
|
|||
|
This change catches a type mismatch in the external files obtained from
|
|||
|
heimdal: hcrypto/evp.c and hcrypto/evp-algs.c and produces the following
|
|||
|
type of compile time error messages.
|
|||
|
|
|||
|
src/libafs/MODLOAD-.../evp.c: In function ‘hc_EVP_md_null’:
|
|||
|
src/libafs/MODLOAD-.../evp.c:501:2: error: cast between incompatible
|
|||
|
function types from ‘void (*)(void *)’ to ‘int (*)(EVP_MD_CTX *)’
|
|||
|
{aka ‘int (*)(struct hc_EVP_MD_CTX *)’}
|
|||
|
[-Werror=cast-function-type]
|
|||
|
501 | (hc_evp_md_init)null_Init,
|
|||
|
| ^
|
|||
|
|
|||
|
Use AX_APPEND_COMPILE_FLAGS to create a CFLAGS_NOCAST_FUNCTION_TYPE
|
|||
|
macro to disable this warning and update the CFLAGS for these 2 files
|
|||
|
for the Linux libafs build.
|
|||
|
|
|||
|
Update the CODING documentation to add the new exceptions. In addition
|
|||
|
add a brief description on how to set up autoconf to add a new build
|
|||
|
macro to suppress compiler warnings.
|
|||
|
|
|||
|
Note: upstream heimdal has committed a fix for this in:
|
|||
|
|
|||
|
hcrypto: Fix return type for null_Init, null_Update and null_Final
|
|||
|
(fc4b3ce49b)
|
|||
|
|
|||
|
Reviewed-on: https://gerrit.openafs.org/14881
|
|||
|
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
|
|||
|
Tested-by: BuildBot <buildbot@rampaginggeek.com>
|
|||
|
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
|
|||
|
(cherry picked from commit 6bdfa976731ce07f3236893ecf12abb9e169b882)
|
|||
|
|
|||
|
Change-Id: Ibd354f663d5876c421a8b4e89b8943c9e3d59ebc
|
|||
|
---
|
|||
|
|
|||
|
diff --git a/CODING b/CODING
|
|||
|
index 5d62dbb..c266979 100644
|
|||
|
--- a/CODING
|
|||
|
+++ b/CODING
|
|||
|
@@ -265,7 +265,13 @@
|
|||
|
# endif
|
|||
|
#endif
|
|||
|
|
|||
|
-If a pragma isn't available for your particular warning, you will need to
|
|||
|
+If the source cannot be changed to add a pragma, you might be abe to use the
|
|||
|
+autoconf function AX_APPEND_COMPILE_FLAGS to create a new macro that disables
|
|||
|
+the warning and then use macro for the build options for that file. For an
|
|||
|
+example, see how the autoconf macro CFLAGS_NOIMPLICIT_FALLTHROUGH is defined and
|
|||
|
+used.
|
|||
|
+
|
|||
|
+Finally if there isn't a way to disable the specific warning, you will need to
|
|||
|
disable all warnings for the file in question. You can do this by supplying
|
|||
|
the autoconf macro @CFLAGS_NOERROR@ in the build options for the file. For
|
|||
|
example:
|
|||
|
@@ -288,6 +294,10 @@
|
|||
|
: signed vs unsigned for dates
|
|||
|
butc/tcudbprocs.c : all : ubik_Call
|
|||
|
external/heimdal/hcrypto/validate.c: all: statement with empty body
|
|||
|
+external/heimdal/hcrypto/evp.c: cast-function-type
|
|||
|
+ : Linux kernel build uses -Wcast-function-type
|
|||
|
+external/heimdal/hcrypto/evp-algs.c: cast-function-type
|
|||
|
+ : Linux kernel build uses -Wcast-function-type
|
|||
|
kauth/admin_tools.c : strict-proto : ubik_Call
|
|||
|
kauth/authclient.c : strict-proto : ubik_Call nonsense
|
|||
|
libadmin/kas/afs_kasAdmin.c: strict-proto : ubik_Call nonsense
|
|||
|
diff --git a/src/cf/osconf.m4 b/src/cf/osconf.m4
|
|||
|
index 1e1b080..11f3eea 100644
|
|||
|
--- a/src/cf/osconf.m4
|
|||
|
+++ b/src/cf/osconf.m4
|
|||
|
@@ -665,6 +665,7 @@
|
|||
|
CFLAGS_NOSTRICT=-fno-strict-aliasing
|
|||
|
CFLAGS_NOUNUSED=
|
|||
|
CFLAGS_NOOLDSTYLE=
|
|||
|
+CFLAGS_NOCAST_FUNCTION_TYPE=
|
|||
|
XCFLAGS_NOCHECKING="$XCFLAGS"
|
|||
|
|
|||
|
if test "x$GCC" = "xyes"; then
|
|||
|
@@ -677,6 +678,8 @@
|
|||
|
CFLAGS_NOERROR="-Wno-error"
|
|||
|
CFLAGS_NOUNUSED="-Wno-unused"
|
|||
|
CFLAGS_NOOLDSTYLE="-Wno-old-style-definition"
|
|||
|
+ AX_APPEND_COMPILE_FLAGS([-Wno-cast-function-type],
|
|||
|
+ [CFLAGS_NOCAST_FUNCTION_TYPE])
|
|||
|
AC_DEFINE(IGNORE_SOME_GCC_WARNINGS, 1, [define to disable some gcc warnings in warnings-as-errors mode])
|
|||
|
else
|
|||
|
CFLAGS_NOSTRICT=
|
|||
|
@@ -753,6 +756,7 @@
|
|||
|
AC_SUBST(CFLAGS_NOSTRICT)
|
|||
|
AC_SUBST(CFLAGS_NOUNUSED)
|
|||
|
AC_SUBST(CFLAGS_NOOLDSTYLE)
|
|||
|
+AC_SUBST(CFLAGS_NOCAST_FUNCTION_TYPE)
|
|||
|
AC_SUBST(XCFLAGS64)
|
|||
|
AC_SUBST(XLDFLAGS)
|
|||
|
AC_SUBST(XLDFLAGS64)
|
|||
|
diff --git a/src/libafs/MakefileProto.LINUX.in b/src/libafs/MakefileProto.LINUX.in
|
|||
|
index d98fa05..8e98afd 100644
|
|||
|
--- a/src/libafs/MakefileProto.LINUX.in
|
|||
|
+++ b/src/libafs/MakefileProto.LINUX.in
|
|||
|
@@ -79,8 +79,9 @@
|
|||
|
CFLAGS_opr_rbtree.o = -I${TOP_SRCDIR}/opr
|
|||
|
|
|||
|
CFLAGS_evp.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto \
|
|||
|
- -DHAVE_CONFIG_H
|
|||
|
-CFLAGS_evp-algs.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
|
|||
|
+ -DHAVE_CONFIG_H @CFLAGS_NOCAST_FUNCTION_TYPE@
|
|||
|
+CFLAGS_evp-algs.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto \
|
|||
|
+ @CFLAGS_NOCAST_FUNCTION_TYPE@
|
|||
|
CFLAGS_evp-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
|
|||
|
CFLAGS_rand-timer-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
|
|||
|
CFLAGS_rand-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
|