Skip to content

Instantly share code, notes, and snippets.

@tpoechtrager
Created December 25, 2014 09:16
Show Gist options
  • Save tpoechtrager/45caa2e6cf4294ef0a1c to your computer and use it in GitHub Desktop.
Save tpoechtrager/45caa2e6cf4294ef0a1c to your computer and use it in GitHub Desktop.
diff --git a/cctools/include/foreign/i386/_types.h b/cctools/include/foreign/i386/_types.h
index 601b196..8bffd6f 100644
--- a/cctools/include/foreign/i386/_types.h
+++ b/cctools/include/foreign/i386/_types.h
@@ -33,6 +33,15 @@
* flotaing point and other arithmetic types, as needed, later.
*/
+/*
+ * Silence old glibc -Wtypedef-redefinition warnings.
+ * https://github.com/tpoechtrager/cctools-port/pull/8
+ */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wtypedef-redefinition"
+#endif
+
#ifdef __GNUC__
typedef __signed char __int8_t;
#else /* !__GNUC__ */
@@ -121,4 +130,8 @@ typedef __uint32_t __darwin_socklen_t; /* socklen_t (duh) */
typedef long __darwin_ssize_t; /* byte count or error */
typedef long __darwin_time_t; /* time() */
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
#endif /* _BSD_I386__TYPES_H_ */
diff --git a/cctools/ld64/src/3rd/strlcat.c b/cctools/ld64/src/3rd/strlcat.c
index ef1a10a..faf09e3 100644
--- a/cctools/ld64/src/3rd/strlcat.c
+++ b/cctools/ld64/src/3rd/strlcat.c
@@ -23,6 +23,14 @@
#ifndef __APPLE__
+/*
+ * Otherwise string.h may hide strnlen().
+ * https://github.com/tpoechtrager/cctools-port/pull/8
+ */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
#include <string.h>
size_t
diff --git a/cctools/otool/ofile_print.c b/cctools/otool/ofile_print.c
index 3eb6506..4e9493a 100644
--- a/cctools/otool/ofile_print.c
+++ b/cctools/otool/ofile_print.c
@@ -201,6 +201,14 @@
#define __dr6 dr6
#define __dr7 dr7
+/*
+ * Otherwise string.h may hide strnlen().
+ * https://github.com/tpoechtrager/cctools-port/pull/8
+ */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment