Turning OFF specific compiler warning flags

So Visual Studio was wiped out and I had to re-download, including Visual Micro IDE. Along the way I updated Arduino, so:

Microsoft Visual Studio Community 2019
Version 16.5.1

Arduino IDE for Visual Studio by Visual Micro 19.0

Arduino 1.8.12

When I got everything running again I started seeing compiler warnings I had never seen before regarding the SD library, specifically:

SdFatUtil.h: 61:45: warning: 'prog_char' is deprecated [-Wdeprecated-declarations]

I figure either #1) the library changed, or more likely #2) the compiler flag configuration had changed.

If I assume #1, my question is REALLY? This hasn't already been fixed? I'm using library SD version 1.2.4.

If I assume #2, than embarrassingly, after hours of searching around I was unable to find a way to turn the flag OFF [-Wdeprecated-declarations]. Can some kindly expert point me to the magic incantation? Thanks!

Please post the full and exact warning.

In the 1.2.4 release of the official SD library, there is no mention of prog_char at line 61 of SdFatUtil.h:

Why would you want to turn warnings off ?

Ignore them when they occur by all means, but they are, after all, meant to help you

Well, I don't want to turn ALL warnings off, just the one mentioned. The verbose output from the compiler is prolific, and when there are two dozen repetitions of the same warning in each build regarding something that suddenly appeared after a tools rebuild, which doesn't prevent the build from being downloaded or executed, it actually makes it more difficult to heed the warnings which are important. Best would be to track down why the warning is suddenly occurring and fix the problem, which is what I'm trying to do.

Here is the full warning:

SD.h:21: In file included from
IncludeList.h:13: from
ExecutionModule.cpp:1: from
SdFatUtil.h: 61:45: warning: 'prog_char' is deprecated [-Wdeprecated-declarations]
static NOINLINE void SerialPrint_P(PGM_P str) {
SdFatUtil.h: 72:47: warning: 'prog_char' is deprecated [-Wdeprecated-declarations]
static NOINLINE void SerialPrintln_P(PGM_P str) {
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -Wall -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=108012 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega" -I"c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\x5p2lcxw.i4g\Micro Platforms\default\debuggers\VM_DBG" -I"C:\Users\Brian\Documents\Arduino\libraries\FastLED" -I"C:\Users\Brian\Documents\Arduino\libraries\SparkFun_HTU21D_Breakout_Arduino_Library-master\src" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" -I"C:\Users\Brian\Documents\Arduino\libraries\TimerFive.x" -I"C:\Program Files (x86)\Arduino\libraries\Ethernet\src" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" -I"C:\Users\Brian\Documents\Arduino\libraries\SD\src" -I"C:\Users\Brian\Documents\Arduino\libraries\LiquidCrystal_I2C" -I"C:\Users\Brian\Documents\Arduino\libraries\RTClib" -I"C:\Users\Brian\Documents\Arduino\libraries\Conceptinetics" -I"C:\Users\Brian\Documents\Arduino\libraries\NewPing\src" -DVM_DEBUG_BREAKPAUSE -DVM_DEBUGGER_TYPE=VM_DEBUGGER_TYPE_GENERIC_OBJECT -DVM_DEBUGGER_SOFT_TRANSPORT_WRITER=Serial -DVM_DEBUGGER_SOFT_TRANSPORT=Serial -DVM_DEBUG -DVM_DEBUG_ENABLE=1 -DVM_DEBUGGER_TYPE_GENERIC_OBJECT=21 -DVM_DEBUGGER_TYPE_NO_SERIAL=20 -DVM_DEBUGGER_TYPE_MS430_SERIAL_=19 -DVM_DEBUGGER_TYPE_SERIALUSB=18 -DVM_DEBUGGER_TYPE_USBAPI=17 -DVM_DEBUGGER_TYPE_NET_UDP=16 -DVM_DEBUGGER_TYPE_HARDWARESERIAL3=15 -DVM_DEBUGGER_TYPE_HARDWARESERIAL2=14 -DVM_DEBUGGER_TYPE_HARDWARESERIAL1=13 -DVM_DEBUGGER_TYPE_CDCSerialClass=12 -DVM_DEBUGGER_TYPE_COSA=11 -DVM_DEBUGGER_TYPE_Uart=10 -DVM_DEBUGGER_TYPE_NET_CONSOLE=9 -DVM_DEBUGGER_TYPE_TTYUART=8 -DVM_DEBUGGER_TYPE_USBSERIAL=7 -DVM_DEBUGGER_TYPE_USART=6 -DVM_DEBUGGER_TYPE_UART=5 -DVM_DEBUGGER_TYPE_TEENSY=4 -DVM_DEBUGGER_TYPE_USB=3 -DVM_DEBUGGER_TYPE_FASTSERIAL=2 -DVM_DEBUGGER_TYPE_SOFTWARESERIAL=1 -DVM_DEBUGGER_TYPE_HARDWARESERIAL=0 -I"C:\Users\Brian\Documents\Arduino\libraries\Adafruit_VL53L0X\src" "C:\Users\Brian\AppData\Local\Temp\VMBuilds\DMXController\mega_atmega2560\Debug\FileSystem.cpp" -o "C:\Users\Brian\AppData\Local\Temp\VMBuilds\DMXController\mega_atmega2560\Debug\FileSystem.cpp.o"

The Visual Micro IDE makes it easy to ADD flags to the invocation, but since I can't find this one anywhere to remove it, I can't. Hence my question. Thank you.

I took a look in avr/pgmspace.h and I now see that if the PROG_TYPES_COMPAT macro is defined, then the PGM_P macro is defined as:

#define PGM_P const prog_char *

which will result in that warning.

This does not occur when compiling with the Arduino IDE. Instead it is defined as:

#define PGM_P const char *

So the question is: why is PROG_TYPES_COMPAT defined when you are compiling with Visual Micro?

A trick I use to investigate macros is to add a definition of the macro to what I know is a new value in my sketch:

#define __PROG_TYPES_COMPAT__ foo

Then when you compile you will get a "redefined" warning that tells you where the previous definition is at.

odlumb:
Best would be to track down why the warning is suddenly occurring and fix the problem

I agree!

Precise, clear, to the point. Thank you pert!

Yes indeed, the macro PROG_TYPES_COMPAT has been defined in FastLED.h, another library I'm using in this project. I'm still investigating if/when/why the library changed, because this warning suddenly appeared after a tools rebuild, and now it appears it's the result of a change in the FastLED library, not the tools. Some libraries may have been 'accidentally updated' in the rebuild, I'm continuing to investigate.

FaestLED.h line #20:

#ifndef PROG_TYPES_COMPAT
#define PROG_TYPES_COMPAT
#endif

Anyway, commenting out the #define made the compiler warning disappear, and things are back to normal. Thank you for your expert assistance.

You're welcome.

The Git blame shows that line was added to FastLED.h 6 years ago: