Skip to content

Commit

Permalink
Removing error console and restoring assert functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
LeStarch committed Feb 6, 2025
1 parent fa8a2ea commit 7447c5d
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 30 deletions.
4 changes: 2 additions & 2 deletions Fw/Port/PortBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ namespace Fw {
FW_ASSERT(size > 0);
// Get the port-custom format string
const char* formatString = this->getToStringFormatString();

Check notice

Code scanning / CodeQL

Use of basic integral type Note

formatString uses the basic integral type char rather than a typedef with size and signedness.
// Determine this port object name (or use "UNKOWN")
// Determine this port object name (or use "UNKNOWN")
const char* object_name =

Check notice

Code scanning / CodeQL

Use of basic integral type Note

object_name uses the basic integral type char rather than a typedef with size and signedness.
#if FW_OBJECT_NAMES == 1

Check notice

Code scanning / CodeQL

Conditional compilation Note

Use of conditional compilation must be kept to a minimum.
this->m_objName.toChar();
Expand All @@ -95,7 +95,7 @@ namespace Fw {
// Get the C/NC for connected or not
const char* this_is_connected = this->isConnected() ? "C" : "NC";

Check notice

Code scanning / CodeQL

Use of basic integral type Note

this_is_connected uses the basic integral type char rather than a typedef with size and signedness.

// Get the name of the connectioned object, "UNKNNOWN" or "NONE"
// Get the name of the connection object, "UNKNOWN" or "NONE"
const char* connected_to = this->isConnected() ?

Check notice

Code scanning / CodeQL

Use of basic integral type Note

connected_to uses the basic integral type char rather than a typedef with size and signedness.
#if FW_OBJECT_NAMES == 1

Check notice

Code scanning / CodeQL

Conditional compilation Note

Use of conditional compilation must be kept to a minimum.
this->m_connObj->getObjName()
Expand Down
5 changes: 3 additions & 2 deletions Fw/Types/Assert.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include <FpConfig.hpp>
#include <Fw/Types/Assert.hpp>
#include <Fw/Types/ExternalString.hpp>
#include <Fw/Logger/Logger.hpp>
#include <Fw/Types/StringUtils.hpp>
#include <cassert>
#include <cstdio>

#if FW_ASSERT_LEVEL == FW_FILEID_ASSERT
#define fileIdFs "Assert: 0x%08" PRIx32 ":%" PRI_PlatformUIntType
Expand All @@ -13,7 +14,7 @@
namespace Fw {

void defaultPrintAssert(const CHAR* msg) {
Fw::Logger::log("%s", msg);
(void) fwrite(msg, sizeof(CHAR), static_cast<size_t>(Fw::StringUtils::string_length(msg, FW_ASSERT_TEXT_SIZE)), stderr);

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter msg has not been checked.

Check warning

Code scanning / CodeQL

Uses of recursion Warning

The function defaultPrintAssert is indirectly recursive via this call to
string_length
.
}

void defaultReportAssert(FILE_NAME_ARG file,
Expand Down
7 changes: 0 additions & 7 deletions Os/Posix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ register_fprime_module(Os_Posix_Shared)
register_os_implementation("File;FileSystem;Directory" Posix Os_Posix_Shared)
register_os_implementation("Console" Posix)

# Special error console
set(MOD_DEPS "Os_Console_Common")
add_library("Os_Console_PosixError" INTERFACE)
add_dependencies("Os_Console_PosixError" "Os_Console_Common" "Os_Console_Posix")
target_link_libraries("Os_Console_PosixError" INTERFACE "Os_Console_Common" "Os_Console_Posix")
register_fprime_implementation("Os_Console" "Os_Console_PosixError" "${CMAKE_CURRENT_LIST_DIR}/DefaultErrorConsole.cpp")

register_os_implementation("Task" Posix Os_Posix_Shared Fw_Time)
register_os_implementation("Mutex;ConditionVariable" Posix Os_Posix_Shared)
register_os_implementation("RawTime" Posix Os_Posix_Shared)
Expand Down
16 changes: 0 additions & 16 deletions Os/Posix/DefaultErrorConsole.cpp

This file was deleted.

2 changes: 0 additions & 2 deletions Os/Stub/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ register_os_implementation(Memory Test_Stub)
register_os_implementation(Queue Test_Stub)
register_os_implementation(RawTime Test_Stub) # add Fw_Buffer here?

# Use the error console for this
choose_fprime_implementation(Os_Console Os_Console_PosixError)
#### File Stub Testing ####
set(UT_SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/ut/StubFileTests.cpp"
Expand Down
2 changes: 1 addition & 1 deletion cmake/API.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ endfunction()
# Designates that the given implementor is the selected implementor for the needed implementation. Platforms must call
# this function once for each defined IMPLEMENTATION. An executable/deployment/unit-test may call this function to set
# a specific implementor for any needed implementation. FRAMEWORK_DEFAULT may be supplied to indicate a default choice
# set by the framework, which can be overriden by the platform and module selections.
# set by the framework, which can be overridden by the platform and module selections.
#
# **IMPLEMENTATION:** implementation module name that is implemented by IMPLEMENTOR
# **IMPLEMENTOR:** implementor of IMPLEMENTATION
Expand Down

0 comments on commit 7447c5d

Please sign in to comment.