mirror of git://sourceware.org/git/glibc.git
sunrpc: Suppress clang -Wgnu-variable-sized-type-not-at-end warning on struct cmessage
clang issues:
svc_unix.c:318:18: error: field 'cmsg' with variable sized type 'struct cmsghdr' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
318 | struct cmsghdr cmsg;
| ^
The __msgread explicitly expects that 'struct ucred' is after the 'cmsg',
so suppress the warning.
Reviewed-by: Sam James <sam@gentoo.org>
This commit is contained in:
parent
c6278687d9
commit
6eb1d9a9ed
|
|
@ -65,6 +65,7 @@
|
|||
#include <libintl.h>
|
||||
#include <wchar.h>
|
||||
#include <shlib-compat.h>
|
||||
#include <libc-diag.h>
|
||||
|
||||
/*
|
||||
* Ops vector for AF_UNIX based rpc service handle
|
||||
|
|
@ -308,12 +309,18 @@ svcunix_destroy (SVCXPRT *xprt)
|
|||
}
|
||||
|
||||
#ifdef SCM_CREDENTIALS
|
||||
/* clang complains if a flexible array member (struct cmsghdr) is not a the
|
||||
end of the struct (it is a GNU extension). The __msgread explicitly
|
||||
expects that 'struct ucred' is after the 'cmsg', so disable the warning. */
|
||||
DIAG_PUSH_NEEDS_COMMENT_CLANG;
|
||||
DIAG_IGNORE_NEEDS_COMMENT_CLANG (18, "-Wgnu-variable-sized-type-not-at-end");
|
||||
struct cmessage {
|
||||
struct cmsghdr cmsg;
|
||||
struct ucred cmcred;
|
||||
/* hack to make sure we have enough memory */
|
||||
char dummy[(CMSG_ALIGN (sizeof (struct ucred)) - sizeof (struct ucred) + sizeof (long))];
|
||||
};
|
||||
DIAG_POP_NEEDS_COMMENT_CLANG;
|
||||
|
||||
/* XXX This is not thread safe, but since the main functions in svc.c
|
||||
and the rpcgen generated *_svc functions for the daemon are also not
|
||||
|
|
|
|||
Loading…
Reference in New Issue