Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 395751 - dev-embedded/msp430mcu - problem with macros and void functions
Summary: dev-embedded/msp430mcu - problem with macros and void functions
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Tim Harder
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-23 01:06 UTC by David Relson
Modified: 2011-12-23 14:21 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
code to generate error messages (macro_problem_1220.c,1.74 KB, text/plain)
2011-12-23 01:07 UTC, David Relson
Details

Note You need to log in before you can comment on or make changes to this bug.
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