OSDN Git Service

2012-07-17 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Jul 2012 20:07:32 +0000 (20:07 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Jul 2012 20:07:32 +0000 (20:07 +0000)
        PR fortran/53985
        * decl.c (gfc_verify_c_interop_param): Make warning conditional
        on -Wc-binding-type works and improve the wording.

2012-07-17  Tobias Burnus  <burnus@net-b.de>

        PR fortran/53985
        * gfortran.dg/bind_c_usage_26.f90: New.
        * gfortran.dg/bind_c_procs.f03: Add dg-options
        * "-Wc-binding-type".
        * gfortran.dg/bind_c_usage_13.f03: Ditto.
        * gfortran.dg/bind_c_usage_18.f90: Ditto.
        * gfortran.dg/interop_params.f03: Ditto.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@189586 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/bind_c_procs.f03
gcc/testsuite/gfortran.dg/bind_c_usage_13.f03
gcc/testsuite/gfortran.dg/bind_c_usage_18.f90
gcc/testsuite/gfortran.dg/bind_c_usage_26.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/interop_params.f03

index 9042014..dd7958b 100644 (file)
@@ -1,5 +1,11 @@
 2012-07-17  Tobias Burnus  <burnus@net-b.de>
 
+       PR fortran/53985
+       * decl.c (gfc_verify_c_interop_param): Make warning conditional
+       on -Wc-binding-type works and improve the wording.
+
+2012-07-17  Tobias Burnus  <burnus@net-b.de>
+
        PR fortran/52101
        * decl.c (match_char_length): Extra argument, show obsolenscent
        warning only if *length is used after the typename.
index 89d501c..83a4c60 100644 (file)
@@ -1028,8 +1028,8 @@ gfc_verify_c_interop_param (gfc_symbol *sym)
                           "because it is polymorphic",
                           sym->name, &(sym->declared_at),
                           sym->ns->proc_name->name);
-             else
-               gfc_warning ("Variable '%s' at %L is a parameter to the "
+             else if (gfc_option.warn_c_binding_type)
+               gfc_warning ("Variable '%s' at %L is a dummy argument of the "
                             "BIND(C) procedure '%s' but may not be C "
                             "interoperable",
                             sym->name, &(sym->declared_at),
index d3bfd48..70efda9 100644 (file)
@@ -1,3 +1,12 @@
+2012-07-17  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/53985
+       * gfortran.dg/bind_c_usage_26.f90: New.
+       * gfortran.dg/bind_c_procs.f03: Add dg-options "-Wc-binding-type".
+       * gfortran.dg/bind_c_usage_13.f03: Ditto.
+       * gfortran.dg/bind_c_usage_18.f90: Ditto.
+       * gfortran.dg/interop_params.f03: Ditto.
+
 2012-07-17  Jason Merrill  <jason@redhat.com>
 
        * g++.dg/template/inherit8.C: Adjust.
index eaf0672..3bb6ea3 100644 (file)
@@ -1,4 +1,5 @@
 ! { dg-do compile }
+! { dg-options "-Wc-binding-type" }
 module bind_c_procs
   use, intrinsic :: iso_c_binding, only: c_int
 
index d89963d..b8c2261 100644 (file)
@@ -1,5 +1,5 @@
 ! { dg-do compile }
-! { dg-options "-fdump-tree-original" }
+! { dg-options "-fdump-tree-original -Wc-binding-type" }
 !
 ! PR fortran/34079
 ! Character bind(c) arguments shall not pass the length as additional argument
index 2bce215..ede9f60 100644 (file)
@@ -1,4 +1,5 @@
 ! { dg-do compile }
+! { dg-options "-Wc-binding-type" }
 !
 ! PR fortran/38160
 !
diff --git a/gcc/testsuite/gfortran.dg/bind_c_usage_26.f90 b/gcc/testsuite/gfortran.dg/bind_c_usage_26.f90
new file mode 100644 (file)
index 0000000..20a68d1
--- /dev/null
@@ -0,0 +1,14 @@
+! { dg-do compile }
+!
+! PR fortran/53985
+!
+! Check that the (default) -Wno-c-binding-type works
+! and no warning is printed.
+!
+! With -Wc-binding-type, one gets:
+!  Warning: Variable 'x' at (1) is a dummy argument to the BIND(C) procedure
+!           'test' but may not be C interoperable )
+!
+subroutine test(x) bind(C)
+  integer :: x
+end subroutine test
index ea3dada..6eafba0 100644 (file)
@@ -1,4 +1,5 @@
 ! { dg-do compile }
+! { dg-options "-Wc-binding-type" }
 module interop_params
 use, intrinsic :: iso_c_binding