Skip to content

Commit

Permalink
making the pedantic gcc happy
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegHahm committed Nov 23, 2013
1 parent 07b541b commit 1f50d91
Show file tree
Hide file tree
Showing 17 changed files with 65 additions and 19 deletions.
2 changes: 2 additions & 0 deletions cpu/arm_common/syscalls.c
Expand Up @@ -264,6 +264,8 @@ int _getpid(void)
/*---------------------------------------------------------------------------*/
int _kill_r(struct _reent *r, int pid, int sig)
{
(void) pid;
(void) sig;
/* not implemented */
r->_errno = ESRCH; // no such process
return -1;
Expand Down
2 changes: 1 addition & 1 deletion cpu/lpc2387/cpu.c
Expand Up @@ -70,7 +70,7 @@ void cpu_clock_scale(uint32_t source, uint32_t target, uint32_t *prescale)
******************************************************************************/
#define VIC_BASE_ADDR 0xFFFFF000

bool install_irq(int IntNumber, void *HandlerAddr, int Priority)
bool install_irq(int IntNumber, void (*HandlerAddr)(void), int Priority)
{
int *vect_addr;
int *vect_cntl;
Expand Down
2 changes: 2 additions & 0 deletions cpu/lpc2387/gpioint/lpc2387-gpioint.c
Expand Up @@ -116,6 +116,8 @@ gpioint_set(int port, uint32_t bitmask, int flags, fp_irqcb callback)
/*---------------------------------------------------------------------------*/
static void __attribute__((__no_instrument_function__)) test_irq(int port, unsigned long f_mask, unsigned long r_mask, struct irq_callback_t *pcb)
{
(void) port;

/* Test each bit of rising and falling masks, if set trigger interrupt
* on corresponding device */
do {
Expand Down
2 changes: 1 addition & 1 deletion cpu/lpc2387/include/cpu.h
Expand Up @@ -26,7 +26,7 @@ License. See the file LICENSE in the top level directory for more details.
extern uintptr_t __stack_start; ///< end of user stack memory space

void lpc2387_pclk_scale(uint32_t source, uint32_t target, uint32_t *pclksel, uint32_t *prescale);
bool install_irq(int IntNumber, void *HandlerAddr, int Priority);
bool install_irq(int IntNumber, void (*HandlerAddr)(void), int Priority);

/** @} */
#endif /* __CPU_H */
2 changes: 1 addition & 1 deletion cpu/lpc2387/lpc23xx-iap.c
Expand Up @@ -4,7 +4,7 @@

uint8_t iap_get_sector(uint32_t addr)
{
if ((addr >= 0x00000000) && (addr <= 0x00000FFF)) {
if (addr <= 0x00000FFF) {
return 0;
}

Expand Down
3 changes: 3 additions & 0 deletions cpu/lpc_common/profiling.c
Expand Up @@ -58,6 +58,8 @@ static int16_t __attribute__((__no_instrument_function__)) get_function_index(ui

void __attribute__((__no_instrument_function__)) __cyg_profile_func_enter(void *func, void *caller)
{
(void) caller;

if (!profiling) {
return;
}
Expand Down Expand Up @@ -94,6 +96,7 @@ void __attribute__((__no_instrument_function__)) __cyg_profile_func_enter(void

void __attribute__((__no_instrument_function__)) __cyg_profile_func_exit(void *func, void *caller)
{
(void) caller;
if (!profiling) {
return;
}
Expand Down
9 changes: 3 additions & 6 deletions drivers/cc110x/cc1100-csmaca-mac.c
Expand Up @@ -50,12 +50,13 @@ static double collisions_per_sec = 0;
static int collision_state = COLLISION_STATE_INITIAL;
static uint64_t collision_measurement_start = 0;

volatile static int cs_hwtimer_id = -1;
volatile static int cs_timeout_flag = 0;
static volatile int cs_hwtimer_id = -1;
static volatile int cs_timeout_flag = 0;

/*---------------------------------------------------------------------------*/
static void cs_timeout_cb(void *ptr)
{
(void) ptr;
cs_timeout_flag = 1;
}

Expand Down Expand Up @@ -182,10 +183,6 @@ int cc1100_send_csmaca(radio_address_t address, protocol_t protocol, int priorit

backoff = rand() % windowSize; /* ...and choose new backoff */

if (backoff < 0) {
backoff *= -1;
}

backoff += (uint16_t) 1;
cycle:
cs_timeout_flag = 0; /* Carrier sense timeout flag */
Expand Down
3 changes: 3 additions & 0 deletions drivers/cc110x/cc1100.c
Expand Up @@ -318,6 +318,7 @@ void switch_to_wor2(void)
*/
static void hwtimer_switch_to_wor2_wrapper(void *ptr)
{
(void) ptr;
wor_hwtimer_id = -1; /* kernel timer handler function called, clear timer id */

if (rflags.TX) {
Expand Down Expand Up @@ -531,6 +532,8 @@ char *cc1100_state_to_text(uint8_t state)

void cc1100_hwtimer_go_receive_wrapper(void *ptr)
{
(void) ptr;

/* kernel timer handler function called, clear timer id */
wor_hwtimer_id = -1;

Expand Down
6 changes: 4 additions & 2 deletions drivers/cc110x/cc1100_phy.c
Expand Up @@ -138,7 +138,7 @@ uint16_t cc1100_burst_count; ///< Burst count, number of packets in a burst tr
uint8_t cc1100_retransmission_count_uc; ///< Number of retransmissions for unicast
uint8_t cc1100_retransmission_count_bc; ///< Number of retransmissions for broadcast

const static double duty_cycle[2][DUTY_CYCLE_SIZE] = { ///< Duty cycle values from AN047
static const double duty_cycle[2][DUTY_CYCLE_SIZE] = { ///< Duty cycle values from AN047
{12.5, 6.25, 3.125, 1.563, 0.781, 0.391, 0.195},
{1.95, 0.9765, 0.4883, 0.2441, 0.1221, 0.061035, 0.030518}
};
Expand Down Expand Up @@ -279,7 +279,7 @@ void cc1100_print_config(void)

inline uint16_t iround(double d)
{
return (uint16_t) d < 0 ? d - .5 : d + .5;
return (uint16_t) (d + 0.5);
}

int cc1100_phy_calc_wor_settings(uint16_t millis)
Expand Down Expand Up @@ -513,6 +513,8 @@ static bool send_burst(cc1100_packet_layer0_t *packet, uint8_t retries, uint8_t

int cc1100_send(radio_address_t addr, protocol_t protocol, int priority, char *payload, int payload_len)
{
(void) priority;

bool result;
int return_code;
uint8_t address;
Expand Down
21 changes: 20 additions & 1 deletion sys/net/destiny/socket.c
Expand Up @@ -519,6 +519,8 @@ void set_tcp_cb(tcp_cb_t *tcp_control, uint32_t rcv_nxt, uint16_t rcv_wnd,

int destiny_socket_connect(int socket, sockaddr6_t *addr, uint32_t addrlen)
{
(void) addrlen;

/* Variables */
ipv6_addr_t src_addr;
socket_internal_t *current_int_tcp_socket;
Expand Down Expand Up @@ -715,9 +717,12 @@ void calculate_rto(tcp_cb_t *tcp_control, long current_time)

int32_t destiny_socket_send(int s, const void *buf, uint32_t len, int flags)
{
(void) flags;

/* Variables */
msg_t recv_msg;
int32_t sent_bytes = 0, total_sent_bytes = 0;
int32_t sent_bytes = 0;
uint32_t total_sent_bytes = 0;
socket_internal_t *current_int_tcp_socket;
socket_t *current_tcp_socket;
uint8_t send_buffer[BUFFER_SIZE];
Expand Down Expand Up @@ -915,6 +920,8 @@ uint8_t read_from_socket(socket_internal_t *current_int_tcp_socket,

int32_t destiny_socket_recv(int s, void *buf, uint32_t len, int flags)
{
(void) flags;

/* Variables */
uint8_t read_bytes;
msg_t m_recv, m_send;
Expand Down Expand Up @@ -958,6 +965,8 @@ int32_t destiny_socket_recv(int s, void *buf, uint32_t len, int flags)
int32_t destiny_socket_recvfrom(int s, void *buf, uint32_t len, int flags,
sockaddr6_t *from, uint32_t *fromlen)
{
(void) flags;

if (isUDPSocket(s)) {
msg_t m_recv, m_send;
ipv6_hdr_t *ipv6_header;
Expand Down Expand Up @@ -994,6 +1003,9 @@ int32_t destiny_socket_recvfrom(int s, void *buf, uint32_t len, int flags,
int32_t destiny_socket_sendto(int s, const void *buf, uint32_t len, int flags,
sockaddr6_t *to, uint32_t tolen)
{
(void) flags;
(void) tolen;

if (isUDPSocket(s) &&
(get_socket(s)->socket_values.foreign_address.sin6_port == 0)) {
uint8_t send_buffer[BUFFER_SIZE];
Expand Down Expand Up @@ -1161,6 +1173,8 @@ int destiny_socket_bind(int s, sockaddr6_t *addr, int addrlen)

int destiny_socket_listen(int s, int backlog)
{
(void) backlog;

if (is_tcp_socket(s) && get_socket(s)->socket_values.tcp_control.state == CLOSED) {
socket_internal_t *current_socket = get_socket(s);
current_socket->socket_values.tcp_control.state = LISTEN;
Expand Down Expand Up @@ -1204,6 +1218,8 @@ socket_internal_t *get_waiting_connection_socket(int socket,
int handle_new_tcp_connection(socket_internal_t *current_queued_int_socket,
socket_internal_t *server_socket, uint8_t pid)
{
(void) pid;

msg_t msg_recv_client_ack, msg_send_client_ack;
socket_t *current_queued_socket = &current_queued_int_socket->socket_values;
uint8_t send_buffer[BUFFER_SIZE];
Expand Down Expand Up @@ -1289,6 +1305,9 @@ int handle_new_tcp_connection(socket_internal_t *current_queued_int_socket,

int destiny_socket_accept(int s, sockaddr6_t *addr, uint32_t *addrlen)
{
(void) addr;
(void) addrlen;

socket_internal_t *server_socket = get_socket(s);

if (is_tcp_socket(s) && (server_socket->socket_values.tcp_control.state == LISTEN)) {
Expand Down
12 changes: 12 additions & 0 deletions sys/net/destiny/tcp.c
Expand Up @@ -76,6 +76,8 @@ uint16_t tcp_csum(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header)
uint8_t handle_payload(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
socket_internal_t *tcp_socket, uint8_t *payload)
{
(void) tcp_header;

msg_t m_send_tcp, m_recv_tcp;
uint8_t tcp_payload_len = ipv6_header->length - TCP_HDR_LEN;
uint8_t acknowledged_bytes = 0;
Expand Down Expand Up @@ -145,6 +147,10 @@ void handle_tcp_ack_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
void handle_tcp_rst_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
socket_internal_t *tcp_socket)
{
(void) ipv6_header;
(void) tcp_header;
(void) tcp_socket;

/* TODO: Reset connection */
}

Expand Down Expand Up @@ -180,6 +186,8 @@ void handle_tcp_syn_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
void handle_tcp_syn_ack_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
socket_internal_t *tcp_socket)
{
(void) ipv6_header;

msg_t m_send_tcp;

if (tcp_socket->socket_values.tcp_control.state == SYN_SENT) {
Expand All @@ -194,6 +202,8 @@ void handle_tcp_syn_ack_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
void handle_tcp_fin_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
socket_internal_t *tcp_socket)
{
(void) ipv6_header;

msg_t m_send;
socket_t *current_tcp_socket = &tcp_socket->socket_values;
uint8_t send_buffer[BUFFER_SIZE];
Expand Down Expand Up @@ -225,6 +235,8 @@ void handle_tcp_fin_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
void handle_tcp_fin_ack_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
socket_internal_t *tcp_socket)
{
(void) ipv6_header;

msg_t m_send;
socket_t *current_tcp_socket = &tcp_socket->socket_values;
uint8_t send_buffer[BUFFER_SIZE];
Expand Down
2 changes: 0 additions & 2 deletions sys/net/destiny/udp.c
Expand Up @@ -48,15 +48,13 @@ void udp_packet_handler(void)
msg_t m_recv_ip, m_send_ip, m_recv_udp, m_send_udp;
ipv6_hdr_t *ipv6_header;
udp_hdr_t *udp_header;
uint8_t *payload;
socket_internal_t *udp_socket = NULL;
uint16_t chksum;

while (1) {
msg_receive(&m_recv_ip);
ipv6_header = ((ipv6_hdr_t *)m_recv_ip.content.ptr);
udp_header = ((udp_hdr_t *)(m_recv_ip.content.ptr + IPV6_HDR_LEN));
payload = (uint8_t *)(m_recv_ip.content.ptr + IPV6_HDR_LEN + UDP_HDR_LEN);

chksum = udp_csum(ipv6_header, udp_header);

Expand Down
2 changes: 1 addition & 1 deletion sys/net/net_help/inet_ntop.c
Expand Up @@ -145,7 +145,7 @@ static const char *inet_ntop6(const unsigned char *src, char *dst, size_t size)
*/
tp = tmp;

for (i = 0; i < (IN6ADDRSZ / INT16SZ);) {
for (i = 0; i < ((int) (IN6ADDRSZ / INT16SZ));) {
/* Are we inside the best run of 0x00's? */
if (i == best.base) {
*tp++ = ':';
Expand Down
4 changes: 4 additions & 0 deletions sys/net/rpl/of0.c
Expand Up @@ -30,6 +30,8 @@ rpl_of_t rpl_of0 = {
which_parent,
which_dodag,
reset,
NULL,
NULL,
NULL
};

Expand All @@ -41,6 +43,7 @@ rpl_of_t *rpl_get_of0(void)
void reset(rpl_dodag_t *dodag)
{
/* Nothing to do in OF0 */
(void) dodag;
}

uint16_t calc_rank(rpl_parent_t *parent, uint16_t base_rank)
Expand Down Expand Up @@ -82,5 +85,6 @@ rpl_parent_t *which_parent(rpl_parent_t *p1, rpl_parent_t *p2)
/* Not used yet, as the implementation only makes use of one dodag for now. */
rpl_dodag_t *which_dodag(rpl_dodag_t *d1, rpl_dodag_t *d2)
{
(void) d2;
return d1;
}
4 changes: 2 additions & 2 deletions sys/posix/strings.c
Expand Up @@ -3,7 +3,7 @@

int strncasecmp(const char *s1, const char *s2, size_t n)
{
while (n-- && tolower(*s1) == tolower(*s2)) {
while (n-- && tolower((unsigned char) *s1) == tolower((unsigned char) *s2)) {
if (!n && !*s1) {
break;
}
Expand All @@ -12,5 +12,5 @@ int strncasecmp(const char *s1, const char *s2, size_t n)
s2++;
}

return (tolower(*s1) - tolower(*s2));
return (tolower((unsigned char) *s1) - tolower((unsigned char) *s2));
}
4 changes: 4 additions & 0 deletions sys/transceiver/transceiver.c
Expand Up @@ -903,6 +903,8 @@ static int16_t set_address(transceiver_type_t t, void *address)
*/
static void set_monitor(transceiver_type_t t, void *mode)
{
(void) mode;

switch(t) {
#ifdef MODULE_CC110X_NG
case TRANSCEIVER_CC1100:
Expand Down Expand Up @@ -931,6 +933,8 @@ static void set_monitor(transceiver_type_t t, void *mode)
#ifdef MODULE_CC110X
void cc1100_packet_monitor(void *payload, int payload_size, protocol_t protocol, packet_info_t *packet_info)
{
(void) protocol;

cc1100_payload = payload;
cc1100_payload_size = payload_size - 3;
cc1100_packet_info = packet_info;
Expand Down
4 changes: 2 additions & 2 deletions sys/vtimer/vtimer.c
Expand Up @@ -125,13 +125,13 @@ void vtimer_callback(void *ptr)
DEBUG("vtimer_callback(): Shooting %" PRIu32 ".\n", timer->absolute.microseconds);

/* shoot timer */
if (timer->action == (void *) msg_send_int) {
if (timer->action == (void (*)(void *)) msg_send_int) {
msg_t msg;
msg.type = MSG_TIMER;
msg.content.value = (unsigned int) timer->arg;
msg_send_int(&msg, timer->pid);
}
else if (timer->action == (void*) thread_wakeup){
else if (timer->action == (void (*)(void *)) thread_wakeup){
timer->action(timer->arg);
}
else {
Expand Down

0 comments on commit 1f50d91

Please sign in to comment.