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

Compiler warnings #91

Closed
csatt opened this issue Nov 30, 2019 · 0 comments
Closed

Compiler warnings #91

csatt opened this issue Nov 30, 2019 · 0 comments
Assignees
Labels

Comments

@csatt
Copy link
Owner

csatt commented Nov 30, 2019

This probably should be classified as "cosmetic" instead of "bug", but one user has reported that his compile fails with 1.3.8 and 1.3.10 and succeeds with the fixes for this issue. The reason for that is not yet understood and no one else has reported such an issue. Most changes are to code that has existed since the original version of the sketch, and the others are in code added in version 1.3.2+ on 28-Jun, 2018, so this is not a recent breakage.

When the "Compiler warnings" option in the Arduino IDE Preferences is set to "All", several warnings are generated. These should be corrected:

/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino:215:23: warning: left shift count >= width of type [-Wshift-count-overflow]
#define MAX_ULONG (1<<32)-1 // Max unsigned long integer
^
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino:268:67: note: in definition of macro '_impl_CASSERT_LINE'
typedef char impl_PASTE(assertion_failed_on_line,line)[2*!!(predicate)-1];
^~~~~~~~~
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino:272:1: note: in expansion of macro 'COMPILER_ASSERT'
COMPILER_ASSERT(MAX_IV_MEAS <= (unsigned long) MAX_ULONG);
^~~~~~~~~~~~~~~
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino:272:48: note: in expansion of macro 'MAX_ULONG'
COMPILER_ASSERT(MAX_IV_MEAS <= (unsigned long) MAX_ULONG);
^~~~~~~~~
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino: In function 'void loop()':
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino:475:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
(index < sizeof(adc_ch0_vals)) && !count_updated;
~~~~~~^~~~~~~~~
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino:500:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
(index < sizeof(adc_ch0_vals)) && !voc_adc_found;
~~~~~~^~~~~~~~~
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino: In function 'void dump_eeprom()':
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino:1165:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
eeprom_addr < ((eeprom_valid_count + 2) * sizeof(float));
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino: In function 'process_config_msg':
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino:1094:26: warning: 'config_val2' may be used uninitialized in this function [-Wmaybe-uninitialized]
eeprom_value = atof(config_val2);
^
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino:1001:9: note: 'config_val2' was declared here
char *config_val2;
^
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino:1122:40: warning: 'config_val' may be used uninitialized in this function [-Wmaybe-uninitialized]
set_second_relay_state((bool)atoi(config_val));
^
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino:1000:9: note: 'config_val' was declared here
char *config_val;
^
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino:1030:15: warning: 'config_type' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (strcmp_P(config_type, clk_div_str) == 0) {
^
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino:999:9: note: 'config_type' was declared here
char *config_type;
^
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino: In function 'loop':
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino:1391:18: warning: 'round_up_mask' may be used uninitialized in this function [-Wmaybe-uninitialized]
sm_scale = (sm & round_up_mask) ? (sm >> shift_amt) + 1 : (sm >> shift_amt);
^
/Users/csatt/Documents/Arduino/IV_Swinger2/IV_Swinger2.ino:1367:15: note: 'round_up_mask' was declared here
int lg, sm, round_up_mask;
^

@csatt csatt added the bug label Nov 30, 2019
@csatt csatt self-assigned this Nov 30, 2019
csatt added a commit that referenced this issue Nov 30, 2019
Fixed the several compiler warnings that were generated when the IDE Preferences are set to "All". See Issue #91 for the list of warnings.

The version number is bumped to 1.3.11
@csatt csatt closed this as completed Nov 30, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant