mirror of
https://github.com/golang/go
synced 2024-11-15 08:20:30 -07:00
265ff83af6
««« CL 15070043 / 90a628ac54ed cmd/cgo: stop using compiler error message text to analyze C names The old approach to determining whether "name" was a type, constant, or expression was to compile the C program name; and scan the errors and warnings generated by the compiler. This requires looking for specific substrings in the errors and warnings, which ties the implementation to specific compiler versions. As compilers change their errors or drop warnings, cgo breaks. This happens slowly but it does happen. Clang in particular (now required on OS X) has a significant churn rate. The new approach compiles a slightly more complex program that is either valid C or not valid C depending on what kind of thing "name" is. It uses only the presence or absence of an error message on a particular line, not the error text itself. The program is: // error if and only if name is undeclared void f1(void) { typeof(name) *x; } // error if and only if name is not a type void f2(void) { name *x; } // error if and only if name is not an integer constant void f3(void) { enum { x = (name)*1 }; } I had not been planning to do this until Go 1.3, because it is a non-trivial change, but it fixes a real Xcode 5 problem in Go 1.2, and the new code is easier to understand than the old code. It should be significantly more robust. Fixes #6596. Fixes #6612. R=golang-dev, r, james, iant CC=golang-dev https://golang.org/cl/15070043 »»» R=golang-dev CC=golang-dev https://golang.org/cl/20060044 |
||
---|---|---|
.. | ||
backdoor | ||
align.go | ||
api.go | ||
basic.go | ||
callback_c_gc.c | ||
callback_c_gccgo.c | ||
callback_c.c | ||
callback.go | ||
cflags.go | ||
cgo_linux_test.go | ||
cgo_test.go | ||
cthread_unix.c | ||
cthread_windows.c | ||
cthread.go | ||
duplicate_symbol.go | ||
env.go | ||
exports.go | ||
fpvar.go | ||
helpers.go | ||
issue1222.go | ||
issue1328.go | ||
issue1560.go | ||
issue1635.go | ||
issue2462.go | ||
issue3250.go | ||
issue3250w.go | ||
issue3261.go | ||
issue3729.go | ||
issue3729w.go | ||
issue3741.go | ||
issue3775.go | ||
issue3945.go | ||
issue4029.go | ||
issue4029w.go | ||
issue4054a.go | ||
issue4054b.go | ||
issue4273.c | ||
issue4273b.c | ||
issue4339.c | ||
issue4339.go | ||
issue4339.h | ||
issue4417.go | ||
issue4857.go | ||
issue5227.go | ||
issue5337.go | ||
issue5337w.go | ||
issue5548_c.c | ||
issue5548.go | ||
issue5603.go | ||
issue5740.go | ||
issue5740a.c | ||
issue5740b.c | ||
issue5986.go | ||
issue6128.go | ||
issue6390.go | ||
issue6472.go | ||
issue6506.go | ||
issue6612.go | ||
setgid_linux.go | ||
sleep_windows_386.go |