REVrobotics / CANBridge

Generic CAN Bridge emulating FRC netcomm CAN driver for connecting a PC to the CAN Bus with WPILib 2020+ and SPARK MAX (FW 1.5.0 or higher) or other drivers, currently only supported in Windows.
Other
11 stars 5 forks source link

Default warnings-as-errors behavior breaks build on non-Windows platforms #28

Open qwertychouskie opened 5 months ago

qwertychouskie commented 5 months ago

The warnings that become errors:

> Task :compileCANBridgeOsxuniversalReleaseSharedLibraryCANBridgeCpp
In file included from /Users/[user]/unofficial-rev-port/CANBridge/src/main/native/cpp/Drivers/Serial/SerialDriver.cpp:32:
In file included from /Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/SerialPort/SerialDevice.h:34:
In file included from /Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/SerialPort/SerialDeviceThread.h:48:
/Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/DriverDeviceThread.h:65:9: error: field 'm_threadIntervalMs' will be initialized after field 'm_counter' [-Werror,-Wreorder-ctor]
        m_threadIntervalMs(threadIntervalMs),
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        m_counter(counter)
/Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/DriverDeviceThread.h:80:46: error: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'int' [-Werror,-Wsign-compare]
            if (element.m_msg.GetMessageId() == targetId) {
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~
/Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/DriverDeviceThread.h:88:174: error: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'const int' [-Werror,-Wsign-compare]
        m_sendQueue.erase(std::remove_if(m_sendQueue.begin(), m_sendQueue.end(), [targetId](detail::CANThreadSendQueueElement element) { return element.m_msg.GetMessageId() == targetId; }), m_sendQueue.end());
                                                                                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~
/Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/DriverDeviceThread.h:154:51: error: parameter 'details' set but not used [-Werror,-Wunused-but-set-parameter]
    void GetCANStatus(rev::usb::CANStatusDetails* details) {
                                                  ^
In file included from /Users/[user]/unofficial-rev-port/CANBridge/src/main/native/cpp/Drivers/Serial/SerialDriver.cpp:32:
In file included from /Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/SerialPort/SerialDevice.h:34:
/Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/SerialPort/SerialDeviceThread.h:117:10: error: 'ReadMessages' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
    void ReadMessages(bool &reading)  {
         ^
/Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/DriverDeviceThread.h:199:18: note: overridden virtual function is here
    virtual void ReadMessages(bool &reading) = 0;
                 ^
In file included from /Users/[user]/unofficial-rev-port/CANBridge/src/main/native/cpp/Drivers/Serial/SerialDriver.cpp:32:
In file included from /Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/SerialPort/SerialDevice.h:34:
/Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/SerialPort/SerialDeviceThread.h:184:10: error: 'WriteMessages' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
    bool WriteMessages(detail::CANThreadSendQueueElement el, std::chrono::steady_clock::time_point now) {
         ^
/Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/DriverDeviceThread.h:200:18: note: overridden virtual function is here
    virtual bool WriteMessages(detail::CANThreadSendQueueElement element, std::chrono::steady_clock::time_point now) = 0;
                 ^
6 errors generated.

In file included from /Users/[user]/unofficial-rev-port/CANBridge/src/main/native/cpp/Drivers/Serial/SerialDevice.cpp:30:
In file included from /Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/SerialPort/SerialDevice.h:34:
In file included from /Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/SerialPort/SerialDeviceThread.h:48:
/Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/DriverDeviceThread.h:65:9: error: field 'm_threadIntervalMs' will be initialized after field 'm_counter' [-Werror,-Wreorder-ctor]
        m_threadIntervalMs(threadIntervalMs),
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        m_counter(counter)
/Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/DriverDeviceThread.h:80:46: error: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'int' [-Werror,-Wsign-compare]
            if (element.m_msg.GetMessageId() == targetId) {
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~
/Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/DriverDeviceThread.h:88:174: error: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'const int' [-Werror,-Wsign-compare]
        m_sendQueue.erase(std::remove_if(m_sendQueue.begin(), m_sendQueue.end(), [targetId](detail::CANThreadSendQueueElement element) { return element.m_msg.GetMessageId() == targetId; }), m_sendQueue.end());
                                                                                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~
/Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/DriverDeviceThread.h:154:51: error: parameter 'details' set but not used [-Werror,-Wunused-but-set-parameter]
    void GetCANStatus(rev::usb::CANStatusDetails* details) {
                                                  ^
In file included from /Users/[user]/unofficial-rev-port/CANBridge/src/main/native/cpp/Drivers/Serial/SerialDevice.cpp:30:
In file included from /Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/SerialPort/SerialDevice.h:34:
/Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/SerialPort/SerialDeviceThread.h:117:10: error: 'ReadMessages' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
    void ReadMessages(bool &reading)  {
         ^
/Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/DriverDeviceThread.h:199:18: note: overridden virtual function is here
    virtual void ReadMessages(bool &reading) = 0;
                 ^
In file included from /Users/[user]/unofficial-rev-port/CANBridge/src/main/native/cpp/Drivers/Serial/SerialDevice.cpp:30:
In file included from /Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/SerialPort/SerialDevice.h:34:
/Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/SerialPort/SerialDeviceThread.h:184:10: error: 'WriteMessages' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
    bool WriteMessages(detail::CANThreadSendQueueElement el, std::chrono::steady_clock::time_point now) {
         ^
/Users/[user]/unofficial-rev-port/CANBridge/src/main/native/include/rev/Drivers/DriverDeviceThread.h:200:18: note: overridden virtual function is here
    virtual bool WriteMessages(detail::CANThreadSendQueueElement element, std::chrono::steady_clock::time_point now) = 0;
                 ^
6 errors generated.
garrettsummerfi3ld commented 4 months ago

Should be resolved in #29

qwertychouskie commented 4 months ago

Should be resolved in #29

In #29, the warnings-as-errors is just disabled as far as I remember, really we should actually fix the errors.