diff options
author | Vladimir Mezentsev <vladimir.mezentsev@oracle.com> | 2023-10-23 19:55:01 -0700 |
---|---|---|
committer | Vladimir Mezentsev <vladimir.mezentsev@oracle.com> | 2023-10-24 23:27:30 -0700 |
commit | 53beac2e23bcffe632bb837c97003998e6986ce9 (patch) | |
tree | 5376681dc206ebe3764915e873daf7cb89905a6c /gprofng/libcollector/hwprofile.c | |
parent | 7ac6d0c38c365a6778a91fd37203c21561c61c4c (diff) | |
download | binutils-53beac2e23bcffe632bb837c97003998e6986ce9.zip binutils-53beac2e23bcffe632bb837c97003998e6986ce9.tar.gz binutils-53beac2e23bcffe632bb837c97003998e6986ce9.tar.bz2 |
gprofng: Fix -Wformat= warnings
Added format attribute to several gprofng functions.
Fixed -Wformat= warnings.
gprofng/ChangeLog
2023-10-23 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
* libcollector/heaptrace.c: Fixed -Wformat= warnings.
* libcollector/hwprofile.c: Likewise.
* libcollector/iolib.c: Likewise.
* libcollector/iotrace.c: Likewise.
* libcollector/jprofile.c: Likewise.
* libcollector/profile.c: Likewise.
* libcollector/synctrace.c: Likewise.
* src/ClassFile.cc: Likewise.
* src/SourceFile.cc: Likewise.
* libcollector/libcol_util.h: Added format attribute.
* src/Emsg.h: Likewise.
* src/collector_module.h: Likewise.
* src/data_pckts.h: Define fld_sizeof.
Diffstat (limited to 'gprofng/libcollector/hwprofile.c')
-rw-r--r-- | gprofng/libcollector/hwprofile.c | 81 |
1 files changed, 53 insertions, 28 deletions
diff --git a/gprofng/libcollector/hwprofile.c b/gprofng/libcollector/hwprofile.c index 3ca89d1..092d665 100644 --- a/gprofng/libcollector/hwprofile.c +++ b/gprofng/libcollector/hwprofile.c @@ -25,6 +25,7 @@ #include <dlfcn.h> #include <stdlib.h> #include <stdio.h> +#include <stddef.h> #include <unistd.h> #include <errno.h> #include <sys/syscall.h> @@ -823,66 +824,90 @@ hwclogwrite0 () collector_interface->writeLog ("<profdata fname=\"%s\"/>\n", module_interface.description); /* Record Hwcntr_packet description */ - Hwcntr_packet *pp = NULL; collector_interface->writeLog ("<profpckt kind=\"%d\" uname=\"" STXT ("Hardware counter profiling data") "\">\n", HW_PCKT); collector_interface->writeLog (" <field name=\"LWPID\" uname=\"" STXT ("Lightweight process id") "\" offset=\"%d\" type=\"%s\"/>\n", - &pp->comm.lwp_id, sizeof (pp->comm.lwp_id) == 4 ? "INT32" : "INT64"); + (int) offsetof (Hwcntr_packet, comm.lwp_id), + fld_sizeof (Hwcntr_packet, comm.lwp_id) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"THRID\" uname=\"" STXT ("Thread number") "\" offset=\"%d\" type=\"%s\"/>\n", - &pp->comm.thr_id, sizeof (pp->comm.thr_id) == 4 ? "INT32" : "INT64"); + (int) offsetof (Hwcntr_packet, comm.thr_id), + fld_sizeof (Hwcntr_packet, comm.thr_id) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"CPUID\" uname=\"" STXT ("CPU id") "\" offset=\"%d\" type=\"%s\"/>\n", - &pp->comm.cpu_id, sizeof (pp->comm.cpu_id) == 4 ? "INT32" : "INT64"); + (int) offsetof (Hwcntr_packet, comm.cpu_id), + fld_sizeof (Hwcntr_packet, comm.cpu_id) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"TSTAMP\" uname=\"" STXT ("High resolution timestamp") "\" offset=\"%d\" type=\"%s\"/>\n", - &pp->comm.tstamp, sizeof (pp->comm.tstamp) == 4 ? "INT32" : "INT64"); + (int) offsetof (Hwcntr_packet, comm.tstamp), + fld_sizeof (Hwcntr_packet, comm.tstamp) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"FRINFO\" offset=\"%d\" type=\"%s\"/>\n", - &pp->comm.frinfo, sizeof (pp->comm.frinfo) == 4 ? "INT32" : "INT64"); + (int) offsetof (Hwcntr_packet, comm.frinfo), + fld_sizeof (Hwcntr_packet, comm.frinfo) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"HWCTAG\" uname=\"" STXT ("Hardware counter index") "\" offset=\"%d\" type=\"%s\"/>\n", - &pp->tag, sizeof (pp->tag) == 4 ? "INT32" : "INT64"); + (int) offsetof (Hwcntr_packet, tag), + fld_sizeof (Hwcntr_packet, tag) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"HWCINT\" uname=\"" STXT ("Hardware counter interval") "\" offset=\"%d\" type=\"%s\"/>\n", - &pp->interval, sizeof (pp->interval) == 4 ? "INT32" : "INT64"); + (int) offsetof (Hwcntr_packet, interval), + fld_sizeof (Hwcntr_packet, interval) == 4 ? "INT32" : "INT64"); collector_interface->writeLog ("</profpckt>\n"); if (hwcdef_has_memspace) { /* Record MHwcntr_packet description */ - MHwcntr_packet *xpp = NULL; collector_interface->writeLog ("<profpckt kind=\"%d\" uname=\"" STXT ("Hardware counter profiling data") "\">\n", MHWC_PCKT); collector_interface->writeLog (" <field name=\"LWPID\" uname=\"" STXT ("Lightweight process id") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->comm.lwp_id, sizeof (xpp->comm.lwp_id) == 4 ? "INT32" : "INT64"); + (int) offsetof (MHwcntr_packet, comm.lwp_id), + fld_sizeof (MHwcntr_packet, comm.lwp_id) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"THRID\" uname=\"" STXT ("Thread number") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->comm.thr_id, sizeof (xpp->comm.thr_id) == 4 ? "INT32" : "INT64"); + (int) offsetof (MHwcntr_packet, comm.thr_id), + fld_sizeof (MHwcntr_packet, comm.thr_id) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"CPUID\" uname=\"" STXT ("CPU id") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->comm.cpu_id, sizeof (xpp->comm.cpu_id) == 4 ? "INT32" : "INT64"); + (int) offsetof (MHwcntr_packet, comm.cpu_id), + fld_sizeof (MHwcntr_packet, comm.cpu_id) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"TSTAMP\" uname=\"" STXT ("High resolution timestamp") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->comm.tstamp, sizeof (xpp->comm.tstamp) == 4 ? "INT32" : "INT64"); + (int) offsetof (MHwcntr_packet, comm.tstamp), + fld_sizeof (MHwcntr_packet, comm.tstamp) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"FRINFO\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->comm.frinfo, sizeof (xpp->comm.frinfo) == 4 ? "INT32" : "INT64"); + (int) offsetof (MHwcntr_packet, comm.frinfo), + fld_sizeof (MHwcntr_packet, comm.frinfo) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"HWCTAG\" uname=\"" STXT ("Hardware counter index") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->tag, sizeof (xpp->tag) == 4 ? "INT32" : "INT64"); + (int) offsetof (MHwcntr_packet, tag), + fld_sizeof (MHwcntr_packet, tag) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"HWCINT\" uname=\"" STXT ("Hardware counter interval") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->interval, sizeof (xpp->interval) == 4 ? "INT32" : "INT64"); + (int) offsetof (MHwcntr_packet, interval), + fld_sizeof (MHwcntr_packet, interval) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"VADDR\" uname=\"" STXT ("Virtual address (data)") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->ea_vaddr, sizeof (xpp->ea_vaddr) == 4 ? "UINT32" : "UINT64"); + (int) offsetof (MHwcntr_packet, ea_vaddr), + fld_sizeof (MHwcntr_packet, ea_vaddr) == 4 ? "UINT32" : "UINT64"); collector_interface->writeLog (" <field name=\"PADDR\" uname=\"" STXT ("Physical address (data)") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->ea_paddr, sizeof (xpp->ea_paddr) == 4 ? "UINT32" : "UINT64"); + (int) offsetof (MHwcntr_packet, ea_paddr), + fld_sizeof (MHwcntr_packet, ea_paddr) == 4 ? "UINT32" : "UINT64"); collector_interface->writeLog (" <field name=\"VIRTPC\" uname=\"" STXT ("Virtual address (instruction)") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->pc_vaddr, sizeof (xpp->pc_vaddr) == 4 ? "UINT32" : "UINT64"); + (int) offsetof (MHwcntr_packet, pc_vaddr), + fld_sizeof (MHwcntr_packet, pc_vaddr) == 4 ? "UINT32" : "UINT64"); collector_interface->writeLog (" <field name=\"PHYSPC\" uname=\"" STXT ("Physical address (instruction)") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->pc_paddr, sizeof (xpp->pc_paddr) == 4 ? "UINT32" : "UINT64"); + (int) offsetof (MHwcntr_packet, pc_paddr), + fld_sizeof (MHwcntr_packet, pc_paddr) == 4 ? "UINT32" : "UINT64"); collector_interface->writeLog (" <field name=\"EA_PAGESIZE\" uname=\"" STXT ("Page size (data)") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->ea_pagesz, sizeof (xpp->ea_pagesz) == 4 ? "INT32" : "INT64"); + (int) offsetof (MHwcntr_packet, ea_pagesz), + fld_sizeof (MHwcntr_packet, ea_pagesz) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"PC_PAGESIZE\" uname=\"" STXT ("Page size (instruction)") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->pc_pagesz, sizeof (xpp->pc_pagesz) == 4 ? "INT32" : "INT64"); + (int) offsetof (MHwcntr_packet, pc_pagesz), + fld_sizeof (MHwcntr_packet, pc_pagesz) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"EA_LGRP\" uname=\"" STXT ("Page locality group (data)") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->ea_lgrp, sizeof (xpp->ea_lgrp) == 4 ? "INT32" : "INT64"); + (int) offsetof (MHwcntr_packet, ea_lgrp), + fld_sizeof (MHwcntr_packet, ea_lgrp) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"PC_LGRP\" uname=\"" STXT ("Page locality group (instruction)") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->pc_lgrp, sizeof (xpp->pc_lgrp) == 4 ? "INT32" : "INT64"); + (int) offsetof (MHwcntr_packet, pc_lgrp), + fld_sizeof (MHwcntr_packet, pc_lgrp) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"LWP_LGRP_HOME\" uname=\"" STXT ("LWP home lgroup id") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->lgrp_lwp, sizeof (xpp->lgrp_lwp) == 4 ? "INT32" : "INT64"); + (int) offsetof (MHwcntr_packet, lgrp_lwp), + fld_sizeof (MHwcntr_packet, lgrp_lwp) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"PS_LGRP_HOME\" uname=\"" STXT ("Process home lgroup id") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->lgrp_ps, sizeof (xpp->lgrp_ps) == 4 ? "INT32" : "INT64"); + (int) offsetof (MHwcntr_packet, lgrp_ps), + fld_sizeof (MHwcntr_packet, lgrp_ps) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"MEM_LAT\" uname=\"" STXT ("Memory Latency Cycles") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->latency, sizeof (xpp->latency) == 4 ? "INT32" : "INT64"); + (int) offsetof (MHwcntr_packet, latency), + fld_sizeof (MHwcntr_packet, latency) == 4 ? "INT32" : "INT64"); collector_interface->writeLog (" <field name=\"MEM_SRC\" uname=\"" STXT ("Memory Data Source") "\" offset=\"%d\" type=\"%s\"/>\n", - &xpp->data_source, sizeof (xpp->data_source) == 4 ? "INT32" : "INT64"); + (int) offsetof (MHwcntr_packet, data_source), + fld_sizeof (MHwcntr_packet, data_source) == 4 ? "INT32" : "INT64"); collector_interface->writeLog ("</profpckt>\n"); } } |