1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00

Return-type warning and pseudo variable __A__ documentation added.

This commit is contained in:
Piotr Kaczorowski 2021-01-04 22:05:55 +01:00 committed by Oliver Schmidt
parent a9b71b6207
commit 9662469957

View File

@ -549,6 +549,8 @@ Here is a description of all the command line options:
<tag><tt/remap-zero/</tag>
Warn about a <tt/<ref id="pragma-charmap" name="#pragma charmap()">/
that changes a character's code number from/to 0x00.
<tag><tt/return-type/</tag>
Warn about no return statement in function returning non-void..
<tag><tt/struct-param/</tag>
Warn when passing structs by value.
<tag><tt/unknown-pragma/</tag>
@ -726,6 +728,29 @@ This cc65 version has some extensions to the ISO C standard.
will give the high byte of any unsigned value.
<p>
<item> There is pseudo variable named <tt/__A__/ that indicates accumulator register.
It can be used to highlight the returned variable in non-void
function where result is hidden in the <tt/asm/ section.
every other variable. They are most useful together with short
sequences of assembler code.
For example, in the function below
<tscreen><verb>
BYTE get_key_via_atarixl_romcall_device_k(void) \
asm("LDA $E425"); \
asm("PHA"); \
asm("LDA $E424"); \
asm("PHA"); \
asm("RTA"); \
return __A__;
</verb></tscreen>
<tt/return __A__;/ will indicate that result is stored in the accumulator
and suppress warning that function has no return statement. Instead, you can
also use <tt/#pragma warn (return-type, off) ... pragma warn (return-type, on)/
<p>
<item> Inside a function, the identifier <tt/__func__/ gives the name of the
current function as a string. Outside of functions, <tt/__func__/ is
undefined.