6

i use ifort and gfortran to compile my Fortran program.

However i also use a coworkers source and he has got a lot of unused variables. How can i suppress these for the compile, seeing as they are not really an error?

However i dont want to disable -pedantic and -stan in the compiler options and thus want all the other warnings.

cheers and thanks for the help

tarrasch
  • 2,630
  • 8
  • 37
  • 61

2 Answers2

9

With ifort try -warn [no]unused.

And, while I'm here, I suggest you remove unused variables. The compiler may not regard them as an error, but disciplined software engineering regards all dead and unused code as erroneous; it imposes a maintenance burden.

High Performance Mark
  • 77,191
  • 7
  • 105
  • 161
5

Yes, as High Performance Mark pointed out, the best way to get rid of those warnings is to tell your coworker to fix his code.

As for easy solutions, with gfortran, have a look at the -Wunused-### options in gcc's manual: Warning Options. Notably, -Wno-unused-variable might do what you want.

[...] why the heck would you use gfortran when you have Intel Fortran ?

When developing, running your code through multiple compilers helps in finding bugs and producing portable code.

eriktous
  • 6,569
  • 2
  • 25
  • 35
  • 4
    +1 for the multiple compilers. It is _very_ useful to test your code with different compilers - especially Fortran with all idioms and different standards. – Ivan Feb 22 '13 at 20:45