solalito
solalito

Reputation: 1209

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

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.

Upvotes: 10

Views: 19819

Answers (3)

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.

Upvotes: 9

b-fg
b-fg

Reputation: 4137

The easiest way of getting rid of the warning in gfortran versions 4.x is to overwrite the -Wno-tabs flag that the -Wall flag sets. So first include -Wall and then -Wtabs

-Wall -Wtabs

Upvotes: 0

DrOli
DrOli

Reputation: 1083

UPDATE: With GCC/gFortran 5xx (I noticed with 5.3.0), the -Wtabs usage has been "reversed", and as they say, "made more sensible".

See here (https://gcc.gnu.org/gcc-5/changes.html)

Now -Wtabs DOES give the nonconforming warning, whereas -Wno-tabs TURNS OFF the warning (i.e. the opposite of the previous usage).

Upvotes: 5

Related Questions