bugGNU indent - Bugs: bug #35943, Indention in C++11 fails on ranged...

 
 

bug #35943: Indention in C++11 fails on ranged based for loops

Submitted by:  None
Submitted on:  Thu 22 Mar 2012 01:08:29 AM UTC  
 
Category: C++Severity: 3 - Normal
Item Group: NoneStatus: Postponed
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.

 

Mon 24 Mar 2014 03:38:42 AM UTC, comment #5:

The proposed patch causes many regression tests to fail. If a working solution is proposed that does not break current functionality, we can consider it.

Daniel P. Valentine <dpv>
Project Administrator
Mon 03 Jun 2013 09:59:32 PM UTC, comment #4:

correct regression in class

(file #28248)

Kéwan Marconnet <tharvik>
Mon 03 Jun 2013 09:32:04 PM UTC, comment #3:

Oups, forgot the add to the buffer, not replace

(file #28245)

Kéwan Marconnet <tharvik>
Mon 03 Jun 2013 09:23:42 PM UTC, comment #2:

This patch should do it.

(file #28244)

Kéwan Marconnet <tharvik>
Thu 22 Mar 2012 10:38:53 AM UTC, comment #1:

Savanah stole the tabulators, so: The examples were:

1)
int main(){
vector<int> v;
for(auto x:v){
do_something();
}
}

2)
int main(){
\tvector<int> v;
\tfor(auto x:v){
\t\tdo_something();
\t}
}

3)
int main(){
\tvector<int> v;
\ for(auto x:v){ //one space at the beginning
\tdo_something();
\t}
}

Anonymous
Thu 22 Mar 2012 01:08:29 AM UTC, original submission:

If your code is

int main(){
vector<int> v;
for(auto x:v){
do_something();
}
}

the expected output of “indent -brf -brs -linux file.cpp” would be:

int main() {
vector<int> v;
for (auto x:v) {
do_something();
}
}

However, what you get is:

int main(){
vector<int> v;
for (auto x:v) {
do_something();
}
}

The Manpage states, that this tool is not primary for use with C++; nevertheless it would be cool if this could be fixed.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #28274:  foreach.patch added by tharvik (978B - application/octet-stream)
file #28249:  2.2.11-foreach.patch added by tharvik (591B - application/octet-stream - Return on end)
file #28248:  foreach.patch added by tharvik (570B - application/octet-stream - Correct regression in class)
file #28245:  2.2.11-foreach.patch added by tharvik (604B - application/octet-stream - Replace previous patch)
file #28244:  foreach.patch added by tharvik (602B - application/octet-stream - Correct the foreach wrong indent)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dpv (Updated the item)
  • -unavailable- added by tharvik (Updated 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 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 24 Mar 2014 03:38:42 AM UTCdpvStatusNone=>Postponed
    Mon 24 Mar 2014 03:36:33 AM UTCdpvCategoryNone=>C++
    Thu 06 Jun 2013 07:48:09 PM UTCtharvikAttached File-=>Added foreach.patch, #28274
    Mon 03 Jun 2013 10:49:20 PM UTCtharvikAttached File-=>Added 2.2.11-foreach.patch, #28249
    Mon 03 Jun 2013 10:05:00 PM UTCtharvikCarbon-CopyRemoved tharvik=>-
    Mon 03 Jun 2013 09:59:32 PM UTCtharvikAttached File-=>Added foreach.patch, #28248
    Mon 03 Jun 2013 09:32:04 PM UTCtharvikAttached File-=>Added 2.2.11-foreach.patch, #28245
    Mon 03 Jun 2013 09:23:42 PM UTCtharvikAttached File-=>Added foreach.patch, #28244
    Sun 02 Jun 2013 08:53:19 PM UTCtharvikCarbon-Copy-=>Added tharvik

    Back to the top


    Powered by Savane 3.1-cleanup