bugGNU indent - Bugs: bug #41960, Alternating indent states on...

 
 

bug #41960: Alternating indent states on sample program with successive runs

Submitted by:  Daniel P. Valentine <dpv>
Submitted on:  Wed 26 Mar 2014 04:15:27 AM UTC  
 
Category: CSeverity: 3 - Normal
Item Group: InconsistencyStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 26 Mar 2014 04:15:27 AM UTC, original submission:

From: Alex Bligh
Subject: indent gives unstable output
Date: Thu, 12 Sep 2013 15:19:21 +0100

With the text below, which I have also attached (I realise the mailing
list will probably strip that), indent flips between two states.

This is irritating, as one can't then use indent as a matter of course
before committing to a version control system.

$ indent test.c ; ls -la test.c ; indent test.c ; ls -la test.c ; indent test.c ; ls -la test.c ; cp test.c test2.c ; indent test.c ; ls -la test.c ; diff -u test.c test2.c

-rw-rw-r-- 1 amb amb 765 Sep 12 15:16 test.c
-rw-rw-r-- 1 amb amb 755 Sep 12 15:16 test.c
-rw-rw-r-- 1 amb amb 765 Sep 12 15:16 test.c
-rw-rw-r-- 1 amb amb 755 Sep 12 15:16 test.c
--- test.c 2013-09-12 15:16:07.149612643 +0100
+++ test2.c 2013-09-12 15:16:07.141613168 +0100
@@ -13,10 +13,11 @@
else if (strcasecmp ("SU_PROTO", param_name) == 0)
{
LOG_INFO_MSG ("SU_PROTO is %s, turning it into %d",
- (const char *) param_node_val->children[0].
- content,
- string_to_proto ((const char *) param_node_val->
- children[0].content));
+ (const char *) param_node_val->
+ children[0].content,
+ string_to_proto ((const char *)
+ param_node_val->children[0].
+ content));

unit->protocol = string_to_proto ((const char *) param_node_val->children[0].content); //get_param_val (param_node_val);

}

--
Alex Bligh

$ cat test.c
load_storage_unit (const char *u_name)
{
for (param_node_val = root_element->children; param_node_val;
param_node_val = param_node_val->next)
{
if (param_node_val->type == XML_ELEMENT_NODE)
{
if (strcasecmp ("SU_NAME", param_name) == 0)
{
unit->unit_name = get_param_val (param_node_val);

}
else if (strcasecmp ("SU_PROTO", param_name) == 0)
{
LOG_INFO_MSG ("SU_PROTO is %s, turning it into %d",
(const char *) param_node_val->children[0].
content,
string_to_proto ((const char *) param_node_val->
children[0].content));

unit->protocol = string_to_proto ((const char *) param_node_val->children[0].content); //get_param_val (param_node_val);

}
}
}
}

Daniel P. Valentine <dpv>
Project Administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dpv (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 27 Mar 2014 10:34:58 PM UTCdpvCategoryNone=>C
      Item GroupNone=>Inconsistency

    Back to the top


    Powered by Savane 3.1-cleanup