From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f44.google.com ([209.85.220.44]:33318 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751528AbcADBCC (ORCPT ); Sun, 3 Jan 2016 20:02:02 -0500 Received: by mail-pa0-f44.google.com with SMTP id cy9so188462816pac.0 for ; Sun, 03 Jan 2016 17:02:02 -0800 (PST) Received: from arch-gct.localdomain ([175.114.213.172]) by smtp.gmail.com with ESMTPSA id 184sm45125786pfa.15.2016.01.03.17.01.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 03 Jan 2016 17:02:00 -0800 (PST) From: Byongho Lee To: linux-btrfs@vger.kernel.org Subject: [PATCH v2 1/6] btrfs-progs: get sparse checking working Date: Mon, 4 Jan 2016 10:01:29 +0900 Message-Id: <1451869294-4291-2-git-send-email-bhlee.kernel@gmail.com> In-Reply-To: <1451869294-4291-1-git-send-email-bhlee.kernel@gmail.com> References: <1451869294-4291-1-git-send-email-bhlee.kernel@gmail.com> Sender: linux-btrfs-owner@vger.kernel.org List-ID: When I run sparse checking it gives the following error: $ make C=1 V=1 gcc -MM -MG -MF cmds-fi-usage.o.d -MT cmds-fi-usage.o -MT \ cmds-fi-usage.static.o -MT cmds-fi-usage.o.d -g -O1 -Wall \ -D_FORTIFY_SOURCE=2 -include config.h -DBTRFS_FLAT_INCLUDES \ -D_XOPEN_SOURCE=700 -fno-strict-aliasing -fPIC cmds-fi-usage.c [SP] ctree.c sparse -g -O1 -Wall -D_FORTIFY_SOURCE=2 -include config.h \ -DBTRFS_FLAT_INCLUDES -D_XOPEN_SOURCE=700 -fno-strict-aliasing -fPIC \ -include -D__CHECKER__ -D__CHECK_ENDIAN__ -Wbitwise -Wuninitialized \ -Wshadow -Wundef -U_FORTIFY_SOURCE ctree.c builtin:1:15: error: unable to open '-D__CHECKER__' Makefile:177: recipe for target 'ctree.o' failed make: *** [ctree.o] Error 1 It means '$(check_defs)' is passed to sparse as NULL and looks '$(check_defs)'should be assigned before assigning '$(CHECKER_FLAGS)'. BTW, I'm not familiar with make tool so there could be some my misunderstanding and better solution. Signed-off-by: Byongho Lee --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 85b45e5bee3b..3b98709f31a5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -60,6 +60,7 @@ STATIC_LIBS = @UUID_LIBS_STATIC@ @BLKID_LIBS_STATIC@ \ # generate so many sparse errors that sparse stops parsing, # which masks real errors that we want to see. CHECKER := sparse +check_defs := .cc-defines.h CHECKER_FLAGS := -include $(check_defs) -D__CHECKER__ \ -D__CHECK_ENDIAN__ -Wbitwise -Wuninitialized -Wshadow -Wundef \ -U_FORTIFY_SOURCE @@ -154,7 +155,6 @@ lib_links = libbtrfs.so.0 libbtrfs.so headers = $(libbtrfs_headers) # make C=1 to enable sparse -check_defs := .cc-defines.h ifdef C # We're trying to use sparse against glibc headers which go wild # trying to use internal compiler macros to test features. We -- 2.6.4