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

Fix PlatformIO Compiler Warnings #4

Merged
merged 1 commit into from
Jul 12, 2022

Conversation

crabel99
Copy link
Contributor

When the library is used in Platform IO there are two compiler warnings that are generated.

In file included from .pio/libdeps/sparkfun_samd21_dev_usb/SparkFun MCP9600 Thermocouple Library/src/SparkFun_MCP9600.h:25:0,
                 from .pio/libdeps/sparkfun_samd21_dev_usb/SparkFun MCP9600 Thermocouple Library/src/SparkFun_MCP9600.cpp:21:
/Users/username/.platformio/packages/framework-arduino-samd-sparkfun/cores/arduino/Arduino.h: In member function 'Thermocouple_Resolution MCP9600::getThermocoupleResolution()':
/Users/username/.platformio/packages/framework-arduino-samd-sparkfun/cores/arduino/Arduino.h:116:37: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
                                     ^~
.pio/libdeps/sparkfun_samd21_dev_usb/SparkFun MCP9600 Thermocouple Library/src/SparkFun_MCP9600.cpp:193:11: note: 'res' was declared here
   uint8_t res;                                        //define new thermocoupleResolution enum to return
           ^~~
In file included from .pio/libdeps/sparkfun_samd21_dev_usb/SparkFun MCP9600 Thermocouple Library/src/SparkFun_MCP9600.h:25:0,
                 from .pio/libdeps/sparkfun_samd21_dev_usb/SparkFun MCP9600 Thermocouple Library/src/SparkFun_MCP9600.cpp:21:
/Users/username/.platformio/packages/framework-arduino-samd-sparkfun/cores/arduino/Arduino.h: In member function 'Burst_Sample MCP9600::getBurstSamples()':
/Users/username/.platformio/packages/framework-arduino-samd-sparkfun/cores/arduino/Arduino.h:116:37: warning: 'samples' may be used uninitialized in this function [-Wmaybe-uninitialized]
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
                                     ^~
.pio/libdeps/sparkfun_samd21_dev_usb/SparkFun MCP9600 Thermocouple Library/src/SparkFun_MCP9600.cpp:273:11: note: 'samples' was declared here
   uint8_t samples;
           ^~~~~~~

This PR simply initializes the values with the null value and removes the compiler warnings.

@PaulZC
Copy link
Contributor

PaulZC commented Jul 12, 2022

Hi @crabel99 ,

Thank you for the contribution - and apologies for the very slow reply!

Merging...

Very best wishes,
Paul

@PaulZC PaulZC merged commit c413bb3 into sparkfun:master Jul 12, 2022
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