aboutsummaryrefslogtreecommitdiff
path: root/gprofng/libcollector
diff options
context:
space:
mode:
authorVladimir Mezentsev <vladimir.mezentsev@oracle.com>2024-09-03 21:30:31 -0700
committerVladimir Mezentsev <vladimir.mezentsev@oracle.com>2024-09-04 13:49:21 -0700
commitb79c457ca01df82dbe1facb708e45def4584c903 (patch)
treedfc6a8871f702ae731d49fab8b2ef7417839578e /gprofng/libcollector
parent82d6a9e5b4bfb313a8e7ce0ad6033fe78a147c00 (diff)
downloadgdb-b79c457ca01df82dbe1facb708e45def4584c903.zip
gdb-b79c457ca01df82dbe1facb708e45def4584c903.tar.gz
gdb-b79c457ca01df82dbe1facb708e45def4584c903.tar.bz2
Fix 32097 Warnings when building gprofng with Clang
gprofng/ChangeLog 2024-09-03 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>. PR gprofng/32097 * common/hwcdrv.c: Fix -Wempty-body warnings. * common/hwcentry.h: Fix -Wdeprecated-non-prototype warnings. * common/hwctable.c: Fix -Wdeprecated-non-prototype warnings. * libcollector/collector.c: Likewise. * libcollector/collector.h: Likewise. * libcollector/collectorAPI.c: Likewise. * libcollector/dispatcher.c: Likewise. * libcollector/iotrace.c: Likewise. * libcollector/libcol_util.c: Fix -Wunused-but-set-variable warnings. * libcollector/libcol_util.h: Remove unused declarations. * libcollector/linetrace.c: Fix -Wdeprecated-non-prototype warnings. * src/BaseMetricTreeNode.h: Fix -Wunused-private-field warnings. * src/Dbe.cc: Fix -Wself-assign warnings. * src/DbeSession.cc: Fix -Wunused-but-set-variable warnings. * src/Disasm.cc: Fix -Wunused-const-variable warnings. * src/Experiment.cc: Fix -Wunused-private-field warnings. * src/HashMap.h: Fix -Wself-assign warnings. * src/IOActivity.h: Fix -Wunused-private-field warnings. * src/collctrl.cc: Fix -Wself-assign, -Wparentheses-equality warnings. * src/collctrl.h: Fix -Wunused-private-field warnings. * src/collector_module.h: Fix -Wdeprecated-non-prototype warnings. * src/gp-display-src.cc: Fix -Wunused-private-field warnings. * src/gp-print.h: Fix -Wheader-guard warnings. * src/hwc_intel_icelake.h: Fix -Winitializer-overrides warnings. * src/util.cc: Fix -Wunused-but-set-variable warnings.
Diffstat (limited to 'gprofng/libcollector')
-rw-r--r--gprofng/libcollector/collector.c15
-rw-r--r--gprofng/libcollector/collector.h2
-rw-r--r--gprofng/libcollector/collectorAPI.c15
-rw-r--r--gprofng/libcollector/dispatcher.c19
-rw-r--r--gprofng/libcollector/iotrace.c12
-rw-r--r--gprofng/libcollector/libcol_util.c2
-rw-r--r--gprofng/libcollector/libcol_util.h6
-rw-r--r--gprofng/libcollector/linetrace.c40
8 files changed, 54 insertions, 57 deletions
diff --git a/gprofng/libcollector/collector.c b/gprofng/libcollector/collector.c
index 3a8f27a..2ff95e5 100644
--- a/gprofng/libcollector/collector.c
+++ b/gprofng/libcollector/collector.c
@@ -210,15 +210,10 @@ get_collector_interface ()
static void
collector_module_init (CollectorInterface *col_intf)
{
- int nmodules = 0;
-
ModuleInitFunc next_init = (ModuleInitFunc) dlsym (RTLD_DEFAULT, "__collector_module_init");
if (next_init != NULL)
- {
- nmodules++;
- next_init (col_intf);
- }
- TprintfT (DBG_LT1, "collector_module_init: %d modules\n", nmodules);
+ next_init (col_intf);
+ TprintfT (DBG_LT1, "collector_module_init: %d modules\n", next_init ? 1 : 0);
}
/* Routines concerned with general experiment start and stop */
@@ -1783,7 +1778,7 @@ __collector_pause ()
}
void
-__collector_pause_m (char *reason)
+__collector_pause_m (const char *reason)
{
hrtime_t now;
char xreason[MAXPATHLEN];
@@ -2449,8 +2444,8 @@ __collector_dlog (int tflag, int level, char *format, ...)
static void (*__real__exit) (int status) = NULL; /* libc only: _exit */
static void (*__real__Exit) (int status) = NULL; /* libc only: _Exit */
-void _exit () __attribute__ ((weak, alias ("__collector_exit")));
-void _Exit () __attribute__ ((weak, alias ("__collector_Exit")));
+void _exit (int status) __attribute__ ((weak, alias ("__collector_exit")));
+void _Exit (int status) __attribute__ ((weak, alias ("__collector_Exit")));
void
__collector_exit (int status)
diff --git a/gprofng/libcollector/collector.h b/gprofng/libcollector/collector.h
index 07a03bd..eda68a0 100644
--- a/gprofng/libcollector/collector.h
+++ b/gprofng/libcollector/collector.h
@@ -123,7 +123,7 @@ extern void __collector_terminate_expt ();
extern void __collector_terminate_hook ();
extern void __collector_sample (char *name);
extern void __collector_pause ();
-extern void __collector_pause_m ();
+extern void __collector_pause_m (const char *reason);
extern void __collector_resume ();
extern int collector_sigemt_sigaction (const struct sigaction*,
struct sigaction*);
diff --git a/gprofng/libcollector/collectorAPI.c b/gprofng/libcollector/collectorAPI.c
index 5fa6403..449bbba 100644
--- a/gprofng/libcollector/collectorAPI.c
+++ b/gprofng/libcollector/collectorAPI.c
@@ -26,16 +26,17 @@
#include "collectorAPI.h"
#include "gp-experiment.h"
-static void *__real_collector_sample = NULL;
-static void *__real_collector_pause = NULL;
-static void *__real_collector_resume = NULL;
-static void *__real_collector_terminate_expt = NULL;
-static void *__real_collector_func_load = NULL;
-static void *__real_collector_func_unload = NULL;
+static void (*__real_collector_sample)(const char *) = NULL;
+static void (*__real_collector_pause)() = NULL;
+static void (*__real_collector_resume)() = NULL;
+static void (*__real_collector_terminate_expt)() = NULL;
+static void (*__real_collector_func_load)(const char *, const char *,
+ const char *, void *, int, int, Lineno *) = NULL;
+static void (*__real_collector_func_unload)(void *) = NULL;
#define INIT_API if (init_API == 0) collectorAPI_initAPI()
#define NULL_PTR(x) (__real_##x == NULL)
-#define CALL_REAL(x) (*(void(*)())__real_##x)
+#define CALL_REAL(x) (__real_##x)
#define CALL_IF_REAL(x) INIT_API; if (!NULL_PTR(x)) CALL_REAL(x)
static int init_API = 0;
diff --git a/gprofng/libcollector/dispatcher.c b/gprofng/libcollector/dispatcher.c
index 8b8ad77..f7cd46e 100644
--- a/gprofng/libcollector/dispatcher.c
+++ b/gprofng/libcollector/dispatcher.c
@@ -908,8 +908,9 @@ sigset (int sig, sighandler_t handler)
// map interposed symbol versions
static int
-gprofng_timer_create (int (real_func) (), clockid_t clockid,
- struct sigevent *sevp, timer_t *timerid)
+gprofng_timer_create (int (real_func) (clockid_t, struct sigevent *, timer_t *),
+ clockid_t clockid,
+ struct sigevent *sevp, timer_t *timerid)
{
// collector reserves SIGPROF
if (sevp == NULL || sevp->sigev_notify != SIGEV_SIGNAL ||
@@ -1044,7 +1045,7 @@ __collector_thr_sigsetmask (int how, const sigset_t* iset, sigset_t* oset)
// map interposed symbol versions
static int
-gprofng_pthread_sigmask (int (real_func) (),
+gprofng_pthread_sigmask (int (real_func) (int, const sigset_t *, sigset_t*),
int how, const sigset_t *iset, sigset_t* oset)
{
sigset_t lsigset;
@@ -1139,9 +1140,10 @@ collector_root (void *cargs)
// map interposed symbol versions
static int
-gprofng_pthread_create (int (real_func) (), pthread_t *thread,
- const pthread_attr_t *attr,
- void *(*func)(void*), void *arg)
+gprofng_pthread_create (int (real_func) (pthread_t *, const pthread_attr_t *,
+ void *(*)(void *), void *),
+ pthread_t *thread, const pthread_attr_t *attr,
+ void *(*func)(void*), void *arg)
{
TprintfT (DBG_LTT, "gprofng_pthread_create @%p\n", real_func);
if (dispatch_mode != DISPATCH_ON)
@@ -1276,6 +1278,7 @@ __collector_ext_clone_pthread (int (*fn)(void *), void *child_stack, int flags,
}
// weak symbols:
-int sigprocmask () __attribute__ ((weak, alias ("__collector_sigprocmask")));
-int thr_sigsetmask () __attribute__ ((weak, alias ("__collector_thr_sigsetmask")));
+int sigprocmask (int, const sigset_t*, sigset_t*) __attribute__ ((weak, alias ("__collector_sigprocmask")));
+int thr_sigsetmask (int, const sigset_t*, sigset_t*) __attribute__ ((weak, alias ("__collector_thr_sigsetmask")));
int setitimer () __attribute__ ((weak, alias ("_setitimer")));
+
diff --git a/gprofng/libcollector/iotrace.c b/gprofng/libcollector/iotrace.c
index 1806086..3deb441 100644
--- a/gprofng/libcollector/iotrace.c
+++ b/gprofng/libcollector/iotrace.c
@@ -1350,7 +1350,7 @@ mkstemp (char *template)
unsigned pktSize;
if (NULL_PTR (mkstemp))
init_io_intf ();
- if (CHCK_REENTRANCE (guard) || template == NULL)
+ if (CHCK_REENTRANCE (guard))
return CALL_REAL (mkstemp)(template);
PUSH_REENTRANCE (guard);
hrtime_t reqt = gethrtime ();
@@ -1405,7 +1405,7 @@ mkstemps (char *template, int slen)
unsigned pktSize;
if (NULL_PTR (mkstemps))
init_io_intf ();
- if (CHCK_REENTRANCE (guard) || template == NULL)
+ if (CHCK_REENTRANCE (guard))
return CALL_REAL (mkstemps)(template, slen);
PUSH_REENTRANCE (guard);
hrtime_t reqt = gethrtime ();
@@ -1485,7 +1485,7 @@ close (int fildes)
/*------------------------------------------------------------- fopen */
static FILE*
-gprofng_fopen (FILE*(real_fopen) (), const char *filename, const char *mode)
+gprofng_fopen (FILE*(real_fopen) (const char *, const char *), const char *filename, const char *mode)
{
int *guard;
FILE *fp = NULL;
@@ -1559,7 +1559,7 @@ DCL_FOPEN (fopen)
/*------------------------------------------------------------- fclose */
static int
-gprofng_fclose (int(real_fclose) (), FILE *stream)
+gprofng_fclose (int(real_fclose) (FILE *), FILE *stream)
{
int *guard;
int stat;
@@ -1645,7 +1645,7 @@ fflush (FILE *stream)
/*------------------------------------------------------------- fdopen */
static FILE*
-gprofng_fdopen (FILE*(real_fdopen) (), int fildes, const char *mode)
+gprofng_fdopen (FILE*(real_fdopen) (int, const char *), int fildes, const char *mode)
{
int *guard;
FILE *fp = NULL;
@@ -2957,7 +2957,7 @@ DCL_FGETPOS (fgetpos)
/*------------------------------------------------------------- fgetpos64 */
static int
-gprofng_fgetpos64 (int(real_fgetpos64) (), FILE *stream, fpos64_t *pos)
+gprofng_fgetpos64 (int(real_fgetpos64) (FILE *, fpos64_t *), FILE *stream, fpos64_t *pos)
{
int *guard;
int ret;
diff --git a/gprofng/libcollector/libcol_util.c b/gprofng/libcollector/libcol_util.c
index 1e58cf4..baac15d 100644
--- a/gprofng/libcollector/libcol_util.c
+++ b/gprofng/libcollector/libcol_util.c
@@ -1013,7 +1013,6 @@ __collector_open (const char *path, int oflag, ...)
mode_t mode = 0;
hrtime_t t_timeout = __collector_gethrtime () + 5 * ((hrtime_t) NANOSEC);
- int nretries = 0;
long long delay = 100; /* start at some small, arbitrary value */
/* get optional mode argument if it's expected/required */
@@ -1058,7 +1057,6 @@ __collector_open (const char *path, int oflag, ...)
delay *= 2;
if (delay > 100000000)
delay = 100000000; /* cap at some large, arbitrary value */
- nretries++;
}
return fd;
}
diff --git a/gprofng/libcollector/libcol_util.h b/gprofng/libcollector/libcol_util.h
index c8ec83f..aa30db7 100644
--- a/gprofng/libcollector/libcol_util.h
+++ b/gprofng/libcollector/libcol_util.h
@@ -81,12 +81,6 @@ extern int __collector_mutex_trylock (collector_mutex_t *mp);
#define __collector_mutex_init(xx) \
do { collector_mutex_t tmp=COLLECTOR_MUTEX_INITIALIZER; *(xx)=tmp; } while(0)
-void __collector_sample (char *name);
-void __collector_terminate_expt ();
-void __collector_pause ();
-void __collector_pause_m ();
-void __collector_resume ();
-
struct DT_lineno;
typedef enum
diff --git a/gprofng/libcollector/linetrace.c b/gprofng/libcollector/linetrace.c
index 67b2d7e..66844bc 100644
--- a/gprofng/libcollector/linetrace.c
+++ b/gprofng/libcollector/linetrace.c
@@ -1207,7 +1207,7 @@ __collector_vfork (void)
}
/*------------------------------------------------------------- execve */
-int execve () __attribute__ ((weak, alias ("__collector_execve")));
+int execve (const char *, char *const [], char *const []) __attribute__ ((weak, alias ("__collector_execve")));
int
__collector_execve (const char* path, char *const argv[], char *const envp[])
@@ -1237,7 +1237,7 @@ __collector_execve (const char* path, char *const argv[], char *const envp[])
return ret;
}
-int execvp () __attribute__ ((weak, alias ("__collector_execvp")));
+int execvp (const char *, char *const []) __attribute__ ((weak, alias ("__collector_execvp")));
int
__collector_execvp (const char* file, char *const argv[])
@@ -1269,7 +1269,7 @@ __collector_execvp (const char* file, char *const argv[])
return ret;
}
-int execv () __attribute__ ((weak, alias ("__collector_execv")));
+int execv (const char *, char *const []) __attribute__ ((weak, alias ("__collector_execv")));
int
__collector_execv (const char* path, char *const argv[])
@@ -1408,7 +1408,10 @@ __collector_execl (const char* path, const char *arg0, ...)
/*-------------------------------------------------------- posix_spawn */
// map interposed symbol versions
static int
-gprofng_posix_spawn (int(real_posix_spawn) (),
+gprofng_posix_spawn (int(real_posix_spawn) (pid_t *, const char *,
+ const posix_spawn_file_actions_t *,
+ const posix_spawnattr_t *,
+ char *const [], char *const []),
pid_t *pidp, const char *path,
const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t *attrp,
@@ -1466,7 +1469,10 @@ DCL_POSIX_SPAWN (posix_spawn)
/*-------------------------------------------------------- posix_spawnp */
static int
-gprofng_posix_spawnp (int (real_posix_spawnp) (),
+gprofng_posix_spawnp (int (real_posix_spawnp) (pid_t *, const char *,
+ const posix_spawn_file_actions_t *,
+ const posix_spawnattr_t *,
+ char *const [], char *const []),
pid_t *pidp, const char *path,
const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t *attrp,
@@ -1754,8 +1760,8 @@ __collector_clone (int (*fn)(void *), void *child_stack, int flags, void *arg,
}
/*-------------------------------------------------------------------- setuid */
-int setuid () __attribute__ ((weak, alias ("__collector_setuid")));
-int _setuid () __attribute__ ((weak, alias ("__collector_setuid")));
+int setuid (uid_t) __attribute__ ((weak, alias ("__collector_setuid")));
+int _setuid (uid_t) __attribute__ ((weak, alias ("__collector_setuid")));
int
__collector_setuid (uid_t ruid)
@@ -1770,8 +1776,8 @@ __collector_setuid (uid_t ruid)
}
/*------------------------------------------------------------------- seteuid */
-int seteuid () __attribute__ ((weak, alias ("__collector_seteuid")));
-int _seteuid () __attribute__ ((weak, alias ("__collector_seteuid")));
+int seteuid (uid_t) __attribute__ ((weak, alias ("__collector_seteuid")));
+int _seteuid (uid_t) __attribute__ ((weak, alias ("__collector_seteuid")));
int
__collector_seteuid (uid_t euid)
@@ -1786,8 +1792,8 @@ __collector_seteuid (uid_t euid)
}
/*------------------------------------------------------------------ setreuid */
-int setreuid () __attribute__ ((weak, alias ("__collector_setreuid")));
-int _setreuid () __attribute__ ((weak, alias ("__collector_setreuid")));
+int setreuid (uid_t, uid_t) __attribute__ ((weak, alias ("__collector_setreuid")));
+int _setreuid (uid_t, uid_t) __attribute__ ((weak, alias ("__collector_setreuid")));
int
__collector_setreuid (uid_t ruid, uid_t euid)
@@ -1802,8 +1808,8 @@ __collector_setreuid (uid_t ruid, uid_t euid)
}
/*-------------------------------------------------------------------- setgid */
-int setgid () __attribute__ ((weak, alias ("__collector_setgid")));
-int _setgid () __attribute__ ((weak, alias ("__collector_setgid")));
+int setgid (gid_t) __attribute__ ((weak, alias ("__collector_setgid")));
+int _setgid (gid_t) __attribute__ ((weak, alias ("__collector_setgid")));
int
__collector_setgid (gid_t rgid)
@@ -1818,8 +1824,8 @@ __collector_setgid (gid_t rgid)
}
/*------------------------------------------------------------------- setegid */
-int setegid () __attribute__ ((weak, alias ("__collector_setegid")));
-int _setegid () __attribute__ ((weak, alias ("__collector_setegid")));
+int setegid (gid_t) __attribute__ ((weak, alias ("__collector_setegid")));
+int _setegid (gid_t) __attribute__ ((weak, alias ("__collector_setegid")));
int
__collector_setegid (gid_t egid)
@@ -1834,8 +1840,8 @@ __collector_setegid (gid_t egid)
}
/*------------------------------------------------------------------ setregid */
-int setregid () __attribute__ ((weak, alias ("__collector_setregid")));
-int _setregid () __attribute__ ((weak, alias ("__collector_setregid")));
+int setregid (gid_t, gid_t) __attribute__ ((weak, alias ("__collector_setregid")));
+int _setregid (gid_t, gid_t) __attribute__ ((weak, alias ("__collector_setregid")));
int
__collector_setregid (gid_t rgid, gid_t egid)