On Mon, May 28, 2018 at 11:40 PM, Hiltjo Posthuma
Post by Hiltjo PosthumaWhat is the output of the compiler? Can you give more information what is
broken exactly?
It works for me on OpenBSD.
I'm using clang on Mac OS X 10.13. It fails with the following errors:
cc -c -o strlcpy.o strlcpy.c -Os -I. -I/usr/include -DVERSION=\"1.8\"
-std=c99 -D_DEFAULT_SOURCE
strlcpy.c:11:1: error: expected parameter declarator
strlcpy(char *dst, const char *src, size_t siz)
^
/usr/include/secure/_string.h:108:47: note: expanded from macro 'strlcpy'
__builtin___strlcpy_chk (dest, __VA_ARGS__,
__darwin_obsz (dest))
^
/usr/include/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object,
_USE_FORTIFY_LEVEL > 1 ? 1 : 0)
^
/usr/include/secure/_common.h:30:32: note: expanded from macro
'_USE_FORTIFY_LEVEL'
# define _USE_FORTIFY_LEVEL 2
^
strlcpy.c:11:1: error: expected ')'
/usr/include/secure/_string.h:108:47: note: expanded from macro 'strlcpy'
__builtin___strlcpy_chk (dest, __VA_ARGS__,
__darwin_obsz (dest))
^
/usr/include/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object,
_USE_FORTIFY_LEVEL > 1 ? 1 : 0)
^
/usr/include/secure/_common.h:30:32: note: expanded from macro
'_USE_FORTIFY_LEVEL'
# define _USE_FORTIFY_LEVEL 2
^
strlcpy.c:11:1: note: to match this '('
/usr/include/secure/_string.h:108:47: note: expanded from macro 'strlcpy'
__builtin___strlcpy_chk (dest, __VA_ARGS__,
__darwin_obsz (dest))
^
/usr/include/secure/_common.h:39:53: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object,
_USE_FORTIFY_LEVEL > 1 ? 1 : 0)
^
strlcpy.c:11:1: warning: type specifier missing, defaults to 'int'
[-Wimplicit-int]
strlcpy(char *dst, const char *src, size_t siz)
^
/usr/include/secure/_string.h:108:47: note: expanded from macro 'strlcpy'
__builtin___strlcpy_chk (dest, __VA_ARGS__,
__darwin_obsz (dest))
^
/usr/include/secure/_common.h:39:31: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object,
_USE_FORTIFY_LEVEL > 1 ? 1 : 0)
^
strlcpy.c:11:1: error: conflicting types for '__builtin___strlcpy_chk'
/usr/include/secure/_string.h:108:3: note: expanded from macro 'strlcpy'
__builtin___strlcpy_chk (dest, __VA_ARGS__,
__darwin_obsz (dest))
^
strlcpy.c:11:1: note: '__builtin___strlcpy_chk' is a builtin with type
'unsigned long (char *, const char *,
unsigned long, unsigned long)'
/usr/include/secure/_string.h:108:3: note: expanded from macro 'strlcpy'
__builtin___strlcpy_chk (dest, __VA_ARGS__,
__darwin_obsz (dest))
^
strlcpy.c:11:1: error: definition of builtin function '__builtin___strlcpy_chk'
strlcpy(char *dst, const char *src, size_t siz)
^
/usr/include/secure/_string.h:108:3: note: expanded from macro 'strlcpy'
__builtin___strlcpy_chk (dest, __VA_ARGS__,
__darwin_obsz (dest))
^
1 warning and 4 errors generated.