Re: [Patch, Fortran] Add -Wc-binding-type warning

2012-03-03 Thread Steve Kargl
On Sat, Mar 03, 2012 at 03:23:01PM +0100, Tobias Burnus wrote:
> GNU Fortran warns by default for code like the following:
> 
> interface
>   subroutine sub (n)  bind (C)
> integer :: n
>   end subroutine sub
> end interface
> 
> Namely, it prints:
> 
> Warning: Variable 'n' at (1) is a parameter to the BIND(C) procedure 
> 'sub' but may not be C interoperable
> 
> That's on one hand correct: There is no defined relation between Fortran 
> default kinds (or any kind number) and the C types. Thus, the proper way 
> is to use the parameters defined in ISO_C_BINDING, such as "c_int".
> 
> On the other hand, "integer" and "int" is the same on many (but not on 
> all systems) and, thus, many users simply use the default type.
> 
> Compiling interfaces with hundreds of such definitions clutters the 
> screen with those warnings and makes it difficult to spot other warnings.
> 
> Thus, this patch adds a warning flag for this purpose - and it also 
> excludes those warnings from the default setting. That's a bit in line 
> with Fortran 2008 and TS 29113, which remove more and more constraints 
> and force the users to ensure themselves that the variables are 
> interoperable. However, keeping it as default warning is also fine with me.
> 
> Build and regtested on x86-64-linux.
> OK?
> 

OK.

-- 
Steve


Re: [Patch, Fortran] Add -Wc-binding-type warning

2012-03-03 Thread FX
> Thus, this patch adds a warning flag for this purpose - and it also excludes 
> those warnings from the default setting. That's a bit in line with Fortran 
> 2008 and TS 29113, which remove more and more constraints and force the users 
> to ensure themselves that the variables are interoperable. However, keeping 
> it as default warning is also fine with me.

No, please really remove them, I find them really annoying (and I think I 
argued against it at some point during ISO_C_BINDING merge!). They warn you not 
about something that is wrong, but something that is unportable and could be 
wrong, but probably is OK in most cases. It can have value, but not as a 
default warning I think.

I don't think I can approve patches given that I'm not following gfortran 
development very closely, but if I could I would approve it, it seems OK :)

FX