Bug 488

Summary: [ns-3-tap] tap-bridge.cc fails to compile in optimized mode
Product: ns-3 Reporter: Francesco Malandrino <francesco.malandrino>
Component: devicesAssignee: Craig Dowell <craigdo>
Status: RESOLVED FIXED    
Severity: minor CC: craigdo, francesco.malandrino
Priority: P5    
Version: pre-release   
Hardware: All   
OS: Linux   
Attachments: The patch

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)