From 85ddb2ce533cb0276aab7780238ec98e1abec2fe Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Wed, 2 May 2018 19:03:38 +0200 Subject: [PATCH] Shuffle const around gcc 8.1 complains about duplicate const, and while some of these really are duplicate, others look like they were supposed to tighten the API contract so that variables are "const pointer to const data", but didn't have that effect. BUG=b:65441143 BRANCH=none TEST=building Chrome EC as part of upstream coreboot's build with a gcc 8.1 compiler now works (better. there are other issues left) Change-Id: I6016c5f282516471746f08d5714ea07ebdd10331 Signed-off-by: Patrick Georgi Reviewed-on: https://chromium-review.googlesource.com/1039812 Commit-Ready: Patrick Georgi Tested-by: Patrick Georgi Reviewed-by: Stefan Reinauer Reviewed-by: Vincent Palatin --- chip/g/idle.c | 2 +- chip/npcx/flash.c | 2 +- common/console.c | 2 +- common/spi_flash.c | 2 +- core/cortex-m/task.c | 2 +- core/cortex-m0/task.c | 2 +- core/nds32/task.c | 2 +- include/als.h | 2 +- include/spi_flash.h | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/chip/g/idle.c b/chip/g/idle.c index 0bff45da84..dd745ec766 100644 --- a/chip/g/idle.c +++ b/chip/g/idle.c @@ -33,7 +33,7 @@ static enum { static int idle_default; -static const char const *idle_name[] = { +static const char *const idle_name[] = { "invalid", "wfi", "sleep", diff --git a/chip/npcx/flash.c b/chip/npcx/flash.c index 219347e17e..ccb5dd2470 100644 --- a/chip/npcx/flash.c +++ b/chip/npcx/flash.c @@ -399,7 +399,7 @@ static void flash_burst_write(unsigned int dest_addr, unsigned int bytes, } static int flash_program_bytes(uint32_t offset, uint32_t bytes, - const uint8_t const *data) + const uint8_t *data) { int write_size; int rv; diff --git a/common/console.c b/common/console.c index 0a8fc3c679..f4bf0b5c39 100644 --- a/common/console.c +++ b/common/console.c @@ -149,7 +149,7 @@ static const struct console_command *find_command(char *name) } -static const char const *errmsgs[] = { +static const char *const errmsgs[] = { "OK", "Unknown error", "Unimplemented", diff --git a/common/spi_flash.c b/common/spi_flash.c index b9ba3538ac..2465a18830 100644 --- a/common/spi_flash.c +++ b/common/spi_flash.c @@ -275,7 +275,7 @@ int spi_flash_erase(unsigned int offset, unsigned int bytes) * @return EC_SUCCESS, or non-zero if any error. */ int spi_flash_write(unsigned int offset, unsigned int bytes, - const uint8_t const *data) + const uint8_t *data) { int rv, write_size; diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c index b2515e4d3f..75e54f6633 100644 --- a/core/cortex-m/task.c +++ b/core/cortex-m/task.c @@ -126,7 +126,7 @@ static const struct { uint32_t r0; uint32_t pc; uint16_t stack_size; -} const tasks_init[] = { +} tasks_init[] = { TASK(IDLE, __idle, 0, IDLE_TASK_STACK_SIZE) CONFIG_TASK_LIST CONFIG_TEST_TASK_LIST diff --git a/core/cortex-m0/task.c b/core/cortex-m0/task.c index a137bf7cee..d70dff1d59 100644 --- a/core/cortex-m0/task.c +++ b/core/cortex-m0/task.c @@ -94,7 +94,7 @@ static const struct { uint32_t r0; uint32_t pc; uint16_t stack_size; -} const tasks_init[] = { +} tasks_init[] = { TASK(IDLE, __idle, 0, IDLE_TASK_STACK_SIZE) CONFIG_TASK_LIST CONFIG_TEST_TASK_LIST diff --git a/core/nds32/task.c b/core/nds32/task.c index 2de4c78303..17f02cd10e 100644 --- a/core/nds32/task.c +++ b/core/nds32/task.c @@ -109,7 +109,7 @@ static const struct { uint32_t r0; uint32_t pc; uint16_t stack_size; -} const tasks_init[] = { +} tasks_init[] = { TASK(IDLE, __idle, 0, IDLE_TASK_STACK_SIZE) CONFIG_TASK_LIST CONFIG_TEST_TASK_LIST diff --git a/include/als.h b/include/als.h index 89d1e06628..2f313fc63e 100644 --- a/include/als.h +++ b/include/als.h @@ -16,7 +16,7 @@ enum als_id; /* Initialized in board.c */ struct als_t { - const char const *name; + const char *const name; int (*init)(void); int (*read)(int *lux, int af); int attenuation_factor; diff --git a/include/spi_flash.h b/include/spi_flash.h index 4e4dd96381..fd3e06a9bc 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -120,7 +120,7 @@ int spi_flash_erase(unsigned int offset, unsigned int bytes); * @return EC_SUCCESS, or non-zero if any error. */ int spi_flash_write(unsigned int offset, unsigned int bytes, - const uint8_t const *data); + const uint8_t *data); /** * Gets the SPI flash JEDEC ID (manufacturer ID, memory type, and capacity)