nopnop2002 / Raspberry-ili9340spi

ILI9340 SPI TFT Library & XPT2046 Touch Screen Library for Raspberry
MIT License
39 stars 16 forks source link

Compile error's with options -Wall -Werror #15

Closed vanvught closed 5 years ago

vanvught commented 6 years ago
src/ili9340.c:659:25: error: & has lower precedence than ==; == will be evaluated first [-Werror,-Wparentheses]
        if (h == (ph-2) & _FONT_UNDER_LINE_)
            ~~~~~~~~~~~~^
src/ili9340.c:659:25: note: place parentheses around the '==' expression to silence this warning
        if (h == (ph-2) & _FONT_UNDER_LINE_)
                        ^
            (          )
src/ili9340.c:659:25: note: place parentheses around the & expression to evaluate it first
        if (h == (ph-2) & _FONT_UNDER_LINE_)
                        ^
                 (                         )
src/ili9340.c:661:25: error: & has lower precedence than ==; == will be evaluated first [-Werror,-Wparentheses]
        if (h == (ph-1) & _FONT_UNDER_LINE_)
            ~~~~~~~~~~~~^
src/ili9340.c:661:25: note: place parentheses around the '==' expression to silence this warning
        if (h == (ph-1) & _FONT_UNDER_LINE_)
                        ^
            (          )
src/ili9340.c:661:25: note: place parentheses around the & expression to evaluate it first
        if (h == (ph-1) & _FONT_UNDER_LINE_)
                        ^
                 (                         )
src/ili9340.c:626:14: error: variable 'yss' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
  } else if (_FONT_DIRECTION_ == 3) {
             ^~~~~~~~~~~~~~~~~~~~~
src/ili9340.c:641:8: note: uninitialized use occurs here
  yy = yss;
       ^~~
src/ili9340.c:626:10: note: remove the 'if' if its condition is always true
  } else if (_FONT_DIRECTION_ == 3) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ili9340.c:593:20: note: initialize the variable 'yss' to silence this warning
  uint16_t xss, yss;
                   ^
                    = 0
src/ili9340.c:626:14: error: variable 'xss' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
  } else if (_FONT_DIRECTION_ == 3) {
             ^~~~~~~~~~~~~~~~~~~~~
src/ili9340.c:642:8: note: uninitialized use occurs here
  xx = xss;
       ^~~
src/ili9340.c:626:10: note: remove the 'if' if its condition is always true
  } else if (_FONT_DIRECTION_ == 3) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ili9340.c:593:15: note: initialize the variable 'xss' to silence this warning
  uint16_t xss, yss;
              ^
               = 0
src/ili9340.c:702:35: error: passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types with different sign [-Werror,-Wpointer-sign]
  spos = String2SJIS(utfs, strlen(utfs), sjis, 64);
                                  ^~~~
/usr/include/string.h:82:28: note: passing argument to parameter '__s' here
size_t   strlen(const char *__s);
                            ^
src/ili9340.c:719:1: error: control may reach end of non-void function [-Werror,-Wreturn-type]
}
^
6 errors generated.
vanvught commented 6 years ago

@nopnop2002 There some remaining errors in:


 src/demo.c:56:14: error: variable 'XMAX' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
  } else if (model == 3) {
             ^~~~~~~~~~
src/demo.c:62:11: note: uninitialized use occurs here
  XMAX2 = XMAX - 1;
          ^~~~
src/demo.c:56:10: note: remove the 'if' if its condition is always true
  } else if (model == 3) {
         ^~~~~~~~~~~~~~~~
src/demo.c:33:11: note: initialize the variable 'XMAX' to silence this warning
  int XMAX,YMAX;
          ^
           = 0
src/demo.c:56:14: error: variable 'YMAX' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
  } else if (model == 3) {
             ^~~~~~~~~~
src/demo.c:63:11: note: uninitialized use occurs here
  YMAX2 = YMAX - 1;
          ^~~~
src/demo.c:56:10: note: remove the 'if' if its condition is always true
  } else if (model == 3) {
         ^~~~~~~~~~~~~~~~
src/demo.c:33:16: note: initialize the variable 'YMAX' to silence this warning
  int XMAX,YMAX;
               ^
                = 0
2 errors generated.
vanvught commented 6 years ago

@nopnop2002 And also some remaining in here:

src/ili9340.c:632:14: error: variable 'yss' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
  } else if (_FONT_DIRECTION_ == 3) {
             ^~~~~~~~~~~~~~~~~~~~~
src/ili9340.c:647:8: note: uninitialized use occurs here
  yy = yss;
       ^~~
src/ili9340.c:632:10: note: remove the 'if' if its condition is always true
  } else if (_FONT_DIRECTION_ == 3) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ili9340.c:599:20: note: initialize the variable 'yss' to silence this warning
  uint16_t xss, yss;
                   ^
                    = 0
src/ili9340.c:632:14: error: variable 'xss' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
  } else if (_FONT_DIRECTION_ == 3) {
             ^~~~~~~~~~~~~~~~~~~~~
src/ili9340.c:648:8: note: uninitialized use occurs here
  xx = xss;
       ^~~
src/ili9340.c:632:10: note: remove the 'if' if its condition is always true
  } else if (_FONT_DIRECTION_ == 3) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ili9340.c:599:15: note: initialize the variable 'xss' to silence this warning
  uint16_t xss, yss;
              ^
               = 0
2 errors generated.