Community
Participate
Working Groups
Build Identifier: M20100909-0800 When doing auto-indent (CTRL + i) it indents the braces of the function. But only if the function returns a pointer! That is has '*' in the function declaration. Remove '*' and it works. Example: const int * functionx(int xxx) const int * functionx(int xxx) {//NOT OK }//NOT OK const int functionx(int xxx) { //OK } //OK I notice that Auto Formatting ( CTRL+SHIFT+'f') indents correctly. Could be related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=298282 Reproducible: Always Steps to Reproduce: 1. Choose project -> "Code Style" -> "K&R [built-in]" 2. Click "Edit" 2. Name it "K&R [built-in] Modified" 3. Tab "Braces" -> "Function Declaration" -> "Next Line" 4. Press "OK" 5. Write these functions in a file test.c ------------------- START ------ const int * functionx(int xxx) { //try auto indent on this function. CTRL + "i" return &xxx; } const int functionx(int xxx) { //try auto indent on this function. CTRL + "i" return xxx; } ------------------- END ------ 6. Mark them and auto format using CTRL + SHIFT + 'F'. 7. Now auto indent them using CTRL + 'i'. 8. The indentation of the first functions braces are indented (wrongly)! 9. Notice: Now auto indent them AGAIN using CTRL + 'i', they move one more time. 10. Notice; Mark them and then auto format them again fixes it (CTRL + SHIFT + 'F').
Strange that nobody found that before. No regression, I can even reproduce with Galileo.
Note that const int *functionx(int xxx) works (no space between * and function name).
Fixed in HEAD and cdt_7_0.
*** cdt cvs genie on behalf of aleherbau *** Bug 334805 - Auto Indentation (CTRL+i) is not correct after function header with pointer return type [*] CIndenterTest.java 1.20 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java?root=Tools_Project&r1=1.19&r2=1.20 [*] CIndenter.java 1.37 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java?root=Tools_Project&r1=1.36&r2=1.37 [*] DocumentCharacterIterator.java 1.7 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/DocumentCharacterIterator.java?root=Tools_Project&r1=1.6&r2=1.7 [*] CIndenterTest.java 1.18.2.2 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java?root=Tools_Project&r1=1.18.2.1&r2=1.18.2.2 [*] CIndenter.java 1.35.2.2 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java?root=Tools_Project&r1=1.35.2.1&r2=1.35.2.2 [*] DocumentCharacterIterator.java 1.6.14.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/DocumentCharacterIterator.java?root=Tools_Project&r1=1.6&r2=1.6.14.1
*** Bug 317279 has been marked as a duplicate of this bug. ***