What is the best practice in Fortran to suppress warning messages like:
remark #7712: This variable has not been used.
for just one particular variable (imagine function in API that we do not want to break)?
Note: I do not want to suppress all warnings for a file
Note2: Something similar for gcc: __attribute__((__unused__))
or other common C practice with MACRO
Note3: I am particularly interested in ifort, but multi-compiler would be better.
Since you're using Intel Fortran (I can tell from the particular message), you have a couple of options. One is to add a dummy reference, for example:
if (.false.) unused=1
Another is to disable just unused variable warnings:
/warn:all,nounused
or for Linux:
-warn all,nounused
Microsoft Fortran had an interesting library function UNUSEDQQ
for this purpose - you added a call to UNUSEDQQ
passing the variable, and this disabled the check. Intel Fortran doesn't support that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With