Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src tests/lint: adjust tests to reflect missing support of __ali...



details:   https://anonhg.NetBSD.org/src/rev/bf09cc158dd5
branches:  trunk
changeset: 366049:bf09cc158dd5
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu May 12 00:09:44 2022 +0000

description:
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.

diffstat:

 distrib/sets/lists/tests/mi             |   3 +-
 tests/usr.bin/xlint/lint1/Makefile      |   3 +-
 tests/usr.bin/xlint/lint1/d_alignof.c   |  56 ++++++++++++++++++++++++++++++--
 tests/usr.bin/xlint/lint1/d_alignof.exp |  10 +++++
 tests/usr.bin/xlint/lint1/msg_014.c     |   6 ++-
 tests/usr.bin/xlint/lint1/msg_014.exp   |   9 ++--
 6 files changed, 75 insertions(+), 12 deletions(-)

diffs (146 lines):

diff -r 3a41689faeb4 -r bf09cc158dd5 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Wed May 11 20:46:47 2022 +0000
+++ b/distrib/sets/lists/tests/mi       Thu May 12 00:09:44 2022 +0000
@@ -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
diff -r 3a41689faeb4 -r bf09cc158dd5 tests/usr.bin/xlint/lint1/Makefile
--- a/tests/usr.bin/xlint/lint1/Makefile        Wed May 11 20:46:47 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/Makefile        Thu May 12 00:09:44 2022 +0000
@@ -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_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
diff -r 3a41689faeb4 -r bf09cc158dd5 tests/usr.bin/xlint/lint1/d_alignof.c
--- a/tests/usr.bin/xlint/lint1/d_alignof.c     Wed May 11 20:46:47 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/d_alignof.c     Thu May 12 00:09:44 2022 +0000
@@ -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] */
diff -r 3a41689faeb4 -r bf09cc158dd5 tests/usr.bin/xlint/lint1/d_alignof.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/xlint/lint1/d_alignof.exp   Thu May 12 00:09:44 2022 +0000
@@ -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]
diff -r 3a41689faeb4 -r bf09cc158dd5 tests/usr.bin/xlint/lint1/msg_014.c
--- a/tests/usr.bin/xlint/lint1/msg_014.c       Wed May 11 20:46:47 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_014.c       Thu May 12 00:09:44 2022 +0000
@@ -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 {
diff -r 3a41689faeb4 -r bf09cc158dd5 tests/usr.bin/xlint/lint1/msg_014.exp
--- a/tests/usr.bin/xlint/lint1/msg_014.exp     Wed May 11 20:46:47 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_014.exp     Thu May 12 00:09:44 2022 +0000
@@ -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]



Home | Main Index | Thread Index | Old Index