Skip to content
Snippets Groups Projects
Commit ccb9179c authored by Oleg Hahm's avatar Oleg Hahm Committed by GitHub
Browse files

Merge pull request #5824 from kaspar030/change_default_c_dialect

make: use -std=c99 as default
parents d1b370ec 1f70e65f
No related branches found
No related tags found
No related merge requests found
# Test if the input language was specified externally. # 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. # Otherwise test if the compiler unterstands the "-std=c99" flag, and use it if so.
ifeq ($(filter -std=%,$(CFLAGS)),) ifeq ($(filter -std=%,$(CFLAGS)),)
ifeq ($(shell $(CC) -std=gnu99 -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0) ifeq ($(shell $(CC) -std=c99 -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
CFLAGS += -std=gnu99 CFLAGS += -std=c99
else
ifeq ($(shell $(CC) -std=c99 -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
CFLAGS += -std=c99
endif
endif endif
endif endif
......
...@@ -46,7 +46,7 @@ export CGANNOTATE ?= cg_annotate ...@@ -46,7 +46,7 @@ export CGANNOTATE ?= cg_annotate
export GPROF ?= gprof export GPROF ?= gprof
# basic cflags: # basic cflags:
export CFLAGS += -Wall -Wextra -pedantic export CFLAGS += -Wall -Wextra -pedantic -std=gnu99
ifeq ($(shell uname -m),x86_64) ifeq ($(shell uname -m),x86_64)
export CFLAGS += -m32 export CFLAGS += -m32
endif endif
......
...@@ -42,11 +42,11 @@ ...@@ -42,11 +42,11 @@
j = k > 400 ? 800 - k : k; \ j = k > 400 ? 800 - k : k; \
led##_ON; \ led##_ON; \
for(i = 0; i < j; ++i) { \ for(i = 0; i < j; ++i) { \
asm("nop"); \ __asm__("nop"); \
} \ } \
led##_OFF; \ led##_OFF; \
for(i = 0; i < 400 - j; ++i) { \ for(i = 0; i < 400 - j; ++i) { \
asm("nop"); \ __asm__("nop"); \
} \ } \
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
export TARGET_ARCH ?= msp430 export TARGET_ARCH ?= msp430
# define build specific options # define build specific options
CFLAGS_CPU = -mmcu=$(CPU_MODEL) CFLAGS_CPU = -mmcu=$(CPU_MODEL) -std=gnu99
CFLAGS_LINK = -ffunction-sections -fdata-sections CFLAGS_LINK = -ffunction-sections -fdata-sections
CFLAGS_DBG = -gdwarf-2 CFLAGS_DBG = -gdwarf-2
CFLAGS_OPT ?= -Os CFLAGS_OPT ?= -Os
......
...@@ -49,12 +49,12 @@ void init8_ovr(void) __attribute__((naked)) __attribute__((section(".init8"))); ...@@ -49,12 +49,12 @@ void init8_ovr(void) __attribute__((naked)) __attribute__((section(".init8")));
void init7_ovr(void) void init7_ovr(void)
{ {
asm("call reset_handler"); __asm__("call reset_handler");
} }
void init8_ovr(void) void init8_ovr(void)
{ {
asm("jmp exit"); __asm__("jmp exit");
} }
/** /**
* @brief This function is the entry point after a system reset * @brief This function is the entry point after a system reset
......
...@@ -249,7 +249,7 @@ int spi_transfer_byte(spi_t dev, char out, char *in) ...@@ -249,7 +249,7 @@ int spi_transfer_byte(spi_t dev, char out, char *in)
int spi_transfer_bytes(spi_t dev, char *out, char *in, unsigned int length) int spi_transfer_bytes(spi_t dev, char *out, char *in, unsigned int length)
{ {
cc2538_ssi_t* ssi = spi_config[dev].dev; cc2538_ssi_t* ssi = spi_config[dev].dev;
typeof(length) tx_n = 0, rx_n = 0; unsigned int tx_n = 0, rx_n = 0;
if ((unsigned int)dev >= SPI_NUMOF) { if ((unsigned int)dev >= SPI_NUMOF) {
return -1; return -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment