]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
Work around for deficiency in C++11/14/17 standard
authorMatthew Barr <matthew.barr@intel.com>
Sun, 8 Jan 2017 22:30:03 +0000 (09:30 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 26 Apr 2017 04:41:29 +0000 (14:41 +1000)
As explained to us by STL at Microsoft (the author of their
vector), there is a hole in the standard wrt the vector copy
constructor, which always exists even if it won't compile.

src/rose/rose_build_bytecode.cpp
src/rose/rose_build_exclusive.h

index 9f4abcadfb1f9cc16f7bc39cf71af85ecbd84eef..daf827e9ddcdb8db01d0ae5238ec5b1677941b5a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -248,6 +248,30 @@ struct build_context : boost::noncopyable {
     rose_group squashable_groups = 0;
 };
 
+/** \brief subengine info including built engine and
+* corresponding triggering rose vertices */
+struct ExclusiveSubengine {
+    aligned_unique_ptr<NFA> nfa;
+    vector<RoseVertex> vertices;
+};
+
+/** \brief exclusive info to build tamarama */
+struct ExclusiveInfo {
+    // subengine info
+    vector<ExclusiveSubengine> subengines;
+    // all the report in tamarama
+    set<ReportID> reports;
+    // assigned queue id
+    u32 queue;
+
+    // workaround a deficiency in the standard (as explained by STL @ MS) we
+    // need to tell the compiler that ExclusiveInfo is moveable-only by
+    // deleting the copy cons so that vector doesn't get confused
+    ExclusiveInfo() = default;
+    ExclusiveInfo(const ExclusiveInfo &) = delete;
+    ExclusiveInfo(ExclusiveInfo &&) = default;
+};
+
 }
 
 static
index 9cabb1d2853de40a93c54354518d4b06106e5d59..3269dce612c0c4fcad68ac0c74c50211a750e683 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Intel Corporation
+ * Copyright (c) 2017, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
 
 namespace ue2 {
 
-/** brief subengine info including built engine and
- * corresponding triggering rose vertices */
-struct ExclusiveSubengine {
-    aligned_unique_ptr<NFA> nfa;
-    std::vector<RoseVertex> vertices;
-};
-
-/** \brief exclusive info to build tamarama */
-struct ExclusiveInfo {
-    // subengine info
-    std::vector<ExclusiveSubengine> subengines;
-    // all the report in tamarama
-    std::set<ReportID> reports;
-    // assigned queue id
-    u32 queue;
-};
-
 /** \brief role info structure for exclusive analysis */
 template<typename role_id>
 struct RoleInfo {