* New -Werror=restrict error with incremental gcc
@ 2018-03-14 21:19 Laura Abbott
2018-03-15 12:50 ` Jiri Olsa
2018-03-15 14:30 ` Arnaldo Carvalho de Melo
0 siblings, 2 replies; 7+ messages in thread
From: Laura Abbott @ 2018-03-14 21:19 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Adrian Hunter, Jiri Olsa, Namhyung Kim,
Wang Nan, Josh Poimboeuf
Cc: Linux Kernel Mailing List
Hi,
Fedora picked up a new gcc (8.0.1-0.18.fc29) and it seems to have introduced a new error:
gcc -Wp,-MD,/home/labbott/linux/tools/objtool/.str_error_r.o.d -Wp,-MT,/home/labbott/linux/tools/objtool/str_error_r.o -Wall -Werror -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wformat -Wstrict-aliasing=3 -Wno-switch-default -Wno-switch-enum -Wno-packed -fomit-frame-pointer -O2 -g -I/home/labbott/linux/tools/include -I/home/labbott/linux/tools/arch/x86/include/uapi -I/home/labbott/linux/tools/objtool/arch/x86/include -I/home/labbott/linux/tools/lib -D"BUILD_STR(s)=#s" -c -o /home/labbott/linux/tools/objtool/str_error_r.o ../lib/str_error_r.c
../lib/str_error_r.c: In function ‘str_error_r’:
../lib/str_error_r.c:25:3: error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]
snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
^~
This looks like gcc is now warning about the aliasing from printing out buf
while printing to the buffer. I can work around this pretty easily but I
know people have strong opinions about gcc warnings. Any thoughts?
Thanks,
Laura
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: New -Werror=restrict error with incremental gcc
2018-03-14 21:19 New -Werror=restrict error with incremental gcc Laura Abbott
@ 2018-03-15 12:50 ` Jiri Olsa
2018-03-15 14:30 ` Arnaldo Carvalho de Melo
1 sibling, 0 replies; 7+ messages in thread
From: Jiri Olsa @ 2018-03-15 12:50 UTC (permalink / raw)
To: Laura Abbott
Cc: Arnaldo Carvalho de Melo, Adrian Hunter, Jiri Olsa, Namhyung Kim,
Wang Nan, Josh Poimboeuf, Linux Kernel Mailing List
On Wed, Mar 14, 2018 at 02:19:41PM -0700, Laura Abbott wrote:
> Hi,
>
> Fedora picked up a new gcc (8.0.1-0.18.fc29) and it seems to have introduced a new error:
>
> gcc -Wp,-MD,/home/labbott/linux/tools/objtool/.str_error_r.o.d -Wp,-MT,/home/labbott/linux/tools/objtool/str_error_r.o -Wall -Werror -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wformat -Wstrict-aliasing=3 -Wno-switch-default -Wno-switch-enum -Wno-packed -fomit-frame-pointer -O2 -g -I/home/labbott/linux/tools/include -I/home/labbott/linux/tools/arch/x86/include/uapi -I/home/labbott/linux/tools/objtool/arch/x86/include -I/home/labbott/linux/tools/lib -D"BUILD_STR(s)=#s" -c -o /home/labbott/linux/tools/objtool/str_error_r.o ../lib/str_error_r.c
> ../lib/str_error_r.c: In function ‘str_error_r’:
> ../lib/str_error_r.c:25:3: error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]
> snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
> ^~
>
> This looks like gcc is now warning about the aliasing from printing out buf
> while printing to the buffer. I can work around this pretty easily but I
> know people have strong opinions about gcc warnings. Any thoughts?
I did not get above warning.. objtool compiled for me properly
but we have some issues with perf there, I have to use
following to get it compile, plus attached patch
make EXTRA_CFLAGS="-Wno-format-truncation -Wno-cast-function-type"
the format-truncation are mostly fine, because we use the
buffer len to be safe and the worst things that will happen
is that we won't open the file, because the path is too long
the cast-function-type seems like a problem, I've bunch
of following errors:
/root/linux/tools/perf/util/python.c:830:15: warning: cast between incompatible function types from ‘PyObject * (*)(struct pyrf_evsel *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct pyrf_evsel *, struct _object *, struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Wcast-function-type]
.ml_meth = (PyCFunction)pyrf_evsel__open,
^
/root/linux/tools/perf/util/python.c:1052:15: warning: cast between incompatible function types from ‘PyObject * (*)(struct pyrf_evlist *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct pyrf_evlist *, struct _object *, struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Wcast-function-type]
.ml_meth = (PyCFunction)pyrf_evlist__mmap,
^
/root/linux/tools/perf/util/python.c:1058:15: warning: cast between incompatible function types from ‘PyObject * (*)(struct pyrf_evlist *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct pyrf_evlist *, struct _object *, struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Wcast-function-type]
.ml_meth = (PyCFunction)pyrf_evlist__open,
we might want to look at it.. there were some python related
changes recently, like v3 support.. Arnaldo?
thanks,
jirka
---
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index cce926aeb0c0..48696fd80ad1 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -2721,7 +2721,7 @@ static int check_ev_match(char *dir_name, char *scriptname,
int match, len;
FILE *fp;
- sprintf(filename, "%s/bin/%s-record", dir_name, scriptname);
+ scnprintf(filename, MAXPATHLEN, "%s/bin/%s-record", dir_name, scriptname);
fp = fopen(filename, "r");
if (!fp)
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: New -Werror=restrict error with incremental gcc
2018-03-14 21:19 New -Werror=restrict error with incremental gcc Laura Abbott
2018-03-15 12:50 ` Jiri Olsa
@ 2018-03-15 14:30 ` Arnaldo Carvalho de Melo
2018-03-15 15:06 ` Laura Abbott
1 sibling, 1 reply; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-03-15 14:30 UTC (permalink / raw)
To: Laura Abbott
Cc: Adrian Hunter, Jiri Olsa, Namhyung Kim, Wang Nan, Josh Poimboeuf,
Linux Kernel Mailing List
Em Wed, Mar 14, 2018 at 02:19:41PM -0700, Laura Abbott escreveu:
> Hi,
>
> Fedora picked up a new gcc (8.0.1-0.18.fc29) and it seems to have introduced a new error:
>
> gcc -Wp,-MD,/home/labbott/linux/tools/objtool/.str_error_r.o.d -Wp,-MT,/home/labbott/linux/tools/objtool/str_error_r.o -Wall -Werror -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wformat -Wstrict-aliasing=3 -Wno-switch-default -Wno-switch-enum -Wno-packed -fomit-frame-pointer -O2 -g -I/home/labbott/linux/tools/include -I/home/labbott/linux/tools/arch/x86/include/uapi -I/home/labbott/linux/tools/objtool/arch/x86/include -I/home/labbott/linux/tools/lib -D"BUILD_STR(s)=#s" -c -o /home/labbott/linux/tools/objtool/str_error_r.o ../lib/str_error_r.c
> ../lib/str_error_r.c: In function ‘str_error_r’:
> ../lib/str_error_r.c:25:3: error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]
> snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
> ^~
>
> This looks like gcc is now warning about the aliasing from printing out buf
> while printing to the buffer. I can work around this pretty easily but I
> know people have strong opinions about gcc warnings. Any thoughts?
I couldn't reproduce it here:
[perfbuilder@b34646cdb12b perf]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --with-linker-hash-style=gnu
--enable-plugin --enable-initfini-array --with-isl --enable-libmpx
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 8.0.1 20180310 (Red Hat 8.0.1-0.17) (GCC)
[perfbuilder@b34646cdb12b perf]$ rpm -q gcc
gcc-8.0.1-0.17.fc29.x86_64
[perfbuilder@b34646cdb12b perf]$
[perfbuilder@b34646cdb12b perf]$ make O=/tmp/build/kernel/
make[1]: Entering directory '/tmp/build/kernel'
CHK include/config/kernel.release
Using /git/perf as source for kernel
GEN ./Makefile
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CHK include/generated/bounds.h
CHK include/generated/timeconst.h
CHK include/generated/asm-offsets.h
CALL /git/perf/scripts/checksyscalls.sh
DESCEND objtool
CC /tmp/build/kernel/tools/objtool/str_error_r.o
LD /tmp/build/kernel/tools/objtool/objtool-in.o
LINK /tmp/build/kernel/tools/objtool/objtool
CHK scripts/mod/devicetable-offsets.h
HOSTCC scripts/asn1_compiler
:-\
But I noticed some of those warnings and started action on then for
tools/perf, things like:
"perf annotate: Use asprintf when formatting objdump command line"
https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?id=f22ed8ad2ca0
- Arnaldo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: New -Werror=restrict error with incremental gcc
2018-03-15 14:30 ` Arnaldo Carvalho de Melo
@ 2018-03-15 15:06 ` Laura Abbott
2018-03-16 3:11 ` Josh Poimboeuf
0 siblings, 1 reply; 7+ messages in thread
From: Laura Abbott @ 2018-03-15 15:06 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Adrian Hunter, Jiri Olsa, Namhyung Kim, Wang Nan, Josh Poimboeuf,
Linux Kernel Mailing List
On 03/15/2018 07:30 AM, Arnaldo Carvalho de Melo wrote:
> Em Wed, Mar 14, 2018 at 02:19:41PM -0700, Laura Abbott escreveu:
>> Hi,
>>
>> Fedora picked up a new gcc (8.0.1-0.18.fc29) and it seems to have introduced a new error:
>>
>> gcc -Wp,-MD,/home/labbott/linux/tools/objtool/.str_error_r.o.d -Wp,-MT,/home/labbott/linux/tools/objtool/str_error_r.o -Wall -Werror -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wformat -Wstrict-aliasing=3 -Wno-switch-default -Wno-switch-enum -Wno-packed -fomit-frame-pointer -O2 -g -I/home/labbott/linux/tools/include -I/home/labbott/linux/tools/arch/x86/include/uapi -I/home/labbott/linux/tools/objtool/arch/x86/include -I/home/labbott/linux/tools/lib -D"BUILD_STR(s)=#s" -c -o /home/labbott/linux/tools/objtool/str_error_r.o ../lib/str_error_r.c
>> ../lib/str_error_r.c: In function ‘str_error_r’:
>> ../lib/str_error_r.c:25:3: error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]
>> snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
>> ^~
>>
>> This looks like gcc is now warning about the aliasing from printing out buf
>> while printing to the buffer. I can work around this pretty easily but I
>> know people have strong opinions about gcc warnings. Any thoughts?
>
> I couldn't reproduce it here:
>
> [perfbuilder@b34646cdb12b perf]$ gcc -v
> Using built-in specs.
> COLLECT_GCC=gcc
> COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
> OFFLOAD_TARGET_NAMES=nvptx-none
> OFFLOAD_TARGET_DEFAULT=1
> Target: x86_64-redhat-linux
> Configured with: ../configure --enable-bootstrap
> --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr
> --mandir=/usr/share/man --infodir=/usr/share/info
> --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
> --enable-threads=posix --enable-checking=release --enable-multilib
> --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
> --enable-gnu-unique-object --enable-linker-build-id
> --with-gcc-major-version-only --with-linker-hash-style=gnu
> --enable-plugin --enable-initfini-array --with-isl --enable-libmpx
> --enable-offload-targets=nvptx-none --without-cuda-driver
> --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686
> --build=x86_64-redhat-linux
> Thread model: posix
> gcc version 8.0.1 20180310 (Red Hat 8.0.1-0.17) (GCC)
> [perfbuilder@b34646cdb12b perf]$ rpm -q gcc
> gcc-8.0.1-0.17.fc29.x86_64
> [perfbuilder@b34646cdb12b perf]$
>
> [perfbuilder@b34646cdb12b perf]$ make O=/tmp/build/kernel/
> make[1]: Entering directory '/tmp/build/kernel'
> CHK include/config/kernel.release
> Using /git/perf as source for kernel
> GEN ./Makefile
> CHK include/generated/uapi/linux/version.h
> CHK include/generated/utsrelease.h
> CHK include/generated/bounds.h
> CHK include/generated/timeconst.h
> CHK include/generated/asm-offsets.h
> CALL /git/perf/scripts/checksyscalls.sh
> DESCEND objtool
> CC /tmp/build/kernel/tools/objtool/str_error_r.o
> LD /tmp/build/kernel/tools/objtool/objtool-in.o
> LINK /tmp/build/kernel/tools/objtool/objtool
> CHK scripts/mod/devicetable-offsets.h
> HOSTCC scripts/asn1_compiler
>
>
> :-\
>
> But I noticed some of those warnings and started action on then for
> tools/perf, things like:
>
> "perf annotate: Use asprintf when formatting objdump command line"
>
> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?id=f22ed8ad2ca0
>
> - Arnaldo
>
This only showed up with the very latest rawhide snapshot, .17 worked and
.18 started failing. I had to download .18 manually to test locally
https://koji.fedoraproject.org/koji/packageinfo?packageID=40
Thanks,
Laura
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: New -Werror=restrict error with incremental gcc
2018-03-15 15:06 ` Laura Abbott
@ 2018-03-16 3:11 ` Josh Poimboeuf
2018-03-17 0:56 ` Laura Abbott
2018-03-20 6:36 ` [tip:perf/core] objtool, perf: Fix GCC 8 -Wrestrict error tip-bot for Josh Poimboeuf
0 siblings, 2 replies; 7+ messages in thread
From: Josh Poimboeuf @ 2018-03-16 3:11 UTC (permalink / raw)
To: Laura Abbott
Cc: Arnaldo Carvalho de Melo, Adrian Hunter, Jiri Olsa, Namhyung Kim,
Wang Nan, Linux Kernel Mailing List
On Thu, Mar 15, 2018 at 08:06:26AM -0700, Laura Abbott wrote:
> This only showed up with the very latest rawhide snapshot, .17 worked and
> .18 started failing. I had to download .18 manually to test locally
> https://koji.fedoraproject.org/koji/packageinfo?packageID=40
I also see the error with the latest gcc master branch. The code is
harmless, but maybe the warning is useful in other places, so here's one
way to fix it.
----
From: Josh Poimboeuf <jpoimboe@redhat.com>
Subject: [PATCH] objtool, perf: Fix GCC 8 -Wrestrict error
Starting with recent GCC 8 builds, objtool and perf fail to build with
the following error:
../str_error_r.c: In function ‘str_error_r’:
../str_error_r.c:25:3: error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]
snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
The code seems harmless, but there's probably no benefit in printing the
'buf' pointer in this situation anyway, so just remove it to make GCC
happy.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
tools/lib/str_error_r.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/str_error_r.c b/tools/lib/str_error_r.c
index d6d65537b0d9..6aad8308a0ac 100644
--- a/tools/lib/str_error_r.c
+++ b/tools/lib/str_error_r.c
@@ -22,6 +22,6 @@ char *str_error_r(int errnum, char *buf, size_t buflen)
{
int err = strerror_r(errnum, buf, buflen);
if (err)
- snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
+ snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, [buf], %zd)=%d", errnum, buflen, err);
return buf;
}
--
2.14.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: New -Werror=restrict error with incremental gcc
2018-03-16 3:11 ` Josh Poimboeuf
@ 2018-03-17 0:56 ` Laura Abbott
2018-03-20 6:36 ` [tip:perf/core] objtool, perf: Fix GCC 8 -Wrestrict error tip-bot for Josh Poimboeuf
1 sibling, 0 replies; 7+ messages in thread
From: Laura Abbott @ 2018-03-17 0:56 UTC (permalink / raw)
To: Josh Poimboeuf
Cc: Arnaldo Carvalho de Melo, Adrian Hunter, Jiri Olsa, Namhyung Kim,
Wang Nan, Linux Kernel Mailing List
On 03/15/2018 08:11 PM, Josh Poimboeuf wrote:
> On Thu, Mar 15, 2018 at 08:06:26AM -0700, Laura Abbott wrote:
>> This only showed up with the very latest rawhide snapshot, .17 worked and
>> .18 started failing. I had to download .18 manually to test locally
>> https://koji.fedoraproject.org/koji/packageinfo?packageID=40
>
> I also see the error with the latest gcc master branch. The code is
> harmless, but maybe the warning is useful in other places, so here's one
> way to fix it.
>
Works for me, you can add
Tested-by: Laura Abbott <labbott@redhat.com>
> ----
>
> From: Josh Poimboeuf <jpoimboe@redhat.com>
> Subject: [PATCH] objtool, perf: Fix GCC 8 -Wrestrict error
>
> Starting with recent GCC 8 builds, objtool and perf fail to build with
> the following error:
>
> ../str_error_r.c: In function ‘str_error_r’:
> ../str_error_r.c:25:3: error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]
> snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
>
> The code seems harmless, but there's probably no benefit in printing the
> 'buf' pointer in this situation anyway, so just remove it to make GCC
> happy.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> ---
> tools/lib/str_error_r.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/str_error_r.c b/tools/lib/str_error_r.c
> index d6d65537b0d9..6aad8308a0ac 100644
> --- a/tools/lib/str_error_r.c
> +++ b/tools/lib/str_error_r.c
> @@ -22,6 +22,6 @@ char *str_error_r(int errnum, char *buf, size_t buflen)
> {
> int err = strerror_r(errnum, buf, buflen);
> if (err)
> - snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
> + snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, [buf], %zd)=%d", errnum, buflen, err);
> return buf;
> }
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [tip:perf/core] objtool, perf: Fix GCC 8 -Wrestrict error
2018-03-16 3:11 ` Josh Poimboeuf
2018-03-17 0:56 ` Laura Abbott
@ 2018-03-20 6:36 ` tip-bot for Josh Poimboeuf
1 sibling, 0 replies; 7+ messages in thread
From: tip-bot for Josh Poimboeuf @ 2018-03-20 6:36 UTC (permalink / raw)
To: linux-tip-commits
Cc: wangnan0, hpa, tglx, linux-kernel, adrian.hunter, jpoimboe,
jolsa, labbott, namhyung, acme, mingo
Commit-ID: 854e55ad289ef8888e7991f0ada85d5846f5afb9
Gitweb: https://git.kernel.org/tip/854e55ad289ef8888e7991f0ada85d5846f5afb9
Author: Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Thu, 15 Mar 2018 22:11:54 -0500
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 19 Mar 2018 13:51:54 -0300
objtool, perf: Fix GCC 8 -Wrestrict error
Starting with recent GCC 8 builds, objtool and perf fail to build with
the following error:
../str_error_r.c: In function ‘str_error_r’:
../str_error_r.c:25:3: error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]
snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
The code seems harmless, but there's probably no benefit in printing the
'buf' pointer in this situation anyway, so just remove it to make GCC
happy.
Reported-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Tested-by: Laura Abbott <labbott@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20180316031154.juk2uncs7baffctp@treble
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/str_error_r.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/str_error_r.c b/tools/lib/str_error_r.c
index d6d65537b0d9..6aad8308a0ac 100644
--- a/tools/lib/str_error_r.c
+++ b/tools/lib/str_error_r.c
@@ -22,6 +22,6 @@ char *str_error_r(int errnum, char *buf, size_t buflen)
{
int err = strerror_r(errnum, buf, buflen);
if (err)
- snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
+ snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, [buf], %zd)=%d", errnum, buflen, err);
return buf;
}
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-03-20 6:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-14 21:19 New -Werror=restrict error with incremental gcc Laura Abbott
2018-03-15 12:50 ` Jiri Olsa
2018-03-15 14:30 ` Arnaldo Carvalho de Melo
2018-03-15 15:06 ` Laura Abbott
2018-03-16 3:11 ` Josh Poimboeuf
2018-03-17 0:56 ` Laura Abbott
2018-03-20 6:36 ` [tip:perf/core] objtool, perf: Fix GCC 8 -Wrestrict error tip-bot for Josh Poimboeuf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.