Skip to content

Commit

Permalink
compiler: replaced noreturn by __noreturn__ in header files
Browse files Browse the repository at this point in the history
* noreturn may be replaced by third-party macros,
  rendering it ineffective

* Closes #11339
  • Loading branch information
0xjakob committed May 11, 2023
1 parent 7bf21e9 commit c8791f3
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int bootloader_utility_get_selected_boot_partition(const bootloader_state_t *bs)
* @param[in] bs Bootloader state structure.
* @param[in] start_index The index from which the search for images begins.
*/
__attribute__((noreturn)) void bootloader_utility_load_boot_image(const bootloader_state_t *bs, int start_index);
__attribute__((__noreturn__)) void bootloader_utility_load_boot_image(const bootloader_state_t *bs, int start_index);

#ifdef CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP
/**
Expand All @@ -65,7 +65,7 @@ void bootloader_utility_load_boot_image_from_deep_sleep(void);
*
* It is not recommended to call this function from an app (if called, the app will abort).
*/
__attribute__((noreturn)) void bootloader_reset(void);
__attribute__((__noreturn__)) void bootloader_reset(void);

/**
* @brief Do any cleanup before exiting the bootloader, before starting the app or resetting
Expand Down
2 changes: 1 addition & 1 deletion components/esp_common/include/esp_err.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const char *esp_err_to_name(esp_err_t code);
const char *esp_err_to_name_r(esp_err_t code, char *buf, size_t buflen);

/** @cond */
void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const char *function, const char *expression) __attribute__((noreturn));
void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const char *function, const char *expression) __attribute__((__noreturn__));

