Skip to content

Commit d5231d0

Browse files
mnaczkigcbot
authored andcommitted
More portable use of strerror_r third attempt
Response to issue #213 Use overload function to solve the issue
1 parent 373d8b0 commit d5231d0

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

visa/iga/IGALibrary/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
##############################################
1111
# IGA dynamic and static library generation
1212

13-
set(CMAKE_CXX_STANDARD 17)
13+
set(CMAKE_CXX_STANDARD 14)
1414

1515
##############################################
1616
# compute the version string from the git repo

visa/iga/IGALibrary/system.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ SPDX-License-Identifier: MIT
3232
#include <sstream>
3333
#include <string>
3434
#include <vector>
35-
#include <type_traits>
3635

3736
using namespace iga;
3837

@@ -243,6 +242,14 @@ unsigned iga::LastError()
243242
#endif // _WIN32
244243
}
245244

245+
static void add_strerror_r_to_error(char *errMsg, int strerror_r_return_value)
246+
{
247+
}
248+
static void add_strerror_r_to_error(char *errMsg, char *strerror_r_return_value)
249+
{
250+
errMsg = strerror_r_return_value;
251+
}
252+
246253
std::string iga::FormatLastError(unsigned errCode)
247254
{
248255
std::string msg;
@@ -262,10 +269,7 @@ std::string iga::FormatLastError(unsigned errCode)
262269
#else
263270
// Response to issue https://github.com/intel/intel-graphics-compiler/issues/213
264271
auto strerror_r_return_value = strerror_r(errCode, buf, sizeof(buf));
265-
if constexpr (std::is_same<decltype(strerror_r_return_value), char*>::value)
266-
{
267-
errMsg = strerror_r_return_value;
268-
}
272+
add_strerror_r_to_error(errMsg, strerror_r_return_value);
269273
#endif // _WIN32
270274
if (errMsg == nullptr || errMsg[0] == 0)
271275
return "???";

0 commit comments

Comments
 (0)