Bug 1371

Summary: [LLVM] error: struct 'TestCase' was previously declared as a class
Product: ns-3 Reporter: Gustavo J. A. M. Carneiro <gjcarneiro>
Component: coreAssignee: Mathieu Lacage <mathieu.lacage>
Status: RESOLVED FIXED    
Severity: normal CC: ns-bugs
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   

Description Gustavo J. A. M. Carneiro 2012-02-22 06:28:41 UTC
../src/core/model/test.cc:226:3: error: struct 'TestCase' was previously declared as a class [-Werror,-Wmismatched-tags]
  struct TestCase *current = m_parent;
  ^~~~~~
  class
In file included from ../src/core/model/test.cc:19:
../src/core/model/test.h:834:7: note: previous use is here
class TestCase
      ^
1 error generated.
Comment 1 Gustavo J. A. M. Carneiro 2012-02-22 08:54:47 UTC
Also this is needed to make clang happy:

diff -r 6b9082bd091b src/core/model/test.h
--- a/src/core/model/test.h	Wed Feb 22 13:51:28 2012 +0000
+++ b/src/core/model/test.h	Wed Feb 22 13:52:07 2012 +0000
@@ -45,7 +45,7 @@
   do {                                          \
     if (MustAssertOnFailure ())                 \
       {                                         \
-        *(int *)0 = 0;                          \
+        *(volatile int *)0 = 0;                 \
       }                                         \
   } while (false)

To fix this error:


../src/wimax/test/wimax-fragmentation-test.cc:113:11: error: indirection of non-volatile null pointer will be deleted, not trap
      [-Werror,-Wnull-dereference]
          NS_TEST_EXPECT_MSG_EQ (((type >> 2) & 1), 1, "The packet is not a fragment");
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../src/wimax/test/wimax-fragmentation-test.cc:23:
./ns3/test.h:230:3: note: instantiated from:
  NS_TEST_EXPECT_MSG_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
  ^
./ns3/test.h:189:9: note: instantiated from:
        ASSERT_ON_FAILURE;                                              \
        ^
./ns3/test.h:48:9: note: instantiated from:
        *(int *)0 = 0;                          \
        ^~~~~~~~~
../src/wimax/test/wimax-fragmentation-test.cc:113:11: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
Comment 2 Mathieu Lacage 2012-02-24 03:39:25 UTC
changeset 0ee272dab97b
Comment 3 Mathieu Lacage 2012-02-24 03:47:37 UTC
changeset: fcf4778c9b16