/** @cond */
void _esp_error_check_failed_without_abort(esp_err_t rc, const char *file, int line, const char *function, const char *expression);
Expand Down
4 changes: 2 additions & 2 deletions components/esp_hw_support/include/esp_sleep.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ esp_err_t esp_sleep_pd_config(esp_sleep_pd_domain_t domain,
*
* This function does not return.
*/
void esp_deep_sleep_start(void) __attribute__((noreturn));
void esp_deep_sleep_start(void) __attribute__((__noreturn__));

/**
* @brief Enter light sleep with the configured wakeup options
Expand Down Expand Up @@ -455,7 +455,7 @@ esp_err_t esp_light_sleep_start(void);
*
* @param time_in_us deep-sleep time, unit: microsecond
*/
void esp_deep_sleep(uint64_t time_in_us) __attribute__((noreturn));
void esp_deep_sleep(uint64_t time_in_us) __attribute__((__noreturn__));


/**
Expand Down
2 changes: 1 addition & 1 deletion components/esp_rom/include/esp32/rom/rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ static inline void rtc_suppress_rom_log(void)
*
* @return None
*/
void __attribute__((noreturn)) software_reset(void);
void __attribute__((__noreturn__)) software_reset(void);

/**
* @brief Software Reset digital core.
Expand Down
2 changes: 1 addition & 1 deletion components/esp_rom/include/esp32c2/rom/libc_stubs.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct syscall_stub_table
void (*_retarget_lock_release_recursive)(_LOCK_T lock);
int (*_printf_float)(struct _reent *data, void *pdata, FILE * fp, int (*pfunc) (struct _reent *, FILE *, const char *, size_t len), va_list * ap);
int (*_scanf_float) (struct _reent *rptr, void *pdata, FILE *fp, va_list *ap);
void (*__assert_func) (const char *file, int line, const char * func, const char *failedexpr) __attribute__((noreturn));
void (*__assert_func) (const char *file, int line, const char * func, const char *failedexpr) __attribute__((__noreturn__));
void (*__sinit) (struct _reent *r);
void (*_cleanup_r) (struct _reent* r);
};
Expand Down
20 changes: 6 additions & 14 deletions components/esp_rom/include/esp32c3/rom/libc_stubs.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _ROM_LIBC_STUBS_H_
#define _ROM_LIBC_STUBS_H_

Expand Down Expand Up @@ -77,7 +69,7 @@ struct syscall_stub_table
void (*_retarget_lock_release_recursive)(_LOCK_T lock);
int (*_printf_float)(struct _reent *data, void *pdata, FILE * fp, int (*pfunc) (struct _reent *, FILE *, const char *, size_t len), va_list * ap);
int (*_scanf_float) (struct _reent *rptr, void *pdata, FILE *fp, va_list *ap);
void (*__assert_func) (const char *file, int line, const char * func, const char *failedexpr) __attribute__((noreturn));
void (*__assert_func) (const char *file, int line, const char * func, const char *failedexpr) __attribute__((__noreturn__));
void (*__sinit) (struct _reent *r);
void (*_cleanup_r) (struct _reent* r);
};
Expand Down
4 changes: 2 additions & 2 deletions components/esp_rom/include/esp32c6/rom/libc_stubs.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -68,7 +68,7 @@ struct syscall_stub_table {
void (*_retarget_lock_release_recursive)(_LOCK_T lock);
int (*_printf_float)(struct _reent *data, void *pdata, FILE *fp, int (*pfunc) (struct _reent *, FILE *, const char *, size_t len), va_list *ap);
int (*_scanf_float) (struct _reent *rptr, void *pdata, FILE *fp, va_list *ap);
void (*__assert_func) (const char *file, int line, const char *func, const char *failedexpr) __attribute__((noreturn));
void (*__assert_func) (const char *file, int line, const char *func, const char *failedexpr) __attribute__((__noreturn__));
void (*__sinit) (struct _reent *r);
void (*_cleanup_r) (struct _reent *r);
};
Expand Down
4 changes: 2 additions & 2 deletions components/esp_rom/include/esp32h2/rom/libc_stubs.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -69,7 +69,7 @@ struct syscall_stub_table
void (*_retarget_lock_release_recursive)(_LOCK_T lock);
int (*_printf_float)(struct _reent *data, void *pdata, FILE * fp, int (*pfunc) (struct _reent *, FILE *, const char *, size_t len), va_list * ap);
int (*_scanf_float) (struct _reent *rptr, void *pdata, FILE *fp, va_list *ap);
void (*__assert_func) (const char *file, int line, const char * func, const char *failedexpr) __attribute__((noreturn));
void (*__assert_func) (const char *file, int line, const char * func, const char *failedexpr) __attribute__((__noreturn__));
void (*__sinit) (struct _reent *r);
void (*_cleanup_r) (struct _reent* r);
};
Expand Down
20 changes: 6 additions & 14 deletions components/esp_rom/include/esp32s3/rom/libc_stubs.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

Expand Down Expand Up @@ -78,7 +70,7 @@ struct syscall_stub_table
void (*_retarget_lock_release_recursive)(_LOCK_T lock);
int (*_printf_float)(struct _reent *data, void *pdata, FILE * fp, int (*pfunc) (struct _reent *, FILE *, const char *, size_t len), va_list * ap);
int (*_scanf_float) (struct _reent *rptr, void *pdata, FILE *fp, va_list *ap);
void (*__assert_func) (const char *file, int line, const char * func, const char *failedexpr) __attribute__((noreturn));
void (*__assert_func) (const char *file, int line, const char * func, const char *failedexpr) __attribute__((__noreturn__));
void (*__sinit) (struct _reent *r);
void (*_cleanup_r) (struct _reent* r);
};
Expand Down
20 changes: 6 additions & 14 deletions components/esp_system/include/esp_private/panic_internal.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

Expand Down Expand Up @@ -76,7 +68,7 @@ void panic_print_hex(int h);
#define panic_print_hex(h)
#endif

void __attribute__((noreturn)) panic_abort(const char *details);
void __attribute__((__noreturn__)) panic_abort(const char *details);

void panic_arch_fill_info(void *frame, panic_info_t *info);

Expand Down
4 changes: 2 additions & 2 deletions components/esp_system/include/esp_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ esp_err_t esp_unregister_shutdown_handler(shutdown_handler_t handle);
* Peripherals (except for Wi-Fi, BT, UART0, SPI1, and legacy timers) are not reset.
* This function does not return.
*/
void esp_restart(void) __attribute__ ((noreturn));
void esp_restart(void) __attribute__ ((__noreturn__));

/**
* @brief Get reason of last reset
Expand Down Expand Up @@ -113,7 +113,7 @@ uint32_t esp_get_minimum_free_heap_size( void );
*
* @param details Details that will be displayed during panic handling.
*/
void __attribute__((noreturn)) esp_system_abort(const char* details);
void __attribute__((__noreturn__)) esp_system_abort(const char* details);

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion components/esp_system/port/include/port/panic_funcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
extern "C" {
#endif

void __attribute__((noreturn)) panic_restart(void);
void __attribute__((__noreturn__)) panic_restart(void);

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion components/ulp/lp_core/lp_core/include/ulp_lp_core_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void ulp_lp_core_delay_us(uint32_t us);
* before halting.
*
*/
__attribute__((noreturn)) void ulp_lp_core_halt(void);
__attribute__((__noreturn__)) void ulp_lp_core_halt(void);

#ifdef __cplusplus
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void ulp_riscv_rescue_from_monitor(void);
* put the ULP in monitor mode and triggers a reset.
*
*/
void __attribute__((noreturn)) ulp_riscv_halt(void);
void __attribute__((__noreturn__)) ulp_riscv_halt(void);

#define ulp_riscv_shutdown ulp_riscv_halt

Expand Down
3 changes: 0 additions & 3 deletions tools/ci/check_copyright_ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@ components/esp_rom/include/esp32c3/rom/crc.h
components/esp_rom/include/esp32c3/rom/digital_signature.h
components/esp_rom/include/esp32c3/rom/esp_flash.h
components/esp_rom/include/esp32c3/rom/hmac.h
components/esp_rom/include/esp32c3/rom/libc_stubs.h
components/esp_rom/include/esp32c3/rom/rom_layout.h
components/esp_rom/include/esp32c3/rom/rsa_pss.h
components/esp_rom/include/esp32c3/rom/sha.h
Expand All @@ -504,7 +503,6 @@ components/esp_rom/include/esp32s3/rom/bigint.h
components/esp_rom/include/esp32s3/rom/crc.h
components/esp_rom/include/esp32s3/rom/digital_signature.h
components/esp_rom/include/esp32s3/rom/hmac.h
components/esp_rom/include/esp32s3/rom/libc_stubs.h
components/esp_rom/include/esp32s3/rom/opi_flash.h
components/esp_rom/include/esp32s3/rom/rom_layout.h
components/esp_rom/include/esp32s3/rom/rsa_pss.h
Expand Down Expand Up @@ -533,7 +531,6 @@ components/esp_system/include/esp_expression_with_stack.h
components/esp_system/include/esp_freertos_hooks.h
components/esp_system/include/esp_int_wdt.h
components/esp_system/include/esp_private/dbg_stubs.h
components/esp_system/include/esp_private/panic_internal.h
components/esp_system/port/public_compat/brownout.h
components/esp_system/port/public_compat/cache_err_int.h
components/esp_system/port/public_compat/trax.h
Expand Down

0 comments on commit c8791f3

Please sign in to comment.