Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package astyle for openSUSE:Factory checked in at 2023-06-20 16:48:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/astyle (Old) and /work/SRC/openSUSE:Factory/.astyle.new.15902 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "astyle" Tue Jun 20 16:48:17 2023 rev:18 rq:1093777 version:3.4 Changes: -------- --- /work/SRC/openSUSE:Factory/astyle/astyle.changes 2023-06-09 20:38:28.542915901 +0200 +++ /work/SRC/openSUSE:Factory/.astyle.new.15902/astyle.changes 2023-06-20 16:48:28.307402325 +0200 @@ -1,0 +2,11 @@ +Sat Jun 17 18:59:34 UTC 2023 - Antoine Belvire <antoine.belv...@opensuse.org> + +- Update to 3.4: + * Fixed formatting of CS interpolation literals (gl#saalen/astyle#8). + * Fixed false lambda recognition (gl#saalen/astyle#11). + * Fixed indentation of member declarations (gl#saalen/astyle#10). + * Fixed indentation of struct assignments (gl#saalen/astyle#12). + * Added new option "--indent-lambda" to to enable new lambda recognition + (gl#saalen/astyle#7). + +------------------------------------------------------------------- Old: ---- astyle-3.3.1.tar.bz2 New: ---- astyle-3.4.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ astyle.spec ++++++ --- /var/tmp/diff_new_pack.nZ2PGT/_old 2023-06-20 16:48:28.927406051 +0200 +++ /var/tmp/diff_new_pack.nZ2PGT/_new 2023-06-20 16:48:28.931406075 +0200 @@ -17,7 +17,7 @@ Name: astyle -Version: 3.3.1 +Version: 3.4 Release: 0 Summary: Source Code Indenter, Formatter, and Beautifier for C, C++, C# and Java License: MIT ++++++ astyle-3.3.1.tar.bz2 -> astyle-3.4.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astyle-3.3.1/build/cmake/Options.cmake new/astyle-3.4/build/cmake/Options.cmake --- old/astyle-3.3.1/build/cmake/Options.cmake 2023-05-24 19:33:59.000000000 +0200 +++ new/astyle-3.4/build/cmake/Options.cmake 2023-06-16 21:43:05.000000000 +0200 @@ -10,7 +10,7 @@ # Linux Soname Version set(MAJORVER 3) -set(MINORVER 3) +set(MINORVER 4) set(PATCHVER 0) set(SOLIBVER ${MAJORVER}.${MINORVER}.${PATCHVER}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astyle-3.3.1/doc/astyle.html new/astyle-3.4/doc/astyle.html --- old/astyle-3.3.1/doc/astyle.html 2023-05-24 19:33:59.000000000 +0200 +++ new/astyle-3.4/doc/astyle.html 2023-06-16 21:43:05.000000000 +0200 @@ -139,6 +139,8 @@ <a class="contents" href="#_indent-col1-comments">indent-col1-comments</a> <a class="contents" href="#_min-conditional-indent">min-conditional-indent</a> <a class="contents" href="#_max-continuation-indent">max-continuation-indent</a> + <a class="contents" href="#_lambda_indent">lambda-indent</a> + </p> <p class="contents1"> <a href="#_Padding_Options">Padding Options</a></p> @@ -1513,6 +1515,7 @@ </div> <p> </p> + <p id="_max-continuation-indent"> <code class="title">--max-continuation-indent=<span class="option">#</span> / -M<span class="option">#</span></code><br /> Set the maximum of <span class="option">#</span> spaces to indent a continuation line. The @@ -1540,6 +1543,38 @@ barArg3); </pre> </div> + +<p id="_lambda_indent"> + <code class="title">--lambda-indent</code><br /> + This option improves indentation of C++ lambda functions. As it currently does not work well with complex lambda function bodies, this feature is not enabled by default. +</p> + +<div class="code"> + <pre>void abssort (float* x, unsigned n) +{ + std::sort (x, x + n, + [] (float a, float b) { + return (std::abs (a) < std::abs (b)); + } + ); +}</pre> +</div> + +<p class="code"> + becomes:</p> + +<div class="code"> + <pre>void abssort (float* x, unsigned n) +{ + std::sort (x, x + n, + [] (float a, float b) { + return (std::abs (a) < std::abs (b)); + } + ); +}</pre> +</div> + + <p> </p> <hr /> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astyle-3.3.1/doc/install.html new/astyle-3.4/doc/install.html --- old/astyle-3.3.1/doc/install.html 2023-05-24 19:33:59.000000000 +0200 +++ new/astyle-3.4/doc/install.html 2023-06-16 21:43:05.000000000 +0200 @@ -58,6 +58,9 @@ <p class="contents1"> <a class="contents" href="#_Compiler_Options">Compiler Options</a></p> + <p class="contents2"> + <a class="contents" href="#_PIP">Python PIP</a></p> + <h3 id="_Artistic_Style_Versions">Artistic Style Versions</h3> <p> @@ -585,8 +588,14 @@ option that allows inline function expansion. Runtime Type Information (RTTI) is NOT needed and exceptions are NOT used. Use whole program optimization if your compiler supports it. There may be other options you can use depending on the compiler. </p> - <p> - </p> + + <h3 id="_PIP">Python PIP</h3> + + <p> + There are two projects which enable astyle installation using PIP: <a href="https://github.com/Freed-Wu/astyle-wheel/">astyle-wheel</a> and <a href="https://github.com/igrr/astyle_py">astyle_py (using WASM)</a>.<br> + These are useful to be included in git pre-commit hooks. + </p> + <p style="margin-left: -0.4in; text-align: center;"> <a href="http://sourceforge.net/projects/astyle"> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astyle-3.3.1/doc/news.html new/astyle-3.4/doc/news.html --- old/astyle-3.3.1/doc/news.html 2023-05-24 19:33:59.000000000 +0200 +++ new/astyle-3.4/doc/news.html 2023-06-16 21:43:05.000000000 +0200 @@ -14,7 +14,14 @@ <h1>Artistic Style News</h1> - <h3>Artistic Style 3.3 (ongoing)</h3> + <h3>Artistic Style 3.4 (ongoing)</h3> + + <p> + A new option "--indent-lambda" was added to apply the lambda recognition only if applicable. + Currently complex lambda functions are not intended properly. + </p> + + <h3>Artistic Style 3.3</h3> <p> The source code has been refactored to no longer use the std namespace globally. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astyle-3.3.1/doc/notes.html new/astyle-3.4/doc/notes.html --- old/astyle-3.3.1/doc/notes.html 2023-05-24 19:33:59.000000000 +0200 +++ new/astyle-3.4/doc/notes.html 2023-06-16 21:43:05.000000000 +0200 @@ -14,6 +14,17 @@ <h1>Artistic Style Release Notes</h1> + <h3>Artistic Style 3.4 (June 2023)</h3> + + <ul> + <li>fixed formatting of CS interpolation literals (https://gitlab.com/saalen/astyle/-/issues/8).</li> + <li>fixed false lambda recognition (https://gitlab.com/saalen/astyle/-/issues/11)</li> + <li>fixed indentation of member declarations (https://gitlab.com/saalen/astyle/-/issues/10)</li> + <li>fixed indentation of struct assignments (https://gitlab.com/saalen/astyle/-/issues/12)</li> + <li>added new option "--indent-lambda" to to enable new lambda recognition (https://gitlab.com/saalen/astyle/-/issues/7)</li> + <li>added link to astyle Python distribution projects (https://gitlab.com/saalen/astyle/-/issues/6)</li> + </ul> + <h3>Artistic Style 3.3 (May 2023)</h3> <ul> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astyle-3.3.1/sh-completion/gen-completions new/astyle-3.4/sh-completion/gen-completions --- old/astyle-3.3.1/sh-completion/gen-completions 2023-05-24 19:33:59.000000000 +0200 +++ new/astyle-3.4/sh-completion/gen-completions 2023-06-16 21:43:05.000000000 +0200 @@ -268,6 +268,9 @@ parser:flag "--squeeze-ws" :description "Remove superfluous whitespace" +parser:flag "--indent-lambda" + :description "Indent C++ lambda functions (experimental, broken for complex fct bodies)" + local p = argparse "gen-completions" p:argument "shell" :choices {"bash", "zsh", "fish"} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astyle-3.3.1/src/ASBeautifier.cpp new/astyle-3.4/src/ASBeautifier.cpp --- old/astyle-3.3.1/src/ASBeautifier.cpp 2023-05-24 19:33:59.000000000 +0200 +++ new/astyle-3.4/src/ASBeautifier.cpp 2023-06-16 21:43:05.000000000 +0200 @@ -60,6 +60,7 @@ setSwitchIndent(false); setCaseIndent(false); setSqueezeWhitespace(false); + setLambdaIndentation(false); setBlockIndent(false); setBraceIndent(false); setBraceIndentVtk(false); @@ -207,6 +208,7 @@ switchIndent = other.switchIndent; caseIndent = other.caseIndent; squeezeWhitespace = other.squeezeWhitespace; + attemptLambdaIndentation = other.attemptLambdaIndentation; namespaceIndent = other.namespaceIndent; braceIndent = other.braceIndent; braceIndentVtk = other.braceIndentVtk; @@ -1121,6 +1123,18 @@ } /** + * set the state of the lambda indentation option. If true, + * the parser tries to recognize lambda code. Indentation + * is bad if the lambda code is more complex (if/switch etc) + * + * @param state state of option. + */ +void ASBeautifier::setLambdaIndentation(bool state) +{ + attemptLambdaIndentation = state; +} + +/** * get the file type. */ int ASBeautifier::getFileType() const @@ -2846,7 +2860,8 @@ { headerStack->pop_back(); isInClassHeader = false; - if ( !findKeyword(line, i, AS_STRUCT) ) // if not on this line #526 + + if (line.find("struct ", 0) > i) // if not on this line #526, GH #12 indentCount -= classInitializerIndents; if (indentCount < 0) indentCount = 0; @@ -2870,8 +2885,13 @@ } // #121 - if (!isLegalNameChar(prevNonSpaceCh) && prevNonSpaceCh != ']' && prevNonSpaceCh != ')' && line.find(AS_AUTO, 0 ) == std::string::npos) { - lambdaIndicator = true; + if (attemptLambdaIndentation // GH #7 + && !isLegalNameChar(prevNonSpaceCh) + && prevNonSpaceCh != ']' + && prevNonSpaceCh != ')' + && prevNonSpaceCh != '*' // GH #11 + && line.find(AS_AUTO, 0 ) == std::string::npos) { + lambdaIndicator = true; } } @@ -2945,7 +2965,7 @@ || isSharpDelegate || isInExternC || isInAsmBlock - //|| (getNextWord(line, i) == AS_NEW // #487 + //|| getNextWord(line, i) == AS_NEW // #487 || (isInDefine && (prevNonSpaceCh == '(' || isLegalNameChar(prevNonSpaceCh)))); @@ -3265,6 +3285,12 @@ if (isObjCStyle() && findKeyword(line, i, AS_NS_HANDLER)) foundPreCommandMacro = true; + //https://sourceforge.net/p/astyle/bugs/353/ + // new is ending the line? + if (isJavaStyle() && findKeyword(line, i, AS_NEW) && line.length()-3 == i) { + headerStack->emplace_back(&AS_FIXED); // needs to be something which will not match - need to define a token which will never match + } + //https://sourceforge.net/p/astyle/bugs/550/ //enum can be function return value if (parenDepth == 0 && findKeyword(line, i, AS_ENUM) && line.find_first_of(AS_OPEN_PAREN, i) == std::string::npos) @@ -3808,7 +3834,8 @@ && prevNonSpaceCh != ']' // an array && statementEndsWithComma(line, i)) { - if (!haveAssignmentThisLine) // only one assignment indent per line + // only one assignment indent per line + GH #10 + if (!haveAssignmentThisLine && line.find(AS_SCOPE_RESOLUTION) == std::string::npos) { // register indent at previous word haveAssignmentThisLine = true; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astyle-3.3.1/src/ASFormatter.cpp new/astyle-3.4/src/ASFormatter.cpp --- old/astyle-3.3.1/src/ASFormatter.cpp 2023-05-24 19:33:59.000000000 +0200 +++ new/astyle-3.4/src/ASFormatter.cpp 2023-06-16 21:43:05.000000000 +0200 @@ -6254,7 +6254,7 @@ checkInterpolation = false; } } - else if (isSharpStyle()) + else if (isSharpStyle() && !checkInterpolation ) { if ((int) currentLine.length() > charNum + 1 && currentLine[charNum + 1] == '"') // check consecutive quotes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astyle-3.3.1/src/astyle.h new/astyle-3.4/src/astyle.h --- old/astyle-3.3.1/src/astyle.h 2023-05-24 19:33:59.000000000 +0200 +++ new/astyle-3.4/src/astyle.h 2023-06-16 21:43:05.000000000 +0200 @@ -371,6 +371,7 @@ void setPreprocDefineIndent(bool state); void setPreprocConditionalIndent(bool state); void setSqueezeWhitespace(bool state); + void setLambdaIndentation(bool state); int getBeautifierFileType() const; int getFileType() const; int getIndentLength() const; @@ -556,6 +557,7 @@ bool shouldIndentPreprocConditional; bool lambdaIndicator; bool squeezeWhitespace; + bool attemptLambdaIndentation; int indentCount; int spaceIndentCount; int spaceIndentObjCMethodAlignment; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astyle-3.3.1/src/astyle_main.cpp new/astyle-3.4/src/astyle_main.cpp --- old/astyle-3.3.1/src/astyle_main.cpp 2023-05-24 19:33:59.000000000 +0200 +++ new/astyle-3.4/src/astyle_main.cpp 2023-06-16 21:43:05.000000000 +0200 @@ -94,7 +94,7 @@ jmethodID g_mid; #endif -const char* g_version = "3.3"; +const char* g_version = "3.4"; //----------------------------------------------------------------------------- // ASStreamIterator class @@ -431,69 +431,6 @@ out.str(outStr); } - -/* -void ASConsole::convertLineEnds(std::ostringstream& out, int lineEnd) { - assert(lineEnd == LINEEND_WINDOWS || lineEnd == LINEEND_LINUX || lineEnd == LINEEND_MACOLD); - - const std::string inStr = out.str(); - std::ostringstream outStream; - - for (std::string::size_type i = 0; i < inStr.length(); ++i) { - const char currChar = inStr[i]; - const char nextChar = i < inStr.length() - 1 ? inStr[i + 1] : 0; - - if (currChar == '\r') { - if (nextChar == '\n') { - // CRLF - if (lineEnd == LINEEND_CR) { - outStream << currChar; // Delete the LF - ++i; - } - else if (lineEnd == LINEEND_LF) { - outStream << nextChar; // Delete the CR - ++i; - } - else { - outStream << currChar << nextChar; // Do not change - ++i; - } - } - else { - // CR - if (lineEnd == LINEEND_CRLF) { - outStream << currChar << '\n'; // Insert the LF - } - else if (lineEnd == LINEEND_LF) { - outStream << '\n'; // Insert the LF - } - else { - outStream << currChar; // Do not change - } - } - } - else if (currChar == '\n') { - // LF - if (lineEnd == LINEEND_CRLF) { - outStream << '\r' << currChar; // Insert the CR and LF - } - else if (lineEnd == LINEEND_CR) { - outStream << '\r'; // Insert the CR - } - else { - outStream << currChar; // Do not change - } - } - else { - outStream << currChar; // Write the current character - } - } - - out.str(outStream.str()); // Replace the stream -} - -*/ - void ASConsole::correctMixedLineEnds(std::ostringstream& out) { LineEndFormat lineEndFormat = LINEEND_DEFAULT; @@ -2114,6 +2051,9 @@ std::cout << " --indent-col1-comments OR -Y\n"; std::cout << " Indent line comments that start in column one.\n"; std::cout << std::endl; + std::cout << " --indent-lambda\n"; + std::cout << " Indent C++ lambda functions (experimental, broken for complex fct bodies)\n"; + std::cout << std::endl; std::cout << " --min-conditional-indent=# OR -m#\n"; std::cout << " Indent a minimal # spaces in a continuous conditional\n"; std::cout << " belonging to a conditional header.\n"; @@ -3820,6 +3760,10 @@ { formatter.setBracketsUnPaddingMode(true); } + else if (isOption(arg, "indent-lambda")) + { + formatter.setLambdaIndentation(true); + } else { return false;