diff options
author | alk3pInjection <webmaster@raspii.tech> | 2024-02-04 16:16:35 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2024-02-04 16:16:35 +0800 |
commit | abdaadbcae30fe0c9a66c7516798279fdfd97750 (patch) | |
tree | 00a54a6e25601e43876d03c1a4a12a749d4a914c /share/doc/gfortran/ATTRIBUTES-directive.html |
https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
Change-Id: I7303388733328cd98ab9aa3c30236db67f2e9e9c
Diffstat (limited to 'share/doc/gfortran/ATTRIBUTES-directive.html')
-rw-r--r-- | share/doc/gfortran/ATTRIBUTES-directive.html | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/share/doc/gfortran/ATTRIBUTES-directive.html b/share/doc/gfortran/ATTRIBUTES-directive.html new file mode 100644 index 0000000..2726d9d --- /dev/null +++ b/share/doc/gfortran/ATTRIBUTES-directive.html @@ -0,0 +1,172 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<!-- Copyright (C) 1999-2023 Free Software Foundation, Inc. + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with the +Invariant Sections being "Funding Free Software", the Front-Cover +Texts being (a) (see below), and with the Back-Cover Texts being (b) +(see below). A copy of the license is included in the section entitled +"GNU Free Documentation License". + +(a) The FSF's Front-Cover Text is: + +A GNU Manual + +(b) The FSF's Back-Cover Text is: + +You have freedom to copy and modify this GNU Manual, like GNU + software. Copies published by the Free Software Foundation raise + funds for GNU development. --> +<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ --> +<head> +<title>The GNU Fortran Compiler: ATTRIBUTES directive</title> + +<meta name="description" content="The GNU Fortran Compiler: ATTRIBUTES directive"> +<meta name="keywords" content="The GNU Fortran Compiler: ATTRIBUTES directive"> +<meta name="resource-type" content="document"> +<meta name="distribution" content="global"> +<meta name="Generator" content="makeinfo"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<link href="index.html#Top" rel="start" title="Top"> +<link href="Option-Index.html#Option-Index" rel="index" title="Option Index"> +<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> +<link href="GNU-Fortran-Compiler-Directives.html#GNU-Fortran-Compiler-Directives" rel="up" title="GNU Fortran Compiler Directives"> +<link href="UNROLL-directive.html#UNROLL-directive" rel="next" title="UNROLL directive"> +<link href="GNU-Fortran-Compiler-Directives.html#GNU-Fortran-Compiler-Directives" rel="previous" title="GNU Fortran Compiler Directives"> +<style type="text/css"> +<!-- +a.summary-letter {text-decoration: none} +blockquote.smallquotation {font-size: smaller} +div.display {margin-left: 3.2em} +div.example {margin-left: 3.2em} +div.indentedblock {margin-left: 3.2em} +div.lisp {margin-left: 3.2em} +div.smalldisplay {margin-left: 3.2em} +div.smallexample {margin-left: 3.2em} +div.smallindentedblock {margin-left: 3.2em; font-size: smaller} +div.smalllisp {margin-left: 3.2em} +kbd {font-style:oblique} +pre.display {font-family: inherit} +pre.format {font-family: inherit} +pre.menu-comment {font-family: serif} +pre.menu-preformatted {font-family: serif} +pre.smalldisplay {font-family: inherit; font-size: smaller} +pre.smallexample {font-size: smaller} +pre.smallformat {font-family: inherit; font-size: smaller} +pre.smalllisp {font-size: smaller} +span.nocodebreak {white-space:nowrap} +span.nolinebreak {white-space:nowrap} +span.roman {font-family:serif; font-weight:normal} +span.sansserif {font-family:sans-serif; font-weight:normal} +ul.no-bullet {list-style: none} +--> +</style> + + +</head> + +<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> +<a name="ATTRIBUTES-directive"></a> +<div class="header"> +<p> +Next: <a href="UNROLL-directive.html#UNROLL-directive" accesskey="n" rel="next">UNROLL directive</a>, Up: <a href="GNU-Fortran-Compiler-Directives.html#GNU-Fortran-Compiler-Directives" accesskey="u" rel="up">GNU Fortran Compiler Directives</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p> +</div> +<hr> +<a name="ATTRIBUTES-directive-1"></a> +<h4 class="subsection">6.2.1 ATTRIBUTES directive</h4> + +<p>The Fortran 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 +<a href="http://gcc.gnu.org/onlinedocs/gcc/index.html#Top">C Extensions</a> in <cite>Using the GNU Compiler Collection (GCC)</cite> +for details. +</p> +<p>For procedures and procedure pointers, the following attributes can +be used to change the calling convention: +</p> +<ul> +<li> <code>CDECL</code> – standard C calling convention +</li><li> <code>STDCALL</code> – convention where the called procedure pops the stack +</li><li> <code>FASTCALL</code> – part of the arguments are passed via registers +instead using the stack +</li></ul> + +<p>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. +</p> +<p>On some systems, procedures and global variables (module variables and +<code>COMMON</code> blocks) need special handling to be accessible when they +are in a shared library. The following attributes are available: +</p> +<ul> +<li> <code>DLLEXPORT</code> – provide a global pointer to a pointer in the DLL +</li><li> <code>DLLIMPORT</code> – reference the function or variable using a +global pointer +</li></ul> + +<p>For dummy arguments, the <code>NO_ARG_CHECK</code> attribute can be used; in +other compilers, it is also known as <code>IGNORE_TKR</code>. For dummy arguments +with this attribute actual arguments of any type and kind (similar to +<code>TYPE(*)</code>), scalars and arrays of any rank (no equivalent +in Fortran standard) are accepted. As with <code>TYPE(*)</code>, the argument +is unlimited polymorphic and no type information is available. +Additionally, the argument may only be passed to dummy arguments +with the <code>NO_ARG_CHECK</code> attribute and as argument to the +<code>PRESENT</code> intrinsic function and to <code>C_LOC</code> of the +<code>ISO_C_BINDING</code> module. +</p> +<p>Variables with <code>NO_ARG_CHECK</code> attribute shall be of assumed-type +(<code>TYPE(*)</code>; recommended) or of type <code>INTEGER</code>, <code>LOGICAL</code>, +<code>REAL</code> or <code>COMPLEX</code>. They shall not have the <code>ALLOCATE</code>, +<code>CODIMENSION</code>, <code>INTENT(OUT)</code>, <code>POINTER</code> or <code>VALUE</code> +attribute; furthermore, they shall be either scalar or of assumed-size +(<code>dimension(*)</code>). As <code>TYPE(*)</code>, the <code>NO_ARG_CHECK</code> attribute +requires an explicit interface. +</p> +<ul> +<li> <code>NO_ARG_CHECK</code> – disable the type, kind and rank checking +</li><li> <code>DEPRECATED</code> – print a warning when using a such-tagged +deprecated procedure, variable or parameter; the warning can be suppressed +with <samp>-Wno-deprecated-declarations</samp>. +</li><li> <code>NOINLINE</code> – prevent inlining given function. +</li><li> <code>NORETURN</code> – add a hint that a given function cannot return. +</li><li> <code>WEAK</code> – emit the declaration of an external symbol as a weak +symbol rather than a global. This is primarily useful in defining library +functions that can be overridden in user code, though it can also be used with +non-function declarations. The overriding symbol must have the same type as +the weak symbol. +</li></ul> + + +<p>The attributes are specified using the syntax +</p> +<p><code>!GCC$ ATTRIBUTES</code> <var>attribute-list</var> <code>::</code> <var>variable-list</var> +</p> +<p>where in free-form source code only whitespace is allowed before <code>!GCC$</code> +and in fixed-form source code <code>!GCC$</code>, <code>cGCC$</code> or <code>*GCC$</code> shall +start in the first column. +</p> +<p>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. +</p> + +<hr> +<div class="header"> +<p> +Next: <a href="UNROLL-directive.html#UNROLL-directive" accesskey="n" rel="next">UNROLL directive</a>, Up: <a href="GNU-Fortran-Compiler-Directives.html#GNU-Fortran-Compiler-Directives" accesskey="u" rel="up">GNU Fortran Compiler Directives</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p> +</div> + + + +</body> +</html> |