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 lint: format tests in a common style



details:   https://anonhg.NetBSD.org/src/rev/6f6dba190cfb
branches:  trunk
changeset: 959099:6f6dba190cfb
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jan 31 14:57:28 2021 +0000

description:
lint: format tests in a common style

The lint tests do not focus on the whitespace since that is the most
boring part of code style.  Therefore, format the tests to be readable
by following share/misc/style as close as possible.

diffstat:

 tests/usr.bin/xlint/lint1/d_c99_anon_union.c           |   6 ++--
 tests/usr.bin/xlint/lint1/d_c99_complex_split.c        |  17 +++++++----
 tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt.c     |  12 +++++--
 tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt2.c    |  17 ++++++++---
 tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt3.c    |  11 ++++--
 tests/usr.bin/xlint/lint1/d_c99_func.c                 |   5 ++-
 tests/usr.bin/xlint/lint1/d_c99_nested_struct.c        |  27 ++++++++---------
 tests/usr.bin/xlint/lint1/d_c99_recursive_init.c       |   8 ++--
 tests/usr.bin/xlint/lint1/d_c99_union_cast.c           |   5 ++-
 tests/usr.bin/xlint/lint1/d_c99_union_cast.exp         |   2 +-
 tests/usr.bin/xlint/lint1/d_c99_union_init3.c          |   5 +--
 tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c     |  11 ++++--
 tests/usr.bin/xlint/lint1/d_cast_init.c                |  18 ++++++------
 tests/usr.bin/xlint/lint1/d_cast_init2.c               |   7 ++--
 tests/usr.bin/xlint/lint1/d_cast_lhs.c                 |  13 +++++---
 tests/usr.bin/xlint/lint1/d_compound_literals1.c       |   4 +-
 tests/usr.bin/xlint/lint1/d_compound_literals2.c       |   7 ++--
 tests/usr.bin/xlint/lint1/d_cvt_constant.c             |  13 ++++----
 tests/usr.bin/xlint/lint1/d_cvt_constant.exp           |   4 +-
 tests/usr.bin/xlint/lint1/d_cvt_in_ternary.c           |  11 ++++--
 tests/usr.bin/xlint/lint1/d_ellipsis_in_switch.c       |   5 ++-
 tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c |   8 ++++-
 tests/usr.bin/xlint/lint1/d_gcc_extension.c            |  15 ++++++---
 tests/usr.bin/xlint/lint1/d_gcc_extension.exp          |   4 +-
 tests/usr.bin/xlint/lint1/d_gcc_func.c                 |   5 ++-
 tests/usr.bin/xlint/lint1/d_gcc_variable_array_init.c  |   5 ++-
 tests/usr.bin/xlint/lint1/d_nested_structs.c           |   6 ++--
 tests/usr.bin/xlint/lint1/d_packed_structs.c           |  17 ++++++-----
 tests/usr.bin/xlint/lint1/d_shift_to_narrower_type.c   |   5 ++-
 tests/usr.bin/xlint/lint1/d_type_question_colon.c      |   5 ++-
 tests/usr.bin/xlint/lint1/d_zero_sized_arrays.c        |   4 +-
 31 files changed, 164 insertions(+), 118 deletions(-)

diffs (truncated from 632 to 300 lines):

diff -r 357037b6498d -r 6f6dba190cfb tests/usr.bin/xlint/lint1/d_c99_anon_union.c
--- a/tests/usr.bin/xlint/lint1/d_c99_anon_union.c      Sun Jan 31 14:39:31 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_anon_union.c      Sun Jan 31 14:57:28 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_c99_anon_union.c,v 1.2 2021/01/31 14:39:31 rillig Exp $      */
+/*     $NetBSD: d_c99_anon_union.c,v 1.3 2021/01/31 14:57:28 rillig Exp $      */
 # 3 "d_c99_anon_union.c"
 
 /* struct with only anonymous members */
@@ -11,8 +11,8 @@
 };
 
 int
