diff options
author | Tobias Burnus <burnus@net-b.de> | 2009-06-28 19:56:41 +0200 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2009-06-28 19:56:41 +0200 |
commit | 08a6b8e049f9935cc314a669b2120ff07cd7fbeb (patch) | |
tree | 49b09d2f1e0cfee1a1f1901ff04e9da4c8a351d1 /gcc/testsuite | |
parent | 0948ccb243a5b2244bef375addc6f1a4b3a2f526 (diff) | |
download | gcc-08a6b8e049f9935cc314a669b2120ff07cd7fbeb.zip gcc-08a6b8e049f9935cc314a669b2120ff07cd7fbeb.tar.gz gcc-08a6b8e049f9935cc314a669b2120ff07cd7fbeb.tar.bz2 |
re PR fortran/34112 (Add $!DEC ATTRIBUTE support for 32bit Windows' STDCALL)
2009-06-28 Tobias Burnus <burnus@net-b.de>
Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/34112
* symbol.c (gfc_add_ext_attribute): New function.
(gfc_get_sym_tree): New argument allow_subroutine.
(gfc_get_symbol,gfc_get_ha_sym_tree,gen_cptr_param,gen_fptr_param
gen_shape_param,generate_isocbinding_symbol): Use it.
* decl.c (find_special): New argument allow_subroutine.
(add_init_expr_to_sym,add_hidden_procptr_result,attr_decl1,
match_procedure_in_type,gfc_match_final_decl): Use it.
(gfc_match_gcc_attributes): New function.
* gfortran.texi (Mixed-Language Programming): New section
"GNU Fortran Compiler Directives".
* gfortran.h (ext_attr_t): New struct.
(symbol_attributes): Use it.
(gfc_add_ext_attribute): New prototype.
(gfc_get_sym_tree): Update pototype.
* expr.c (gfc_check_pointer_assign): Check whether call
convention is the same.
* module.c (import_iso_c_binding_module, create_int_parameter,
use_iso_fortran_env_module): Update gfc_get_sym_tree call.
* scanner.c (skip_gcc_attribute): New function.
(skip_free_comments,skip_fixed_comments): Use it.
(gfc_next_char_literal): Support !GCC$ lines.
* resolve.c (check_host_association): Update
gfc_get_sym_tree call.
* match.c (gfc_match_sym_tree,gfc_match_call): Update
gfc_get_sym_tree call.
* trans-decl.c (add_attributes_to_decl): New function.
(gfc_get_symbol_decl,get_proc_pointer_decl,
gfc_get_extern_function_decl,build_function_decl: Use it.
* match.h (gfc_match_gcc_attributes): Add prototype.
* parse.c (decode_gcc_attribute): New function.
(next_free,next_fixed): Support !GCC$ lines.
* primary.c (match_actual_arg,check_for_implicit_index,
gfc_match_rvalue,gfc_match_rvalue): Update
gfc_get_sym_tree call.
2009-06-28 Tobias Burnus <burnus@net-b.de>
PR fortran/34112
* gfortran.dg/compiler-directive_1.f90: New test.
* gfortran.dg/compiler-directive_2.f: New test.
Co-Authored-By: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
From-SVN: r149036
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/compiler-directive_1.f90 | 48 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/compiler-directive_2.f | 11 |
3 files changed, 65 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aa693ce..ce26ed9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2009-06-28 Tobias Burnus <burnus@net-b.de> + + PR fortran/34112 + * gfortran.dg/compiler-directive_1.f90: New test. + * gfortran.dg/compiler-directive_2.f: New test. + 2009-06-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * gfortran.dg/integer_exponentiation_4.f90: Temporarily diff --git a/gcc/testsuite/gfortran.dg/compiler-directive_1.f90 b/gcc/testsuite/gfortran.dg/compiler-directive_1.f90 new file mode 100644 index 0000000..75f28dc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/compiler-directive_1.f90 @@ -0,0 +1,48 @@ +! { dg-do compile } +! +! PR fortran/34112 +! +! Check for calling convention consitency +! in procedure-pointer assignments. + +program test + interface + subroutine sub1() + end subroutine sub1 + subroutine sub2() + !GCC$ ATTRIBUTES CDECL :: sub2 + end subroutine sub2 + subroutine sub3() + !GCC$ ATTRIBUTES STDCALL :: sub3 + end subroutine sub3 + subroutine sub4() +!GCC$ ATTRIBUTES FASTCALL :: sub4 + end subroutine sub4 + end interface + + !gcc$ attributes cdecl :: cdecl + !gcc$ attributes stdcall :: stdcall + procedure(), pointer :: ptr + procedure(), pointer :: cdecl + procedure(), pointer :: stdcall + procedure(), pointer :: fastcall + !gcc$ attributes fastcall :: fastcall + + ! Valid: + ptr => sub1 + cdecl => sub2 + stdcall => sub3 + fastcall => sub4 + + ! Invalid: + ptr => sub3 ! { dg-error "mismatch in the calling convention" } + ptr => sub4 ! { dg-error "mismatch in the calling convention" } + cdecl => sub3 ! { dg-error "mismatch in the calling convention" } + cdecl => sub4 ! { dg-error "mismatch in the calling convention" } + stdcall => sub1 ! { dg-error "mismatch in the calling convention" } + stdcall => sub2 ! { dg-error "mismatch in the calling convention" } + stdcall => sub4 ! { dg-error "mismatch in the calling convention" } + fastcall => sub1 ! { dg-error "mismatch in the calling convention" } + fastcall => sub2 ! { dg-error "mismatch in the calling convention" } + fastcall => sub3 ! { dg-error "mismatch in the calling convention" } +end program diff --git a/gcc/testsuite/gfortran.dg/compiler-directive_2.f b/gcc/testsuite/gfortran.dg/compiler-directive_2.f new file mode 100644 index 0000000..fcb1657 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/compiler-directive_2.f @@ -0,0 +1,11 @@ +! { dg-do compile { target i?86-*-* x86_64-*-* } } +! { dg-require-effective-target ilp32 } +! +! PR fortran/34112 +! +! Check for calling convention consitency +! in procedure-pointer assignments. +! + subroutine test() ! { dg-error "fastcall and stdcall attributes are not compatible" } +cGCC$ attributes stdcall, fastcall::test + end subroutine test |