🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Charlie Xiaoli Huang Thu, 03 Sep 1992 18:23
following up on indent 1.6 (forced newline in typedef)
#722
Author: Charlie Xiaoli Huang
Date: Thu, 03 Sep 1992 18:23
63 lines
2064 bytes
Following up on my previous message on a forced newline 
at end of typedef, I'm convinced it is a bug. The reason
is inconsistent behavior as follows:

	original:

	typedef struct foo {
	int bar;
	} foo_t;

will become

	typedef struct foo {
		int bar;
	} 
	foo_t;

whereas 

	original

	typedef struct foo {
	int bar;
	struct fubar x;
	} foo_t;

will become

	typedef struct foo {
		iunt bar;
		struct fubar x;
	} foo_t;

As you can see, the inserted newline before type name "foo_t"
is insterted if the last member of the struct is NOT a struct.

I've attempted to track down where in indent.c the decision 
was made to set the force_nl var in this case, and made the 
fix as follows:

*** indent.c    Thu Sep  3 11:02:27 1992
--- indent.c.orig       Wed Aug 19 15:32:29 1992
***************
*** 997,1006 ****
          prefix_blankline_requested = 0;
          parse (rbrace);       /* let parser know about this */
          if ((parser_state_tos->last_rw != rw_struct_like
-              && parser_state_tos->last_rw != rw_decl  /* hxl@epic.com added
-                                                          so that things like
-                                                          typedef struct won't have 
-                                                          a forced newline */
               && (parser_state_tos->p_stack[parser_state_tos->tos] == stmtl
                  || (parser_state_tos->p_stack[parser_state_tos->tos]
                      == ifhead)))
--- 997,1002 ----

It seems to work all right FOR MY CODE. 

Please let me know what you think.

Thanks,

hxl
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads