Browse Source

Merge pull request #270 from npmccallum/gcc

Two minor compile fixes on GCC 8.1.1
Li Xun 5 years ago
parent
commit
a911f996de

+ 4 - 4
sdk/protected_fs/sgx_tprotected_fs/file_read_write.cpp

@@ -425,7 +425,7 @@ file_data_node_t* protected_fs_file::append_data_node()
 	try {
 		new_file_data_node = new file_data_node_t;
 	}
-	catch (std::bad_alloc e) {
+	catch (std::bad_alloc& e) {
 		(void)e; // remove warning
 		last_error = ENOMEM;
 		return NULL;
@@ -471,7 +471,7 @@ file_data_node_t* protected_fs_file::read_data_node()
 	try {
 		file_data_node = new file_data_node_t;
 	}
-	catch (std::bad_alloc e) {
+	catch (std::bad_alloc& e) {
 		(void)e; // remove warning
 		last_error = ENOMEM;
 		return NULL;
@@ -563,7 +563,7 @@ file_mht_node_t* protected_fs_file::append_mht_node(uint64_t mht_node_number)
 	try {
 		new_file_mht_node = new file_mht_node_t;
 	}
-	catch (std::bad_alloc e) {
+	catch (std::bad_alloc& e) {
 		(void)e; // remove warning
 		last_error = ENOMEM;
 		return NULL;
@@ -609,7 +609,7 @@ file_mht_node_t* protected_fs_file::read_mht_node(uint64_t mht_node_number)
 	try {
 		file_mht_node = new file_mht_node_t;
 	}
-	catch (std::bad_alloc e) {
+	catch (std::bad_alloc& e) {
 		(void)e; // remove warning
 		last_error = ENOMEM;
 		return NULL;

+ 2 - 2
sdk/protected_fs/sgx_tprotected_fs/lru_cache.cpp

@@ -76,7 +76,7 @@ bool lru_cache::add(uint64_t key, void* data)
 		map_node = new map_node_t();
 		list_node = new list_node_t();
 	}
-	catch (std::bad_alloc e) {
+	catch (std::bad_alloc& e) {
 		(void)e; // remove warning
 		return false;
 	}
@@ -131,7 +131,7 @@ void* lru_cache::get(uint64_t key)
 			list_node = new list_node_t();
 			list_node->key = map_it->first;
 		}
-		catch (std::bad_alloc e) {
+		catch (std::bad_alloc& e) {
 			(void)e; // remove warning
 			return NULL;
 		}

+ 1 - 1
sdk/protected_fs/sgx_tprotected_fs/sgx_tprotected_fs.cpp

@@ -49,7 +49,7 @@ static SGX_FILE* sgx_fopen_internal(const char* filename, const char* mode, cons
 	try {
 		file = new protected_fs_file(filename, mode, auto_key, kdk_key);
 	}
-	catch (std::bad_alloc e) {
+	catch (std::bad_alloc& e) {
 		(void)e; // remove warning
 		errno = ENOMEM;
 		return NULL;

+ 2 - 2
sdk/trts/init_enclave.cpp

@@ -140,12 +140,12 @@ extern "C" int init_enclave(void *enclave_base, void *ms)
 
     // optimized libs
     if (SDK_VERSION_2_0 < g_sdk_version) {
-		if(0 != init_optimized_libs((const uint64_t)sys_features.cpu_features, (uint32_t*)sys_features.cpuinfo_table, xfrm))
+		if (0 != init_optimized_libs(sys_features.cpu_features, (uint32_t*)sys_features.cpuinfo_table, xfrm))
 		{
 			return -1;
 		}
 	} else {
-		if(0 != init_optimized_libs((const uint64_t)sys_features.cpu_features, NULL, xfrm))
+		if (0 != init_optimized_libs(sys_features.cpu_features, NULL, xfrm))
 		{
 			return -1;
 		}