mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	use c++17 [[fallthrough]]; (#9149)
				
					
				
			This commit is contained in:
		| @@ -312,7 +312,7 @@ FileDecoderState AudioDecoder::decode_mp3_() { | ||||
|   if (err) { | ||||
|     switch (err) { | ||||
|       case esp_audio_libs::helix_decoder::ERR_MP3_OUT_OF_MEMORY: | ||||
|         // Intentional fallthrough | ||||
|         [[fallthrough]]; | ||||
|       case esp_audio_libs::helix_decoder::ERR_MP3_NULL_POINTER: | ||||
|         return FileDecoderState::FAILED; | ||||
|         break; | ||||
|   | ||||
| @@ -496,17 +496,17 @@ float BLEClientBase::parse_char_value(uint8_t *value, uint16_t length) { | ||||
|       if (length > 2) { | ||||
|         return (float) encode_uint16(value[1], value[2]); | ||||
|       } | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|     case 0x7:  // uint24. | ||||
|       if (length > 3) { | ||||
|         return (float) encode_uint24(value[1], value[2], value[3]); | ||||
|       } | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|     case 0x8:  // uint32. | ||||
|       if (length > 4) { | ||||
|         return (float) encode_uint32(value[1], value[2], value[3], value[4]); | ||||
|       } | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|     case 0xC:  // int8. | ||||
|       return (float) ((int8_t) value[1]); | ||||
|     case 0xD:  // int12. | ||||
| @@ -514,12 +514,12 @@ float BLEClientBase::parse_char_value(uint8_t *value, uint16_t length) { | ||||
|       if (length > 2) { | ||||
|         return (float) ((int16_t) (value[1] << 8) + (int16_t) value[2]); | ||||
|       } | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|     case 0xF:  // int24. | ||||
|       if (length > 3) { | ||||
|         return (float) ((int32_t) (value[1] << 16) + (int32_t) (value[2] << 8) + (int32_t) (value[3])); | ||||
|       } | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|     case 0x10:  // int32. | ||||
|       if (length > 4) { | ||||
|         return (float) ((int32_t) (value[1] << 24) + (int32_t) (value[2] << 16) + (int32_t) (value[3] << 8) + | ||||
|   | ||||
| @@ -584,7 +584,7 @@ void PN7150::nci_fsm_transition_() { | ||||
|       } else { | ||||
|         this->nci_fsm_set_state_(NCIState::NFCC_INIT); | ||||
|       } | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|  | ||||
|     case NCIState::NFCC_INIT: | ||||
|       if (this->init_core_() != nfc::STATUS_OK) { | ||||
| @@ -594,7 +594,7 @@ void PN7150::nci_fsm_transition_() { | ||||
|       } else { | ||||
|         this->nci_fsm_set_state_(NCIState::NFCC_CONFIG); | ||||
|       } | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|  | ||||
|     case NCIState::NFCC_CONFIG: | ||||
|       if (this->send_init_config_() != nfc::STATUS_OK) { | ||||
| @@ -605,7 +605,7 @@ void PN7150::nci_fsm_transition_() { | ||||
|         this->config_refresh_pending_ = false; | ||||
|         this->nci_fsm_set_state_(NCIState::NFCC_SET_DISCOVER_MAP); | ||||
|       } | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|  | ||||
|     case NCIState::NFCC_SET_DISCOVER_MAP: | ||||
|       if (this->set_discover_map_() != nfc::STATUS_OK) { | ||||
| @@ -615,7 +615,7 @@ void PN7150::nci_fsm_transition_() { | ||||
|       } else { | ||||
|         this->nci_fsm_set_state_(NCIState::NFCC_SET_LISTEN_MODE_ROUTING); | ||||
|       } | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|  | ||||
|     case NCIState::NFCC_SET_LISTEN_MODE_ROUTING: | ||||
|       if (this->set_listen_mode_routing_() != nfc::STATUS_OK) { | ||||
| @@ -625,7 +625,7 @@ void PN7150::nci_fsm_transition_() { | ||||
|       } else { | ||||
|         this->nci_fsm_set_state_(NCIState::RFST_IDLE); | ||||
|       } | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|  | ||||
|     case NCIState::RFST_IDLE: | ||||
|       if (this->nci_state_error_ == NCIState::RFST_DISCOVERY) { | ||||
| @@ -650,14 +650,14 @@ void PN7150::nci_fsm_transition_() { | ||||
|  | ||||
|     case NCIState::RFST_W4_HOST_SELECT: | ||||
|       select_endpoint_(); | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|  | ||||
|     // All cases below are waiting for NOTIFICATION messages | ||||
|     case NCIState::RFST_DISCOVERY: | ||||
|       if (this->config_refresh_pending_) { | ||||
|         this->refresh_core_config_(); | ||||
|       } | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|  | ||||
|     case NCIState::RFST_LISTEN_ACTIVE: | ||||
|     case NCIState::RFST_LISTEN_SLEEP: | ||||
|   | ||||
| @@ -609,7 +609,7 @@ void PN7160::nci_fsm_transition_() { | ||||
|       } else { | ||||
|         this->nci_fsm_set_state_(NCIState::NFCC_INIT); | ||||
|       } | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|  | ||||
|     case NCIState::NFCC_INIT: | ||||
|       if (this->init_core_() != nfc::STATUS_OK) { | ||||
| @@ -619,7 +619,7 @@ void PN7160::nci_fsm_transition_() { | ||||
|       } else { | ||||
|         this->nci_fsm_set_state_(NCIState::NFCC_CONFIG); | ||||
|       } | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|  | ||||
|     case NCIState::NFCC_CONFIG: | ||||
|       if (this->send_init_config_() != nfc::STATUS_OK) { | ||||
| @@ -630,7 +630,7 @@ void PN7160::nci_fsm_transition_() { | ||||
|         this->config_refresh_pending_ = false; | ||||
|         this->nci_fsm_set_state_(NCIState::NFCC_SET_DISCOVER_MAP); | ||||
|       } | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|  | ||||
|     case NCIState::NFCC_SET_DISCOVER_MAP: | ||||
|       if (this->set_discover_map_() != nfc::STATUS_OK) { | ||||
| @@ -640,7 +640,7 @@ void PN7160::nci_fsm_transition_() { | ||||
|       } else { | ||||
|         this->nci_fsm_set_state_(NCIState::NFCC_SET_LISTEN_MODE_ROUTING); | ||||
|       } | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|  | ||||
|     case NCIState::NFCC_SET_LISTEN_MODE_ROUTING: | ||||
|       if (this->set_listen_mode_routing_() != nfc::STATUS_OK) { | ||||
| @@ -650,7 +650,7 @@ void PN7160::nci_fsm_transition_() { | ||||
|       } else { | ||||
|         this->nci_fsm_set_state_(NCIState::RFST_IDLE); | ||||
|       } | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|  | ||||
|     case NCIState::RFST_IDLE: | ||||
|       if (this->nci_state_error_ == NCIState::RFST_DISCOVERY) { | ||||
| @@ -675,14 +675,14 @@ void PN7160::nci_fsm_transition_() { | ||||
|  | ||||
|     case NCIState::RFST_W4_HOST_SELECT: | ||||
|       select_endpoint_(); | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|  | ||||
|     // All cases below are waiting for NOTIFICATION messages | ||||
|     case NCIState::RFST_DISCOVERY: | ||||
|       if (this->config_refresh_pending_) { | ||||
|         this->refresh_core_config_(); | ||||
|       } | ||||
|       // fall through | ||||
|       [[fallthrough]]; | ||||
|  | ||||
|     case NCIState::RFST_LISTEN_ACTIVE: | ||||
|     case NCIState::RFST_LISTEN_SLEEP: | ||||
|   | ||||
| @@ -445,8 +445,7 @@ template<typename T> stm32_err_t stm32_check_ack_timeout(const stm32_err_t s_err | ||||
|       return STM32_ERR_OK; | ||||
|     case STM32_ERR_NACK: | ||||
|       log(); | ||||
|       // TODO: c++17 [[fallthrough]] | ||||
|       /* fallthrough */ | ||||
|       [[fallthrough]]; | ||||
|     default: | ||||
|       return STM32_ERR_UNKNOWN; | ||||
|   } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user