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 GCC compound expr...



details:   https://anonhg.NetBSD.org/src/rev/02ccbfb10cbf
branches:  trunk
changeset: 982688:02ccbfb10cbf
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Apr 23 20:13:29 2021 +0000

description:
tests/lint: test GCC compound expression without declaration

diffstat:

 tests/usr.bin/xlint/lint1/d_gcc_compound_statements2.c |  21 +++++++++++++----
 1 files changed, 16 insertions(+), 5 deletions(-)

diffs (36 lines):

diff -r 10b9c5fd69a6 -r 02ccbfb10cbf tests/usr.bin/xlint/lint1/d_gcc_compound_statements2.c
--- a/tests/usr.bin/xlint/lint1/d_gcc_compound_statements2.c    Fri Apr 23 15:21:49 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_gcc_compound_statements2.c    Fri Apr 23 20:13:29 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_gcc_compound_statements2.c,v 1.2 2021/01/31 14:39:31 rillig Exp $    */
+/*     $NetBSD: d_gcc_compound_statements2.c,v 1.3 2021/04/23 20:13:29 rillig Exp $    */
 # 3 "d_gcc_compound_statements2.c"
 
 /* GCC compound statements with non-expressions */
@@ -7,11 +7,22 @@
 };
 
 int
-main(void)
+compound_expression_with_decl_and_stmt(void)
 {
        return ({
-           struct cpu_info *__ci;
-           __asm__ volatile("movl %%fs:4,%0":"=r" (__ci));
-           __ci;
+           struct cpu_info *ci;
+           __asm__ volatile("movl %%fs:4,%0":"=r" (ci));
+           ci;
        })->bar;
 }
+
+int
+compound_expression_with_only_stmt(void)
+{
+       struct cpu_info ci = { 0 };
+       return ({
+           if (ci.bar > 0)
+               ci.bar++;
+           ci;
+       }).bar;
+}



Home | Main Index | Thread Index | Old Index