earlephilhower / arduino-pico

Raspberry Pi Pico Arduino core, for all RP2040 boards
GNU Lesser General Public License v2.1
1.88k stars 394 forks source link

Warning : "MEM_STATS" / "MEMP_STATS" redefined when not using NDEBUG #2211

Closed maxint-rd closed 1 month ago

maxint-rd commented 1 month ago

First of all a big Thank You for making and maintaining this Arduino core for the RP2040. It helped me a lot in my projects for the rPi PICO.

With the goal to test debugging of the PICO I just installed the latest core release v3.9.2 in Arduino IDE v2.3.2 on my Windows 11 PC. Upon compiling my test project I saw a few warnings coming by regarding redefinition of MEM_STATS and MEMP_STATS in lwipopts.h:

C:\Users\Myusername\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.2/tools/libpico/lwipopts.h:79: warning: "MEMP_STATS" redefined
   79 | #define MEMP_STATS                  1
      | 
C:\Users\Myusername\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.2/tools/libpico/lwipopts.h:47: note: this is the location of the previous definition
   47 | #define MEMP_STATS                  0
      | 
C:\Users\Myusername\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.2/tools/libpico/lwipopts.h:80: warning: "MEM_STATS" redefined
   80 | #define MEM_STATS                   1
      | 
C:\Users\Myusername\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.2/tools/libpico/lwipopts.h:45: note: this is the location of the previous definition
   45 | #define MEM_STATS                   0

Upon closer inspection of this file I noticed that the redefinition is depending on the definition of NDEBUG:

#ifndef NDEBUG
#define LWIP_DEBUG                  1
#define LWIP_STATS                  1
#define LWIP_STATS_DISPLAY          1
#define MEMP_STATS                  1
#define MEM_STATS                   1
#endif

I assume that this is remeniscent of some development session where these defines were set for debugging. I also noticed that in the earlier version I have installed on another PC (release 3,8.1), these values were not redefined. Of course this isn't a major issue, but you may want to fix this, hence this notification. Cheers!