[BACK]Return to token_keyword_struct_union_enum.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / tests / usr.bin / indent

Annotation of src/tests/usr.bin/indent/token_keyword_struct_union_enum.c, Revision 1.4

1.4     ! rillig      1: /* $NetBSD: token_keyword_struct_union_enum.c,v 1.3 2021/11/07 15:44:28 rillig Exp $ */
1.1       rillig      2:
                      3: /*
                      4:  * Tests for the keywords 'struct', 'union' and 'enum'.
                      5:  */
                      6:
                      7: #indent input
                      8: struct stat {
                      9:        mode_t          st_mode;
                     10: };
                     11:
                     12: union variant {
                     13:        enum {
                     14:        }               tag;
                     15:        int             v_int;
                     16:        long            v_long;
                     17:        bool            v_bool;
                     18:        void           *v_pointer;
                     19: };
                     20: #indent end
                     21:
                     22: #indent run-equals-input
1.2       rillig     23:
                     24:
                     25: /* See FreeBSD r303485. */
                     26: #indent input
                     27: int f(struct x *a);
                     28:
                     29: void
                     30: t(void)
                     31: {
                     32:        static const struct {
                     33:                int     a;
                     34:                int     b;
                     35:        } c[] = {
                     36:                { D, E },
                     37:                { F, G }
                     38:        };
                     39: }
                     40:
                     41: void u(struct x a) {
                     42:        int b;
                     43:        struct y c = (struct y *)&a;
                     44: }
                     45: #indent end
                     46:
                     47: #indent run
                     48: int            f(struct x *a);
                     49:
                     50: void
                     51: t(void)
                     52: {
                     53:        static const struct {
                     54:                int             a;
                     55:                int             b;
                     56:        }               c[] = {
                     57:                {D, E},
                     58:                {F, G}
                     59:        };
                     60: }
                     61:
                     62: void
                     63: u(struct x a)
                     64: {
                     65:        int             b;
                     66:        struct y        c = (struct y *)&a;
                     67: }
                     68: #indent end
1.3       rillig     69:
                     70:
                     71: /* Comment between 'struct' and the tag name; doesn't occur in practice. */
                     72: #indent input
                     73: struct   /* comment */   tag var;
                     74: #indent end
                     75:
                     76: #indent run -di0
                     77: struct /* comment */ tag var;
                     78: #indent end

CVSweb <webmaster@jp.NetBSD.org>