]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/cgo: make sure nil is undefined before defining it
authorElias Naur <elias.naur@gmail.com>
Wed, 7 Mar 2018 17:23:21 +0000 (18:23 +0100)
committerElias Naur <elias.naur@gmail.com>
Wed, 7 Mar 2018 21:08:19 +0000 (21:08 +0000)
While working on standalone builds of gomobile bindings, I ran into
errors on the form:

gcc_darwin_arm.c:30:31: error: ambiguous expansion of macro 'nil' [-Werror,-Wambiguous-macro]
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk/usr/include/MacTypes.h:94:15: note: expanding this definition of 'nil'

Fix it by undefining nil before defining it in libcgo.h.

Change-Id: I8e9660a68c6c351e592684d03d529f0d182c0493
Reviewed-on: https://go-review.googlesource.com/99215
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/cgo/gcc_darwin_arm.c
src/runtime/cgo/gcc_darwin_arm64.c
src/runtime/cgo/libcgo.h

index e2f96e9dc8960675a30625bfc6592c1fe6e702e3..30fca9902a7f0971daf86f974a76f7b0fad0b1c3 100644 (file)
@@ -9,12 +9,12 @@
 #include <sys/param.h>
 #include <unistd.h>
 
-#include "libcgo.h"
-#include "libcgo_unix.h"
-
 #include <CoreFoundation/CFBundle.h>
 #include <CoreFoundation/CFString.h>
 
+#include "libcgo.h"
+#include "libcgo_unix.h"
+
 #define magic (0xe696c4f4U)
 
 // inittls allocates a thread-local storage slot for g.
index 25106b75a55d43e573f21f348e870a19a2eca5b9..5c483b1845c3ef7aa172f1db1877e57b6f1f38fb 100644 (file)
 #include <unistd.h>
 #include <stdlib.h>
 
-#include "libcgo.h"
-#include "libcgo_unix.h"
-
 #include <CoreFoundation/CFBundle.h>
 #include <CoreFoundation/CFString.h>
 
+#include "libcgo.h"
+#include "libcgo_unix.h"
+
 #define magic (0xc476c475c47957UL)
 
 // inittls allocates a thread-local storage slot for g.
index 2b8b4e25a29a94e393aa4201b5c4dc608378d812..c38fb643ff7d5e36254cd2f0646d7d675a8501be 100644 (file)
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 
+#undef nil
 #define nil ((void*)0)
 #define nelem(x) (sizeof(x)/sizeof((x)[0]))