Permalink
Browse files

cortex: anotate unused parameters, cleanup range checks.

  • Loading branch information...
1 parent ad3e418 commit 2bd9f4581322ae0d6a72a08df506468d08403f42 @jmesmon jmesmon committed Jan 14, 2011
Showing with 14 additions and 11 deletions.
  1. +1 −1 arch_cortex/exti.c
  2. +4 −3 arch_cortex/hax.c
  3. +1 −2 arch_cortex/spi.c
  4. +6 −5 arch_cortex/syscall.c
  5. +2 −0 compilers.h
View
@@ -76,7 +76,7 @@ void digital_setup(index_t index, bool output)
index_t pin = index - IX_DIGITAL(1);
if (!DIG_VALID(pin)) {
WARN_IX(index);
- return
+ return;
}
GPIO_InitTypeDef param;
View
@@ -85,12 +85,13 @@ ctrl_mode_t ctrl_mode_get(void) {
*/
uint16_t analog_get(index_t ix)
{
- if (IX_ANALOG(1) <= ix && ix <= IX_ANALOG(CT_ANALOG)) {
- return adc_buffer[ix - IX_ANALOG(1)];
- } else {
+ index_t i = ix - IX_ANALOG(1);
+ if (!(i < CT_ANALOG)) {
WARN_IX(ix);
return 0;
}
+
+ return adc_buffer[i];
}
/*
View
@@ -221,9 +221,8 @@ bool is_master_ready(void)
!GPIO_ReadInputDataBit(GPIOE,GPIO_Pin_4);
}
-void spi_packet_init_m2u(spi_packet_m2u_t *m2u)
+void spi_packet_init_m2u(spi_packet_m2u_t __unused *m2u)
{
-
}
void spi_packet_init_u2m(spi_packet_u2m_t *u2m)
View
@@ -1,5 +1,6 @@
#include "stm32f10x.h"
+#include "compilers.h"
#include <reent.h>
#include <errno.h>
#include <sys/types.h>
@@ -101,22 +102,22 @@ caddr_t _sbrk(int incr)
return (caddr_t) prev_heap_end;
}
-int _close(int fd)
+int _close(int __unused fd)
{
return -1;
}
-int _fstat(int fd, struct stat *st)
+int _fstat(int __unused fd, struct stat *st)
{
st->st_mode = S_IFCHR;
return 0;
}
-int _lseek(int fd, int ptr, int dir) {
+int _lseek(int __unused fd, int __unused ptr, int __unused dir) {
return 0;
}
-int _read(int fd, char *ptr, int len)
+int _read(int __unused fd, char __unused *ptr, int __unused len)
{
return 0;
}
@@ -125,7 +126,7 @@ int _read(int fd, char *ptr, int len)
// 1 means we are connected to a term.
// 0 means not ^.
-int _isatty(int fd)
+int _isatty(int __unused fd)
{
return 1;
}
View
@@ -7,11 +7,13 @@
# define __noreturn
# define __rom rom
# define __overlay overlay
+# define __unused
#elif defined(__GNUC__)
# define GCC 1
# define __noreturn __attribute__((noreturn))
# define __rom
# define __overlay
+# define __unused __attribute__((unused))
#elif defined(SDCC)
# define __rom __code
# define __noreturn

0 comments on commit 2bd9f45

Please sign in to comment.