From patchwork Mon Jun 30 08:57:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Li X-Patchwork-Id: 4446611 Return-Path: X-Original-To: patchwork-linux-sparse@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0209A9F319 for ; Mon, 30 Jun 2014 08:57:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 53A3520353 for ; Mon, 30 Jun 2014 08:57:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8217A20328 for ; Mon, 30 Jun 2014 08:57:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755182AbaF3I5Q (ORCPT ); Mon, 30 Jun 2014 04:57:16 -0400 Received: from mail-qc0-f171.google.com ([209.85.216.171]:51192 "EHLO mail-qc0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755163AbaF3I5O (ORCPT ); Mon, 30 Jun 2014 04:57:14 -0400 Received: by mail-qc0-f171.google.com with SMTP id w7so6902393qcr.30 for ; Mon, 30 Jun 2014 01:57:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:cc:content-type; bh=dRg6Pe7CwETtKeAt7y2brFQYO7QfS241XpDSruae16U=; b=rIAkp4o4ElMbeUMbSu0wqrNo6nrOEV3Z2EWcawD/RidTzykXB6WIYOBMu+JJvfAwpt Cc/dzmg3/j5tXRo6cFPWuWSLGojoVQZ2PvYy6iJmmdHhQx1SX9K1XLHJb/HReJ+/K2bQ VCZDCmO3NnC3mSCuKAZonqjvS1/vFM+M62U7A7FiEg9JjYrAQ2zpV1UiAOkr8QtsOMkV A4QUgWS4qG3+M7govQZEeKGbltk/Zj/I3e/ERVbF+LHEHzN0gFGX3F+BlshrsN1JCR85 FN6K8xuzDECkxKnrRoJ6hOoH1DP+d7wICIl8bWL8O3XQMFG6X+GbUIF23zIvGub31iPG nVEQ== MIME-Version: 1.0 X-Received: by 10.140.29.139 with SMTP id b11mr54661357qgb.44.1404118633716; Mon, 30 Jun 2014 01:57:13 -0700 (PDT) Received: by 10.140.102.8 with HTTP; Mon, 30 Jun 2014 01:57:13 -0700 (PDT) Date: Mon, 30 Jun 2014 01:57:13 -0700 X-Google-Sender-Auth: 7Iwam5svylYIBmtVrnJcH95nbv4 Message-ID: Subject: [PATCH] sparse: Add CLOG option for saving warning From: Christopher Li To: linux-kernel Cc: Linux-Sparse , Sam Ravnborg , Andrew Morton , Josh Triplett Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently sparse warning only output to stderr. In the parallel build process, different source file output is fixed together. It is hard to keep track of the warning. Add the CLOG= option in command line to save the sparse warning into individual log file. Typical usage: make -j8 C=2 CLOG= The log file is saved in the target directory as .xxx.o..sparse By diffing between different log file, it is much easier to analyze how the sparse change impact the whole kernel build. Signed-off-by: Christopher Li Chris From 3b2ff204cbda684adf9dba2adf568062533ae34d Mon Sep 17 00:00:00 2001 From: Christopher Li Date: Mon, 30 Jun 2014 01:33:22 -0700 Subject: [PATCH] sparse: Add CLOG option for saving warning Currently sparse warning only output to stderr. In the parallel build process, different source file output is fixed together. It is hard to keep track of the warning. Add the CLOG= option in command line to save the sparse warning into individual log file. Typical usage: make -j8 C=2 CLOG= The log file is saved in the target directory as .xxx.o..sparse By diffing between different log file, it is much easier to analyze how the sparse change impact the whole kernel build. Signed-off-by: Christopher Li --- Makefile | 13 ++++++++++++- scripts/Makefile.build | 11 +++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b11e2d5..56c3502 100644 --- a/Makefile +++ b/Makefile @@ -68,6 +68,16 @@ ifndef KBUILD_CHECKSRC KBUILD_CHECKSRC = 0 endif +ifeq ("$(origin CLOG)", "command line") + KBUILD_CHECKLOG = $(CLOG) +endif +ifndef KBUILD_CHECKLOG + KBUILD_CHECKLOG = +endif + + + + # Use make M=dir to specify directory of external module to build # Old syntax make ... SUBDIRS=$PWD is still supported # Setting the environment variable KBUILD_EXTMOD take precedence @@ -287,7 +297,7 @@ ifeq ($(MAKECMDGOALS),) endif export KBUILD_MODULES KBUILD_BUILTIN -export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD +export KBUILD_CHECKSRC KBUILD_CHECKLOG KBUILD_SRC KBUILD_EXTMOD # Beautify output # --------------------------------------------------------------------------- @@ -1370,6 +1380,7 @@ clean: $(clean-dirs) $(call cmd,rmfiles) @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ + -o -name '.*.sparse' \ -o -name '*.ko.*' \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ -o -name '*.symtypes' -o -name 'modules.order' \ diff --git a/scripts/Makefile.build b/scripts/Makefile.build index bf3e677..45c6004 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -96,14 +96,21 @@ __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ $(subdir-ym) $(always) @: +check_log_file = $(dot-target).$(KBUILD_CHECKLOG).sparse + +ifneq ($(KBUILD_CHECKLOG),) + check_logging = 2> $(check_log_file) +endif + +cmd_check = $(CHECK) $(CHECKFLAGS) $(c_flags) $< $(check_logging) ; # Linus' kernel sanity checking tool ifneq ($(KBUILD_CHECKSRC),0) ifeq ($(KBUILD_CHECKSRC),2) quiet_cmd_force_checksrc = CHECK $< - cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; + cmd_force_checksrc = $(cmd_check) else quiet_cmd_checksrc = CHECK $< - cmd_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; + cmd_checksrc = $(cmd_check) endif endif -- 1.9.3