Silence the warning: `Non-conforming tab character` in gfortran

solalito picture solalito · Aug 13, 2015 · Viewed 12.4k times · Source

I usually run my code with ifort, but during implementation, I prefer compiling and testing with gfortran as I find it to be a lot stricter than its intel counterpart.

While turning on compiling options such as -Wall, I get the following warning:

Warning: Nonconforming tab character at (1)

Is there a way to silence this one particular warning while using the same compiling options? Note that I do NOT want to replace tabs with space characters. If there is no way to resolve this issue, then the answer "No it's not possible" would suffice.

Answer

Andras Deak picture Andras Deak · Aug 13, 2015

Warning: the below answer I originally wrote only applies to gfortran 4.x. The behaviour has been reversed in version 5.x, see the answer by DrOli.


What have you tried so far? Does -Wtabs help? From man gfortran:

-Wtabs

By default, tabs are accepted as whitespace, but tabs are not members of the Fortran Character Set. For continuation lines, a tab followed by a digit between 1 and 9 is supported. -Wno-tabs will cause a warning to be issued if a tab is encountered. Note, -Wno-tabs is active for -pedantic, -std=f95, -std=f2003, -std=f2008 and -Wall.

And -Wall sets -Wno-tabs.

If it doesn't help, it could still be that -Wall overwrites this option. Then you can try manually setting -Wall without the tabs part:

-Wall

Enables commonly used warning options pertaining to usage that we recommend avoiding and that we believe are easy to avoid. This currently includes -Waliasing, -Wampersand, -Wconversion, -Wsurprising, -Wc-binding-type, -Wintrinsics-std, -Wno-tabs, -Wintrinsic-shadow, -Wline-truncation, -Wtarget-lifetime, -Wreal-q-constant and -Wunused.