[Mesa-dev] [PATCH v2 13/15] nv50/ir: use C++11 compliant unordered_set if possible

Chih-Wei Huang cwhuang at android-x86.org
Tue May 19 20:25:37 PDT 2015


If build with C++11 standard, use std::unordered_set
instead of std::tr1::unordered_set.

Signed-off-by: Chih-Wei Huang <cwhuang at linux.org.tw>
---
 Android.common.mk                             | 1 +
 src/gallium/auxiliary/Android.mk              | 2 --
 src/gallium/drivers/nouveau/codegen/nv50_ir.h | 8 ++++++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Android.common.mk b/Android.common.mk
index 43766bf..45474ee 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -77,6 +77,7 @@ LOCAL_CFLAGS += \
 endif
 
 LOCAL_CPPFLAGS += \
+	-std=c++11 \
 	-Wno-error=non-virtual-dtor \
 	-Wno-non-virtual-dtor
 
diff --git a/src/gallium/auxiliary/Android.mk b/src/gallium/auxiliary/Android.mk
index 2d91752..4a914ab 100644
--- a/src/gallium/auxiliary/Android.mk
+++ b/src/gallium/auxiliary/Android.mk
@@ -39,8 +39,6 @@ ifeq ($(MESA_ENABLE_LLVM),true)
 LOCAL_SRC_FILES += \
 	$(GALLIVM_SOURCES) \
 	$(GALLIVM_CPP_SOURCES)
-
-LOCAL_CPPFLAGS := -std=c++11
 endif
 
 LOCAL_MODULE := libmesa_gallium
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
index f4d52b7..f8316f7 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
@@ -29,7 +29,13 @@
 #include <deque>
 #include <list>
 #include <vector>
+#if __cplusplus >= 201103L
+#include <unordered_set>
+typedef std::unordered_set<void *> voidptr_unordered_set;
+#else
 #include <tr1/unordered_set>
+typedef std::tr1::unordered_set<void *> voidptr_unordered_set;
+#endif
 
 #include "codegen/nv50_ir_util.h"
 #include "codegen/nv50_ir_graph.h"
@@ -451,8 +457,6 @@ struct Storage
 #define NV50_IR_INTERP_OFFSET      (2 << 2)
 #define NV50_IR_INTERP_SAMPLEID    (3 << 2)
 
-typedef std::tr1::unordered_set<void *> voidptr_unordered_set;
-
 template <typename V>
 class ptr_unordered_set : public voidptr_unordered_set {
   public:
-- 
1.9.1



More information about the mesa-dev mailing list