mirror of
https://github.com/cc65/cc65.git
synced 2024-06-02 04:41:35 +00:00
Updated documentation on string literal translation in asm() and _Static_assert().
This commit is contained in:
parent
7b0d1d9679
commit
21b6cbb66e
|
@ -837,21 +837,21 @@ This cc65 version has some extensions to the ISO C standard.
|
||||||
|
|
||||||
<itemize>
|
<itemize>
|
||||||
|
|
||||||
<item> The compiler allows to insert assembler expressions into the output
|
<item> The compiler allows to insert inline assembler code in the form of the
|
||||||
file. The syntax is
|
<tt/asm/ expression into the output file. The syntax is
|
||||||
|
|
||||||
<tscreen><verb>
|
<tscreen><verb>
|
||||||
asm [optional volatile] (<string literal>[, optional parameters]) ;
|
asm [optional volatile] (<string literal>[, optional parameters])
|
||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
or
|
or
|
||||||
<tscreen><verb>
|
<tscreen><verb>
|
||||||
__asm__ [optional volatile] (<string literal>[, optional parameters]) ;
|
__asm__ [optional volatile] (<string literal>[, optional parameters])
|
||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
|
|
||||||
The first form is in the user namespace; and, is disabled if the <tt/-A/
|
The first form is in the user namespace; and, is disabled if the <tt/-A/
|
||||||
switch is given.
|
switch is given.
|
||||||
|
|
||||||
There is a whole section covering inline assembler expressions,
|
There is a whole section covering the inline assembler,
|
||||||
<ref id="inline-asm" name="see there">.
|
<ref id="inline-asm" name="see there">.
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
|
@ -1008,6 +1008,13 @@ This cc65 version has some extensions to the ISO C standard.
|
||||||
<tt/_Static_assert/ is also available as the macro <tt/static_assert/ in
|
<tt/_Static_assert/ is also available as the macro <tt/static_assert/ in
|
||||||
<tt/assert.h/.
|
<tt/assert.h/.
|
||||||
|
|
||||||
|
Note: The string literal as the message in the <tt/_Static_assert/
|
||||||
|
declaration is not subject to string literal translation (see
|
||||||
|
<tt/<ref id="pragma-charmap" name="#pragma charmap()">/) and will
|
||||||
|
always be in the host encoding. On the other hand, any character or
|
||||||
|
string literals present in the condition expression of the
|
||||||
|
<tt/_Static_assert/ declaration will be translated as usual.
|
||||||
|
|
||||||
<item> cc65 supports bit-fields of any integral type that is int-sized or
|
<item> cc65 supports bit-fields of any integral type that is int-sized or
|
||||||
smaller, and enumerated types with those types as their underlying
|
smaller, and enumerated types with those types as their underlying
|
||||||
type. (Only <tt/int/, <tt/signed int/, and <tt/unsigned int/ are
|
type. (Only <tt/int/, <tt/signed int/, and <tt/unsigned int/ are
|
||||||
|
@ -1317,7 +1324,9 @@ parameter with the <tt/#pragma/.
|
||||||
|
|
||||||
<sect1><tt>#pragma charmap (<index>, <code>)</tt><label id="pragma-charmap"><p>
|
<sect1><tt>#pragma charmap (<index>, <code>)</tt><label id="pragma-charmap"><p>
|
||||||
|
|
||||||
Each literal string and each literal character in the source is translated
|
Each literal string and each literal character in the preprocessed source,
|
||||||
|
except when used in an <tt/asm/ expression as the inline assembler code or
|
||||||
|
in a <tt/_Static_assert/ declaration as the failure message, is translated
|
||||||
by use of a translation table. That translation table is preset when the
|
by use of a translation table. That translation table is preset when the
|
||||||
compiler is started, depending on the target system; for example, to map
|
compiler is started, depending on the target system; for example, to map
|
||||||
ISO-8859-1 characters into PETSCII if the target is a Commodore machine.
|
ISO-8859-1 characters into PETSCII if the target is a Commodore machine.
|
||||||
|
@ -1714,23 +1723,23 @@ bloated code and a slowdown.
|
||||||
|
|
||||||
<sect>Inline assembler<label id="inline-asm"><p>
|
<sect>Inline assembler<label id="inline-asm"><p>
|
||||||
|
|
||||||
The compiler allows to insert assembler expressions into the output file. The
|
The compiler allows to insert inline assembler code in the form of the <tt/asm/
|
||||||
syntax is
|
expression into the output file. The syntax is
|
||||||
|
|
||||||
<tscreen><verb>
|
<tscreen><verb>
|
||||||
asm [optional volatile] (<string literal>[, optional parameters]) ;
|
asm [optional volatile] (<string literal>[, optional parameters])
|
||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
or
|
or
|
||||||
<tscreen><verb>
|
<tscreen><verb>
|
||||||
__asm__ [optional volatile] (<string literal>[, optional parameters]) ;
|
__asm__ [optional volatile] (<string literal>[, optional parameters])
|
||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
The first form is in the user namespace; and, is disabled by <tt><ref
|
The first form is in the user namespace; and, is disabled by <tt><ref
|
||||||
id="option--standard" name="--standard"></tt> if the argument is not <tt/cc65/.
|
id="option--standard" name="--standard"></tt> if the argument is not <tt/cc65/.
|
||||||
|
|
||||||
The <tt/asm/ expression can be used only inside a function. Please note that
|
The <tt/asm/ expression can be used only inside a function. The result of an
|
||||||
the result of an inline assembler expression is always of type <tt/void/.
|
<tt/asm/ expression is always of type <tt/void/.
|
||||||
|
|
||||||
The contents of the string literal are preparsed by the compiler; and, inserted
|
The contents of the string literal are preparsed by the compiler; and, inserted
|
||||||
into the generated assembly output, so that it can be processed further by
|
into the generated assembly output, so that it can be processed further by
|
||||||
|
@ -1757,6 +1766,13 @@ The string literal may contain format specifiers from the following list. For
|
||||||
each format specifier, an argument is expected which is inserted instead of
|
each format specifier, an argument is expected which is inserted instead of
|
||||||
the format specifier, before passing the assembly code line to the backend.
|
the format specifier, before passing the assembly code line to the backend.
|
||||||
|
|
||||||
|
Note: The string literal as the inline assembler code itself in the <tt/asm/
|
||||||
|
expression is not subject to string literal translation (see
|
||||||
|
<tt/<ref id="pragma-charmap" name="#pragma charmap()">/) and will always
|
||||||
|
be in the host encoding. On the other hand, all character and string literals
|
||||||
|
as the arguments for replacing the format specifiers will be translated as
|
||||||
|
usual.
|
||||||
|
|
||||||
<itemize>
|
<itemize>
|
||||||
<item><tt/%b/ - Numerical 8-bit value
|
<item><tt/%b/ - Numerical 8-bit value
|
||||||
<item><tt/%w/ - Numerical 16-bit value
|
<item><tt/%w/ - Numerical 16-bit value
|
||||||
|
|
Loading…
Reference in New Issue
Block a user