Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NUM_PORTS -> FwIndexType #3239

Merged
merged 1 commit into from
Feb 14, 2025
Merged

Conversation

LeStarch
Copy link
Collaborator

Related Issue(s)
Has Unit Tests (y/n)
Documentation Included (y/n)

Change Description

This is an automated change to convert usages of NUM_PORTS and PORT_COUNT use FwIndexType.

There are 2 manual fixes:

  1. Input port m_portNum -> FwIndexType
  2. Added static assert to ensure constant addition remains in-bounds for FwIndexType

@LeStarch LeStarch requested a review from thomas-bc February 14, 2025 22:36
@@ -24,7 +24,7 @@
void init() override;

PassiveComponentBase* m_comp; // !< pointer to containing component
NATIVE_INT_TYPE m_portNum; // !< port number in containing object
FwIndexType m_portNum; // !< port number in containing object

Check notice

Code scanning / CodeQL

Use of basic integral type Note

m_portNum uses the basic integral type int rather than a typedef with size and signedness.
@@ -30,7 +30,7 @@

class ActiveRateGroup : public ActiveRateGroupComponentBase {
public:
static constexpr NATIVE_INT_TYPE CONNECTION_COUNT_MAX = NUM_RATEGROUPMEMBEROUT_OUTPUT_PORTS;
static constexpr FwIndexType CONNECTION_COUNT_MAX = NUM_RATEGROUPMEMBEROUT_OUTPUT_PORTS;

Check notice

Code scanning / CodeQL

Use of basic integral type Note

CONNECTION_COUNT_MAX uses the basic integral type int rather than a typedef with size and signedness.
@@ -28,7 +28,7 @@
m_allocator(nullptr),
m_allocation(nullptr) {
// Initialize throttles to "off"
for (NATIVE_UINT_TYPE i = 0; i < TOTAL_PORT_COUNT; i++) {
for (FwIndexType i = 0; i < TOTAL_PORT_COUNT; i++) {

Check notice

Code scanning / CodeQL

Use of basic integral type Note

i uses the basic integral type int rather than a typedef with size and signedness.
@@ -131,7 +131,7 @@
}

void ComQueue::buffQueueIn_handler(const FwIndexType portNum, Fw::Buffer& fwBuffer) {
const NATIVE_INT_TYPE queueNum = portNum + COM_PORT_COUNT;
const FwIndexType queueNum = portNum + COM_PORT_COUNT;

Check notice

Code scanning / CodeQL

Use of basic integral type Note

queueNum uses the basic integral type int rather than a typedef with size and signedness.
@@ -206,7 +206,7 @@
NATIVE_INT_TYPE HealthImpl::findEntry(const Fw::CmdStringArg& entry) {

// walk through entries
for (NATIVE_UINT_TYPE tableEntry = 0; tableEntry < NUM_PINGSEND_OUTPUT_PORTS; tableEntry++) {
for (FwIndexType tableEntry = 0; tableEntry < NUM_PINGSEND_OUTPUT_PORTS; tableEntry++) {

Check notice

Code scanning / CodeQL

Use of basic integral type Note

tableEntry uses the basic integral type int rather than a typedef with size and signedness.
@@ -34,7 +34,7 @@

public:
//! Size of the divider table, provided as a constants to users passing the table in
static const NATIVE_UINT_TYPE DIVIDER_SIZE = NUM_CYCLEOUT_OUTPUT_PORTS;
static const FwIndexType DIVIDER_SIZE = NUM_CYCLEOUT_OUTPUT_PORTS;

Check notice

Code scanning / CodeQL

Use of basic integral type Note

DIVIDER_SIZE uses the basic integral type int rather than a typedef with size and signedness.
@@ -131,7 +131,7 @@
}

void ComQueue::buffQueueIn_handler(const FwIndexType portNum, Fw::Buffer& fwBuffer) {
const NATIVE_INT_TYPE queueNum = portNum + COM_PORT_COUNT;
const FwIndexType queueNum = portNum + COM_PORT_COUNT;

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter portNum has not been checked.
@LeStarch LeStarch merged commit 34a4e2c into nasa:devel Feb 14, 2025
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants