Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/cgo: incompatible with Xcode 4.6.3 (?) #6128

Closed
quarnster opened this issue Aug 13, 2013 · 22 comments

Comments

@quarnster
Copy link

commented Aug 13, 2013

What steps will reproduce the problem?

It doesn't happen with all cgo code, but one instance where it does happen is the
attached broken.go.

What is the expected output?
Nothing out of the ordinary, just a normal compilation.

What do you see instead?

"gcc produced no output" and the build errors out. Looking at
https://code.google.com/p/go/source/browse/src/cmd/cgo/gcc.go#311 I can see that this
results in a "fatal" when there is no stderr output as a result of running the
cgo command. Is it really fatal?

The attached log.txt contains the output of "go tool cgo -debug-gcc broken.go
&> log.txt".

Building with "CC=gcc go build" works just fine.


Which compiler are you using (5g, 6g, 8g, gccgo)?

6g

Which operating system are you using?

OS X 10.8.3

Which version are you using?  (run 'go version')

go version devel +897a42d03643 Tue Aug 13 15:08:10 2013 +1000 darwin/amd64

Attachments:

  1. log.txt (380184 bytes)
  2. broken.go (92 bytes)
@robpike

This comment has been minimized.

Copy link
Contributor

commented Aug 14, 2013

Comment 1:

Labels changed: added priority-soon, cgo, removed priority-triage.

Status changed to Accepted.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Sep 4, 2013

Comment 3:

Issue #6133 has been merged into this issue.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Sep 4, 2013

Comment 4:

Labels changed: added go1.2, removed go1.2maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Sep 10, 2013

Comment 5:

What does 'clang --version' print?
Please create a file x.c containing:
/* Define intgo when compiling with GCC.  */
#ifdef __PTRDIFF_TYPE__
typedef __PTRDIFF_TYPE__ intgo;
#elif defined(_LP64)
typedef long long intgo;
#else
typedef int intgo;
#endif
typedef struct { char *p; intgo n; } _GoString_;
typedef struct { char *p; intgo n; intgo c; } _GoBytes_;
_GoString_ GoString(char *p);
_GoString_ GoStringN(char *p, int l);
_GoBytes_ GoBytes(void *p, int n);
char *CString(_GoString_);
#line 3 "broken.go"
#include <GL/glew.h>
void __cgo__f__(void) {
#line 1 "cgo-test"
GL_TEXTURE_2D; /* #0 */
enum { _cgo_enum_0 = GL_TEXTURE_2D }; /* #0 */
}
and then run
clang -Wall -Werror -ox.o -gdwarf-2 \
    -fno-eliminate-unused-debug-types -c -xc \
    -ferror-limit=0 -Wno-unknown-warning-option \
    -Wno-unneeded-internal-declaration \
    -Wno-unused-function \
    -Qunused-arguments -m64 - \
    -Wsystem-headers <x.c
Does it really print nothing?
On my system I get:
cgo-test:1:1: error: expression result unused [-Werror,-Wunused-value]
GL_TEXTURE_2D; /* #0 */
^~~~~~~~~~~~~
...
Thanks.
@gopherbot

This comment has been minimized.

Copy link

commented Sep 10, 2013

Comment 6 by samuel.stauffer:

I didn't file the initial issue, but I can confirm the lack of output from the above
using clang from Xcode5-DP6 and GLEW 1.10.0 on OS X.. been having the same issue with
cgo on Xcode5/clang so I'm eager to see a fix for this.
using x.c from above comment :
$ clang -Wall -Werror -ox.o -gdwarf-2 \
> -fno-eliminate-unused-debug-types -c -xc \
> -ferror-limit=0 -Wno-unknown-warning-option \
> -Wno-unneeded-internal-declaration \
> -Wno-unused-function \
> -Qunused-arguments -m64 - \
> -Wsystem-headers <x.c
$ clang --version
clang version 3.3 (tags/RELEASE_33/final)
Target: x86_64-apple-darwin12.4.0
Thread model: posix
$ xcodebuild -version
Xcode 5.0
Build version 5A11386k
@quarnster

This comment has been minimized.

Copy link
Author

commented Sep 11, 2013

Comment 7:

> Does it really print nothing?
Yep, nothing.
10:17 /tmp $ clang -Wall -Werror -ox.o -gdwarf-2 \
>         -fno-eliminate-unused-debug-types -c -xc \
>         -ferror-limit=0 -Wno-unknown-warning-option \
>         -Wno-unneeded-internal-declaration \
>         -Wno-unused-function \
>         -Qunused-arguments -m64 - \
>         -Wsystem-headers <x.c
10:17 /tmp $ clang --version
clang version 3.2 (tags/RELEASE_32/final)
Target: x86_64-apple-darwin12.3.0
Thread model: posix
10:17 /tmp $ xcodebuild -version
Xcode 4.6.3
Build version 4H1503
@rsc

This comment has been minimized.

Copy link
Contributor

commented Sep 11, 2013

Comment 8:

$ clang --version
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.4.0
Thread model: posix
$ xcodebuild -version
Xcode 4.5.2
Build version 4G2008a
$ 
That's my system, which is working. I'm a little surprised that your clang --version
does not say "Apple clang", just "clang". Are you sure you are using the Xcode clang and
not a different clang that you built or obtained some other way?
I will try to find an Xcode 4.6.3 to make sure.
@quarnster

This comment has been minimized.

Copy link
Author

commented Sep 11, 2013

Comment 9:

>  I'm a little surprised that your clang --version does not say "Apple clang", just
"clang". Are you sure you are using the Xcode clang and not a different clang that you
built or obtained some other way?
Apparently I did have another clang taking precedence in the path, using Apple's clang
appears to change nothing though.
Version of that is:
$ clang --version
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.3.0
Thread model: posix
@rsc

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2013

Comment 10:

