updated version to 3.6.12
I get this too in ver. 3.6.12. An align-pointer=name has no effect on e.g. this: protected: virtual void DoDataExchange (CDataExchange* pDX); DECLARE_MESSAGE_MAP() I want virtual void DoDataExchange (CDataExchange *pDX); but astyle does not make it so.
Hi, Please ignore this issue as I was not able to reproduce it. Sorry for the inconvenience. Thanks!
When Astyle fails to open a specified file, the file is emptied
Thx, I pushed an update into the git repo
Hello Simon, Thank you for your reply an for looking at this, Unfortunately I tested on the version 3.6.10 and it seems that the lamdas are no longer indented Original indenting int func() { auto addLambda = [](int a, int b) { return a + b; }; } Then I run astyle-3.6.10-x64> .\astyle.exe --style=allman --indent=spaces=3 --indent-lambda MyFile.c Which gives me int func() { auto addLambda = [](int a, int b) { return a + b; }; } While in version 3.6.7 I have int func() { auto addLambda = [](int a, int...
Hello, I tested on the version 3.6.10 and it seems that the lamdas are no longer indented Original indenting int func() { auto addLambda = [](int a, int b) { return a + b; }; } Then I run astyle-3.6.10-x64> .\astyle.exe --style=allman --indent=spaces=3 --indent-lambda MyFile.c Which gives me int func() { auto addLambda = [](int a, int b) { return a + b; }; } While in version 3.6.7 I have int func() { auto addLambda = [](int a, int b) { return a + b; }; }
Hello, I tested on the version 3.6.10 and it seems that the lamdas are no longer indented Original indenting int func() { auto addLambda = [](int a, int b) { return a + b; }; } Then I run astyle-3.6.10-x64> .\astyle.exe --style=allman --indent=spaces=3 --indent-lambda MyFile.c Which gives me int func() { auto addLambda = [](int a, int b) { return a + b; }; } While in version 3.6.7 I have int func() { auto addLambda = [](int a, int b) { return a + b; }; }
Unexpected indent in immediately called lambda
Hi, please try again with 3.6.10
Please try with 3.6.10.
I have pushed a fix to the repo
Hi Marco, adding a single space after // also increases readability for humans. Therefore, many style guides prescribe this type of visual padding between the “frame” of the comment and its content.
Hello @saalen, yes, there are some rows of code: #include <string.h> #include <stdlib.h> #include <stdio.h> /////////////////////////////////////////////////////////// // INCLUDE COMUNI /////////////////////////////////////////////////////////// #include "configBase.h" #include "errorCode.h"//serve x AP_ERR #include "message.h" #include "myLib.h"//serve per AM #include "apEnum.h" #include "vegaassert.h" /////////////////////////////////////////////////////////// // INCLUDE SPECIFICI ///////////////////////////////////////////////////////////...
References in lambda parameter lists are not formatted according to --align-reference=type
Hi, is there any code before this function to trigger this?
indentation preprocessor inside functions
--align-pointer=type and --align-reference=type behave incorrectly
The problem with * ptr = 10; is still present in 3.6.9
The problem with * ptr = 10; still present in 3.6.9
Could you please add your examples as text like this: ```cpp verbatim copy of your code section goes here ``` The images are very small and are placed in the wrong place when clicked. In addition, they cannot be copied to easily verify the problem and possible fixes. And finally: Which Artistic Style version do you use?
Could you please add your examples as text like this: ```cpp verbatim copy of your code section goes here ``` The images are very small and are placed in the wrong place when clicked. In addition, they cannot be copied to easily verify the problem and possible fixes. Which version are you using?
With example 3
With example 2
With example 1
Issue with indenting if without brackets and if-else (with or without brackets) when in a lambda block.
AStyle 3.6.7: class modifiers indentation
AStyle 3.6.7: wrong indentation of multi-line assignment
astyle 3.6.8 (git 2025-03-14): incorrect using indentation
astyle 3.6.8 (git 2025-03-14): incorrect function-scope class indentation
astyle 3.6.8 (git 2025-03-17): unexpected linebreak for inherited class
Unwanted indentation after >>>
Unexpected change of raw string literal
I have pushed a fix for the first problem (pointer reference). It works correctly now, thanks! The second you can inmprove with --squeeze-ws. But only int will be recognized as a type, this is a limitation of the current parser. Hopfully this function can be restored again at some time. I've been relying on it a lot in Astyle 3.1 to normalize third-party codebases, especially all the function signatures.
I have pushed a fix for the first problem (pointer reference). The second you can inmprove with --squeeze-ws. But only int will be recognized as a type, this is a limitation of the current parser.
There seems to be a more general issue: Astyle keeps the following code unchanged: void test(int* test) { wxWindow * const win = nullptr; int* const win = nullptr; std::vector<std::pair<int, int>> * const win = nullptr; } expected: void test(int* test) { wxWindow* const win = nullptr; int* const win = nullptr; std::vector<std::pair<int, int>>* const win = nullptr; }
Perfect, the issue has been fixed!
Unwanted indentation after >>>
I pushed a fix for this one (Java operators confusion)
Preserve one-liners in switch
I just realized there is "--keep-one-line-statements", and it works for switches, too!! Ticket can be closed! :)
Sorry, this should have been filed under "Feature Requests", not "Bugs".
My Astyle config used: --style=allman --suffix=none --keep-one-line-blocks --align-pointer=type --min-conditional-indent=0 --max-continuation-indent=80 --indent-switches --indent-col1-comments --indent-preproc-block --indent-preproc-define --pad-header --pad-comma --formatted --lineend=linux --indent-preproc-block --convert-tabs --preserve-ws
Preserve one-liners in switch
Unexpected change of raw string literal
There is also the opposite case: AStyle produces: auto test() { return { .ai_flags = AI_ADDRCONFIG | AI_PASSIVE }; } while the expected result is: auto test() { return { .ai_flags = AI_ADDRCONFIG | AI_PASSIVE }; }
Unwanted indentation after >>>
Unwanted space between *&
Wrong indendation when returning struct
The ticked can be closed! Apparently the latest changes to https://sourceforge.net/p/astyle/bugs/585/ fixed this one as well! Thanks!
Thank you! :) Ticket can be closed.
Thinking about it, the expected result is probably better this one: template <typename... Ts> struct is_proxy_type_list<ProxyTypeList<Ts...>> : std::true_type {}; template <typename T> struct GenerateTypeList { private: using proxy = typename std::conditional<is_proxy_type_list<T>::value, T, ProxyTypeList<T>>::type; }; But with your latest changes, the current code produces: template <typename T> struct GenerateTypeList { private: using proxy = typename std::conditional<is_proxy_type_list<T>::value,...
The ticked can be closed! Apparently the latest changes to https://sourceforge.net/p/astyle/bugs/585/ fixed this one as well! Thanks!
Awesome! I seem to have run out of any more of these issues :D The ticket can probably be closed.
I have pushed another variant of the fix.
Please try again with the latest version in git.
This issue should be fixed! See https://sourceforge.net/p/astyle/bugs/585/
astyle 3.6.8 (git 2025-03-17): unexpected linebreak for inherited class
Alas, one problematic "switch" remains: struct TreeView { bool operator()(const TreeLine& lhs, const TreeLine& rhs) { switch (lhs.type) { case NodeType::root: return true; case NodeType::folder: { const auto* folderL = nullptr; if (!folderL) return false; return true; } case NodeType::files: break; } assert(false); return false; } };
The issue seems to be fixed!
Here's a probably related issue with function "missingIndent()": void test(const std::vector<std::pair<int, int>>& workload) { } class NativeFileSystem { public: Zstring missingIndent() const { return isNullFileSystem() ? Zstring{} : rootPath_; } };
This is a major improvement! Most issues are gone, but not the following: class GdriveFileState { public: std::optional<std::vector<int>> tryGetBufferedFolderContent() { return {}; } struct FileStateDelta { FileStateDelta() {} private: int test = 0; }; };
astyle 3.6.8 (git 2025-03-14): incorrect switch indentation
astyle 3.6.8 (git 2025-03-14): incorrect using indentation
Please try these cases with the latest git version.
I have reverted this fix as it was based on a wrong assumption... the problem is the template earlier which triggers the indent in the unrelated code later. Well back in the day it was no rocket science to compile something which had no third party dependencies. Simple things should be kept simple ;)
Hi, I pushed another fix
Unfortunately this example doesn't work yet: namespace { struct SshDeviceId { }; class SftpSessionManager { public: class SshSessionShared { public: SshSessionShared() : session_(0) {} int session_; }; } } should be namespace { struct SshDeviceId { }; class SftpSessionManager { public: class SshSessionShared { public: SshSessionShared() : session_(0) {} int session_; }; } }
astyle 3.6.8 (git 2025-03-14): incorrect function-scope class indentation
astyle 3.6.8 (git 2025-03-14): incorrect using indentation
This is probably the same error: (full repro when inside .cpp file) namespace fff { struct FileAttributes { }; SyncDirection getEffectiveSyncDir(SyncOperation syncOp) { switch (syncOp) { case SO_CREATE_LEFT: case SO_DELETE_LEFT: case SO_OVERWRITE_LEFT: case SO_RENAME_LEFT: case SO_MOVE_LEFT_FROM: case SO_MOVE_LEFT_TO: return SyncDirection::left; case SO_DO_NOTHING: case SO_EQUAL: case SO_UNRESOLVED_CONFLICT: break; } return SyncDirection::none; } }
astyle 3.6.8 (git 2025-03-14): incorrect switch indentation
It works! :)
It works! :) BTW thanks for supporting all these different build environments: I downloaded the latest Astyle code from git, opened the vs2022 solution, just compiled: executable built, no errors! My mind is a bit blown by how great this works and how easys it is. I didn't even have to read any documentation, or fiddle with compiler options. It' s like when you're used to torture, but then you're unexpectedly offered a spa...
I have pushed a fix in the git repo.
I have pushed a fix in the git repo.
I don't think it's a good idea to change the actual code just to avoid incorrect formatting of the sources. Some compilers will optimize away the string concatenations, others will not, resulting in significant runtime degradation. A better way, also obvious for future reader, is to prevent formatting on portions of the code: // *INDENT-OFF* std::string test() { return "--" + boundaryString + "\r\n" "Content-Type: application/json; charset=UTF-8" "\r\n" /**/ "\r\n" + metaDataBuf + "\r\n" "--" + boundaryString...
I don't think it's a good idea to change the actual code just to avoid incorrect formatting of the sources. Some compilers will optimize away the string concatenations, others will not, resulting in significant runtime degradation. A better way, also obvious for future reader, is to prevent formatting on portions of the code: // *INDENT-OFF* std::string test() { return "--" + boundaryString + "\r\n" "Content-Type: application/json; charset=UTF-8" "\r\n" /**/ "\r\n" + metaDataBuf + "\r\n" "--" + boundaryString...
I don't think it's a good idea to change the actual code just to avoid incorrect formatting of the sources. Some compilers will optimize away the string concatenations, others will not, resulting in significant runtime degradation. A better way, also obvious for future reader, is to prevent formatting on portions of the code: // *INDENT-OFF* std::string test() { return "--" + boundaryString + "\r\n" "Content-Type: application/json; charset=UTF-8" "\r\n" /**/ "\r\n" + metaDataBuf + "\r\n" "--" + boundaryString...
astyle 3.6.7: incorrect indentation within parenthesis
Hi, until a fix is available you can avoid this by adding string concat operator (+) like this: std::string test() { return "--" + boundaryString + "\r\n" + "Content-Type: application/json; charset=UTF-8" "\r\n" + /**/ "\r\n" + metaDataBuf + "\r\n" + "--" + boundaryString + "\r\n" "Content-Type: application/octet-stream" "\r\n" /**/ "\r\n"; }
astyle 3.6.7: incorrect indentation within parenthesis
AStyle 3.6.7: wrong indentation of multi-line string concat
AStyle 3.6.7: wrong indentation of multi-line assignment
AStyle 3.6.7: class modifiers indentation