On Mon, Jul 23, 2007 at 2:48 PM, Anatoly Sokolov <[EMAIL PROTECTED]> wrote:
> This patch add "OS_main" and 'OS_task' attributes in GCC 4.2.1. Function with > "OS_main" and 'OS_task' attributes do not save any "call-saved" registers. I had hoped that using OS_main would get rid of the call to main, wastes stack space, and all of the dead _exit code, which is not allowed under some design guidelines (as well as taking space), that will never be executed, but it doesn't. Is there an attribute that would? using 'noreturn' does not work on main, causes: Main/main.cpp: In function 'int main()': Main/main.cpp:60: warning: function declared 'noreturn' has a 'return' statement Removing 'int' from main causes different errors. Test case: int main( void ) __attribute__ ((OS_main)); int main( void ) { for(;;) ; } generates the following where main will never return and _exit will never be executed. 5a: 02 d0 rcall .+4 ; 0x60 <main> 5c: 02 c0 rjmp .+4 ; 0x62 <_exit> 0000005e <__bad_interrupt>: 5e: d0 cf rjmp .-96 ; 0x0 <__vectors> 00000060 <main>: int main( void ) 60: ff cf rjmp .-2 ; 0x60 <main> 00000062 <_exit>: 62: f8 94 cli 00000064 <__stop_program>: 64: ff cf rjmp .-2 ; 0x64 <__stop_program> _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list