#53 "result" should not be a default variable name

closed-fixed
nobody
None
5
2009-07-02
2009-02-11
Rabid Deity
No

I upgraded my nesC/avr-gcc to the latest available versions recently (nesc , and tried to compile one of the Crossbow xmesh apps against the xbow tos tree (it's a 1.x hybrid). ncc is 1.2.4, nesc is 1.3.0, avrgcc is 4.1.2. All this is running under cygwin.

"make iris" gives me this:

/opt/MoteWorks/tos/sensorboards/mts400/Switch.nc: In function 'MicaWbSwitchM$Switch$setDone':
/opt/MoteWorks/tos/sensorboards/mts400/Switch.nc:23: error: 'result' redeclared as different kind of symbol
/opt/MoteWorks/tos/sensorboards/mts400/Switch.nc:23: error: previous definition of 'result' was here
/opt/MoteWorks/tos/sensorboards/mts400/Switch.nc: In function 'MicaWbSwitchM$Switch$setAllDone':
/opt/MoteWorks/tos/sensorboards/mts400/Switch.nc:24: error: 'result' redeclared as different kind of symbol
/opt/MoteWorks/tos/sensorboards/mts400/Switch.nc:24: error: previous definition of 'result' was here

The offending lines looks like this:

interface Switch {
// ...
event result_t setDone(bool result);
event result_t setAllDone(bool result);
}

If I change the above code to:

event result_t setDone(bool result1);
event result_t setAllDone(bool result1);

it compiles and builds without errors.

I read at http://www.mail-archive.com/tinyos-help@millennium.berkeley.edu/msg22930.html that this is because nesC uses "result" as a replacement variable name. If this is in fact nesC's fault, it should be fixed... the chances that someone would be using the variable name "result" are pretty high, and then the redeclaration by nesC causes errors.

Suggested fix: let nesC use something like "__result_nesC" as a replacement instead. If it's not nesC's fault, please close this bug.

Discussion

  • David Gay

    David Gay - 2009-02-17

    Indeed a bug (probably introduced in 1.3.0 as a result of Deputy support) - I'll fix it for 1.3.1

     
  • David Gay

    David Gay - 2009-07-02

    Fixed for 1.3.1 by using __nesc_result

     
  • David Gay

    David Gay - 2009-07-02
    • status: open --> closed
     
  • David Gay

    David Gay - 2009-07-02
    • status: closed --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks