[FL-2520] FW build with -Wextra (#1185)

* Fixing compiler warnings with -Wextra
* More warnings suppression, WIP
* Even more warning fixes
* Added new lines at end of text files.
* Padding fix
* Additional fixes to warnings on different build configurations; added -Wextra to default build pipeline
* Fixes for Secplus v1
* -additional warnings
* +-Wredundant-decls fixes
* FuriHal: print stack overflow task name in console
* FuriHal: add missing include

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
hedger
2022-05-06 16:37:10 +03:00
committed by GitHub
parent 1ca98170d9
commit 4d6b170769
461 changed files with 940 additions and 519 deletions

View File

@@ -76,6 +76,7 @@ const SubGhzProtocol subghz_protocol_came = {
};
void* subghz_protocol_encoder_came_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderCame* instance = malloc(sizeof(SubGhzProtocolEncoderCame));
instance->base.protocol = &subghz_protocol_came;
@@ -182,6 +183,7 @@ LevelDuration subghz_protocol_encoder_came_yield(void* context) {
}
void* subghz_protocol_decoder_came_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderCame* instance = malloc(sizeof(SubGhzProtocolDecoderCame));
instance->base.protocol = &subghz_protocol_came;
instance->generic.protocol_name = instance->base.protocol->name;

View File

@@ -136,7 +136,7 @@ void subghz_protocol_decoder_came_atomo_feed(void* context, bool level, uint32_t
subghz_protocol_came_atomo_const.te_delta) {
event = ManchesterEventLongLow;
} else if(
duration >= (subghz_protocol_came_atomo_const.te_long * 2 +
duration >= ((uint32_t)subghz_protocol_came_atomo_const.te_long * 2 +
subghz_protocol_came_atomo_const.te_delta)) {
if(instance->decoder.decode_count_bit ==
subghz_protocol_came_atomo_const.min_count_bit_for_found) {

View File

@@ -103,6 +103,7 @@ const SubGhzProtocol subghz_protocol_came_twee = {
};
void* subghz_protocol_encoder_came_twee_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderCameTwee* instance = malloc(sizeof(SubGhzProtocolEncoderCameTwee));
instance->base.protocol = &subghz_protocol_came_twee;
@@ -289,6 +290,7 @@ LevelDuration subghz_protocol_encoder_came_twee_yield(void* context) {
}
void* subghz_protocol_decoder_came_twee_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderCameTwee* instance = malloc(sizeof(SubGhzProtocolDecoderCameTwee));
instance->base.protocol = &subghz_protocol_came_twee;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -351,7 +353,7 @@ void subghz_protocol_decoder_came_twee_feed(void* context, bool level, uint32_t
subghz_protocol_came_twee_const.te_delta) {
event = ManchesterEventLongLow;
} else if(
duration >= (subghz_protocol_came_twee_const.te_long * 2 +
duration >= ((uint32_t)subghz_protocol_came_twee_const.te_long * 2 +
subghz_protocol_came_twee_const.te_delta)) {
if(instance->decoder.decode_count_bit >=
subghz_protocol_came_twee_const.min_count_bit_for_found) {

View File

@@ -69,6 +69,7 @@ const SubGhzProtocol subghz_protocol_faac_slh = {
};
void* subghz_protocol_decoder_faac_slh_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderFaacSLH* instance = malloc(sizeof(SubGhzProtocolDecoderFaacSLH));
instance->base.protocol = &subghz_protocol_faac_slh;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -111,7 +112,7 @@ void subghz_protocol_decoder_faac_slh_feed(void* context, bool level, uint32_t d
break;
case FaacSLHDecoderStepSaveDuration:
if(level) {
if(duration >= (subghz_protocol_faac_slh_const.te_short * 3 +
if(duration >= ((uint32_t)subghz_protocol_faac_slh_const.te_short * 3 +
subghz_protocol_faac_slh_const.te_delta)) {
instance->decoder.parser_step = FaacSLHDecoderStepFoundPreambula;
if(instance->decoder.decode_count_bit >=

View File

@@ -75,6 +75,7 @@ const SubGhzProtocol subghz_protocol_firefly = {
};
void* subghz_protocol_encoder_firefly_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderFirefly* instance = malloc(sizeof(SubGhzProtocolEncoderFirefly));
instance->base.protocol = &subghz_protocol_firefly;
@@ -193,6 +194,7 @@ LevelDuration subghz_protocol_encoder_firefly_yield(void* context) {
}
void* subghz_protocol_decoder_firefly_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderFirefly* instance = malloc(sizeof(SubGhzProtocolDecoderFirefly));
instance->base.protocol = &subghz_protocol_firefly;
instance->generic.protocol_name = instance->base.protocol->name;

View File

@@ -69,6 +69,7 @@ const SubGhzProtocol subghz_protocol_gate_tx = {
};
void* subghz_protocol_encoder_gate_tx_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderGateTx* instance = malloc(sizeof(SubGhzProtocolEncoderGateTx));
instance->base.protocol = &subghz_protocol_gate_tx;
@@ -175,6 +176,7 @@ LevelDuration subghz_protocol_encoder_gate_tx_yield(void* context) {
}
void* subghz_protocol_decoder_gate_tx_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderGateTx* instance = malloc(sizeof(SubGhzProtocolDecoderGateTx));
instance->base.protocol = &subghz_protocol_gate_tx;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -218,7 +220,7 @@ void subghz_protocol_decoder_gate_tx_feed(void* context, bool level, uint32_t du
break;
case GateTXDecoderStepSaveDuration:
if(!level) {
if(duration >= (subghz_protocol_gate_tx_const.te_short * 10 +
if(duration >= ((uint32_t)subghz_protocol_gate_tx_const.te_short * 10 +
subghz_protocol_gate_tx_const.te_delta)) {
instance->decoder.parser_step = GateTXDecoderStepFoundStartBit;
if(instance->decoder.decode_count_bit >=

View File

@@ -72,6 +72,7 @@ const SubGhzProtocol subghz_protocol_hormann = {
};
void* subghz_protocol_encoder_hormann_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderHormann* instance = malloc(sizeof(SubGhzProtocolEncoderHormann));
instance->base.protocol = &subghz_protocol_hormann;
@@ -191,6 +192,7 @@ LevelDuration subghz_protocol_encoder_hormann_yield(void* context) {
}
void* subghz_protocol_decoder_hormann_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderHormann* instance = malloc(sizeof(SubGhzProtocolDecoderHormann));
instance->base.protocol = &subghz_protocol_hormann;
instance->generic.protocol_name = instance->base.protocol->name;

View File

@@ -68,6 +68,7 @@ const SubGhzProtocol subghz_protocol_ido = {
};
void* subghz_protocol_decoder_ido_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderIDo* instance = malloc(sizeof(SubGhzProtocolDecoderIDo));
instance->base.protocol = &subghz_protocol_ido;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -111,8 +112,8 @@ void subghz_protocol_decoder_ido_feed(void* context, bool level, uint32_t durati
break;
case IDoDecoderStepSaveDuration:
if(level) {
if(duration >=
(subghz_protocol_ido_const.te_short * 5 + subghz_protocol_ido_const.te_delta)) {
if(duration >= ((uint32_t)subghz_protocol_ido_const.te_short * 5 +
subghz_protocol_ido_const.te_delta)) {
instance->decoder.parser_step = IDoDecoderStepFoundPreambula;
if(instance->decoder.decode_count_bit >=
subghz_protocol_ido_const.min_count_bit_for_found) {

View File

@@ -72,4 +72,4 @@ bool subghz_protocol_decoder_ido_deserialize(void* context, FlipperFormat* flipp
* @param context Pointer to a SubGhzProtocolDecoderIDo instance
* @param output Resulting text
*/
void subghz_protocol_decoder_ido_get_string(void* context, string_t output);
void subghz_protocol_decoder_ido_get_string(void* context, string_t output);

View File

@@ -384,7 +384,7 @@ void subghz_protocol_decoder_keeloq_feed(void* context, bool level, uint32_t dur
break;
case KeeloqDecoderStepCheckDuration:
if(!level) {
if(duration >= (subghz_protocol_keeloq_const.te_short * 2 +
if(duration >= ((uint32_t)subghz_protocol_keeloq_const.te_short * 2 +
subghz_protocol_keeloq_const.te_delta)) {
// Found end TX
instance->decoder.parser_step = KeeloqDecoderStepReset;

View File

@@ -81,4 +81,4 @@ inline uint64_t
subghz_protocol_keeloq_common_magic_xor_type1_learning(uint32_t data, uint64_t xor) {
data &= 0x0FFFFFFF;
return (((uint64_t)data << 32) | data) ^ xor;
}
}

View File

@@ -70,6 +70,7 @@ const SubGhzProtocol subghz_protocol_kia = {
};
void* subghz_protocol_decoder_kia_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderKIA* instance = malloc(sizeof(SubGhzProtocolDecoderKIA));
instance->base.protocol = &subghz_protocol_kia;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -141,7 +142,7 @@ void subghz_protocol_decoder_kia_feed(void* context, bool level, uint32_t durati
case KIADecoderStepSaveDuration:
if(level) {
if(duration >=
(subghz_protocol_kia_const.te_long + subghz_protocol_kia_const.te_delta * 2)) {
(uint32_t)(subghz_protocol_kia_const.te_long + subghz_protocol_kia_const.te_delta * 2)) {
//Found stop bit
instance->decoder.parser_step = KIADecoderStepReset;
if(instance->decoder.decode_count_bit >=

View File

@@ -71,6 +71,7 @@ const SubGhzProtocol subghz_protocol_nero_radio = {
};
void* subghz_protocol_encoder_nero_radio_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderNeroRadio* instance = malloc(sizeof(SubGhzProtocolEncoderNeroRadio));
instance->base.protocol = &subghz_protocol_nero_radio;
@@ -200,6 +201,7 @@ LevelDuration subghz_protocol_encoder_nero_radio_yield(void* context) {
}
void* subghz_protocol_decoder_nero_radio_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderNeroRadio* instance = malloc(sizeof(SubGhzProtocolDecoderNeroRadio));
instance->base.protocol = &subghz_protocol_nero_radio;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -278,7 +280,7 @@ void subghz_protocol_decoder_nero_radio_feed(void* context, bool level, uint32_t
break;
case NeroRadioDecoderStepCheckDuration:
if(!level) {
if(duration >= (subghz_protocol_nero_radio_const.te_short * 10 +
if(duration >= ((uint32_t)subghz_protocol_nero_radio_const.te_short * 10 +
subghz_protocol_nero_radio_const.te_delta * 2)) {
//Found stop bit
if(DURATION_DIFF(

View File

@@ -70,6 +70,7 @@ const SubGhzProtocol subghz_protocol_nero_sketch = {
};
void* subghz_protocol_encoder_nero_sketch_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderNeroSketch* instance = malloc(sizeof(SubGhzProtocolEncoderNeroSketch));
instance->base.protocol = &subghz_protocol_nero_sketch;
@@ -194,6 +195,7 @@ LevelDuration subghz_protocol_encoder_nero_sketch_yield(void* context) {
}
void* subghz_protocol_decoder_nero_sketch_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderNeroSketch* instance = malloc(sizeof(SubGhzProtocolDecoderNeroSketch));
instance->base.protocol = &subghz_protocol_nero_sketch;
instance->generic.protocol_name = instance->base.protocol->name;

View File

@@ -69,6 +69,7 @@ const SubGhzProtocol subghz_protocol_nice_flo = {
};
void* subghz_protocol_encoder_nice_flo_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderNiceFlo* instance = malloc(sizeof(SubGhzProtocolEncoderNiceFlo));
instance->base.protocol = &subghz_protocol_nice_flo;
@@ -175,6 +176,7 @@ LevelDuration subghz_protocol_encoder_nice_flo_yield(void* context) {
}
void* subghz_protocol_decoder_nice_flo_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderNiceFlo* instance = malloc(sizeof(SubGhzProtocolDecoderNiceFlo));
instance->base.protocol = &subghz_protocol_nice_flo;
instance->generic.protocol_name = instance->base.protocol->name;

View File

@@ -106,4 +106,4 @@ bool subghz_protocol_decoder_nice_flo_deserialize(void* context, FlipperFormat*
* @param context Pointer to a SubGhzProtocolDecoderNiceFlo instance
* @param output Resulting text
*/
void subghz_protocol_decoder_nice_flo_get_string(void* context, string_t output);
void subghz_protocol_decoder_nice_flo_get_string(void* context, string_t output);

View File

@@ -80,6 +80,7 @@ const SubGhzProtocol subghz_protocol_princeton = {
};
void* subghz_protocol_encoder_princeton_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderPrinceton* instance = malloc(sizeof(SubGhzProtocolEncoderPrinceton));
instance->base.protocol = &subghz_protocol_princeton;
@@ -194,6 +195,7 @@ LevelDuration subghz_protocol_encoder_princeton_yield(void* context) {
}
void* subghz_protocol_decoder_princeton_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderPrinceton* instance = malloc(sizeof(SubGhzProtocolDecoderPrinceton));
instance->base.protocol = &subghz_protocol_princeton;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -238,7 +240,7 @@ void subghz_protocol_decoder_princeton_feed(void* context, bool level, uint32_t
break;
case PrincetonDecoderStepCheckDuration:
if(!level) {
if(duration >= (subghz_protocol_princeton_const.te_short * 10 +
if(duration >= ((uint32_t)subghz_protocol_princeton_const.te_short * 10 +
subghz_protocol_princeton_const.te_delta)) {
instance->decoder.parser_step = PrincetonDecoderStepSaveDuration;
if(instance->decoder.decode_count_bit ==

View File

@@ -249,7 +249,7 @@ void subghz_decoder_princeton_for_testing_parse(
break;
case PrincetonDecoderStepCheckDuration:
if(!level) {
if(duration >= (instance->te_short * 10 + instance->te_delta)) {
if(duration >= ((uint32_t)instance->te_short * 10 + instance->te_delta)) {
instance->parser_step = PrincetonDecoderStepSaveDuration;
if(instance->code_count_bit == instance->code_min_count_bit_for_found) {
instance->te /= (instance->code_count_bit * 4 + 1);

View File

@@ -192,6 +192,7 @@ size_t subghz_protocol_raw_get_sample_write(SubGhzProtocolDecoderRAW* instance)
}
void* subghz_protocol_decoder_raw_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderRAW* instance = malloc(sizeof(SubGhzProtocolDecoderRAW));
instance->base.protocol = &subghz_protocol_raw;
instance->upload_raw = NULL;
@@ -243,6 +244,7 @@ void subghz_protocol_decoder_raw_get_string(void* context, string_t output) {
}
void* subghz_protocol_encoder_raw_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderRAW* instance = malloc(sizeof(SubGhzProtocolEncoderRAW));
instance->base.protocol = &subghz_protocol_raw;

View File

@@ -76,6 +76,7 @@ const SubGhzProtocol subghz_protocol_scher_khan = {
};
void* subghz_protocol_decoder_scher_khan_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderScherKhan* instance = malloc(sizeof(SubGhzProtocolDecoderScherKhan));
instance->base.protocol = &subghz_protocol_scher_khan;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -150,7 +151,7 @@ void subghz_protocol_decoder_scher_khan_feed(void* context, bool level, uint32_t
break;
case ScherKhanDecoderStepSaveDuration:
if(level) {
if(duration >= (subghz_protocol_scher_khan_const.te_long +
if(duration >= (uint32_t)(subghz_protocol_scher_khan_const.te_long +
subghz_protocol_scher_khan_const.te_delta * 2)) {
//Found stop bit
instance->decoder.parser_step = ScherKhanDecoderStepReset;

View File

@@ -89,6 +89,7 @@ const SubGhzProtocol subghz_protocol_secplus_v1 = {
};
void* subghz_protocol_decoder_secplus_v1_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderSecPlus_v1* instance = malloc(sizeof(SubGhzProtocolDecoderSecPlus_v1));
instance->base.protocol = &subghz_protocol_secplus_v1;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -321,7 +322,7 @@ void subghz_protocol_decoder_secplus_v1_get_string(void* context, string_t outpu
// pin = (fixed // 3**10) % (3**9) 3^10=59049 3^9=19683
pin = (fixed / 59049) % 19683;
if(0 <= pin && pin <= 9999) {
if(pin <= 9999) {
string_cat_printf(output, " pin:%d", pin);
} else if(10000 <= pin && pin <= 11029) {
string_cat_printf(output, " pin:enter");

View File

@@ -81,6 +81,7 @@ const SubGhzProtocol subghz_protocol_secplus_v2 = {
};
void* subghz_protocol_decoder_secplus_v2_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderSecPlus_v2* instance = malloc(sizeof(SubGhzProtocolDecoderSecPlus_v2));
instance->base.protocol = &subghz_protocol_secplus_v2;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -154,7 +155,7 @@ void subghz_protocol_decoder_secplus_v2_feed(void* context, bool level, uint32_t
subghz_protocol_secplus_v2_const.te_delta) {
event = ManchesterEventLongLow;
} else if(
duration >= (subghz_protocol_secplus_v2_const.te_long * 2 +
duration >= (uint32_t)(subghz_protocol_secplus_v2_const.te_long * 2 +
subghz_protocol_secplus_v2_const.te_delta)) {
if(instance->decoder.decode_count_bit >=
subghz_protocol_secplus_v2_const.min_count_bit_for_found) {

View File

@@ -75,6 +75,7 @@ const SubGhzProtocol subghz_protocol_somfy_keytis = {
};
void* subghz_protocol_decoder_somfy_keytis_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderSomfyKeytis* instance = malloc(sizeof(SubGhzProtocolDecoderSomfyKeytis));
instance->base.protocol = &subghz_protocol_somfy_keytis;
instance->generic.protocol_name = instance->base.protocol->name;

View File

@@ -74,6 +74,7 @@ const SubGhzProtocol subghz_protocol_somfy_telis = {
};
void* subghz_protocol_decoder_somfy_telis_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderSomfyTelis* instance = malloc(sizeof(SubGhzProtocolDecoderSomfyTelis));
instance->base.protocol = &subghz_protocol_somfy_telis;
instance->generic.protocol_name = instance->base.protocol->name;