A comment in https://bugs.kde.org/show_bug.cgi?id=519604 about correctly checking
for DARWIN_VERS led me to doing some builds with -Wundef. We still get quite a few
warnings from mips and LZO. I'll repeat the exercise on illumos Darwin and Linux amd64.
return VG_(do_syscall2)(__NR_munmap, (UWord)start, length );
}
-#if HAVE_MREMAP
+#ifdef HAVE_MREMAP
/* The following are used only to implement mremap(). */
SysRes ML_(am_do_extend_mapping_NO_NOTIFY)(
/* --- --- --- resizing/move a mapping --- --- --- */
-#if HAVE_MREMAP
+#ifdef HAVE_MREMAP
/* This function grows a client mapping in place into an adjacent free segment.
ADDR is the client mapping's start address and DELTA, which must be page
di->ddump_frames = VG_(clo_debug_dump_frames);
}
-#if DARWIN_VERS >= DARWIN_11_00
+#if defined(VGO_darwin) && (DARWIN_VERS >= DARWIN_11_00)
di->from_memory = False;
#endif
# undef HAVE_MEMSET
#endif
+// despite all of the above macro nastiness the code that
+// uses these macros still mixes up undefined and defined to 0
+#if !defined(HAVE_MEMCMP)
+#define HAVE_MEMCMP 0
+#endif
+
+#if !defined(HAVE_MEMCPY)
+#define HAVE_MEMCPY 0
+#endif
+
+#if !defined(HAVE_MEMMOVE)
+#define HAVE_MEMMOVE 0
+#endif
+
+#if !defined(HAVE_MEMSET)
+#define HAVE_MEMSET 0
+#endif
+
#if !(HAVE_MEMCMP)
# undef memcmp
# define memcmp(a,b,c) lzo_memcmp(a,b,c)
easily be invoked hundreds of thousands of times. */
DebugInfoMapping* last_rx_map;
-#if DARWIN_VERS >= DARWIN_11_00
+#if defined(VGO_darwin) && (DARWIN_VERS >= DARWIN_11_00)
/* Indicate that this debug info was loaded from memory (i.e. DSC)
instead than from a file. This means that some data might be missing (e.g. rw data). */
Bool from_memory;
Useful for register and int image */
char* heximage (char *buf, const char *bin, int count)
{
-#if (VKI_LITTLE_ENDIAN)
+#if defined(VKI_LITTLE_ENDIAN)
char rev[count];
/* note: no need for trailing \0, length is known with count */
int i;
}
#endif
-#if HAVE_MREMAP
+#ifdef HAVE_MREMAP
/* Expand (or shrink) an existing mapping, potentially moving it at
the same time (controlled by the MREMAP_MAYMOVE flag). Nightmare.
*/
}
#endif
-#if HAVE_MREMAP
+#ifdef HAVE_MREMAP
PRE(sys_mremap)
{
// Nb: this is different to the glibc version described in the man pages,
#ifndef VKI_AMD64_FREEBSD_H
#define VKI_AMD64_FREEBSD_H
+#define VKI_LITTLE_ENDIAN 1
+
/* PAGE_SHIFT determines the page size. */
#define VKI_PAGE_SHIFT 12UL
#define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT)
#ifndef VKI_ARM64_FREEBSD_H
#define VKI_ARM64_FREEBSD_H
+#define VKI_LITTLE_ENDIAN 1
+
//----------------------------------------------------------------------
// arm/param.h
//----------------------------------------------------------------------
#ifndef VKI_X86_FREEBSD_H
#define VKI_X86_FREEBSD_H
+#define VKI_LITTLE_ENDIAN 1
+
//----------------------------------------------------------------------
// From somewhere
//----------------------------------------------------------------------