From 6094a48ec821a52731172f3471dce4923a482cd1 Mon Sep 17 00:00:00 2001 From: Vladimir Mezentsev Date: Fri, 27 May 2022 19:54:26 -0700 Subject: [PATCH] gprofng: fix build with -mx32 gprofng/ChangeLog 2022-05-27 Vladimir Mezentsev PR gprofng/28983 PR gprofng/29143 * src/Experiment.cc (write_header): Fix argument for ctime. Fix -Wformat= warnings. * src/Dbe.cc: Likewise. * src/DwarfLib.h: Fix [-Wsign-compare] warnings. * src/Experiment.h: Likewise. * src/ipc.cc: Fix -Wformat= warnings. --- gprofng/src/Dbe.cc | 14 ++++++-------- gprofng/src/DwarfLib.h | 6 +++--- gprofng/src/Experiment.cc | 16 ++++++++++------ gprofng/src/Experiment.h | 2 +- gprofng/src/ipc.cc | 2 +- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/gprofng/src/Dbe.cc b/gprofng/src/Dbe.cc index 1a6e5214581..d2cd94bfc19 100644 --- a/gprofng/src/Dbe.cc +++ b/gprofng/src/Dbe.cc @@ -1944,21 +1944,19 @@ dbeGetOverviewText (int dbevindex) info->append (dbe_sprintf (GTXT (" Target : '%s'"), field)); field = exp->hostname; if (field && field[0]) - info->append (dbe_sprintf (NTXT (" %s %s (%s, %s)"), - GTXT ("Host :"), + info->append (dbe_sprintf (GTXT (" Host : %s (%s, %s)"), field, exp->architecture ? exp->architecture : GTXT (""), exp->os_version ? exp->os_version : GTXT (""))); - long start_sec = exp->start_sec; - char *p = ctime (&start_sec); // does this need to be freed? YXXX + time_t start_sec = (time_t) exp->start_sec; + char *p = ctime (&start_sec); hrtime_t tot_time = dbeCalcGroupDuration (grInd); double seconds = tot_time * 1.e-9; - info->append (dbe_sprintf (NTXT (" %s %s %s %0.3f %s"), - GTXT ("Start Time :"), p, - GTXT ("Duration :"), seconds, - GTXT ("Seconds"))); + info->append (dbe_sprintf ( + GTXT (" Start Time : %s Duration : %0.3f Seconds"), + p, seconds)); // Number of descendants/processes would be nice info->append (dbe_strdup (NTXT (""))); } diff --git a/gprofng/src/DwarfLib.h b/gprofng/src/DwarfLib.h index 95eff5751ff..07bd60fcb44 100644 --- a/gprofng/src/DwarfLib.h +++ b/gprofng/src/DwarfLib.h @@ -152,9 +152,9 @@ private: uint64_t timestamp; uint64_t file_size; uint64_t address; - uint32_t file; - uint32_t line; - uint32_t column; + int file; + int line; + int column; Dwarf_Half version; uint64_t op_index_register; Dwarf_Small maximum_operations_per_instruction; diff --git a/gprofng/src/Experiment.cc b/gprofng/src/Experiment.cc index a23c10c30a3..c797724af07 100644 --- a/gprofng/src/Experiment.cc +++ b/gprofng/src/Experiment.cc @@ -644,7 +644,7 @@ Experiment::ExperimentHandler::startElement (char*, char*, char *qName, Attribut exp->exp_start_time = ts; str = attrs->getValue (NTXT ("time")); if (str != NULL) - exp->start_sec = atol (str); + exp->start_sec = atoll (str); str = attrs->getValue (NTXT ("pid")); if (str != NULL) exp->pid = atoi (str); @@ -4136,7 +4136,8 @@ Experiment::write_header () if (dbeSession->ipc_mode || dbeSession->rdt_mode) { // In GUI: print start time at the beginning - char *start_time = ctime (&start_sec); + time_t t = (time_t) start_sec; + char *start_time = ctime (&t); if (start_time != NULL) { sb.setLength (0); @@ -4258,7 +4259,8 @@ Experiment::write_header () } // add comment for start time - char *p = ctime (&start_sec); + time_t t = (time_t) start_sec; + char *p = ctime (&t); sb.setLength (0); if (p != NULL) sb.sprintf (GTXT ("Experiment started %s"), p); @@ -6444,9 +6446,11 @@ Experiment::dump_map (FILE *outfile) load.tv_nsec += NANOSEC; } fprintf (outfile, - "0x%08llx %8lld (0x%08llx) %5ld.%09ld %5ld.%09ld \"%s\"\n", - s->base, s->size, s->size, load.tv_sec, load.tv_nsec, - unload.tv_sec, unload.tv_nsec, s->obj->get_name ()); + "0x%08llx %8lld (0x%08llx) %5lld.%09lld %5lld.%09lld \"%s\"\n", + (long long) s->base, (long long) s->size, (long long) s->size, + (long long) load.tv_sec, (long long) load.tv_nsec, + (long long) unload.tv_sec, (long long) unload.tv_nsec, + s->obj->get_name ()); } fprintf (outfile, NTXT ("\n")); } diff --git a/gprofng/src/Experiment.h b/gprofng/src/Experiment.h index 41c44e4a08a..17c91bda23e 100644 --- a/gprofng/src/Experiment.h +++ b/gprofng/src/Experiment.h @@ -114,7 +114,7 @@ public: // Configuration Information char *hostname; // Hosthame (e.g. mymachine) - long start_sec; // Starting timeval secs. + hrtime_t start_sec; // Starting timeval secs. char *username; // name of person performing the test char *architecture; // Architecture name ("sun4") Platform_t platform; // Sparc,Sparcv9,Intel diff --git a/gprofng/src/ipc.cc b/gprofng/src/ipc.cc index 932423cdf0d..edc70256a68 100644 --- a/gprofng/src/ipc.cc +++ b/gprofng/src/ipc.cc @@ -1281,7 +1281,7 @@ ipc_doWork (void *arg) { int arg1 = readInt (req); uint64_t arg2 = readLong (req); - ipc_log (" args = %d, %ld\n", arg1, arg2); + ipc_log (" args = %d, %lld\n", arg1, (long long) arg2); dbeSetSelObjV2 (arg1, arg2); writeString (NULL, req); } -- 2.30.2