Skip to content

Commit

Permalink
Fix pedantic warnings (#2441)
Browse files Browse the repository at this point in the history
* Fix macro pedantic warning

* Fixed pedantic warnings
  • Loading branch information
JohanBertrand authored Jan 5, 2024
1 parent 1caf1e4 commit 7d13cbd
Show file tree
Hide file tree
Showing 28 changed files with 51 additions and 52 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ add_compile_options(
-Wall
-Wextra
-Werror
# -pedantic
$<$<COMPILE_LANGUAGE:CXX>:-Wold-style-cast>
-Wno-unused-parameter
)
Expand Down
2 changes: 1 addition & 1 deletion Drv/Ip/SocketReadTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ void SocketReadTask::readTask(void* pointer) {
(status == SOCK_SUCCESS || status == SOCK_INTERRUPTED_TRY_AGAIN || self->m_reconnect));
self->getSocketHandler().shutdown(); // Shutdown the port entirely
}
}; // namespace Drv
} // namespace Drv
2 changes: 1 addition & 1 deletion Drv/Ip/SocketReadTask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,5 +173,5 @@ class SocketReadTask {
bool m_stop; //!< Stops the task when set to true

};
};
}
#endif // DRV_SOCKETREADTASK_HPP
4 changes: 2 additions & 2 deletions Drv/LinuxGpioDriver/LinuxGpioDriverComponentImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#include <fcntl.h>
#include <poll.h>

//#define DEBUG_PRINT(x,...) printf(x,##__VA_ARGS__); fflush(stdout)
#define DEBUG_PRINT(x,...)
//#define DEBUG_PRINT(...) printf(##__VA_ARGS__); fflush(stdout)
#define DEBUG_PRINT(...)

namespace Drv {

Expand Down
36 changes: 17 additions & 19 deletions Drv/LinuxI2cDriver/LinuxI2cDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,25 +174,23 @@ namespace Drv {
Fw::Logger::logMsg("I2c addr: 0x%02X\n",addr);
#endif

struct i2c_msg rdwr_msgs[2] = {
{ // Start address
.addr = static_cast<U16>(addr),
.flags = 0, // write
.len = static_cast<U16>(writeBuffer.getSize()),
.buf = writeBuffer.getData()
},
{ // Read buffer
.addr = static_cast<U16>(addr),
.flags = I2C_M_RD, // read
.len = static_cast<U16>(readBuffer.getSize()),
.buf = readBuffer.getData()
}
};

struct i2c_rdwr_ioctl_data rdwr_data = {
.msgs = rdwr_msgs,
.nmsgs = 2
};
struct i2c_msg rdwr_msgs[2];

// Start address
rdwr_msgs[0].addr = static_cast<U16>(addr);
rdwr_msgs[0].flags = 0; // write
rdwr_msgs[0].len = static_cast<U16>(writeBuffer.getSize());
rdwr_msgs[0].buf = writeBuffer.getData();

// Read buffer
rdwr_msgs[1].addr = static_cast<U16>(addr);
rdwr_msgs[1].flags = I2C_M_RD; // read
rdwr_msgs[1].len = static_cast<U16>(readBuffer.getSize());
rdwr_msgs[1].buf = readBuffer.getData();

struct i2c_rdwr_ioctl_data rdwr_data;
rdwr_data.msgs = rdwr_msgs;
rdwr_data.nmsgs = 2;

//Use ioctl to perform the combined write/read transaction
NATIVE_INT_TYPE stat = ioctl(this->m_fd, I2C_RDWR, &rdwr_data);
Expand Down
4 changes: 2 additions & 2 deletions Drv/LinuxSpiDriver/LinuxSpiDriverComponentImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#include <linux/spi/spidev.h>
#include <cerrno>

//#define DEBUG_PRINT(x,...) printf(x,##__VA_ARGS__); fflush(stdout)
#define DEBUG_PRINT(x,...)
//#define DEBUG_PRINT(...) printf(##__VA_ARGS__); fflush(stdout)
#define DEBUG_PRINT(...)

namespace Drv {

Expand Down
4 changes: 2 additions & 2 deletions Drv/LinuxUartDriver/LinuxUartDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

//#include <cstdlib>
//#include <cstdio>
//#define DEBUG_PRINT(x,...) printf(x,##__VA_ARGS__); fflush(stdout)
#define DEBUG_PRINT(x, ...)
//#define DEBUG_PRINT(...) printf(##__VA_ARGS__); fflush(stdout)
#define DEBUG_PRINT(...)

namespace Drv {

Expand Down
4 changes: 2 additions & 2 deletions Fw/Comp/ActiveComponentBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <Os/TaskString.hpp>
#include <cstdio>

//#define DEBUG_PRINT(x,...) printf(x,##__VA_ARGS__); fflush(stdout)
#define DEBUG_PRINT(x,...)
//#define DEBUG_PRINT(...) printf(##__VA_ARGS__); fflush(stdout)
#define DEBUG_PRINT(...)

namespace Fw {

Expand Down
3 changes: 1 addition & 2 deletions Fw/Logger/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ namespace Fw {
Logger::~Logger() {
}

};
//End namespace Fw
} //End namespace Fw
2 changes: 1 addition & 1 deletion Fw/Types/BasicTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// Use C linkage for the basic items
extern "C" {
#include "BasicTypes.h"
};
}

#ifndef FW_BASIC_TYPES_HPP
#define FW_BASIC_TYPES_HPP
Expand Down
4 changes: 2 additions & 2 deletions Os/Linux/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ extern "C" {
#include <cstring>
#include <cstdio>

//#define DEBUG_PRINT(x,...) printf(x,##__VA_ARGS__); fflush(stdout)
#define DEBUG_PRINT(x,...)
//#define DEBUG_PRINT(...) printf(##__VA_ARGS__); fflush(stdout)
#define DEBUG_PRINT(...)

namespace Os {

Expand Down
2 changes: 1 addition & 1 deletion Os/Linux/SystemResources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace Os {

SystemResources::SystemResourcesStatus parseCpuData(char proc_stat_line[LINE_SIZE],
U32 cpu_data[4]) {
if (sscanf(proc_stat_line, "%*s %d %d %d %d", &cpu_data[0], &cpu_data[1], &cpu_data[2], &cpu_data[3]) !=
if (sscanf(proc_stat_line, "%*s %u %u %u %u", &cpu_data[0], &cpu_data[1], &cpu_data[2], &cpu_data[3]) !=
4) {
return SystemResources::SYSTEM_RESOURCES_ERROR;
}
Expand Down
2 changes: 1 addition & 1 deletion Os/ValidatedFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ namespace Os {
Utils::HashBuffer hashBuffer;
};

};
}

#endif
1 change: 1 addition & 0 deletions Ref/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ register_fprime_deployment()
target_compile_options("${PROJECT_NAME}" PUBLIC -Wall)
target_compile_options("${PROJECT_NAME}" PUBLIC -Wextra)
target_compile_options("${PROJECT_NAME}" PUBLIC -Werror)
target_compile_options("${PROJECT_NAME}" PUBLIC -pedantic)
#target_compile_options("${PROJECT_NAME}" PUBLIC -Wshadow)
target_compile_options("${PROJECT_NAME}" PUBLIC -Wconversion)
target_compile_options("${PROJECT_NAME}" PUBLIC -Wsign-conversion)
Expand Down
2 changes: 1 addition & 1 deletion Svc/BufferLogger/BufferLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ namespace Svc {
}
}

};
}
2 changes: 1 addition & 1 deletion Svc/CmdSequencer/Sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Svc {
m_allocatorId(0)
{

};
}

CmdSequencerComponentImpl::Sequence ::
~Sequence()
Expand Down
2 changes: 1 addition & 1 deletion Svc/ComLogger/ComLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,4 @@ namespace Svc {
this->log_WARNING_LO_FileValidationError(logStringArg1, logStringArg2, validateStatus);
}
}
};
}
2 changes: 1 addition & 1 deletion Svc/ComLogger/ComLogger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,6 @@ namespace Svc {
void writeHashFile(
);
};
};
}

