由宏

时间:2017-12-05 19:01:48

标签: c arm gcc-warning

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

  

'UEZMemAlloc'冲突类型的冲突类型   '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编译器/预处理器是否变得更加挑剔?有没有办法避免这些错误? Rowley Crossworks for ARM使用GCC。

1 个答案:

答案 0 :(得分:0)

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