1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #1119 from Kijewski/error_old-style-definition

Exterminate old-style function definitions
This commit is contained in:
René Kijewski 2014-05-14 13:31:30 +02:00
commit 8038e96d09
29 changed files with 90 additions and 79 deletions

31
Makefile.cflags Normal file
View File

@ -0,0 +1,31 @@
# Test if the input language was specified externally.
# Otherwise test if the compiler unterstands the "-std=gnu99" flag, and use it if so.
# Otherwise test if the compiler unterstands the "-std=c99" flag, and use it if so.
ifeq ($(filter -std=%,$(CFLAGS)),)
ifeq ($(shell $(CC) -std=gnu99 -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
CFLAGS += -std=gnu99
else
ifeq ($(shell $(CC) -std=c99 -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
CFLAGS += -std=c99
endif
endif
endif
# Add `-fno-delete-null-pointer-checks` flag iff the compiler supports it.
# GCC removes moves tests whether `x == NULL`, if previously `x` or even `x->y` was accessed.
# 0x0 might be a sane memory location for embedded systems, so the test must not be removed.
# Right now clang does not use the *delete-null-pointer* optimization, and does not understand the parameter.
# Related issues: #628, #664.
ifeq ($(shell $(CC) -fno-delete-null-pointer-checks -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
ifeq ($(shell LANG=C $(CC) -fno-delete-null-pointer-checks -E - 2>&1 1>/dev/null </dev/null | grep warning: | grep -- -fno-delete-null-pointer-checks),)
CFLAGS += -fno-delete-null-pointer-checks
endif
endif
# Fast-out on old style function definitions.
# They cause unreadable error compiler errors on missing semicolons.
# Worse yet they hide errors by accepting wildcard argument types.
ifeq ($(shell $(CC) -Wstrict-prototypes -Werror=strict-prototypes -Wold-style-definition -Werror=old-style-definition -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
# duplicated parameters don't hurt
CFLAGS += -Wstrict-prototypes -Werror=strict-prototypes -Wold-style-definition -Werror=old-style-definition
endif

View File

@ -54,29 +54,8 @@ ifneq (, $(filter $(DISABLE_MODULE), $(USEMODULE)))
$(error "Required modules were disabled using DISABLE_MODULE: $(sort $(filter $(DISABLE_MODULE), $(USEMODULE)))")
endif
# Test if the input language was specified externally.
# Otherwise test if the compiler unterstands the "-std=gnu99" flag, and use it if so.
# Otherwise test if the compiler unterstands the "-std=c99" flag, and use it if so.
ifeq ($(filter -std=%,$(CFLAGS)),)
ifeq ($(shell $(CC) -std=gnu99 -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
CFLAGS += -std=gnu99
else
ifeq ($(shell $(CC) -std=c99 -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
CFLAGS += -std=c99
endif
endif
endif
# Add `-fno-delete-null-pointer-checks` flag iff the compiler supports it.
# GCC removes moves tests whether `x == NULL`, if previously `x` or even `x->y` was accessed.
# 0x0 might be a sane memory location for embedded systems, so the test must not be removed.
# Right now clang does not use the *delete-null-pointer* optimization, and does not understand the parameter.
# Related issues: #628, #664.
ifeq ($(shell $(CC) -fno-delete-null-pointer-checks -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
ifeq ($(shell LANG=C $(CC) -fno-delete-null-pointer-checks -E - 2>&1 1>/dev/null </dev/null | grep warning: | grep -- -fno-delete-null-pointer-checks),)
CFLAGS += -fno-delete-null-pointer-checks
endif
endif
# Feature test default CFLAGS and LINKFLAGS for the set compiled.
include $(RIOTBASE)/Makefile.cflags
# your binaries to link
BASELIBS += $(BINDIR)$(BOARD)_base.a

View File

@ -233,7 +233,7 @@ void msp430_init_dco(void)
#endif
}
void board_init()
void board_init(void)
{
msp430_cpu_init();
msb_ports_init();

View File

@ -60,7 +60,7 @@ void __attribute__((__no_instrument_function__)) ltc4150_sync_blocking(void)
while (!(FIO0PIN & BIT4)) {};
}
void __attribute__((__no_instrument_function__)) ltc4150_arch_init()
void __attribute__((__no_instrument_function__)) ltc4150_arch_init(void)
{
FIO0DIR |= BIT5;
FIO0SET = BIT5;

View File

@ -7,6 +7,6 @@ void change_baud(const char *baud_name);
/* called before/after using serial device, used to have terminal
* close the device.
*/
void signal_terminal();
void signal_terminal(void);
#endif // LPC2K_PGM

View File

@ -21,7 +21,7 @@
* Nothing to initialize at the moment.
* Turns the red LED on and the green LED off.
*/
void board_init()
void board_init(void)
{
LED_GREEN_OFF;
LED_RED_ON;

View File

@ -138,7 +138,7 @@ int init_tcp_socket(char *tcpport)
return s;
}
int init_unix_socket()
int init_unix_socket(void)
{
int s;
struct sockaddr_un sa;
@ -161,7 +161,7 @@ int init_unix_socket()
return s;
}
void handle_uart_in()
void handle_uart_in(void)
{
char buf[42];
int nread;
@ -198,7 +198,7 @@ void handle_uart_in()
thread_yield();
}
void handle_uart_sock()
void handle_uart_sock(void)
{
int s;
socklen_t t;
@ -226,7 +226,7 @@ void handle_uart_sock()
}
#ifdef MODULE_UART0
void _native_handle_uart0_input()
void _native_handle_uart0_input(void)
{
if (FD_ISSET(STDIN_FILENO, &_native_rfds)) {
handle_uart_in();

View File

@ -143,7 +143,8 @@ void msp430_init_dco(void)
}
}
void board_init() {
void board_init(void)
{
msp430_cpu_init();
msb_ports_init();

View File

@ -57,7 +57,7 @@ static void (*sched_cb) (uint32_t timestamp, uint32_t value) = NULL;
schedstat pidlist[MAXTHREADS];
#endif
void sched_run()
void sched_run(void)
{
sched_context_switch_request = 0;

View File

@ -32,12 +32,12 @@
#include "hwtimer.h"
#include "sched.h"
inline int thread_getpid()
inline int thread_getpid(void)
{
return active_thread->pid;
}
int thread_getlastpid()
int thread_getlastpid(void)
{
return last_pid;
}
@ -60,7 +60,7 @@ const char *thread_getname(int pid)
return sched_threads[pid]->name;
}
void thread_sleep()
void thread_sleep(void)
{
if (inISR()) {
return;

View File

@ -20,7 +20,7 @@ volatile int __inISR = 0;
char __isr_stack[MSP430_ISR_STACK_SIZE];
void thread_yield()
void thread_yield(void)
{
__save_context();
@ -84,7 +84,7 @@ char *thread_stack_init(void (*task_func)(void), void *stack_start, int stack_si
return (char *) stackptr;
}
int inISR()
int inISR(void)
{
return __inISR;
}

View File

@ -77,7 +77,7 @@ void timer_unset(short timer)
*ptr = 0;
}
unsigned long hwtimer_arch_now()
unsigned long hwtimer_arch_now(void)
{
return ((uint32_t)timer_round << 16) + TIMER_VAL_REG;
}

View File

@ -22,7 +22,7 @@
#include "irq.h"
#include "cpu.h"
unsigned int disableIRQ()
unsigned int disableIRQ(void)
{
unsigned int state;
__asm__("mov.w r2,%0" : "=r"(state));
@ -35,7 +35,7 @@ unsigned int disableIRQ()
return state;
}
unsigned int enableIRQ()
unsigned int enableIRQ(void)
{
unsigned int state;
__asm__("mov.w r2,%0" : "=r"(state));

View File

@ -179,7 +179,7 @@ void schedule_timer(void)
*
* set new system timer, call timer interrupt handler
*/
void hwtimer_isr_timer()
void hwtimer_isr_timer(void)
{
DEBUG("hwtimer_isr_timer()\n");
@ -297,7 +297,7 @@ unsigned long hwtimer_arch_now(void)
* Called once on process creation in order to mimic the behaviour a
* regular hardware timer.
*/
void native_hwtimer_pre_init()
void native_hwtimer_pre_init(void)
{
/* initialize time delta */
time_null = 0;

View File

@ -41,13 +41,13 @@
*/
void native_cpu_init(void);
void native_interrupt_init(void);
extern void native_hwtimer_pre_init();
extern void native_hwtimer_pre_init(void);
void native_irq_handler();
void native_irq_handler(void);
extern void _native_sig_leave_tramp(void);
void _native_syscall_leave();
void _native_syscall_enter();
void _native_syscall_leave(void);
void _native_syscall_enter(void);
/**
* external functions regularly wrapped in native for direct use

View File

@ -51,7 +51,7 @@ void nativenet_init(int transceiver_pid);
/**
* Shutdown transceiver
*/
void nativenet_powerdown();
void nativenet_powerdown(void);
/**
* Enable/disable monitor mode
@ -82,7 +82,7 @@ radio_address_t nativenet_set_address(radio_address_t address);
*
* @return the address
*/
radio_address_t nativenet_get_address();
radio_address_t nativenet_get_address(void);
/**
* @brief Sets the IEEE long address of the nativenet transceiver.
@ -114,7 +114,7 @@ int16_t nativenet_set_channel(uint8_t channel);
*
* @return the channel
*/
int16_t nativenet_get_channel();
int16_t nativenet_get_channel(void);
/**
* Set transceiver pan
@ -129,11 +129,11 @@ uint16_t nativenet_set_pan(uint16_t pan);
*
* @return the pan
*/
uint16_t nativenet_get_pan();
uint16_t nativenet_get_pan(void);
/**
* Enable transceiver rx mode
*/
void nativenet_switch_to_rx();
void nativenet_switch_to_rx(void);
/** @} */
#endif /* NATIVENET_H */

View File

@ -105,7 +105,7 @@ void print_sigmasks(void)
}
}
void native_print_signals()
void native_print_signals(void)
{
sigset_t p, q;
puts("native signals:\n");
@ -253,7 +253,7 @@ int _native_popsig(void)
* call signal handlers,
* restore user context
*/
void native_irq_handler()
void native_irq_handler(void)
{
int sig;

View File

@ -43,7 +43,7 @@ void lpm_init(void)
return;
}
void _native_lpm_sleep()
void _native_lpm_sleep(void)
{
#ifdef MODULE_UART0
int nfds;

View File

@ -147,7 +147,7 @@ void isr_cpu_switch_context_exit(void)
errx(EXIT_FAILURE, "2 this should have never been reached!!");
}
void cpu_switch_context_exit()
void cpu_switch_context_exit(void)
{
#ifdef NATIVE_AUTO_EXIT
if (num_tasks <= 1) {
@ -174,7 +174,7 @@ void cpu_switch_context_exit()
errx(EXIT_FAILURE, "3 this should have never been reached!!");
}
void isr_thread_yield()
void isr_thread_yield(void)
{
DEBUG("isr_thread_yield()\n");
@ -189,7 +189,7 @@ void isr_thread_yield()
}
}
void thread_yield()
void thread_yield(void)
{
ucontext_t *ctx = (ucontext_t *)(active_thread->sp);
if (_native_in_isr == 0) {
@ -209,7 +209,7 @@ void thread_yield()
}
}
void native_cpu_init()
void native_cpu_init(void)
{
if (getcontext(&end_context) == -1) {
err(EXIT_FAILURE, "end_context(): getcontext()");

View File

@ -63,7 +63,7 @@ void nativenet_init(int transceiver_pid)
_native_net_tpid = transceiver_pid;
}
void nativenet_powerdown()
void nativenet_powerdown(void)
{
return;
}
@ -80,7 +80,7 @@ int16_t nativenet_set_channel(uint8_t channel)
return _native_net_chan;
}
int16_t nativenet_get_channel()
int16_t nativenet_get_channel(void)
{
return _native_net_chan;
}
@ -91,7 +91,7 @@ uint16_t nativenet_set_pan(uint16_t pan)
return _native_net_pan;
}
uint16_t nativenet_get_pan()
uint16_t nativenet_get_pan(void)
{
return _native_net_pan;
}
@ -103,7 +103,7 @@ radio_address_t nativenet_set_address(radio_address_t address)
return _native_net_addr;
}
radio_address_t nativenet_get_address()
radio_address_t nativenet_get_address(void)
{
DEBUG("nativenet_get_address -> address = %d\n", _native_net_addr);
return _native_net_addr;
@ -131,7 +131,7 @@ int8_t nativenet_send(radio_packet_t *packet)
return send_buf(packet);
}
void nativenet_switch_to_rx()
void nativenet_switch_to_rx(void)
{
return;
}

View File

@ -136,7 +136,7 @@ void _native_log_stderr(char *stderrtype)
}
}
void daemonize()
void daemonize(void)
{
if ((_native_pid = fork()) == -1) {
err(EXIT_FAILURE, "daemonize: fork");
@ -148,7 +148,7 @@ void daemonize()
}
}
void usage_exit()
void usage_exit(void)
{
real_printf("usage: %s", _progname);

View File

@ -55,7 +55,7 @@ void (*real_free)(void *ptr);
void* (*real_calloc)(size_t nmemb, size_t size);
void* (*real_realloc)(void *ptr, size_t size);
void _native_syscall_enter()
void _native_syscall_enter(void)
{
_native_in_syscall++;
#if LOCAL_DEBUG
@ -63,7 +63,7 @@ void _native_syscall_enter()
#endif
}
void _native_syscall_leave()
void _native_syscall_leave(void)
{
#if LOCAL_DEBUG
real_write(STDERR_FILENO, "< _native_in_syscall\n", 21);

View File

@ -166,13 +166,13 @@ int border_add_addr(const char *ip_addr);
* router.
* @return This border router's current version.
*/
uint16_t get_abro_version();
uint16_t get_abro_version(void);
/**
* @brief Increments and updates the version for ABROs send by this
* router.
* @return This border router's new ABRO version.
*/
uint16_t get_next_abro_version();
uint16_t get_next_abro_version(void);
#endif /* SIXLOWDRIVER_H*/

View File

@ -153,7 +153,7 @@ cc1100_statistic_t cc1100_statistic;
// Initialization of physical layer
/*---------------------------------------------------------------------------*/
void cc1100_phy_init()
void cc1100_phy_init(void)
{
int i;

View File

@ -121,7 +121,7 @@ uint8_t cc110x_get_buffer_pos(void)
return (rx_buffer_next - 1);
}
radio_address_t cc110x_get_address()
radio_address_t cc110x_get_address(void)
{
return radio_address;
}

View File

@ -1542,7 +1542,7 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr,
packet_length = IPV6_HDR_LEN + ipv6_buf->length;
}
uint8_t lowpan_context_len()
uint8_t lowpan_context_len(void)
{
return context_len;
}
@ -1596,7 +1596,7 @@ lowpan_context_t *lowpan_context_update(uint8_t num, const ipv6_addr_t *prefix,
return context;
}
lowpan_context_t *lowpan_context_get()
lowpan_context_t *lowpan_context_get(void)
{
return contexts;
}

View File

@ -65,7 +65,7 @@ rpl_instance_t *rpl_get_instance(uint8_t instanceid)
return NULL;
}
rpl_instance_t *rpl_get_my_instance()
rpl_instance_t *rpl_get_my_instance(void)
{
for (int i = 0; i < RPL_MAX_INSTANCES; i++) {
if (instances[i].joined) {
@ -115,7 +115,7 @@ rpl_dodag_t *rpl_get_dodag(ipv6_addr_t *id)
return NULL;
}
rpl_dodag_t *rpl_get_my_dodag()
rpl_dodag_t *rpl_get_my_dodag(void)
{
for (int i = 0; i < RPL_MAX_DODAGS; i++) {
if (dodags[i].joined) {
@ -416,7 +416,7 @@ void rpl_local_repair(void)
}
ipv6_addr_t *rpl_get_my_preferred_parent()
ipv6_addr_t *rpl_get_my_preferred_parent(void)
{
rpl_dodag_t *my_dodag = rpl_get_my_dodag();

View File

@ -217,7 +217,7 @@ void dao_delay_over(void)
}
}
void dao_ack_received()
void dao_ack_received(void)
{
ack_received = true;
long_delay_dao();

View File

@ -287,7 +287,7 @@ void vtimer_get_localtime(struct tm *localt)
// TODO: fill the other fields
}
int vtimer_init()
int vtimer_init(void)
{
DEBUG("vtimer_init().\n");
int state = disableIRQ();