From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2041) id 376953858D1E; Tue, 20 Dec 2022 01:14:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 376953858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1671498895; bh=kw0JGVNvDyyk7GA0Xeq/ODzQi33BC0BjlDCYI8ycYRs=; h=From:To:Subject:Date:From; b=d3E6FPZvJugsflTzT4rDYaUMyBXf2VXPbfSU7ZZP4rSQnNZOqcWbmYTukQGUKF/O0 k7KnzSjzEGRQoEYPtaV1PWTvfqApbhuTuf/8r225KFhz0GnBjyKvJwkNmA4C2KGO6/ jnq2ixeuOImtehk3KMTNzSr6kTHlgpaErTlaREeo= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Vladimir Mezentsev To: bfd-cvs@sourceware.org, gdb-cvs@sourceware.org Subject: [binutils-gdb] gprofng: PR29646 Various warnings X-Act-Checkin: binutils-gdb X-Git-Author: Vladimir Mezentsev X-Git-Refname: refs/heads/master X-Git-Oldrev: bd1473135af24ca37e3871771c6aaf4541c6987d X-Git-Newrev: 309b9a1abf77d9c643206f512d3db3ed7a23b854 Message-Id: <20221220011455.376953858D1E@sourceware.org> Date: Tue, 20 Dec 2022 01:14:55 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D309b9a1abf77= d9c643206f512d3db3ed7a23b854 commit 309b9a1abf77d9c643206f512d3db3ed7a23b854 Author: Vladimir Mezentsev Date: Mon Dec 19 01:01:04 2022 -0800 gprofng: PR29646 Various warnings =20 gprofng/ChangeLog 2022-12-19 Vladimir Mezentsev =20 PR gprofng/29646 * common/core_pcbe.c: Fix missingReturn warning. * libcollector/iolib.c: Fix -Waddress warnings. * src/Settings.cc: Likewise. * src/checks.cc: Likewise. * libcollector/linetrace.c: Likewise. * libcollector/iotrace.c: Fix va_end_missing error. * libcollector/libcol_util.c: Fix uninitvar warning. * src/Command.cc: Fix arrayIndexOutOfBounds error. * src/Function.cc: Fix uninitStructMember warning. * src/ipc.cc: Fix -Wwrite-strings warnings. Diff: --- gprofng/common/core_pcbe.c | 2 ++ gprofng/libcollector/iolib.c | 2 +- gprofng/libcollector/iotrace.c | 7 ++++++- gprofng/libcollector/libcol_util.c | 2 +- gprofng/libcollector/linetrace.c | 2 +- gprofng/src/Command.cc | 2 +- gprofng/src/Function.cc | 2 ++ gprofng/src/Settings.cc | 2 +- gprofng/src/checks.cc | 2 +- gprofng/src/ipc.cc | 12 ++++++------ 10 files changed, 22 insertions(+), 13 deletions(-) diff --git a/gprofng/common/core_pcbe.c b/gprofng/common/core_pcbe.c index 6f746d8da1d..e10a14ea1e8 100644 --- a/gprofng/common/core_pcbe.c +++ b/gprofng/common/core_pcbe.c @@ -2937,6 +2937,8 @@ core_pcbe_cpuref (void) return GTXT ("See Chapter 19 of the \"Intel 64 and IA-32 Architectures Soft= ware Developer's Manual Volume 3B: System Programming Guide, Part 2\"\nOrde= r Number: 253669-045US, January 2013"); } +#else + return GTXT ("Unknown cpu model"); #endif } =20 diff --git a/gprofng/libcollector/iolib.c b/gprofng/libcollector/iolib.c index 861843c183d..5f09b0e4cd1 100644 --- a/gprofng/libcollector/iolib.c +++ b/gprofng/libcollector/iolib.c @@ -148,7 +148,7 @@ __collector_create_handle (char *descp) init (); =20 /* set up header for file, file name, etc. */ - if (__collector_exp_dir_name =3D=3D NULL) + if (*__collector_exp_dir_name =3D=3D 0) { __collector_log_write ("__collector= _exp_dir_name=3D=3DNULL\n", SP_JCMD_CERROR, COL_ERROR_EXPOPEN); diff --git a/gprofng/libcollector/iotrace.c b/gprofng/libcollector/iotrace.c index e7e8afa307d..466bf457b75 100644 --- a/gprofng/libcollector/iotrace.c +++ b/gprofng/libcollector/iotrace.c @@ -2713,10 +2713,15 @@ fprintf (FILE *stream, const char *format, ...) if (NULL_PTR (vfprintf)) init_io_intf (); if (CHCK_REENTRANCE (guard) || stream =3D=3D NULL) - return CALL_REAL (vfprintf)(stream, format, ap); + { + ret =3D CALL_REAL (vfprintf)(stream, format, ap); + va_end (ap); + return ret; + } PUSH_REENTRANCE (guard); hrtime_t reqt =3D gethrtime (); ret =3D CALL_REAL (vfprintf)(stream, format, ap); + va_end (ap); if (RECHCK_REENTRANCE (guard)) { POP_REENTRANCE (guard); diff --git a/gprofng/libcollector/libcol_util.c b/gprofng/libcollector/libc= ol_util.c index d682aa0ab29..454f45bba00 100644 --- a/gprofng/libcollector/libcol_util.c +++ b/gprofng/libcollector/libcol_util.c @@ -137,7 +137,7 @@ atomic_swap (volatile int * p, int v) int __collector_mutex_lock (collector_mutex_t *lock_var) { - volatile unsigned int i; /* xxxx volatile may not be honored on amd64 -x= 04 */ + volatile unsigned int i =3D 0; /* xxxx volatile may not be honored on am= d64 -x04 */ =20 if (!(*lock_var) && !atomic_swap (lock_var, 1)) return 0; diff --git a/gprofng/libcollector/linetrace.c b/gprofng/libcollector/linetr= ace.c index d67a66a3734..e974c97ec9b 100644 --- a/gprofng/libcollector/linetrace.c +++ b/gprofng/libcollector/linetrace.c @@ -832,7 +832,7 @@ linetrace_ext_fork_epilogue (const char *variant, const= pid_t ret, char * n_line =20 const char *params =3D CALL_UTIL (getenv)(SP_COLLECTOR_PARAMS); int ret; - if (new_exp_name =3D=3D NULL) + if (*new_exp_name =3D=3D 0) TprintfT (DBG_LT0, "linetrace_ext_fork_epilogue: ERROR: getenv(%s) un= defined -- new expt aborted!\n", SP_COLLECTOR_EXPNAME); else if (params =3D=3D NULL) diff --git a/gprofng/src/Command.cc b/gprofng/src/Command.cc index d1620d7acd6..40530c2d15d 100644 --- a/gprofng/src/Command.cc +++ b/gprofng/src/Command.cc @@ -222,7 +222,7 @@ static Cmdtable cmd_lst[] =3D { // list of commands // like quit, but deletes all data loaded =20 { HHELP, "xhelp", NULL, NULL, 0, &desc[HHELP]}, - { WHOAMI, "-whoami", NULL, NULL, 0, &desc[WHOAMI]}, + { WHOAMI, "whoami", NULL, NULL, 0, NULL}, =20 // these are not recognized at this point { LOADOBJECT, "segments", "pmap", NULL, 0, &desc[LOADOBJECT]}, diff --git a/gprofng/src/Function.cc b/gprofng/src/Function.cc index b0e4a8ff16a..0436e09ebea 100644 --- a/gprofng/src/Function.cc +++ b/gprofng/src/Function.cc @@ -416,6 +416,8 @@ SrcInfo * Function::new_srcInfo () { SrcInfo *t =3D new SrcInfo (); + t->src_line =3D NULL; + t->included_from =3D NULL; t->next =3D srcinfo_list; srcinfo_list =3D t; return t; diff --git a/gprofng/src/Settings.cc b/gprofng/src/Settings.cc index 572997f8a88..53405a20075 100644 --- a/gprofng/src/Settings.cc +++ b/gprofng/src/Settings.cc @@ -1257,7 +1257,7 @@ Settings::set_name_format (char *arg) return CMD_BAD_ARG; =20 bool soname_fmt =3D false; - if (colon && (colon + 1)) + if (colon) { colon++; if (!strcasecmp (colon, NTXT ("soname"))) diff --git a/gprofng/src/checks.cc b/gprofng/src/checks.cc index 105821e4cfa..6a89a7b1cdb 100644 --- a/gprofng/src/checks.cc +++ b/gprofng/src/checks.cc @@ -326,7 +326,7 @@ collect::check_executable_arch (Elf *elf) // now figure out if the platform can run it struct utsname unbuf; int r =3D uname (&unbuf); - if (r =3D=3D 0 && unbuf.machine && strstr (unbuf.machine, "_64") =3D=3D N= ULL) + if (r =3D=3D 0 && strstr (unbuf.machine, "_64") =3D=3D NULL) // machine can not run 64 bits, but this code is 64-bit return EXEC_ELF_ARCH; } diff --git a/gprofng/src/ipc.cc b/gprofng/src/ipc.cc index 06ba33d5b69..180b5104e22 100644 --- a/gprofng/src/ipc.cc +++ b/gprofng/src/ipc.cc @@ -69,16 +69,16 @@ bool2str (bool v) return v ? "true" : "false"; } =20 -inline char* -str2str (String v) +inline const char* +str2str (const char* v) { - return (char*) (v ? v : "NULL"); + return v ? v : "NULL"; } =20 -inline char* -str2s (String v) +inline const char* +str2s (const char* v) { - return (char*) (v ? v : ""); + return v ? v : ""; } =20 inline DbeView *