Received: by 10.213.65.68 with SMTP id h4csp1645881imn; Thu, 15 Mar 2018 05:51:47 -0700 (PDT) X-Google-Smtp-Source: AG47ELutgt+MwfruYVGdSVxAVQOqhmaJYVf9jseYgwPkgLZIqxSphFN8wwjAYdLPzRJxyONncsyC X-Received: by 10.99.98.134 with SMTP id w128mr6633243pgb.217.1521118307591; Thu, 15 Mar 2018 05:51:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521118307; cv=none; d=google.com; s=arc-20160816; b=Vc9ia9j7PseqpC42RPHzGhLxsqSgJmTJ6flBjXrVB9osiGarHEO9Iel9gt5ok3uibr 3VNSL7u9dDVzi4ZZVW1ZRxMLuK/G+29vBKjr6U3u+wtmG6U55sQscU7mOSA3Rh6cFHoX xRp3vFygBbvaLI1ucJEtPuACEmXCggl81qK6lr9XKEFaL2sszpfyPxbne42RmLBzJJGR fzfOywzH/jFmTyC9sQ1TogxX6UKupoYjjpSfBpA93b5AfZ0GfhEGcW/p/LFtIRnylp34 JDf7WneEe1Bw8evQPfVXPCSCncZcfXHSFfK9n9nD1aaHU3WEeYlYnNHRsqehwrnj7ctB QpJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=FZGM5G/aFSuqbJmgW4TRhmeWWqB0RL+el+mRYEwyk1E=; b=GVSf2cYMhEvGbpfDqX2No7eO7xiluJZXQWcLX5547ZGjS5wso7HqDuZ17kDxDFXYPN Lq981sRrLfu+bOnV/oxjsTBFRE3rwOtUBtRr1LlPmqxOdHwFUirtA3vJFPTK60jekRh5 2lWlPRAgVv2C4zQ4SJ6cdFMzaLOoN6dsHdzfBFIhfvUqjrCQtKUzNas8dMYwHD6OhGrW LQivA2WU7m+zrtQEkSAI/tGnWBb8Yq4o0REEz8352rFuZ9nkbVdtGuGap96uIR9dyBmX hDyewb3hdr/XVqcjVWZDIWRUPNflNINdxB2o8lfhB7sgZ1dqUva1WZY+HuLzivhR1sC6 Wmng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d14si3425263pgn.306.2018.03.15.05.51.33; Thu, 15 Mar 2018 05:51:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751612AbeCOMue (ORCPT + 99 others); Thu, 15 Mar 2018 08:50:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40892 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750987AbeCOMuc (ORCPT ); Thu, 15 Mar 2018 08:50:32 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 390C0A28D7; Thu, 15 Mar 2018 12:50:32 +0000 (UTC) Received: from krava (unknown [10.43.17.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id A37DDBDC2E; Thu, 15 Mar 2018 12:50:30 +0000 (UTC) Date: Thu, 15 Mar 2018 13:50:30 +0100 From: Jiri Olsa To: Laura Abbott Cc: Arnaldo Carvalho de Melo , Adrian Hunter , Jiri Olsa , Namhyung Kim , Wang Nan , Josh Poimboeuf , Linux Kernel Mailing List Subject: Re: New -Werror=restrict error with incremental gcc Message-ID: <20180315125030.GA4727@krava> References: <34478c69-e238-90db-bf1e-9622a060c778@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <34478c69-e238-90db-bf1e-9622a060c778@redhat.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 15 Mar 2018 12:50:32 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 15 Mar 2018 12:50:32 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jolsa@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)