Browse Source

Fix two compiler warnings. (#259)

* Fix compiler warning [-Wunused-const-variable=]

Compiling a sketches that uses this library can report a warning
about the const variable `font` being defined, but never used.
Work around this by defining a (static inline) function which
references the variable.

* Remove unused variable (compiler warning)
Henry Gabryjelski 6 years ago
parent
commit
6d513193e6
2 changed files with 7 additions and 1 deletions
  1. 0 1
      Adafruit_SPITFT.cpp
  2. 7 0
      glcdfont.c

+ 0 - 1
Adafruit_SPITFT.cpp

@@ -2114,7 +2114,6 @@ void Adafruit_SPITFT::writeCommand16(uint16_t cmd) {
              not supported by the MCU architecture).
 */
 uint16_t Adafruit_SPITFT::read16(void) {
-    uint8_t  b = 0;
     uint16_t w = 0;
     if(connection == TFT_PARALLEL) {
         if(tft8._rd >= 0) {

+ 7 - 0
glcdfont.c

@@ -277,4 +277,11 @@ static const unsigned char font[] PROGMEM = {
 	0x00, 0x3C, 0x3C, 0x3C, 0x3C,
 	0x00, 0x00, 0x00, 0x00, 0x00  // #255 NBSP
 };
+
+// allow clean compilation with [-Wunused-const-variable=] and [-Wall]
+static inline void avoid_unused_const_variable_compiler_warning(void)
+{
+	(void)font;
+}
+
 #endif // FONT5X7_H