From 8455f537b7937a811a635fba68909e825bad5f59 Mon Sep 17 00:00:00 2001 From: Oleksandr Masliuchenko Date: Mon, 22 May 2017 21:54:41 +0300 Subject: [PATCH] More warning fixes --- STM32/cores/arduino/syscalls.c | 26 ++++++++++----------- STM32/cores/arduino/syscalls.h | 2 +- STM32/variants/DISCOVERY_F746NG/variant.cpp | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/STM32/cores/arduino/syscalls.c b/STM32/cores/arduino/syscalls.c index 40999c1..cc85a83 100644 --- a/STM32/cores/arduino/syscalls.c +++ b/STM32/cores/arduino/syscalls.c @@ -42,9 +42,9 @@ // Helper macro to mark unused parameters and prevent compiler warnings. // Appends _UNUSED to the variable name to prevent accidentally using them. #ifdef __GNUC__ -#define UNUSED(x) x ## _UNUSED __attribute__((__unused__)) +#define UNUSED_PARAM(x) x ## _UNUSED __attribute__((__unused__)) #else -#define UNUSED(x) x ## _UNUSED +#define UNUSED_PARAM(x) x ## _UNUSED #endif /*---------------------------------------------------------------------------- @@ -65,20 +65,20 @@ extern int _getpid ( void ) ; static unsigned char *heap_brk = 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_end = end; } extern caddr_t _sbrk ( int incr ) { - caddr_t *prev_heap ; + caddr_t prev_heap; if ( heap_brk == NULL ) { heap_brk = (unsigned char *)&_end ; } - prev_heap = heap_brk; + prev_heap = (caddr_t)heap_brk; if (heap_end != NULL && (heap_brk + incr) > heap_end) { return (caddr_t)-1; @@ -89,39 +89,39 @@ extern caddr_t _sbrk ( int incr ) 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 ; } -extern int _close( UNUSED(int file) ) +extern int _close( UNUSED_PARAM(int file) ) { 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 ; return 0 ; } -extern int _isatty( UNUSED(int file) ) +extern int _isatty( UNUSED_PARAM(int file) ) { 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 ; } -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 ; } -extern int _write( UNUSED(int file), char *ptr, int len ) +extern int _write( UNUSED_PARAM(int file), char *ptr, int len ) { int iIndex = 0; @@ -138,7 +138,7 @@ extern void _exit( int status ) for ( ; ; ) ; } -extern void _kill( UNUSED(int pid), UNUSED(int sig) ) +extern void _kill( UNUSED_PARAM(int pid), UNUSED_PARAM(int sig) ) { return ; } diff --git a/STM32/cores/arduino/syscalls.h b/STM32/cores/arduino/syscalls.h index 758b0af..a3a111a 100644 --- a/STM32/cores/arduino/syscalls.h +++ b/STM32/cores/arduino/syscalls.h @@ -38,7 +38,7 @@ extern "C" { #endif -extern void setHeap(char *start, char *end); +extern void setHeap(unsigned char *start, unsigned char *end); extern caddr_t _sbrk( int incr ) ; diff --git a/STM32/variants/DISCOVERY_F746NG/variant.cpp b/STM32/variants/DISCOVERY_F746NG/variant.cpp index beef86d..bd59fc5 100644 --- a/STM32/variants/DISCOVERY_F746NG/variant.cpp +++ b/STM32/variants/DISCOVERY_F746NG/variant.cpp @@ -6,7 +6,7 @@ extern "C" void preinitVariant() { //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() {