I updated to Xcode 4.6.3 and then installed the command line tools from within Xcode
> Preferences. Now my clang version matches yours. And yet the behavior does not. I
have no GL headers so I have replaced the #include with #define GL_TEXTURE_2D 0x0DE1,
which should have the same effect. Can you try this simplified case?
g% clang --version
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
g% cat x.c
/* Define intgo when compiling with GCC.  */
#ifdef __PTRDIFF_TYPE__
typedef __PTRDIFF_TYPE__ intgo;
#elif defined(_LP64)
typedef long long intgo;
#else
typedef int intgo;
#endif
typedef struct { char *p; intgo n; } _GoString_;
typedef struct { char *p; intgo n; intgo c; } _GoBytes_;
_GoString_ GoString(char *p);
_GoString_ GoStringN(char *p, int l);
_GoBytes_ GoBytes(void *p, int n);
char *CString(_GoString_);
#line 3 "broken.go"
#define GL_TEXTURE_2D 0x0DE1
void __cgo__f__(void) {
#line 1 "cgo-test"
GL_TEXTURE_2D; /* #0 */
enum { _cgo_enum_0 = GL_TEXTURE_2D }; /* #0 */
}
g% clang -Wall -Werror -ox.o -gdwarf-2 \
    -fno-eliminate-unused-debug-types -c -xc \
    -ferror-limit=0 -Wno-unknown-warning-option \
    -Wno-unneeded-internal-declaration \
    -Wno-unused-function \
    -Qunused-arguments -m64 - \
    -Wsystem-headers <x.c
cgo-test:1:1: error: expression result unused [-Werror,-Wunused-value]
GL_TEXTURE_2D; /* #0 */
^~~~~~~~~~~~~
broken.go:3:23: note: expanded from macro 'GL_TEXTURE_2D'
#define GL_TEXTURE_2D 0x0DE1
                      ^~~~~~
1 error generated.
g%
@rsc

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2013

Comment 11:

I downloaded GLEW 1.10 and added an appropriate -I to the command line, so that I'm
really using a GL/glew.h, and I still get the (correct) error:
g% clang -I/Users/rsc/Downloads/glew-1.10.0/include -Wall -Werror -ox.o -gdwarf-2
    -fno-eliminate-unused-debug-types -c -xc    -ferror-limit=0 -Wno-unknown-warning-option
    -Wno-unneeded-internal-declaration  -Wno-unused-function    -Qunused-arguments -m64 -
    -Wsystem-headers <x.c
cgo-test:1:1: error: expression result unused [-Werror,-Wunused-value]
GL_TEXTURE_2D; /* #0 */
^~~~~~~~~~~~~
/Users/rsc/Downloads/glew-1.10.0/include/GL/glew.h:9413:23: note: expanded from macro
'GL_TEXTURE_2D'
#define GL_TEXTURE_2D 0x0DE1
                      ^~~~~~
1 error generated.
g%
@quarnster

This comment has been minimized.

Copy link
Author

commented Oct 9, 2013

Comment 12:

I'm on XCode 5 now, but still no error.
    15:10 /tmp $ cat x.c
    /* Define intgo when compiling with GCC.  */
    #ifdef __PTRDIFF_TYPE__
    typedef __PTRDIFF_TYPE__ intgo;
    #elif defined(_LP64)
    typedef long long intgo;
    #else
    typedef int intgo;
    #endif
    
    typedef struct { char *p; intgo n; } _GoString_;
    typedef struct { char *p; intgo n; intgo c; } _GoBytes_;
    _GoString_ GoString(char *p);
    _GoString_ GoStringN(char *p, int l);
    _GoBytes_ GoBytes(void *p, int n);
    char *CString(_GoString_);
    #line 3 "broken.go"
    #define GL_TEXTURE_2D 0x0DE1
    
    void __cgo__f__(void) {
    #line 1 "cgo-test"
    GL_TEXTURE_2D; /* #0 */
    enum { _cgo_enum_0 = GL_TEXTURE_2D }; /* #0 */
    }
    15:10 /tmp $ clang --version
    clang version 3.3 (tags/RELEASE_33/final)
    Target: x86_64-apple-darwin12.5.0
    Thread model: posix
    15:11 /tmp $ clang -Wall -Werror -ox.o -gdwarf-2         -fno-eliminate-unused-debug-types -c -xc         -ferror-limit=0 -Wno-unknown-warning-option         -Wno-unneeded-internal-declaration         -Wno-unused-function         -Qunused-arguments -m64 -         -Wsystem-headers <x.c
    15:11 /tmp $ /usr/bin/clang --version
    Apple LLVM version 5.0 (clang-500.2.75) (based on LLVM 3.3svn)
    Target: x86_64-apple-darwin12.5.0
    Thread model: posix
    15:11 /tmp $ /usr/bin/clang -Wall -Werror -ox.o -gdwarf-2         -fno-eliminate-unused-debug-types -c -xc         -ferror-limit=0 -Wno-unknown-warning-option         -Wno-unneeded-internal-declaration         -Wno-unused-function         -Qunused-arguments -m64 -         -Wsystem-headers <x.c
    15:11 /tmp $
Oddly enough if I add in
    0x0DE1; /* #0 */
I get
    cgo-test:3:1: error: expression result unused [-Werror,-Wunused-value]
    0x0DE1; /* #0 */
    ^~~~~~
    1 error generated.
Or if I change it to
    {int a = GL_TEXTURE_2D;} /* #0 */
I get
    cgo-test:1:7: error: unused variable 'a' [-Werror,-Wunused-variable]
            {int a = GL_TEXTURE_2D;} /* #0 */
                 ^
    1 error generated.
@quarnster

This comment has been minimized.

Copy link
Author

commented Oct 9, 2013

Comment 13:

