diff --git a/src/Accelerometers/LISAccelerometer.cpp b/src/Accelerometers/LISAccelerometer.cpp index 836566a1cf..4c65948ad5 100644 --- a/src/Accelerometers/LISAccelerometer.cpp +++ b/src/Accelerometers/LISAccelerometer.cpp @@ -53,7 +53,7 @@ bool LISAccelerometer::CheckPresent() noexcept } // Return the type name of the accelerometer. Only valid after checkPresent returns true. -const char *LISAccelerometer::GetTypeName() const noexcept +const char *_ecv_array LISAccelerometer::GetTypeName() const noexcept { return accelerometerType.ToString(); } @@ -61,7 +61,7 @@ const char *LISAccelerometer::GetTypeName() const noexcept uint8_t LISAccelerometer::ReadStatus() noexcept { uint8_t val; - return (ReadRegister(LisRegister::Status, val)) ? val : 0xFF; + return (ReadRegister(LisRegister::Status, val)) ? val : 0xFFu; } // Configure the accelerometer to collect for the requested axis at or near the requested sampling rate and the requested resolution in bits. @@ -347,7 +347,7 @@ bool LISAccelerometer::ReadRegisters(LisRegister reg, size_t numToRead) noexcept // On the LIS3DH, bit 6 must be set to 1 to auto-increment the address when doing reading multiple registers // On the LIS3DSH and LIS2DW, bit 6 is an extra register address bit, so we must not set it. // So that we can read the WHO_AM_I register of both chips before we know which chip we have, only set bit 6 if we have a LIS3DH and we are reading multiple registers. - transferBuffer[1] = (uint8_t)reg | ((numToRead < 2 || accelerometerType != AccelerometerType::LIS3DH) ? 0x80 : 0xC0); + transferBuffer[1] = (uint8_t)reg | ((numToRead < 2 || accelerometerType != AccelerometerType::LIS3DH) ? 0x80u : 0xC0u); const bool ret = TransceivePacket(transferBuffer + 1, transferBuffer + 1, 1 + numToRead); Deselect(); return ret; @@ -364,7 +364,7 @@ bool LISAccelerometer::WriteRegisters(LisRegister reg, size_t numToWrite) noexce { return false; } - transferBuffer[1] = (numToWrite < 2 || accelerometerType != AccelerometerType::LIS3DH) ? (uint8_t)reg : (uint8_t)reg | 0x40; // set auto increment bit if LIS3DH + transferBuffer[1] = (numToWrite < 2 || accelerometerType != AccelerometerType::LIS3DH) ? (uint8_t)reg : (uint8_t)reg | 0x40u; // set auto increment bit if LIS3DH const bool ret = TransceivePacket(transferBuffer + 1, transferBuffer + 1, 1 + numToWrite); Deselect(); return ret; diff --git a/src/Accelerometers/LISAccelerometer.h b/src/Accelerometers/LISAccelerometer.h index fd28eb68a3..d7f888233e 100644 --- a/src/Accelerometers/LISAccelerometer.h +++ b/src/Accelerometers/LISAccelerometer.h @@ -23,7 +23,7 @@ class LISAccelerometer : public SharedSpiClient bool CheckPresent() noexcept; // Return the type name of the accelerometer. Only valid after checkPresent returns true. - const char *GetTypeName() const noexcept; + const char *_ecv_array GetTypeName() const noexcept; // Configure the accelerometer to collect at or near the requested sampling rate and the requested resolution in bits. bool Configure(uint16_t& p_samplingRate, uint8_t& p_resolution) noexcept; @@ -64,7 +64,7 @@ class LISAccelerometer : public SharedSpiClient bool ReadRegister(LisRegister reg, uint8_t& val) noexcept; bool WriteRegister(LisRegister reg, uint8_t val) noexcept; - volatile TaskHandle taskWaiting; + volatile TaskHandle _ecv_null taskWaiting; uint32_t firstInterruptTime; uint32_t lastInterruptTime; uint32_t totalNumRead; diff --git a/src/Comms/AuxDevice.cpp b/src/Comms/AuxDevice.cpp index 23b8fd70da..159ed05647 100644 --- a/src/Comms/AuxDevice.cpp +++ b/src/Comms/AuxDevice.cpp @@ -58,7 +58,7 @@ void AuxDevice::Disable() noexcept } } -void AuxDevice::SendPanelDueMessage(const char* msg) noexcept +void AuxDevice::SendPanelDueMessage(const char *_ecv_array msg) noexcept { if (mode == AuxMode::panelDue) { @@ -72,7 +72,7 @@ void AuxDevice::SendPanelDueMessage(const char* msg) noexcept } } -void AuxDevice::AppendAuxReply(const char *msg, bool rawMessage) noexcept +void AuxDevice::AppendAuxReply(const char *_ecv_array msg, bool rawMessage) noexcept { // Discard this response if either no aux device is attached or if the response is empty if (msg[0] != 0 && IsEnabledForGCodeIo()) @@ -95,7 +95,7 @@ void AuxDevice::AppendAuxReply(const char *msg, bool rawMessage) noexcept } } -void AuxDevice::AppendAuxReply(OutputBuffer *reply, bool rawMessage) noexcept +void AuxDevice::AppendAuxReply(OutputBuffer *_ecv_array reply, bool rawMessage) noexcept { // Discard this response if either no aux device is attached or if the response is empty if (reply == nullptr || reply->Length() == 0 || !IsEnabledForGCodeIo()) @@ -134,7 +134,7 @@ bool AuxDevice::Flush() noexcept if (hasMore) { MutexLocker lock(mutex); - OutputBuffer *auxOutputBuffer = outStack.GetFirstItem(); + OutputBuffer *_ecv_null auxOutputBuffer = outStack.GetFirstItem(); if (auxOutputBuffer == nullptr) { (void)outStack.Pop(); @@ -447,7 +447,7 @@ uint32_t AuxDevice::CalcTransmissionTime(unsigned int numChars) const noexcept } // Send some data to the Uart. Returns GCodeResult::error if we failed to acquire the mutex, GCodeResult::ok if we sent the data. -GCodeResult AuxDevice::SendUartData(const uint8_t *data, size_t len) noexcept +GCodeResult AuxDevice::SendUartData(const uint8_t *_ecv_array data, size_t len) noexcept { if (!mutex.Take(BusAvailableTimeout)) { @@ -474,7 +474,7 @@ GCodeResult AuxDevice::SendUartData(const uint8_t *data, size_t len) noexcept return GCodeResult::ok; } -GCodeResult AuxDevice::ReadUartData(uint8_t *data, size_t bytesToRead) noexcept +GCodeResult AuxDevice::ReadUartData(uint8_t *_ecv_array data, size_t bytesToRead) noexcept { if (!mutex.Take(BusAvailableTimeout)) { diff --git a/src/Comms/AuxDevice.h b/src/Comms/AuxDevice.h index 59bc9c0eac..8e925696c2 100644 --- a/src/Comms/AuxDevice.h +++ b/src/Comms/AuxDevice.h @@ -42,27 +42,27 @@ class AuxDevice uint32_t GetBaudRate() const noexcept { return baudRate; } bool IsRaw() const noexcept { return mode == AuxMode::raw; } - void SendPanelDueMessage(const char* msg) noexcept; - void AppendAuxReply(const char *msg, bool rawMessage) noexcept; - void AppendAuxReply(OutputBuffer *reply, bool rawMessage) noexcept; + void SendPanelDueMessage(const char *_ecv_array msg) noexcept; + void AppendAuxReply(const char *_ecv_array msg, bool rawMessage) noexcept; + void AppendAuxReply(OutputBuffer *_ecv_array reply, bool rawMessage) noexcept; bool Flush() noexcept; void Diagnostics(MessageType mt, unsigned int index) noexcept; #if SUPPORT_MODBUS_RTU - bool ConfigureDirectionPort(const char *pinName, const StringRef& reply) THROWS(GCodeException); + bool ConfigureDirectionPort(const char *_ecv_array pinName, const StringRef& reply) THROWS(GCodeException); void AppendDirectionPortName(const StringRef& reply) const noexcept; - GCodeResult SendModbusRegisters(uint8_t p_slaveAddress, uint8_t p_function, uint16_t p_startRegister, uint16_t p_numRegisters, const uint8_t *data) noexcept; - GCodeResult ReadModbusRegisters(uint8_t p_slaveAddress, uint8_t p_function, uint16_t p_startRegister, uint16_t p_numRegisters, uint8_t *data) noexcept + GCodeResult SendModbusRegisters(uint8_t p_slaveAddress, uint8_t p_function, uint16_t p_startRegister, uint16_t p_numRegisters, const uint8_t *_ecv_array data) noexcept; + GCodeResult ReadModbusRegisters(uint8_t p_slaveAddress, uint8_t p_function, uint16_t p_startRegister, uint16_t p_numRegisters, uint8_t *_ecv_array data) noexcept pre(function == 3 || function == 4); GCodeResult CheckModbusResult() noexcept; void TxEndedCallback() noexcept; #endif - GCodeResult SendUartData(const uint8_t *data, size_t len) noexcept; - GCodeResult ReadUartData(uint8_t *data, size_t bytesToRead) noexcept; + GCodeResult SendUartData(const uint8_t *_ecv_array data, size_t len) noexcept; + GCodeResult ReadUartData(uint8_t *_ecv_array data, size_t bytesToRead) noexcept; private: uint32_t CalcTransmissionTime(unsigned int numChars) const noexcept; // calculate the time in milliseconds to send or received the specified number of characters @@ -83,7 +83,7 @@ class AuxDevice static constexpr uint32_t BusAvailableTimeout = 50; // how many milliseconds we wait for the device to become available static constexpr uint32_t UartResponseTimeout = 200; // how many milliseconds we wait for the device to respond, excluding transmission time - AsyncSerial *uart; // the underlying serial device + AsyncSerial *_ecv_null uart; // the underlying serial device Mutex mutex; volatile OutputStack outStack; // output stack for use in raw or PanelDue mode uint32_t seq; // sequence number for output in PanelDue mode @@ -92,7 +92,7 @@ class AuxDevice #if SUPPORT_MODBUS_RTU IoPort txNotRx; // port used to switch the RS485 port between transmit and receive - uint8_t *receivedData; + uint8_t *_ecv_array receivedData; uint32_t whenStartedTransmitting; CRC16 crc; uint16_t bytesTransmitted; diff --git a/src/Config/Pins.h b/src/Config/Pins.h index 2a275a3c61..5dd0ff9f0c 100644 --- a/src/Config/Pins.h +++ b/src/Config/Pins.h @@ -337,4 +337,7 @@ # error Cannot support Modbus RTU without aux devices #endif +// Function to look up a pin name pass back the corresponding index into the pin table +bool LookupPinName(const char *_ecv_array pn, LogicalPin& lpin, bool& hardwareInverted) noexcept; + #endif // PINS_H__ diff --git a/src/Config/Pins_Duet3Mini.h b/src/Config/Pins_Duet3Mini.h index 88833a637d..c21fba4043 100644 --- a/src/Config/Pins_Duet3Mini.h +++ b/src/Config/Pins_Duet3Mini.h @@ -336,9 +336,6 @@ constexpr Pin CanTxPin = PortBPin(14); constexpr Pin CanRxPin = PortBPin(15); constexpr GpioPinFunction CanPinsMode = GpioPinFunction::H; -// Function to look up a pin name and pass back the corresponding index into the pin table -bool LookupPinName(const char *pn, LogicalPin& lpin, bool& hardwareInverted) noexcept; - // List of assignable pins and their mapping from names to MPU ports. This is indexed by logical pin number. // The names must match user input that has been concerted to lowercase and had _ and - characters stripped out. // Aliases are separate by the , character. diff --git a/src/Config/Pins_Duet3_MB6HC.h b/src/Config/Pins_Duet3_MB6HC.h index 1716a2c233..a47548f935 100644 --- a/src/Config/Pins_Duet3_MB6HC.h +++ b/src/Config/Pins_Duet3_MB6HC.h @@ -381,9 +381,6 @@ constexpr PinDescription PinTable[] = constexpr unsigned int NumNamedPins = ARRAY_SIZE(PinTable); static_assert(NumNamedPins == 32+32+32+32+6); -// Function to look up a pin name pass back the corresponding index into the pin table -bool LookupPinName(const char *pn, LogicalPin& lpin, bool& hardwareInverted) noexcept; - // Serial Interfaces constexpr Pin APIN_Serial0_RXD = PortDPin(25); constexpr Pin APIN_Serial0_TXD = PortDPin(26); diff --git a/src/Config/Pins_Duet3_MB6XD.h b/src/Config/Pins_Duet3_MB6XD.h index f29f5e5838..3a56b33843 100644 --- a/src/Config/Pins_Duet3_MB6XD.h +++ b/src/Config/Pins_Duet3_MB6XD.h @@ -340,9 +340,6 @@ constexpr PinDescription PinTable[] = constexpr unsigned int NumNamedPins = ARRAY_SIZE(PinTable); static_assert(NumNamedPins == 32+32+32+32+6); -// Function to look up a pin name pass back the corresponding index into the pin table -bool LookupPinName(const char *pn, LogicalPin& lpin, bool& hardwareInverted) noexcept; - // Serial Interfaces constexpr Pin APIN_Serial0_RXD = PortDPin(25); constexpr Pin APIN_Serial0_TXD = PortDPin(26); diff --git a/src/Config/Pins_DuetM.h b/src/Config/Pins_DuetM.h index a76970d120..ab22c6f2f3 100644 --- a/src/Config/Pins_DuetM.h +++ b/src/Config/Pins_DuetM.h @@ -310,9 +310,6 @@ constexpr PinDescription PinTable[] = constexpr unsigned int NumNamedPins = ARRAY_SIZE(PinTable); static_assert(NumNamedPins == 3*32); -// Function to look up a pin name and pass back the corresponding index into the pin table -bool LookupPinName(const char *pn, LogicalPin& lpin, bool& hardwareInverted) noexcept; - // Wire Interfaces #define WIRE_INTERFACES_COUNT (1) // SAM4S supports two I2C interfaces but we only have the first one available diff --git a/src/Config/Pins_DuetNG.h b/src/Config/Pins_DuetNG.h index f904627ca7..49c386c346 100644 --- a/src/Config/Pins_DuetNG.h +++ b/src/Config/Pins_DuetNG.h @@ -437,9 +437,6 @@ constexpr PinDescription PinTable[] = constexpr unsigned int NumNamedPins = ARRAY_SIZE(PinTable); static_assert(NumNamedPins == 32+32+32+32+6+16+16); -// Function to look up a pin name pass back the corresponding index into the pin table -bool LookupPinName(const char *pn, LogicalPin& lpin, bool& hardwareInverted) noexcept; - // USARTs used for SPI constexpr Pin APIN_USART_SSPI_MOSI = PortBPin(1); constexpr GpioPinFunction USARTSPIMosiPeriphMode = GpioPinFunction::C; diff --git a/src/Config/Pins_FMDC.h b/src/Config/Pins_FMDC.h index 8a3b1202a0..659c6c8534 100644 --- a/src/Config/Pins_FMDC.h +++ b/src/Config/Pins_FMDC.h @@ -315,9 +315,6 @@ constexpr Pin EspDataReadyPin = PortAPin(18); constexpr Pin SamTfrReadyPin = PortAPin(19); constexpr Pin SamCsPin = PortAPin(14); -// Function to look up a pin name and pass back the corresponding index into the pin table -bool LookupPinName(const char *pn, LogicalPin& lpin, bool& hardwareInverted) noexcept; - // List of assignable pins and their mapping from names to MPU ports. This is indexed by logical pin number. // The names must match user input that has been concerted to lowercase and had _ and - characters stripped out. // Aliases are separate by the , character. diff --git a/src/Config/Pins_Pccb.h b/src/Config/Pins_Pccb.h index a96ad3cd00..c022d4395f 100644 --- a/src/Config/Pins_Pccb.h +++ b/src/Config/Pins_Pccb.h @@ -360,8 +360,6 @@ constexpr PinDescription PinTable[] = constexpr unsigned int NumNamedPins = ARRAY_SIZE(PinTable); static_assert(NumNamedPins == 3*32); -// Function to look up a pin name pass back the corresponding index into the pin table -bool LookupPinName(const char *pn, LogicalPin& lpin, bool& hardwareInverted) noexcept; // Wire Interfaces #define WIRE_INTERFACES_COUNT (1) // SAM4S supports two I2C interfaces but we only have the first one available diff --git a/src/FilamentMonitors/FilamentMonitor.h b/src/FilamentMonitors/FilamentMonitor.h index c959c542fd..744d588e35 100644 --- a/src/FilamentMonitors/FilamentMonitor.h +++ b/src/FilamentMonitors/FilamentMonitor.h @@ -30,10 +30,10 @@ class FilamentMonitor INHERIT_OBJECT_MODEL { public: // Override the virtual destructor if your derived class allocates any dynamic memory - virtual ~FilamentMonitor() noexcept; + virtual ~FilamentMonitor() noexcept override; // We don't want to copy filament monitors - FilamentMonitor(const FilamentMonitor&) = delete; + FilamentMonitor(const FilamentMonitor &_ecv_from) = delete; // Static initialisation static void InitStatic() noexcept; @@ -59,7 +59,7 @@ class FilamentMonitor INHERIT_OBJECT_MODEL static size_t GetNumMonitorsToReport() noexcept; // Get access to a filament monitor when we already have a read lock - static FilamentMonitor *GetMonitorAlreadyLocked(size_t extruder) noexcept { return filamentSensors[extruder]; } + static FilamentMonitor *_ecv_from GetMonitorAlreadyLocked(size_t extruder) noexcept { return filamentSensors[extruder]; } #endif #if SUPPORT_CAN_EXPANSION @@ -119,7 +119,7 @@ class FilamentMonitor INHERIT_OBJECT_MODEL uint8_t GetDriver() const noexcept { return driveNumber; } // Get the status of the filament monitor as a string - const char *GetStatusText() const noexcept { return lastStatus.ToString(); } + const char *_ecv_array GetStatusText() const noexcept { return lastStatus.ToString(); } // Call the following at intervals to check the status. This is only called when extrusion is in progress or imminent. // 'filamentConsumed' is the net amount of extrusion since the last call to this function. @@ -163,7 +163,7 @@ class FilamentMonitor INHERIT_OBJECT_MODEL private: // Create a filament sensor returning null if not a valid sensor type - static FilamentMonitor *Create(unsigned int extruder, unsigned int monitorType, GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); + static FilamentMonitor *_ecv_from Create(unsigned int extruder, unsigned int monitorType, GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); static void InterruptEntry(CallbackParameter param) noexcept; static constexpr size_t NumFilamentMonitors = @@ -174,7 +174,7 @@ class FilamentMonitor INHERIT_OBJECT_MODEL MaxExtruders; #endif - static FilamentMonitor *filamentSensors[NumFilamentMonitors]; + static FilamentMonitor *_ecv_from filamentSensors[NumFilamentMonitors]; #if SUPPORT_REMOTE_COMMANDS static constexpr uint32_t StatusUpdateInterval = 2000; // how often we send status reports when there isn't a change diff --git a/src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp b/src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp index e14ff7bd25..93ef10e16f 100644 --- a/src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp +++ b/src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp @@ -45,7 +45,6 @@ constexpr ObjectModelTableEntry RotatingMagnetFilamentMonitor::objectModelTable[ { "configured", OBJECT_MODEL_FUNC(self, 2), ObjectModelEntryFlags::none }, #ifdef DUET3_ATE { "mag", OBJECT_MODEL_FUNC((int32_t)self->magnitude), ObjectModelEntryFlags::live }, - { "position", OBJECT_MODEL_FUNC((int32_t)self->lastKnownPosition), ObjectModelEntryFlags::live }, #endif // 1. RotatingMagnetFilamentMonitor.calibrated members @@ -66,7 +65,7 @@ constexpr uint8_t RotatingMagnetFilamentMonitor::objectModelTableDescriptor[] = { 3, #ifdef DUET3_ATE - 5, + 4, #else 2, #endif diff --git a/src/GCodes/GCodeBuffer/ExpressionParser.h b/src/GCodes/GCodeBuffer/ExpressionParser.h index 17ed512de0..38de851733 100644 --- a/src/GCodes/GCodeBuffer/ExpressionParser.h +++ b/src/GCodes/GCodeBuffer/ExpressionParser.h @@ -45,7 +45,7 @@ class LineReader class ExpressionParser { public: - ExpressionParser(const GCodeBuffer& p_gb, const char *text, const char *textLimit, int p_column = -1) noexcept; + ExpressionParser(const GCodeBuffer& p_gb, const char *_ecv_array text, const char *_ecv_array textLimit, int p_column = -1) noexcept; ExpressionValue Parse(bool evaluate = true) THROWS(GCodeException); bool ParseBoolean() THROWS(GCodeException); @@ -64,23 +64,23 @@ class ExpressionParser const char *GetEndptr() const noexcept { return currentp; } private: - [[noreturn]] void __attribute__((noinline)) ThrowParseException(const char *str) const THROWS(GCodeException); - [[noreturn]] void __attribute__((noinline)) ThrowParseException(const char *str, const char *param) const THROWS(GCodeException); - [[noreturn]] void __attribute__((noinline)) ThrowParseException(const char *str, uint32_t param) const THROWS(GCodeException); + [[noreturn]] void __attribute__((noinline)) ThrowParseException(const char *_ecv_array str) const THROWS(GCodeException); + [[noreturn]] void __attribute__((noinline)) ThrowParseException(const char *_ecv_array str, const char *param) const THROWS(GCodeException); + [[noreturn]] void __attribute__((noinline)) ThrowParseException(const char *_ecv_array str, uint32_t param) const THROWS(GCodeException); void __attribute__((noinline)) ParseInternal(ExpressionValue& val, bool evaluate, uint8_t priority) THROWS(GCodeException); void __attribute__((noinline)) ParseExpectKet(ExpressionValue& rslt, bool evaluate, char expectedKet) THROWS(GCodeException); void __attribute__((noinline)) ParseNumber(ExpressionValue& rslt) noexcept - pre(readPointer >= 0; isdigit(gb.buffer[readPointer])); + pre((bool)isdigit(*currentp)); void __attribute__((noinline)) ParseIdentifierExpression(ExpressionValue& rslt, bool evaluate, bool applyLengthOperator, bool applyExists) THROWS(GCodeException) - pre(readPointer >= 0; isalpha(gb.buffer[readPointer])); + pre((bool)isalpha(*currentp)); void __attribute__((noinline)) ParseQuotedString(ExpressionValue& rslt) THROWS(GCodeException); void ParseCharacter(ExpressionValue& rslt) THROWS(GCodeException); void ParseGeneralArray(ExpressionValue& firstElementAndResult, bool evaluate) THROWS(GCodeException); void ParseArray(size_t& length, function_ref processElement) THROWS(GCodeException); - time_t __attribute__((noinline)) ParseDateTime(const char *s) const THROWS(GCodeException); + time_t __attribute__((noinline)) ParseDateTime(const char *_ecv_array s) const THROWS(GCodeException); void __attribute__((noinline)) GetVariableValue(ExpressionValue& rslt, const VariableSet *vars, const char *name, ObjectExplorationContext& context, bool isParameter, bool applyLengthOperator, bool wantExists) THROWS(GCodeException); @@ -115,9 +115,9 @@ class ExpressionParser void AdvancePointer() noexcept; char SkipWhiteSpace() noexcept; - const char *currentp; - const char * const startp; - const char * const endp; + const char *_ecv_array currentp; + const char *_ecv_array const startp; + const char *_ecv_array const endp; const GCodeBuffer& gb; int column; String obsoleteField; diff --git a/src/GCodes/GCodeBuffer/StringParser.cpp b/src/GCodes/GCodeBuffer/StringParser.cpp index f0abe432e7..9f9c541bb9 100644 --- a/src/GCodes/GCodeBuffer/StringParser.cpp +++ b/src/GCodes/GCodeBuffer/StringParser.cpp @@ -91,7 +91,7 @@ bool StringParser::Put(char c) noexcept return LineFinished(); } - if (c == 0x7F && gb.bufferState != GCodeBufferState::discarding) + if (c == (char)0x7Fu && gb.bufferState != GCodeBufferState::discarding) { // The UART receiver stores 0x7F in the buffer if an overrun or framing errors occurs. So discard the command and resync on the next newline. gcodeLineEnd = 0; @@ -142,7 +142,7 @@ bool StringParser::Put(char c) noexcept if (isDigit(c)) { AddToChecksum(c); - receivedLineNumber = (10 * receivedLineNumber) + (c - '0'); + receivedLineNumber = (10 * receivedLineNumber) + (unsigned int)(c - '0'); break; } else @@ -230,6 +230,7 @@ bool StringParser::Put(char c) noexcept default: StoreAndAddToChecksum(c); + break; } break; @@ -258,7 +259,7 @@ bool StringParser::Put(char c) noexcept case GCodeBufferState::parsingChecksum: // parsing the checksum after '*' if (isDigit(c)) { - declaredChecksum = (10 * declaredChecksum) + (c - '0'); + declaredChecksum = (10 * declaredChecksum) + (unsigned int)(c - '0'); ++checksumCharsReceived; } else @@ -467,7 +468,7 @@ bool StringParser::ProcessConditionalGCode(const StringRef& reply, BlockType ski ) { readPointer = i; - const char * const command = gb.buffer; + const char *_ecv_array const command = gb.buffer; switch (i) { case 2: @@ -686,7 +687,7 @@ void StringParser::ProcessVarOrGlobalCommand(bool isGlobal) THROWS(GCodeExceptio // Get the identifier char c = gb.buffer[readPointer]; - if (!isalpha(c)) + if (!(bool)isalpha(c)) { throw ConstructParseException("expected a new variable name"); } @@ -696,7 +697,7 @@ void StringParser::ProcessVarOrGlobalCommand(bool isGlobal) THROWS(GCodeExceptio varName.cat(c); ++readPointer; c = gb.buffer[readPointer]; - } while (isalpha(c) || isdigit(c) || c == '_' ); + } while ((bool)isalpha(c) || (bool)isdigit(c) || c == '_' ); // Expect '=' SkipWhiteSpace(); @@ -710,7 +711,7 @@ void StringParser::ProcessVarOrGlobalCommand(bool isGlobal) THROWS(GCodeExceptio WriteLockedPointer vset = (isGlobal) ? reprap.GetGlobalVariablesForWriting() : WriteLockedPointer(nullptr, &gb.GetVariables()); - Variable * const v = vset->Lookup(varName.c_str(), false); + Variable *_ecv_null const v = vset->Lookup(varName.c_str(), false); if (v != nullptr) { // For now we don't allow an existing variable to be reassigned using a 'var' or 'global' statement. We may need to allow it for 'global' statements. @@ -718,9 +719,9 @@ void StringParser::ProcessVarOrGlobalCommand(bool isGlobal) THROWS(GCodeExceptio } SkipWhiteSpace(); - ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), commandIndent + readPointer); + ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), (int)commandIndent + readPointer); ExpressionValue ev = parser.Parse(); - vset->InsertNew(varName.c_str(), ev, (isGlobal) ? 0 : gb.CurrentFileMachineState().GetBlockNesting()); + vset->InsertNew(varName.c_str(), ev, (isGlobal) ? 0 : (int)gb.CurrentFileMachineState().GetBlockNesting()); if (isGlobal) { reprap.GlobalUpdated(); @@ -738,14 +739,14 @@ void StringParser::ProcessSetCommand() THROWS(GCodeException) // Skip the "var." or "global." prefix and get access to the appropriate variable set WriteLockedPointer vset = (isGlobal) - ? (readPointer += strlen("global."), reprap.GetGlobalVariablesForWriting()) + ? (readPointer += (int)strlen("global."), reprap.GetGlobalVariablesForWriting()) : (StringStartsWith(gb.buffer + readPointer, "var.")) - ? (readPointer += strlen("var."), WriteLockedPointer(nullptr, &gb.GetVariables())) + ? (readPointer += (int)strlen("var."), WriteLockedPointer(nullptr, &gb.GetVariables())) : throw ConstructParseException("expected a global or local variable"); // Get the identifier char c = gb.buffer[readPointer]; - if (!isalpha(c)) + if (!(bool)isalpha(c)) { throw ConstructParseException("expected a new variable name"); } @@ -756,10 +757,10 @@ void StringParser::ProcessSetCommand() THROWS(GCodeException) varName.cat(c); ++readPointer; c = gb.buffer[readPointer]; - } while (isalpha(c) || isdigit(c) || c == '_' ); + } while ((bool)isalpha(c) || (bool)isdigit(c) || c == '_' ); // Look up the identifier - Variable * const var = vset->Lookup(varName.c_str(), false); + Variable *_ecv_null const var = vset->Lookup(varName.c_str(), false); if (var == nullptr) { throw ConstructParseException("unknown variable '%s'", varName.c_str()); @@ -783,7 +784,7 @@ void StringParser::ProcessSetCommand() THROWS(GCodeException) } ++readPointer; - ExpressionParser indexParser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), commandIndent + readPointer); + ExpressionParser indexParser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), (int)commandIndent + readPointer); const uint32_t indexExpr = indexParser.ParseUnsigned(); readPointer = indexParser.GetEndptr() - gb.buffer; if (gb.buffer[readPointer] != ']') @@ -801,7 +802,7 @@ void StringParser::ProcessSetCommand() THROWS(GCodeException) } ++readPointer; - ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), commandIndent + readPointer); + ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), (int)commandIndent + readPointer); ExpressionValue ev = parser.Parse(); if (numIndices == 0) @@ -831,7 +832,7 @@ void StringParser::ProcessAbortCommand(const StringRef& reply) noexcept // If we fail to parse the expression, we want to abort anyway try { - ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), commandIndent + readPointer); + ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), (int)commandIndent + readPointer); const ExpressionValue val = parser.Parse(); readPointer = parser.GetEndptr() - gb.buffer; val.AppendAsString(reply); @@ -885,10 +886,10 @@ void StringParser::ProcessEchoCommand(const StringRef& reply) THROWS(GCodeExcept } String filename; GetQuotedString(filename.GetRef(), false); - FileStore * const f = reprap.GetPlatform().OpenSysFile(filename.c_str(), openMode); + FileStore *_ecv_null const f = reprap.GetPlatform().OpenSysFile(filename.c_str(), openMode); if (f == nullptr) { - throw GCodeException(&gb, readPointer + commandIndent, "Failed to create or open file"); + throw GCodeException(&gb, readPointer + (int)commandIndent, "Failed to create or open file"); } outputFile.Set(f); #else @@ -903,7 +904,7 @@ void StringParser::ProcessEchoCommand(const StringRef& reply) THROWS(GCodeExcept { break; } - ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), commandIndent + readPointer); + ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), (int)commandIndent + readPointer); const ExpressionValue val = parser.Parse(); readPointer = parser.GetEndptr() - gb.buffer; if (!reply.IsEmpty()) @@ -943,7 +944,7 @@ void StringParser::ProcessEchoCommand(const StringRef& reply) THROWS(GCodeExcept // Evaluate the condition that should follow 'if' or 'while' bool StringParser::EvaluateCondition() THROWS(GCodeException) { - ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), commandIndent + readPointer); + ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), (int)commandIndent + readPointer); const bool b = parser.ParseBoolean(); parser.CheckForExtraCharacters(); return b; @@ -964,7 +965,7 @@ void StringParser::DecodeCommand() noexcept } else { - cl = toupper(cl); + cl = (char)toupper(cl); } commandFraction = -1; if (cl == 'G' || cl == 'M' || cl == 'T') @@ -1096,10 +1097,10 @@ void StringParser::FindParameters() noexcept } else { - const char c2 = toupper(c); + const char c2 = (char)toupper(c); if (escaped) { - if (c2 >= 'A' && c2 <= toupper(HighestAxisLetter) && (c2 != 'E' || commandEnd == parameterStart || !isdigit(gb.buffer[commandEnd - 1]))) + if (c2 >= 'A' && c2 <= (char)toupper(HighestAxisLetter) && (c2 != 'E' || commandEnd == parameterStart || !isdigit(gb.buffer[commandEnd - 1]))) { parametersPresent.SetBit(c2 - ('A' - 26)); } @@ -1120,7 +1121,7 @@ void StringParser::FindParameters() noexcept } // Add an entire string, overwriting any existing content and adding '\n' at the end if necessary to make it a complete line -void StringParser::PutAndDecode(const char *str, size_t len) noexcept +void StringParser::PutAndDecode(const char *_ecv_array str, size_t len) noexcept { Init(); for (size_t i = 0; i < len; i++) @@ -1136,13 +1137,13 @@ void StringParser::PutAndDecode(const char *str, size_t len) noexcept DecodeCommand(); } -void StringParser::PutAndDecode(const char *str) noexcept +void StringParser::PutAndDecode(const char *_ecv_array str) noexcept { PutAndDecode(str, strlen(str)); } // Put a complete command but don't decode it -void StringParser::PutCommand(const char *str) noexcept +void StringParser::PutCommand(const char *_ecv_array str) noexcept { char c; do @@ -1182,7 +1183,7 @@ void StringParser::SetFinished() noexcept FilePosition StringParser::GetFilePosition() const noexcept { #if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES - const GCodeMachineState* ms = gb.machineState; + const GCodeMachineState *ms = gb.machineState; while (ms->waitingForAcknowledgement && ms->GetPrevious() != nullptr) { ms = ms->GetPrevious(); @@ -1226,7 +1227,7 @@ bool StringParser::Seen(char c) noexcept if (wantLowerCase) { bit = c - ('a' - 26); - c = toupper(c); + c = (char)toupper(c); } else { @@ -1256,7 +1257,7 @@ bool StringParser::Seen(char c) noexcept else { if ( inBrackets == 0 - && toupper(b) == c + && (char)toupper(b) == c && escaped == wantLowerCase && (c != 'E' || (unsigned int)readPointer == parameterStart || !isdigit(gb.buffer[readPointer - 1])) ) @@ -1305,7 +1306,7 @@ void StringParser::GetFloatArray(float arr[], size_t& returnedLength) THROWS(GCo if (gb.buffer[readPointer] == '{') { - ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), commandIndent + readPointer); + ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), (int)commandIndent + readPointer); parser.ParseFloatArray(arr, returnedLength); } else @@ -1338,7 +1339,7 @@ void StringParser::GetIntArray(int32_t arr[], size_t& returnedLength) THROWS(GCo if (gb.buffer[readPointer] == '{') { - ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), commandIndent + readPointer); + ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), (int)commandIndent + readPointer); parser.ParseIntArray(arr, returnedLength); } else @@ -1372,7 +1373,7 @@ void StringParser::GetUnsignedArray(uint32_t arr[], size_t& returnedLength) THRO if (gb.buffer[readPointer] == '{') { - ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), commandIndent + readPointer); + ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), (int)commandIndent + readPointer); parser.ParseUnsignedArray(arr, returnedLength); } else @@ -1406,7 +1407,7 @@ void StringParser::GetDriverIdArray(DriverId arr[], size_t& returnedLength) THRO if (gb.buffer[readPointer] == '{') { - ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), commandIndent + readPointer); + ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), (int)commandIndent + readPointer); parser.ParseDriverIdArray(arr, returnedLength); } else @@ -1435,7 +1436,7 @@ ExpressionValue StringParser::GetExpression() THROWS(GCodeException) { if (gb.buffer[readPointer] == '{') { - ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), commandIndent + readPointer); + ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), (int)commandIndent + readPointer); return parser.Parse(); } throw ConstructParseException("expected an expression inside { }"); @@ -1466,7 +1467,7 @@ void StringParser::GetQuotedString(const StringRef& str, bool allowEmpty) THROWS case '{': { - ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), commandIndent + readPointer); + ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), (int)commandIndent + readPointer); const ExpressionValue val = parser.Parse(); readPointer = parser.GetEndptr() - gb.buffer; val.AppendAsString(str); @@ -1548,7 +1549,7 @@ void StringParser::InternalGetPossiblyQuotedString(const StringRef& str) THROWS( } else if (gb.buffer[readPointer] == '{') { - ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), commandIndent + readPointer); + ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), (int)commandIndent + readPointer); const ExpressionValue val = parser.Parse(); readPointer = parser.GetEndptr() - gb.buffer; val.AppendAsString(str); @@ -1635,12 +1636,12 @@ void StringParser::GetIPAddress(IPAddress& returnedIp) THROWS(GCodeException) THROW_INTERNAL_ERROR; } - const char* p = gb.buffer + readPointer; + const char *_ecv_array p = gb.buffer + readPointer; uint8_t ip[4]; unsigned int n = 0; for (;;) { - const char *pp; + const char *_ecv_array pp; const uint32_t v = StrToU32(p, &pp); if (pp == p || v > 255) { @@ -1677,11 +1678,11 @@ void StringParser::GetMacAddress(MacAddress& mac) THROWS(GCodeException) THROW_INTERNAL_ERROR; } - const char* p = gb.buffer + readPointer; + const char *_ecv_array p = gb.buffer + readPointer; unsigned int n = 0; for (;;) { - const char *pp; + const char *_ecv_array pp; const unsigned long v = StrHexToU32(p, &pp); if (pp == p || v > 255) { @@ -1736,7 +1737,7 @@ void StringParser::AppendFullCommand(const StringRef &s) const noexcept for (size_t i = commandStart; i < cmdEnd; ++i) { const char c = gb.buffer[i]; - if (c < 0x20) + if (c < (char)0x20u) { s.catf("[0x%02x]", (unsigned int)c); } @@ -1756,7 +1757,7 @@ void StringParser::StartNewFile() noexcept #if HAS_MASS_STORAGE // Open a file to write to -bool StringParser::OpenFileToWrite(const char* directory, const char* fileName, const FilePosition size, const bool binaryWrite, const uint32_t fileCRC32) noexcept +bool StringParser::OpenFileToWrite(const char *_ecv_array directory, const char *_ecv_array fileName, const FilePosition size, const bool binaryWrite, const uint32_t fileCRC32) noexcept { fileBeingWritten = reprap.GetPlatform().OpenFile(directory, fileName, OpenMode::writeWithCrc); eofStringCounter = 0; @@ -1782,7 +1783,7 @@ void StringParser::WriteToFile() noexcept fileBeingWritten->Close(); fileBeingWritten = nullptr; Init(); - const char* const r = (gb.LatestMachineState().compatibility == Compatibility::Marlin) ? "Done saving file." : ""; + const char *_ecv_array const r = (gb.LatestMachineState().compatibility == Compatibility::Marlin) ? "Done saving file." : ""; reprap.GetGCodes().HandleReply(gb, GCodeResult::ok, r); return; } @@ -1851,7 +1852,7 @@ void StringParser::FinishWritingBinary() noexcept binaryWriting = false; if (crcOk) { - const char* const r = (gb.LatestMachineState().compatibility == Compatibility::Marlin) ? "Done saving file." : ""; + const char *_ecv_array const r = (gb.LatestMachineState().compatibility == Compatibility::Marlin) ? "Done saving file." : ""; reprap.GetGCodes().HandleReply(gb, GCodeResult::ok, r); } else @@ -1903,7 +1904,7 @@ bool StringParser::FileEnded() noexcept fileBeingWritten->Close(); fileBeingWritten = nullptr; SetFinished(); - const char* const r = (gb.LatestMachineState().compatibility == Compatibility::Marlin) ? "Done saving file." : ""; + const char *_ecv_array const r = (gb.LatestMachineState().compatibility == Compatibility::Marlin) ? "Done saving file." : ""; reprap.GetGCodes().HandleReply(gb, GCodeResult::ok, r); return false; } @@ -1934,7 +1935,7 @@ float StringParser::ReadFloatValue() THROWS(GCodeException) { if (gb.buffer[readPointer] == '{') { - ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), commandIndent + readPointer); + ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), (int)commandIndent + readPointer); const float val = parser.ParseFloat(); readPointer = parser.GetEndptr() - gb.buffer; return val; @@ -1950,7 +1951,7 @@ uint32_t StringParser::ReadUIValue() THROWS(GCodeException) { if (gb.buffer[readPointer] == '{') { - ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), commandIndent + readPointer); + ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), (int)commandIndent + readPointer); const uint32_t val = parser.ParseUnsigned(); readPointer = parser.GetEndptr() - gb.buffer; return val; @@ -1967,7 +1968,7 @@ int32_t StringParser::ReadIValue() THROWS(GCodeException) { if (gb.buffer[readPointer] == '{') { - ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), commandIndent + readPointer); + ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), (int)commandIndent + readPointer); const int32_t val = parser.ParseInteger(); readPointer = parser.GetEndptr() - gb.buffer; return val; @@ -1986,7 +1987,7 @@ DriverId StringParser::ReadDriverIdValue() THROWS(GCodeException) { // Allow a floating point expression to be converted to a driver ID // We assume that a driver ID only ever has a single fractional digit. This means that e.g. 3.10 will be treated the same as 3.1. - ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), commandIndent + readPointer); + ExpressionParser parser(gb, gb.buffer + readPointer, gb.buffer + ARRAY_SIZE(gb.buffer), (int)commandIndent + readPointer); const float val = 10.0 * parser.ParseFloat(); readPointer = parser.GetEndptr() - gb.buffer; const int32_t ival = lrintf(val); @@ -2059,7 +2060,7 @@ void StringParser::AddParameters(VariableSet& vs, int codeRunning) THROWS(GCodeE if ((letter != 'P' || codeRunning != 98) && Seen(letter)) { const char c = gb.buffer[readPointer]; - if (!isdigit(c) && c != '"' && c != '{' && c != '.' && c != '-' && c != '+') + if (!(bool)isdigit(c) && c != '"' && c != '{' && c != '.' && c != '-' && c != '+') { throw ConstructParseException("invalid value for parameter '%c'", (uint32_t)c); } @@ -2072,17 +2073,17 @@ void StringParser::AddParameters(VariableSet& vs, int codeRunning) THROWS(GCodeE ); } -GCodeException StringParser::ConstructParseException(const char *str) const noexcept +GCodeException StringParser::ConstructParseException(const char *_ecv_array str) const noexcept { return GCodeException(&gb, GetColumn(), str); } -GCodeException StringParser::ConstructParseException(const char *str, const char *param) const noexcept +GCodeException StringParser::ConstructParseException(const char *_ecv_array str, const char *_ecv_array param) const noexcept { return GCodeException(&gb, GetColumn(), str, param); } -GCodeException StringParser::ConstructParseException(const char *str, uint32_t param) const noexcept +GCodeException StringParser::ConstructParseException(const char *_ecv_array str, uint32_t param) const noexcept { return GCodeException(&gb, GetColumn(), str, param); } @@ -2090,7 +2091,7 @@ GCodeException StringParser::ConstructParseException(const char *str, uint32_t p // Get the current column if we can, else return -1 int StringParser::GetColumn() const noexcept { - return (readPointer < 0) ? -1 : readPointer + commandIndent; + return (readPointer < 0) ? -1 : readPointer + (int)commandIndent; } // End diff --git a/src/GCodes/GCodeBuffer/StringParser.h b/src/GCodes/GCodeBuffer/StringParser.h index 9d861c804c..6c64b83e5c 100644 --- a/src/GCodes/GCodeBuffer/StringParser.h +++ b/src/GCodes/GCodeBuffer/StringParser.h @@ -27,10 +27,10 @@ class StringParser explicit StringParser(GCodeBuffer& gcodeBuffer) noexcept; void Init() noexcept; // Set it up to parse another G-code bool Put(char c) noexcept SPEED_CRITICAL; // Add a character to the end - void PutCommand(const char *str) noexcept; // Put a complete command but don't decode it + void PutCommand(const char *_ecv_array str) noexcept; // Put a complete command but don't decode it void DecodeCommand() noexcept; // Decode the next command in the line - void PutAndDecode(const char *str, size_t len) noexcept; // Add an entire string, overwriting any existing content - void PutAndDecode(const char *str) noexcept; // Add a null-terminated string, overwriting any existing content + void PutAndDecode(const char *_ecv_array str, size_t len) noexcept; // Add an entire string, overwriting any existing content + void PutAndDecode(const char *_ecv_array str) noexcept; // Add a null-terminated string, overwriting any existing content void StartNewFile() noexcept; // Called when we start a new file bool FileEnded() noexcept; // Called when we reach the end of the file we are reading from bool CheckMetaCommand(const StringRef& reply) THROWS(GCodeException); // Check whether the current command is a meta command, or we are skipping block @@ -67,7 +67,7 @@ class StringParser void SetCommsProperties(uint32_t arg) noexcept { checksumRequired = (arg & 1); crcRequired = (arg & 4); } #if HAS_MASS_STORAGE - bool OpenFileToWrite(const char* directory, const char* fileName, const FilePosition size, const bool binaryWrite, const uint32_t fileCRC32) noexcept; + bool OpenFileToWrite(const char *_ecv_array directory, const char *_ecv_array fileName, const FilePosition size, const bool binaryWrite, const uint32_t fileCRC32) noexcept; // Open a file to write to bool IsWritingFile() const noexcept { return fileBeingWritten != nullptr; } // Returns true if writing a file void WriteToFile() noexcept; // Write the current GCode to file @@ -86,9 +86,9 @@ class StringParser void AppendFullCommand(const StringRef &s) const noexcept; void AddParameters(VariableSet& vs, int codeRunning) THROWS(GCodeException); - GCodeException ConstructParseException(const char *str) const noexcept; - GCodeException ConstructParseException(const char *str, const char *param) const noexcept; - GCodeException ConstructParseException(const char *str, uint32_t param) const noexcept; + GCodeException ConstructParseException(const char *_ecv_array str) const noexcept; + GCodeException ConstructParseException(const char *_ecv_array str, const char *_ecv_array param) const noexcept; + GCodeException ConstructParseException(const char *_ecv_array str, uint32_t param) const noexcept; int GetColumn() const noexcept; // Get the current column if we can, else return -1 diff --git a/src/GCodes/GCodeException.cpp b/src/GCodes/GCodeException.cpp index df60a89051..64de07a0f1 100644 --- a/src/GCodes/GCodeException.cpp +++ b/src/GCodes/GCodeException.cpp @@ -131,12 +131,12 @@ void GCodeException::GetMessage(const StringRef &reply, const GCodeBuffer *null } } -[[noreturn]] void ThrowGCodeException(const char *errMsg) THROWS(GCodeException) +[[noreturn]] void ThrowGCodeException(const char *_ecv_array errMsg) THROWS(GCodeException) { throw GCodeException(-1, -1, errMsg); } -[[noreturn]] void ThrowGCodeException(const char *errMsg, uint32_t param) THROWS(GCodeException) +[[noreturn]] void ThrowGCodeException(const char *_ecv_array errMsg, uint32_t param) THROWS(GCodeException) { throw GCodeException(-1, -1, errMsg, param); } diff --git a/src/GCodes/GCodeException.h b/src/GCodes/GCodeException.h index bfa1083974..a4529bb4eb 100644 --- a/src/GCodes/GCodeException.h +++ b/src/GCodes/GCodeException.h @@ -72,8 +72,8 @@ class GCodeException String stringParam; }; -// Functions tro create and throw an exception. Using these avoids allocating the GCodeException object on the local stack when it is not going to be used. -[[noreturn]] void __attribute__((noinline)) ThrowGCodeException(const char *errMsg) THROWS(GCodeException); -[[noreturn]] void __attribute__((noinline)) ThrowGCodeException(const char *errMsg, uint32_t param) THROWS(GCodeException); +// Functions to create and throw an exception. Using these avoids allocating the GCodeException object on the local stack when it is not going to be used. +[[noreturn]] void __attribute__((noinline)) ThrowGCodeException(const char *_ecv_array errMsg) THROWS(GCodeException); +[[noreturn]] void __attribute__((noinline)) ThrowGCodeException(const char *_ecv_array errMsg, uint32_t param) THROWS(GCodeException); #endif /* SRC_GCODES_GCODEEXCEPTION_H_ */ diff --git a/src/GCodes/GCodeMachineState.h b/src/GCodes/GCodeMachineState.h index 02c84134e4..e1219e2c9d 100644 --- a/src/GCodes/GCodeMachineState.h +++ b/src/GCodes/GCodeMachineState.h @@ -219,7 +219,7 @@ class GCodeMachineState void SetState(GCodeState newState) noexcept; inline void AdvanceState() noexcept { state = static_cast(static_cast(state) + 1); } - GCodeMachineState *GetPrevious() const noexcept { return previous; } + GCodeMachineState *_ecv_null GetPrevious() const noexcept { return previous; } GCodeMachineState *Pop() const noexcept; uint16_t GetBlockNesting() const noexcept { return blockNesting; } @@ -296,7 +296,7 @@ class GCodeMachineState bool UsingMachineCoordinates() const noexcept { return g53Active || runningSystemMacro; } // Set the error message and associated state - void SetError(const char *msg) noexcept; + void SetError(const char *_ecv_array msg) noexcept; void SetError(const GCodeException& exc) noexcept; void SetWarning(const char *msg) noexcept; void RetrieveStateMachineResult(const GCodeBuffer& gb, const StringRef& reply, GCodeResult& rslt) const noexcept; @@ -314,7 +314,7 @@ class GCodeMachineState void ClearBlocks() noexcept; private: - GCodeMachineState *previous; + GCodeMachineState *_ecv_null previous; BlockState *currentBlockState; GCodeException errorMessage; // we use a GCodeException to store a possible message and a parameter uint16_t blockNesting; diff --git a/src/GCodes/GCodes.h b/src/GCodes/GCodes.h index aabefcffdb..b71c283902 100644 --- a/src/GCodes/GCodes.h +++ b/src/GCodes/GCodes.h @@ -93,7 +93,7 @@ class SbcInterface; class GCodes { public: - GCodes(Platform& p) noexcept; + explicit GCodes(Platform& p) noexcept; void Spin() noexcept; // Called in a tight loop to make this class work void Init() noexcept; // Set it up void Exit() noexcept; // Shut it down @@ -128,7 +128,7 @@ class GCodes float GetRawExtruderTotalByDrive(size_t extruder) const noexcept; // Get the total extrusion since start of print, for one drive float GetTotalRawExtrusion() const noexcept { return rawExtruderTotal; } // Get the total extrusion since start of print, all drives float GetTotalBabyStepOffset(size_t axis) const noexcept - pre(axis < maxAxes); + pre(axis < MaxAxes); float GetUserCoordinate(const MovementState& ms, size_t axis) const noexcept; // Get the current user coordinate in the current workspace coordinate system bool CheckNetworkCommandAllowed(GCodeBuffer& gb, const StringRef& reply, GCodeResult& result) noexcept; @@ -179,7 +179,7 @@ class GCodes bool LowVoltageResume() noexcept; #endif - const char *GetAxisLetters() const noexcept { return axisLetters; } // Return a null-terminated string of axis letters indexed by drive + const char *_ecv_array GetAxisLetters() const noexcept { return axisLetters; } // Return a null-terminated string of axis letters indexed by drive size_t GetAxisNumberForLetter(const char axisLetter) const noexcept; MachineType GetMachineType() const noexcept { return machineType; } bool LockMovementSystemAndWaitForStandstill(GCodeBuffer& gb, MovementSystemNumber msNumber) noexcept; // Lock a movement system and wait for pending moves to finish @@ -203,7 +203,7 @@ class GCodes #endif void SetMappedFanSpeed(const GCodeBuffer *null gb, float f) noexcept; // Set the speeds of fans mapped for the current tool - void HandleReply(GCodeBuffer& gb, GCodeResult rslt, const char *reply) noexcept; // Handle G-Code replies + void HandleReply(GCodeBuffer& gb, GCodeResult rslt, const char *_ecv_array reply) noexcept; // Handle G-Code replies void EmergencyStop() noexcept; // Cancel everything const GridDefinition& GetDefaultGrid() const { return defaultGrid; }; // Get the default grid definition @@ -282,7 +282,7 @@ class GCodes // Return laser PWM in 0..1. Only the primary movement queue is permitted to control the laser. float GetLaserPwm() const noexcept { - return (float)moveStates[0].laserPwmOrIoBits.laserPwm * (1.0/65535); + return (float)moveStates[0].laserPwmOrIoBits.laserPwm * (1.0/65535.0); } # endif #endif @@ -292,7 +292,7 @@ class GCodes void SetRemotePrinting(bool isPrinting) noexcept { isRemotePrinting = isPrinting; } #endif - static constexpr const char *AllowedAxisLetters = + static constexpr const char *_ecv_array AllowedAxisLetters = #if defined(DUET3) || STM32H7 "XYZUVWABCDabcdefghijklmnopqrstuvwxyz"; #else @@ -307,25 +307,25 @@ class GCodes #define TPOST "tpost" #define TFREE "tfree" - static constexpr const char* CONFIG_FILE = "config.g"; - static constexpr const char* CONFIG_BACKUP_FILE = "config.g.bak"; - static constexpr const char* BED_EQUATION_G = "bed.g"; - static constexpr const char* MESH_G = "mesh.g"; - static constexpr const char* PAUSE_G = "pause.g"; - static constexpr const char* RESUME_G = "resume.g"; - static constexpr const char* CANCEL_G = "cancel.g"; - static constexpr const char* START_G = "start.g"; - static constexpr const char* STOP_G = "stop.g"; - static constexpr const char* CONFIG_OVERRIDE_G = "config-override.g"; - static constexpr const char* DefaultHeightMapFile = "heightmap.csv"; - static constexpr const char* LOAD_FILAMENT_G = "load.g"; - static constexpr const char* CONFIG_FILAMENT_G = "config.g"; - static constexpr const char* UNLOAD_FILAMENT_G = "unload.g"; - static constexpr const char* RESUME_AFTER_POWER_FAIL_G = "resurrect.g"; - static constexpr const char* RESUME_PROLOGUE_G = "resurrect-prologue.g"; - static constexpr const char* FILAMENT_CHANGE_G = "filament-change.g"; - static constexpr const char* DAEMON_G = "daemon.g"; - static constexpr const char* RUNONCE_G = "runonce.g"; + static constexpr const char *_ecv_array CONFIG_FILE = "config.g"; + static constexpr const char *_ecv_array CONFIG_BACKUP_FILE = "config.g.bak"; + static constexpr const char *_ecv_array BED_EQUATION_G = "bed.g"; + static constexpr const char *_ecv_array MESH_G = "mesh.g"; + static constexpr const char *_ecv_array PAUSE_G = "pause.g"; + static constexpr const char *_ecv_array RESUME_G = "resume.g"; + static constexpr const char *_ecv_array CANCEL_G = "cancel.g"; + static constexpr const char *_ecv_array START_G = "start.g"; + static constexpr const char *_ecv_array STOP_G = "stop.g"; + static constexpr const char *_ecv_array CONFIG_OVERRIDE_G = "config-override.g"; + static constexpr const char *_ecv_array DefaultHeightMapFile = "heightmap.csv"; + static constexpr const char *_ecv_array LOAD_FILAMENT_G = "load.g"; + static constexpr const char *_ecv_array CONFIG_FILAMENT_G = "config.g"; + static constexpr const char *_ecv_array UNLOAD_FILAMENT_G = "unload.g"; + static constexpr const char *_ecv_array RESUME_AFTER_POWER_FAIL_G = "resurrect.g"; + static constexpr const char *_ecv_array RESUME_PROLOGUE_G = "resurrect-prologue.g"; + static constexpr const char *_ecv_array FILAMENT_CHANGE_G = "filament-change.g"; + static constexpr const char *_ecv_array DAEMON_G = "daemon.g"; + static constexpr const char *_ecv_array RUNONCE_G = "runonce.g"; #if SUPPORT_PROBE_POINTS_FILE static constexpr const char* DefaultProbeProbePointsFile = "probePoints.csv"; #endif @@ -381,7 +381,7 @@ class GCodes bool HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); // Do an M code bool HandleTcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); // Do a T code bool HandleQcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); // Do an internal code - bool HandleResult(GCodeBuffer& gb, GCodeResult rslt, const StringRef& reply, OutputBuffer *outBuf) noexcept + bool HandleResult(GCodeBuffer& gb, GCodeResult rslt, const StringRef& reply, OutputBuffer *_ecv_null outBuf) noexcept pre(outBuf == nullptr || rslt == GCodeResult::ok); void HandleReply(GCodeBuffer& gb, OutputBuffer *reply) noexcept; @@ -390,8 +390,7 @@ class GCodes GCodeResult TryMacroFile(GCodeBuffer& gb) THROWS(GCodeException); // Try to find a macro file that implements a G or M command bool DoStraightMove(GCodeBuffer& gb, bool isCoordinated) THROWS(GCodeException) SPEED_CRITICAL; // Execute a straight move - bool DoArcMove(GCodeBuffer& gb, bool clockwise) THROWS(GCodeException) // Execute an arc move - pre(segmentsLeft == 0; resourceOwners[MoveResource] == &gb); + bool DoArcMove(GCodeBuffer& gb, bool clockwise) THROWS(GCodeException); // Execute an arc move void FinaliseMove(GCodeBuffer& gb, MovementState& ms) noexcept; // Adjust the move parameters to account for segmentation and/or part of the move having been done already bool CheckEnoughAxesHomed(AxesBitmap axesToMove) noexcept; // Check that enough axes have been homed bool TravelToStartPoint(GCodeBuffer& gb) noexcept; // Set up a move to travel to the resume point @@ -413,10 +412,9 @@ class GCodes GCodeResult ConfigureSCurve(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); // Deal with M971 #endif GCodeResult ConfigureDriver(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); // Deal with M569 - GCodeResult ConfigureLocalDriver(GCodeBuffer& gb, const StringRef& reply, uint8_t drive) THROWS(GCodeException) - pre(drive < platform.GetNumActualDirectDrivers()); // Deal with M569 for one local driver + GCodeResult ConfigureLocalDriver(GCodeBuffer& gb, const StringRef& reply, uint8_t drive) THROWS(GCodeException); // Deal with M569 for one local driver GCodeResult ConfigureLocalDriverBasicParameters(GCodeBuffer& gb, const StringRef& reply, uint8_t drive) THROWS(GCodeException) - pre(drive < platform.GetNumActualDirectDrivers()); // Deal with M569.0 for one local driver + pre(drive < reprap.GetMove().GetNumActualDirectDrivers()); // Deal with M569.0 for one local driver GCodeResult ConfigureAccelerations(GCodeBuffer&gb, const StringRef& reply) THROWS(GCodeException); // process M204 GCodeResult DoMessageBox(GCodeBuffer&gb, const StringRef& reply) THROWS(GCodeException); // process M291 GCodeResult AcknowledgeMessage(GCodeBuffer&gb, const StringRef& reply) THROWS(GCodeException); // process M292 @@ -765,7 +763,7 @@ class GCodes #if HAS_MASS_STORAGE static constexpr uint32_t SdTimingByteIncrement = 8 * 1024; // how many timing bytes we write at a time - static constexpr const char *TimingFileName = "test.tst"; // the name of the file we write + static constexpr const char *_ecv_array TimingFileName = "test.tst"; // the name of the file we write FileStore *sdTimingFile; // file handle being used for SD card write timing uint32_t timingBytesRequested; // how many bytes we were asked to write uint32_t timingBytesWritten; // how many timing bytes we have written so far @@ -801,7 +799,7 @@ inline bool GCodes::LockMovement(const GCodeBuffer& gb, MovementSystemNumber msN // Unlock a particular movement system, if we own it inline void GCodes::UnlockMovement(const GCodeBuffer& gb, MovementSystemNumber msNumber) noexcept { - return UnlockResource(gb, MoveResourceBase + msNumber); + UnlockResource(gb, MoveResourceBase + msNumber); } #if !SUPPORT_ASYNC_MOVES @@ -847,7 +845,7 @@ inline bool GCodes::LockAllMovement(const GCodeBuffer& gb) noexcept // Unlock the movement system we are using, if we own it inline void GCodes::UnlockMovement(const GCodeBuffer& gb) noexcept { - return UnlockResource(gb, MoveResourceBase); + UnlockResource(gb, MoveResourceBase); } // Grab all movement locks even if they are already owned diff --git a/src/GCodes/StraightProbeSettings.h b/src/GCodes/StraightProbeSettings.h index c1862e3a71..4983eac210 100644 --- a/src/GCodes/StraightProbeSettings.h +++ b/src/GCodes/StraightProbeSettings.h @@ -29,7 +29,7 @@ class StraightProbeSettings void Reset() noexcept; void SetCoordsToTarget(float[MaxAxes]) const noexcept; - float* GetTarget() noexcept { return target; }; + float *_ecv_array GetTarget() noexcept { return target; }; const StraightProbeType GetType() const noexcept { return type; } void SetStraightProbeType(const StraightProbeType t) noexcept { type = t; } diff --git a/src/Hardware/ExceptionHandlers.cpp b/src/Hardware/ExceptionHandlers.cpp index bc2766ed52..ef7d13af89 100644 --- a/src/Hardware/ExceptionHandlers.cpp +++ b/src/Hardware/ExceptionHandlers.cpp @@ -213,14 +213,14 @@ extern "C" [[noreturn]] __attribute__((externally_visible)) void stackOverflowDi SoftwareReset(SoftwareResetReason::stackOverflow, pulFaultStackAddress); } -extern "C" void vApplicationStackOverflowHook(TaskHandle_t pxTask, char *pcTaskName) noexcept __attribute((naked, noreturn)); +extern "C" void vApplicationStackOverflowHook(TaskHandle_t pxTask, char *pcTaskName) noexcept __attribute__((naked, noreturn)); void vApplicationStackOverflowHook(TaskHandle_t pxTask, char *pcTaskName) noexcept { // r0 = pxTask, r1 = pxTaskName __asm volatile ( - " push {r0, r1, lr} \n" /* save parameters and call address on the stack */ - " mov r0, sp \n" + " push {r0, r1, lr} \n" /* save parameters and call address on the stack */ + " mov r0, sp \n" " ldr r2, handler_sovf_address_const \n" " bx r2 \n" " .align 2 \n" /* make the 2 LSBs zero at the next instruction */ @@ -233,17 +233,17 @@ extern "C" [[noreturn]] __attribute__((externally_visible)) void assertCalledDis SoftwareReset(SoftwareResetReason::assertCalled, pulFaultStackAddress); } -extern "C" [[noreturn]] void vAssertCalled(uint32_t line, const char *file) noexcept __attribute((naked)); +extern "C" [[noreturn]] void vAssertCalled(uint32_t line, const char *file) noexcept __attribute__((naked)); void vAssertCalled(uint32_t line, const char *file) noexcept { -#if false +#if 0 debugPrintf("ASSERTION FAILED IN %s on LINE %d\n", file, line); SERIAL_MAIN_DEVICE.flush(); #endif __asm volatile ( - " push {r0, r1, lr} \n" /* save parameters and call address */ - " mov r0, sp \n" + " push {r0, r1, lr} \n" /* save parameters and call address */ + " mov r0, sp \n" " ldr r2, handler_asrt_address_const \n" " bx r2 \n" " .align 2 \n" /* make the 2 LSBs zero at the next instruction */ diff --git a/src/Hardware/I2C.cpp b/src/Hardware/I2C.cpp index caeecf152b..7003628c38 100644 --- a/src/Hardware/I2C.cpp +++ b/src/Hardware/I2C.cpp @@ -34,11 +34,11 @@ void I2C::Init() noexcept #include "RTOSIface/RTOSIface.h" -static TaskHandle twiTask = nullptr; // the task that is waiting for a TWI command to complete +static TaskHandle _ecv_null twiTask = nullptr; // the task that is waiting for a TWI command to complete extern "C" void WIRE_ISR_HANDLER() noexcept { - WIRE_INTERFACE->TWI_IDR = 0xFFFFFFFF; + WIRE_INTERFACE->TWI_IDR = 0xFFFFFFFFu; TaskBase::GiveFromISR(twiTask, NotifyIndices::I2C); // wake up the task twiTask = nullptr; } @@ -51,12 +51,12 @@ uint32_t I2C::statusWaitFunc(Twi *twi, uint32_t bitsToWaitFor) noexcept { // Suspend this task until we get an interrupt indicating that a status bit that we are interested in has been set twiTask = TaskBase::GetCallerTaskHandle(); - twi->TWI_IDR = 0xFFFFFFFF; + twi->TWI_IDR = 0xFFFFFFFFu; twi->TWI_IER = bitsToWaitFor; NVIC_EnableIRQ(I2C_IRQn); ok = TaskBase::TakeIndexed(NotifyIndices::I2C, 2); twiTask = nullptr; - twi->TWI_IDR = 0xFFFFFFFF; + twi->TWI_IDR = 0xFFFFFFFFu; sr = twi->TWI_SR; } return sr; diff --git a/src/Hardware/IoPorts.cpp b/src/Hardware/IoPorts.cpp index db9591b9d1..b7d4cd509b 100644 --- a/src/Hardware/IoPorts.cpp +++ b/src/Hardware/IoPorts.cpp @@ -34,7 +34,7 @@ constexpr unsigned int AdcBits = LegacyAnalogIn::AdcBits; // Read a port name parameter and assign some ports. Caller must call gb.Seen() with the appropriate letter and get 'true' returned before calling this. // Return the number of ports allocated, or 0 if there was an error with the error message in 'reply'. -/*static*/ size_t IoPort::AssignPorts(GCodeBuffer& gb, const StringRef& reply, PinUsedBy neededFor, size_t numPorts, IoPort* const ports[], const PinAccess access[]) THROWS(GCodeException) +/*static*/ size_t IoPort::AssignPorts(GCodeBuffer& gb, const StringRef& reply, PinUsedBy neededFor, size_t numPorts, IoPort *_ecv_from const ports[], const PinAccess access[]) THROWS(GCodeException) { // Get the full port names string String portNames; // 50 characters wasn't always enough when passing 4 duex endstop input names in a M574 command @@ -46,12 +46,12 @@ constexpr unsigned int AdcBits = LegacyAnalogIn::AdcBits; // If successful, return true; else return false with the error message in 'reply'. bool IoPort::AssignPort(GCodeBuffer& gb, const StringRef& reply, PinUsedBy neededFor, PinAccess access) THROWS(GCodeException) { - IoPort* const p = this; + IoPort *_ecv_from const p = this; return AssignPorts(gb, reply, neededFor, 1, &p, &access) == 1; } // Try to assign ports, returning the number of ports successfully assigned -/*static*/ size_t IoPort::AssignPorts(const char* pinNames, const StringRef& reply, PinUsedBy neededFor, size_t numPorts, IoPort* const ports[], const PinAccess access[]) noexcept +/*static*/ size_t IoPort::AssignPorts(const char *_ecv_array pinNames, const StringRef& reply, PinUsedBy neededFor, size_t numPorts, IoPort *_ecv_from const ports[], const PinAccess access[]) noexcept { // Release any existing assignments for (size_t i = 0; i < numPorts; ++i) @@ -108,13 +108,13 @@ bool IoPort::AssignPort(GCodeBuffer& gb, const StringRef& reply, PinUsedBy neede return numPorts; } -bool IoPort::AssignPort(const char* pinName, const StringRef& reply, PinUsedBy neededFor, PinAccess access) noexcept +bool IoPort::AssignPort(const char *_ecv_array pinName, const StringRef& reply, PinUsedBy neededFor, PinAccess access) noexcept { - IoPort* const p = this; + IoPort *_ecv_from const p = this; return AssignPorts(pinName, reply, neededFor, 1, &p, &access) == 1; } -/*static*/ const char* IoPort::TranslatePinAccess(PinAccess access) noexcept +/*static*/ const char *_ecv_array IoPort::TranslatePinAccess(PinAccess access) noexcept { switch (access) { @@ -200,7 +200,7 @@ void IoPort::ClearAnalogCallback() noexcept #endif // Allocate the specified logical pin, returning true if successful -bool IoPort::Allocate(const char *pn, const StringRef& reply, PinUsedBy neededFor, PinAccess access) noexcept +bool IoPort::Allocate(const char *_ecv_array pn, const StringRef& reply, PinUsedBy neededFor, PinAccess access) noexcept { Release(); @@ -229,7 +229,7 @@ bool IoPort::Allocate(const char *pn, const StringRef& reply, PinUsedBy neededFo ++pn; } - const char *const fullPinName = pn; // the full pin name less the inversion and pullup flags + const char *_ecv_array const fullPinName = pn; // the full pin name less the inversion and pullup flags #if SUPPORT_CAN_EXPANSION if (isdigit(*pn)) @@ -354,7 +354,7 @@ bool IoPort::SetMode(PinAccess access) noexcept bool IoPort::GetInvert() const noexcept { - return (hardwareInvert) ? !totalInvert : totalInvert; + return (hardwareInvert) ? !totalInvert : (bool)totalInvert; } void IoPort::SetInvert(bool pInvert) noexcept @@ -408,9 +408,9 @@ void IoPort::AppendPinName(const StringRef& str) const noexcept } const size_t insertPoint = str.strlen(); #if STM32 - const char *pn = GetPinNames(logicalPin); + const char *_ecv_array pn = GetPinNames(logicalPin); #else - const char *pn = PinTable[logicalPin].GetNames(); + const char *_ecv_array pn = PinTable[logicalPin].GetNames(); #endif unsigned int numPrinted = 0; do @@ -540,9 +540,9 @@ uint16_t IoPort::ReadAnalog() const noexcept size_t numToSkip = prefix; unsigned int boardAddress = 0; - while (isdigit(portName[numToSkip])) + while ((bool)isdigit(portName[numToSkip])) { - boardAddress = (boardAddress * 10) + (portName[numToSkip] - '0'); + boardAddress = (boardAddress * 10) + (unsigned int)(portName[numToSkip] - '0'); ++numToSkip; } #if SUPPORT_CAN_EXPANSION diff --git a/src/Hardware/IoPorts.h b/src/Hardware/IoPorts.h index b16e0e58f1..d973dd72f0 100644 --- a/src/Hardware/IoPorts.h +++ b/src/Hardware/IoPorts.h @@ -24,11 +24,11 @@ class IoPort void Release() noexcept; void AppendBasicDetails(const StringRef& str) const noexcept; - static size_t AssignPorts(GCodeBuffer& gb, const StringRef& reply, PinUsedBy neededFor, size_t numPorts, IoPort * const ports[], const PinAccess access[]) THROWS(GCodeException); + static size_t AssignPorts(GCodeBuffer& gb, const StringRef& reply, PinUsedBy neededFor, size_t numPorts, IoPort *_ecv_from const ports[], const PinAccess access[]) THROWS(GCodeException); bool AssignPort(GCodeBuffer& gb, const StringRef& reply, PinUsedBy neededFor, PinAccess access) THROWS(GCodeException); - static size_t AssignPorts(const char *pinNames, const StringRef& reply, PinUsedBy neededFor, size_t numPorts, IoPort * const ports[], const PinAccess access[]) noexcept; - bool AssignPort(const char *pinName, const StringRef& reply, PinUsedBy neededFor, PinAccess access) noexcept; + static size_t AssignPorts(const char *_ecv_array pinNames, const StringRef& reply, PinUsedBy neededFor, size_t numPorts, IoPort *_ecv_from const ports[], const PinAccess access[]) noexcept; + bool AssignPort(const char *_ecv_array pinName, const StringRef& reply, PinUsedBy neededFor, PinAccess access) noexcept; void AppendPinName(const StringRef& str) const noexcept; bool IsValid() const noexcept { return logicalPin < NumNamedPins; } @@ -82,7 +82,7 @@ class IoPort static void WriteAnalog(Pin p, float pwm, uint16_t frequency) noexcept; protected: - bool Allocate(const char *pinName, const StringRef& reply, PinUsedBy neededFor, PinAccess access) noexcept; + bool Allocate(const char *_ecv_array pinName, const StringRef& reply, PinUsedBy neededFor, PinAccess access) noexcept; // Get the physical pin without checking the validity of the logical pin Pin GetPinNoCheck() const noexcept @@ -91,7 +91,7 @@ class IoPort return (Pin)logicalPin; } - static const char* TranslatePinAccess(PinAccess access) noexcept; + static const char*_ecv_array TranslatePinAccess(PinAccess access) noexcept; LogicalPin logicalPin; // the logical pin number uint8_t hardwareInvert : 1, // true if the hardware includes inversion diff --git a/src/Hardware/NonVolatileMemory.cpp b/src/Hardware/NonVolatileMemory.cpp index 9daabadd27..48f9ef55a7 100644 --- a/src/Hardware/NonVolatileMemory.cpp +++ b/src/Hardware/NonVolatileMemory.cpp @@ -88,7 +88,7 @@ void NonVolatileMemory::EnsureWritten() noexcept #endif } -SoftwareResetData* NonVolatileMemory::GetLastWrittenResetData(unsigned int &slot) noexcept +SoftwareResetData *_ecv_null NonVolatileMemory::GetLastWrittenResetData(unsigned int &slot) noexcept { EnsureRead(); for (unsigned int i = NumberOfResetDataSlots; i != 0; ) @@ -147,13 +147,13 @@ void NonVolatileMemory::SetThermistorHighCalibration(unsigned int inputNumber, i SetThermistorCalibration(inputNumber, val, buffer.thermistorHighCalibration); } -int8_t NonVolatileMemory::GetThermistorCalibration(unsigned int inputNumber, uint8_t *calibArray) noexcept +int8_t NonVolatileMemory::GetThermistorCalibration(unsigned int inputNumber, uint8_t *_ecv_array calibArray) noexcept { EnsureRead(); return (inputNumber >= MaxCalibratedThermistors || calibArray[inputNumber] == 0xFF) ? 0 : (int)calibArray[inputNumber] - (int)0x7F; } -void NonVolatileMemory::SetThermistorCalibration(unsigned int inputNumber, int8_t val, uint8_t *calibArray) noexcept +void NonVolatileMemory::SetThermistorCalibration(unsigned int inputNumber, int8_t val, uint8_t *_ecv_array calibArray) noexcept { if (inputNumber < MaxCalibratedThermistors) { diff --git a/src/Hardware/NonVolatileMemory.h b/src/Hardware/NonVolatileMemory.h index 560d49811a..27854bb81c 100644 --- a/src/Hardware/NonVolatileMemory.h +++ b/src/Hardware/NonVolatileMemory.h @@ -21,7 +21,7 @@ class NonVolatileMemory NonVolatileMemory() noexcept; void EnsureWritten() noexcept; - SoftwareResetData *GetLastWrittenResetData(unsigned int &slot) noexcept; + SoftwareResetData *_ecv_null GetLastWrittenResetData(unsigned int &slot) noexcept; SoftwareResetData *AllocateResetDataSlot() noexcept; int8_t GetThermistorLowCalibration(unsigned int inputNumber) noexcept; int8_t GetThermistorHighCalibration(unsigned int inputNumber) noexcept; @@ -33,8 +33,8 @@ class NonVolatileMemory private: void EnsureRead() noexcept; - int8_t GetThermistorCalibration(unsigned int inputNumber, uint8_t *calibArray) noexcept; - void SetThermistorCalibration(unsigned int inputNumber, int8_t val, uint8_t *calibArray) noexcept; + int8_t GetThermistorCalibration(unsigned int inputNumber, uint8_t *_ecv_array calibArray) noexcept; + void SetThermistorCalibration(unsigned int inputNumber, int8_t val, uint8_t *_ecv_array calibArray) noexcept; struct NVM { diff --git a/src/Hardware/Spi/SharedSpiClient.cpp b/src/Hardware/Spi/SharedSpiClient.cpp index 885aa17614..f4fb6a19ec 100644 --- a/src/Hardware/Spi/SharedSpiClient.cpp +++ b/src/Hardware/Spi/SharedSpiClient.cpp @@ -50,7 +50,7 @@ void SharedSpiClient::Deselect() const noexcept device.Release(); } -bool SharedSpiClient::TransceivePacket(const uint8_t* tx_data, uint8_t* rx_data, size_t len) const noexcept +bool SharedSpiClient::TransceivePacket(const uint8_t *_ecv_array _ecv_null tx_data, uint8_t *_ecv_array _ecv_null rx_data, size_t len) const noexcept { return device.TransceivePacket(tx_data, rx_data, len); } diff --git a/src/Hardware/Spi/SharedSpiDevice.cpp b/src/Hardware/Spi/SharedSpiDevice.cpp index 009e426244..f414743111 100644 --- a/src/Hardware/Spi/SharedSpiDevice.cpp +++ b/src/Hardware/Spi/SharedSpiDevice.cpp @@ -19,7 +19,7 @@ SharedSpiDevice::SharedSpiDevice(uint8_t sercomNum) noexcept // Static members -SharedSpiDevice *SharedSpiDevice::mainSharedSpiDevice = nullptr; +SharedSpiDevice *_ecv_null SharedSpiDevice::mainSharedSpiDevice = nullptr; void SharedSpiDevice::Init() noexcept { diff --git a/src/Hardware/Spi/SharedSpiDevice.h b/src/Hardware/Spi/SharedSpiDevice.h index fe1154f8a4..357efca5f2 100644 --- a/src/Hardware/Spi/SharedSpiDevice.h +++ b/src/Hardware/Spi/SharedSpiDevice.h @@ -41,7 +41,7 @@ class SharedSpiDevice : public SpiDevice static SharedSpiDevice *Devices[]; static SharedSpiDevice *invalidDevice; #else - static SharedSpiDevice *mainSharedSpiDevice; + static SharedSpiDevice *_ecv_null mainSharedSpiDevice; #endif }; diff --git a/src/Movement/BedProbing/Grid.h b/src/Movement/BedProbing/Grid.h index a4137e06c9..f9d7fa28ff 100644 --- a/src/Movement/BedProbing/Grid.h +++ b/src/Movement/BedProbing/Grid.h @@ -79,18 +79,20 @@ class HeightMap float GetInterpolatedHeightError(float axis0, float axis1) const noexcept; // Compute the interpolated height error at the specified point void ClearGridHeights() noexcept; // Clear all grid height corrections void SetGridHeight(size_t axis0Index, size_t axis1Index, float height) noexcept; // Set the height of a grid point + + bool IsValid() const noexcept { return def.IsValid(); } #if HAS_MASS_STORAGE || HAS_SBC_INTERFACE - bool SaveToFile(FileStore *f, const char *fname, float zOffset) noexcept // Save the grid to file returning true if an error occurred + bool SaveToFile(FileStore *f, const char *_ecv_array fname, float zOffset) noexcept // Save the grid to file returning true if an error occurred pre(IsValid()); - bool LoadFromFile(FileStore *f, const char *fname, const StringRef& r + bool LoadFromFile(FileStore *f, const char *_ecv_array fname, const StringRef& r # if SUPPORT_PROBE_POINTS_FILE , bool isPointsFile # endif ) noexcept; // Load the grid from file returning true if an error occurred - const char *GetFileName() const noexcept { return fileName.c_str(); } + const char *_ecv_array GetFileName() const noexcept { return fileName.c_str(); } #endif unsigned int GetMinimumSegments(float deltaAxis0, float deltaAxis1) const noexcept; // Return the minimum number of segments for a move by this X or Y amount @@ -110,9 +112,9 @@ class HeightMap #if HAS_MASS_STORAGE || HAS_SBC_INTERFACE // Increase the version number in the following string whenever we change the format of the height map file significantly. // Adding more fields to the header row can be handled in GridDefinition::ReadParameters() though. - static constexpr const char* HeightMapComment = "RepRapFirmware height map file v2"; // The start of the comment we write at the start of the height map file + static constexpr const char *_ecv_array HeightMapComment = "RepRapFirmware height map file v2"; // The start of the comment we write at the start of the height map file # if SUPPORT_PROBE_POINTS_FILE - static constexpr const char* PointsFileComment = "RepRapFirmware probe points file v2"; // The start of the comment we write at the start of the points map file + static constexpr const char *_ecv_array PointsFileComment = "RepRapFirmware probe points file v2"; // The start of the comment we write at the start of the points map file # endif #endif diff --git a/src/Movement/ExtruderShaper.h b/src/Movement/ExtruderShaper.h index 5c7d1f18b4..1b35d0849a 100644 --- a/src/Movement/ExtruderShaper.h +++ b/src/Movement/ExtruderShaper.h @@ -22,7 +22,7 @@ class ExtruderShaper // Temporary functions until we support more sophisticated pressure advance float GetKclocks() const noexcept { return k; } // get pressure advance in step clocks - float GetKseconds() const noexcept { return k * (1.0/StepClockRate); } + float GetKseconds() const noexcept { return k * (1.0/(float)StepClockRate); } void SetKseconds(float val) noexcept { k = val * StepClockRate; } // set pressure advance in seconds private: diff --git a/src/Movement/Kinematics/CoreKinematics.h b/src/Movement/Kinematics/CoreKinematics.h index 79beb058e4..de6e84b8a5 100644 --- a/src/Movement/Kinematics/CoreKinematics.h +++ b/src/Movement/Kinematics/CoreKinematics.h @@ -9,7 +9,7 @@ #define SRC_MOVEMENT_KINEMATICS_COREKINEMATICS_H_ #include "ZLeadscrewKinematics.h" -#include "Math/Matrix.h" +#include class CoreKinematics : public ZLeadscrewKinematics { diff --git a/src/Movement/Kinematics/Kinematics.h b/src/Movement/Kinematics/Kinematics.h index 2541ae2984..2c77389c55 100644 --- a/src/Movement/Kinematics/Kinematics.h +++ b/src/Movement/Kinematics/Kinematics.h @@ -9,9 +9,10 @@ #define SRC_MOVEMENT_KINEMATICS_H_ #include -#include #include +template class MathMatrix; + inline floatc_t fcsquare(floatc_t a) { return a * a; diff --git a/src/Movement/Kinematics/LinearDeltaKinematics.h b/src/Movement/Kinematics/LinearDeltaKinematics.h index 21ba9f1a84..200abd9557 100644 --- a/src/Movement/Kinematics/LinearDeltaKinematics.h +++ b/src/Movement/Kinematics/LinearDeltaKinematics.h @@ -13,6 +13,7 @@ #if SUPPORT_LINEAR_DELTA #include "RoundBedKinematics.h" +#include // Class to hold the parameter for a delta machine. class LinearDeltaKinematics : public RoundBedKinematics diff --git a/src/Movement/Kinematics/RotaryDeltaKinematics.cpp b/src/Movement/Kinematics/RotaryDeltaKinematics.cpp index 5bd3ac78c7..65eea43191 100644 --- a/src/Movement/Kinematics/RotaryDeltaKinematics.cpp +++ b/src/Movement/Kinematics/RotaryDeltaKinematics.cpp @@ -15,6 +15,7 @@ #include #include #include +#include const float RotaryDeltaKinematics::NormalTowerAngles[DELTA_AXES] = { -150.0, -30.0, 90.0 }; diff --git a/src/Movement/Kinematics/ZLeadscrewKinematics.cpp b/src/Movement/Kinematics/ZLeadscrewKinematics.cpp index 6f59f361fd..f2aef8a8aa 100644 --- a/src/Movement/Kinematics/ZLeadscrewKinematics.cpp +++ b/src/Movement/Kinematics/ZLeadscrewKinematics.cpp @@ -11,6 +11,7 @@ #include #include #include +#include const float M3ScrewPitch = 0.5; diff --git a/src/Movement/RawMove.h b/src/Movement/RawMove.h index 8cb562c470..a48d9d95df 100644 --- a/src/Movement/RawMove.h +++ b/src/Movement/RawMove.h @@ -57,7 +57,7 @@ struct RawMove // GCC normally calls memcpy to assign objects of this class. We can do better because we know they must be 32-bit aligned. RawMove& operator=(const RawMove& arg) noexcept { - memcpyu32(reinterpret_cast(this), reinterpret_cast(&arg), sizeof(*this)/4); + memcpyu32(reinterpret_cast(this), reinterpret_cast(&arg), sizeof(*this)/4); return *this; } }; diff --git a/src/Movement/StepTimer.h b/src/Movement/StepTimer.h index 49acbbecd6..9c540e0a31 100644 --- a/src/Movement/StepTimer.h +++ b/src/Movement/StepTimer.h @@ -99,7 +99,7 @@ class StepTimer // Convert a number of step timer ticks to microseconds // Our tick rate is a multiple of 1000 so instead of multiplying n by 1000000 and risking overflow, we multiply by 1000 and divide by StepClockRate/1000 static uint32_t TicksToIntegerMicroseconds(uint32_t n) noexcept { return (n * 1000)/(StepClockRate/1000); } - static float TicksToFloatMicroseconds(uint32_t n) noexcept { return (float)n * (1000000.0f/StepClockRate); } + static float TicksToFloatMicroseconds(uint32_t n) noexcept { return (float)n * (1000000.0f/(float)StepClockRate); } #if SUPPORT_REMOTE_COMMANDS static uint32_t GetLocalTimeOffset() noexcept { return localTimeOffset; } diff --git a/src/ObjectModel/GlobalVariables.cpp b/src/ObjectModel/GlobalVariables.cpp index 81b5f29cdd..5985d29b58 100644 --- a/src/ObjectModel/GlobalVariables.cpp +++ b/src/ObjectModel/GlobalVariables.cpp @@ -9,12 +9,12 @@ #include // This function is not used in this class -const ObjectModelClassDescriptor *GlobalVariables::GetObjectModelClassDescriptor() const noexcept { return nullptr; } +const ObjectModelClassDescriptor *_ecv_null GlobalVariables::GetObjectModelClassDescriptor() const noexcept { return nullptr; } // Construct a JSON representation of those parts of the object model requested by the user // This overrides the standard definition because the variable names are not fixed // We ignore any remaining key or flags and just report all the variables -void GlobalVariables::ReportAsJson(OutputBuffer *buf, ObjectExplorationContext& context, const ObjectModelClassDescriptor * null classDescriptor, uint8_t tableNumber, const char *filter) const THROWS(GCodeException) +void GlobalVariables::ReportAsJson(OutputBuffer *buf, ObjectExplorationContext& context, const ObjectModelClassDescriptor *_ecv_null classDescriptor, uint8_t tableNumber, const char *_ecv_array filter) const THROWS(GCodeException) { if (*filter == 0) { @@ -39,15 +39,15 @@ void GlobalVariables::ReportAsJson(OutputBuffer *buf, ObjectExplorationContext& else { // Report a specific global variable, or part of one - const char *pos = GetNextElement(filter); // find the end of the variable name - const Variable *const var = vars.Lookup(filter, pos - filter, false); + const char *_ecv_array pos = GetNextElement(filter); // find the end of the variable name + const Variable *_ecv_null const var = vars.Lookup(filter, pos - filter, false); if (var == nullptr) { buf->cat("null"); } else if (context.IncreaseDepth()) { - ReportItemAsJson(buf, context, nullptr, var->GetValue(), pos); + ReportItemAsJson(buf, context, nullptr, not_null(var)->GetValue(), pos); } else { diff --git a/src/ObjectModel/ObjectModel.cpp b/src/ObjectModel/ObjectModel.cpp index c689601b2c..5eede089e2 100644 --- a/src/ObjectModel/ObjectModel.cpp +++ b/src/ObjectModel/ObjectModel.cpp @@ -769,7 +769,7 @@ void ObjectModel::ReportArrayLengthAsJson(OutputBuffer *buf, ObjectExplorationCo // This function is recursive, so keep its stack usage low. // The type of 'val' may not be ObjectModel_tc. That type is handled in function ReportItemAsJson, which is declared 'inline' to reduce stack usage. void ObjectModel::ReportItemAsJsonFull(OutputBuffer *buf, ObjectExplorationContext& context, const ObjectModelClassDescriptor *null classDescriptor, - const ExpressionValue& val, const char *filter) const THROWS(GCodeException) + const ExpressionValue& val, const char *_ecv_array filter) const THROWS(GCodeException) { switch (val.GetType()) { @@ -1194,7 +1194,7 @@ const ObjectModelTableEntry* ObjectModel::FindObjectModelTableEntry(const Object return nullptr; } -/*static*/ const char* ObjectModel::GetNextElement(const char *id) noexcept +/*static*/ const char *_ecv_array ObjectModel::GetNextElement(const char *_ecv_array id) noexcept { while (*id != 0 && *id != '.' && *id != '[' && *id != '^') { @@ -1209,7 +1209,7 @@ bool ObjectModelTableEntry::Matches(const char* filterString, const ObjectExplor } // Add the value of this element to the buffer, returning true if it matched and we did -bool ObjectModelTableEntry::ReportAsJson(OutputBuffer* buf, ObjectExplorationContext& context, const ObjectModelClassDescriptor *classDescriptor, const ObjectModel *self, const char* filter, bool first) const THROWS(GCodeException) +bool ObjectModelTableEntry::ReportAsJson(OutputBuffer* buf, ObjectExplorationContext& context, const ObjectModelClassDescriptor *_ecv_null classDescriptor, const ObjectModel *_ecv_from self, const char *_ecv_array filter, bool first) const THROWS(GCodeException) { const char * nextElement = ObjectModel::GetNextElement(filter); const ExpressionValue val = func(self, context); diff --git a/src/ObjectModel/ObjectModel.h b/src/ObjectModel/ObjectModel.h index eef953ec3e..4f1476b503 100644 --- a/src/ObjectModel/ObjectModel.h +++ b/src/ObjectModel/ObjectModel.h @@ -290,11 +290,11 @@ class ObjectModel ExpressionValue GetObjectValueUsingTableNumber(ObjectExplorationContext& context, const ObjectModelClassDescriptor * null classDescriptor, const char *_ecv_array idString, uint8_t tableNumber) const THROWS(GCodeException); // Function to report a value or object as JSON. This does not need to handle 'var' or 'global' because those are checked for before this is called. - void ReportItemAsJson(OutputBuffer *buf, ObjectExplorationContext& context, const ObjectModelClassDescriptor *classDescriptor, + void ReportItemAsJson(OutputBuffer *buf, ObjectExplorationContext& context, const ObjectModelClassDescriptor *_ecv_null classDescriptor, const ExpressionValue& val, const char *_ecv_array filter) const THROWS(GCodeException); // Skip the current element in the ID or filter string - static const char* GetNextElement(const char *id) noexcept; + static const char *_ecv_array GetNextElement(const char *_ecv_array id) noexcept; protected: // Construct a JSON representation of those parts of the object model requested by the user @@ -313,7 +313,7 @@ class ObjectModel // Get the object model table entry for the current level object in the query const ObjectModelTableEntry *FindObjectModelTableEntry(const ObjectModelClassDescriptor *classDescriptor, uint8_t tableNumber, const char *_ecv_array idString) const noexcept; - virtual const ObjectModelClassDescriptor *GetObjectModelClassDescriptor() const noexcept = 0; + virtual const ObjectModelClassDescriptor *_ecv_null GetObjectModelClassDescriptor() const noexcept = 0; // Get the requested entry in the array table virtual const ObjectModelArrayTableEntry *_ecv_null GetObjectModelArrayEntry(unsigned int index) const noexcept { return nullptr; } @@ -346,7 +346,7 @@ class ObjectModel // This function is recursive, so keep its stack usage low. // Most recursive calls are for non-array object values, so handle object values inline to reduce stack usage. // This saves about 240 bytes of stack space but costs 272 bytes of flash memory. -inline void ObjectModel::ReportItemAsJson(OutputBuffer *buf, ObjectExplorationContext& context, const ObjectModelClassDescriptor *classDescriptor, +inline void ObjectModel::ReportItemAsJson(OutputBuffer *buf, ObjectExplorationContext& context, const ObjectModelClassDescriptor *_ecv_null classDescriptor, const ExpressionValue& val, const char *_ecv_array filter) const THROWS(GCodeException) { if (context.WantArrayLength() && *filter == 0) @@ -406,7 +406,7 @@ class ObjectModelTableEntry bool IsObsolete() const noexcept { return ((uint8_t)flags & (uint8_t)ObjectModelEntryFlags::obsolete) != 0; } // See whether we should add the value of this element to the buffer, returning true if it matched the filter and we did add it - bool ReportAsJson(OutputBuffer* buf, ObjectExplorationContext& context, const ObjectModelClassDescriptor *classDescriptor, const ObjectModel *_ecv_from self, const char *_ecv_array filter, bool first) const THROWS(GCodeException); + bool ReportAsJson(OutputBuffer* buf, ObjectExplorationContext& context, const ObjectModelClassDescriptor *_ecv_null classDescriptor, const ObjectModel *_ecv_from self, const char *_ecv_array filter, bool first) const THROWS(GCodeException); // Return the name of this field const char *_ecv_array GetName() const noexcept { return name; } @@ -445,7 +445,7 @@ struct ObjectModelClassDescriptor // Use this macro in the 'protected' section of every class declaration that derived from ObjectModel #define DECLARE_OBJECT_MODEL \ - const ObjectModelClassDescriptor *GetObjectModelClassDescriptor() const noexcept override; \ + const ObjectModelClassDescriptor *_ecv_null GetObjectModelClassDescriptor() const noexcept override; \ static const ObjectModelTableEntry objectModelTable[]; \ static const uint8_t objectModelTableDescriptor[]; \ static const ObjectModelClassDescriptor objectModelClassDescriptor; diff --git a/src/ObjectModel/Variable.cpp b/src/ObjectModel/Variable.cpp index bcb66565d2..b34e284f1a 100644 --- a/src/ObjectModel/Variable.cpp +++ b/src/ObjectModel/Variable.cpp @@ -10,7 +10,7 @@ #include // Members of class Variable -Variable::Variable(const char *str, ExpressionValue& pVal, int16_t pScope) THROWS(GCodeException) +Variable::Variable(const char *_ecv_array str, ExpressionValue& pVal, int16_t pScope) THROWS(GCodeException) : name(str), val(), scope(pScope) { Assign(pVal); // this may throw @@ -22,7 +22,7 @@ Variable::~Variable() val.Release(); } -bool Variable::IsValidVariableName(const char *str) noexcept +bool Variable::IsValidVariableName(const char *_ecv_array str) noexcept { size_t len = strlen(str); if (len == 0) @@ -94,7 +94,7 @@ void Variable::Assign(ExpressionValue& ev) THROWS(GCodeException) } // Assign a new value to an indexed part of this variable. There is always at least one index. -void Variable::AssignIndexed(const ExpressionValue& ev, size_t numIndices, const uint32_t *indices) THROWS(GCodeException) +void Variable::AssignIndexed(const ExpressionValue& ev, size_t numIndices, const uint32_t *_ecv_array indices) THROWS(GCodeException) { if (val.GetType() != TypeCode::HeapArray) { @@ -118,7 +118,7 @@ void Variable::AssignArray(size_t numElements, function_refnext) @@ -132,7 +132,7 @@ Variable *_ecv_null VariableSet::Lookup(const char *str, bool wantParameter) noe return nullptr; } -const Variable *_ecv_null VariableSet::Lookup(const char *str, size_t length, bool wantParameter) const noexcept +const Variable *_ecv_null VariableSet::Lookup(const char *_ecv_array str, size_t length, bool wantParameter) const noexcept { const LinkedVariable *lv; for (lv = root; lv != nullptr; lv = lv->next) @@ -146,7 +146,7 @@ const Variable *_ecv_null VariableSet::Lookup(const char *str, size_t length, bo return nullptr; } -Variable *VariableSet::InsertNew(const char *str, ExpressionValue pVal, int16_t pScope) THROWS(GCodeException) +Variable *VariableSet::InsertNew(const char *_ecv_array str, ExpressionValue pVal, int16_t pScope) THROWS(GCodeException) { LinkedVariable * const toInsert = new LinkedVariable(str, pVal, pScope, root); root = toInsert; @@ -181,7 +181,7 @@ void VariableSet::EndScope(uint8_t blockNesting) noexcept } } -void VariableSet::Delete(const char *str) noexcept +void VariableSet::Delete(const char *_ecv_array str) noexcept { LinkedVariable *prev = nullptr; for (LinkedVariable *lv = root; lv != nullptr; lv = lv->next) diff --git a/src/ObjectModel/Variable.h b/src/ObjectModel/Variable.h index 1d4664f9ba..af389d8609 100644 --- a/src/ObjectModel/Variable.h +++ b/src/ObjectModel/Variable.h @@ -28,7 +28,7 @@ class Variable ExpressionValue GetValue() const noexcept { return val; } int8_t GetScope() const noexcept { return scope; } void Assign(ExpressionValue& ev) THROWS(GCodeException); - void AssignIndexed(const ExpressionValue& ev, size_t numIndices, const uint32_t *indices) THROWS(GCodeException) pre(numIndices != 0); + void AssignIndexed(const ExpressionValue& ev, size_t numIndices, const uint32_t *_ecv_array indices) THROWS(GCodeException) pre(numIndices != 0; indices.lim >= numIndices); void AssignArray(size_t numElements, function_ref) noexcept; private: @@ -51,10 +51,10 @@ class VariableSet Variable *_ecv_null Lookup(const char *_ecv_array str, bool wantParameter) noexcept; const Variable *_ecv_null Lookup(const char *_ecv_array str, size_t length, bool wantParameter) const noexcept pre(length <= strlen(str)); - Variable *InsertNew(const char *str, ExpressionValue pVal, int16_t pScope) THROWS(GCodeException); - void InsertNewParameter(const char *str, ExpressionValue pVal) THROWS(GCodeException) { InsertNew(str, pVal, -1); } + Variable *InsertNew(const char *_ecv_array str, ExpressionValue pVal, int16_t pScope) THROWS(GCodeException); + void InsertNewParameter(const char *_ecv_array str, ExpressionValue pVal) THROWS(GCodeException) { InsertNew(str, pVal, -1); } void EndScope(uint8_t blockNesting) noexcept; - void Delete(const char *str) noexcept; + void Delete(const char *_ecv_array str) noexcept; void Clear() noexcept; void IterateWhile(function_ref_noexcept func) const noexcept; diff --git a/src/Platform/Event.cpp b/src/Platform/Event.cpp index 77db512ab5..b516657eab 100644 --- a/src/Platform/Event.cpp +++ b/src/Platform/Event.cpp @@ -40,7 +40,7 @@ inline Event::Event(Event *_ecv_null p_next, EventType et, uint16_t p_param, Can // An event is 'similar' if it has the same type, device number, CAN address and parameter even if the text is different. TaskCriticalSectionLocker lock; - Event** pe = &eventsPending; + Event*_ecv_null * pe = &eventsPending; while (*pe != nullptr && (et >= (*pe)->type || (*pe)->isBeingProcessed)) // while the next event in the list has same or higher priority than the new one { if (et == (*pe)->type && devNum == (*pe)->deviceNumber &&(*pe)->param == p_param @@ -78,7 +78,7 @@ inline Event::Event(Event *_ecv_null p_next, EventType et, uint16_t p_param, Can { TaskCriticalSectionLocker lock; - Event * const ev = eventsPending; + Event *_ecv_null const ev = eventsPending; if (ev == nullptr) { return false; @@ -90,7 +90,7 @@ inline Event::Event(Event *_ecv_null p_next, EventType et, uint16_t p_param, Can // Get the name of the macro that we run when this event occurs /*static*/ void Event::GetMacroFileName(const StringRef& fname) noexcept { - const Event * const ep = eventsPending; + const Event *_ecv_null const ep = eventsPending; if (ep != nullptr && ep->isBeingProcessed) { fname.copy(ep->type.ToString()); @@ -102,7 +102,7 @@ inline Event::Event(Event *_ecv_null p_next, EventType et, uint16_t p_param, Can // Get the macro parameters for the current event, excluding the S parameter which the caller will add /*static*/ void Event::GetParameters(VariableSet& vars) noexcept { - const Event * const ep = eventsPending; + const Event *_ecv_null const ep = eventsPending; if (ep != nullptr && ep->isBeingProcessed) { vars.InsertNewParameter("D", ExpressionValue((int32_t)(ep->deviceNumber))); @@ -114,7 +114,7 @@ inline Event::Event(Event *_ecv_null p_next, EventType et, uint16_t p_param, Can // Get the default action for the current event /*static*/ PrintPausedReason Event::GetDefaultPauseReason() noexcept { - const Event * const ep = eventsPending; + const Event *_ecv_null const ep = eventsPending; if (ep != nullptr && ep->isBeingProcessed) { switch (ep->type.RawValue()) @@ -140,7 +140,7 @@ inline Event::Event(Event *_ecv_null p_next, EventType et, uint16_t p_param, Can { TaskCriticalSectionLocker lock; - const Event *ev = eventsPending; + const Event *_ecv_null ev = eventsPending; if (ev != nullptr && ev->isBeingProcessed) { eventsPending = ev->next; @@ -152,7 +152,7 @@ inline Event::Event(Event *_ecv_null p_next, EventType et, uint16_t p_param, Can // Get a description of the current event /*static*/ MessageType Event::GetTextDescription(const StringRef& str) noexcept { - const Event * const ep = eventsPending; + const Event *_ecv_null const ep = eventsPending; if (ep != nullptr && ep->isBeingProcessed) { switch (ep->type.RawValue()) @@ -204,7 +204,7 @@ inline Event::Event(Event *_ecv_null p_next, EventType et, uint16_t p_param, Can #if SUPPORT_CAN_EXPANSION str.printf("MCU temperature warning from board %u: temperature %.1fC", ep->boardAddress, (double)((float)ep->param/10)); #else - str.printf("MCU temperature warning: temperature %.1fC", (double)((float)ep->param/10)); + str.printf("MCU temperature warning: temperature %.1fC", (double)((float)ep->param/10.0)); #endif return WarningMessage; @@ -212,7 +212,7 @@ inline Event::Event(Event *_ecv_null p_next, EventType et, uint16_t p_param, Can #if SUPPORT_CAN_EXPANSION str.printf("overvoltage on board %u: voltage %.1fV", ep->boardAddress, (double)((float)ep->param/10)); #else - str.printf("overvoltage: voltage %.1fV", (double)((float)ep->param/10)); + str.printf("overvoltage: voltage %.1fV", (double)((float)ep->param/10.0)); #endif return WarningMessage; @@ -220,7 +220,7 @@ inline Event::Event(Event *_ecv_null p_next, EventType et, uint16_t p_param, Can #if SUPPORT_CAN_EXPANSION str.printf("undervoltage on board %u: voltage %.1fV", ep->boardAddress, (double)((float)ep->param/10)); #else - str.printf("undervoltage: voltage %.1fV", (double)((float)ep->param/10)); + str.printf("undervoltage: voltage %.1fV", (double)((float)ep->param/10.0)); #endif return WarningMessage; diff --git a/src/Platform/Event.h b/src/Platform/Event.h index db8b563c09..382a4da269 100644 --- a/src/Platform/Event.h +++ b/src/Platform/Event.h @@ -82,7 +82,7 @@ class Event volatile bool isBeingProcessed; // true if this event is being processed, so it must remain at the head of the queue String<50> text; // additional info to display to the user - static Event * _ecv_null eventsPending; // linked list of events waiting to be processed + static Event *_ecv_null eventsPending; // linked list of events waiting to be processed static unsigned int eventsQueued; static unsigned int eventsProcessed; }; diff --git a/src/Platform/Logger.cpp b/src/Platform/Logger.cpp index 05dafaca48..282a5caae2 100644 --- a/src/Platform/Logger.cpp +++ b/src/Platform/Logger.cpp @@ -18,7 +18,7 @@ class Lock { public: - Lock(bool& pb) : b(pb) { b = true; } + explicit Lock(bool& pb) : b(pb) { b = true; } ~Lock() { b = false; } private: @@ -29,12 +29,12 @@ Logger::Logger(LogLevel logLvl) noexcept : logFile(), lastFlushTime(0), lastFlus { } -GCodeResult Logger::Start(time_t time, const StringRef& filename, const StringRef& reply) noexcept +GCodeResult Logger::Start(time_t currentTime, const StringRef& filename, const StringRef& reply) noexcept { if (!inLogger && logLevel > LogLevel::off) { Lock loggerLock(inLogger); - FileStore * const f = reprap.GetPlatform().OpenSysFile(filename.c_str(), OpenMode::append); + FileStore *_ecv_null const f = reprap.GetPlatform().OpenSysFile(filename.c_str(), OpenMode::append); if (f == nullptr) { reply.printf("Unable to create or open file %s", filename.c_str()); @@ -47,15 +47,15 @@ GCodeResult Logger::Start(time_t time, const StringRef& filename, const StringRe logFileName.copy(filename.c_str()); String startMessage; startMessage.printf("Event logging started at level %s\n", logLevel.ToString()); - InternalLogMessage(time, startMessage.c_str(), MessageLogLevel::info); - LogFirmwareInfo(time); + InternalLogMessage(currentTime, startMessage.c_str(), MessageLogLevel::info); + LogFirmwareInfo(currentTime); reprap.StateUpdated(); } return GCodeResult::ok; } // TODO: Move this to a more sensible location ? -void Logger::LogFirmwareInfo(time_t time) noexcept +void Logger::LogFirmwareInfo(time_t currentTime) noexcept { const size_t versionStringLength = 80 #if 0 && SUPPORT_CAN_EXPANSION // TODO enable this once the part below is cleaned up @@ -73,15 +73,15 @@ void Logger::LogFirmwareInfo(time_t time) noexcept firmwareInfo.catf(" - %s", expansionBoardData.typeName); } #endif - InternalLogMessage(time, firmwareInfo.c_str(), MessageLogLevel::info); + InternalLogMessage(currentTime, firmwareInfo.c_str(), MessageLogLevel::info); } -void Logger::Stop(time_t time) noexcept +void Logger::Stop(time_t currentTime) noexcept { if (logFile.IsLive() && !inLogger) { Lock loggerLock(inLogger); - InternalLogMessage(time, "Event logging stopped\n", MessageLogLevel::info); + InternalLogMessage(currentTime, "Event logging stopped\n", MessageLogLevel::info); logFile.Close(); reprap.StateUpdated(); } @@ -105,9 +105,8 @@ bool Logger::IsLoggingEnabledFor(const MessageType mt) const noexcept } #endif -void Logger::LogMessage(time_t time, const char *message, MessageType type) noexcept +void Logger::LogMessage(time_t currentTime, const char *_ecv_array message, MessageType type) noexcept { - if (logFile.IsLive() && !inLogger && !IsEmptyMessage(message)) { const auto messageLogLevel = GetMessageLogLevel(type); @@ -116,11 +115,11 @@ void Logger::LogMessage(time_t time, const char *message, MessageType type) noex return; } Lock loggerLock(inLogger); - InternalLogMessage(time, message, messageLogLevel); + InternalLogMessage(currentTime, message, messageLogLevel); } } -void Logger::LogMessage(time_t time, OutputBuffer *buf, MessageType type) noexcept +void Logger::LogMessage(time_t currentTime, OutputBuffer *buf, MessageType type) noexcept { if (logFile.IsLive() && !inLogger && !IsEmptyMessage(buf->Data())) { @@ -130,7 +129,7 @@ void Logger::LogMessage(time_t time, OutputBuffer *buf, MessageType type) noexce return; } Lock loggerLock(inLogger); - bool ok = WriteDateTimeAndLogLevelPrefix(time, messageLogLevel); + bool ok = WriteDateTimeAndLogLevelPrefix(currentTime, messageLogLevel); if (ok) { ok = buf->WriteToFile(logFile); @@ -149,9 +148,9 @@ void Logger::LogMessage(time_t time, OutputBuffer *buf, MessageType type) noexce } // Version of LogMessage for when we already know we want to proceed and we have already set inLogger -void Logger::InternalLogMessage(time_t time, const char *message, const MessageLogLevel messageLogLevel) noexcept +void Logger::InternalLogMessage(time_t currentTime, const char *_ecv_array message, const MessageLogLevel messageLogLevel) noexcept { - bool ok = WriteDateTimeAndLogLevelPrefix(time, messageLogLevel); + bool ok = WriteDateTimeAndLogLevelPrefix(currentTime, messageLogLevel); if (ok) { const size_t len = strlen(message); @@ -201,11 +200,11 @@ void Logger::Flush(bool forced) noexcept // Write the data, time and message log level to the file followed by a space. // Caller must already have checked and set inLogger. -bool Logger::WriteDateTimeAndLogLevelPrefix(time_t time, MessageLogLevel messageLogLevel) noexcept +bool Logger::WriteDateTimeAndLogLevelPrefix(time_t currentTime, MessageLogLevel messageLogLevel) noexcept { String bufferSpace; const StringRef buf = bufferSpace.GetRef(); - if (time == 0) + if (currentTime == 0) { const uint32_t timeSincePowerUp = (uint32_t)(millis64()/1000u); buf.printf("power up + %02" PRIu32 ":%02" PRIu32 ":%02" PRIu32 " ", timeSincePowerUp/3600u, (timeSincePowerUp % 3600u)/60u, timeSincePowerUp % 60u); @@ -213,7 +212,7 @@ bool Logger::WriteDateTimeAndLogLevelPrefix(time_t time, MessageLogLevel message else { tm timeInfo; - gmtime_r(&time, &timeInfo); + gmtime_r(¤tTime, &timeInfo); buf.printf("%04u-%02u-%02u %02u:%02u:%02u ", timeInfo.tm_year + 1900, timeInfo.tm_mon + 1, timeInfo.tm_mday, timeInfo.tm_hour, timeInfo.tm_min, timeInfo.tm_sec); } diff --git a/src/Platform/Logger.h b/src/Platform/Logger.h index ccea4d5d07..a83984be0f 100644 --- a/src/Platform/Logger.h +++ b/src/Platform/Logger.h @@ -20,15 +20,15 @@ class OutputBuffer; class Logger { public: - Logger(LogLevel logLvl) noexcept; + explicit Logger(LogLevel logLvl) noexcept; GCodeResult Start(time_t time, const StringRef& file, const StringRef& reply) noexcept; - void Stop(time_t time) noexcept; - void LogMessage(time_t time, const char *message, MessageType type) noexcept; - void LogMessage(time_t time, OutputBuffer *buf, MessageType type) noexcept; + void Stop(time_t currentTime) noexcept; + void LogMessage(time_t currentTime, const char *_ecv_array message, MessageType type) noexcept; + void LogMessage(time_t currentTime, OutputBuffer *buf, MessageType type) noexcept; void Flush(bool forced) noexcept; bool IsActive() const noexcept { return logFile.IsLive(); } - const char *GetFileName() const noexcept { return (IsActive()) ? logFileName.c_str() : nullptr; } + const char *_ecv_array _ecv_null GetFileName() const noexcept { return (IsActive()) ? logFileName.c_str() : nullptr; } LogLevel GetLogLevel() const noexcept { return logLevel; } void SetLogLevel(LogLevel newLogLevel) noexcept; #if 0 // Currently not needed but might be useful in the future @@ -40,15 +40,15 @@ class Logger private: NamedEnum(MessageLogLevel, uint8_t, debug, info, warn, off); - MessageLogLevel GetMessageLogLevel(MessageType mt) const noexcept { return (MessageLogLevel) ((mt & MessageType::LogLevelMask) >> MessageType::LogLevelShift); } + MessageLogLevel GetMessageLogLevel(MessageType mt) const noexcept { return (MessageLogLevel) (((unsigned int)mt & (unsigned int)MessageType::LogLevelMask) >> (unsigned int)MessageType::LogLevelShift); } static const uint8_t LogEnabledThreshold = 3; - bool WriteDateTimeAndLogLevelPrefix(time_t time, MessageLogLevel messageLogLevel) noexcept; - void InternalLogMessage(time_t time, const char *message, const MessageLogLevel messageLogLevel) noexcept; + bool WriteDateTimeAndLogLevelPrefix(time_t currentTime, MessageLogLevel messageLogLevel) noexcept; + void InternalLogMessage(time_t currentTime, const char *_ecv_array message, const MessageLogLevel messageLogLevel) noexcept; bool IsLoggingEnabledFor(const MessageLogLevel mll) const noexcept { return (mll < MessageLogLevel::off) && (mll.ToBaseType() + logLevel.ToBaseType() >= LogEnabledThreshold); } - void LogFirmwareInfo(time_t time) noexcept; - bool IsEmptyMessage(const char * message) const noexcept { return message[0] == '\0' || (message[0] == '\n' && message[1] == '\0'); } + void LogFirmwareInfo(time_t currentTime) noexcept; + bool IsEmptyMessage(const char *_ecv_array message) const noexcept { return message[0] == '\0' || (message[0] == '\n' && message[1] == '\0'); } String logFileName; FileData logFile; diff --git a/src/Platform/OutputMemory.cpp b/src/Platform/OutputMemory.cpp index 14a1e36897..731976593a 100644 --- a/src/Platform/OutputMemory.cpp +++ b/src/Platform/OutputMemory.cpp @@ -10,14 +10,14 @@ #include "RepRap.h" #include -/*static*/ OutputBuffer * volatile OutputBuffer::freeOutputBuffers = nullptr; // Messages may also be sent by ISRs, +/*static*/ OutputBuffer *_ecv_null volatile OutputBuffer::freeOutputBuffers = nullptr; // Messages may also be sent by ISRs, /*static*/ volatile size_t OutputBuffer::usedOutputBuffers = 0; // so make these volatile. /*static*/ volatile size_t OutputBuffer::maxUsedOutputBuffers = 0; //************************************************************************************************* // OutputBuffer class implementation -void OutputBuffer::Append(OutputBuffer *other) noexcept +void OutputBuffer::Append(OutputBuffer *_ecv_null other) noexcept { if (other != nullptr) { @@ -76,7 +76,7 @@ char OutputBuffer::operator[](size_t index) const noexcept return itemToIndex->data[index]; } -const char *OutputBuffer::Read(size_t len) noexcept +const char *_ecv_array OutputBuffer::Read(size_t len) noexcept { const size_t offset = bytesRead; bytesRead += len; @@ -301,7 +301,7 @@ size_t OutputBuffer::EncodeChar(char c) noexcept return cat(c); } -size_t OutputBuffer::EncodeReply(OutputBuffer *src) noexcept +size_t OutputBuffer::EncodeReply(OutputBuffer *_ecv_null src) noexcept { size_t bytesWritten = cat('"'); @@ -359,7 +359,7 @@ bool OutputBuffer::WriteToFile(FileData& f) const noexcept } // Allocates an output buffer instance which can be used for (large) string outputs. This must be thread safe. Not safe to call from interrupts! -/*static*/ bool OutputBuffer::Allocate(OutputBuffer *&buf) noexcept +/*static*/ bool OutputBuffer::Allocate(OutputBuffer *_ecv_null &buf) noexcept { { TaskCriticalSectionLocker lock; @@ -408,7 +408,7 @@ bool OutputBuffer::WriteToFile(FileData& f) const noexcept // Truncate an output buffer to free up more memory. Returns the number of released bytes. // This never releases the first buffer in the chain, so call it with a large value of bytesNeeded to release all buffers except the first. -/*static */ size_t OutputBuffer::Truncate(OutputBuffer *buffer, size_t bytesNeeded) noexcept +/*static */ size_t OutputBuffer::Truncate(OutputBuffer *_ecv_null buffer, size_t bytesNeeded) noexcept { // Can we free up space from this chain? Don't break it up if it's referenced anywhere else if (buffer == nullptr || buffer->Next() == nullptr || buffer->IsReferenced()) @@ -436,7 +436,7 @@ bool OutputBuffer::WriteToFile(FileData& f) const noexcept } while (previousItem != buffer && releasedBytes < bytesNeeded); // Update all the references to the last item - for (OutputBuffer *item = buffer; item != nullptr; item = item->Next()) + for (OutputBuffer *_ecv_null item = buffer; item != nullptr; item = item->Next()) { item->last = previousItem; } @@ -465,7 +465,7 @@ bool OutputBuffer::WriteToFile(FileData& f) const noexcept return nextBuffer; } -/*static */ void OutputBuffer::ReleaseAll(OutputBuffer * volatile &buf) noexcept +/*static */ void OutputBuffer::ReleaseAll(OutputBuffer *_ecv_null volatile &buf) noexcept { while (buf != nullptr) { @@ -483,7 +483,7 @@ bool OutputBuffer::WriteToFile(FileData& f) const noexcept // OutputStack class implementation // Push an OutputBuffer chain. Return true if successful, else release the buffer and return false. -bool OutputStack::Push(OutputBuffer *buffer, MessageType type) volatile noexcept +bool OutputStack::Push(OutputBuffer *_ecv_null buffer, MessageType type) volatile noexcept { { TaskCriticalSectionLocker lock; @@ -541,7 +541,7 @@ MessageType OutputStack::GetFirstItemType() const volatile noexcept #if HAS_SBC_INTERFACE // Update the first item of the stack -void OutputStack::SetFirstItem(OutputBuffer *buffer) volatile noexcept +void OutputStack::SetFirstItem(OutputBuffer *_ecv_null buffer) volatile noexcept { if (count != 0) { @@ -598,7 +598,7 @@ bool OutputStack::ApplyTimeout(uint32_t ticks) volatile noexcept } // Returns the last item from the stack or nullptr if none is available -OutputBuffer *OutputStack::GetLastItem() const volatile noexcept +OutputBuffer *_ecv_null OutputStack::GetLastItem() const volatile noexcept { return (count == 0) ? nullptr : items[count - 1]; } diff --git a/src/Platform/OutputMemory.h b/src/Platform/OutputMemory.h index 6034127b1c..fb5c350805 100644 --- a/src/Platform/OutputMemory.h +++ b/src/Platform/OutputMemory.h @@ -21,10 +21,10 @@ const size_t OUTPUT_STACK_DEPTH = 4; // Number of OutputBuffer chains that can b class OutputBuffer { public: - explicit OutputBuffer(OutputBuffer *null n) noexcept : next(n) { } + explicit OutputBuffer(OutputBuffer *_ecv_null n) noexcept : next(n) { } OutputBuffer(const OutputBuffer&) = delete; - void Append(OutputBuffer *other) noexcept; + void Append(OutputBuffer *_ecv_null other) noexcept; OutputBuffer *null Next() const noexcept { return next; } bool IsReferenced() const noexcept { return isReferenced; } bool HadOverflow() const noexcept { return hadOverflow; } @@ -61,7 +61,7 @@ class OutputBuffer size_t cat(StringRef &str) noexcept; size_t EncodeChar(char c) noexcept; - size_t EncodeReply(OutputBuffer *src) noexcept; + size_t EncodeReply(OutputBuffer *_ecv_null src) noexcept; uint32_t GetAge() const noexcept; @@ -73,20 +73,20 @@ class OutputBuffer static void Init() noexcept; // Allocate an unused OutputBuffer instance. Returns true on success or false if no instance could be allocated. - static bool Allocate(OutputBuffer *&buf) noexcept; + static bool Allocate(OutputBuffer *_ecv_null &buf) noexcept; // Get the number of bytes left for allocation. If writingBuffer is not NULL, this returns the number of free bytes for // continuous writes, i.e. for writes that need to allocate an extra OutputBuffer instance to finish the message. static size_t GetBytesLeft(const OutputBuffer *writingBuffer) noexcept; // Truncate an OutputBuffer instance to free up more memory. Returns the number of released bytes. - static size_t Truncate(OutputBuffer *buffer, size_t bytesNeeded) noexcept; + static size_t Truncate(OutputBuffer *_ecv_null buffer, size_t bytesNeeded) noexcept; // Release one OutputBuffer instance. Returns the next item from the chain or nullptr if this was the last instance. __attribute__((warn_unused_result)) static OutputBuffer *Release(OutputBuffer *buf) noexcept; // Release all OutputBuffer objects in a chain - static void ReleaseAll(OutputBuffer * volatile &buf) noexcept; + static void ReleaseAll(OutputBuffer *_ecv_null volatile &buf) noexcept; static void Diagnostics(MessageType mtype) noexcept; @@ -95,7 +95,7 @@ class OutputBuffer private: void Clear() noexcept; - OutputBuffer *null next; + OutputBuffer *_ecv_null next; OutputBuffer *last; uint32_t whenQueued; // milliseconds timer when this buffer was filled in @@ -107,7 +107,7 @@ class OutputBuffer bool hadOverflow; volatile size_t references; - static OutputBuffer * volatile freeOutputBuffers; // Messages may be sent by multiple tasks + static OutputBuffer *_ecv_null volatile freeOutputBuffers; // Messages may be sent by multiple tasks static volatile size_t usedOutputBuffers; // so make these volatile. static volatile size_t maxUsedOutputBuffers; }; @@ -132,7 +132,7 @@ class OutputStack void Clear() volatile noexcept { count = 0; } // Push an OutputBuffer chain. Return true if successful, else release the buffer and return false. - bool Push(OutputBuffer *buffer, MessageType type = NoDestinationMessage) volatile noexcept; + bool Push(OutputBuffer *_ecv_null buffer, MessageType type = NoDestinationMessage) volatile noexcept; // Pop an OutputBuffer chain or return NULL if none is available OutputBuffer *Pop() volatile noexcept; @@ -154,7 +154,7 @@ class OutputStack bool ApplyTimeout(uint32_t ticks) volatile noexcept; // Returns the last item from the stack or NULL if none is available - OutputBuffer *GetLastItem() const volatile noexcept; + OutputBuffer *_ecv_null GetLastItem() const volatile noexcept; // Returns the type of the last item from the stack or NoDestinationMessage if none is available MessageType GetLastItemType() const volatile noexcept; @@ -174,7 +174,7 @@ class OutputStack private: size_t count; - OutputBuffer * items[OUTPUT_STACK_DEPTH]; + OutputBuffer *_ecv_null items[OUTPUT_STACK_DEPTH]; MessageType types[OUTPUT_STACK_DEPTH]; }; diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp index 5c465021ec..6377e47bc3 100644 --- a/src/Platform/Platform.cpp +++ b/src/Platform/Platform.cpp @@ -2715,14 +2715,14 @@ GCodeResult Platform::ReceiveI2cOrModbus(GCodeBuffer& gb, const StringRef &reply String varName; bool seenV = false; gb.TryGetQuotedString('V', varName.GetRef(), seenV, false); - if (!Variable::IsValidVariableName(varName.c_str())) - { - reply.printf("variable '%s' is not a valid name", varName.c_str()); - return GCodeResult::error; - } Variable *_ecv_null resultVar = nullptr; if (seenV) { + if (!Variable::IsValidVariableName(varName.c_str())) + { + reply.printf("variable '%s' is not a valid name", varName.c_str()); + return GCodeResult::error; + } auto vset = WriteLockedPointer(nullptr, &gb.GetVariables()); Variable *_ecv_null const v = vset->Lookup(varName.c_str(), false); if (v != nullptr) diff --git a/src/Platform/Platform.h b/src/Platform/Platform.h index 2985fbcbfa..fa1889722e 100644 --- a/src/Platform/Platform.h +++ b/src/Platform/Platform.h @@ -298,7 +298,7 @@ class Platform INHERIT_OBJECT_MODEL // File functions #if HAS_MASS_STORAGE || HAS_SBC_INTERFACE || HAS_EMBEDDED_FILES - FileStore* OpenFile(const char *_ecv_array folder, const char *_ecv_array fileName, OpenMode mode, uint32_t preAllocSize = 0) const noexcept; + FileStore *_ecv_null OpenFile(const char *_ecv_array folder, const char *_ecv_array fileName, OpenMode mode, uint32_t preAllocSize = 0) const noexcept; bool FileExists(const char *_ecv_array folder, const char *_ecv_array filename) const noexcept; # if HAS_MASS_STORAGE || HAS_SBC_INTERFACE bool Delete(const char *_ecv_array folder, const char *_ecv_array filename) const noexcept; @@ -311,7 +311,7 @@ class Platform INHERIT_OBJECT_MODEL // Functions to work with the system files folder GCodeResult SetSysDir(const char *_ecv_array dir, const StringRef& reply) noexcept; // Set the system files path bool SysFileExists(const char *_ecv_array filename) const noexcept; - FileStore* OpenSysFile(const char *_ecv_array filename, OpenMode mode) const noexcept; + FileStore *_ecv_null OpenSysFile(const char *_ecv_array filename, OpenMode mode) const noexcept; # if HAS_MASS_STORAGE || HAS_SBC_INTERFACE bool DeleteSysFile(const char *_ecv_array filename) const noexcept; # endif diff --git a/src/Platform/UniqueId.cpp b/src/Platform/UniqueId.cpp index 0591c5e107..01759f4ad0 100644 --- a/src/Platform/UniqueId.cpp +++ b/src/Platform/UniqueId.cpp @@ -20,7 +20,7 @@ void UniqueId::GenerateMacAddress(MacAddress& addr) const noexcept // There are 16 ID bytes not including the checksum. It appears that the last bytes are more likely to change, so they must be included. memset(addr.bytes, 0, sizeof(addr.bytes)); addr.bytes[0] = 0xBE; // use a fixed first byte with the locally-administered bit set - const uint8_t * const idBytes = reinterpret_cast(data); + const uint8_t *_ecv_array const idBytes = reinterpret_cast(data); for (size_t i = 0; i < 16; ++i) { addr.bytes[(i % 5) + 1] ^= idBytes[i]; diff --git a/src/RepRapFirmware.h b/src/RepRapFirmware.h index 0b262b6d0d..97950e52ab 100644 --- a/src/RepRapFirmware.h +++ b/src/RepRapFirmware.h @@ -484,9 +484,9 @@ inline constexpr unsigned int ParameterLetterToBitNumber(char c) noexcept } // Find the parameter letter corresponding to a bit number -inline constexpr unsigned int BitNumberToParameterLetter(unsigned int n) noexcept +inline constexpr char BitNumberToParameterLetter(unsigned int n) noexcept { - return (n < 26) ? 'A' + n : 'a' + (n - 26); + return (n < 26) ? (char)('A' + n) : (char)('a' + (n - 26)); } // Make a ParameterLettersBitmap representing a single letter diff --git a/src/RepRapFirmware.pdp b/src/RepRapFirmware.pdp index 39580067a8..75bac821e6 100644 Binary files a/src/RepRapFirmware.pdp and b/src/RepRapFirmware.pdp differ diff --git a/src/Tools/Filament.h b/src/Tools/Filament.h index c70b76db76..8b0fb869ef 100644 --- a/src/Tools/Filament.h +++ b/src/Tools/Filament.h @@ -12,14 +12,13 @@ const size_t FilamentNameLength = 32; - class Filament { public: - Filament(int extr) noexcept; + explicit Filament(int extr) noexcept; int GetExtruder() const noexcept { return extruder; } // Returns the assigned extruder drive - const char *GetName() const noexcept { return name.c_str(); } // Returns the name of the currently loaded filament + const char *_ecv_array GetName() const noexcept { return name.c_str(); } // Returns the name of the currently loaded filament // TODO: Add support for filament counters, tool restrictions etc. // These should be stored in a dedicate file per filament directory like /filaments//filament.json