summaryrefslogtreecommitdiff
path: root/tests/test_table.cc
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2019-03-27 15:32:05 -0700
committerGitHub <noreply@github.com>2019-03-27 15:32:05 -0700
commitcf35baa1ad70f0dca734f93bcc2b54d8d059bcdd (patch)
tree3c9881fcceaba1dbb5f04fe01ddc5f2dc5c647d1 /tests/test_table.cc
parent928ef7f2c02f18d9945dd750884dffbdebef1b98 (diff)
Moved macros from upb.h to port_def.inc to avoid leaking them to users. (#160)
* Use port_def.inc to prevent macros from leaking to users. * Added helpful comments to port_def.inc/port_undef.inc.
Diffstat (limited to 'tests/test_table.cc')
-rw-r--r--tests/test_table.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/test_table.cc b/tests/test_table.cc
index 96a5387..063eb68 100644
--- a/tests/test_table.cc
+++ b/tests/test_table.cc
@@ -6,15 +6,18 @@
#include <limits.h>
#include <string.h>
#include <sys/resource.h>
-#include <ext/hash_map>
#include <iostream>
#include <map>
#include <set>
#include <string>
+#include <unordered_map>
#include <vector>
+
#include "tests/upb_test.h"
#include "upb/table.int.h"
+#include "upb/port_def.inc"
+
// Convenience interface for C++. We don't put this in upb itself because
// the table is not exposed to users.
@@ -397,7 +400,7 @@ void test_inttable(int32_t *keys, uint16_t num_entries, const char *desc) {
Table table;
uint32_t largest_key = 0;
std::map<uint32_t, uint32_t> m;
- __gnu_cxx::hash_map<uint32_t, uint32_t> hm;
+ std::unordered_map<uint32_t, uint32_t> hm;
for(size_t i = 0; i < num_entries; i++) {
int32_t key = keys[i];
largest_key = UPB_MAX((int32_t)largest_key, key);
@@ -546,7 +549,7 @@ void test_inttable(int32_t *keys, uint16_t num_entries, const char *desc) {
total = get_usertime() - before;
printf("%ld/s (%0.1f%% of upb)\n", (long)(i/total), i / upb_rand_i);
- printf("__gnu_cxx::hash_map<uint32_t, uint32_t>(seq): ");
+ printf("std::unordered_map<uint32_t, uint32_t>(seq): ");
fflush(stdout);
before = get_usertime();
for(i = 0; true; i++) {
@@ -557,7 +560,7 @@ void test_inttable(int32_t *keys, uint16_t num_entries, const char *desc) {
total = get_usertime() - before;
printf("%ld/s (%0.1f%% of upb)\n", (long)(i/total), i / upb_seq_i);
- printf("__gnu_cxx::hash_map<uint32_t, uint32_t>(rand): ");
+ printf("std::unordered_map<uint32_t, uint32_t>(rand): ");
fflush(stdout);
before = get_usertime();
for(i = 0; true; i++) {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback