folg / stm32flash

Automatically exported from code.google.com/p/stm32flash
0 stars 0 forks source link

Fix incorrect enum comparisons #66

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Building on OS X 10.9.5 results in compiler warnings, presumably that occur 
with clang but not with gcc:

cc -Wall -g   -c -o stm32.o stm32.c
stm32.c:607:12: warning: comparison of constant 31 with expression of type 
'stm32_err_t' is always false
      [-Wtautological-constant-out-of-range-compare]
        if (s_err == STM32_NACK) {
            ~~~~~ ^  ~~~~~~~~~~
stm32.c:634:12: warning: comparison of constant 31 with expression of type 
'stm32_err_t' is always false
      [-Wtautological-constant-out-of-range-compare]
        if (s_err == STM32_NACK) {
            ~~~~~ ^  ~~~~~~~~~~
stm32.c:661:12: warning: comparison of constant 31 with expression of type 
'stm32_err_t' is always false
      [-Wtautological-constant-out-of-range-compare]
        if (s_err == STM32_NACK) {
            ~~~~~ ^  ~~~~~~~~~~
stm32.c:688:12: warning: comparison of constant 31 with expression of type 
'stm32_err_t' is always false
      [-Wtautological-constant-out-of-range-compare]
        if (s_err == STM32_NACK) {
            ~~~~~ ^  ~~~~~~~~~~
4 warnings generated.

These warnings appear to be real issues - they're cases where the return value 
of stm32_get_ack_timeout() is compared to STM32_NACK, but 
stm32_get_ack_timeout() only returns STM32_ERR_NACK.

Original issue reported on code.google.com by seth.laf...@gmail.com on 3 Jan 2015 at 4:57

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the patch. Can I add you with your e-mail address to the commit as 
author?

Original comment by lists.to...@gmail.com on 24 Feb 2015 at 8:42

GoogleCodeExporter commented 9 years ago
Issue 67 has been merged into this issue.

Original comment by lists.to...@gmail.com on 24 Feb 2015 at 8:43

GoogleCodeExporter commented 9 years ago
Issue 71 has been merged into this issue.

Original comment by lists.to...@gmail.com on 24 Feb 2015 at 8:51