declaring any function as inline (in pic16 port) will cause
...returned errorcode 256
from gpasm (I think).
Sample code (test.c):
inline int foobar() {
}
Compiled with:
~/sdcc-3.4.0/bin/sdcc -c --no-crt --ivt-loc=0x800 -V -L ~/sdcc-3.4.0/share/sdcc/non-free/lib/pic16 -Wl,-m,-s18f45k50.lkr -mpic16 -p18f45k50 --disable-warning 85 --std-sdcc99 --obanksel=3 --use-non-free test.c -o ../obj/test.o
SDCC/gpasm version:
nyholkus-MacBook-Pro:src nyholku$ ~/sdcc-3.4.0/bin/sdcc -v
SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8 3.4.0 #8981 (Apr 5 2014) (Mac OS X i386)
published under GNU General Public License (GPL)
nyholkus-MacBook-Pro:src nyholku$ gpasm -v
gpasm-1.4.0 #1107 (Oct 28 2014)
If every occurrence of foobar has an inline qualifier and no extern, it should not be implemented by the compiler as a separate function in this object. But it may/must require an external implementation in another object unless it is static.
The global keyword should be extern or not present at all if it's never used.
SDCC 3.4.1 linux amd64 build from source:
pic16 port (target - pic18f25k22)
--std-sdcc99
static inline minor issue
static inline void test_static_inline(void){
/somecode/
asm("banksel _PORTA");
asm("movf _PORTA, W");
asm("movwf _PORTB");
}
void testfunc(void){
test_static_inline; //without bracers!
asm("nop");
test_static_inline();
}
code compilies without errors. is it normal?
for this simle code generated asm listing
...
; ; Starting pCode block
S_main__test_static_inline code
_test_static_inline:
; .line 4; main.c static inline void test_static_inline(void){
MOVFF FSR2L, POSTDEC1
MOVFF FSR1L, FSR2L
banksel _PORTA
movf _PORTA, W
movwf _PORTB
MOVFF PREINC1, FSR2L
RETURN
...
; ; Starting pCode block
S_main__testfunc code
_testfunc:
; .line 11; main.c void testfunc(void){
MOVFF FSR2L, POSTDEC1
MOVFF FSR1L, FSR2L
nop
banksel _PORTA
movf _PORTA, W
movwf _PORTB
; .line 14; main.c test_static_inline();
MOVFF PREINC1, FSR2L
RETURN
...
so.
1)for static inline function created codeblock. but it static inline - so it wooldn't use in external calls. it would be logical for inline, but not for static inline
or not?
2)[i]test_static_inline; //without bracers![/i] - completely ignored. no errors.
I think that may lead to difficulties in debugging.
3)info about inlined code after code, that inlined, but other info before.
*i do not know English well.
Last edit: egan.fryazino 2015-02-20
Using a function name without parentheses is the same as taking its address. And not assigning it is totally legal. compare: