2009-06-04 Vladimir Serbinenko <phcoder@gmail.com>

Avoid aliases when compiling with Apple's CC for PCBIOS machine

	* kern/misc.c [APPLE_CC] (memcpy): new function
	[APPLE_CC] (memmove): likewise
	[APPLE_CC && !GRUB_UTIL] (grub_err_printf): likewise
	(memcpy): define alias conditionaly on !APPLE_CC
	(memset): likewise
	(abort): likewise
	* include/grub/misc.h (memove): don't define when both GRUB_UTIL and
	APPLE_CC are defined
	* include/grub/list.h [APPLE_CC] (grub_assert_fail): new function
	(grub_assert_fail): make prototype conditional
This commit is contained in:
phcoder 2009-06-04 21:17:05 +00:00
parent e37ffc5cf6
commit 6c68847712
4 changed files with 63 additions and 1 deletions

View file

@ -41,7 +41,18 @@ void EXPORT_FUNC(grub_list_insert) (grub_list_t *head, grub_list_t item,
/* This function doesn't exist, so if assertion is false for some reason, the
linker would fail. */
#ifdef APPLE_CC
/* This approach fails with Apple's gcc. Use grub_abort. */
#include <grub/misc.h>
static inline void *
grub_assert_fail (void)
{
grub_abort ();
return 0;
}
#else
extern void* grub_assert_fail (void);
#endif
#define GRUB_FIELD_MATCH(ptr, type, field) \
((char *) &(ptr)->field == (char *) &((type) (ptr))->field)

View file

@ -40,8 +40,10 @@ char *EXPORT_FUNC(grub_strcat) (char *dest, const char *src);
char *EXPORT_FUNC(grub_strncat) (char *dest, const char *src, int c);
/* Prototypes for aliases. */
#if !defined (GRUB_UTIL) || !defined (APPLE_CC)
void *EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n);
void *EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n);
#endif
int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n);
int EXPORT_FUNC(grub_strcmp) (const char *s1, const char *s2);