Bug 1779 - NS_UNUSED_GLOBAL not working in attribute test class declaration
NS_UNUSED_GLOBAL not working in attribute test class declaration
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
pre-release
PC Linux
: P5 normal
Assigned To: Vedran Miletić
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-20 22:27 UTC by Tom Henderson
Modified: 2013-10-21 04:39 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Henderson 2013-10-20 22:27:58 UTC
Observed on Fedora Core 19, 64bit system, gcc-4.8.1, after the clang patch merge:

In file included from ./ns3/nstime.h:27:0,
                 from ../src/core/test/attribute-test-suite.cc:36:
./ns3/unused.h:10:54: error: ‘unused’ attribute ignored [-Werror=attributes]
 # define NS_UNUSED_GLOBAL(x) x __attribute__((unused))
                                                      ^
../src/core/test/attribute-test-suite.cc:228:8: note: in expansion of macro ‘NS_UNUSED_GLOBAL’
   bool NS_UNUSED_GLOBAL (m_boolTest);
        ^
./ns3/unused.h:10:54: error: ‘unused’ attribute ignored [-Werror=attributes]
 # define NS_UNUSED_GLOBAL(x) x __attribute__((unused))
                                                      ^
../src/core/test/attribute-test-suite.cc:229:11: note: in expansion of macro ‘NS_UNUSED_GLOBAL’
   int16_t NS_UNUSED_GLOBAL (m_int16);
           ^
./ns3/unused.h:10:54: error: ‘unused’ attribute ignored [-Werror=attributes]
 # define NS_UNUSED_GLOBAL(x) x __attribute__((unused))
                                                      ^
../src/core/test/attribute-test-suite.cc:230:11: note: in expansion of macro ‘NS_UNUSED_GLOBAL’
   int16_t NS_UNUSED_GLOBAL (m_int16WithBounds);
           ^
./ns3/unused.h:10:54: error: ‘unused’ attribute ignored [-Werror=attributes]
 # define NS_UNUSED_GLOBAL(x) x __attribute__((unused))
                                                      ^
../src/core/test/attribute-test-suite.cc:232:11: note: in expansion of macro ‘NS_UNUSED_GLOBAL’
   uint8_t NS_UNUSED_GLOBAL (m_uint8);
           ^
./ns3/unused.h:10:54: error: ‘unused’ attribute ignored [-Werror=attributes]
 # define NS_UNUSED_GLOBAL(x) x __attribute__((unused))
                                                      ^
../src/core/test/attribute-test-suite.cc:233:9: note: in expansion of macro ‘NS_UNUSED_GLOBAL’
   float NS_UNUSED_GLOBAL (m_float);
         ^
./ns3/unused.h:10:54: error: ‘unused’ attribute ignored [-Werror=attributes]
 # define NS_UNUSED_GLOBAL(x) x __attribute__((unused))
                                                      ^
../src/core/test/attribute-test-suite.cc:234:15: note: in expansion of macro ‘NS_UNUSED_GLOBAL’
   enum Test_e NS_UNUSED_GLOBAL (m_enum);
               ^
cc1plus: all warnings being treated as errors


I found this on the web, describing possible gcc-4.8.1 problem:
http://readlist.com/lists/gcc.gnu.org/gcc-help/6/31119.html

However, I also found problems on gcc-4.6.3:

lback-test-suite.cc.3.o
[1401/2177] cxx: src/core/test/command-line-test-suite.cc -> build/src/core/test/command-line-test-suite.cc.3.o
../src/core/test/attribute-test-suite.cc:228:8: error: ‘unused’ attribute ignored [-Werror=attributes]
../src/core/test/attribute-test-suite.cc:229:11: error: ‘unused’ attribute ignored [-Werror=attributes]
../src/core/test/attribute-test-suite.cc:230:11: error: ‘unused’ attribute ignored [-Werror=attributes]
../src/core/test/attribute-test-suite.cc:232:11: error: ‘unused’ attribute ignored [-Werror=attributes]
../src/core/test/attribute-test-suite.cc:233:9: error: ‘unused’ attribute ignored [-Werror=attributes]
../src/core/test/attribute-test-suite.cc:234:15: error: ‘unused’ attribute ignored [-Werror=attributes]


so perhaps we should go back to Vedran's original suggested patch for attribute-test-suite.cc?
Comment 1 Vedran Miletić 2013-10-21 04:39:35 UTC
Fixed in a bit nicer way, by using NS_UNUSED inside constructor as in LTE tests previously.

changeset:   10220:fd5b94ebc43f
tag:         tip
user:        Vedran Miletić <rivanvx@gmail.com>
date:        Mon Oct 21 10:38:06 2013 +0200
summary:     Bug 1779 - NS_UNUSED_GLOBAL not working in attribute test class declaration

Sorry for this, well, it seemed to compile nicely.