0005-Fix-32097-Warnings-when-building-gprofng-with-Clang.patch 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  1. From 0cec0418dacd30f4215d0d778b4e5d23f6a93801 Mon Sep 17 00:00:00 2001
  2. From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
  3. Date: Tue, 3 Sep 2024 21:30:31 -0700
  4. Subject: [PATCH] Fix 32097 Warnings when building gprofng with Clang
  5. gprofng/ChangeLog
  6. 2024-09-03 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>.
  7. PR gprofng/32097
  8. * common/hwcdrv.c: Fix -Wempty-body warnings.
  9. * common/hwcentry.h: Fix -Wdeprecated-non-prototype warnings.
  10. * common/hwctable.c: Fix -Wdeprecated-non-prototype warnings.
  11. * libcollector/collector.c: Likewise.
  12. * libcollector/collector.h: Likewise.
  13. * libcollector/collectorAPI.c: Likewise.
  14. * libcollector/dispatcher.c: Likewise.
  15. * libcollector/iotrace.c: Likewise.
  16. * libcollector/libcol_util.c: Fix -Wunused-but-set-variable warnings.
  17. * libcollector/libcol_util.h: Remove unused declarations.
  18. * libcollector/linetrace.c: Fix -Wdeprecated-non-prototype warnings.
  19. * src/BaseMetricTreeNode.h: Fix -Wunused-private-field warnings.
  20. * src/Dbe.cc: Fix -Wself-assign warnings.
  21. * src/DbeSession.cc: Fix -Wunused-but-set-variable warnings.
  22. * src/Disasm.cc: Fix -Wunused-const-variable warnings.
  23. * src/Experiment.cc: Fix -Wunused-private-field warnings.
  24. * src/HashMap.h: Fix -Wself-assign warnings.
  25. * src/IOActivity.h: Fix -Wunused-private-field warnings.
  26. * src/collctrl.cc: Fix -Wself-assign, -Wparentheses-equality warnings.
  27. * src/collctrl.h: Fix -Wunused-private-field warnings.
  28. * src/collector_module.h: Fix -Wdeprecated-non-prototype warnings.
  29. * src/gp-display-src.cc: Fix -Wunused-private-field warnings.
  30. * src/gp-print.h: Fix -Wheader-guard warnings.
  31. * src/hwc_intel_icelake.h: Fix -Winitializer-overrides warnings.
  32. * src/util.cc: Fix -Wunused-but-set-variable warnings.
  33. Upstream: b79c457ca01df82dbe1facb708e45def4584c903
  34. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  35. ---
  36. gprofng/common/hwcdrv.c | 3 ++-
  37. gprofng/common/hwcentry.h | 7 +----
  38. gprofng/common/hwctable.c | 13 +---------
  39. gprofng/libcollector/collector.c | 15 ++++-------
  40. gprofng/libcollector/collector.h | 2 +-
  41. gprofng/libcollector/collectorAPI.c | 15 ++++++-----
  42. gprofng/libcollector/dispatcher.c | 19 ++++++++------
  43. gprofng/libcollector/iotrace.c | 12 ++++-----
  44. gprofng/libcollector/libcol_util.c | 2 --
  45. gprofng/libcollector/libcol_util.h | 6 -----
  46. gprofng/libcollector/linetrace.c | 40 +++++++++++++++++------------
  47. gprofng/src/BaseMetricTreeNode.h | 1 -
  48. gprofng/src/Dbe.cc | 12 ++++-----
  49. gprofng/src/DbeSession.cc | 3 ---
  50. gprofng/src/Disasm.cc | 1 -
  51. gprofng/src/Experiment.cc | 2 --
  52. gprofng/src/HashMap.h | 3 +--
  53. gprofng/src/IOActivity.h | 1 -
  54. gprofng/src/collctrl.cc | 14 +++++-----
  55. gprofng/src/collector_module.h | 20 +++++++--------
  56. gprofng/src/gp-display-src.cc | 8 ------
  57. gprofng/src/gp-print.h | 2 +-
  58. gprofng/src/util.cc | 10 +++-----
  59. 23 files changed, 84 insertions(+), 127 deletions(-)
  60. diff --git a/gprofng/common/hwcdrv.c b/gprofng/common/hwcdrv.c
  61. index 2d549b0d6a5..fa1ad32430b 100644
  62. --- a/gprofng/common/hwcdrv.c
  63. +++ b/gprofng/common/hwcdrv.c
  64. @@ -650,6 +650,7 @@ read_sample (counter_state_t *ctr_state, int msgsz, uint64_t *rvalue,
  65. static void
  66. dump_perf_event_attr (struct perf_event_attr *at)
  67. {
  68. +#if defined(DEBUG)
  69. TprintfT (DBG_LT2, "dump_perf_event_attr: size=%d type=%d sample_period=%lld\n"
  70. " config=0x%llx config1=0x%llx config2=0x%llx wakeup_events=%lld __reserved_1=%lld\n",
  71. (int) at->size, (int) at->type, (unsigned long long) at->sample_period,
  72. @@ -665,13 +666,13 @@ dump_perf_event_attr (struct perf_event_attr *at)
  73. DUMP_F (exclude_kernel);
  74. DUMP_F (exclude_hv);
  75. DUMP_F (exclude_idle);
  76. - // DUMP_F(xmmap);
  77. DUMP_F (comm);
  78. DUMP_F (freq);
  79. DUMP_F (inherit_stat);
  80. DUMP_F (enable_on_exec);
  81. DUMP_F (task);
  82. DUMP_F (watermark);
  83. +#endif
  84. }
  85. static void
  86. diff --git a/gprofng/common/hwcentry.h b/gprofng/common/hwcentry.h
  87. index a35a363e693..7899875cf96 100644
  88. --- a/gprofng/common/hwcentry.h
  89. +++ b/gprofng/common/hwcentry.h
  90. @@ -202,17 +202,12 @@ extern "C"
  91. extern char *hwc_get_docref (char *buf, size_t buflen);
  92. /* Return a CPU HWC document reference, or NULL. */
  93. - // TBR
  94. - extern char *hwc_get_default_cntrs ();
  95. - /* Return a default HW counter string; may be NULL, or zero-length */
  96. - /* NULL means none is defined in the table; or zero-length means string defined could not be loaded */
  97. -
  98. extern char *hwc_get_default_cntrs2 (int forKernel, int style);
  99. /* like hwc_get_default_cntrs() for style==1 */
  100. /* but allows other styles of formatting as well */
  101. /* deprecate and eventually remove hwc_get_default_cntrs() */
  102. - extern char *hwc_get_orig_default_cntrs ();
  103. + extern char *hwc_get_orig_default_cntrs (int forKernel);
  104. /* Get the default HW counter string as set in the table */
  105. /* NULL means none is defined in the table */
  106. diff --git a/gprofng/common/hwctable.c b/gprofng/common/hwctable.c
  107. index d0735132fac..fe9153190e7 100644
  108. --- a/gprofng/common/hwctable.c
  109. +++ b/gprofng/common/hwctable.c
  110. @@ -3231,7 +3231,7 @@ check_tables ()
  111. }
  112. #endif
  113. -static int try_a_counter ();
  114. +static int try_a_counter (int forKernel);
  115. static void hwc_process_raw_ctrs (int forKernel, Hwcentry ***pstd_out,
  116. Hwcentry ***praw_out, Hwcentry ***phidden_out,
  117. Hwcentry**static_tables,
  118. @@ -4321,17 +4321,6 @@ hwc_get_docref (char *buf, size_t buflen)
  119. return buf;
  120. }
  121. -//TBR:
  122. -
  123. -extern char*
  124. -hwc_get_default_cntrs ()
  125. -{
  126. - setup_cpcx ();
  127. - if (cpcx_default_hwcs[0] != NULL)
  128. - return strdup (cpcx_default_hwcs[0]); // TBR deprecate this
  129. - return NULL;
  130. -}
  131. -
  132. extern char*
  133. hwc_get_default_cntrs2 (int forKernel, int style)
  134. {
  135. diff --git a/gprofng/libcollector/collector.c b/gprofng/libcollector/collector.c
  136. index 39529758600..ef580dcbdd9 100644
  137. --- a/gprofng/libcollector/collector.c
  138. +++ b/gprofng/libcollector/collector.c
  139. @@ -210,15 +210,10 @@ get_collector_interface ()
  140. static void
  141. collector_module_init (CollectorInterface *col_intf)
  142. {
  143. - int nmodules = 0;
  144. -
  145. ModuleInitFunc next_init = (ModuleInitFunc) dlsym (RTLD_DEFAULT, "__collector_module_init");
  146. if (next_init != NULL)
  147. - {
  148. - nmodules++;
  149. - next_init (col_intf);
  150. - }
  151. - TprintfT (DBG_LT1, "collector_module_init: %d modules\n", nmodules);
  152. + next_init (col_intf);
  153. + TprintfT (DBG_LT1, "collector_module_init: %d modules\n", next_init ? 1 : 0);
  154. }
  155. /* Routines concerned with general experiment start and stop */
  156. @@ -1784,7 +1779,7 @@ __collector_pause ()
  157. }
  158. void
  159. -__collector_pause_m (char *reason)
  160. +__collector_pause_m (const char *reason)
  161. {
  162. hrtime_t now;
  163. char xreason[MAXPATHLEN];
  164. @@ -2451,8 +2446,8 @@ __collector_dlog (int tflag, int level, char *format, ...)
  165. static void (*__real__exit) (int status) = NULL; /* libc only: _exit */
  166. static void (*__real__Exit) (int status) = NULL; /* libc only: _Exit */
  167. -void _exit () __attribute__ ((weak, alias ("__collector_exit")));
  168. -void _Exit () __attribute__ ((weak, alias ("__collector_Exit")));
  169. +void _exit (int status) __attribute__ ((weak, alias ("__collector_exit")));
  170. +void _Exit (int status) __attribute__ ((weak, alias ("__collector_Exit")));
  171. void
  172. __collector_exit (int status)
  173. diff --git a/gprofng/libcollector/collector.h b/gprofng/libcollector/collector.h
  174. index 07a03bdd17a..eda68a0e4f5 100644
  175. --- a/gprofng/libcollector/collector.h
  176. +++ b/gprofng/libcollector/collector.h
  177. @@ -123,7 +123,7 @@ extern void __collector_terminate_expt ();
  178. extern void __collector_terminate_hook ();
  179. extern void __collector_sample (char *name);
  180. extern void __collector_pause ();
  181. -extern void __collector_pause_m ();
  182. +extern void __collector_pause_m (const char *reason);
  183. extern void __collector_resume ();
  184. extern int collector_sigemt_sigaction (const struct sigaction*,
  185. struct sigaction*);
  186. diff --git a/gprofng/libcollector/collectorAPI.c b/gprofng/libcollector/collectorAPI.c
  187. index 5fa6403ad49..449bbbaab65 100644
  188. --- a/gprofng/libcollector/collectorAPI.c
  189. +++ b/gprofng/libcollector/collectorAPI.c
  190. @@ -26,16 +26,17 @@
  191. #include "collectorAPI.h"
  192. #include "gp-experiment.h"
  193. -static void *__real_collector_sample = NULL;
  194. -static void *__real_collector_pause = NULL;
  195. -static void *__real_collector_resume = NULL;
  196. -static void *__real_collector_terminate_expt = NULL;
  197. -static void *__real_collector_func_load = NULL;
  198. -static void *__real_collector_func_unload = NULL;
  199. +static void (*__real_collector_sample)(const char *) = NULL;
  200. +static void (*__real_collector_pause)() = NULL;
  201. +static void (*__real_collector_resume)() = NULL;
  202. +static void (*__real_collector_terminate_expt)() = NULL;
  203. +static void (*__real_collector_func_load)(const char *, const char *,
  204. + const char *, void *, int, int, Lineno *) = NULL;
  205. +static void (*__real_collector_func_unload)(void *) = NULL;
  206. #define INIT_API if (init_API == 0) collectorAPI_initAPI()
  207. #define NULL_PTR(x) (__real_##x == NULL)
  208. -#define CALL_REAL(x) (*(void(*)())__real_##x)
  209. +#define CALL_REAL(x) (__real_##x)
  210. #define CALL_IF_REAL(x) INIT_API; if (!NULL_PTR(x)) CALL_REAL(x)
  211. static int init_API = 0;
  212. diff --git a/gprofng/libcollector/dispatcher.c b/gprofng/libcollector/dispatcher.c
  213. index d2a4ad0b60b..867753a22ec 100644
  214. --- a/gprofng/libcollector/dispatcher.c
  215. +++ b/gprofng/libcollector/dispatcher.c
  216. @@ -909,8 +909,9 @@ sigset (int sig, sighandler_t handler)
  217. // map interposed symbol versions
  218. static int
  219. -gprofng_timer_create (int (real_func) (), clockid_t clockid,
  220. - struct sigevent *sevp, timer_t *timerid)
  221. +gprofng_timer_create (int (real_func) (clockid_t, struct sigevent *, timer_t *),
  222. + clockid_t clockid,
  223. + struct sigevent *sevp, timer_t *timerid)
  224. {
  225. // collector reserves SIGPROF
  226. if (sevp == NULL || sevp->sigev_notify != SIGEV_SIGNAL ||
  227. @@ -1045,7 +1046,7 @@ __collector_thr_sigsetmask (int how, const sigset_t* iset, sigset_t* oset)
  228. // map interposed symbol versions
  229. static int
  230. -gprofng_pthread_sigmask (int (real_func) (),
  231. +gprofng_pthread_sigmask (int (real_func) (int, const sigset_t *, sigset_t*),
  232. int how, const sigset_t *iset, sigset_t* oset)
  233. {
  234. sigset_t lsigset;
  235. @@ -1140,9 +1141,10 @@ collector_root (void *cargs)
  236. // map interposed symbol versions
  237. static int
  238. -gprofng_pthread_create (int (real_func) (), pthread_t *thread,
  239. - const pthread_attr_t *attr,
  240. - void *(*func)(void*), void *arg)
  241. +gprofng_pthread_create (int (real_func) (pthread_t *, const pthread_attr_t *,
  242. + void *(*)(void *), void *),
  243. + pthread_t *thread, const pthread_attr_t *attr,
  244. + void *(*func)(void*), void *arg)
  245. {
  246. TprintfT (DBG_LTT, "gprofng_pthread_create @%p\n", real_func);
  247. if (dispatch_mode != DISPATCH_ON)
  248. @@ -1277,6 +1279,7 @@ __collector_ext_clone_pthread (int (*fn)(void *), void *child_stack, int flags,
  249. }
  250. // weak symbols:
  251. -int sigprocmask () __attribute__ ((weak, alias ("__collector_sigprocmask")));
  252. -int thr_sigsetmask () __attribute__ ((weak, alias ("__collector_thr_sigsetmask")));
  253. +int sigprocmask (int, const sigset_t*, sigset_t*) __attribute__ ((weak, alias ("__collector_sigprocmask")));
  254. +int thr_sigsetmask (int, const sigset_t*, sigset_t*) __attribute__ ((weak, alias ("__collector_thr_sigsetmask")));
  255. int setitimer () __attribute__ ((weak, alias ("_setitimer")));
  256. +
  257. diff --git a/gprofng/libcollector/iotrace.c b/gprofng/libcollector/iotrace.c
  258. index 18060864796..3deb441d9c7 100644
  259. --- a/gprofng/libcollector/iotrace.c
  260. +++ b/gprofng/libcollector/iotrace.c
  261. @@ -1350,7 +1350,7 @@ mkstemp (char *template)
  262. unsigned pktSize;
  263. if (NULL_PTR (mkstemp))
  264. init_io_intf ();
  265. - if (CHCK_REENTRANCE (guard) || template == NULL)
  266. + if (CHCK_REENTRANCE (guard))
  267. return CALL_REAL (mkstemp)(template);
  268. PUSH_REENTRANCE (guard);
  269. hrtime_t reqt = gethrtime ();
  270. @@ -1405,7 +1405,7 @@ mkstemps (char *template, int slen)
  271. unsigned pktSize;
  272. if (NULL_PTR (mkstemps))
  273. init_io_intf ();
  274. - if (CHCK_REENTRANCE (guard) || template == NULL)
  275. + if (CHCK_REENTRANCE (guard))
  276. return CALL_REAL (mkstemps)(template, slen);
  277. PUSH_REENTRANCE (guard);
  278. hrtime_t reqt = gethrtime ();
  279. @@ -1485,7 +1485,7 @@ close (int fildes)
  280. /*------------------------------------------------------------- fopen */
  281. static FILE*
  282. -gprofng_fopen (FILE*(real_fopen) (), const char *filename, const char *mode)
  283. +gprofng_fopen (FILE*(real_fopen) (const char *, const char *), const char *filename, const char *mode)
  284. {
  285. int *guard;
  286. FILE *fp = NULL;
  287. @@ -1559,7 +1559,7 @@ DCL_FOPEN (fopen)
  288. /*------------------------------------------------------------- fclose */
  289. static int
  290. -gprofng_fclose (int(real_fclose) (), FILE *stream)
  291. +gprofng_fclose (int(real_fclose) (FILE *), FILE *stream)
  292. {
  293. int *guard;
  294. int stat;
  295. @@ -1645,7 +1645,7 @@ fflush (FILE *stream)
  296. /*------------------------------------------------------------- fdopen */
  297. static FILE*
  298. -gprofng_fdopen (FILE*(real_fdopen) (), int fildes, const char *mode)
  299. +gprofng_fdopen (FILE*(real_fdopen) (int, const char *), int fildes, const char *mode)
  300. {
  301. int *guard;
  302. FILE *fp = NULL;
  303. @@ -2957,7 +2957,7 @@ DCL_FGETPOS (fgetpos)
  304. /*------------------------------------------------------------- fgetpos64 */
  305. static int
  306. -gprofng_fgetpos64 (int(real_fgetpos64) (), FILE *stream, fpos64_t *pos)
  307. +gprofng_fgetpos64 (int(real_fgetpos64) (FILE *, fpos64_t *), FILE *stream, fpos64_t *pos)
  308. {
  309. int *guard;
  310. int ret;
  311. diff --git a/gprofng/libcollector/libcol_util.c b/gprofng/libcollector/libcol_util.c
  312. index 15ba24d2ab5..c2b82894e6b 100644
  313. --- a/gprofng/libcollector/libcol_util.c
  314. +++ b/gprofng/libcollector/libcol_util.c
  315. @@ -1013,7 +1013,6 @@ __collector_open (const char *path, int oflag, ...)
  316. mode_t mode = 0;
  317. hrtime_t t_timeout = __collector_gethrtime () + 5 * ((hrtime_t) NANOSEC);
  318. - int nretries = 0;
  319. long long delay = 100; /* start at some small, arbitrary value */
  320. /* get optional mode argument if it's expected/required */
  321. @@ -1058,7 +1057,6 @@ __collector_open (const char *path, int oflag, ...)
  322. delay *= 2;
  323. if (delay > 100000000)
  324. delay = 100000000; /* cap at some large, arbitrary value */
  325. - nretries++;
  326. }
  327. return fd;
  328. }
  329. diff --git a/gprofng/libcollector/libcol_util.h b/gprofng/libcollector/libcol_util.h
  330. index 2eeeaeed50b..1b1b928180a 100644
  331. --- a/gprofng/libcollector/libcol_util.h
  332. +++ b/gprofng/libcollector/libcol_util.h
  333. @@ -81,12 +81,6 @@ extern int __collector_mutex_trylock (collector_mutex_t *mp);
  334. #define __collector_mutex_init(xx) \
  335. do { collector_mutex_t tmp=COLLECTOR_MUTEX_INITIALIZER; *(xx)=tmp; } while(0)
  336. -void __collector_sample (char *name);
  337. -void __collector_terminate_expt ();
  338. -void __collector_pause ();
  339. -void __collector_pause_m ();
  340. -void __collector_resume ();
  341. -
  342. struct DT_lineno;
  343. typedef enum
  344. diff --git a/gprofng/libcollector/linetrace.c b/gprofng/libcollector/linetrace.c
  345. index 67b2d7e9030..66844bc1337 100644
  346. --- a/gprofng/libcollector/linetrace.c
  347. +++ b/gprofng/libcollector/linetrace.c
  348. @@ -1207,7 +1207,7 @@ __collector_vfork (void)
  349. }
  350. /*------------------------------------------------------------- execve */
  351. -int execve () __attribute__ ((weak, alias ("__collector_execve")));
  352. +int execve (const char *, char *const [], char *const []) __attribute__ ((weak, alias ("__collector_execve")));
  353. int
  354. __collector_execve (const char* path, char *const argv[], char *const envp[])
  355. @@ -1237,7 +1237,7 @@ __collector_execve (const char* path, char *const argv[], char *const envp[])
  356. return ret;
  357. }
  358. -int execvp () __attribute__ ((weak, alias ("__collector_execvp")));
  359. +int execvp (const char *, char *const []) __attribute__ ((weak, alias ("__collector_execvp")));
  360. int
  361. __collector_execvp (const char* file, char *const argv[])
  362. @@ -1269,7 +1269,7 @@ __collector_execvp (const char* file, char *const argv[])
  363. return ret;
  364. }
  365. -int execv () __attribute__ ((weak, alias ("__collector_execv")));
  366. +int execv (const char *, char *const []) __attribute__ ((weak, alias ("__collector_execv")));
  367. int
  368. __collector_execv (const char* path, char *const argv[])
  369. @@ -1408,7 +1408,10 @@ __collector_execl (const char* path, const char *arg0, ...)
  370. /*-------------------------------------------------------- posix_spawn */
  371. // map interposed symbol versions
  372. static int
  373. -gprofng_posix_spawn (int(real_posix_spawn) (),
  374. +gprofng_posix_spawn (int(real_posix_spawn) (pid_t *, const char *,
  375. + const posix_spawn_file_actions_t *,
  376. + const posix_spawnattr_t *,
  377. + char *const [], char *const []),
  378. pid_t *pidp, const char *path,
  379. const posix_spawn_file_actions_t *file_actions,
  380. const posix_spawnattr_t *attrp,
  381. @@ -1466,7 +1469,10 @@ DCL_POSIX_SPAWN (posix_spawn)
  382. /*-------------------------------------------------------- posix_spawnp */
  383. static int
  384. -gprofng_posix_spawnp (int (real_posix_spawnp) (),
  385. +gprofng_posix_spawnp (int (real_posix_spawnp) (pid_t *, const char *,
  386. + const posix_spawn_file_actions_t *,
  387. + const posix_spawnattr_t *,
  388. + char *const [], char *const []),
  389. pid_t *pidp, const char *path,
  390. const posix_spawn_file_actions_t *file_actions,
  391. const posix_spawnattr_t *attrp,
  392. @@ -1754,8 +1760,8 @@ __collector_clone (int (*fn)(void *), void *child_stack, int flags, void *arg,
  393. }
  394. /*-------------------------------------------------------------------- setuid */
  395. -int setuid () __attribute__ ((weak, alias ("__collector_setuid")));
  396. -int _setuid () __attribute__ ((weak, alias ("__collector_setuid")));
  397. +int setuid (uid_t) __attribute__ ((weak, alias ("__collector_setuid")));
  398. +int _setuid (uid_t) __attribute__ ((weak, alias ("__collector_setuid")));
  399. int
  400. __collector_setuid (uid_t ruid)
  401. @@ -1770,8 +1776,8 @@ __collector_setuid (uid_t ruid)
  402. }
  403. /*------------------------------------------------------------------- seteuid */
  404. -int seteuid () __attribute__ ((weak, alias ("__collector_seteuid")));
  405. -int _seteuid () __attribute__ ((weak, alias ("__collector_seteuid")));
  406. +int seteuid (uid_t) __attribute__ ((weak, alias ("__collector_seteuid")));
  407. +int _seteuid (uid_t) __attribute__ ((weak, alias ("__collector_seteuid")));
  408. int
  409. __collector_seteuid (uid_t euid)
  410. @@ -1786,8 +1792,8 @@ __collector_seteuid (uid_t euid)
  411. }
  412. /*------------------------------------------------------------------ setreuid */
  413. -int setreuid () __attribute__ ((weak, alias ("__collector_setreuid")));
  414. -int _setreuid () __attribute__ ((weak, alias ("__collector_setreuid")));
  415. +int setreuid (uid_t, uid_t) __attribute__ ((weak, alias ("__collector_setreuid")));
  416. +int _setreuid (uid_t, uid_t) __attribute__ ((weak, alias ("__collector_setreuid")));
  417. int
  418. __collector_setreuid (uid_t ruid, uid_t euid)
  419. @@ -1802,8 +1808,8 @@ __collector_setreuid (uid_t ruid, uid_t euid)
  420. }
  421. /*-------------------------------------------------------------------- setgid */
  422. -int setgid () __attribute__ ((weak, alias ("__collector_setgid")));
  423. -int _setgid () __attribute__ ((weak, alias ("__collector_setgid")));
  424. +int setgid (gid_t) __attribute__ ((weak, alias ("__collector_setgid")));
  425. +int _setgid (gid_t) __attribute__ ((weak, alias ("__collector_setgid")));
  426. int
  427. __collector_setgid (gid_t rgid)
  428. @@ -1818,8 +1824,8 @@ __collector_setgid (gid_t rgid)
  429. }
  430. /*------------------------------------------------------------------- setegid */
  431. -int setegid () __attribute__ ((weak, alias ("__collector_setegid")));
  432. -int _setegid () __attribute__ ((weak, alias ("__collector_setegid")));
  433. +int setegid (gid_t) __attribute__ ((weak, alias ("__collector_setegid")));
  434. +int _setegid (gid_t) __attribute__ ((weak, alias ("__collector_setegid")));
  435. int
  436. __collector_setegid (gid_t egid)
  437. @@ -1834,8 +1840,8 @@ __collector_setegid (gid_t egid)
  438. }
  439. /*------------------------------------------------------------------ setregid */
  440. -int setregid () __attribute__ ((weak, alias ("__collector_setregid")));
  441. -int _setregid () __attribute__ ((weak, alias ("__collector_setregid")));
  442. +int setregid (gid_t, gid_t) __attribute__ ((weak, alias ("__collector_setregid")));
  443. +int _setregid (gid_t, gid_t) __attribute__ ((weak, alias ("__collector_setregid")));
  444. int
  445. __collector_setregid (gid_t rgid, gid_t egid)
  446. diff --git a/gprofng/src/BaseMetricTreeNode.h b/gprofng/src/BaseMetricTreeNode.h
  447. index d73d244e27e..7698f9c6eaf 100644
  448. --- a/gprofng/src/BaseMetricTreeNode.h
  449. +++ b/gprofng/src/BaseMetricTreeNode.h
  450. @@ -85,7 +85,6 @@ private:
  451. BaseMetricTreeNode *root; // root of tree
  452. BaseMetricTreeNode *parent; // my parent
  453. - bool aggregation; // value is based on children's values
  454. char *name; // bm->get_cmd() for metrics, unique string otherwise
  455. char *uname; // user-visible text
  456. char *unit; // see UNIT_* defines
  457. diff --git a/gprofng/src/Dbe.cc b/gprofng/src/Dbe.cc
  458. index 91a5aa5ef05..bcbf4694565 100644
  459. --- a/gprofng/src/Dbe.cc
  460. +++ b/gprofng/src/Dbe.cc
  461. @@ -9594,14 +9594,12 @@ dbeGetTLDataRepVals (VMode view_mode, hrtime_t start_ts, hrtime_t delta,
  462. }
  463. if (sampleVals != NULL)
  464. {
  465. - Sample* sample = (Sample*) packets->getObjValue (PROP_SMPLOBJ, packetIdx);
  466. - if (!sample || !sample->get_usage ())
  467. - sample = sample;
  468. - else
  469. + Sample *sample = (Sample*) packets->getObjValue (PROP_SMPLOBJ, packetIdx);
  470. + if (sample != NULL)
  471. {
  472. - PrUsage* prusage = sample->get_usage ();
  473. - Vector<long long> *mstateVals = prusage->getMstateValues ();
  474. - sampleVals->store (eventIdx, mstateVals);
  475. + PrUsage *prusage = sample->get_usage ();
  476. + if (prusage != NULL)
  477. + sampleVals->store (eventIdx, prusage->getMstateValues ());
  478. }
  479. }
  480. }
  481. diff --git a/gprofng/src/DbeSession.cc b/gprofng/src/DbeSession.cc
  482. index 20329091167..5d6bab75638 100644
  483. --- a/gprofng/src/DbeSession.cc
  484. +++ b/gprofng/src/DbeSession.cc
  485. @@ -1162,8 +1162,6 @@ DbeSession::open_experiment (Experiment *exp, char *path)
  486. closedir (exp_dir);
  487. exp_names->sort (dir_name_cmp);
  488. Experiment **t_exp_list = new Experiment *[exp_names->size ()];
  489. - int nsubexps = 0;
  490. -
  491. for (int j = 0, jsz = exp_names->size (); j < jsz; j++)
  492. {
  493. t_exp_list[j] = NULL;
  494. @@ -1220,7 +1218,6 @@ DbeSession::open_experiment (Experiment *exp, char *path)
  495. dexp->open (dpath);
  496. append (dexp);
  497. t_exp_list[j] = dexp;
  498. - nsubexps++;
  499. dexp->set_clock (exp->clock);
  500. // DbeView add_experiment() is split into two parts
  501. diff --git a/gprofng/src/Disasm.cc b/gprofng/src/Disasm.cc
  502. index 1396e4fb072..d78212cee39 100644
  503. --- a/gprofng/src/Disasm.cc
  504. +++ b/gprofng/src/Disasm.cc
  505. @@ -49,7 +49,6 @@ struct DisContext
  506. };
  507. static const int MAX_DISASM_STR = 2048;
  508. -static const int MAX_INSTR_SIZE = 8;
  509. Disasm::Disasm (char *fname)
  510. {
  511. diff --git a/gprofng/src/Experiment.cc b/gprofng/src/Experiment.cc
  512. index 02a24ebc40d..a31550aff66 100644
  513. --- a/gprofng/src/Experiment.cc
  514. +++ b/gprofng/src/Experiment.cc
  515. @@ -1935,8 +1935,6 @@ private:
  516. }
  517. Experiment *exp;
  518. - char *hostname;
  519. - hrtime_t time, tstamp;
  520. };
  521. void
  522. diff --git a/gprofng/src/HashMap.h b/gprofng/src/HashMap.h
  523. index 918c0dc95f9..c5fdd345ba8 100644
  524. --- a/gprofng/src/HashMap.h
  525. +++ b/gprofng/src/HashMap.h
  526. @@ -78,9 +78,8 @@ copy_key (uint64_t a)
  527. }
  528. template<> inline void
  529. -delete_key (uint64_t a)
  530. +delete_key (uint64_t)
  531. {
  532. - a = a;
  533. }
  534. template<> inline int
  535. diff --git a/gprofng/src/IOActivity.h b/gprofng/src/IOActivity.h
  536. index cf462cf8d55..f3a22ada6b1 100644
  537. --- a/gprofng/src/IOActivity.h
  538. +++ b/gprofng/src/IOActivity.h
  539. @@ -78,7 +78,6 @@ private:
  540. Hist_data *hist_data_file_all;
  541. Hist_data *hist_data_vfd_all;
  542. Hist_data *hist_data_callstack_all;
  543. - Hist_data *hist_data_callstack;
  544. DbeView *dbev;
  545. };
  546. diff --git a/gprofng/src/collctrl.cc b/gprofng/src/collctrl.cc
  547. index ebf888c5a20..b0ed66efcdc 100644
  548. --- a/gprofng/src/collctrl.cc
  549. +++ b/gprofng/src/collctrl.cc
  550. @@ -952,9 +952,7 @@ Coll_Ctrl::set_clkprof (const char *string, char** warn)
  551. double dval = strtod (string, &endchar);
  552. if (*endchar == 'm' || *endchar == 0) /* user specified milliseconds */
  553. dval = dval * 1000.;
  554. - else if (*endchar == 'u') /* user specified microseconds */
  555. - dval = dval;
  556. - else
  557. + else if (*endchar != 'u')
  558. return dbe_sprintf (GTXT ("Unrecognized clock-profiling interval `%s'\n"), string);
  559. nclkprof_timer = (int) (dval + 0.5);
  560. }
  561. @@ -2901,7 +2899,7 @@ Coll_Ctrl::get (char * control)
  562. }
  563. if (!strncmp (control, ipc_str_javaprof, len))
  564. {
  565. - if ((java_mode == 0))
  566. + if (java_mode == 0)
  567. return strdup (ipc_str_off);
  568. return strdup (ipc_str_on);
  569. }
  570. @@ -2917,7 +2915,7 @@ Coll_Ctrl::get (char * control)
  571. }
  572. if (!strncmp (control, ipc_str_sample_sig, len))
  573. {
  574. - if ((sample_sig == 0))
  575. + if (sample_sig == 0)
  576. return strdup (ipc_str_off);
  577. char *str_signal = find_signal_name (sample_sig);
  578. if (str_signal != NULL)
  579. @@ -2951,15 +2949,15 @@ Coll_Ctrl::get (char * control)
  580. }
  581. if (!strncmp (control, ipc_str_iotrace, len))
  582. {
  583. - if ((iotrace_enabled == 0))
  584. + if (iotrace_enabled == 0)
  585. return strdup (ipc_str_off);
  586. return strdup (ipc_str_on);
  587. }
  588. if (!strncmp (control, ipc_str_count, len))
  589. {
  590. - if ((count_enabled == 0))
  591. + if (count_enabled == 0)
  592. return strdup (ipc_str_off);
  593. - if ((count_enabled < 0))
  594. + if (count_enabled < 0)
  595. return strdup ("on\nstatic");
  596. return strdup (ipc_str_on);
  597. }
  598. diff --git a/gprofng/src/collector_module.h b/gprofng/src/collector_module.h
  599. index bb48eadb9f8..ebcdbca561f 100644
  600. --- a/gprofng/src/collector_module.h
  601. +++ b/gprofng/src/collector_module.h
  602. @@ -40,12 +40,12 @@ struct tm;
  603. * If you add any, please put it in the right place */
  604. typedef struct CollectorUtilFuncs
  605. {
  606. - int (*access)();
  607. + int (*access)(const char *, int);
  608. int (*atoi)(const char *nptr);
  609. void *(*calloc)(size_t nelem, size_t elsize);
  610. int (*clearenv)(void);
  611. int (*close)(int);
  612. - int (*closedir)();
  613. + int (*closedir)(DIR *);
  614. int (*execv)(const char *path, char *const argv[]);
  615. void (*exit)(int status);
  616. int (*fclose)(FILE *stream);
  617. @@ -66,20 +66,20 @@ typedef struct CollectorUtilFuncs
  618. off_t (*lseek)(int fd, off_t offset, int whence);
  619. void *(*malloc)(size_t size);
  620. void *(*memset)(void *s1, int c, size_t n);
  621. - int (*mkdir)();
  622. + int (*mkdir)(const char *, mode_t);
  623. time_t (*mktime)(struct tm *timeptr);
  624. void *(*mmap)(void *, size_t, int, int, int, off_t);
  625. - void *(*mmap64_)();
  626. - int (*munmap)();
  627. + void *(*mmap64_)(void *, size_t, int, int, int, off_t);
  628. + int (*munmap)(void *, size_t);
  629. int (*open)(const char *, int, ...);
  630. int (*open_bare)(const char *, int, ...);
  631. - DIR *(*opendir)();
  632. + DIR *(*opendir)(const char *);
  633. int (*pclose)(FILE *stream);
  634. FILE *(*popen)(const char *command, const char *mode);
  635. int (*putenv)(char *string);
  636. - ssize_t (*pwrite)();
  637. - ssize_t (*pwrite64_)();
  638. - ssize_t (*read)();
  639. + ssize_t (*pwrite)(int, const void *, size_t, off_t);
  640. + ssize_t (*pwrite64_)(int, const void *, size_t, off_t);
  641. + ssize_t (*read)(int, void *, size_t);
  642. int (*setenv)(const char *name, const char *value, int overwrite);
  643. int (*sigfillset)(sigset_t *set);
  644. int (*sigprocmask)(int how, const sigset_t *set, sigset_t *oldset);
  645. @@ -112,7 +112,7 @@ typedef struct CollectorUtilFuncs
  646. int (*unsetenv)(const char *name);
  647. int (*vsnprintf)(char *str, size_t size, const char *format, va_list ap);
  648. pid_t (*waitpid)(pid_t pid, int *stat_loc, int options);
  649. - ssize_t (*write)();
  650. + ssize_t (*write)(int, void *, size_t);
  651. double (*atof)();
  652. void *n_a;
  653. } CollectorUtilFuncs;
  654. diff --git a/gprofng/src/gp-display-src.cc b/gprofng/src/gp-display-src.cc
  655. index 200e6080d2e..24af375edf1 100644
  656. --- a/gprofng/src/gp-display-src.cc
  657. +++ b/gprofng/src/gp-display-src.cc
  658. @@ -75,14 +75,6 @@ private:
  659. bool v_opt;
  660. int multiple;
  661. char *str_compcom;
  662. - bool hex_visible;
  663. - int src_visible;
  664. - int vis_src;
  665. - int vis_dis;
  666. - int threshold_src;
  667. - int threshold_dis;
  668. - int threshold;
  669. - int vis_bits;
  670. };
  671. static int
  672. diff --git a/gprofng/src/gp-print.h b/gprofng/src/gp-print.h
  673. index 1b748ea60a3..1a8ad3b6c13 100644
  674. --- a/gprofng/src/gp-print.h
  675. +++ b/gprofng/src/gp-print.h
  676. @@ -19,7 +19,7 @@
  677. MA 02110-1301, USA. */
  678. #ifndef _GP_PRINT_H
  679. -#define _ER_PRINT_H
  680. +#define _GP_PRINT_H
  681. #include "Command.h"
  682. #include "DbeApplication.h"
  683. diff --git a/gprofng/src/util.cc b/gprofng/src/util.cc
  684. index 201f7088b66..228140b61ae 100644
  685. --- a/gprofng/src/util.cc
  686. +++ b/gprofng/src/util.cc
  687. @@ -741,17 +741,13 @@ get_relative_link (const char *path_from, const char *path_to)
  688. s2 = canonical_path (s2);
  689. long l = dbe_sstrlen (s1);
  690. // try to find common directories
  691. - int common_slashes = 0;
  692. int last_common_slash = -1;
  693. for (int i = 0; i < l; i++)
  694. {
  695. - if (s1[i] != s2[i]) break;
  696. - if (s1[i] == 0) break;
  697. + if (s1[i] != s2[i] || s1[i] == 0)
  698. + break;
  699. if (s1[i] == '/')
  700. - {
  701. - common_slashes++;
  702. - last_common_slash = i;
  703. - }
  704. + last_common_slash = i;
  705. }
  706. // find slashes in remaining path_to
  707. int slashes = 0;
  708. --
  709. 2.50.1