[llvm-bugs] [Bug 38881] New: Clang warning extending into system headers (-Werror, -Wsign-compare)
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Sep 9 16:47:23 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38881
Bug ID: 38881
Summary: Clang warning extending into system headers
(-Werror,-Wsign-compare)
Product: clang
Version: 7.0
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: raj.khem at gmail.com
CC: llvm-bugs at lists.llvm.org
Attached example when compiled with clang for linux/musl systems emits a
warnings in system headers
Testcase
=============================
#define _GNU_SOURCE
#include <sys/socket.h>
int foo(struct cmsghdr *header, struct msghdr msg) {
header = CMSG_NXTHDR(&msg, header);
return 0;
}
=============================
error:
../../../../../../../workspace/sources/libkcapi/lib/kcapi-kernel-if.c:25:11:
error: comparison of integers of different signs: 'unsigned long' and 'long'
[-Werror,-Wsign-compare]
header = CMSG_NXTHDR(&msg, header);
^~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/a/oe/build/tmp/work/core2-64-bec-linux-musl/libkcapi/1.1.3+git999-r0/recipe-sysroot/usr/include/sys/socket.h:299:44:
note: expanded from macro 'CMSG_NXTHDR'
__CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) -
(unsigned char *)(cmsg) \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
=============================
cmdline:
x86_64-bec-linux-musl-clang
--sysroot=/mnt/a/oe/build/tmp/work/core2-64-bec-linux-musl/libkcapi/1.1.3+git999-r0/recipe-sysroot
-c lib/kcapi-kernel-if.c -O -Werror -Wextra
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180909/337a4bfc/attachment.html>
More information about the llvm-bugs
mailing list