由宏引起的 C 类型冲突

C conflicting types caused by macro

我正在构建一些代码,这些代码用于使用旧版本的 Rowley Crossworks for ARM version 2 正确编译。现在尝试使用 Crossworks for ARM version 4 编译应用程序,以下头文件导致编译器抛出以下错误:

conflicting types for 'UEZMemAlloc'
conflicting types for 'UEZMemRealloc'

/*-------------------------------------------------------------------------*
 * File:  uEZMemory.h
 *-------------------------------------------------------------------------*
 * Description:
 *     uEZ Memory Allocation (thread safe) routines
 *-------------------------------------------------------------------------*/
#ifndef _UEZ_MEMORY_H_
#define _UEZ_MEMORY_H_

/*--------------------------------------------------------------------------
 * uEZ(R) - Copyright (C) 2007-2010 Future Designs, Inc.
 *--------------------------------------------------------------------------
 * This file is part of the uEZ(R) distribution.  See the included
 * uEZLicense.txt or visit http://www.teamfdi.com/uez for details.
 *
 *    *===============================================================*
 *    |  Future Designs, Inc. can port uEZ(tm) to your own hardware!  |
 *    |             We can get you up and running fast!               |
 *    |      See http://www.teamfdi.com/uez for more details.         |
 *    *===============================================================*
 *
 *-------------------------------------------------------------------------*/

/*-------------------------------------------------------------------------*
 * Includes:
 *-------------------------------------------------------------------------*/
#include "uEZTypes.h"

#ifndef UEZ_MEM_CHECK_MEMORY
#define UEZ_MEM_CHECK_MEMORY    0
#endif
#ifndef UEZ_MEM_CHECK_MEMORY_FAIL_CALLBACK
#define UEZ_MEM_CHECK_MEMORY_FAIL_CALLBACK 0
#endif

/*-------------------------------------------------------------------------*
 * Prototypes:
 *-------------------------------------------------------------------------*/
void UEZMemInit(void);
void *UEZMemAlloc(TUInt32 aSize);
void *UEZStackMemAlloc(TUInt32 aSize);
void UEZMemFree(void *aMemory);
void *UEZMemRealloc(void *aMemory, TUInt32 aSize); //NOT IMPLEMENTED YET
void *UEZMemAllocPermanent(TUInt32 aSize);
void *UEZPlatformMemAllocPermanent(TUInt32 aSize);

#if UEZ_MEM_CHECK_MEMORY_FAIL_CALLBACK
void UEZMemFailedCallback(void);
#endif
#if UEZ_MEM_CHECK_MEMORY
TUInt32 UEZMemGetSize(void *aMemory);
TUInt32 UEZMemGetNumBlocks(void);
#endif

/*-------------------------------------------------------------------------*
 * Macros:
 *-------------------------------------------------------------------------*/
// Provide standard C compatible routines
#define malloc(a)           UEZMemAlloc(a)
#define free(a)             UEZMemFree(a)
#define realloc(a, b)       UEZMemRealloc(a, b)


#endif // _UEZ_MEMORY_H_

/*-------------------------------------------------------------------------*
 * End of File:  uEZMemory.h
 *-------------------------------------------------------------------------*/

在我看来,较新的编译器现在对以下问题感到恼火:

#define malloc(a)           UEZMemAlloc(a)
#define realloc(a, b)       UEZMemRealloc(a, b)

我正在使用的 uEZ 库 documentation here. 似乎表明它是故意的。随着时间的推移,gcc compiler/preprocessor 变得更加挑剔了吗?有没有办法避免这些错误? Rowley Crossworks for ARM 使用 GCC。

解决方案是修改 Config_Build.h 文件,导致编译不更改某些标准 C 类型的类型。