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/fortran/gfortran.texi | |
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/fortran/gfortran.texi')
-rw-r--r-- | gcc/fortran/gfortran.texi | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi index ab69c0a..f0b1c67 100644 --- a/gcc/fortran/gfortran.texi +++ b/gcc/fortran/gfortran.texi @@ -1851,6 +1851,7 @@ c @menu * Interoperability with C:: +* GNU Fortran Compiler Directives:: * Non-Fortran Main Program:: @end menu @@ -2097,6 +2098,60 @@ C-interoperable @code{OPTIONAL} and for assumed-rank and assumed-type dummy arguments. However, the TR has neither been approved nor implemented in GNU Fortran; therefore, these features are not yet available. + + +@node GNU Fortran Compiler Directives +@section GNU Fortran Compiler Directives + +The Fortran standard standard describes how a conforming program shall +behave; however, the exact implementation is not standardized. In order +to allow the user to choose specific implementation details, compiler +directives can be used to set attributes of variables and procedures +which are not part of the standard. Whether a given attribute is +supported and its exact effects depend on both the operating system and +on the processor; see +@ref{Top,,C Extensions,gcc,Using the GNU Compiler Collection (GCC)} +for details. + +For procedures and procedure pointers, the following attributes can +be used to change the calling convention: + +@itemize +@item @code{CDECL} -- standard C calling convention +@item @code{STDCALL} -- convention where the called procedure pops the stack +@item @code{FASTCALL} -- part of the arguments are passed via registers +instead using the stack +@end itemize + +Besides changing the calling convention, the attributes also influence +the decoration of the symbol name, e.g., by a leading underscore or by +a trailing at-sign followed by the number of bytes on the stack. When +assigning a procedure to a procedure pointer, both should use the same +calling convention. + +On some systems, procedures and global variables (module variables and +@code{COMMON} blocks) need special handling to be accessible when they +are in a shared library. The following attributes are available: + +@itemize +@item @code{DLLEXPORT} -- provide a global pointer to a pointer in the DLL +@item @code{DLLIMPORT} -- reference the function or variable using a global pointer +@end itemize + +The attributes are specified using the syntax + +@code{!GCC$ ATTRIBUTES} @var{attribute-list} @code{::} @var{variable-list} + +where in free-form source code only whitespace is allowed before @code{!GCC$} +and in fixed-form source code @code{!GCC$}, @code{cGCC$} or @code{*GCC$} shall +start in the first column. + +For procedures, the compiler directives shall be placed into the body +of the procedure; for variables and procedure pointers, they shall be in +the same declaration part as the variable or procedure pointer. + + + @node Non-Fortran Main Program @section Non-Fortran Main Program |