Source-Changes-HG archive

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

[src/trunk]: src tests/lint: make test d_gcc_extension platform-independent



details:   https://anonhg.NetBSD.org/src/rev/0b8cf074a825
branches:  trunk
changeset: 379281:0b8cf074a825
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue May 25 19:22:18 2021 +0000

description:
tests/lint: make test d_gcc_extension platform-independent

That test was intended to test the keywords '__extension__' and
'__typeof'.  The GCC builtin functions were just a side-effect.

These built-in functions generated error messages on platforms such as
amd64 where sizeof(long double) != sizeof(double), but not on others
such as sparc.

The current infrastructure for the lint tests cannot handle tests with
platform-dependent outcome.

diffstat:

 distrib/sets/lists/tests/mi                   |   4 ++--
 tests/usr.bin/xlint/lint1/Makefile            |   3 +--
 tests/usr.bin/xlint/lint1/d_gcc_extension.c   |  10 ++++++++--
 tests/usr.bin/xlint/lint1/d_gcc_extension.exp |   2 --
 4 files changed, 11 insertions(+), 8 deletions(-)

diffs (67 lines):

diff -r f3f9d0121c0f -r 0b8cf074a825 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Tue May 25 19:04:07 2021 +0000
+++ b/distrib/sets/lists/tests/mi       Tue May 25 19:22:18 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1053 2021/05/17 04:07:42 yamaguchi Exp $
+# $NetBSD: mi,v 1.1054 2021/05/25 19:22:18 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6157,7 +6157,7 @@
 ./usr/tests/usr.bin/xlint/lint1/d_gcc_compound_statements2.c   tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_gcc_compound_statements3.c   tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_gcc_extension.c              tests-usr.bin-tests     compattestfile,atf
-./usr/tests/usr.bin/xlint/lint1/d_gcc_extension.exp            tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/d_gcc_extension.exp            tests-obsolete          obsolete
 ./usr/tests/usr.bin/xlint/lint1/d_gcc_func.c                   tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_gcc_variable_array_init.c    tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_incorrect_array_size.c       tests-usr.bin-tests     compattestfile,atf
diff -r f3f9d0121c0f -r 0b8cf074a825 tests/usr.bin/xlint/lint1/Makefile
--- a/tests/usr.bin/xlint/lint1/Makefile        Tue May 25 19:04:07 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/Makefile        Tue May 25 19:22:18 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.58 2021/05/16 11:11:37 rillig Exp $
+# $NetBSD: Makefile,v 1.59 2021/05/25 19:22:18 rillig Exp $
 
 NOMAN=         # defined
 MAX_MESSAGE=   344             # see lint1/err.c
@@ -67,7 +67,6 @@ FILES+=               d_gcc_compound_statements1.c
 FILES+=                d_gcc_compound_statements2.c
 FILES+=                d_gcc_compound_statements3.c
 FILES+=                d_gcc_extension.c
-FILES+=                d_gcc_extension.exp
 FILES+=                d_gcc_func.c
 FILES+=                d_gcc_variable_array_init.c
 FILES+=                d_incorrect_array_size.c
diff -r f3f9d0121c0f -r 0b8cf074a825 tests/usr.bin/xlint/lint1/d_gcc_extension.c
--- a/tests/usr.bin/xlint/lint1/d_gcc_extension.c       Tue May 25 19:04:07 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_gcc_extension.c       Tue May 25 19:22:18 2021 +0000
@@ -1,6 +1,12 @@
-/*     $NetBSD: d_gcc_extension.c,v 1.5 2021/04/05 01:35:34 rillig Exp $       */
+/*     $NetBSD: d_gcc_extension.c,v 1.6 2021/05/25 19:22:18 rillig Exp $       */
 # 3 "d_gcc_extension.c"
 
+/*
+ * Test that the GCC '__extension__' and '__typeof' are recognized.
+ */
+
+_Bool dbl_isinf(double);
+
 /* extension */
 void
 a(void)
@@ -8,7 +14,7 @@ a(void)
        double __logbw = 1;
        if (__extension__(({
                __typeof((__logbw)) x_ = (__logbw);
-               !__builtin_isinf((x_)) && !__builtin_isnan((x_)); /* expect: 259 *//* expect: 259 */
+               !dbl_isinf((x_));
        })))
                __logbw = 1;
 }
diff -r f3f9d0121c0f -r 0b8cf074a825 tests/usr.bin/xlint/lint1/d_gcc_extension.exp
--- a/tests/usr.bin/xlint/lint1/d_gcc_extension.exp     Tue May 25 19:04:07 2021 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-d_gcc_extension.c(11): warning: argument #1 is converted from 'double' to 'long double' due to prototype [259]
-d_gcc_extension.c(11): warning: argument #1 is converted from 'double' to 'long double' due to prototype [259]



Home | Main Index | Thread Index | Old Index