Permalink
Browse files

Merge branch 'rdan-20120129' of https://github.com/rdan/uncrustify in…

…to rdan-rdan-20120129

Conflicts:
	src/indent.cpp
  • Loading branch information...
2 parents d519bfa + bbbee52 commit c6e500aaaba0abba230311471a52f8b34776cdde @bengardner bengardner committed Mar 21, 2012
Showing with 226 additions and 2 deletions.
  1. +5 −2 src/indent.cpp
  2. +2 −0 tests/c.test
  3. +71 −0 tests/input/c/pp-if-indent.c
  4. +71 −0 tests/output/c/00616-pp-if-indent.c
  5. +77 −0 tests/output/c/00617-pp-if-indent.c
View
@@ -399,6 +399,7 @@ void indent_text(void)
int sql_col = 0;
int sql_orig_col = 0;
bool in_func_def = false;
+ c_token_t memtype;
memset(&frm, 0, sizeof(frm));
cpd.frame_count = 0;
@@ -412,7 +413,7 @@ void indent_text(void)
pc = chunk_get_head();
while (pc != NULL)
{
- /* Handle proprocessor transitions */
+ /* Handle preprocessor transitions */
in_preproc = (pc->flags & PCF_IN_PREPROC) != 0;
if (cpd.settings[UO_indent_brace_parent].b)
@@ -428,6 +429,7 @@ void indent_text(void)
next = chunk_get_next_ncnl(pc);
if ((pc->parent_type == CT_FUNC_DEF) ||
((pc->type == CT_COMMENT) &&
+ (next != NULL) &&
(next->parent_type == CT_FUNC_DEF)))
{
in_func_def = true;
@@ -503,9 +505,10 @@ void indent_text(void)
{
next = chunk_get_next(pc);
/* Hack to get the logs to look right */
+ memtype = next->type;
next->type = CT_PP_IF_INDENT;
indent_pse_push(frm, next);
- next->type = CT_PP_IF;
+ next->type = memtype;
/* Indent one level */
frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + indent_size;
View
@@ -154,6 +154,8 @@
00614 pp-space.cfg c/pp-space.c
00615 pp-indent-2.cfg c/pp-nest.c
+00616 pp_if_indent-1.cfg c/pp-if-indent.c
+00617 rdan.cfg c/pp-if-indent.c
00620 ben.cfg c/indent-assign.c
00621 nl_endif.cfg c/nl_endif.c
@@ -0,0 +1,71 @@
+/* Test rules chapter 6.8 */
+
+/* no indentation */
+#if COMINL_coMINIMUM_DELAY_TIME == COMINL_coENABLE
+#include "MEMSRV.h"
+#endif
+
+/* already well indented */
+#ifndef COMINL_coAPPLI_TX_CONFIRMATION
+ #error "Define COMINL_coAPPLI_TX_CONFIRMATION is undefined"
+#endif
+
+/* bad indentation */
+#ifndef COMINL_coENABLE
+ #error "Define COMINL_coENABLE is undefined"
+#endif
+
+
+#if COMINL_coSTART_STOP_PERIODIC == COMINL_coENABLE
+void COMINL_vidInit(void)
+{
+ uint8 u8LocalMsgIdx;
+
+ if (COMINL_kastrVarReceiveMsg[u8LocalMsgIdx].udtDeadlineMonTimer < COMINL_udtNB_MESSAGES_RX)
+ {
+ u8LocalMsgIdx = E_OK;
+ }
+ else
+ {
+ u8LocalMsgIdx = E_NOT_OK;
+ }
+
+/* nested #if...already well indented */
+ #if COMINL_coRX_MESSAGE_VAR == COMINL_coENABLE
+ /*!Trace to: VEES_R_11_04044_004.01*/
+ for(u8LocalMsgIdx = 0; u8LocalMsgIdx < COMINL_udtNB_MESSAGES_RX; u8LocalMsgIdx++)
+ {
+ #if COMINL_coRX_DEADLINE_MONITORING == COMINL_coENABLE
+ COMINL_kastrVarReceiveMsg[u8LocalMsgIdx].udtDeadlineMonTimer = 0;
+ #else /* COMINL_coRX_DEADLINE_MONITORING == COMINL_coENABLE */
+ COMINL_kastrVarReceiveMsg[u8LocalMsgIdx].udtINMDeadlineMonTimer = 0;
+ #endif /* COMINL_coRX_DEADLINE_MONITORING == COMINL_coENABLE */
+ }
+ #endif /* COMINL_coRX_MESSAGE_VAR == COMINL_coENABLE */
+
+
+
+/* nested #if... no indentation */
+#if COMINL_coTX_MESSAGE_VAR == COMINL_coENABLE
+ /*!Trace to: VEES_R_11_04044_004.01*/
+ for(u8LocalMsgIdx = 0; u8LocalMsgIdx < COMINL_udtNB_MESSAGES_TX; u8LocalMsgIdx++)
+ {
+#if COMINL_coTX_DEADLINE_MONITORING == COMINL_coENABLE
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].udtDeadlineMonTimer = 0;
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].bDeadlineMonEnable = FALSE;
+#endif /* COMINL_coTX_DEADLINE_MONITORING == COMINL_coENABLE */
+#if COMINL_coTX_INM_DEADLINE_MONITORING == COMINL_coENABLE
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].udtINMDeadlineMonTimer = 0;
+#else /* COMINL_coTX_INM_DEADLINE_MONITORING == COMINL_coENABLE */
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].udtMDTTimer = 0;
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].bMDTMsgToSend = FALSE;
+#endif /*COMINL_coMINIMUM_DELAY_TIME == COMINL_coENABLE*/
+#if COMINL_coMIXED_MODE != COMINL_coDISABLE
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].udtPeriodicTimer = 0;
+#endif
+ }
+#endif /* COMINL_coTX_MESSAGE_VAR == COMINL_coENABLE */
+}
+#endif
+
+/*------------------------------- end of file --------------------------------*/
@@ -0,0 +1,71 @@
+/* Test rules chapter 6.8 */
+
+/* no indentation */
+#if COMINL_coMINIMUM_DELAY_TIME == COMINL_coENABLE
+ #include "MEMSRV.h"
+#endif
+
+/* already well indented */
+#ifndef COMINL_coAPPLI_TX_CONFIRMATION
+ #error "Define COMINL_coAPPLI_TX_CONFIRMATION is undefined"
+#endif
+
+/* bad indentation */
+#ifndef COMINL_coENABLE
+ #error "Define COMINL_coENABLE is undefined"
+#endif
+
+
+#if COMINL_coSTART_STOP_PERIODIC == COMINL_coENABLE
+ void COMINL_vidInit(void)
+ {
+ uint8 u8LocalMsgIdx;
+
+ if (COMINL_kastrVarReceiveMsg[u8LocalMsgIdx].udtDeadlineMonTimer < COMINL_udtNB_MESSAGES_RX)
+ {
+ u8LocalMsgIdx = E_OK;
+ }
+ else
+ {
+ u8LocalMsgIdx = E_NOT_OK;
+ }
+
+/* nested #if...already well indented */
+ #if COMINL_coRX_MESSAGE_VAR == COMINL_coENABLE
+ /*!Trace to: VEES_R_11_04044_004.01*/
+ for(u8LocalMsgIdx = 0; u8LocalMsgIdx < COMINL_udtNB_MESSAGES_RX; u8LocalMsgIdx++)
+ {
+ #if COMINL_coRX_DEADLINE_MONITORING == COMINL_coENABLE
+ COMINL_kastrVarReceiveMsg[u8LocalMsgIdx].udtDeadlineMonTimer = 0;
+ #else /* COMINL_coRX_DEADLINE_MONITORING == COMINL_coENABLE */
+ COMINL_kastrVarReceiveMsg[u8LocalMsgIdx].udtINMDeadlineMonTimer = 0;
+ #endif /* COMINL_coRX_DEADLINE_MONITORING == COMINL_coENABLE */
+ }
+ #endif /* COMINL_coRX_MESSAGE_VAR == COMINL_coENABLE */
+
+
+
+/* nested #if... no indentation */
+ #if COMINL_coTX_MESSAGE_VAR == COMINL_coENABLE
+ /*!Trace to: VEES_R_11_04044_004.01*/
+ for(u8LocalMsgIdx = 0; u8LocalMsgIdx < COMINL_udtNB_MESSAGES_TX; u8LocalMsgIdx++)
+ {
+ #if COMINL_coTX_DEADLINE_MONITORING == COMINL_coENABLE
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].udtDeadlineMonTimer = 0;
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].bDeadlineMonEnable = FALSE;
+ #endif /* COMINL_coTX_DEADLINE_MONITORING == COMINL_coENABLE */
+ #if COMINL_coTX_INM_DEADLINE_MONITORING == COMINL_coENABLE
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].udtINMDeadlineMonTimer = 0;
+ #else /* COMINL_coTX_INM_DEADLINE_MONITORING == COMINL_coENABLE */
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].udtMDTTimer = 0;
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].bMDTMsgToSend = FALSE;
+ #endif /*COMINL_coMINIMUM_DELAY_TIME == COMINL_coENABLE*/
+ #if COMINL_coMIXED_MODE != COMINL_coDISABLE
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].udtPeriodicTimer = 0;
+ #endif
+ }
+ #endif /* COMINL_coTX_MESSAGE_VAR == COMINL_coENABLE */
+ }
+#endif
+
+/*------------------------------- end of file --------------------------------*/
@@ -0,0 +1,77 @@
+/* Test rules chapter 6.8 */
+
+/* no indentation */
+#if COMINL_coMINIMUM_DELAY_TIME == COMINL_coENABLE
+ #include "MEMSRV.h"
+#endif
+
+/* already well indented */
+#ifndef COMINL_coAPPLI_TX_CONFIRMATION
+ #error "Define COMINL_coAPPLI_TX_CONFIRMATION is undefined"
+#endif
+
+/* bad indentation */
+#ifndef COMINL_coENABLE
+ #error "Define COMINL_coENABLE is undefined"
+#endif
+
+#if COMINL_coSTART_STOP_PERIODIC == COMINL_coENABLE
+void COMINL_vidInit(void)
+{
+ uint8 u8LocalMsgIdx;
+
+
+ if (COMINL_kastrVarReceiveMsg[u8LocalMsgIdx].udtDeadlineMonTimer
+ < COMINL_udtNB_MESSAGES_RX)
+ {
+ u8LocalMsgIdx = E_OK;
+ }
+ else
+ {
+ u8LocalMsgIdx = E_NOT_OK;
+ }
+
+ /* nested #if...already well indented */
+ #if COMINL_coRX_MESSAGE_VAR == COMINL_coENABLE
+ /*!Trace to: VEES_R_11_04044_004.01*/
+ for (u8LocalMsgIdx = 0;
+ u8LocalMsgIdx < COMINL_udtNB_MESSAGES_RX;
+ u8LocalMsgIdx++)
+ {
+ #if COMINL_coRX_DEADLINE_MONITORING == COMINL_coENABLE
+ COMINL_kastrVarReceiveMsg[u8LocalMsgIdx].udtDeadlineMonTimer = 0;
+ #else /* COMINL_coRX_DEADLINE_MONITORING == COMINL_coENABLE */
+ COMINL_kastrVarReceiveMsg[u8LocalMsgIdx].udtINMDeadlineMonTimer = 0;
+ #endif /* COMINL_coRX_DEADLINE_MONITORING == COMINL_coENABLE */
+ }
+ #endif /* COMINL_coRX_MESSAGE_VAR == COMINL_coENABLE */
+
+ /* nested #if... no indentation */
+ #if COMINL_coTX_MESSAGE_VAR == COMINL_coENABLE
+ /*!Trace to: VEES_R_11_04044_004.01*/
+ for (u8LocalMsgIdx = 0;
+ u8LocalMsgIdx < COMINL_udtNB_MESSAGES_TX;
+ u8LocalMsgIdx++)
+ {
+ #if COMINL_coTX_DEADLINE_MONITORING == COMINL_coENABLE
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].udtDeadlineMonTimer = 0;
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].bDeadlineMonEnable =
+ FALSE;
+ #endif /* COMINL_coTX_DEADLINE_MONITORING == COMINL_coENABLE */
+ #if COMINL_coTX_INM_DEADLINE_MONITORING == COMINL_coENABLE
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].udtINMDeadlineMonTimer =
+ 0;
+ #else /* COMINL_coTX_INM_DEADLINE_MONITORING == COMINL_coENABLE */
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].udtMDTTimer = 0;
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].bMDTMsgToSend = FALSE;
+ #endif /*COMINL_coMINIMUM_DELAY_TIME == COMINL_coENABLE*/
+ #if COMINL_coMIXED_MODE != COMINL_coDISABLE
+ COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].udtPeriodicTimer = 0;
+ #endif
+ }
+ #endif /* COMINL_coTX_MESSAGE_VAR == COMINL_coENABLE */
+}
+
+#endif
+
+/*------------------------------- end of file --------------------------------*/

0 comments on commit c6e500a

Please sign in to comment.