#endif
2 changes: 1 addition & 1 deletion Svc/ComSplitter/ComSplitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ namespace Svc {
}
}

};
}
2 changes: 1 addition & 1 deletion Svc/ComSplitter/ComSplitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ namespace Svc {

};

};
}

#endif
2 changes: 1 addition & 1 deletion Svc/FramingProtocol/DeframingProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ void DeframingProtocol::setup(DeframingProtocolInterface& interface) {
FW_ASSERT(m_interface == nullptr);
m_interface = &interface;
}
};
}
2 changes: 1 addition & 1 deletion Svc/FramingProtocol/DeframingProtocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ class DeframingProtocol {
PROTECTED:
DeframingProtocolInterface* m_interface;
};
};
}
#endif // SVC_DEFRAMING_PROTOCOL_HPP
2 changes: 1 addition & 1 deletion Svc/FramingProtocol/FprimeProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ DeframingProtocol::DeframingStatus FprimeDeframing::deframe(Types::CircularBuffe
m_interface->route(buffer);
return DeframingProtocol::DEFRAMING_STATUS_SUCCESS;
}
};
}
2 changes: 1 addition & 1 deletion Svc/FramingProtocol/FramingProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ void FramingProtocol::setup(FramingProtocolInterface& interface) {
FW_ASSERT(m_interface == nullptr);
m_interface = &interface;
}
};
}
4 changes: 2 additions & 2 deletions Svc/UdpReceiver/UdpReceiverComponentImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include <arpa/inet.h>
#include <Os/TaskString.hpp>

//#define DEBUG_PRINT(x,...) printf(x,##__VA_ARGS__)
#define DEBUG_PRINT(x,...)
//#define DEBUG_PRINT(...) printf(##__VA_ARGS__)
#define DEBUG_PRINT(...)

namespace Svc {

Expand Down
4 changes: 2 additions & 2 deletions Svc/UdpSender/UdpSenderComponentImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#include <cstdlib>
#include <unistd.h>

//#define DEBUG_PRINT(x,...) printf(x,##__VA_ARGS__)
#define DEBUG_PRINT(x,...)
//#define DEBUG_PRINT(...) printf(##__VA_ARGS__)
#define DEBUG_PRINT(...)

namespace Svc {

Expand Down
2 changes: 1 addition & 1 deletion Utils/Types/Queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ NATIVE_UINT_TYPE Queue::getQueueSize() const {
}


}; // namespace Types
} // namespace Types
2 changes: 1 addition & 1 deletion config/FpConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
#include <Fw/Types/BasicTypes.hpp>
extern "C" {
#include <FpConfig.h>
};
}

0 comments on commit 7d13cbd

Please sign in to comment.