2019-05-09 07:38 AM
I had to create some register variables and inline assembler to enforce use of the M7's SMLAL instruction and now keep getting the warning several times per compile :
warning: optimization may eliminate reads and/or writes to register variables [-Wvolatile-register-var]
Is it possible to mute just this particular warning ? I went to the Files->Properties->Warnings page and there are various tickboxes but I can't see a way to mute a particular warning.
Solved! Go to Solution.
2019-05-09 07:48 AM
Is there a place in the Settings to add a custom compiler option? Just adding "-Wno-volatile-register-var" there should do the work.
Or, you could temporarily disable the warning only for those lines you want:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wvolatile-register-var"
/* code generating the warning */
#pragma GCC diagnostic pop
2019-05-09 07:48 AM
Is there a place in the Settings to add a custom compiler option? Just adding "-Wno-volatile-register-var" there should do the work.
Or, you could temporarily disable the warning only for those lines you want:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wvolatile-register-var"
/* code generating the warning */
#pragma GCC diagnostic pop
2019-05-09 07:56 AM
It seems to just be tickboxes. The only field that looks where it looks like it should go is in the Settings->GCC Compiler->Tool Settings but this field is greyed out and so not editable, presumably to stop people making silly mistakes.
2019-05-09 11:46 AM
Thanks - I hadn't thought of using a pragma. I can see the real warnings now.