mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 21:24:32 +02:00
fix(build): add __attribute__((nonstring)) to nonsting variables
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
* BTC.
|
||||
*
|
||||
******************************************************************************/
|
||||
#include "esp_attr.h"
|
||||
#include "string.h"
|
||||
#include "common/bt_target.h"
|
||||
#include "stack/a2d_api.h"
|
||||
@@ -66,7 +67,7 @@
|
||||
#define BTA_AV_CO_SBC_MAX_BITPOOL 53
|
||||
|
||||
/* SCMS-T protect info */
|
||||
const UINT8 bta_av_co_cp_scmst[BTA_AV_CP_INFO_LEN] = "\x02\x02\x00";
|
||||
const UINT8 bta_av_co_cp_scmst[BTA_AV_CP_INFO_LEN] = { 2, 2, 0 };
|
||||
|
||||
/* SBC SRC codec capabilities */
|
||||
const tA2D_SBC_CIE bta_av_co_sbc_caps = {
|
||||
|
@@ -161,6 +161,13 @@ extern "C" {
|
||||
// Forces to not inline function
|
||||
#define NOINLINE_ATTR __attribute__((noinline))
|
||||
|
||||
#if !defined(__clang__) && __GNUC__ >= 15
|
||||
// Marks a character array as not null-terminated to avoid string-related optimizations or warnings
|
||||
#define NONSTRING_ATTR __attribute__ ((nonstring))
|
||||
#else
|
||||
#define NONSTRING_ATTR
|
||||
#endif
|
||||
|
||||
// This allows using enum as flags in C++
|
||||
// Format: FLAG_ATTR(flag_enum_t)
|
||||
#ifdef __cplusplus
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "esp_attr.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "hal/uart_types.h"
|
||||
|
||||
@@ -45,7 +46,7 @@ typedef struct {
|
||||
'*' represents any symbol.
|
||||
The end character cannot be '*'.
|
||||
Example: "he**o" matches hello, heyyo. */
|
||||
char wake_chars_seq[SOC_UART_WAKEUP_CHARS_SEQ_MAX_LEN];
|
||||
NONSTRING_ATTR char wake_chars_seq[SOC_UART_WAKEUP_CHARS_SEQ_MAX_LEN];
|
||||
#endif
|
||||
|
||||
} uart_wakeup_cfg_t;
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#ifndef PHY_INIT_DATA_H
|
||||
#define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */
|
||||
#include "esp_phy_init.h"
|
||||
#include "esp_attr.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -50,7 +51,7 @@ typedef struct {
|
||||
* @brief Country corresponds to PHY init data type structure
|
||||
*/
|
||||
typedef struct {
|
||||
char cc[PHY_COUNTRY_CODE_LEN];
|
||||
NONSTRING_ATTR char cc[PHY_COUNTRY_CODE_LEN];
|
||||
uint8_t type;
|
||||
} phy_country_to_bin_type_t;
|
||||
#endif
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#ifndef PHY_INIT_DATA_H
|
||||
#define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */
|
||||
#include "esp_phy_init.h"
|
||||
#include "esp_attr.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -51,7 +52,7 @@ typedef struct {
|
||||
* @brief Country corresponds to PHY init data type structure
|
||||
*/
|
||||
typedef struct {
|
||||
char cc[PHY_COUNTRY_CODE_LEN];
|
||||
NONSTRING_ATTR char cc[PHY_COUNTRY_CODE_LEN];
|
||||
uint8_t type;
|
||||
} phy_country_to_bin_type_t;
|
||||
#endif
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#ifndef PHY_INIT_DATA_H
|
||||
#define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */
|
||||
#include "esp_phy_init.h"
|
||||
#include "esp_attr.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -51,7 +52,7 @@ typedef struct {
|
||||
* @brief Country corresponds to PHY init data type structure
|
||||
*/
|
||||
typedef struct {
|
||||
char cc[PHY_COUNTRY_CODE_LEN];
|
||||
NONSTRING_ATTR char cc[PHY_COUNTRY_CODE_LEN];
|
||||
uint8_t type;
|
||||
} phy_country_to_bin_type_t;
|
||||
#endif
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#ifndef PHY_INIT_DATA_H
|
||||
#define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */
|
||||
#include <stdint.h>
|
||||
#include "esp_attr.h"
|
||||
#include "esp_phy_init.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
@@ -52,7 +53,7 @@ typedef struct {
|
||||
* @brief Country corresponds to PHY init data type structure
|
||||
*/
|
||||
typedef struct {
|
||||
char cc[PHY_COUNTRY_CODE_LEN];
|
||||
NONSTRING_ATTR char cc[PHY_COUNTRY_CODE_LEN];
|
||||
uint8_t type;
|
||||
} phy_country_to_bin_type_t;
|
||||
#endif
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#ifndef PHY_INIT_DATA_H
|
||||
#define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */
|
||||
#include "esp_phy_init.h"
|
||||
#include "esp_attr.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -51,7 +52,7 @@ typedef struct {
|
||||
* @brief Country corresponds to PHY init data type structure
|
||||
*/
|
||||
typedef struct {
|
||||
char cc[PHY_COUNTRY_CODE_LEN];
|
||||
NONSTRING_ATTR char cc[PHY_COUNTRY_CODE_LEN];
|
||||
uint8_t type;
|
||||
} phy_country_to_bin_type_t;
|
||||
#endif
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */
|
||||
#include <stdint.h>
|
||||
#include "esp_phy_init.h"
|
||||
#include "esp_attr.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -52,7 +53,7 @@ typedef struct {
|
||||
* @brief Country corresponds to PHY init data type structure
|
||||
*/
|
||||
typedef struct {
|
||||
char cc[PHY_COUNTRY_CODE_LEN];
|
||||
NONSTRING_ATTR char cc[PHY_COUNTRY_CODE_LEN];
|
||||
uint8_t type;
|
||||
} phy_country_to_bin_type_t;
|
||||
#endif
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#ifndef PHY_INIT_DATA_H
|
||||
#define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */
|
||||
#include "esp_phy_init.h"
|
||||
#include "esp_attr.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -51,7 +52,7 @@ typedef struct {
|
||||
* @brief Country corresponds to PHY init data type structure
|
||||
*/
|
||||
typedef struct {
|
||||
char cc[PHY_COUNTRY_CODE_LEN];
|
||||
NONSTRING_ATTR char cc[PHY_COUNTRY_CODE_LEN];
|
||||
uint8_t type;
|
||||
} phy_country_to_bin_type_t;
|
||||
#endif
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#ifndef PHY_INIT_DATA_H
|
||||
#define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */
|
||||
#include "esp_phy_init.h"
|
||||
#include "esp_attr.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -51,7 +52,7 @@ typedef struct {
|
||||
* @brief Country corresponds to PHY init data type structure
|
||||
*/
|
||||
typedef struct {
|
||||
char cc[PHY_COUNTRY_CODE_LEN];
|
||||
NONSTRING_ATTR char cc[PHY_COUNTRY_CODE_LEN];
|
||||
uint8_t type;
|
||||
} phy_country_to_bin_type_t;
|
||||
#endif
|
||||
|
@@ -97,6 +97,12 @@ if(CONFIG_ESP_WIFI_ENABLED OR CONFIG_ESP_HOST_WIFI_ENABLED)
|
||||
target_link_libraries(${COMPONENT_LIB} PUBLIC ${blob})
|
||||
endforeach()
|
||||
endif()
|
||||
# TODO IDF-13365: remove the following lines
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
||||
set_source_files_properties(regulatory/esp_wifi_regulatory.c
|
||||
PROPERTIES COMPILE_FLAGS
|
||||
-Wno-unterminated-string-initialization)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CONFIG_SPIRAM)
|
||||
|
@@ -362,6 +362,7 @@ PREDEFINED = \
|
||||
IDF_DEPRECATED(X)= \
|
||||
IRAM_ATTR= \
|
||||
FORCE_INLINE_ATTR= \
|
||||
NONSTRING_ATTR= \
|
||||
configSUPPORT_DYNAMIC_ALLOCATION=1 \
|
||||
configSUPPORT_STATIC_ALLOCATION=1 \
|
||||
configQUEUE_REGISTRY_SIZE=1 \
|
||||
|
Reference in New Issue
Block a user