summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.76.0/src/flag_parens.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2022-12-04 19:16:43 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2022-12-04 19:38:30 +0900
commitfdcd72088371b3d8dfd31f2a5159861ce0be5535 (patch)
tree06c160cc34157344f62b6c19af297858a0e57157 /debian/uncrustify-trinity/uncrustify-trinity-0.76.0/src/flag_parens.cpp
parenta5d7db3b2c6171ea9e76b84155d2dfb66c243e5a (diff)
downloadextra-dependencies-fdcd72088371b3d8dfd31f2a5159861ce0be5535.tar.gz
extra-dependencies-fdcd72088371b3d8dfd31f2a5159861ce0be5535.zip
uncrustify-trinity: updated based on upstream version 0.76.0
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'debian/uncrustify-trinity/uncrustify-trinity-0.76.0/src/flag_parens.cpp')
-rw-r--r--debian/uncrustify-trinity/uncrustify-trinity-0.76.0/src/flag_parens.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.76.0/src/flag_parens.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.76.0/src/flag_parens.cpp
new file mode 100644
index 00000000..c435710a
--- /dev/null
+++ b/debian/uncrustify-trinity/uncrustify-trinity-0.76.0/src/flag_parens.cpp
@@ -0,0 +1,71 @@
+/**
+ * @file flag_parens.cpp
+ *
+ * @author Guy Maurel
+ * @license GPL v2+
+ */
+
+#include "flag_parens.h"
+
+#include "uncrustify.h"
+
+
+Chunk *flag_parens(Chunk *po, T_PcfFlags flags, E_Token opentype, E_Token parent_type, bool parent_all)
+{
+ LOG_FUNC_ENTRY();
+ Chunk *paren_close;
+
+ paren_close = po->GetClosingParen(E_Scope::PREPROC);
+
+ if (paren_close->IsNullChunk())
+ {
+ LOG_FMT(LERR, "%s(%d): no match for '%s' at [%zu:%zu]",
+ __func__, __LINE__, po->Text(), po->GetOrigLine(), po->GetOrigCol());
+ log_func_stack_inline(LERR);
+ exit(EX_SOFTWARE);
+ }
+ LOG_FMT(LFLPAREN, "%s(%d): between po is '%s', orig line is %zu, orig col is %zu, and\n",
+ __func__, __LINE__, po->Text(), po->GetOrigLine(), po->GetOrigCol());
+ LOG_FMT(LFLPAREN, "%s(%d): paren_close is '%s', orig line is %zu, orig col is %zu, type is %s, parent type is %s\n",
+ __func__, __LINE__, paren_close->Text(), paren_close->GetOrigLine(), paren_close->GetOrigCol(),
+ get_token_name(opentype), get_token_name(parent_type));
+ log_func_stack_inline(LFLPAREN);
+
+ // the last chunk must be also modified. Issue #2149
+ Chunk *after_paren_close = paren_close->GetNext();
+
+ if (po != paren_close)
+ {
+ if ( flags != PCF_NONE
+ || ( parent_all
+ && parent_type != CT_NONE))
+ {
+ Chunk *pc;
+
+ for (pc = po->GetNext(E_Scope::PREPROC);
+ pc != nullptr && pc->IsNotNullChunk() && pc != after_paren_close;
+ pc = pc->GetNext(E_Scope::PREPROC))
+ {
+ pc->SetFlagBits(flags);
+
+ if (parent_all)
+ {
+ pc->SetParentType(parent_type);
+ }
+ }
+ }
+
+ if (opentype != CT_NONE)
+ {
+ po->SetType(opentype);
+ paren_close->SetType((E_Token)(opentype + 1));
+ }
+
+ if (parent_type != CT_NONE)
+ {
+ po->SetParentType(parent_type);
+ paren_close->SetParentType(parent_type);
+ }
+ }
+ return(paren_close->GetNextNcNnl(E_Scope::PREPROC));
+} // flag_parens