From b9cba617f4250d0350d5dae64ba6254959691ea5 Mon Sep 17 00:00:00 2001 From: Chad Loder Date: Sat, 3 Dec 2005 01:04:07 +0000 Subject: Add a couple more __attribute__ test cases to test 11, and hook up 11 now that lint deals with attributes. --- regress/usr.bin/xlint/Makefile | 4 ++-- regress/usr.bin/xlint/test-11.c | 22 +++++++++++++++++++--- regress/usr.bin/xlint/test-11.c.exp | 16 ++++++++++++++++ 3 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 regress/usr.bin/xlint/test-11.c.exp (limited to 'regress') diff --git a/regress/usr.bin/xlint/Makefile b/regress/usr.bin/xlint/Makefile index a6b0c8bbeab..b5d60539a35 100644 --- a/regress/usr.bin/xlint/Makefile +++ b/regress/usr.bin/xlint/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.10 2005/12/02 21:24:09 grunk Exp $ +# $OpenBSD: Makefile,v 1.11 2005/12/03 01:04:06 cloder Exp $ -TEST_MODULES= 1 2 3 4 5 6 7 8 9 10 +TEST_MODULES= 1 2 3 4 5 6 7 8 9 10 11 LINT= lint LINTFLAGS?= -chapbx diff --git a/regress/usr.bin/xlint/test-11.c b/regress/usr.bin/xlint/test-11.c index 96c867222f4..510906bc0f8 100644 --- a/regress/usr.bin/xlint/test-11.c +++ b/regress/usr.bin/xlint/test-11.c @@ -1,4 +1,4 @@ -/* $OpenBSD: test-11.c,v 1.1 2005/12/02 22:11:46 cloder Exp $ */ +/* $OpenBSD: test-11.c,v 1.2 2005/12/03 01:04:06 cloder Exp $ */ /* * Placed in the public domain by Chad Loder . @@ -35,12 +35,28 @@ void foo4(void) __attribute__((__pure__)) __attribute__((__section__("text"))); +/* + * A function prototype with multiple attributes after, + * one of which (volatile) is stupidly also a C keyword. + */ +__attribute__((__noreturn__)) void foo5(const char *, ...) + __attribute__((volatile, __format__ (printf, 1, 2))); + +/* + * A function prototype with unnamed parameters having attributes. + */ +void foo6(char[], int __attribute__((unused))); + +/* + * A function prototype with named parameters having attributes. + */ +void foo7(char func[], int i __attribute__((unused))); /* * A function definition with a single attribute before. */ __attribute__((__noreturn__)) void -foo5(void) +foo8(void) { exit(0); } @@ -52,7 +68,7 @@ __attribute__((__noreturn__)) __attribute__((__pure__)) __attribute__((__section__("text"))) void -foo6(void) +foo9(void) { exit(0); } diff --git a/regress/usr.bin/xlint/test-11.c.exp b/regress/usr.bin/xlint/test-11.c.exp new file mode 100644 index 00000000000..2e3b18a0968 --- /dev/null +++ b/regress/usr.bin/xlint/test-11.c.exp @@ -0,0 +1,16 @@ +test-11.c(126): warning: argument argc unused in function main +test-11.c(126): warning: argument argv unused in function main +Lint pass2: +foo1 declared( test-11.c(15) ), but never used or defined +foo2 declared( test-11.c(23) ), but never used or defined +foo3 declared( test-11.c(28) ), but never used or defined +foo4 declared( test-11.c(36) ), but never used or defined +foo5 declared( test-11.c(43) ), but never used or defined +foo6 declared( test-11.c(48) ), but never used or defined +foo7 declared( test-11.c(53) ), but never used or defined +foo8 defined( test-11.c(59) ), but never used +foo9 defined( test-11.c(71) ), but never used +pac defined( test-11.c(117) ), but never used +f defined( test-11.c(123) ), but never used +sh2 defined( test-11.c(112) ), but never used +sh defined( test-11.c(107) ), but never used -- cgit v1.2.3