Older C++ compilers complain about the use of a class with a non trivial
constructor in a union.  Change the ProtoState class to use an init fn
instead of a constructor.

=== modified file 'parser/libapparmor_re/hfa.cc'
--- parser/libapparmor_re/hfa.cc        2012-03-22 20:21:55 +0000
+++ parser/libapparmor_re/hfa.cc        2012-05-28 10:32:39 +0000
@@ -101,7 +101,8 @@
        nnodev = nnodes_cache.insert(nnodes);
        anodes = anodes_cache.insert(anodes);
 
-       ProtoState proto(nnodev, anodes);
+       ProtoState proto;
+       proto.init(nnodev, anodes);
        State *state = new State(node_map.size(), proto, other);
        pair<NodeMap::iterator,bool> x = node_map.insert(proto, state);
        if (x.second == false) {

=== modified file 'parser/libapparmor_re/hfa.h'
--- parser/libapparmor_re/hfa.h 2012-03-22 20:21:55 +0000
+++ parser/libapparmor_re/hfa.h 2012-05-28 10:01:26 +0000
@@ -310,7 +310,15 @@
        hashedNodeVec *nnodes;
        NodeSet *anodes;
 
-       ProtoState(hashedNodeVec *n, NodeSet *a = NULL): nnodes(n), anodes(a) { 
};
+       /* init is used instead of a constructor because ProtoState is used
+        * in a union
+        */
+       void init(hashedNodeVec *n, NodeSet *a = NULL)
+       {
+               nnodes = n;
+               anodes = a;
+       }
+
        bool operator<(ProtoState const &rhs)const
        {
                if (nnodes == rhs.nnodes)
@@ -338,7 +346,7 @@
  * parition: Is a temporary work variable used during dfa minimization.
  *           it can be replaced with a map, but that is slower and uses more
  *           memory.
- * nodes: Is a temporary work variable used during dfa creation.  It can
+ * proto: Is a temporary work variable used during dfa creation.  It can
  *        be replaced by using the nodemap, but that is slower
  */
 class State {
@@ -379,8 +387,8 @@
 
        /* temp storage for State construction */
        union {
-               Partition *partition;
-               ProtoState proto;
+               Partition *partition;   /* used during minimization */
+               ProtoState proto;       /* used during creation */
        };
 };
 

-- 
AppArmor mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to