Bug 488 - [ns-3-tap] tap-bridge.cc fails to compile in optimized mode
: [ns-3-tap] tap-bridge.cc fails to compile in optimized mode
Status: RESOLVED FIXED
: ns-3
devices
: pre-release
: All Linux
: P5 minor
Assigned To:
:
:
:
:
  Show dependency treegraph
 
Reported: 2009-02-05 05:49 EDT by
Modified: 2009-02-05 14:44 EDT (History)


Attachments
The patch (523 bytes, patch)
2009-02-05 05:50 EDT, Francesco Malandrino
Details | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2009-02-05 05:49:24 EDT
When configured with -d optimized, compiling
src/devices/tap-bridge/tap-bridge.cc fails due to a warning about "ignored
return value of write".
(In "optimized" mode, warnings are treated as errors)

The attached patch trivially fixed the issue.
------- Comment #1 From 2009-02-05 05:50:21 EDT -------
Created an attachment (id=371) [details]
The patch
------- Comment #2 From 2009-02-05 12:46:16 EDT -------
What compiler/os are you using?
------- Comment #3 From 2009-02-05 13:18:21 EDT -------
This happens with both

g++ (Ubuntu 4.3.2-1ubuntu12) 4.3.2

and

g++ (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu3)

It seems that some compilers do not emit the "unused return value" warning. As
an alternative to my patch, I would suggest to add a "-Dwarn_unused_result= "
string to the g++ command line to suppress the warning.
------- Comment #4 From 2009-02-05 13:30:39 EDT -------
I committed a change to assign the return code to a variable with __attribute
__ ((unused)).

Please pull from craigdo/ns-3-tap and see if this works for you as I cannot yet
manage to run this code through the nightly build mechanism.
------- Comment #5 From 2009-02-05 14:29:55 EDT -------
Ok, now it works with:
g++ (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu3)