From patchwork Mon Nov 19 20:44:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 10689413 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 173DF13B5 for ; Mon, 19 Nov 2018 20:44:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0768D29FF6 for ; Mon, 19 Nov 2018 20:44:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF68129CAE; Mon, 19 Nov 2018 20:44:42 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 1AC8929CAE for ; Mon, 19 Nov 2018 20:44:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730782AbeKTHKD (ORCPT ); Tue, 20 Nov 2018 02:10:03 -0500 Received: from avasout04.plus.net ([212.159.14.19]:52100 "EHLO avasout04.plus.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730771AbeKTHKD (ORCPT ); Tue, 20 Nov 2018 02:10:03 -0500 Received: from [10.0.2.15] ([146.198.133.33]) by smtp with ESMTPA id OqPOg9oyAYyh2OqPPgYlgf; Mon, 19 Nov 2018 20:44:40 +0000 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.3 cv=MoN8FVSe c=1 sm=1 tr=0 a=VCDsReDbrwk4B7AcQzWGLw==:117 a=VCDsReDbrwk4B7AcQzWGLw==:17 a=IkcTkHD0fZMA:10 a=VwQbUJbxAAAA:8 a=n_ItD3lUVZEvVKbbH9YA:9 a=QEXdDO2ut3YA:10 a=AjGcO6oz07-iQ99wixmX:22 X-AUTH: ramsayjones@:2500 To: Luc Van Oostenryck Cc: Sparse Mailing-list From: Ramsay Jones Subject: [PATCH 0/9] misc sparse patches Message-ID: <53dc6269-3884-ab48-94bb-550718e4e3ce@ramsayjones.plus.com> Date: Mon, 19 Nov 2018 20:44:37 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 Content-Language: en-GB X-CMAE-Envelope: MS4wfLnMm2C4B/RLceTkxpBheAk8mLXL9wpwU6wPMLt3qkeFVUxLPlZXUvPTYwPQCU7qxqG+YvsdVQoK8YB4sjjlbs6N+W7L7sRay5SsYo3c9HjAtSJs2ufs zysolqttwXwu13apV47Q//5hkC+lgS9oUVEVWVmGUjLh0J1hqI8ro9+gPMyjvi2SRDrZehHJs+BIWg== 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 Luc, I noticed a couple of days ago, that the git.kernel.org sparse repo had suddenly 'fast-forwarded' to just two commits behind the master branch of your github sparse.git repo. As I mentioned before, I have been using that branch as a base for my own patches (so that I don't suffer the 'sysmacros' warnings on newer versions of Linux). Tonight, I noticed that it has 'fast-forwarded' again and is now at the same commit as the base for my patches. So, I thought I may as well send these along ... :-D So, the base for these patches is commit 06a4545: $ git log --oneline master~1..dev 8764999 (HEAD -> dev) constant: add -Wconstant-size warning 5ed6580 pre-processor: add some pre-defined macros ffab79b pre-process: add the -dM option to dump macro definitions 0449136 pre-process: print variable argument macros correctly 49c61c8 pre-process: don't put spaces in macro parameter list c4b224c pre-process: print macros containing # and ## correctly 4a45aea pre-process: suppress trailing space when dumping macros c9398e7 sparsei: add the --[no-]jit options dd6a13e sparsec: use a compatible exception model on cygwin 06a4545 (origin/master, origin/HEAD, luc/master, master, luc-master) tokenize: check show_string() for NULL pointer $ Note that the final patch is marked RFC (see below). Some brief notes about the patches: 0001-sparsec-use-a-compatible-exception-model-on-cygwin.patch 0002-sparsei-add-the-no-jit-options.patch The first two patches fix the use of the llvm tools on cygwin. The test suite had 64 test failures (55 + additional 9 fixed by these patches). The test suite now runs clean. 0003-pre-process-suppress-trailing-space-when-dumping-mac.patch 0004-pre-process-print-macros-containing-and-correctly.patch 0005-pre-process-don-t-put-spaces-in-macro-parameter-list.patch 0006-pre-process-print-variable-argument-macros-correctly.patch 0007-pre-process-add-the-dM-option-to-dump-macro-definiti.patch These patches implement '-dM' for sparse, just so that I could run: $ gcc -dM -E - gcc-macs $ ./sparse -dM -E - sp-macs $ meld gcc-macs sp-macs $ (note you can add -m32, -mx32, -m64 to those gcc/sparse command lines). ... in order to help with ... 0008-pre-processor-add-some-pre-defined-macros.patch ... this patch! This patch is not 'finished', but has enough to get started with (eg cygwin has a 16-bit wchar_t, etc). For example, on cygwin, sparse would spew approx. 1600 warnings on git, without using the SPARSE_FLAGS in the config.mak file to set the following: $ grep SPARSE_FLAGS config.mak #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 $ After this patch, as you can see, I can comment them out (and remove them once this patch lands). Also, the 'selfcheck' used to complain about being 'unable to determine type definition of intptr_t' and 'int32_t'. 0009-constant-add-Wconstant-size-warning.patch This is the RFC patch. The main (but not only) problem with this patch is the name of the warning 'constant-size'! ;-) Please take that as simply a placeholder for a more appropriate name (whatever that is!). Ramsay Jones (9): sparsec: use a compatible exception model on cygwin sparsei: add the --[no-]jit options pre-process: suppress trailing space when dumping macros pre-process: print macros containing # and ## correctly pre-process: don't put spaces in macro parameter list pre-process: print variable argument macros correctly pre-process: add the -dM option to dump macro definitions pre-processor: add some pre-defined macros constant: add -Wconstant-size warning cgcc | 2 +- expression.c | 2 +- lib.c | 104 +++++++++++++++++++-- lib.h | 2 + pre-process.c | 22 ++++- sparse.1 | 10 ++ sparsec | 12 ++- sparsei | 20 +++- validation/backend/sum.c | 2 +- validation/constant-size-32.c | 15 +++ validation/constant-size-64.c | 15 +++ validation/preprocessor/dump-macros-only.c | 36 +++++++ validation/preprocessor/dump-macros.c | 16 ++++ 13 files changed, 242 insertions(+), 16 deletions(-) create mode 100644 validation/constant-size-32.c create mode 100644 validation/constant-size-64.c create mode 100644 validation/preprocessor/dump-macros-only.c