Source-Changes-HG archive

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

[src/trunk]: src/tests/usr.bin/xlint/lint1 tests/lint: test default argument ...



details:   https://anonhg.NetBSD.org/src/rev/374a993487d0
branches:  trunk
changeset: 1022974:374a993487d0
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Aug 16 20:27:31 2021 +0000

description:
tests/lint: test default argument promotion with enum

diffstat:

 tests/usr.bin/xlint/lint1/expr_promote.c           |  17 ++++++++++++++---
 tests/usr.bin/xlint/lint1/expr_promote.exp-ln      |   4 ++--
 tests/usr.bin/xlint/lint1/expr_promote_trad.c      |  13 +++++++++++--
 tests/usr.bin/xlint/lint1/expr_promote_trad.exp-ln |   4 ++--
 4 files changed, 29 insertions(+), 9 deletions(-)

diffs (91 lines):

diff -r b591836104e9 -r 374a993487d0 tests/usr.bin/xlint/lint1/expr_promote.c
--- a/tests/usr.bin/xlint/lint1/expr_promote.c  Mon Aug 16 20:11:03 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/expr_promote.c  Mon Aug 16 20:27:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: expr_promote.c,v 1.1 2021/08/16 20:11:03 rillig Exp $  */
+/*     $NetBSD: expr_promote.c,v 1.2 2021/08/16 20:27:31 rillig Exp $  */
 # 3 "expr_promote.c"
 
 /*
@@ -28,6 +28,9 @@
        float _Complex float_complex;
        double _Complex double_complex;
        long double _Complex long_double_complex;
+       enum {
+               E
+       } enumerator;
 };
 
 void
@@ -51,7 +54,15 @@
            arg->long_floating,
            arg->float_complex,
            arg->double_complex,
-           arg->long_double_complex);
+           arg->long_double_complex,
+           arg->enumerator);
 }
 
-/* XXX: _Bool is not promoted but should. */
+/*
+ * XXX: _Bool should be promoted to 'int', C99 6.3.1.1p2 "If an int can
+ * represent ...".
+ */
+/*
+ * XXX: Enumerations may need be promoted to 'int', at least C99 6.3.1.1p2
+ * suggests that: "If an int can represent ...".
+ */
diff -r b591836104e9 -r 374a993487d0 tests/usr.bin/xlint/lint1/expr_promote.exp-ln
--- a/tests/usr.bin/xlint/lint1/expr_promote.exp-ln     Mon Aug 16 20:11:03 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/expr_promote.exp-ln     Mon Aug 16 20:27:31 2021 +0000
@@ -1,5 +1,5 @@
 0sexpr_promote.c
 Sexpr_promote.c
 10d0.10e4sinkF2PcCEV
-54c0.54i4sinkf19PcCBIIIIIIuILuLQuQDDlDsXXlXV
-34d0.34d6callerF1PsT116arithmetic_typesV
+58c0.58i4sinkf20PcCBIIIIIIuILuLQuQDDlDsXXlXeT331.0.0V
+37d0.37d6callerF1PsT116arithmetic_typesV
diff -r b591836104e9 -r 374a993487d0 tests/usr.bin/xlint/lint1/expr_promote_trad.c
--- a/tests/usr.bin/xlint/lint1/expr_promote_trad.c     Mon Aug 16 20:11:03 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/expr_promote_trad.c     Mon Aug 16 20:27:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: expr_promote_trad.c,v 1.1 2021/08/16 20:11:03 rillig Exp $     */
+/*     $NetBSD: expr_promote_trad.c,v 1.2 2021/08/16 20:27:31 rillig Exp $     */
 # 3 "expr_promote_trad.c"
 
 /*
@@ -27,6 +27,9 @@
        double double_floating;
        /* long double is not available in traditional C */
        /* _Complex is not available in traditional C */
+       enum {
+               E
+       } enumerator;
 };
 
 caller(arg)
@@ -42,5 +45,11 @@
            arg->signed_long,
            arg->unsigned_long,
            arg->single_floating,       /* gets promoted to 'double' */
-           arg->double_floating);
+           arg->double_floating,
+           arg->enumerator);
 }
+
+/*
+ * XXX: Enumerations may need be promoted to 'int', at least C99 6.3.1.1p2
+ * suggests that: "If an int can represent ...".
+ */
diff -r b591836104e9 -r 374a993487d0 tests/usr.bin/xlint/lint1/expr_promote_trad.exp-ln
--- a/tests/usr.bin/xlint/lint1/expr_promote_trad.exp-ln        Mon Aug 16 20:11:03 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/expr_promote_trad.exp-ln        Mon Aug 16 20:27:31 2021 +0000
@@ -1,5 +1,5 @@
 0sexpr_promote_trad.c
 Sexpr_promote_trad.c
 10d0.10e4sinkFI
-45c0.45s1""i4sinkf11PCIuIIuIIuILuLDDI
-32d0.32do6callerf1PsT116arithmetic_typesI
+49c0.49s1""i4sinkf12PCIuIIuIIuILuLDDeT330.0.0I
+35d0.35do6callerf1PsT116arithmetic_typesI



Home | Main Index | Thread Index | Old Index