rpms/indent/devel indent-2.2.9-cdw.patch, NONE, 1.1 indent.spec, 1.16, 1.17
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Fri Jan 27 16:42:31 UTC 2006
Author: pmachata
Update of /cvs/dist/rpms/indent/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv21407
Modified Files:
indent.spec
Added Files:
indent-2.2.9-cdw.patch
Log Message:
- Changed the placement of closing `while' of `do {} while' command
under a -cdw option. It's now cuddled up to the brace. (#67781)
- Changed the indentation of cuddled `else': the brace is lined up
under opening brace. Let's see if people like it. It looks less
strange than before, but still it looks strange.
indent-2.2.9-cdw.patch:
indent.c | 15 ++++++++++++---
indent.h | 3 +++
parse.c | 15 +++++++++++++++
3 files changed, 30 insertions(+), 3 deletions(-)
--- NEW FILE indent-2.2.9-cdw.patch ---
diff -burp indent-2.2.9/src/indent.c indent-2.2.9-cdw/src/indent.c
--- indent-2.2.9/src/indent.c 2006-01-18 18:22:36.000000000 +0100
+++ indent-2.2.9-cdw/src/indent.c 2006-01-27 17:13:55.000000000 +0100
@@ -976,13 +976,10 @@ static void handle_token_semicolon(
if (!*sp_sw)
{ /* if not if for (;;) */
- do
- {
if (parse (semicolon) != total_success)
{
*file_exit_value = indent_error;
}
- } while(0);
*force_nl = true; /* force newline after a end of stmt */
}
@@ -2625,6 +2622,18 @@ static exit_values_ty indent_main_loop(v
return file_exit_value; /* RETURN */
}
+ if (type_code == sp_paren
+ && parser_state_tos->p_stack[parser_state_tos->tos] == dohead
+ && parser_state_tos->last_token == rbrace)
+ {
+ /* This is closing `while' of `do {stuff;} while'
+ statement (not `do stuff; while' command). In -cdw, we
+ want to suppress newline. */
+ if (settings.cuddle_do_while)
+ force_nl = false;
+ parser_state_tos->in_closing_br_while = true;
+ }
+
if ((type_code != comment) &&
(type_code != cplus_comment) &&
(type_code != newline) &&
diff -burp indent-2.2.9/src/indent.h indent-2.2.9-cdw/src/indent.h
--- indent-2.2.9/src/indent.h 2006-01-18 18:22:36.000000000 +0100
+++ indent-2.2.9-cdw/src/indent.h 2006-01-27 17:20:14.000000000 +0100
@@ -357,6 +357,9 @@ typedef struct parser_state
BOOLEAN in_decl; /* set to true when we are in a declaration
* statement. The processing of braces is then
* slightly different */
+ BOOLEAN in_closing_br_while; /* set to true when we are parsing
+ * closing while of do {} while
+ * statement*/
int in_stmt; /* set to 1 while in a stmt */
int in_parameter_declaration;
int ind_level; /* the current indentation level in spaces */
diff -burp indent-2.2.9/src/parse.c indent-2.2.9-cdw/src/parse.c
--- indent-2.2.9/src/parse.c 2002-08-04 19:08:41.000000000 +0200
+++ indent-2.2.9-cdw/src/parse.c 2006-01-27 17:18:52.000000000 +0100
@@ -38,6 +38,7 @@ void init_parser (void)
parser_state_tos->cstk = (int *) xmalloc (INITIAL_STACK_SIZE * sizeof (int));
parser_state_tos->paren_indents_size = 8;
parser_state_tos->paren_indents = (short *) xmalloc (parser_state_tos->paren_indents_size * sizeof (short));
+ parser_state_tos->in_closing_br_while = false;
/* Although these are supposed to grow if we reach the end,
* I can find no place in the code which does this. */
@@ -380,6 +381,14 @@ exit_values_ty parse (
parser_state_tos->ind_level = parser_state_tos->i_l_follow;
parser_state_tos->il[parser_state_tos->tos] = parser_state_tos->i_l_follow;
+
+ if (parser_state_tos->in_closing_br_while
+ && settings.cuddle_do_while
+ && !settings.btype_2)
+ {
+ parser_state_tos->ind_level += settings.brace_indent;
+ }
+ parser_state_tos->in_closing_br_while = false;
}
else
{ /* it is a while loop */
@@ -409,6 +418,12 @@ exit_values_ty parse (
parser_state_tos->p_stack[parser_state_tos->tos] = elsehead;
/* remember if with else */
parser_state_tos->search_brace = true;
+
+ if (settings.cuddle_else
+ && !settings.btype_2)
+ {
+ parser_state_tos->ind_level += settings.brace_indent;
+ }
}
break;
Index: indent.spec
===================================================================
RCS file: /cvs/dist/rpms/indent/devel/indent.spec,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- indent.spec 18 Jan 2006 17:35:44 -0000 1.16
+++ indent.spec 27 Jan 2006 16:42:29 -0000 1.17
@@ -1,7 +1,7 @@
Summary: A GNU program for formatting C code.
Name: indent
Version: 2.2.9
-Release: 9
+Release: 10
License: GPL
Group: Applications/Text
URL: http://www.gnu.org/software/indent/
@@ -9,6 +9,7 @@
Patch: indent-2.2.9-fix.patch
Patch2: indent-2.2.9-gcc4.patch
Patch3: indent-2.2.9-explicits.patch
+Patch4: indent-2.2.9-cdw.patch
Prereq: /sbin/install-info
BuildRoot: %{_tmppath}/%{name}-%{version}-root
@@ -26,6 +27,7 @@
%patch -p1
%patch2 -p1
%patch3 -p1
+%patch4 -p1
%build
@@ -64,7 +66,14 @@
%changelog
-* Wed Jan 18 2006 Petr Machata <pmachata at redhat.com>
+* Wed Jan 27 2006 Petr Machata <pmachata at redhat.com> 2.2.9-10
+- Changed the placement of closing `while' of `do {} while' command
+ under a -cdw option. It's now cuddled up to the brace. (#67781)
+- Changed the indentation of cuddled `else': the brace is lined up
+ under opening brace. Let's see if people like it. It looks less
+ strange than before, but still it looks strange.
+
+* Wed Jan 18 2006 Petr Machata <pmachata at redhat.com> 2.2.9-9
- Silenting some warnings, voidifying some functions that were
implicitly int but didn't actually return anything. (#114376)
More information about the fedora-cvs-commits
mailing list