aws-samples / arduino-aws-greengrass-iot

This library uses AWS C-SDK to implement an Arduino class AWSGreenGrassIoT to make it easy to securely connect sensors/actuator to AWS IoT core, directly or by mean of an AWS greengrass device (i.e. Raspberry PI) using X509 certificates.
Apache License 2.0
44 stars 13 forks source link

Failed to compile with cc1plus compiler #14

Open bluestar714 opened 2 years ago

bluestar714 commented 2 years ago

Issue #, if available:

I faced the following error and failed to compile.

~/arduino-aws-greengrass-iot/src/AWSGreenGrassIoT.cpp: In member function 'int AWSGreenGrassIoT::_connect(char*, char*)':
~/arduino-aws-greengrass-iot/src/AWSGreenGrassIoT.cpp:144:66: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]
     if (connectParams.clientIDLen = (uint16_t) strlen(_thingName))
                                                                  ^
cc1plus: some warnings being treated as errors
exit status 1
Error compiling for board ESP32 Dev Module.

Normally, this message looks fine to ignore because it is a warning. However, I changed the single equal operator to a double equal operator because it fails to compile. It's a very small change...So I created a PR without creating an issue....

Description of changes: The following changes have been made. I just added more equals. I know that some compilers will ignore this warning and compile successfully, but the single equal operator seems to be written in a C-like way. I think C++ if statements usually use a double equal operator. uble equal operator.

AWSGreenGrassIoT.cpp:144

    if (connectParams.clientIDLen == (uint16_t) strlen(_thingName))

Regards,