From d6aa2ec91a8f465f68aa77c9887e227de660f74a Mon Sep 17 00:00:00 2001 From: Nav Date: Wed, 13 Oct 2021 23:59:05 +0100 Subject: [PATCH] Const placement consistency --- .../VendorSpecific/EDBG/AVR/Avr8Generic.hpp | 114 +++++++++--------- .../CommandFrames/AVR8Generic/ReadMemory.cpp | 2 +- src/EventManager/EventListener.cpp | 2 +- src/EventManager/EventManager.cpp | 4 +- .../BitsetWidget/BitBodyWidget.hpp | 4 +- .../BitsetWidget/BitWidget.hpp | 12 +- .../BitsetWidget/BitsetWidget.hpp | 6 +- 7 files changed, 72 insertions(+), 72 deletions(-) diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/Avr8Generic.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/Avr8Generic.hpp index d0db8c03..a67155b3 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/Avr8Generic.hpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/Avr8Generic.hpp @@ -18,70 +18,70 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr struct Avr8EdbgParameters { - constexpr static Avr8EdbgParameter CONFIG_VARIANT {0x00, 0x00}; - constexpr static Avr8EdbgParameter CONFIG_FUNCTION {0x00, 0x01}; - constexpr static Avr8EdbgParameter PHYSICAL_INTERFACE {0x01, 0x00}; - constexpr static Avr8EdbgParameter DW_CLOCK_DIVISION_FACTOR {0x01, 0x10}; - constexpr static Avr8EdbgParameter PDI_CLOCK_SPEED {0x01, 0x31}; - constexpr static Avr8EdbgParameter MEGA_DEBUG_CLOCK {0x01, 0x21}; - constexpr static Avr8EdbgParameter JTAG_DAISY_CHAIN_SETTINGS {0x01, 0x01}; + static constexpr Avr8EdbgParameter CONFIG_VARIANT {0x00, 0x00}; + static constexpr Avr8EdbgParameter CONFIG_FUNCTION {0x00, 0x01}; + static constexpr Avr8EdbgParameter PHYSICAL_INTERFACE {0x01, 0x00}; + static constexpr Avr8EdbgParameter DW_CLOCK_DIVISION_FACTOR {0x01, 0x10}; + static constexpr Avr8EdbgParameter PDI_CLOCK_SPEED {0x01, 0x31}; + static constexpr Avr8EdbgParameter MEGA_DEBUG_CLOCK {0x01, 0x21}; + static constexpr Avr8EdbgParameter JTAG_DAISY_CHAIN_SETTINGS {0x01, 0x01}; // debugWire and JTAG parameters - constexpr static Avr8EdbgParameter DEVICE_BOOT_START_ADDR {0x02, 0x0A}; - constexpr static Avr8EdbgParameter DEVICE_FLASH_BASE {0x02, 0x06}; - constexpr static Avr8EdbgParameter DEVICE_SRAM_START {0x02, 0x0E}; - constexpr static Avr8EdbgParameter DEVICE_EEPROM_SIZE {0x02, 0x10}; - constexpr static Avr8EdbgParameter DEVICE_EEPROM_PAGE_SIZE {0x02, 0x12}; - constexpr static Avr8EdbgParameter DEVICE_FLASH_PAGE_SIZE {0x02, 0x00}; - constexpr static Avr8EdbgParameter DEVICE_FLASH_SIZE {0x02, 0x02}; - constexpr static Avr8EdbgParameter DEVICE_OCD_REVISION {0x02, 0x13}; - constexpr static Avr8EdbgParameter DEVICE_OCD_DATA_REGISTER {0x02, 0x18}; - constexpr static Avr8EdbgParameter DEVICE_SPMCR_REGISTER {0x02, 0x1D}; - constexpr static Avr8EdbgParameter DEVICE_OSCCAL_ADDR {0x02, 0x1E}; - constexpr static Avr8EdbgParameter DEVICE_EEARH_ADDR {0x02, 0x19}; - constexpr static Avr8EdbgParameter DEVICE_EEARL_ADDR {0x02, 0x1A}; - constexpr static Avr8EdbgParameter DEVICE_EECR_ADDR {0x02, 0x1B}; - constexpr static Avr8EdbgParameter DEVICE_EEDR_ADDR {0x02, 0x1C}; + static constexpr Avr8EdbgParameter DEVICE_BOOT_START_ADDR {0x02, 0x0A}; + static constexpr Avr8EdbgParameter DEVICE_FLASH_BASE {0x02, 0x06}; + static constexpr Avr8EdbgParameter DEVICE_SRAM_START {0x02, 0x0E}; + static constexpr Avr8EdbgParameter DEVICE_EEPROM_SIZE {0x02, 0x10}; + static constexpr Avr8EdbgParameter DEVICE_EEPROM_PAGE_SIZE {0x02, 0x12}; + static constexpr Avr8EdbgParameter DEVICE_FLASH_PAGE_SIZE {0x02, 0x00}; + static constexpr Avr8EdbgParameter DEVICE_FLASH_SIZE {0x02, 0x02}; + static constexpr Avr8EdbgParameter DEVICE_OCD_REVISION {0x02, 0x13}; + static constexpr Avr8EdbgParameter DEVICE_OCD_DATA_REGISTER {0x02, 0x18}; + static constexpr Avr8EdbgParameter DEVICE_SPMCR_REGISTER {0x02, 0x1D}; + static constexpr Avr8EdbgParameter DEVICE_OSCCAL_ADDR {0x02, 0x1E}; + static constexpr Avr8EdbgParameter DEVICE_EEARH_ADDR {0x02, 0x19}; + static constexpr Avr8EdbgParameter DEVICE_EEARL_ADDR {0x02, 0x1A}; + static constexpr Avr8EdbgParameter DEVICE_EECR_ADDR {0x02, 0x1B}; + static constexpr Avr8EdbgParameter DEVICE_EEDR_ADDR {0x02, 0x1C}; // PDI/XMega device parameters - constexpr static Avr8EdbgParameter DEVICE_XMEGA_APPL_BASE_ADDR {0x02, 0x00}; - constexpr static Avr8EdbgParameter DEVICE_XMEGA_BOOT_BASE_ADDR {0x02, 0x04}; - constexpr static Avr8EdbgParameter DEVICE_XMEGA_EEPROM_BASE_ADDR {0x02, 0x08}; - constexpr static Avr8EdbgParameter DEVICE_XMEGA_FUSE_BASE_ADDR {0x02, 0x0C}; - constexpr static Avr8EdbgParameter DEVICE_XMEGA_LOCKBIT_BASE_ADDR {0x02, 0x10}; - constexpr static Avr8EdbgParameter DEVICE_XMEGA_USER_SIGN_BASE_ADDR {0x02, 0x14}; - constexpr static Avr8EdbgParameter DEVICE_XMEGA_PROD_SIGN_BASE_ADDR {0x02, 0x18}; - constexpr static Avr8EdbgParameter DEVICE_XMEGA_DATA_BASE_ADDR {0x02, 0x1C}; - constexpr static Avr8EdbgParameter DEVICE_XMEGA_APPLICATION_BYTES {0x02, 0x20}; - constexpr static Avr8EdbgParameter DEVICE_XMEGA_BOOT_BYTES {0x02, 0x24}; - constexpr static Avr8EdbgParameter DEVICE_XMEGA_NVM_BASE {0x02, 0x2B}; - constexpr static Avr8EdbgParameter DEVICE_XMEGA_SIGNATURE_OFFSET {0x02, 0x2D}; - constexpr static Avr8EdbgParameter DEVICE_XMEGA_FLASH_PAGE_BYTES {0x02, 0x26}; - constexpr static Avr8EdbgParameter DEVICE_XMEGA_EEPROM_SIZE {0x02, 0x28}; - constexpr static Avr8EdbgParameter DEVICE_XMEGA_EEPROM_PAGE_SIZE {0x02, 0x2A}; + static constexpr Avr8EdbgParameter DEVICE_XMEGA_APPL_BASE_ADDR {0x02, 0x00}; + static constexpr Avr8EdbgParameter DEVICE_XMEGA_BOOT_BASE_ADDR {0x02, 0x04}; + static constexpr Avr8EdbgParameter DEVICE_XMEGA_EEPROM_BASE_ADDR {0x02, 0x08}; + static constexpr Avr8EdbgParameter DEVICE_XMEGA_FUSE_BASE_ADDR {0x02, 0x0C}; + static constexpr Avr8EdbgParameter DEVICE_XMEGA_LOCKBIT_BASE_ADDR {0x02, 0x10}; + static constexpr Avr8EdbgParameter DEVICE_XMEGA_USER_SIGN_BASE_ADDR {0x02, 0x14}; + static constexpr Avr8EdbgParameter DEVICE_XMEGA_PROD_SIGN_BASE_ADDR {0x02, 0x18}; + static constexpr Avr8EdbgParameter DEVICE_XMEGA_DATA_BASE_ADDR {0x02, 0x1C}; + static constexpr Avr8EdbgParameter DEVICE_XMEGA_APPLICATION_BYTES {0x02, 0x20}; + static constexpr Avr8EdbgParameter DEVICE_XMEGA_BOOT_BYTES {0x02, 0x24}; + static constexpr Avr8EdbgParameter DEVICE_XMEGA_NVM_BASE {0x02, 0x2B}; + static constexpr Avr8EdbgParameter DEVICE_XMEGA_SIGNATURE_OFFSET {0x02, 0x2D}; + static constexpr Avr8EdbgParameter DEVICE_XMEGA_FLASH_PAGE_BYTES {0x02, 0x26}; + static constexpr Avr8EdbgParameter DEVICE_XMEGA_EEPROM_SIZE {0x02, 0x28}; + static constexpr Avr8EdbgParameter DEVICE_XMEGA_EEPROM_PAGE_SIZE {0x02, 0x2A}; // UPDI device parameters - constexpr static Avr8EdbgParameter DEVICE_UPDI_PROGMEM_BASE_ADDR {0x02, 0x00}; - constexpr static Avr8EdbgParameter DEVICE_UPDI_FLASH_PAGE_SIZE {0x02, 0x02}; - constexpr static Avr8EdbgParameter DEVICE_UPDI_EEPROM_PAGE_SIZE {0x02, 0x03}; - constexpr static Avr8EdbgParameter DEVICE_UPDI_NVMCTRL_ADDR {0x02, 0x04}; - constexpr static Avr8EdbgParameter DEVICE_UPDI_OCD_ADDR {0x02, 0x06}; - constexpr static Avr8EdbgParameter DEVICE_UPDI_FLASH_SIZE {0x02, 0x12}; - constexpr static Avr8EdbgParameter DEVICE_UPDI_EEPROM_SIZE {0x02, 0x16}; - constexpr static Avr8EdbgParameter DEVICE_UPDI_USER_SIG_SIZE {0x02, 0x18}; - constexpr static Avr8EdbgParameter DEVICE_UPDI_FUSE_SIZE {0x02, 0x1A}; - constexpr static Avr8EdbgParameter DEVICE_UPDI_EEPROM_BASE_ADDR {0x02, 0x20}; - constexpr static Avr8EdbgParameter DEVICE_UPDI_USER_SIG_BASE_ADDR {0x02, 0x22}; - constexpr static Avr8EdbgParameter DEVICE_UPDI_SIG_BASE_ADDR {0x02, 0x24}; - constexpr static Avr8EdbgParameter DEVICE_UPDI_FUSE_BASE_ADDR {0x02, 0x26}; - constexpr static Avr8EdbgParameter DEVICE_UPDI_LOCK_BASE_ADDR {0x02, 0x28}; - constexpr static Avr8EdbgParameter DEVICE_UPDI_DEVICE_ID {0x02, 0x2A}; - constexpr static Avr8EdbgParameter DEVICE_UPDI_PROGMEM_BASE_ADDR_MSB {0x02, 0x2C}; - constexpr static Avr8EdbgParameter DEVICE_UPDI_FLASH_PAGE_SIZE_MSB {0x02, 0x2D}; - constexpr static Avr8EdbgParameter DEVICE_UPDI_24_BIT_ADDRESSING_ENABLE {0x02, 0x2E}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_PROGMEM_BASE_ADDR {0x02, 0x00}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_FLASH_PAGE_SIZE {0x02, 0x02}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_EEPROM_PAGE_SIZE {0x02, 0x03}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_NVMCTRL_ADDR {0x02, 0x04}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_OCD_ADDR {0x02, 0x06}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_FLASH_SIZE {0x02, 0x12}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_EEPROM_SIZE {0x02, 0x16}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_USER_SIG_SIZE {0x02, 0x18}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_FUSE_SIZE {0x02, 0x1A}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_EEPROM_BASE_ADDR {0x02, 0x20}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_USER_SIG_BASE_ADDR {0x02, 0x22}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_SIG_BASE_ADDR {0x02, 0x24}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_FUSE_BASE_ADDR {0x02, 0x26}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_LOCK_BASE_ADDR {0x02, 0x28}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_DEVICE_ID {0x02, 0x2A}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_PROGMEM_BASE_ADDR_MSB {0x02, 0x2C}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_FLASH_PAGE_SIZE_MSB {0x02, 0x2D}; + static constexpr Avr8EdbgParameter DEVICE_UPDI_24_BIT_ADDRESSING_ENABLE {0x02, 0x2E}; - constexpr static Avr8EdbgParameter RUN_TIMERS_WHILST_STOPPED {0x03, 0x00}; - constexpr static Avr8EdbgParameter ENABLE_HIGH_VOLTAGE_UPDI {0x03, 0x06}; + static constexpr Avr8EdbgParameter RUN_TIMERS_WHILST_STOPPED {0x03, 0x00}; + static constexpr Avr8EdbgParameter ENABLE_HIGH_VOLTAGE_UPDI {0x03, 0x06}; }; enum class Avr8ConfigVariant: unsigned char diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AVR8Generic/ReadMemory.cpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AVR8Generic/ReadMemory.cpp index a7f7c478..f3192a4c 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AVR8Generic/ReadMemory.cpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AVR8Generic/ReadMemory.cpp @@ -29,7 +29,7 @@ std::vector ReadMemory::getPayload() const { output[10] = static_cast(this->bytes >> 24); if (!this->excludedAddresses.empty()) { - auto const endAddress = this->address + (this->bytes - 1); + const auto endAddress = this->address + (this->bytes - 1); constexpr auto byteBitSize = std::numeric_limits::digits; auto byteBitset = std::bitset(); diff --git a/src/EventManager/EventListener.cpp b/src/EventManager/EventListener.cpp index 6ea9907c..d2575909 100644 --- a/src/EventManager/EventListener.cpp +++ b/src/EventManager/EventListener.cpp @@ -69,7 +69,7 @@ void EventListener::dispatchEvent(const SharedGenericEventPointer& event) { void EventListener::dispatchCurrentEvents() { auto events = this->getEvents(); - for (auto const& event: events) { + for (const auto& event: events) { dispatchEvent(event); } } diff --git a/src/EventManager/EventManager.cpp b/src/EventManager/EventManager.cpp index 2f37377c..161297da 100644 --- a/src/EventManager/EventManager.cpp +++ b/src/EventManager/EventManager.cpp @@ -15,7 +15,7 @@ void EventManager::deregisterListener(size_t listenerId) { void EventManager::triggerEvent(const std::shared_ptr& event) { auto registerListenersLock = std::unique_lock(this->registerListenerMutex); - for(auto const& [listenerId, listener] : this->registeredListeners) { + for(const auto& [listenerId, listener] : this->registeredListeners) { if (listener->isEventTypeRegistered(event->getType())) { listener->registerEvent(event); } @@ -25,7 +25,7 @@ void EventManager::triggerEvent(const std::shared_ptr& even bool EventManager::isEventTypeListenedFor(Events::EventType eventType) { auto registerListenersLock = std::unique_lock(this->registerListenerMutex); - for(auto const& [listenerId, listener] : this->registeredListeners) { + for(const auto& [listenerId, listener] : this->registeredListeners) { if (listener->isEventTypeRegistered(eventType)) { return true; } diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/BitsetWidget/BitBodyWidget.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/BitsetWidget/BitBodyWidget.hpp index b1112478..eebe6495 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/BitsetWidget/BitBodyWidget.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/BitsetWidget/BitBodyWidget.hpp @@ -18,8 +18,8 @@ namespace Bloom::Widgets Q_OBJECT public: - constexpr static int WIDTH = 23; - constexpr static int HEIGHT = 30; + static constexpr int WIDTH = 23; + static constexpr int HEIGHT = 30; BitBodyWidget( int bitIndex, diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/BitsetWidget/BitWidget.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/BitsetWidget/BitWidget.hpp index a833141c..8ff07e97 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/BitsetWidget/BitWidget.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/BitsetWidget/BitWidget.hpp @@ -20,15 +20,15 @@ namespace Bloom::Widgets Q_OBJECT private: - const static int VERTICAL_SPACING = 3; + static const int VERTICAL_SPACING = 3; public: - constexpr static int LABEL_HEIGHT = 14; - constexpr static int LABEL_COUNT = 2; - constexpr static int WIDTH = BitBodyWidget::WIDTH; - constexpr static int HEIGHT = BitBodyWidget::HEIGHT + (BitWidget::LABEL_HEIGHT * BitWidget::LABEL_COUNT) + static constexpr int LABEL_HEIGHT = 14; + static constexpr int LABEL_COUNT = 2; + static constexpr int WIDTH = BitBodyWidget::WIDTH; + static constexpr int HEIGHT = BitBodyWidget::HEIGHT + (BitWidget::LABEL_HEIGHT * BitWidget::LABEL_COUNT) + BitWidget::VERTICAL_SPACING; - constexpr static int SPACING = 6; + static constexpr int SPACING = 6; BitWidget( int bitIndex, diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/BitsetWidget/BitsetWidget.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/BitsetWidget/BitsetWidget.hpp index be4178e9..571dfaa3 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/BitsetWidget/BitsetWidget.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/BitsetWidget/BitsetWidget.hpp @@ -16,9 +16,9 @@ namespace Bloom::Widgets Q_OBJECT public: - constexpr static int VALUE_GRAPHIC_HEIGHT = 20; - constexpr static int HEIGHT = BitWidget::HEIGHT + BitsetWidget::VALUE_GRAPHIC_HEIGHT + 8; - constexpr static int WIDTH = (BitWidget::WIDTH + BitWidget::SPACING) * 8; + static constexpr int VALUE_GRAPHIC_HEIGHT = 20; + static constexpr int HEIGHT = BitWidget::HEIGHT + BitsetWidget::VALUE_GRAPHIC_HEIGHT + 8; + static constexpr int WIDTH = (BitWidget::WIDTH + BitWidget::SPACING) * 8; BitsetWidget(int byteNumber, unsigned char& byte, bool readOnly, QWidget* parent);