diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-11-09 14:30:28 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-11-09 14:30:28 +0300 |
commit | 06dc58407ac9a3ea9552cc96d5b77822551c554b (patch) | |
tree | 88d4516ca8695a0aeb7ad5f673ede29f022ad13f /src/Platform | |
parent | 890d18e32fa955feb4a6846cc47f282397e93549 (diff) |
Annotations for static analysis
Diffstat (limited to 'src/Platform')
-rw-r--r-- | src/Platform/Platform.cpp | 62 | ||||
-rw-r--r-- | src/Platform/Platform.h | 42 |
2 files changed, 52 insertions, 52 deletions
diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp index 293f4038..259eae32 100644 --- a/src/Platform/Platform.cpp +++ b/src/Platform/Platform.cpp @@ -205,7 +205,7 @@ constexpr ObjectModelArrayDescriptor Platform::workplaceOffsetsArrayDescriptor = { return ExpressionValue(reprap.GetGCodes().GetWorkplaceOffset(context.GetIndex(1), context.GetIndex(0)), 3); } }; -static inline const char* GetFilamentName(size_t extruder) noexcept +static inline const char *_ecv_array GetFilamentName(size_t extruder) noexcept { const Filament *fil = Filament::GetFilamentByExtruder(extruder); return (fil == nullptr) ? "" : fil->GetName(); @@ -215,7 +215,7 @@ constexpr ObjectModelTableEntry Platform::objectModelTable[] = { // 0. boards[0] members #if SUPPORT_ACCELEROMETERS - { "accelerometer", OBJECT_MODEL_FUNC_IF(Accelerometers::HasLocalAccelerometer(), self, 9), ObjectModelEntryFlags::none }, + { "accelerometer", OBJECT_MODEL_FUNC_IF(Accelerometers::HasLocalAccelerometer(), self, 9), ObjectModelEntryFlags::none }, #endif #if SUPPORT_CAN_EXPANSION { "canAddress", OBJECT_MODEL_FUNC_NOSELF((int32_t)CanInterface::GetCanAddress()), ObjectModelEntryFlags::none }, @@ -872,7 +872,7 @@ void Platform::PanelDueBeep(int freq, int ms) noexcept } // Send a short message to the aux channel. There is no flow control on this port, so it can't block for long. -void Platform::SendPanelDueMessage(size_t auxNumber, const char* msg) noexcept +void Platform::SendPanelDueMessage(size_t auxNumber, const char *_ecv_array msg) noexcept { #if HAS_AUX_DEVICES // Don't send anything to PanelDue while we are flashing it @@ -1428,7 +1428,7 @@ void Platform::Spin() noexcept // Report driver status conditions that require attention. // Sets 'reported' if we reported anything, else leaves 'reported' alone. -void Platform::ReportDrivers(MessageType mt, DriversBitmap& whichDrivers, const char* text, bool& reported) noexcept +void Platform::ReportDrivers(MessageType mt, DriversBitmap& whichDrivers, const char *_ecv_array text, bool& reported) noexcept { if (whichDrivers.IsNonEmpty()) { @@ -1696,7 +1696,7 @@ void Platform::Diagnostics(MessageType mtype) noexcept Message(mtype, "\n"); #else - const char* resetReasons[8] = { "power up", "backup", "watchdog", "software", + const char *_ecv_array resetReasons[8] = { "power up", "backup", "watchdog", "software", # ifdef DUET_NG // On the SAM4E a watchdog reset may be reported as a user reset because of the capacitor on the NRST pin. // The SAM4S is the same but the Duet M has a diode in the reset circuit to avoid this problem. @@ -2315,9 +2315,9 @@ GCodeResult Platform::DiagnosticTest(GCodeBuffer& gb, const StringRef& reply, Ou uint32_t now1 = SysTick->VAL; crc.Update( #if SAME5x - reinterpret_cast<const char*>(HSRAM_ADDR), + reinterpret_cast<const char *_ecv_array>(HSRAM_ADDR), #else - reinterpret_cast<const char*>(IRAM_ADDR), // for the SAME70 this is in the non-cacheable RAM, which is the usual case when computing a CRC + reinterpret_cast<const char *_ecv_array>(IRAM_ADDR), // for the SAME70 this is in the non-cacheable RAM, which is the usual case when computing a CRC #endif length); uint32_t now2 = SysTick->VAL; @@ -3217,7 +3217,7 @@ void Platform::InitPanelDueUpdater() noexcept } #endif -void Platform::AppendAuxReply(size_t auxNumber, const char *msg, bool rawMessage) noexcept +void Platform::AppendAuxReply(size_t auxNumber, const char *_ecv_array msg, bool rawMessage) noexcept { #if HAS_AUX_DEVICES if (auxNumber < ARRAY_SIZE(auxDevices)) @@ -3253,7 +3253,7 @@ void Platform::AppendAuxReply(size_t auxNumber, OutputBuffer *reply, bool rawMes } // Send the specified message to the specified destinations. The Error and Warning flags have already been handled. -void Platform::RawMessage(MessageType type, const char *message) noexcept +void Platform::RawMessage(MessageType type, const char *_ecv_array message) noexcept { #if HAS_MASS_STORAGE // Deal with logging @@ -3292,7 +3292,7 @@ void Platform::RawMessage(MessageType type, const char *message) noexcept { // Debug output sends messages in blocking mode. We now give up sending if we are close to software watchdog timeout. MutexLocker lock(usbMutex); - const char *p = message; + const char *_ecv_array p = message; size_t len = strlen(p); while (SERIAL_MAIN_DEVICE.IsConnected() && len != 0 && !reprap.SpinTimeoutImminent()) { @@ -3417,7 +3417,7 @@ void Platform::Message(const MessageType type, OutputBuffer *buffer) noexcept } } -void Platform::MessageF(MessageType type, const char *fmt, va_list vargs) noexcept +void Platform::MessageV(MessageType type, const char *_ecv_array fmt, va_list vargs) noexcept { String<FormatStringLength> formatString; #if HAS_SBC_INTERFACE @@ -3450,15 +3450,15 @@ void Platform::MessageF(MessageType type, const char *fmt, va_list vargs) noexce RawMessage((MessageType)(type & ~(ErrorMessageFlag | WarningMessageFlag)), formatString.c_str()); } -void Platform::MessageF(MessageType type, const char *fmt, ...) noexcept +void Platform::MessageF(MessageType type, const char *_ecv_array fmt, ...) noexcept { va_list vargs; va_start(vargs, fmt); - MessageF(type, fmt, vargs); + MessageV(type, fmt, vargs); va_end(vargs); } -void Platform::Message(MessageType type, const char *message) noexcept +void Platform::Message(MessageType type, const char *_ecv_array message) noexcept { #if HAS_SBC_INTERFACE if (reprap.UsingSbcInterface() && @@ -3499,7 +3499,7 @@ void Platform::Message(MessageType type, const char *message) noexcept } // Send a debug message to USB using minimal stack -void Platform::DebugMessage(const char *fmt, va_list vargs) noexcept +void Platform::DebugMessage(const char *_ecv_array fmt, va_list vargs) noexcept { MutexLocker lock(usbMutex); vuprintf([](char c) -> bool @@ -3527,7 +3527,7 @@ void Platform::DebugMessage(const char *fmt, va_list vargs) noexcept // sParam = 1 As for 0 but display a Close button as well // sParam = 2 Display the message box with an OK button, wait for acknowledgement (waiting is set up by the caller) // sParam = 3 As for 2 but also display a Cancel button -void Platform::SendAlert(MessageType mt, const char *message, const char *title, int sParam, float tParam, AxesBitmap controls) noexcept +void Platform::SendAlert(MessageType mt, const char *_ecv_array message, const char *_ecv_array title, int sParam, float tParam, AxesBitmap controls) noexcept { if ((mt & (HttpMessage | AuxMessage | LcdMessage | BinaryCodeReplyFlag)) != 0) { @@ -3605,14 +3605,14 @@ GCodeResult Platform::ConfigureLogging(GCodeBuffer& gb, const StringRef& reply) } // Return the log file name, or nullptr if logging is not active -const char *Platform::GetLogFileName() const noexcept +const char *_ecv_array null Platform::GetLogFileName() const noexcept { return (logger == nullptr) ? nullptr : logger->GetFileName(); } #endif -const char *Platform::GetLogLevel() const noexcept +const char *_ecv_array Platform::GetLogLevel() const noexcept { static const LogLevel off = LogLevel::off; // need to have an instance otherwise it will fail .ToString() below #if HAS_MASS_STORAGE @@ -3864,7 +3864,7 @@ void Platform::SetBoardType(BoardType bt) noexcept } // Get a string describing the electronics -const char* Platform::GetElectronicsString() const noexcept +const char *_ecv_array Platform::GetElectronicsString() const noexcept { switch (board) { @@ -3908,7 +3908,7 @@ const char* Platform::GetElectronicsString() const noexcept } // Get the board string -const char* Platform::GetBoardString() const noexcept +const char *_ecv_array Platform::GetBoardString() const noexcept { switch (board) { @@ -3959,14 +3959,14 @@ bool Platform::IsDuetWiFi() const noexcept return board == BoardType::DuetWiFi_10 || board == BoardType::DuetWiFi_102; } -const char *Platform::GetBoardName() const noexcept +const char *_ecv_array Platform::GetBoardName() const noexcept { return (board == BoardType::Duet2SBC_10 || board == BoardType::Duet2SBC_102) ? BOARD_NAME_SBC : (IsDuetWiFi()) ? BOARD_NAME_WIFI : BOARD_NAME_ETHERNET; } -const char *Platform::GetBoardShortName() const noexcept +const char *_ecv_array Platform::GetBoardShortName() const noexcept { return (board == BoardType::Duet2SBC_10 || board == BoardType::Duet2SBC_102) ? BOARD_SHORT_NAME_SBC @@ -3987,13 +3987,13 @@ bool Platform::IsDuetWiFi() const noexcept #if HAS_MASS_STORAGE || HAS_SBC_INTERFACE -bool Platform::Delete(const char* folder, const char *filename) const noexcept +bool Platform::Delete(const char *_ecv_array folder, const char *_ecv_array filename) const noexcept { String<MaxFilenameLength> location; return MassStorage::CombineName(location.GetRef(), folder, filename) && MassStorage::Delete(location.c_str(), true); } -bool Platform::DeleteSysFile(const char *filename) const noexcept +bool Platform::DeleteSysFile(const char *_ecv_array filename) const noexcept { String<MaxFilenameLength> location; return MakeSysFileName(location.GetRef(), filename) && MassStorage::Delete(location.c_str(), true); @@ -4004,7 +4004,7 @@ bool Platform::DeleteSysFile(const char *filename) const noexcept #if HAS_MASS_STORAGE || HAS_SBC_INTERFACE || HAS_EMBEDDED_FILES // Open a file -FileStore* Platform::OpenFile(const char* folder, const char* fileName, OpenMode mode, uint32_t preAllocSize) const noexcept +FileStore* Platform::OpenFile(const char *_ecv_array folder, const char *_ecv_array fileName, OpenMode mode, uint32_t preAllocSize) const noexcept { String<MaxFilenameLength> location; return (MassStorage::CombineName(location.GetRef(), folder, fileName)) @@ -4012,25 +4012,25 @@ FileStore* Platform::OpenFile(const char* folder, const char* fileName, OpenMode : nullptr; } -bool Platform::FileExists(const char* folder, const char *filename) const noexcept +bool Platform::FileExists(const char *_ecv_array folder, const char *_ecv_array filename) const noexcept { String<MaxFilenameLength> location; return MassStorage::CombineName(location.GetRef(), folder, filename) && MassStorage::FileExists(location.c_str()); } // Return a pointer to a string holding the directory where the system files are. Lock the sysdir lock before calling this. -const char* Platform::InternalGetSysDir() const noexcept +const char *_ecv_array Platform::InternalGetSysDir() const noexcept { return (sysDir != nullptr) ? sysDir : DEFAULT_SYS_DIR; } -bool Platform::SysFileExists(const char *filename) const noexcept +bool Platform::SysFileExists(const char *_ecv_array filename) const noexcept { String<MaxFilenameLength> location; return MakeSysFileName(location.GetRef(), filename) && MassStorage::FileExists(location.c_str()); } -FileStore* Platform::OpenSysFile(const char *filename, OpenMode mode) const noexcept +FileStore* Platform::OpenSysFile(const char *_ecv_array filename, OpenMode mode) const noexcept { String<MaxFilenameLength> location; return (MakeSysFileName(location.GetRef(), filename)) @@ -4038,7 +4038,7 @@ FileStore* Platform::OpenSysFile(const char *filename, OpenMode mode) const noex : nullptr; } -bool Platform::MakeSysFileName(const StringRef& result, const char *filename) const noexcept +bool Platform::MakeSysFileName(const StringRef& result, const char *_ecv_array filename) const noexcept { return MassStorage::CombineName(result, GetSysDir().Ptr(), filename); } @@ -4059,7 +4059,7 @@ ReadLockedPointer<const char> Platform::GetSysDir() const noexcept #if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES // Set the system files path -GCodeResult Platform::SetSysDir(const char* dir, const StringRef& reply) noexcept +GCodeResult Platform::SetSysDir(const char *_ecv_array dir, const StringRef& reply) noexcept { String<MaxFilenameLength> newSysDir; WriteLocker lock(sysDirLock); diff --git a/src/Platform/Platform.h b/src/Platform/Platform.h index c6c7ae77..a1f816da 100644 --- a/src/Platform/Platform.h +++ b/src/Platform/Platform.h @@ -336,8 +336,8 @@ public: BoardType GetBoardType() const noexcept { return board; } void SetBoardType(BoardType bt) noexcept; - const char* GetElectronicsString() const noexcept; - const char* GetBoardString() const noexcept; + const char *_ecv_array GetElectronicsString() const noexcept; + const char *_ecv_array GetBoardString() const noexcept; #if SUPPORT_OBJECT_MODEL size_t GetNumGpInputsToReport() const noexcept; @@ -350,8 +350,8 @@ public: #ifdef DUET_NG bool IsDueXPresent() const noexcept { return expansionBoard != ExpansionBoardType::none; } - const char *GetBoardName() const noexcept; - const char *GetBoardShortName() const noexcept; + const char *_ecv_array GetBoardName() const noexcept; + const char *_ecv_array GetBoardShortName() const noexcept; #endif const MacAddress& GetDefaultMacAddress() const noexcept { return defaultMacAddress; } @@ -369,7 +369,7 @@ public: // Communications and data storage void AppendUsbReply(OutputBuffer *buffer) noexcept; void AppendAuxReply(size_t auxNumber, OutputBuffer *buf, bool rawMessage) noexcept; - void AppendAuxReply(size_t auxNumber, const char *msg, bool rawMessage) noexcept; + void AppendAuxReply(size_t auxNumber, const char *_ecv_array msg, bool rawMessage) noexcept; void ResetChannel(size_t chan) noexcept; // Re-initialise a serial channel bool IsAuxEnabled(size_t auxNumber) const noexcept; // Any device on the AUX line? @@ -399,10 +399,10 @@ public: // File functions #if HAS_MASS_STORAGE || HAS_SBC_INTERFACE || HAS_EMBEDDED_FILES - FileStore* OpenFile(const char* folder, const char* fileName, OpenMode mode, uint32_t preAllocSize = 0) const noexcept; - bool FileExists(const char* folder, const char *filename) const noexcept; + FileStore* OpenFile(const char *_ecv_array folder, const char* 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* folder, const char *filename) const noexcept; + bool Delete(const char *_ecv_array folder, const char *_ecv_array filename) const noexcept; #endif const char *_ecv_array GetWebDir() const noexcept; // Where the html etc files are @@ -410,13 +410,13 @@ public: const char *_ecv_array GetMacroDir() const noexcept; // Where the user-defined macros are // Functions to work with the system files folder - GCodeResult SetSysDir(const char* dir, const StringRef& reply) noexcept; // Set the system files path - bool SysFileExists(const char *filename) const noexcept; - FileStore* OpenSysFile(const char *filename, OpenMode mode) const noexcept; + 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; # if HAS_MASS_STORAGE || HAS_SBC_INTERFACE - bool DeleteSysFile(const char *filename) const noexcept; + bool DeleteSysFile(const char *_ecv_array filename) const noexcept; # endif - bool MakeSysFileName(const StringRef& result, const char *filename) const noexcept; + bool MakeSysFileName(const StringRef& rslt, const char *_ecv_array filename) const noexcept; void AppendSysDir(const StringRef & path) const noexcept; ReadLockedPointer<const char> GetSysDir() const noexcept; // where the system files are #endif @@ -425,7 +425,7 @@ public: void Message(MessageType type, const char *_ecv_array message) noexcept; void Message(MessageType type, OutputBuffer *buffer) noexcept; void MessageF(MessageType type, const char *_ecv_array fmt, ...) noexcept __attribute__ ((format (printf, 3, 4))); - void MessageF(MessageType type, const char *_ecv_array fmt, va_list vargs) noexcept; + void MessageV(MessageType type, const char *_ecv_array fmt, va_list vargs) noexcept; void DebugMessage(const char *_ecv_array fmt, va_list vargs) noexcept; bool FlushMessages() noexcept; // Flush messages to USB and aux, returning true if there is more to send void SendAlert(MessageType mt, const char *_ecv_array message, const char *_ecv_array title, int sParam, float tParam, AxesBitmap controls) noexcept; @@ -537,7 +537,7 @@ public: // AUX device void PanelDueBeep(int freq, int ms) noexcept; - void SendPanelDueMessage(size_t auxNumber, const char* msg) noexcept; + void SendPanelDueMessage(size_t auxNumber, const char *_ecv_array msg) noexcept; // Hotend configuration float GetFilamentWidth() const noexcept; @@ -590,10 +590,10 @@ public: #endif // Logging support - const char *GetLogLevel() const noexcept; + const char *_ecv_array GetLogLevel() const noexcept; #if HAS_MASS_STORAGE GCodeResult ConfigureLogging(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); - const char *GetLogFileName() const noexcept; + const char *_ecv_array null GetLogFileName() const noexcept; #endif // Ancillary PWM @@ -656,9 +656,9 @@ protected: OBJECT_MODEL_ARRAY(workplaceOffsets) private: - const char* InternalGetSysDir() const noexcept; // where the system files are - not thread-safe! + const char *_ecv_array InternalGetSysDir() const noexcept; // where the system files are - not thread-safe! - void RawMessage(MessageType type, const char *message) noexcept; // called by Message after handling error/warning flags + void RawMessage(MessageType type, const char *_ecv_array message) noexcept; // called by Message after handling error/warning flags float GetCpuTemperature() const noexcept; @@ -672,7 +672,7 @@ private: #endif #if HAS_SMART_DRIVERS - void ReportDrivers(MessageType mt, DriversBitmap& whichDrivers, const char* text, bool& reported) noexcept; + void ReportDrivers(MessageType mt, DriversBitmap& whichDrivers, const char *_ecv_array text, bool& reported) noexcept; #endif #if HAS_MASS_STORAGE @@ -821,7 +821,7 @@ private: // Files #if HAS_MASS_STORAGE || HAS_SBC_INTERFACE || HAS_EMBEDDED_FILES - const char *sysDir; + const char *_ecv_array sysDir; mutable ReadWriteLock sysDirLock; #endif |