Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 395751

Summary: dev-embedded/msp430mcu - problem with macros and void functions
Product: Gentoo Linux Reporter: David Relson <relson>
Component: [OLD] UnspecifiedAssignee: Tim Harder <radhermit>
Status: RESOLVED INVALID    
Severity: normal CC: dev-embedded+disabled
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: code to generate error messages

Description David Relson 2011-12-23 01:06:10 UTC
gcc generates error messages when compiling msp430 code from Texas Instruments. 

The following macro invocations expand to include the result of functions (of return type 'void') as arguments to other functions:
    _BIC_SR(LPM3_EXIT);
    __bis_SR_register(LPM0 + GIE);

"Actual Results" below gives the exact error messages.

Attached file macro_problem_1220.c can be compiled to generate the error messages.

Reproducible: Always

Steps to Reproduce:
1. command 'msp430-gcc -c -o macro_problem_1220.o macro_problem_1220.c'
2.
3.
Actual Results:  
msp430-gcc -c -o macro_problem_1220.o macro_problem_1220.c
macro_problem_1220.c: In function ‘Low_Power_Mode__Port_1’:
macro_problem_1220.c:24:5: error: invalid use of void expression
macro_problem_1220.c: In function ‘Timer_Blink_LED__main’:
macro_problem_1220.c:41:5: error: void value not ignored as it ought to be
make: *** [macro_problem_1220.o] Error 1
make: Target `macro_problem_1220' not remade because of errors.


Expected Results:  
Compilation without error messages
Comment 1 David Relson 2011-12-23 01:07:11 UTC
Created attachment 296703 [details]
code to generate error messages
Comment 2 David Relson 2011-12-23 14:21:15 UTC
The sample code being used was copied from TI web pages.  I now believe the flaw is TI's.  

The following two changes allow successful compilation:

from:    _BIC_SR(LPM3_EXIT);
to:      LPM3_EXIT;

from:    __bis_SR_register(LPM0 + GIE); // LPM0 with interrupts enabled
to:      __bis_SR_register(LPM0_bits + GIE); // LPM0 with interrupts enabled