cf: Resolve implicit function definition for memset

The autoconf function OPENAFS_HAVE_STRUCT_FIELD can produce a compiler
warning for an implicit function definition for memset, however with
macOS 11 (Big Sur) the default compiler flags have been changed
(-Werror=implicit-function-declaration) so that this is now flagged as an
error. As an error this can lead to an incorrect result returned by
OPENAFS_HAVE_STRUCT_FIELD.

Add an include for <string.h> to provide the necessary definition for
memset.

Note, both gcc and clang can produce the implicit function definition
warning.

Change-Id: I05ea43e1712c0450b7d1a78d4e953bfad9be28b9
Reviewed-on: https://gerrit.openafs.org/14631
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Cheyenne Wills 2021-06-04 10:18:39 -06:00 committed by Benjamin Kaduk
parent b60754ed1c
commit fd5aa52ef8

View File

@ -4,7 +4,9 @@ dnl should be shipping AC_ macros.
AC_DEFUN([OPENAFS_HAVE_STRUCT_FIELD], [
define(cache_val, translit(ac_cv_type_$1_$2, [A-Z ], [a-z_]))
AC_CACHE_CHECK([for $2 in $1], cache_val,[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$3]],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
$3
#include <string.h>]],
[[$1 x; memset(&x, 0, sizeof(x)); x.$2]])],
[cache_val=yes],
[cache_val=no])