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

 
 

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

Submitter:  None
Submitted:  Thu 22 Mar 2012 01:08:29 AM UTC
   
 
Category:  C++ Severity:  3 - Normal
Item Group:  None Status:  Postponed
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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 Files:
   
   
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
  • -email is unavailable- added by dpv (Updated the item)
  • -email is unavailable- added by tharvik (Updated 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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-03-24 dpv StatusNone Postponed
    2014-03-24 dpv CategoryNone C++
    2013-06-06 tharvik Attached File- Added foreach.patch, #28274
    2013-06-03 tharvik Attached File- Added 2.2.11-foreach.patch, #28249
    2013-06-03 tharvik Carbon-CopyRemoved tharvik -
    2013-06-03 tharvik Attached File- Added foreach.patch, #28248
    2013-06-03 tharvik Attached File- Added 2.2.11-foreach.patch, #28245
    2013-06-03 tharvik Attached File- Added foreach.patch, #28244
    2013-06-02 tharvik Carbon-Copy- Added tharvik

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code