The following commit has been merged in the openafs-stable-1_8_x branch:
commit d50ced2a17e05884ea18bb3dfcde6378b2531dc7
Author: Cheyenne Wills <[email protected]>
Date:   Thu Feb 17 18:27:02 2022 -0700

    cf: Avoid nested C functions built by autoconf
    
    Currently, two of the Linux-related autoconf macros try to compile code
    containing nested C functions (AC_CHECK_LINUX_OPERATION and
    LINUX_KMEM_CACHE_CREATE_CTOR_TAKES_VOID).  For example, the
    AC_CHECK_LINUX_OPERATION check for 'follow_link' generates this code
    where 'op' is a nested function inside 'conftest':
    
       #include <linux/module.h>
       #include <linux/fs.h>
       void conftest(void)
       {
           struct inode_operations ops;
           const char *op(struct dentry *dentry, void **link_date) {
               return (const char *)0;
           };
           ops.follow_link = op;
       }
    
    Nested functions are a gcc-specific feature, and are not supported by
    other compilers (e.g. clang), causing these checks to always fail when
    using clang, leading to incorrect configure results.
    
    To fix this, change AC_CHECK_LINUX_OPERATION and
    LINUX_KMEM_CACHE_CREATE_CTOR_TAKES_VOID macros to just define the
    relevant function as a proper top-level function.
    
    (these were discovered by forcing a clang build of both the Linux kernel
    and the openafs kernel module)
    
    Reviewed-on: https://gerrit.openafs.org/14901
    Tested-by: BuildBot <[email protected]>
    Reviewed-by: Andrew Deason <[email protected]>
    Reviewed-by: Michael Meffie <[email protected]>
    Reviewed-by: Benjamin Kaduk <[email protected]>
    (cherry picked from commit a4878a5e26b9997e40a3b197cea5f8c3b24f2539)
    
    Change-Id: Ie186658167a3f9e162fe85722aa0792cbe4fcfda
    Reviewed-on: https://gerrit.openafs.org/15540
    Tested-by: BuildBot <[email protected]>
    Reviewed-by: Marcio Brito Barbosa <[email protected]>
    Reviewed-by: Stephan Wiesand <[email protected]>

 src/cf/linux-test1.m4 | 5 ++++-
 src/cf/linux-test4.m4 | 5 +++--
 2 files changed, 7 insertions(+), 3 deletions(-)

-- 
OpenAFS Master Repository
_______________________________________________
OpenAFS-cvs mailing list
[email protected]
https://lists.openafs.org/mailman/listinfo/openafs-cvs

Reply via email to