AVR-GCC warning extra tokens at end of #undef in porthardware.h

I use version FreeRTOS-LTS_V10.5.1 and the AVR-GCC version 5.4.0. Here in the file FreeRTOS/FreeRTOS-Kernel/portable/ThirdParty/Partner-Supported-Ports/GCC/AVR_AVRDx/porthardware.h at lines 177-180 the warning is generated. If I delete the parenthesises after the name to undefine there is no warning. So the reason for the warning are these parenthesis. Is there a way to get rid of this warning without changing the source and without disabling all other warnings? In other words, is there an option that the compiler accepts these parenthesises?

Thanks for bringing this to our attention and for posting @perthil! I’m setting up my workspace to duplicate this and to play around with settings. I’ll get back to you when I have more.

I tried to reproduce your warnings as quickly as possible but was not able to. This could be because of a few things…

  1. I could have a different demo setup than you. This would probably be the most obvious problem. I tried to use the demo documented here
  2. I could be on a newer version of AVR-GCC. Atmel studio has been replaced with Microchip Studio. I used this and while I’m not sure there are meaningful differences (both are version 7 and heck - the installer even has Atmel abbreviations) I can’t rule it out.

Regardless - your post made me find out our current AVR demos are broken. I’ll be working on patching them. It appears our repo restructure for 3p ports caused an issue.

As for your issue - I looked at this online page but didn’t find a mentioned compiler option to suppress the extra token warning. However, other compilers like Clang have a -Wno-extra-tokens option. Could you try this when you compile?

Until now I haven’t tested it with a demo, only with my own program.
Maybe that the demo is configured for another timer as FreeRTOS tick timer.
You have to set the RTC as FreeRTOS timer. Have you done this?
If not you can do it by setting configUSE_TIMER_INSTANCE to 5.

Perfect! Setting that macro is exactly what did it. I see the warnings you’re talking about

Looks like the typical ways aren’t available…
I was hoping a flag would work, the -Wextra-tokens\-Wno-extra-tokens options are unsupported.

Pragmas also appear unsupported.

If you’d like to create a PR to fix this considering you found the issue, I’d be happy to review it :slight_smile:

I’m submitting this pull request to fix this for future releases