15:28 /tmp $ cat x.c
    /* Define intgo when compiling with GCC.  */
    #ifdef __PTRDIFF_TYPE__
    typedef __PTRDIFF_TYPE__ intgo;
    #elif defined(_LP64)
    typedef long long intgo;
    #else
    typedef int intgo;
    #endif
    
    typedef struct { char *p; intgo n; } _GoString_;
    typedef struct { char *p; intgo n; intgo c; } _GoBytes_;
    _GoString_ GoString(char *p);
    _GoString_ GoStringN(char *p, int l);
    _GoBytes_ GoBytes(void *p, int n);
    char *CString(_GoString_);
    #line 3 "broken.go"
    #define ARNE 0x0DE1
    #define GL_TEXTURE_2D 0x0DE1
    
    void __cgo__f__(void) {
    #line 1 "cgo-test"
        GL_TEXTURE_2D; /* #0 */
        {int a = GL_TEXTURE_2D;} /* #0 */
        enum { _cgo_enum_0 = GL_TEXTURE_2D }; /* #0 */
        0x0DE1; /* #0 */
    }
    15:28 /tmp $ clang -Wall -Werror -ox.o -gdwarf-2         -fno-eliminate-unused-debug-types -c -xc         -ferror-limit=0 -Wno-unknown-warning-option         -Wno-unneeded-internal-declaration         -Wno-unused-function         -Qunused-arguments -m64 -      -Wunused-variable   -Wsystem-headers <x.c
    cgo-test:2:7: error: unused variable 'a' [-Werror,-Wunused-variable]
            {int a = GL_TEXTURE_2D;} /* #0 */
                 ^
    cgo-test:4:2: error: expression result unused [-Werror,-Wunused-value]
            0x0DE1; /* #0 */
            ^~~~~~
    2 errors generated.
@rsc

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2013

Comment 14:

Does clang implicitly read from some kind of .clangrc file or something
like that? There is clearly something different between your system and
mine other than the Xcode and clang versions.
I am trying Xcode 5 now...
@quarnster

This comment has been minimized.

Copy link
Author

commented Oct 9, 2013

Comment 15:

> Does clang implicitly read from some kind of .clangrc file or something
like that?
Not that I know of.
FWIW:
17:18 /tmp $ sudo dtruss -a /usr/bin/clang -v -Wall -Werror -ox.o -gdwarf-2        
-fno-eliminate-unused-debug-types -c -xc         -ferror-limit=0
-Wno-unknown-warning-option         -Wno-unneeded-internal-declaration        
-Wno-unused-function         -Qunused-arguments -m64 -         -Wsystem-headers
-emit-llvm <x.c
Apple LLVM version 5.0 (clang-500.2.75) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
 "/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.8.0 -emit-llvm-bc -disable-free -disable-llvm-verifier -main-file-name - -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 224.1 -v -g -coverage-file /private/tmp/x.o -resource-dir /usr/bin/../lib/clang/5.0 -Wall -Werror -Wno-unknown-warning-option -Wno-unneeded-internal-declaration -Wno-unused-function -Wsystem-headers -fdebug-compilation-dir /private/tmp -ferror-limit 0 -fmessage-length 204 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.8.0 -fobjc-dispatch-method=mixed -fobjc-default-synthesize-properties -fencode-extended-block-signature -fdiagnostics-show-option -fcolor-diagnostics -o x.o -x c -
clang -cc1 version 5.0 based upon LLVM 3.3svn default target x86_64-apple-darwin12.5.0
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/bin/../lib/clang/5.0/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
cgo-test:2:7: error: unused variable 'a' [-Werror,-Wunused-variable]
        {int a = GL_TEXTURE_2D;} /* #0 */
             ^
cgo-test:4:2: error: expression result unused [-Werror,-Wunused-value]
        0x0DE1; /* #0 */
        ^~~~~~
2 errors generated.
    PID/THRD  RELATIVE  ELAPSD    CPU SYSCALL(args)          = return
