development/uncrustify: Updated for version 0.71.0

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Zhu Qun-Ying 2020-05-25 16:13:22 -07:00 committed by Willy Sudiarto Raharjo
parent 3b7e450ce3
commit 89ac9f15fe
3 changed files with 5 additions and 110 deletions

View file

@ -1,104 +0,0 @@
From 06822aa69bf460b5ef0363f2a0cf69ec7a426bda Mon Sep 17 00:00:00 2001
From: Guy Maurel <g.maurel@agwest.de>
Date: Fri, 29 Nov 2019 18:04:25 +0100
Subject: nl_func_leave_one_liners is now completed
Ref. #2561
diff --git a/src/newlines.cpp b/src/newlines.cpp
index a7db6181..576cd874 100644
--- a/src/newlines.cpp
+++ b/src/newlines.cpp
@@ -2782,12 +2782,30 @@ static void newline_func_def_or_call(chunk_t *start)
if (tmp_next != nullptr && tmp_next->type != CT_FUNC_CLASS_DEF)
{
- bool is_proto = ( tmp->parent_type == CT_FUNC_PROTO
- || tmp->parent_type == CT_FUNC_CLASS_PROTO);
- iarf_e a = (is_proto) ?
- options::nl_func_proto_type_name() :
- (options::nl_func_leave_one_liners()) ? // Issue #1511
- IARF_IGNORE : options::nl_func_type_name();
+ chunk_t *closing = chunk_skip_to_match(tmp);
+ chunk_t *brace = chunk_get_next_ncnl(closing);
+ iarf_e a; // Issue #2561
+
+ if ( tmp->parent_type == CT_FUNC_PROTO
+ || tmp->parent_type == CT_FUNC_CLASS_PROTO)
+ {
+ // proto
+ a = options::nl_func_proto_type_name();
+ }
+ else
+ {
+ // def
+
+ if ( options::nl_func_leave_one_liners()
+ && brace->flags.test(PCF_ONE_LINER)) // Issue #1511
+ {
+ a = IARF_IGNORE;
+ }
+ else
+ {
+ a = options::nl_func_type_name();
+ }
+ }
if ( tmp->flags.test(PCF_IN_CLASS)
&& (options::nl_func_type_name_class() != IARF_IGNORE))
diff --git a/tests/config/Issue_2561.cfg b/tests/config/Issue_2561.cfg
new file mode 100644
index 00000000..03a40504
--- /dev/null
+++ b/tests/config/Issue_2561.cfg
@@ -0,0 +1,5 @@
+sp_func_def_paren = force
+indent_columns = 3
+nl_func_leave_one_liners = true
+nl_func_type_name = force
+mod_add_long_function_closebrace_comment = 1
diff --git a/tests/cpp.test b/tests/cpp.test
index 77797aed..39c7e421 100644
--- a/tests/cpp.test
+++ b/tests/cpp.test
@@ -96,6 +96,7 @@
30085 nSolve.cfg cpp/align_class.cpp
30086 align_class-constr.cfg cpp/align_class-constr.cpp
30087 Issue_1511.cfg cpp/Issue_1511.cpp
+30088 Issue_2561.cfg cpp/Issue_2561.cpp
30090 bug_488.cfg cpp/bug_488.cpp
30091 bug_472.cfg cpp/bug_472.cpp
diff --git a/tests/expected/cpp/30088-Issue_2561.cpp b/tests/expected/cpp/30088-Issue_2561.cpp
new file mode 100644
index 00000000..aa566966
--- /dev/null
+++ b/tests/expected/cpp/30088-Issue_2561.cpp
@@ -0,0 +1,11 @@
+#include <stdio.h>
+
+int getFoo () { return foo; }
+
+int
+main (int argc, char *argv[])
+{
+ printf("hello world!\n");
+
+ return 0;
+} // main
diff --git a/tests/input/cpp/Issue_2561.cpp b/tests/input/cpp/Issue_2561.cpp
new file mode 100644
index 00000000..15232fc4
--- /dev/null
+++ b/tests/input/cpp/Issue_2561.cpp
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+int getFoo() { return foo; }
+
+int main (int argc, char *argv[])
+{
+ printf("hello world!\n");
+
+ return 0;
+}

View file

@ -5,8 +5,8 @@
# Written by Aleksandar Samardzic <asamardzic@gmail.com>
PRGNAM=uncrustify
VERSION=${VERSION:-0.70.1}
BUILD=${BUILD:-2}
VERSION=${VERSION:-0.71.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@ -46,7 +46,6 @@ find -L . \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
patch -p1 < $CWD/nl_func_leave_one_liners.patch
mkdir -p build
cd build
cmake \

View file

@ -1,8 +1,8 @@
PRGNAM="uncrustify"
VERSION="0.70.1"
VERSION="0.71.0"
HOMEPAGE="http://uncrustify.sourceforge.net/"
DOWNLOAD="https://github.com/uncrustify/uncrustify/archive/uncrustify-0.70.1/uncrustify-uncrustify-0.70.1.tar.gz"
MD5SUM="7b018fb343615bdb0c8c1143b89b61da"
DOWNLOAD="https://github.com/uncrustify/uncrustify/archive/uncrustify-0.71.0/uncrustify-uncrustify-0.71.0.tar.gz"
MD5SUM="748482d4c16e2de966505c7e3829d925"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""