aboutsummaryrefslogtreecommitdiff
path: root/include/platform.h
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2015-03-14 20:33:00 +0000
committerRon Yorston <rmy@pobox.com>2015-03-14 20:33:00 +0000
commita4f58436b78fe59e57620c6e0301f213ee25f273 (patch)
tree8355f724926e605280af2d6f2b1ccc6b1bd02dee /include/platform.h
parentba0c36cfcf84efbac6f89e27238e04bb57e9cd45 (diff)
parent49acc1a7618a28d34381cbb7661d7c981fcb238f (diff)
downloadbusybox-w32-a4f58436b78fe59e57620c6e0301f213ee25f273.tar.gz
busybox-w32-a4f58436b78fe59e57620c6e0301f213ee25f273.tar.bz2
busybox-w32-a4f58436b78fe59e57620c6e0301f213ee25f273.zip
Merge branch 'busybox' into merge
Conflicts: coreutils/od_bloaty.c libbb/lineedit.c
Diffstat (limited to 'include/platform.h')
-rw-r--r--include/platform.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/platform.h b/include/platform.h
index e2b61592e..a550feae6 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -234,6 +234,7 @@ typedef uint64_t bb__aliased_uint64_t FIX_ALIASING;
234 * a lvalue. This makes it more likely to not swap them by mistake 234 * a lvalue. This makes it more likely to not swap them by mistake
235 */ 235 */
236#if defined(i386) || defined(__x86_64__) || defined(__powerpc__) 236#if defined(i386) || defined(__x86_64__) || defined(__powerpc__)
237# define BB_UNALIGNED_MEMACCESS_OK 1
237# define move_from_unaligned_int(v, intp) ((v) = *(bb__aliased_int*)(intp)) 238# define move_from_unaligned_int(v, intp) ((v) = *(bb__aliased_int*)(intp))
238# define move_from_unaligned_long(v, longp) ((v) = *(bb__aliased_long*)(longp)) 239# define move_from_unaligned_long(v, longp) ((v) = *(bb__aliased_long*)(longp))
239# define move_from_unaligned16(v, u16p) ((v) = *(bb__aliased_uint16_t*)(u16p)) 240# define move_from_unaligned16(v, u16p) ((v) = *(bb__aliased_uint16_t*)(u16p))
@@ -242,6 +243,7 @@ typedef uint64_t bb__aliased_uint64_t FIX_ALIASING;
242# define move_to_unaligned32(u32p, v) (*(bb__aliased_uint32_t*)(u32p) = (v)) 243# define move_to_unaligned32(u32p, v) (*(bb__aliased_uint32_t*)(u32p) = (v))
243/* #elif ... - add your favorite arch today! */ 244/* #elif ... - add your favorite arch today! */
244#else 245#else
246# define BB_UNALIGNED_MEMACCESS_OK 0
245/* performs reasonably well (gcc usually inlines memcpy here) */ 247/* performs reasonably well (gcc usually inlines memcpy here) */
246# define move_from_unaligned_int(v, intp) (memcpy(&(v), (intp), sizeof(int))) 248# define move_from_unaligned_int(v, intp) (memcpy(&(v), (intp), sizeof(int)))
247# define move_from_unaligned_long(v, longp) (memcpy(&(v), (longp), sizeof(long))) 249# define move_from_unaligned_long(v, longp) (memcpy(&(v), (longp), sizeof(long)))
@@ -387,6 +389,7 @@ typedef unsigned smalluint;
387#define HAVE_SETBIT 1 389#define HAVE_SETBIT 1
388#define HAVE_SIGHANDLER_T 1 390#define HAVE_SIGHANDLER_T 1
389#define HAVE_STPCPY 1 391#define HAVE_STPCPY 1
392#define HAVE_MEMPCPY 1
390#define HAVE_STRCASESTR 1 393#define HAVE_STRCASESTR 1
391#define HAVE_STRCHRNUL 1 394#define HAVE_STRCHRNUL 1
392#define HAVE_STRSEP 1 395#define HAVE_STRSEP 1
@@ -486,6 +489,8 @@ typedef unsigned smalluint;
486#endif 489#endif
487 490
488#if defined(__FreeBSD__) 491#if defined(__FreeBSD__)
492/* users say mempcpy is not present in FreeBSD 9.x */
493# undef HAVE_MEMPCPY
489# undef HAVE_CLEARENV 494# undef HAVE_CLEARENV
490# undef HAVE_FDATASYNC 495# undef HAVE_FDATASYNC
491# undef HAVE_MNTENT_H 496# undef HAVE_MNTENT_H
@@ -550,6 +555,18 @@ typedef void (*sighandler_t)(int);
550extern char *stpcpy(char *p, const char *to_add) FAST_FUNC; 555extern char *stpcpy(char *p, const char *to_add) FAST_FUNC;
551#endif 556#endif
552 557
558#ifndef HAVE_MEMPCPY
559#include <string.h>
560/* In case we are wrong about !HAVE_MEMPCPY, and toolchain _does_ have
561 * mempcpy(), avoid colliding with it:
562 */
563#define mempcpy bb__mempcpy
564static ALWAYS_INLINE void *mempcpy(void *dest, const void *src, size_t len)
565{
566 return memcpy(dest, src, len) + len;
567}
568#endif
569
553#ifndef HAVE_STRCASESTR 570#ifndef HAVE_STRCASESTR
554extern char *strcasestr(const char *s, const char *pattern) FAST_FUNC; 571extern char *strcasestr(const char *s, const char *pattern) FAST_FUNC;
555#endif 572#endif