sahib / rmlint

Extremely fast tool to remove duplicates and other lint from your filesystem
http://rmlint.rtfd.org
GNU General Public License v3.0
1.85k stars 128 forks source link

scons: check *xattr functions with correct arguments #668

Open bdrung opened 1 month ago

bdrung commented 1 month ago

SCons.Conftest.CheckFunc(context, "lgetxattr", "#include <sys/types.h>\n#include <sys/xattr.h>") will generate following C code:

#include <assert.h>
#include <sys/types.h>
#include <sys/xattr.h>

#if _MSC_VER && !__INTEL_COMPILER
    #pragma function(lgetxattr)
#endif

int main(void) {
#if defined (__stub_lgetxattr) || defined (__stub___lgetxattr)
   #error "lgetxattr has a GNU stub, cannot check"
#else
   lgetxattr();
#endif

     return 0;
}

This code snippet will fail to compile on armhf on Ubuntu 24.04 (noble):

$ gcc -o test test.c
test.c: In function ‘main’:
test.c:13:11: error: too few arguments to function ‘lgetxattr’
   13 | lgetxattr();
      | ^~~~~~~~~
In file included from test2.c:3:
/usr/include/arm-linux-gnueabihf/sys/xattr.h:67:16: note: declared here
   67 | extern ssize_t lgetxattr (const char *__path, const char *__name,
      | ^~~~~~~~~

So pass valid arguments to the *xttr functions.

Note: The funcargs parameter requires SCons >= 4.7.0!

Bug-Ubuntu: https://launchpad.net/bugs/2066970