From patchwork Mon Jul 17 16:30:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 9845715 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EE9DF60392 for ; Mon, 17 Jul 2017 16:30:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF32027C05 for ; Mon, 17 Jul 2017 16:30:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D395D2821F; Mon, 17 Jul 2017 16:30:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 476C927C05 for ; Mon, 17 Jul 2017 16:30:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751315AbdGQQaR (ORCPT ); Mon, 17 Jul 2017 12:30:17 -0400 Received: from avasout06.plus.net ([212.159.14.18]:60262 "EHLO avasout06.plus.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751284AbdGQQaR (ORCPT ); Mon, 17 Jul 2017 12:30:17 -0400 Received: from [10.0.2.15] ([143.159.212.52]) by avasout06 with smtp id lsWE1v00418PUFB01sWFEi; Mon, 17 Jul 2017 17:30:16 +0100 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.2 cv=GetnpUfL c=1 sm=1 tr=0 a=CKmocqUIrzA4K3l9YJ19NQ==:117 a=CKmocqUIrzA4K3l9YJ19NQ==:17 a=IkcTkHD0fZMA:10 a=4kbXW9agahTONp6AnCcA:9 a=iEIgiXVb_nkZA7zd:21 a=NBWhoKjtF2GQhOdc:21 a=QEXdDO2ut3YA:10 X-AUTH: ramsayjones@:2500 To: Christopher Li Cc: Luc Van Oostenryck , Sparse Mailing-list From: Ramsay Jones Subject: make selfcheck Message-ID: Date: Mon, 17 Jul 2017 17:30:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Language: en-GB Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Christopher, The 'make selfcheck' target fails very quickly on cygwin, like so: $ make selfcheck CHECK target.c CHECK parse.c /usr/include/sys/_default_fcntl.h:163:14: error: redefinition of struct flock make: *** [Makefile:204: parse.sc] Error 1 $ This is caused by sparse not defining the '__CYGWIN__' macro, which would have been defined by cgcc, so the follwing fixes that: -- >8 -- ---- Having applied the above patch, the output on cygwin is almost the same as Linux. Only two additional warnings (x2 instances), which is caused by sparse not defining some symbols that gcc defines by default. Unfortunately, the C library on cygwin (well the header files anyway) assumes that the compiler will define these symbols (unlike glibc which has reasonable fallbacks). So, I forgot to mention, that on cygwin I have to have the following in my config.mak file to use sparse on the git code base: SPARSE_FLAGS += -D__INTPTR_TYPE__='long int' SPARSE_FLAGS += -D__INT32_TYPE__=int SPARSE_FLAGS += -D__INT32_MAX__=2147483647 SPARSE_FLAGS += -D__UINT32_TYPE__='unsigned int' SPARSE_FLAGS += -D__UINT32_MAX__=4294967295U SPARSE_FLAGS += -D__INT64_TYPE__='long int' SPARSE_FLAGS += -D__INT64_MAX__=9223372036854775807L SPARSE_FLAGS += -D__UINT64_TYPE__='long unsigned int' SPARSE_FLAGS += -D__UINT64_MAX__=18446744073709551615UL SPARSE_FLAGS += -D__INTMAX_TYPE__='long int' SPARSE_FLAGS += -D__INTMAX_MAX__=9223372036854775807L SPARSE_FLAGS += -D__UINTMAX_TYPE__='long unsigned int' SPARSE_FLAGS += -D__UINTMAX_MAX__=18446744073709551615UL SPARSE_FLAGS += -D__SIZE_TYPE__='long unsigned int' SPARSE_FLAGS += -D__SIZE_MAX__=18446744073709551615UL [Just FYI, 'make selfcheck' on cygwin looks like: $ make selfcheck Makefile:67: Your system does not have libxml, disabling c2xml Makefile:80: Your system does not have libgtk2, disabling test-inspect CHECK target.c CHECK parse.c CHECK tokenize.c /usr/include/sys/_intsup.h:68:2: error: "Unable to determine type definition of intptr_t" /usr/include/sys/_intsup.h:75:2: error: "Unable to determine type definition of int32_t" CHECK pre-process.c pre-process.c:712:25: warning: Variable length array is used. pre-process.c:2019:28: warning: Variable length array is used. CHECK symbol.c CHECK lib.c lib.c:194:6: error: symbol 'error_die' redeclared with different type (originally declared at lib.h:98) - different modifiers lib.c:203:6: error: symbol 'die' redeclared with different type (originally declared at lib.h:94) - different modifiers lib.c:283:5: warning: symbol 'arch_msize_long' was not declared. Should it be static? CHECK scope.c CHECK expression.c ... CHECK sparse-llvm.c /usr/include/sys/_intsup.h:68:2: error: "Unable to determine type definition of intptr_t" /usr/include/sys/_intsup.h:75:2: error: "Unable to determine type definition of int32_t" $ Note the additional intptr_t and int32_t errors.] I think Luc already added some of these symbols, but we maybe need to add some more. (This is the difference between applying sparse to a user-space project rather than the kernel). I have to go now, so this is just a heads-up! ;-) ATB, Ramsay Jones --- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Makefile b/Makefile index 4214e17..a3d3b9c 100644 --- a/Makefile +++ b/Makefile @@ -201,7 +201,7 @@ c2xml.o c2xml.sc: CFLAGS += $(LIBXML_CFLAGS) $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< %.sc: %.c sparse - $(QUIET_CHECK) ./sparse -c $(ALL_CFLAGS) $< + $(QUIET_CHECK) ./cgcc -c $(ALL_CFLAGS) $< selfcheck: $(LIB_OBJS:.o=.sc) $(addsuffix .sc, $(PROGRAMS))