Is there a trick to remove/hide the legacy API notices?

I get A LOT of these messages after updating today:

------------------------------------------------------------------------                                                               
    [-Wdeprecated-declarations]                                                                                                        
   Kaleidoscope.useLoopHook(legacyLoopHook);                                                                                           
                                          ^                                                                                            
In file included from /home/hoschi/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope-Focus/src/Kaleidoscope/Focus.h:21,           
                 from /home/hoschi/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope-Focus/src/Kaleidoscope-Focus.h:21,           
                 from /home/hoschi/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope-Focus/src/Kaleidoscope/Focus.cpp:19:         
/home/hoschi/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope/src/Kaleidoscope.h:184:15: note: declared here                     
   static void useLoopHook(loopHook hook)                                                                                              
               ^~~~~~~~~~~                                                                                                             
/home/hoschi/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope-Focus/src/Kaleidoscope/Focus.cpp:146:42: warning: 'static void kale
idoscope::Kaleidoscope_::useLoopHook(kaleidoscope::Kaleidoscope_::loopHook)' is deprecated:                                            
------------------------------------------------------------------------                                                               
The legacy plugin API based on hook registration is deprecated.                                                                        
                                                                                                                                       
Consider upgrading your plugins, or implementing the new interface                                                                     
described by `kaleidoscope::Plugin`. In particular, instead of using                                                                   
`Kaleidoscope.useLoopHook`, implement `.beforeEachCycle`,                                                                              
`.beforeReportingState()`, or `.afterEachCycle()` instead.                                                                             
                                                                                                                                       
If your plugins are up-to-date, and you are not a developer, it is                                                                     
usually safe to ignore this message. Especally if the full error
points to a line containing `legacyLoopHook` or `legacyEventHandler`.                                                               

Is this something I can influence?

Also I get this warning, is this important?

/usr/share/arduino/hardware/arduino/avr/cores/arduino/WString.cpp: In member function 'void String::remove(unsigned int, unsigned int)':
/usr/share/arduino/hardware/arduino/avr/cores/arduino/WString.cpp:699:9: warning: 'char* strncpy(char*, const char*, size_t)' accessing 0 or more bytes at offsets [0, 32767] and [0, 32767] may overlap up to 65535 bytes at offset [98301, 32767] [-Wrestrict]             
  strncpy(writeTo, buffer + index + count,len - index);

1 Like

If you are building from the commandline, add the following line to a .kaleidoscope-builder.conf file (in the same dir as your Makefile):

LOCAL_CFLAGS="-DKALEIDOSCOPE_ENABLE_V1_PLUGIN_API=0"

If you are using the Arduino IDE, then edit ~/Arduino/hardware/keyboardio/avr/boards.txt, find this line:

model01.build.extra_flags={build.usb_flags} '-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Model01.h"'

and replace it with this:

model01.build.extra_flags={build.usb_flags} '-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Model01.h"' '-DKALEIDOSCOPE_ENABLE_V1_PLUGIN_API=0'
3 Likes

@algernon

LOCAL_CFLAGS=“-DKALEIDOSCOPE_ENABLE_V1_PLUGIN_API=0”

solved the problem of legacy plugin API warnings, thanks. The one in WString.cpp still persists, can you help me with that too?

That’s in Arduino core, and looks not relevant (we don’t use String, I believe). I think it is safe to ignore for now. Unless you do use it in your sketch…

Out of curiosity, what version of Arduino are you using?

Not that I know.

How do I check that?

Start the Arduino IDE, and select Help/About from the menu. That should show the version somewhere (likely near the top).

Arduino IDE says 1.8.5