Skip to content

Commit ee8bdf1

Browse files
committed
Fix NVHPC Toml11 open mode
1 parent 5105af1 commit ee8bdf1

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/IO/JSON/JSONIOHandlerImpl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,19 +1320,23 @@ JSONIOHandlerImpl::getFilehandle(File fileName, Access access)
13201320
*/
13211321
std::ios_base::openmode openmode =
13221322
std::ios_base::out | std::ios_base::trunc;
1323+
#if !__NVCOMPILER
13231324
if (m_fileFormat == FileFormat::Toml)
13241325
{
13251326
openmode |= std::ios_base::binary;
13261327
}
1328+
#endif
13271329
fs->open(path, openmode);
13281330
break;
13291331
}
13301332
case Access::READ_ONLY: {
13311333
std::ios_base::openmode openmode = std::ios_base::in;
1334+
#if !__NVCOMPILER
13321335
if (m_fileFormat == FileFormat::Toml)
13331336
{
13341337
openmode |= std::ios_base::binary;
13351338
}
1339+
#endif
13361340
fs->open(path, openmode);
13371341
break;
13381342
}

src/auxiliary/JSON.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,7 @@ namespace
294294
}
295295
else
296296
{
297-
std::istringstream istream(
298-
options.c_str(), std::ios_base::binary | std::ios_base::in);
297+
std::istringstream istream(options.c_str(), std::ios_base::in);
299298
toml::value tomlVal =
300299
toml::parse(istream, "[inline TOML specification]");
301300
res.config = json::tomlToJson(tomlVal);
@@ -315,7 +314,13 @@ ParsedConfig parseOptions(std::string const &options, bool considerFiles)
315314
{
316315
std::fstream handle;
317316
handle.open(
318-
filename.value(), std::ios_base::binary | std::ios_base::in);
317+
filename.value(),
318+
#if __NVCOMPILER
319+
std::ios_base::in
320+
#else
321+
std::ios_base::binary | std::ios_base::in
322+
#endif
323+
);
319324
ParsedConfig res;
320325
if (auxiliary::ends_with(filename.value(), ".toml"))
321326
{
@@ -358,7 +363,12 @@ parseOptions(std::string const &options, MPI_Comm comm, bool considerFiles)
358363
{
359364
std::istringstream istream(
360365
fileContent.c_str(),
361-
std::ios_base::binary | std::ios_base::in);
366+
#if __NVCOMPILER
367+
std::ios_base::in
368+
#else
369+
std::ios_base::binary | std::ios_base::in
370+
#endif
371+
);
362372
res.config = tomlToJson(toml::parse(istream, filename.value()));
363373
res.originallySpecifiedAs = SupportedLanguages::TOML;
364374
}

0 commit comments

Comments
 (0)