Commit 7a2a96d6 authored by Elias Naur's avatar Elias Naur

runtime/cgo: make sure nil is undefined before defining it

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: default avatarIan Lance Taylor <iant@golang.org>
parent 709da955
......@@ -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.
......
......@@ -10,12 +10,12 @@
#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.
......
......@@ -6,6 +6,7 @@
#include <stdlib.h>
#include <stdio.h>
#undef nil
#define nil ((void*)0)
#define nelem(x) (sizeof(x)/sizeof((x)[0]))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment