ttlappalainen / NMEA2000

NMEA2000 library for Arduino
508 stars 211 forks source link

UpdateHasPendingInformation() gives compile error #410

Open tsgouros opened 2 days ago

tsgouros commented 2 days ago
> NMEA2000 % cmake --build .
> [  5%] Building CXX object src/CMakeFiles/nmea2000.dir/N2kMsg.cpp.o
> [ 10%] Building CXX object src/CMakeFiles/nmea2000.dir/N2kStream.cpp.o
> [ 15%] Building CXX object src/CMakeFiles/nmea2000.dir/N2kMessages.cpp.o
> [ 21%] Building CXX object src/CMakeFiles/nmea2000.dir/N2kTimer.cpp.o
> [ 26%] Building CXX object src/CMakeFiles/nmea2000.dir/Seasmart.cpp.o
> [ 31%] Building CXX object src/CMakeFiles/nmea2000.dir/N2kDeviceList.cpp.o
> In file included from XX/teensy/Teensy_40_NMEA2000_depth_and_temperature/libraries/NMEA2000/src/N2kDeviceList.cpp:26:
> In file included from XX/teensy/Teensy_40_NMEA2000_depth_and_temperature/libraries/NMEA2000/src/N2kDeviceList.h:33:
> XX/teensy/Teensy_40_NMEA2000_depth_and_temperature/libraries/NMEA2000/src/NMEA2000.h:923:31: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
>       HasPendingInformation=  PendingIsoAddressClaim.IsEnabled()
>                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> XX/teensy/Teensy_40_NMEA2000_depth_and_temperature/libraries/NMEA2000/src/NMEA2000.h:923:31: note: cast one or both operands to int to silence this warning
> XX/teensy/Teensy_40_NMEA2000_depth_and_temperature/libraries/NMEA2000/src/NMEA2000.h:923:31: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
>       HasPendingInformation=  PendingIsoAddressClaim.IsEnabled()
>                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> XX/teensy/Teensy_40_NMEA2000_depth_and_temperature/libraries/NMEA2000/src/NMEA2000.h:923:31: note: cast one or both operands to int to silence this warning
> XX/teensy/Teensy_40_NMEA2000_depth_and_temperature/libraries/NMEA2000/src/NMEA2000.h:923:31: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
>       HasPendingInformation=  PendingIsoAddressClaim.IsEnabled()
>                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> XX/teensy/Teensy_40_NMEA2000_depth_and_temperature/libraries/NMEA2000/src/NMEA2000.h:923:31: note: cast one or both operands to int to silence this warning
> 3 errors generated.
> make[2]: *** [src/CMakeFiles/nmea2000.dir/N2kDeviceList.cpp.o] Error 1
> make[1]: *** [src/CMakeFiles/nmea2000.dir/all] Error 2
> make: *** [all] Error 2
> 

I changed UpdateHasPendingInformation() to look like this:

    void UpdateHasPendingInformation() {
      HasPendingInformation=  PendingIsoAddressClaim.IsEnabled()
                            || PendingProductInformation.IsEnabled()
                            || PendingConfigurationInformation.IsEnabled()
                            #if !defined(N2K_NO_ISO_MULTI_PACKET_SUPPORT)
                            || NextDTSendTime.IsEnabled()
                            #endif
                            ;
    }
  };

That seems to have silenced the error. This is on a Mac, Ventura 13.6.4