-main(void) {
-
+main(void)
+{
        struct foo *f = 0;
        printf("%p\n", &f[1]);
        return 0;
diff -r 357037b6498d -r 6f6dba190cfb tests/usr.bin/xlint/lint1/d_c99_complex_split.c
--- a/tests/usr.bin/xlint/lint1/d_c99_complex_split.c   Sun Jan 31 14:39:31 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_complex_split.c   Sun Jan 31 14:57:28 2021 +0000
@@ -1,11 +1,16 @@
-/*     $NetBSD: d_c99_complex_split.c,v 1.3 2021/01/31 14:39:31 rillig Exp $   */
+/*     $NetBSD: d_c99_complex_split.c,v 1.4 2021/01/31 14:57:28 rillig Exp $   */
 # 3 "d_c99_complex_split.c"
 
-int b(double a) {
+int
+b(double a)
+{
        return a == 0;
 }
-void a(void) {
-    double _Complex z = 0;
-    if (b(__real__ z) && b(__imag__ z))
-       return;
+
+void
+a(void)
+{
+       double _Complex z = 0;
+       if (b(__real__ z) && b(__imag__ z))
+               return;
 }
diff -r 357037b6498d -r 6f6dba190cfb tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt.c
--- a/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt.c        Sun Jan 31 14:39:31 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt.c        Sun Jan 31 14:57:28 2021 +0000
@@ -1,8 +1,12 @@
-/*     $NetBSD: d_c99_decls_after_stmt.c,v 1.2 2021/01/31 14:39:31 rillig Exp $        */
+/*     $NetBSD: d_c99_decls_after_stmt.c,v 1.3 2021/01/31 14:57:28 rillig Exp $        */
 # 3 "d_c99_decls_after_stmt.c"
 
-void sample(void)
+void
+sample(void)
 {
-  int i = 0; i += 1;
-  int j = 0; j += 1;
+       int i = 0;
+       i += 1;
+
+       int j = 0;
+       j += 1;
 }
diff -r 357037b6498d -r 6f6dba190cfb tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt2.c
--- a/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt2.c       Sun Jan 31 14:39:31 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt2.c       Sun Jan 31 14:57:28 2021 +0000
@@ -1,9 +1,16 @@
-/*     $NetBSD: d_c99_decls_after_stmt2.c,v 1.2 2021/01/31 14:39:31 rillig Exp $       */
+/*     $NetBSD: d_c99_decls_after_stmt2.c,v 1.3 2021/01/31 14:57:28 rillig Exp $       */
 # 3 "d_c99_decls_after_stmt2.c"
 
 typedef int int_t;
-int main(void) {
-int i = 0; i += 1;
-int_t j = 0; j += 1;
-return 0;
+
+int
+main(void)
+{
+       int i = 0;
+       i += 1;
+
+       int_t j = 0;
+       j += 1;
+
+       return 0;
 }
diff -r 357037b6498d -r 6f6dba190cfb tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt3.c
--- a/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt3.c       Sun Jan 31 14:39:31 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt3.c       Sun Jan 31 14:57:28 2021 +0000
@@ -1,8 +1,11 @@
-/*     $NetBSD: d_c99_decls_after_stmt3.c,v 1.2 2021/01/31 14:39:31 rillig Exp $       */
+/*     $NetBSD: d_c99_decls_after_stmt3.c,v 1.3 2021/01/31 14:57:28 rillig Exp $       */
 # 3 "d_c99_decls_after_stmt3.c"
 
-void sample(int i)
+void
+sample(int i)
 {
-  i += 1;
-  int j = 0; j += 1;
+       i += 1;
+
+       int j = 0;
+       j += 1;
 }
diff -r 357037b6498d -r 6f6dba190cfb tests/usr.bin/xlint/lint1/d_c99_func.c
--- a/tests/usr.bin/xlint/lint1/d_c99_func.c    Sun Jan 31 14:39:31 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_func.c    Sun Jan 31 14:57:28 2021 +0000
@@ -1,10 +1,11 @@
-/*     $NetBSD: d_c99_func.c,v 1.2 2021/01/31 14:39:31 rillig Exp $    */
+/*     $NetBSD: d_c99_func.c,v 1.3 2021/01/31 14:57:28 rillig Exp $    */
 # 3 "d_c99_func.c"
 
 /* C99 __func__ */
 
 void
-foo(const char *p) {
+foo(const char *p)
+{
        p = __func__;
        foo(p);
 }
diff -r 357037b6498d -r 6f6dba190cfb tests/usr.bin/xlint/lint1/d_c99_nested_struct.c
--- a/tests/usr.bin/xlint/lint1/d_c99_nested_struct.c   Sun Jan 31 14:39:31 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_nested_struct.c   Sun Jan 31 14:57:28 2021 +0000
@@ -1,28 +1,27 @@
-/*     $NetBSD: d_c99_nested_struct.c,v 1.2 2021/01/31 14:39:31 rillig Exp $   */
+/*     $NetBSD: d_c99_nested_struct.c,v 1.3 2021/01/31 14:57:28 rillig Exp $   */
 # 3 "d_c99_nested_struct.c"
 
 /* C99 nested struct init with named and non-named initializers */
 typedef struct pthread_mutex_t {
- unsigned int ptm_magic;
- char ptm_errorcheck;
+       unsigned int ptm_magic;
+       char ptm_errorcheck;
 
- char ptm_pad1[3];
+       char ptm_pad1[3];
 
- char ptm_interlock;
+       char ptm_interlock;
 
- char ptm_pad2[3];
+       char ptm_pad2[3];
 
- volatile void * ptm_owner;
- void * volatile ptm_waiters;
- unsigned int ptm_recursed;
- void *ptm_spare2;
+       volatile void *ptm_owner;
+       void *volatile ptm_waiters;
+       unsigned int ptm_recursed;
+       void *ptm_spare2;
 } pthread_mutex_t;
 
 
 struct arc4random_global {
-
- pthread_mutex_t lock;
+       pthread_mutex_t lock;
 } arc4random_global = {
-
- .lock = { 0x33330003, 0, { 0, 0, 0 }, 0, { 0, 0, 0 }, ((void *)0), ((void *)0), 0, ((void *)0) },
+       .lock = { 0x33330003, 0, { 0, 0, 0 }, 0, { 0, 0, 0 }, ((void *)0),
+                 ((void *)0), 0, ((void *)0) },
 };
diff -r 357037b6498d -r 6f6dba190cfb tests/usr.bin/xlint/lint1/d_c99_recursive_init.c
--- a/tests/usr.bin/xlint/lint1/d_c99_recursive_init.c  Sun Jan 31 14:39:31 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_recursive_init.c  Sun Jan 31 14:57:28 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_c99_recursive_init.c,v 1.3 2021/01/31 14:39:31 rillig Exp $  */
+/*     $NetBSD: d_c99_recursive_init.c,v 1.4 2021/01/31 14:57:28 rillig Exp $  */
 # 3 "d_c99_recursive_init.c"
 
 /* C99 recursive struct/union initialization */
@@ -8,9 +8,9 @@
        union onion {
                short us;
                char uc;
-       }  u;
+       } u;
        char *s;
 } c[] = {
-       { .s = "foo", .c = 'b', .u = { .uc = 'c' } },
-       { .i = 1, .c = 'a', .u = { .us = 2 } },
+       { .s = "foo", .c = 'b', .u = { .uc = 'c' }},
+       { .i = 1, .c = 'a', .u = { .us = 2 }},
 };
diff -r 357037b6498d -r 6f6dba190cfb tests/usr.bin/xlint/lint1/d_c99_union_cast.c
--- a/tests/usr.bin/xlint/lint1/d_c99_union_cast.c      Sun Jan 31 14:39:31 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_union_cast.c      Sun Jan 31 14:57:28 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_c99_union_cast.c,v 1.2 2021/01/31 14:39:31 rillig Exp $      */
+/*     $NetBSD: d_c99_union_cast.c,v 1.3 2021/01/31 14:57:28 rillig Exp $      */
 # 3 "d_c99_union_cast.c"
 
 /* union cast */
@@ -14,7 +14,8 @@
 };
 
 void
-foo(void) {
+foo(void)
+{
        struct bar *a;
 
        ((union foo)a).a;
diff -r 357037b6498d -r 6f6dba190cfb tests/usr.bin/xlint/lint1/d_c99_union_cast.exp
--- a/tests/usr.bin/xlint/lint1/d_c99_union_cast.exp    Sun Jan 31 14:39:31 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_union_cast.exp    Sun Jan 31 14:57:28 2021 +0000
@@ -1,1 +1,1 @@
-d_c99_union_cast.c(18): warning: a unused in function foo [192]
+d_c99_union_cast.c(19): warning: a unused in function foo [192]
diff -r 357037b6498d -r 6f6dba190cfb tests/usr.bin/xlint/lint1/d_c99_union_init3.c
--- a/tests/usr.bin/xlint/lint1/d_c99_union_init3.c     Sun Jan 31 14:39:31 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_union_init3.c     Sun Jan 31 14:57:28 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_c99_union_init3.c,v 1.3 2021/01/31 14:39:31 rillig Exp $     */
+/*     $NetBSD: d_c99_union_init3.c,v 1.4 2021/01/31 14:57:28 rillig Exp $     */
 # 3 "d_c99_union_init3.c"
 
 /* C99 union initialization */
@@ -6,6 +6,5 @@
        int i[10];
        char *s;
 } c[] = {
-       { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
-       "foo" },
+       {{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, "foo" },
 };
diff -r 357037b6498d -r 6f6dba190cfb tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c
--- a/tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c        Sun Jan 31 14:39:31 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c        Sun Jan 31 14:57:28 2021 +0000
@@ -1,11 +1,14 @@
-/*     $NetBSD: d_cast_fun_array_param.c,v 1.2 2021/01/31 14:39:31 rillig Exp $        */
+/*     $NetBSD: d_cast_fun_array_param.c,v 1.3 2021/01/31 14:57:28 rillig Exp $        */
 # 3 "d_cast_fun_array_param.c"
 
-static void f(void *b[4]) {
+static void
+f(void *b[4])
+{
        (void)&b;
 }
 
 void *
-foo(void *fn) {
-       return fn == 0 ? f : (void (*)(void *[4])) fn;
+foo(void *fn)
+{
+       return fn == 0 ? f : (void (*)(void *[4]))fn;
 }
diff -r 357037b6498d -r 6f6dba190cfb tests/usr.bin/xlint/lint1/d_cast_init.c
--- a/tests/usr.bin/xlint/lint1/d_cast_init.c   Sun Jan 31 14:39:31 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_cast_init.c   Sun Jan 31 14:57:28 2021 +0000
@@ -1,19 +1,19 @@
-/*     $NetBSD: d_cast_init.c,v 1.3 2021/01/31 14:39:31 rillig Exp $   */
+/*     $NetBSD: d_cast_init.c,v 1.4 2021/01/31 14:57:28 rillig Exp $   */
 # 3 "d_cast_init.c"
 
 /* cast initialization */
 
 typedef unsigned char u_char;
 
-struct sockaddr_x25 {
-       u_char  x25_len;
-       u_char  x25_family;
-       char    x25_udata[4];
+struct sockaddr_x25 {
+       u_char x25_len;
+       u_char x25_family;
+       char x25_udata[4];
 };
 
 struct sockaddr_x25 x25_dgmask = {
-       (unsigned char)(unsigned char)(unsigned int)(unsigned long)
-       (&((( struct sockaddr_x25  *)0)->x25_udata[1])),
-       0,
-       {-1, -1, -1, -1},
+    (unsigned char)(unsigned char)(unsigned int)(unsigned long)
+       (&(((struct sockaddr_x25 *)0)->x25_udata[1])),
+    0,
+    { -1, -1, -1, -1 },
 };
diff -r 357037b6498d -r 6f6dba190cfb tests/usr.bin/xlint/lint1/d_cast_init2.c
--- a/tests/usr.bin/xlint/lint1/d_cast_init2.c  Sun Jan 31 14:39:31 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_cast_init2.c  Sun Jan 31 14:57:28 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_cast_init2.c,v 1.2 2021/01/31 14:39:31 rillig Exp $  */
+/*     $NetBSD: d_cast_init2.c,v 1.3 2021/01/31 14:57:28 rillig Exp $  */
 # 3 "d_cast_init2.c"
 
 /* cast initialization as the rhs of a - operand */
@@ -6,5 +6,6 @@



Home | Main Index | Thread Index | Old Index