From patchwork Thu Mar 19 17:56:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Eder X-Patchwork-Id: 13075 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2JHwS1J006735 for ; Thu, 19 Mar 2009 17:58:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753329AbZCSR61 (ORCPT ); Thu, 19 Mar 2009 13:58:27 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753523AbZCSR61 (ORCPT ); Thu, 19 Mar 2009 13:58:27 -0400 Received: from fk-out-0910.google.com ([209.85.128.189]:48111 "EHLO fk-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753329AbZCSR61 (ORCPT ); Thu, 19 Mar 2009 13:58:27 -0400 Received: by fk-out-0910.google.com with SMTP id 18so268345fkq.5 for ; Thu, 19 Mar 2009 10:57:34 -0700 (PDT) Received: by 10.103.176.20 with SMTP id d20mr1233490mup.27.1237485454152; Thu, 19 Mar 2009 10:57:34 -0700 (PDT) Received: from vmbox.hanneseder.net (chello080109038207.17.14.tuwien.teleweb.at [80.109.38.207]) by mx.google.com with ESMTPS id s10sm2580391muh.22.2009.03.19.10.57.26 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 19 Mar 2009 10:57:27 -0700 (PDT) Received: by vmbox.hanneseder.net (sSMTP sendmail emulation); Thu, 19 Mar 2009 18:56:29 +0100 From: Hannes Eder Subject: [PATCH] test-suite: new preprocessor test case Date: Thu, 19 Mar 2009 18:56:11 +0100 Message-ID: <20090319175544.13691.42362.stgit@f10box.hanneseder.net> User-Agent: StGit/0.14.3.348.gcb02.dirty MIME-Version: 1.0 To: Christopher Li Cc: Al Viro Cc: linux-sparse@vger.kernel.org Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org Sparse currently fails on this test. Signed-off-by: Hannes Eder --- I discovered this while hunting down the sparse segfault when checking kernel/cred.c. When preprocessing the file with gcc, gcc remains silent, but sparse complains: include/linux/skbuff.h:381:9: error: expected preprocessor identifier include/linux/skbuff.h:381:9: error: expected preprocessor identifier include/linux/skbuff.h:381:9: error: garbage at end: ) include/linux/skbuff.h:381:9: error: expected preprocessor identifier include/linux/skbuff.h:381:9: error: expected preprocessor identifier include/linux/skbuff.h:381:9: error: garbage at end: ) this is covered by the test case in a more abstract form. Sparse further complains about this, which is not yet covered in a test case: kernel/cred.c:281:9: error: unmatched #endif in stream kernel/cred.c:281:9: error: unmatched #endif in stream kernel/cred.c:281:9: error: unmatched #endif in stream validation/preprocessor/preprocessor22.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) create mode 100644 validation/preprocessor/preprocessor22.c -- 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/validation/preprocessor/preprocessor22.c b/validation/preprocessor/preprocessor22.c new file mode 100644 index 0000000..838479f --- /dev/null +++ b/validation/preprocessor/preprocessor22.c @@ -0,0 +1,21 @@ +#define CONFIG_FOO 1 + +#define define_struct(name, fields...) struct fields name; + +define_struct(a, { +#ifdef CONFIG_FOO + int b; +#endif +}); +/* + * check-name: Preprocessor #22 + * check-description: Sparse gets this wrong, should be fixed + * check-command: sparse -E $file + * check-known-to-fail + * + * check-output-start + +struct { +int b; } a;; + * check-output-end + */