Module Name: src Committed By: rillig Date: Thu May 12 00:09:44 UTC 2022
Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: Makefile d_alignof.c msg_014.c msg_014.exp Added Files: src/tests/usr.bin/xlint/lint1: d_alignof.exp Log Message: tests/lint: adjust tests to reflect missing support of __alignof__ The change in lex.c 1.129 attempted to add support for __alignof, in addition to the existing support for __alignof__. It failed by removing support for __alignof__, while allowing the plain 'alignof' instead. To generate a diff of this commit: cvs rdiff -u -r1.1203 -r1.1204 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.121 -r1.122 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/d_alignof.c cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/d_alignof.exp cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_014.c \ src/tests/usr.bin/xlint/lint1/msg_014.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1203 src/distrib/sets/lists/tests/mi:1.1204 --- src/distrib/sets/lists/tests/mi:1.1203 Sun May 8 10:20:49 2022 +++ src/distrib/sets/lists/tests/mi Thu May 12 00:09:44 2022 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1203 2022/05/08 10:20:49 rillig Exp $ +# $NetBSD: mi,v 1.1204 2022/05/12 00:09:44 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -6371,6 +6371,7 @@ ./usr/tests/usr.bin/xlint/lint1/c99_init_designator.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/c99_init_designator.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_alignof.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/d_alignof.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_bltinoffsetof.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_c99_anon_struct.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_c99_anon_union.c tests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/xlint/lint1/Makefile diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.121 src/tests/usr.bin/xlint/lint1/Makefile:1.122 --- src/tests/usr.bin/xlint/lint1/Makefile:1.121 Thu Apr 28 21:38:38 2022 +++ src/tests/usr.bin/xlint/lint1/Makefile Thu May 12 00:09:44 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.121 2022/04/28 21:38:38 rillig Exp $ +# $NetBSD: Makefile,v 1.122 2022/05/12 00:09:44 rillig Exp $ NOMAN= # defined MAX_MESSAGE= 348 # see lint1/err.c @@ -27,6 +27,7 @@ FILES+= c99_init_array.exp FILES+= c99_init_designator.c FILES+= c99_init_designator.exp FILES+= d_alignof.c +FILES+= d_alignof.exp FILES+= d_bltinoffsetof.c FILES+= d_c99_anon_struct.c FILES+= d_c99_anon_union.c Index: src/tests/usr.bin/xlint/lint1/d_alignof.c diff -u src/tests/usr.bin/xlint/lint1/d_alignof.c:1.2 src/tests/usr.bin/xlint/lint1/d_alignof.c:1.3 --- src/tests/usr.bin/xlint/lint1/d_alignof.c:1.2 Sun Jan 31 14:39:31 2021 +++ src/tests/usr.bin/xlint/lint1/d_alignof.c Thu May 12 00:09:44 2022 @@ -1,9 +1,57 @@ -/* $NetBSD: d_alignof.c,v 1.2 2021/01/31 14:39:31 rillig Exp $ */ +/* $NetBSD: d_alignof.c,v 1.3 2022/05/12 00:09:44 rillig Exp $ */ # 3 "d_alignof.c" -/* __alignof__ */ -int -main(void) +/* https://gcc.gnu.org/onlinedocs/gcc/Alignment.html */ + +unsigned long +leading_and_trailing_alignof_type(void) { + /* FIXME: '__alignof__' must be recognized. */ + /* expect+2: error: function '__alignof__' implicitly declared to return int [215] */ + /* expect+1: error: syntax error 'short' [249] */ return __alignof__(short); } +/* expect-1: warning: function leading_and_trailing_alignof_type falls off bottom without returning value [217] */ + +unsigned long +leading_alignof_type(void) +{ + return __alignof(short); +} + +unsigned long +plain_alignof_type(void) +{ + /* The plain word 'alignof' is not recognized by GCC. */ + /* FIXME: plain 'alignof' is not defined by GCC. */ + return alignof(short); +} + +unsigned long +leading_and_trailing_alignof_expr(void) +{ + /* FIXME: '__alignof__' must be recognized. */ + /* FIXME: '__alignof__ expr' must be recognized. */ + /* expect+2: error: '__alignof__' undefined [99] */ + /* expect+1: error: syntax error '3' [249] */ + return __alignof__ 3; +} +/* expect-1: warning: function leading_and_trailing_alignof_expr falls off bottom without returning value [217] */ + +unsigned long +leading_alignof_expr(void) +{ + /* FIXME: '__alignof expr' must be recognized. */ + /* expect+1: error: syntax error '3' [249] */ + return __alignof 3; +} +/* expect-1: warning: function leading_alignof_expr falls off bottom without returning value [217] */ + +unsigned long +plain_alignof_expr(void) +{ + /* The plain word 'alignof' is not recognized by GCC. */ + /* expect+1: error: syntax error '3' [249] */ + return alignof 3; +} +/* expect-1: warning: function plain_alignof_expr falls off bottom without returning value [217] */ Index: src/tests/usr.bin/xlint/lint1/msg_014.c diff -u src/tests/usr.bin/xlint/lint1/msg_014.c:1.5 src/tests/usr.bin/xlint/lint1/msg_014.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_014.c:1.5 Sat Apr 2 21:47:04 2022 +++ src/tests/usr.bin/xlint/lint1/msg_014.c Thu May 12 00:09:44 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_014.c,v 1.5 2022/04/02 21:47:04 rillig Exp $ */ +/* $NetBSD: msg_014.c,v 1.6 2022/05/12 00:09:44 rillig Exp $ */ # 3 "msg_014.c" // Test for message: compiler takes alignment of function [14] @@ -6,7 +6,9 @@ typedef void function(void); -/* expect+1: error: cannot take size/alignment of function type 'function(void) returning void' [144] */ +/* FIXME: '__alignof__' must be recognized. */ +/* expect+2: error: function '__alignof__' implicitly declared to return int [215] */ +/* expect+1: error: syntax error 'function' [249] */ unsigned long alignof_function = __alignof__(function); struct illegal_bit_field { Index: src/tests/usr.bin/xlint/lint1/msg_014.exp diff -u src/tests/usr.bin/xlint/lint1/msg_014.exp:1.5 src/tests/usr.bin/xlint/lint1/msg_014.exp:1.6 --- src/tests/usr.bin/xlint/lint1/msg_014.exp:1.5 Sat Apr 2 21:47:04 2022 +++ src/tests/usr.bin/xlint/lint1/msg_014.exp Thu May 12 00:09:44 2022 @@ -1,4 +1,5 @@ -msg_014.c(10): error: cannot take size/alignment of function type 'function(void) returning void' [144] -msg_014.c(14): warning: illegal bit-field type 'function(void) returning void' [35] -msg_014.c(16): error: function illegal in structure or union [38] -msg_014.c(21): error: array of function is illegal [16] +msg_014.c(12): error: function '__alignof__' implicitly declared to return int [215] +msg_014.c(12): error: syntax error 'function' [249] +msg_014.c(16): warning: illegal bit-field type 'function(void) returning void' [35] +msg_014.c(18): error: function illegal in structure or union [38] +msg_014.c(23): error: array of function is illegal [16] Added files: Index: src/tests/usr.bin/xlint/lint1/d_alignof.exp diff -u /dev/null src/tests/usr.bin/xlint/lint1/d_alignof.exp:1.1 --- /dev/null Thu May 12 00:09:44 2022 +++ src/tests/usr.bin/xlint/lint1/d_alignof.exp Thu May 12 00:09:44 2022 @@ -0,0 +1,10 @@ +d_alignof.c(12): error: function '__alignof__' implicitly declared to return int [215] +d_alignof.c(12): error: syntax error 'short' [249] +d_alignof.c(13): warning: function leading_and_trailing_alignof_type falls off bottom without returning value [217] +d_alignof.c(37): error: '__alignof__' undefined [99] +d_alignof.c(37): error: syntax error '3' [249] +d_alignof.c(38): warning: function leading_and_trailing_alignof_expr falls off bottom without returning value [217] +d_alignof.c(46): error: syntax error '3' [249] +d_alignof.c(47): warning: function leading_alignof_expr falls off bottom without returning value [217] +d_alignof.c(55): error: syntax error '3' [249] +d_alignof.c(56): warning: function plain_alignof_expr falls off bottom without returning value [217]