1From ab8dcad25d0ac1f3a88814e78794e5d450de15ac Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 14 Sep 2017 23:12:51 -0700
4Subject: [PATCH 1/5] Turn off sign-compare for musl-libc
5
6Fix
7
8../../../../../../../workspace/sources/breakpad/src/client/linux/crash_generation/crash_generation_server.cc:234:14: error:                 comparison of integers of different signs: 'unsigned long' and 'int' [-Werror,-Wsign-compare]                                          hdr = CMSG_NXTHDR(&msg, hdr)) {                                                                                                             ^~~~~~~~~~~~~~~~~~~~~~
9/mnt/a/oe/build/tmp/work/cortexa7hf-neon-vfpv4-bec-linux-musleabi/breakpad/1_1.0+git999-r0/recipe-sysroot/usr/include/sys/socket.h:288:44: note:                                                                                                                                  expanded from macro 'CMSG_NXTHDR'                                                                                                       __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                       1 error generated.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 src/client/linux/crash_generation/crash_generation_server.cc | 10 ++++++++++
14 1 file changed, 10 insertions(+)
15
16--- a/src/client/linux/crash_generation/crash_generation_server.cc
17+++ b/src/client/linux/crash_generation/crash_generation_server.cc
18@@ -230,8 +230,18 @@ CrashGenerationServer::ClientEvent(short
19   // Walk the control payload and extract the file descriptor and validated pid.
20   pid_t crashing_pid = -1;
21   int signal_fd = -1;
22+#ifndef __GLIBC__
23+  // In musl-libc, CMSG_NXTHDR typecasts char* to cmsghdr* which causes
24+  // clang to throw sign-compare warning. This is to suppress the warning
25+  // inline.
26+  #pragma clang diagnostic push
27+  #pragma clang diagnostic ignored "-Wsign-compare"
28+#endif
29   for (struct cmsghdr* hdr = CMSG_FIRSTHDR(&msg); hdr;
30        hdr = CMSG_NXTHDR(&msg, hdr)) {
31+#ifndef __GLIBC__
32+  #pragma clang diagnostic pop
33+#endif
34     if (hdr->cmsg_level != SOL_SOCKET)
35       continue;
36     if (hdr->cmsg_type == SCM_RIGHTS) {
37