More warning fixes

This commit is contained in:
Oleksandr Masliuchenko 2017-05-22 21:54:41 +03:00
parent 4fad9bf6cf
commit 8455f537b7
3 changed files with 15 additions and 15 deletions

View File

@ -42,9 +42,9 @@
// Helper macro to mark unused parameters and prevent compiler warnings. // Helper macro to mark unused parameters and prevent compiler warnings.
// Appends _UNUSED to the variable name to prevent accidentally using them. // Appends _UNUSED to the variable name to prevent accidentally using them.
#ifdef __GNUC__ #ifdef __GNUC__
#define UNUSED(x) x ## _UNUSED __attribute__((__unused__)) #define UNUSED_PARAM(x) x ## _UNUSED __attribute__((__unused__))
#else #else
#define UNUSED(x) x ## _UNUSED #define UNUSED_PARAM(x) x ## _UNUSED
#endif #endif
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
@ -65,20 +65,20 @@ extern int _getpid ( void ) ;
static unsigned char *heap_brk = NULL; static unsigned char *heap_brk = NULL;
static unsigned char *heap_end = NULL; static unsigned char *heap_end = NULL;
void setHeap(char *start, char *end) { void setHeap(unsigned char *start, unsigned char *end) {
heap_brk = start; heap_brk = start;
heap_end = end; heap_end = end;
} }
extern caddr_t _sbrk ( int incr ) extern caddr_t _sbrk ( int incr )
{ {
caddr_t *prev_heap ; caddr_t prev_heap;
if ( heap_brk == NULL ) if ( heap_brk == NULL )
{ {
heap_brk = (unsigned char *)&_end ; heap_brk = (unsigned char *)&_end ;
} }
prev_heap = heap_brk; prev_heap = (caddr_t)heap_brk;
if (heap_end != NULL && (heap_brk + incr) > heap_end) { if (heap_end != NULL && (heap_brk + incr) > heap_end) {
return (caddr_t)-1; return (caddr_t)-1;
@ -89,39 +89,39 @@ extern caddr_t _sbrk ( int incr )
return prev_heap ; return prev_heap ;
} }
extern int link( UNUSED(char *cOld), UNUSED(char *cNew) ) extern int link( UNUSED_PARAM(char *cOld), UNUSED_PARAM(char *cNew) )
{ {
return -1 ; return -1 ;
} }
extern int _close( UNUSED(int file) ) extern int _close( UNUSED_PARAM(int file) )
{ {
return -1 ; return -1 ;
} }
extern int _fstat( UNUSED(int file), struct stat *st ) extern int _fstat( UNUSED_PARAM(int file), struct stat *st )
{ {
st->st_mode = S_IFCHR ; st->st_mode = S_IFCHR ;
return 0 ; return 0 ;
} }
extern int _isatty( UNUSED(int file) ) extern int _isatty( UNUSED_PARAM(int file) )
{ {
return 1 ; return 1 ;
} }
extern int _lseek( UNUSED(int file), UNUSED(int ptr), UNUSED(int dir) ) extern int _lseek( UNUSED_PARAM(int file), UNUSED_PARAM(int ptr), UNUSED_PARAM(int dir) )
{ {
return 0 ; return 0 ;
} }
extern int _read(UNUSED(int file), UNUSED(char *ptr), UNUSED(int len) ) extern int _read(UNUSED_PARAM(int file), UNUSED_PARAM(char *ptr), UNUSED_PARAM(int len) )
{ {
return 0 ; return 0 ;
} }
extern int _write( UNUSED(int file), char *ptr, int len ) extern int _write( UNUSED_PARAM(int file), char *ptr, int len )
{ {
int iIndex = 0; int iIndex = 0;
@ -138,7 +138,7 @@ extern void _exit( int status )
for ( ; ; ) ; for ( ; ; ) ;
} }
extern void _kill( UNUSED(int pid), UNUSED(int sig) ) extern void _kill( UNUSED_PARAM(int pid), UNUSED_PARAM(int sig) )
{ {
return ; return ;
} }

View File

@ -38,7 +38,7 @@
extern "C" { extern "C" {
#endif #endif
extern void setHeap(char *start, char *end); extern void setHeap(unsigned char *start, unsigned char *end);
extern caddr_t _sbrk( int incr ) ; extern caddr_t _sbrk( int incr ) ;

View File

@ -6,7 +6,7 @@
extern "C" void preinitVariant() { extern "C" void preinitVariant() {
//Set heap to external SDRAM //Set heap to external SDRAM
setHeap((char*)0xC0000000, (char*)(0xC0000000 + 8 * 1024 * 1024)); setHeap((unsigned char*)0xC0000000, (unsigned char*)(0xC0000000 + 8 * 1024 * 1024));
} }
extern "C" void initVariant() { extern "C" void initVariant() {