Skip to content

macOS: Builtin issues #41

@IngwiePhoenix

Description

@IngwiePhoenix

Hello! :)

I just wanted to try this project out and made me a clone and attempted a build with mkdir out && make all BUILDDIR=./out. This is what essentially happened:

cc -g -c -Icpp -o out/getopt.o cpp/getopt.c
cpp/getopt.c:21:3: warning: add explicit braces to avoid dangling else [-Wdangling-else]
                else if (strcmp(argv[optind], "--") == 0) {
                ^
1 warning generated.
cc -g -c -Icpp -o out/unix.o cpp/unix.c
cpp/unix.c:96:1: error: expected parameter declarator
memmove(void *dp, const void *sp, size_t n)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:69:47: note: expanded from macro 'memmove'
                __builtin___memmove_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
                                                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:38:63: note: expanded from macro '__darwin_obsz0'
#define __darwin_obsz0(object) __builtin_object_size (object, 0)
                                                              ^
cpp/unix.c:96:1: error: expected ')'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:69:47: note: expanded from macro 'memmove'
                __builtin___memmove_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
                                                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:38:63: note: expanded from macro '__darwin_obsz0'
#define __darwin_obsz0(object) __builtin_object_size (object, 0)
                                                              ^
cpp/unix.c:96:1: note: to match this '('
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:69:47: note: expanded from macro 'memmove'
                __builtin___memmove_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
                                                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:38:54: note: expanded from macro '__darwin_obsz0'
#define __darwin_obsz0(object) __builtin_object_size (object, 0)
                                                     ^
cpp/unix.c:96:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
memmove(void *dp, const void *sp, size_t n)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:69:47: note: expanded from macro 'memmove'
                __builtin___memmove_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
                                                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_common.h:38:32: note: expanded from macro '__darwin_obsz0'
#define __darwin_obsz0(object) __builtin_object_size (object, 0)
                               ^
cpp/unix.c:96:1: error: conflicting types for '__builtin___memmove_chk'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:69:3: note: expanded from macro 'memmove'
                __builtin___memmove_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
                ^
cpp/unix.c:96:1: note: '__builtin___memmove_chk' is a builtin with type 'void *(void *, const void *, unsigned long, unsigned long)'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:69:3: note: expanded from macro 'memmove'
                __builtin___memmove_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
                ^
cpp/unix.c:96:1: error: definition of builtin function '__builtin___memmove_chk'
memmove(void *dp, const void *sp, size_t n)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/secure/_string.h:69:3: note: expanded from macro 'memmove'
                __builtin___memmove_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
                ^
1 warning and 4 errors generated.
make: *** [out/unix.o] Error 1

macOS uses a specialized version of LLVM Clang:

$ cc --version
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Kind regards,

Ingwie.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions