ESP-IDF 4.4.1: A question about and a possible problem with data storage classes
Posted: Fri Jun 17, 2022 12:43 pm
Hello,
Does the gcc of the ESP-IDF store different storage classes in different address spaces?
Here are the relevant code fragments:
The „standard“ gcc of linux does not generate neither warnings nor error messages for this code. The gcc of the ESP-IDF generates error messages and warnings for the same code:
Who makes mistakes at this place? Me or gcc?
Can somebody help me to solve this problem?
Thanks in advance,
Michael
Does the gcc of the ESP-IDF store different storage classes in different address spaces?
Here are the relevant code fragments:
Code: Select all
static const char *name_primitive = "Primitive";
static const char *name_date = "Date";
static const char *name_time = "Time";
static const char *name_sensor_value = "SensorValue";
static const char *name_rssi = "RSSI";
static const struct {
field_type_t type;
const char *name;
} field_type[] = {
{ FIELD_TYPE_PRIMITIVE, name_primitive },
{ FIELD_TYPE_TIME, name_time },
{ FIELD_TYPE_DATE, name_date },
{ FIELD_TYPE_SENSOR_VALUE, name_sensor_value },
{ FIELD_TYPE_WIFI_RSSI, name_rssi },
{ FIELD_TYPE_UNKNOWN, NULL }
};
Code: Select all
settings.c:88:29: error: initializer element is not constant
{ FIELD_TYPE_PRIMITIVE, name_primitive },
^~~~~~~~~~~~~~
settings.c:88:29: note: (near initialization for 'field_type[0].name')
settings.c:88:5: warning: missing initializer for field 'name' of 'const struct <anonymous>' [-Wmissing-field-initializers]
{ FIELD_TYPE_PRIMITIVE, name_primitive },
^
settings.c:86:21: note: 'name' declared here
const char *name;
^~~~
Can somebody help me to solve this problem?
Thanks in advance,
Michael