53533/0x313a37:       853      70     19 open("/dev/dtracehelper\0", 0x2,
0x7FFF5FBFF1B0)      = 3 0
53533/0x313a37:    115327  114476 114472 ioctl(0x3, 0x80086804, 0x7FFF5FBFF110)      = 0 0
53533/0x313a37:    115335      13      6 close(0x3)      = 0 0
53533/0x313a37:    115356      17     14 stat64("/usr/lib/libstdc++.6.dylib\0",
0x7FFF5FBFE150, 0x7FFF5FBFF050)      = 0 0
53533/0x313a37:    115595      75      6 __sysctl(0x7FFF5FBFEC64, 0x2, 0x7FFF5FBFEC50)      
= 0 0
53533/0x313a37:    115608       6      0 bsdthread_register(0x7FFF84C1B194,
0x7FFF84C1B184, 0x2000)      = 0 0
53533/0x313a37:    115609       3      0 thread_selfid(0x7FFF84C1B194, 0x7FFF84C1B184,
0x0)         = 3226167 0
53533/0x313a37:    115634       9      3 mmap(0x0, 0x2000, 0x3, 0x1002, 0x1000000,
0x0)         = 0x1C19000 0
53533/0x313a37:    115645       5      2 mprotect(0x101C19000, 0x88, 0x1)        = 0 0
53533/0x313a37:    115647       4      1 mmap(0x0, 0x17000, 0x3, 0x1002, 0x1000000,
0x0)         = 0x1C1B000 0
53533/0x313a37:    115649       3      1 mprotect(0x101C1B000, 0x1000, 0x0)      = 0 0
53533/0x313a37:    115650       2      1 mprotect(0x101C31000, 0x1000, 0x0)      = 0 0
53533/0x313a37:    115662       3      0 mmap(0x0, 0x17000, 0x3, 0x1002, 0x1000000,
0x0)         = 0x1C32000 0
53533/0x313a37:    115663       2      0 mprotect(0x101C32000, 0x1000, 0x0)      = 0 0
53533/0x313a37:    115664       2      0 mprotect(0x101C48000, 0x1000, 0x0)      = 0 0
53533/0x313a37:    115676       3      0 mmap(0x0, 0x1000, 0x3, 0x1002, 0x1000000,
0x0)         = 0x1C49000 0
53533/0x313a37:    115679       2      0 mprotect(0x101C49000, 0x1000, 0x1)      = 0 0
53533/0x313a37:    115681       3      1 mprotect(0x101C19000, 0x88, 0x3)        = 0 0
53533/0x313a37:    115683       3      0 mmap(0x0, 0x200000, 0x3, 0x1002, 0x7000000,
0x0)         = 0x1C4A000 0
53533/0x313a37:    115685       5      1 munmap(0x101C4A000, 0xB6000)        = 0 0
53533/0x313a37:    115687       2      0 munmap(0x101E00000, 0x4A000)        = 0 0
53533/0x313a37:    115696       3      1 mprotect(0x101C19000, 0x88, 0x1)        = 0 0
53533/0x313a37:    115730       3      0 issetugid(0x7FFF86C2F075, 0x7FFF5FBFEC64,
0x7FFF5FBFF8E8)      = 0 0
53533/0x313a37:    115769      11      7 getattrlist("/usr\0", 0x7FFF6D67C794,
0x7FFF5FBFC360)      = 0 0
53533/0x313a37:    115772       4      2 getattrlist("/usr/bin\0", 0x7FFF6D67C794,
0x7FFF5FBFC360)      = 0 0
53533/0x313a37:    115776       4      2 getattrlist("/usr/bin/clang\0", 0x7FFF6D67C794,
0x7FFF5FBFC360)      = 0 0
53533/0x313a37:    115789       4      2 getattrlist("/usr\0", 0x7FFF6D67C794,
0x7FFF5FBFC360)      = 0 0
53533/0x313a37:    115791       3      1 getattrlist("/usr/bin\0", 0x7FFF6D67C794,
0x7FFF5FBFC360)      = 0 0
53533/0x313a37:    115793       3      1 getattrlist("/usr/bin/clang\0", 0x7FFF6D67C794,
0x7FFF5FBFC360)      = 0 0
53533/0x313a37:    115808       5      2 getattrlist("/usr\0", 0x7FFF6D67C794,
0x7FFF5FBFC360)      = 0 0
53533/0x313a37:    115810       3      1 getattrlist("/usr/bin\0", 0x7FFF6D67C794,
0x7FFF5FBFC360)      = 0 0
53533/0x313a37:    115813       3      1 getattrlist("/usr/bin/clang\0", 0x7FFF6D67C794,
0x7FFF5FBFC360)      = 0 0
53533/0x313a37:    116131       4      1 mmap(0x0, 0x1000000, 0x3, 0x1002, 0x2000000,
0x0)         = 0x1E00000 0
53533/0x313a37:    116133       3      1 munmap(0x101E00000, 0x200000)       = 0 0
53533/0x313a37:    116134       2      0 munmap(0x102800000, 0x600000)       = 0 0
53533/0x313a37:    116284       4      0 getpid(0x7FFF5FBFEAC4, 0x3, 0x3)        = 53533 0
53533/0x313a37:    116294       5      2 __mac_syscall(0x7FFF8DD528CC, 0x2,
0x7FFF5FBFEAF8)      = 0 0
53533/0x313a37:    116297       5      2 stat64("/AppleInternal\0", 0x7FFF5FBFEB68,
0x0)         = -1 Err#2
53533/0x313a37:    116337       4      1 audit_session_self(0x7FFF5FBFEA50,
0x7FFF5FBFE888, 0x4)         = 4611 0
53533/0x313a37:    116337       2      0 geteuid(0x7FFF5FBFEA50, 0x7FFF5FBFE888, 0x0)       
= 0 0
53533/0x313a37:    116338       2      0 getegid(0x7FFF5FBFEA50, 0x7FFF5FBFE888, 0x0)       
= 0 0
53533/0x313a37:    116340       3      0 getaudit_addr(0x7FFF5FBFEB00, 0x30, 0x0)        = 0 0
53533/0x313a37:    116353       4      1 csops(0xD11D, 0x7, 0x7FFF5FBFE6E0)      = 0 0
53533/0x313a37:    116554       7      1 sigaction(0x1, 0x7FFF5FBFDC58, 0x101BDE620)         =
0 0
53533/0x313a37:    116555       3      0 sigaction(0x2, 0x7FFF5FBFDC58, 0x101BDE638)         =
0 0
53533/0x313a37:    116556       3      0 sigaction(0x3, 0x7FFF5FBFDC58, 0x101BDE650)         =
0 0
53533/0x313a37:    116557       3      0 sigaction(0xD, 0x7FFF5FBFDC58, 0x101BDE668)         =
0 0
53533/0x313a37:    116558       3      0 sigaction(0xF, 0x7FFF5FBFDC58, 0x101BDE680)         =
0 0
53533/0x313a37:    116558       2      0 sigaction(0x1E, 0x7FFF5FBFDC58, 0x101BDE698)       
= 0 0
53533/0x313a37:    116559       2      0 sigaction(0x1F, 0x7FFF5FBFDC58, 0x101BDE6B0)       
= 0 0
53533/0x313a37:    116564       3      0 sigaction(0x4, 0x7FFF5FBFDC58, 0x101BDE6C8)         =
0 0
53533/0x313a37:    116565       2      0 sigaction(0x5, 0x7FFF5FBFDC58, 0x101BDE6E0)         =
0 0
53533/0x313a37:    116565       2      0 sigaction(0x6, 0x7FFF5FBFDC58, 0x101BDE6F8)         =
0 0
53533/0x313a37:    116566       2      0 sigaction(0x8, 0x7FFF5FBFDC58, 0x101BDE710)         =
0 0
53533/0x313a37:    116566       1      0 sigaction(0xA, 0x7FFF5FBFDC58, 0x101BDE728)         =
0 0
53533/0x313a37:    116567       2      0 sigaction(0xB, 0x7FFF5FBFDC58, 0x101BDE740)         =
0 0
53533/0x313a37:    116567       1      0 sigaction(0xC, 0x7FFF5FBFDC58, 0x101BDE758)         =
0 0
53533/0x313a37:    116568       1      0 sigaction(0x18, 0x7FFF5FBFDC58, 0x101BDE770)       
= 0 0
53533/0x313a37:    116568       2      0 sigaction(0x19, 0x7FFF5FBFDC58, 0x101BDE788)       
= 0 0
53533/0x313a37:    116569       1      0 sigaction(0x7, 0x7FFF5FBFDC58, 0x101BDE7A0)         =
0 0
53533/0x313a37:    116615       8      4 stat64("/\0", 0x7FFF5FBFC800, 0x7FFF730FB218)      
= 0 0
53533/0x313a37:    116625       9      5 getattrlist("/usr\0", 0x7FFF72446510,
0x7FFF5FBFC890)      = 0 0
53533/0x313a37:    116630       6      3 getattrlist("/usr/bin\0", 0x7FFF72446510,
0x7FFF5FBFC890)      = 0 0
53533/0x313a37:    116638       8      6 getattrlist("/usr/bin/clang\0", 0x7FFF72446510,
0x7FFF5FBFC890)      = 0 0
53533/0x313a37:    116788       4      1 lseek(0x2, 0x0, 0x1)        = 0 0
53533/0x313a37:    116864       5      3 __sysctl(0x7FFF5FBFD748, 0x2, 0x7FFF5FBFD7C0)      
= 0 0
53533/0x313a37:    116867       5      2 __sysctl(0x7FFF5FBFD748, 0x2, 0x7FFF5FBFD8C0)      
= 0 0
53533/0x313a37:    116869       3      1 __sysctl(0x7FFF5FBFD748, 0x2, 0x7FFF5FBFD9C0)      
= 0 0
53533/0x313a37:    116870       3      1 __sysctl(0x7FFF5FBFD748, 0x2, 0x7FFF5FBFDAC0)      
= 0 0
53533/0x313a37:    116874       5      2 __sysctl(0x7FFF5FBFD748, 0x2, 0x7FFF5FBFDBC0)      
= 0 0
53533/0x313a37:    116921       6      2 access("/usr/bin\0", 0x0, 0x7FFF5FBFDC30)       = 0
0
53533/0x313a37:    117003      11      8 write(0x2, "Apple LLVM version 5.0
(clang-500.2.75) (based on LLVM 3.3svn)\0", 0x3E)        = 62 0
53533/0x313a37:    117006       3      1 write(0x2, "\n\0", 0x1)         = 1 0
53533/0x313a37:    117007       2      1 write(0x2, "Target: \0", 0x8)       = 8 0
53533/0x313a37:    117009       2      0 write(0x2, "x86_64-apple-darwin12.5.0\0",
0x19)        = 25 0
53533/0x313a37:    117010       2      0 write(0x2, "\n\0", 0x1)         = 1 0
53533/0x313a37:    117011       2      0 write(0x2, "Thread model: \0", 0xE)         = 14 0
53533/0x313a37:    117013       2      0 write(0x2, "posix\0", 0x5)      = 5 0
53533/0x313a37:    117014       2      0 write(0x2, "\n\0", 0x1)         = 1 0
53533/0x313a37:    117152      13      8 open_nocancel(".\0", 0x0, 0x1)      = 3 0
53533/0x313a37:    117155       4      1 fstat64(0x3, 0x7FFF5FBFBD00, 0x0)       = 0 0
53533/0x313a37:    117159       6      2 fcntl_nocancel(0x3, 0x32, 0x102005400)      = 0 0
53533/0x313a37:    117162       6      2 close_nocancel(0x3)         = 0 0
53533/0x313a37:    117166       5      2 stat64("/private/tmp\0", 0x7FFF5FBFBC70, 0x0)      
= 0 0
53533/0x313a37:    117204       4      1 stat64("/private/tmp\0", 0x7FFF5FBFC148, 0x1)      
= 0 0
53533/0x313a37:    117205       2      1 stat64(".\0", 0x7FFF5FBFC0B8, 0x0)      = 0 0
53533/0x313a37:    117217       5      2 ioctl(0x2, 0x4004667A, 0x7FFF5FBFC1F4)      = 0 0
53533/0x313a37:    117221       4      2 ioctl(0x2, 0x40087468, 0x7FFF5FBFCC18)      = 0 0
53533/0x313a37:    117286       2      0 ioctl(0x2, 0x4004667A, 0x7FFF5FBFC1F4)      = 0 0
53533/0x313a37:    117309       5      3 write(0x2, " \"\0", 0x2)        = 2 0
53533/0x313a37:    117311       2      0 write(0x2, "/usr/bin/clang\0", 0xE)         = 14 0
53533/0x313a37:    117312       2      0 write(0x2, "\"\0", 0x1)         = 1 0
53533/0x313a37:    117313       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117316       2      0 write(0x2, "-cc1\0", 0x4)       = 4 0
53533/0x313a37:    117317       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117318       2      0 write(0x2, "-triple\0", 0x7)        = 7 0
53533/0x313a37:    117319       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117320       2      0 write(0x2, "x86_64-apple-macosx10.8.0\0",
0x19)        = 25 0
53533/0x313a37:    117321       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117322       2      0 write(0x2, "-emit-llvm-bc\0", 0xD)      = 13 0
53533/0x313a37:    117323       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117324       2      0 write(0x2, "-disable-free\0", 0xD)      = 13 0
53533/0x313a37:    117326       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117327       2      0 write(0x2, "-disable-llvm-verifier\0", 0x16)       
= 22 0
53533/0x313a37:    117328       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117329       2      0 write(0x2, "-main-file-name\0", 0xF)        = 15 0
53533/0x313a37:    117330       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117331       2      0 write(0x2, "-\0", 0x1)      = 1 0
53533/0x313a37:    117332       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117333       2      0 write(0x2, "-mrelocation-model\0", 0x12)        = 18
0
53533/0x313a37:    117334       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117338       2      0 write(0x2, "pic\0", 0x3)        = 3 0
53533/0x313a37:    117339       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117340       2      0 write(0x2, "-pic-level\0", 0xA)         = 10 0
53533/0x313a37:    117341       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117342       2      0 write(0x2, "2\0", 0x1)      = 1 0
53533/0x313a37:    117343       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117344       2      0 write(0x2, "-mdisable-fp-elim\0", 0x11)         = 17 0
53533/0x313a37:    117345       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117346       2      0 write(0x2, "-masm-verbose\0", 0xD)      = 13 0
53533/0x313a37:    117347       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117348       2      0 write(0x2, "-munwind-tables\0", 0xF)        = 15 0
53533/0x313a37:    117349       1      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117350       2      0 write(0x2, "-target-cpu\0", 0xB)        = 11 0
53533/0x313a37:    117351       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117352       2      0 write(0x2, "core2\0", 0x5)      = 5 0
53533/0x313a37:    117353       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117354       2      0 write(0x2, "-target-linker-version\0", 0x16)       
= 22 0
53533/0x313a37:    117355       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117356       2      0 write(0x2, "224.1\0", 0x5)      = 5 0
53533/0x313a37:    117357       1      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117358       2      0 write(0x2, "-v\0", 0x2)         = 2 0
53533/0x313a37:    117359       1      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117360       2      0 write(0x2, "-g\0", 0x2)         = 2 0
53533/0x313a37:    117361       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117362       1      0 write(0x2, "-coverage-file\0", 0xE)         = 14 0
53533/0x313a37:    117363       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117364       2      0 write(0x2, "/private/tmp/x.o\0", 0x10)      = 16 0
53533/0x313a37:    117365       1      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117367       2      0 write(0x2, "-resource-dir\0", 0xD)      = 13 0
53533/0x313a37:    117368       1      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117369       2      0 write(0x2, "/usr/bin/../lib/clang/5.0\0",
0x19)        = 25 0
53533/0x313a37:    117370       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117371       2      0 write(0x2, "-Wall\0", 0x5)      = 5 0
53533/0x313a37:    117372       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117373       2      0 write(0x2, "-Werror\0", 0x7)        = 7 0
53533/0x313a37:    117374       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117375       2      0 write(0x2, "-Wno-unknown-warning-option\0",
0x1B)        = 27 0
53533/0x313a37:    117376       1      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117377       2      0 write(0x2,
"-Wno-unneeded-internal-declaration\0", 0x22)        = 34 0
53533/0x313a37:    117378       1      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117379       2      0 write(0x2, "-Wno-unused-function\0", 0x14)      =
20 0
53533/0x313a37:    117381       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117382       2      0 write(0x2, "-Wsystem-headers\0", 0x10)      = 16 0
53533/0x313a37:    117383       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117384       2      0 write(0x2, "-fdebug-compilation-dir\0", 0x17)      
= 23 0
53533/0x313a37:    117385       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117386       2      0 write(0x2, "/private/tmp\0", 0xC)       = 12 0
53533/0x313a37:    117387       1      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117388       2      0 write(0x2, "-ferror-limit\0", 0xD)      = 13 0
53533/0x313a37:    117389       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117390       2      0 write(0x2, "0\0", 0x1)      = 1 0
53533/0x313a37:    117391       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117392       2      0 write(0x2, "-fmessage-length\0", 0x10)      = 16 0
53533/0x313a37:    117393       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117394       2      0 write(0x2, "204\0", 0x3)        = 3 0
53533/0x313a37:    117395       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117396       2      0 write(0x2, "-stack-protector\0", 0x10)      = 16 0
53533/0x313a37:    117397       1      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117398       2      0 write(0x2, "1\0", 0x1)      = 1 0
53533/0x313a37:    117399       1      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117400       2      0 write(0x2, "-mstackrealign\0", 0xE)         = 14 0
53533/0x313a37:    117401       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117402       2      0 write(0x2, "-fblocks\0", 0x8)       = 8 0
53533/0x313a37:    117403       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117404       2      0 write(0x2, "-fobjc-runtime=macosx-10.8.0\0",
0x1C)        = 28 0
53533/0x313a37:    117405       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117406       2      0 write(0x2, "-fobjc-dispatch-method=mixed\0",
0x1C)        = 28 0
53533/0x313a37:    117407       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117409       2      0 write(0x2,
"-fobjc-default-synthesize-properties\0", 0x24)      = 36 0
53533/0x313a37:    117410       1      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117411       2      0 write(0x2,
"-fencode-extended-block-signature\0", 0x21)         = 33 0
53533/0x313a37:    117412       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117413       2      0 write(0x2, "-fdiagnostics-show-option\0",
0x19)        = 25 0
53533/0x313a37:    117414       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117415       1      0 write(0x2, "-fcolor-diagnostics\0", 0x13)       =
19 0
53533/0x313a37:    117416       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117417       2      0 write(0x2, "-o\0", 0x2)         = 2 0
53533/0x313a37:    117419       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117420       2      0 write(0x2, "x.o\0", 0x3)        = 3 0
53533/0x313a37:    117421       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117422       2      0 write(0x2, "-x\0", 0x2)         = 2 0
53533/0x313a37:    117423       2      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117424       2      0 write(0x2, "c\0", 0x1)      = 1 0
53533/0x313a37:    117425       1      0 write(0x2, " \0", 0x1)      = 1 0
53533/0x313a37:    117426       2      0 write(0x2, "-\0", 0x1)      = 1 0
53533/0x313a37:    117427       2      0 write(0x2, "\n\0", 0x1)         = 1 0
53533/0x313a37:    117605     240    172 posix_spawn(0x7FFF5FBFD254, 0x7FFF5FBFDB41,
0x0)         = 0 0
53533/0x313a37:    117618  135957      8 wait4(0xD11E, 0x7FFF5FBFD2B4, 0x0)      = 53534 0
53533/0x313a37:    117635      15      9 access("x.o\0", 0x2, 0x0)       = -1 Err#2
53533/0x313a37:        59      54      0 issetugid(0x100000000, 0x12, 0x7FFF5FBFF800)       
= 0 0
53533/0x313a37:        60       3      0 geteuid(0x100000000, 0x12, 0x0)         = 0 0
53533/0x313a37:        61       3      0 csops(0x0, 0x0, 0x7FFF5FBFF2E4)         = 0 0
53533/0x313a37:        98       4      1 shared_region_check_np(0x7FFF5FBFD238, 0x2,
0x7FFF5FBFD238)      = 0 0
53533/0x313a37:       120      15     11
stat64("/usr/lib/dtrace/libdtrace_dyld.dylib\0", 0x7FFF5FBFE380, 0x7FFF5FBFF350)         = 0 0
53533/0x313a37:       169     156     48 open("/usr/lib/dtrace/libdtrace_dyld.dylib\0",
0x0, 0x0)        = 3 0
53533/0x313a37:       174      10      3 pread(0x3, "\312\376\272\276\0", 0x1000, 0x0)      
= 4096 0
53533/0x313a37:       177       4      1 pread(0x3, "\317\372\355\376\a\0", 0x1000,
0x6000)      = 4096 0
53533/0x313a37:       202      18     12 mmap(0x101C14000, 0x2000, 0x5, 0x12, 0x3,
0x6000)      = 0x1C14000 0
53533/0x313a37:       205       5      3 mmap(0x101C16000, 0x1000, 0x3, 0x12, 0x3,
0x8000)      = 0x1C16000 0
53533/0x313a37:       209       5      2 mmap(0x101C17000, 0x1FF0, 0x1, 0x12, 0x3,
0x9000)      = 0x1C17000 0
53533/0x313a37:       219       6      3 close(0x3)      = 0 0
53533/0x313a37:       245      18     16 stat64("/\0", 0x7FFF5FBFCE50, 0x0)      = 0 0
53533/0x313a37:       259      13      9 getattrlist("/usr\0", 0x7FFF6D67C794,
0x7FFF5FBFCEE0)      = 0 0
53533/0x313a37:       263       4      2 getattrlist("/usr/bin\0", 0x7FFF6D67C794,
0x7FFF5FBFCEE0)      = 0 0
53533/0x313a37:       266       4      2 getattrlist("/usr/bin/clang\0", 0x7FFF6D67C794,
0x7FFF5FBFCEE0)      = 0 0
53533/0x313a37:       270       4      2 stat64("/usr/lib/libSystem.B.dylib\0",
0x7FFF5FBFE150, 0x7FFF5FBFF050)      = 0 0
53533/0x313a37:       277       4      2 stat64("/usr/lib/libc++.1.dylib\0",
0x7FFF5FBFE150, 0x7FFF5FBFF050)      = 0 0
53533/0x313a37:       283       4      2 stat64("/usr/lib/system/libcache.dylib\0",
0x7FFF5FBFDE40, 0x7FFF5FBFED40)      = 0 0
53533/0x313a37:       288       4      2
stat64("/usr/lib/system/libcommonCrypto.dylib\0", 0x7FFF5FBFDE40, 0x7FFF5FBFED40)        = 0 0
53533/0x313a37:       293       3      2
stat64("/usr/lib/system/libcompiler_rt.dylib\0", 0x7FFF5FBFDE40, 0x7FFF5FBFED40)         = 0 0
53533/0x313a37:       301       3      2 stat64("/usr/lib/system/libcopyfile.dylib\0",
0x7FFF5FBFDE40, 0x7FFF5FBFED40)      = 0 0
53533/0x313a37:       305       3      2 stat64("/usr/lib/system/libdispatch.dylib\0",
0x7FFF5FBFDE40, 0x7FFF5FBFED40)      = 0 0
53533/0x313a37:       310       3      2 stat64("/usr/lib/system/libdnsinfo.dylib\0",
0x7FFF5FBFDE40, 0x7FFF5FBFED40)      = 0 0
53533/0x313a37:       314       3      1 stat64("/usr/lib/system/libdyld.dylib\0",
0x7FFF5FBFDE40, 0x7FFF5FBFED40)      = 0 0
53533/0x313a37:       319       3      2 stat64("/usr/lib/system/libkeymgr.dylib\0",
0x7FFF5FBFDE40, 0x7FFF5FBFED40)      = 0 0
53533/0x313a37:       324       3      2 stat64("/usr/lib/system/liblaunch.dylib\0",
0x7FFF5FBFDE40, 0x7FFF5FBFED40)      = 0 0
53533/0x313a37:       328       3      2 stat64("/usr/lib/system/libmacho.dylib\0",
0x7FFF5FBFDE40, 0x7FFF5FBFED40)      = 0 0
53533/0x313a37:       332       3      2 stat64("/usr/lib/system/libquarantine.dylib\0",
0x7FFF5FBFDE40, 0x7FFF5FBFED40)      = 0 0
53533/0x313a37:       340       4      2 stat64("/usr/lib/system/libremovefile.dylib\0",
0x7FFF5FBFDE40, 0x7FFF5FBFED40)      = 0 0
53533/0x313a37:       345       4      2
stat64("/usr/lib/system/libsystem_blocks.dylib\0", 0x7FFF5FBFDE40, 0x7FFF5FBFED40)       = 0
0
53533/0x313a37:       350       3      2 stat64("/usr/lib/system/libsystem_c.dylib\0",
0x7FFF5FBFDE40, 0x7FFF5FBFED40)      = 0 0
53533/0x313a37:       355       4      2
stat64("/usr/lib/system/libsystem_dnssd.dylib\0", 0x7FFF5FBFDE40, 0x7FFF5FBFED40)        = 0 0
53533/0x313a37:       360       3      2
stat64("/usr/lib/system/libsystem_info.dylib\0", 0x7FFF5FBFDE40, 0x7FFF5FBFED40)         = 0 0
53533/0x313a37:       365       3      2
stat64("/usr/lib/system/libsystem_kernel.dylib\0", 0x7FFF5FBFDE40, 0x7FFF5FBFED40)       = 0
0
53533/0x313a37:       369       3      2 stat64("/usr/lib/system/libsystem_m.dylib\0",
0x7FFF5FBFDE40, 0x7FFF5FBFED40)      = 0 0
53533/0x313a37:       374       3      2
stat64("/usr/lib/system/libsystem_network.dylib\0", 0x7FFF5FBFDE40, 0x7FFF5FBFED40)      =
0 0
53533/0x313a37:       379       4      2
stat64("/usr/lib/system/libsystem_notify.dylib\0", 0x7FFF5FBFDE40, 0x7FFF5FBFED40)       = 0
0
53533/0x313a37:       384       3      2
stat64("/usr/lib/system/libsystem_sandbox.dylib\0", 0x7FFF5FBFDE40, 0x7FFF5FBFED40)      =
0 0
53533/0x313a37:       389       4      2 stat64("/usr/lib/system/libunc.dylib\0",
0x7FFF5FBFDE40, 0x7FFF5FBFED40)      = 0 0
53533/0x313a37:       394       4      2 stat64("/usr/lib/system/libunwind.dylib\0",
0x7FFF5FBFDE40, 0x7FFF5FBFED40)      = 0 0
53533/0x313a37:       399       3      1 stat64("/usr/lib/system/libxpc.dylib\0",
0x7FFF5FBFDE40, 0x7FFF5FBFED40)      = 0 0
53533/0x313a37:       404       3      2 stat64("/usr/lib/system/libcorecrypto.dylib\0",
0x7FFF5FBFDD40, 0x7FFF5FBFEC40)      = 0 0
53533/0x313a37:       411       3      2 stat64("/usr/lib/libobjc.A.dylib\0",
0x7FFF5FBFDD20, 0x7FFF5FBFEC20)      = 0 0
53533/0x313a37:       416       3      1 stat64("/usr/lib/libauto.dylib\0",
0x7FFF5FBFDD20, 0x7FFF5FBFEC20)      = 0 0
53533/0x313a37:       423       4      2 stat64("/usr/lib/libc++abi.dylib\0",
0x7FFF5FBFDBF0, 0x7FFF5FBFEAF0)      = 0 0
53533/0x313a37:       429       3      2
stat64("/usr/lib/libDiagnosticMessagesClient.dylib\0", 0x7FFF5FBFDAD0, 0x7FFF5FBFE9D0)      
= 0 0
53533/0x313a37:       454       3      0 getpid(0x7FFF5FBFF0B8, 0x101C13004, 0xEA60)         =
53533 0
CALL                                        COUNT
__mac_syscall                                   1
audit_session_self                              1
bsdthread_register                              1
close_nocancel                                  1
exit                                            1
fcntl_nocancel                                  1
fstat64                                         1
getaudit_addr                                   1
getegid                                         1
lseek                                           1
open_nocancel                                   1
posix_spawn                                     1
shared_region_check_np                          1
thread_selfid                                   1
wait4                                           1
access                                          2
close                                           2
csops                                           2
geteuid                                         2
getpid                                          2
issetugid                                       2
open                                            2
pread                                           2
ioctl                                           4
munmap                                          4
__sysctl                                        6
mprotect                                        8
mmap                                            9
getattrlist                                    15
sigaction                                      17
stat64                                         39
write                                         116
@rsc

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2013

Comment 16:

with xcode 5 and
Apple LLVM version 5.0 (clang-500.2.75) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
i am finally seeing the same results you are.
@james4k

This comment has been minimized.

Copy link
Contributor

commented Oct 14, 2013

Comment 17:

Appears to have started with this clang revision:
http://llvm.org/viewvc/llvm-project?view=revision&revision=172696
@james4k

This comment has been minimized.

Copy link
Contributor

commented Oct 14, 2013

Comment 18:

Here is a simple patch that seems to work with both gcc and clang:
https://gist.github.com/james4k/6971932
The idea came from noticing the NOP(a) statements in the unused-value clang tests. [1]
Note that for names that are types, this change gives the new error: "expected
expression". [2]
[1]
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/unused-expr.c?r1=166534&r2=172696&pathrev=172696&diff_format=h
[2] https://gist.github.com/james4k/6972039
I realize I should be using a CL, but I wanted to confirm that this makes sense before I
figure out the codereview system again. (sorry to be frank and maybe unreasonable)
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Oct 14, 2013

Comment 19:

If you add the search for "expected expression" do you still need to add the
parentheses?  Adding the parentheses is probably fine but I'm concerned about tweaking
this somewhat delicate code just before a release.
@james4k

This comment has been minimized.

Copy link
Contributor

commented Oct 14, 2013

Comment 20:

The parentheses are necessary to trigger the unused-value warning for macro expansions,
since macro expansions no longer output this warning in recent versions of clang. cgo
relies on this warning to determine if the name represents a value.
As an alternative, it might be possible to assume that no output from CC gives this same
meaning for the given names.
@rsc

This comment has been minimized.

Copy link
Contributor

commented Oct 15, 2013

Comment 21:

I cannot reproduce the fix you've posted by placing parens. Specifically, using Xcode 5:
g% cat x.c
#define X 1
void f(void) { (X); }
g% clang -Wall -Werror -Wunused-value -c x.c
g% 
However, the default assumption in cgo appears to be "this is an expression", so as long
as we can make clang exit with a non-zero status cgo will do the right thing. That can
be done by putting a new statement "1;" in at the top of the function. I'll do that.
@rsc

This comment has been minimized.

Copy link
Contributor

commented Oct 15, 2013

Comment 22:

Owner changed to @rsc.

Status changed to Started.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Oct 15, 2013

Comment 23:

This issue was closed by revision 043ace1.

Status changed to Fixed.

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015

@rsc rsc removed the go1.2 label Apr 14, 2015

@golang golang locked and limited conversation to collaborators Jun 24, 2016

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
6 participants
You can’t perform that action at this time.