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

 
 

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

Submitter:  Daniel P. Valentine <dpv>
Submitted:  Wed 26 Mar 2014 04:15:27 AM UTC
   
 
Category:  C Severity:  3 - Normal
Item Group:  Inconsistency Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-03-27 dpv CategoryNone C
        Item GroupNone Inconsistency

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code