Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#647 fix format-string type warnings #747

Merged
merged 1 commit into from
Apr 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/vt/trace/trace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,8 @@ void Trace::writeTracesFile(int flush, bool is_incremental_flush) {
"Event must exist that was logged"
);

TraceEntrySeqType event_seq_id = log.ep == no_trace_entry_id
// Widen to unsigned long for %lu format
unsigned long event_seq_id = log.ep == no_trace_entry_id
? 0 // no_trace_entry_seq != 0 (perhaps shift offsets..).
: TraceRegistry::getEvent(log.ep).theEventSeq();

Expand All @@ -915,7 +916,7 @@ void Trace::writeTracesFile(int flush, bool is_incremental_flush) {
auto const& sdata = log.sys_data();
gzprintf(
gzfile,
"%d %d %lu %lld %d %d %d 0 %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " 0\n",
"%d %d %lu %lld %d %d %zu 0 %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " 0\n",
type,
eTraceEnvelopeTypes::ForChareMsg,
event_seq_id,
Expand All @@ -934,7 +935,7 @@ void Trace::writeTracesFile(int flush, bool is_incremental_flush) {
auto const& sdata = log.sys_data();
gzprintf(
gzfile,
"%d %d %lu %lld %d %d %d 0 %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " 0\n",
"%d %d %lu %lld %d %d %zu 0 %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " 0\n",
type,
eTraceEnvelopeTypes::ForChareMsg,
event_seq_id,
Expand Down Expand Up @@ -974,15 +975,14 @@ void Trace::writeTracesFile(int flush, bool is_incremental_flush) {
auto const& sdata = log.sys_data();
gzprintf(
gzfile,
"%d %d %lu %lld %d %d %d %d %d\n",
"%d %d %lu %lld %d %d %zu 0 %d\n",
type,
eTraceEnvelopeTypes::ForChareMsg,
event_seq_id,
converted_time,
log.event,
log.node,
sdata.msg_len,
0,
num_nodes
);
break;
Expand All @@ -991,7 +991,7 @@ void Trace::writeTracesFile(int flush, bool is_incremental_flush) {
auto const& sdata = log.sys_data();
gzprintf(
gzfile,
"%d %d %lu %lld %d %d %d 0\n",
"%d %d %lu %lld %d %d %zu 0\n",
type,
eTraceEnvelopeTypes::ForChareMsg,
event_seq_id,
Expand Down Expand Up @@ -1068,11 +1068,11 @@ void Trace::writeTracesFile(int flush, bool is_incremental_flush) {
);
break;
}
case TraceConstantsType::MessageRecv:
vtAssert(false, "Message receive log type unimplemented");
break;
default:
vtAssertInfo(false, "Unimplemented log type", converted_time, log.node);
auto log_type = static_cast<std::underlying_type<TraceConstantsType>::type>(log.type);
vtAssertInfo(false,
"Unimplemented log type", converted_time, log.node, log_type
);
}

// Poof!
Expand Down
4 changes: 2 additions & 2 deletions src/vt/vrt/collection/balance/proc_stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ void StatsRestartReader::inputStatsFile(
fpos_t pos;
bool finished = false;
while (!finished) {
if (fscanf(pFile, "%zu %c %llu %c %lf", &phaseID, &separator, &elmID,
&separator, &tval) > 0) {
if (fscanf(pFile, "%zu %c %lu %c %lf",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or change ElementIDType to be large enough for llu.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, in this case it might be better to capture to a unsigned long local and convert before use to minimize changes..

&phaseID, &separator, &elmID, &separator, &tval) > 0) {
fgetpos (pFile,&pos);
fscanf (pFile, "%c", &separator);
if (separator == ',') {
Expand Down