From bad411472a12b93f8bfca6b7ca52d89488a8d8ce Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Tue, 5 Jan 2021 11:14:15 +0900 Subject: Backported commits 5f3f392a and fb66774e from upstream. This solves upstream issues 3040. Upstream commit message: ----------------------------------------------------------- commit 5f3f392a3b8fc6dc334d6f688b9a57e06827579b Author: Guy Maurel Date: Sat Jan 2 18:59:46 2021 +0100 insert closing brace before the preprocessor line M src/braces.cpp A tests/config/Issue_3040.cfg M tests/cpp.test A tests/expected/cpp/34326-Issue_3040.cpp A tests/input/cpp/Issue_3040.cpp commit fb66774e46b1b0f93b548ed172126619fcbd6723 Author: Guy Maurel Date: Sun Jan 3 18:08:13 2021 +0100 insert after #endif M src/braces.cpp M tests/expected/cpp/34326-Issue_3040.cpp M tests/input/cpp/Issue_3040.cpp ----------------------------------------------------------- Signed-off-by: Michele Calgaro --- .../uncrustify-trinity-0.72.0/debian/changelog | 11 +- .../debian/patches/007_issue_3040.diff | 183 +++++++++++++++++++++ .../debian/patches/series | 1 + 3 files changed, 193 insertions(+), 2 deletions(-) create mode 100644 debian/uncrustify-trinity/uncrustify-trinity-0.72.0/debian/patches/007_issue_3040.diff diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/debian/changelog b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/debian/changelog index 25607cbc..fdc5124d 100644 --- a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/debian/changelog +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/debian/changelog @@ -1,7 +1,14 @@ +uncrustify-trinity (0.72.0-0debian11.0.0+7) unstable; urgency=medium + + * TDE version 0.72-0+7 + * Backported commits 5f3f392a and fb66774e from upstream. + + -- Michele Calgaro Thu, 05 Jan 2021 11:08:00 +0900 + uncrustify-trinity (0.72.0-0debian11.0.0+6) unstable; urgency=medium - * TDE version of upstream 0.72-0+6 - * Backported commits 45681e88 and 64d93e3fb. + * TDE version 0.72-0+6 + * Backported commits 45681e88 and 64d93e3fb from upstream. -- Michele Calgaro Thu, 24 Dec 2020 20:14:00 +0900 diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/debian/patches/007_issue_3040.diff b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/debian/patches/007_issue_3040.diff new file mode 100644 index 00000000..99d4887f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/debian/patches/007_issue_3040.diff @@ -0,0 +1,183 @@ +Backported commits 5f3f392a and fb66774e from upstream. This solves upstream issues 3040. + +--- a/src/braces.cpp ++++ b/src/braces.cpp +@@ -1290,7 +1290,7 @@ + static chunk_t *mod_case_brace_add(chunk_t *cl_colon) + { + LOG_FUNC_ENTRY(); +- LOG_FMT(LMCB, "%s(%d): line %zu", ++ LOG_FMT(LMCB, "%s(%d): line %zu\n", + __func__, __LINE__, cl_colon->orig_line); + + chunk_t *pc = cl_colon; +@@ -1309,7 +1309,28 @@ + && ( chunk_is_token(pc, CT_CASE) + || chunk_is_token(pc, CT_BREAK))) + { +- last = pc; ++ // check if previous line is a preprocessor Issue #3040 ++ chunk_t *prev = chunk_get_prev_ncnl(pc); ++ LOG_FMT(LMCB, "%s(%d): prev->text() is '%s', orig_line %zu\n", ++ __func__, __LINE__, prev->text(), prev->orig_line); ++ ++ if ( chunk_is_preproc(prev) ++ && chunk_is_not_token(prev, CT_PP_ENDIF)) ++ { ++ // previous line is a preprocessor, but NOT #endif ++ while (chunk_is_preproc(prev)) ++ { ++ prev = chunk_get_prev_ncnl(prev); ++ } ++ chunk_t *next_prev = chunk_get_next_ncnl(prev); ++ LOG_FMT(LMCB, "%s(%d): next_prev->text() is '%s', orig_line %zu\n", ++ __func__, __LINE__, next_prev->text(), next_prev->orig_line); ++ last = next_prev; ++ } ++ else ++ { ++ last = pc; ++ } + break; + } + } +--- /dev/null ++++ b/tests/config/Issue_3040.cfg +@@ -0,0 +1,7 @@ ++indent_columns = 2 ++indent_switch_case = 2 ++nl_before_case = true ++nl_after_case = true ++eat_blanks_before_close_brace = true ++mod_move_case_break = true ++mod_case_brace = force +--- a/tests/cpp.test ++++ b/tests/cpp.test +@@ -827,6 +827,7 @@ + 34322 issue_2623_1.cfg cpp/issue_2623.cpp + 34323 issue_2623_2.cfg cpp/issue_2623.cpp + 34324 issue_2623_3.cfg cpp/issue_2623.cpp ++34326 Issue_3040.cfg cpp/Issue_3040.cpp + + # Adopt some UT tests + 10000 empty.cfg cpp/621_this-spacing.cpp +--- /dev/null ++++ b/tests/expected/cpp/34326-Issue_3040.cpp +@@ -0,0 +1,62 @@ ++void main() ++{ ++ switch (opcode ) { ++ ++ case LocaleCompare: ++ { ++ return Number(localeCompare(s, a0.toString(exec))); ++ } ++ ++#ifndef KJS_PURE_ECMA ++ case Big: ++ { ++ result = String("" + s + ""); ++ break; ++ } ++#endif ++ } ++ ++ switch (ev->command) ++ { ++ case (MIDI_NOTEON): ++ { ++ ev->note = *ptrdata; ptrdata++; currentpos++; ++ ev->vel = *ptrdata; ptrdata++; currentpos++; ++ if (ev->vel==0) ++ note[ev->chn][ev->note]=FALSE; ++ else ++ note[ev->chn][ev->note]=TRUE; ++ ++#ifdef TRACKDEBUG2 ++ if (ev->chn==6) { ++ if (ev->vel==0) printfdebug("Note Onf\n"); ++ else printfdebug("Note On\n"); ++ }; ++#endif ++ break; ++ } ++ ++ case (MIDI_NOTEOFF): ++ { ++#ifdef TRACKDEBUG2 ++ if (ev->chn==6) printfdebug("Note Off\n"); ++#endif ++ ev->note = *ptrdata; ptrdata++; currentpos++; ++ ev->vel = *ptrdata; ptrdata++; currentpos++; ++ note[ev->chn][ev->note]=FALSE; ++ ++ break; ++ } ++ ++ case (MIDI_KEY_PRESSURE): ++ { ++#ifdef TRACKDEBUG2 ++ if (ev->chn==6) printfdebug ("Key press\n"); ++#endif ++ ev->note = *ptrdata; ptrdata++; currentpos++; ++ ev->vel = *ptrdata; ptrdata++; currentpos++; ++ break; ++ } ++ } ++} ++ +--- /dev/null ++++ b/tests/input/cpp/Issue_3040.cpp +@@ -0,0 +1,52 @@ ++void main() ++{ ++ switch (opcode ) { ++ ++ case LocaleCompare: ++ return Number(localeCompare(s, a0.toString(exec))); ++ ++#ifndef KJS_PURE_ECMA ++ case Big: ++ result = String("" + s + ""); ++ break; ++#endif ++ ++ } ++ ++ switch (ev->command) ++ { ++ case (MIDI_NOTEON): ++ ev->note = *ptrdata; ptrdata++; currentpos++; ++ ev->vel = *ptrdata; ptrdata++; currentpos++; ++ if (ev->vel==0) ++ note[ev->chn][ev->note]=FALSE; ++ else ++ note[ev->chn][ev->note]=TRUE; ++ ++#ifdef TRACKDEBUG2 ++ if (ev->chn==6) { ++ if (ev->vel==0) printfdebug("Note Onf\n"); ++ else printfdebug("Note On\n"); ++ }; ++#endif ++ break; ++ case (MIDI_NOTEOFF) : ++#ifdef TRACKDEBUG2 ++ if (ev->chn==6) printfdebug("Note Off\n"); ++#endif ++ ev->note = *ptrdata;ptrdata++;currentpos++; ++ ev->vel = *ptrdata;ptrdata++;currentpos++; ++ note[ev->chn][ev->note]=FALSE; ++ ++ break; ++ case (MIDI_KEY_PRESSURE) : ++#ifdef TRACKDEBUG2 ++ if (ev->chn==6) printfdebug ("Key press\n"); ++#endif ++ ev->note = *ptrdata;ptrdata++;currentpos++; ++ ev->vel = *ptrdata;ptrdata++;currentpos++; ++ break; ++ ++ } ++} ++ diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/debian/patches/series b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/debian/patches/series index 1cf3e23a..eb36bb0b 100644 --- a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/debian/patches/series +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/debian/patches/series @@ -4,3 +4,4 @@ 004_fixed_usage.diff 005_upstream_45681e88.diff 006_upstream_64d93e3fb.diff +007_issue_3040.diff -- cgit v1.2.1