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
Product: ns-3
Classification: Unclassified
Component: devices
pre-release
All Linux
: P5 minor
Assigned To: Craig Dowell
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-02-05 05:49 UTC by Francesco Malandrino
Modified: 2009-02-05 14:44 UTC (History)
2 users (show)

See Also:


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

Note You need to log in before you can comment on or make changes to this bug.
Description Francesco Malandrino 2009-02-05 05:49:24 UTC
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 Francesco Malandrino 2009-02-05 05:50:21 UTC
Created attachment 371 [details]
The patch
Comment 2 Craig Dowell 2009-02-05 12:46:16 UTC
What compiler/os are you using?
Comment 3 Francesco Malandrino 2009-02-05 13:18:21 UTC
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 Craig Dowell 2009-02-05 13:30:39 UTC
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 Francesco Malandrino 2009-02-05 14:29:55 UTC
Ok, now it works with:
g++ (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu3)