forked from aniani/vim
patch 9.1.1237: Compile error with C89 compiler in term.c
Problem: Compile error with C89 compiler in term.c (Zoltan Arpadffy) Solution: split out LOG_TR macro into 2 different macros. LOG_TR1 that takes only a single argument and LOG_TRN that takes 2 arguments. Remove the use of ##__VA_ARGS__ since the macro is now always called with 2 arguments (Hirohito Higashi) related: #16962 closes: #16969 Signed-off-by: Hirohito Higashi <h.east.727@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
35cb03648f
commit
2726821d38
75
src/term.c
75
src/term.c
@@ -67,15 +67,20 @@ static int term_is_builtin(char_u *name);
|
|||||||
static int term_7to8bit(char_u *p);
|
static int term_7to8bit(char_u *p);
|
||||||
static void accept_modifiers_for_function_keys(void);
|
static void accept_modifiers_for_function_keys(void);
|
||||||
|
|
||||||
# if 0 // Change to 1 to enable ch_log() calls for termresponse debugging.
|
#if 0 // Change to 1 to enable ch_log() calls for termresponse debugging.
|
||||||
# define DEBUG_TERMRESPONSE
|
# define DEBUG_TERMRESPONSE
|
||||||
# define LOG_TR(fmt,...) \
|
# define LOG_TR1(str) \
|
||||||
ch_log(NULL, "TermResp: %s " fmt, \
|
ch_log(NULL, "TermResp: %s " str, \
|
||||||
must_redraw == UPD_NOT_VALID ? "NV" \
|
must_redraw == UPD_NOT_VALID ? "NV" \
|
||||||
: must_redraw == UPD_CLEAR ? "CL" : " ", ##__VA_ARGS__)
|
: must_redraw == UPD_CLEAR ? "CL" : " ")
|
||||||
# else
|
# define LOG_TRN(fmt,...) \
|
||||||
# define LOG_TR(fmt,...) do { /**/ } while (0)
|
ch_log(NULL, "TermResp: %s " fmt, \
|
||||||
# endif
|
must_redraw == UPD_NOT_VALID ? "NV" \
|
||||||
|
: must_redraw == UPD_CLEAR ? "CL" : " ", __VA_ARGS__)
|
||||||
|
#else
|
||||||
|
# define LOG_TR1(str) do { /**/ } while (0)
|
||||||
|
# define LOG_TRN(fmt,...) do { /**/ } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TGETENT
|
#ifdef HAVE_TGETENT
|
||||||
static char *invoke_tgetent(char_u *, char_u *);
|
static char *invoke_tgetent(char_u *, char_u *);
|
||||||
@@ -1691,7 +1696,7 @@ may_adjust_color_count(int val)
|
|||||||
{
|
{
|
||||||
int r = redraw_asap(UPD_CLEAR);
|
int r = redraw_asap(UPD_CLEAR);
|
||||||
|
|
||||||
LOG_TR("Received t_Co, redraw_asap(): %d", r);
|
LOG_TRN("Received t_Co, redraw_asap(): %d", r);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
redraw_asap(UPD_CLEAR);
|
redraw_asap(UPD_CLEAR);
|
||||||
@@ -2300,7 +2305,7 @@ set_termname(char_u *term)
|
|||||||
full_screen = TRUE; // we can use termcap codes from now on
|
full_screen = TRUE; // we can use termcap codes from now on
|
||||||
set_term_defaults(); // use current values as defaults
|
set_term_defaults(); // use current values as defaults
|
||||||
#ifdef FEAT_TERMRESPONSE
|
#ifdef FEAT_TERMRESPONSE
|
||||||
LOG_TR("setting crv_status to STATUS_GET");
|
LOG_TR1("setting crv_status to STATUS_GET");
|
||||||
crv_status.tr_progress = STATUS_GET; // Get terminal version later
|
crv_status.tr_progress = STATUS_GET; // Get terminal version later
|
||||||
write_t_8u_state = FALSE;
|
write_t_8u_state = FALSE;
|
||||||
#endif
|
#endif
|
||||||
@@ -4080,7 +4085,7 @@ may_req_termresponse(void)
|
|||||||
&& *T_CRV != NUL)
|
&& *T_CRV != NUL)
|
||||||
{
|
{
|
||||||
MAY_WANT_TO_LOG_THIS;
|
MAY_WANT_TO_LOG_THIS;
|
||||||
LOG_TR("Sending CRV request");
|
LOG_TR1("Sending CRV request");
|
||||||
out_str(T_CRV);
|
out_str(T_CRV);
|
||||||
termrequest_sent(&crv_status);
|
termrequest_sent(&crv_status);
|
||||||
// check for the characters now, otherwise they might be eaten by
|
// check for the characters now, otherwise they might be eaten by
|
||||||
@@ -4119,7 +4124,7 @@ check_terminal_behavior(void)
|
|||||||
// changes cursor position, so it must be called immediately after
|
// changes cursor position, so it must be called immediately after
|
||||||
// entering termcap mode.
|
// entering termcap mode.
|
||||||
MAY_WANT_TO_LOG_THIS;
|
MAY_WANT_TO_LOG_THIS;
|
||||||
LOG_TR("Sending request for ambiwidth check");
|
LOG_TR1("Sending request for ambiwidth check");
|
||||||
// Do this in the second row. In the first row the returned sequence
|
// Do this in the second row. In the first row the returned sequence
|
||||||
// may be CSI 1;2R, which is the same as <S-F3>.
|
// may be CSI 1;2R, which is the same as <S-F3>.
|
||||||
term_windgoto(1, 0);
|
term_windgoto(1, 0);
|
||||||
@@ -4148,7 +4153,7 @@ check_terminal_behavior(void)
|
|||||||
// handles test sequence incorrectly, a garbage string is displayed and
|
// handles test sequence incorrectly, a garbage string is displayed and
|
||||||
// the cursor does move.
|
// the cursor does move.
|
||||||
MAY_WANT_TO_LOG_THIS;
|
MAY_WANT_TO_LOG_THIS;
|
||||||
LOG_TR("Sending xterm compatibility test sequence.");
|
LOG_TR1("Sending xterm compatibility test sequence.");
|
||||||
// Do this in the third row. Second row is used by ambiguous
|
// Do this in the third row. Second row is used by ambiguous
|
||||||
// character width check.
|
// character width check.
|
||||||
term_windgoto(2, 0);
|
term_windgoto(2, 0);
|
||||||
@@ -4199,7 +4204,7 @@ may_req_bg_color(void)
|
|||||||
if (rfg_status.tr_progress == STATUS_GET && *T_RFG != NUL)
|
if (rfg_status.tr_progress == STATUS_GET && *T_RFG != NUL)
|
||||||
{
|
{
|
||||||
MAY_WANT_TO_LOG_THIS;
|
MAY_WANT_TO_LOG_THIS;
|
||||||
LOG_TR("Sending FG request");
|
LOG_TR1("Sending FG request");
|
||||||
out_str(T_RFG);
|
out_str(T_RFG);
|
||||||
termrequest_sent(&rfg_status);
|
termrequest_sent(&rfg_status);
|
||||||
didit = TRUE;
|
didit = TRUE;
|
||||||
@@ -4210,7 +4215,7 @@ may_req_bg_color(void)
|
|||||||
if (rbg_status.tr_progress == STATUS_GET && *T_RBG != NUL)
|
if (rbg_status.tr_progress == STATUS_GET && *T_RBG != NUL)
|
||||||
{
|
{
|
||||||
MAY_WANT_TO_LOG_THIS;
|
MAY_WANT_TO_LOG_THIS;
|
||||||
LOG_TR("Sending BG request");
|
LOG_TR1("Sending BG request");
|
||||||
out_str(T_RBG);
|
out_str(T_RBG);
|
||||||
termrequest_sent(&rbg_status);
|
termrequest_sent(&rbg_status);
|
||||||
didit = TRUE;
|
didit = TRUE;
|
||||||
@@ -4821,7 +4826,7 @@ switch_to_8bit(void)
|
|||||||
need_gather = TRUE; // need to fill termleader[]
|
need_gather = TRUE; // need to fill termleader[]
|
||||||
}
|
}
|
||||||
detected_8bit = TRUE;
|
detected_8bit = TRUE;
|
||||||
LOG_TR("Switching to 8 bit");
|
LOG_TR1("Switching to 8 bit");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CHECK_DOUBLE_CLICK
|
#ifdef CHECK_DOUBLE_CLICK
|
||||||
@@ -4974,7 +4979,7 @@ handle_u7_response(int *arg, char_u *tp UNUSED, int csi_len UNUSED)
|
|||||||
{
|
{
|
||||||
char *aw = NULL;
|
char *aw = NULL;
|
||||||
|
|
||||||
LOG_TR("Received U7 status: %s", tp);
|
LOG_TRN("Received U7 status: %s", tp);
|
||||||
u7_status.tr_progress = STATUS_GOT;
|
u7_status.tr_progress = STATUS_GOT;
|
||||||
did_cursorhold = TRUE;
|
did_cursorhold = TRUE;
|
||||||
if (arg[1] == 2)
|
if (arg[1] == 2)
|
||||||
@@ -4991,7 +4996,7 @@ handle_u7_response(int *arg, char_u *tp UNUSED, int csi_len UNUSED)
|
|||||||
{
|
{
|
||||||
int r = redraw_asap(UPD_CLEAR);
|
int r = redraw_asap(UPD_CLEAR);
|
||||||
|
|
||||||
LOG_TR("set 'ambiwidth', redraw_asap(): %d", r);
|
LOG_TRN("set 'ambiwidth', redraw_asap(): %d", r);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
redraw_asap(UPD_CLEAR);
|
redraw_asap(UPD_CLEAR);
|
||||||
@@ -5007,7 +5012,7 @@ handle_u7_response(int *arg, char_u *tp UNUSED, int csi_len UNUSED)
|
|||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
LOG_TR("Received compatibility test result: %s", tp);
|
LOG_TRN("Received compatibility test result: %s", tp);
|
||||||
xcc_status.tr_progress = STATUS_GOT;
|
xcc_status.tr_progress = STATUS_GOT;
|
||||||
|
|
||||||
// Third row: xterm compatibility test.
|
// Third row: xterm compatibility test.
|
||||||
@@ -5031,7 +5036,7 @@ handle_version_response(int first, int *arg, int argc, char_u *tp)
|
|||||||
// version.
|
// version.
|
||||||
int version = arg[1];
|
int version = arg[1];
|
||||||
|
|
||||||
LOG_TR("Received CRV response: %s", tp);
|
LOG_TRN("Received CRV response: %s", tp);
|
||||||
crv_status.tr_progress = STATUS_GOT;
|
crv_status.tr_progress = STATUS_GOT;
|
||||||
did_cursorhold = TRUE;
|
did_cursorhold = TRUE;
|
||||||
|
|
||||||
@@ -5074,7 +5079,7 @@ handle_version_response(int first, int *arg, int argc, char_u *tp)
|
|||||||
// terminals the request should be ignored.
|
// terminals the request should be ignored.
|
||||||
if (version >= 141 && p_xtermcodes)
|
if (version >= 141 && p_xtermcodes)
|
||||||
{
|
{
|
||||||
LOG_TR("Enable checking for XT codes");
|
LOG_TR1("Enable checking for XT codes");
|
||||||
check_for_codes = TRUE;
|
check_for_codes = TRUE;
|
||||||
need_gather = TRUE;
|
need_gather = TRUE;
|
||||||
req_codes_from_term();
|
req_codes_from_term();
|
||||||
@@ -5244,7 +5249,7 @@ handle_version_response(int first, int *arg, int argc, char_u *tp)
|
|||||||
&& *T_CRS != NUL)
|
&& *T_CRS != NUL)
|
||||||
{
|
{
|
||||||
MAY_WANT_TO_LOG_THIS;
|
MAY_WANT_TO_LOG_THIS;
|
||||||
LOG_TR("Sending cursor style request");
|
LOG_TR1("Sending cursor style request");
|
||||||
out_str(T_CRS);
|
out_str(T_CRS);
|
||||||
termrequest_sent(&rcs_status);
|
termrequest_sent(&rcs_status);
|
||||||
need_flush = TRUE;
|
need_flush = TRUE;
|
||||||
@@ -5259,7 +5264,7 @@ handle_version_response(int first, int *arg, int argc, char_u *tp)
|
|||||||
&& *T_CRC != NUL)
|
&& *T_CRC != NUL)
|
||||||
{
|
{
|
||||||
MAY_WANT_TO_LOG_THIS;
|
MAY_WANT_TO_LOG_THIS;
|
||||||
LOG_TR("Sending cursor blink mode request");
|
LOG_TR1("Sending cursor blink mode request");
|
||||||
out_str(T_CRC);
|
out_str(T_CRC);
|
||||||
termrequest_sent(&rbm_status);
|
termrequest_sent(&rbm_status);
|
||||||
need_flush = TRUE;
|
need_flush = TRUE;
|
||||||
@@ -5631,7 +5636,7 @@ handle_csi(
|
|||||||
{
|
{
|
||||||
initial_cursor_blink = (arg[1] == '1');
|
initial_cursor_blink = (arg[1] == '1');
|
||||||
rbm_status.tr_progress = STATUS_GOT;
|
rbm_status.tr_progress = STATUS_GOT;
|
||||||
LOG_TR("Received cursor blinking mode response: %s", tp);
|
LOG_TRN("Received cursor blinking mode response: %s", tp);
|
||||||
key_name[0] = (int)KS_EXTRA;
|
key_name[0] = (int)KS_EXTRA;
|
||||||
key_name[1] = (int)KE_IGNORE;
|
key_name[1] = (int)KE_IGNORE;
|
||||||
*slen = csi_len;
|
*slen = csi_len;
|
||||||
@@ -5764,7 +5769,7 @@ handle_osc(char_u *tp, char_u *argp, int len, char_u *key_name, int *slen)
|
|||||||
char *new_bg_val = (3 * '6' < *tp_r + *tp_g +
|
char *new_bg_val = (3 * '6' < *tp_r + *tp_g +
|
||||||
*tp_b) ? "light" : "dark";
|
*tp_b) ? "light" : "dark";
|
||||||
|
|
||||||
LOG_TR("Received RBG response: %s", tp);
|
LOG_TRN("Received RBG response: %s", tp);
|
||||||
#ifdef FEAT_TERMRESPONSE
|
#ifdef FEAT_TERMRESPONSE
|
||||||
rbg_status.tr_progress = STATUS_GOT;
|
rbg_status.tr_progress = STATUS_GOT;
|
||||||
# ifdef FEAT_TERMINAL
|
# ifdef FEAT_TERMINAL
|
||||||
@@ -5786,7 +5791,7 @@ handle_osc(char_u *tp, char_u *argp, int len, char_u *key_name, int *slen)
|
|||||||
#if defined(FEAT_TERMRESPONSE) && defined(FEAT_TERMINAL)
|
#if defined(FEAT_TERMRESPONSE) && defined(FEAT_TERMINAL)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_TR("Received RFG response: %s", tp);
|
LOG_TRN("Received RFG response: %s", tp);
|
||||||
rfg_status.tr_progress = STATUS_GOT;
|
rfg_status.tr_progress = STATUS_GOT;
|
||||||
fg_r = rval;
|
fg_r = rval;
|
||||||
fg_g = gval;
|
fg_g = gval;
|
||||||
@@ -5809,7 +5814,7 @@ handle_osc(char_u *tp, char_u *argp, int len, char_u *key_name, int *slen)
|
|||||||
}
|
}
|
||||||
if (i == len)
|
if (i == len)
|
||||||
{
|
{
|
||||||
LOG_TR("not enough characters for RB");
|
LOG_TR1("not enough characters for RB");
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
@@ -5839,7 +5844,7 @@ handle_dcs(char_u *tp, char_u *argp, int len, char_u *key_name, int *slen)
|
|||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
LOG_TR("Received DCS response: %s", (char*)tp);
|
LOG_TRN("Received DCS response: %s", (char*)tp);
|
||||||
j = 1 + (tp[0] == ESC);
|
j = 1 + (tp[0] == ESC);
|
||||||
if (len < j + 3)
|
if (len < j + 3)
|
||||||
i = len; // need more chars
|
i = len; // need more chars
|
||||||
@@ -5896,7 +5901,7 @@ handle_dcs(char_u *tp, char_u *argp, int len, char_u *key_name, int *slen)
|
|||||||
(number & 1) ? FALSE : TRUE;
|
(number & 1) ? FALSE : TRUE;
|
||||||
rcs_status.tr_progress = STATUS_GOT;
|
rcs_status.tr_progress = STATUS_GOT;
|
||||||
#endif
|
#endif
|
||||||
LOG_TR("Received cursor shape response: %s", tp);
|
LOG_TRN("Received cursor shape response: %s", tp);
|
||||||
|
|
||||||
key_name[0] = (int)KS_EXTRA;
|
key_name[0] = (int)KS_EXTRA;
|
||||||
key_name[1] = (int)KE_IGNORE;
|
key_name[1] = (int)KE_IGNORE;
|
||||||
@@ -5915,7 +5920,7 @@ handle_dcs(char_u *tp, char_u *argp, int len, char_u *key_name, int *slen)
|
|||||||
{
|
{
|
||||||
// These codes arrive many together, each code can be
|
// These codes arrive many together, each code can be
|
||||||
// truncated at any point.
|
// truncated at any point.
|
||||||
LOG_TR("not enough characters for XT");
|
LOG_TR1("not enough characters for XT");
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
@@ -6267,7 +6272,7 @@ check_termcode(
|
|||||||
{
|
{
|
||||||
#ifdef DEBUG_TERMRESPONSE
|
#ifdef DEBUG_TERMRESPONSE
|
||||||
if (resp == -1)
|
if (resp == -1)
|
||||||
LOG_TR("Not enough characters for CSI sequence");
|
LOG_TR1("Not enough characters for CSI sequence");
|
||||||
#endif
|
#endif
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
@@ -6558,7 +6563,7 @@ check_termcode(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_TERMRESPONSE
|
#ifdef FEAT_TERMRESPONSE
|
||||||
LOG_TR("normal character");
|
LOG_TR1("normal character");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0; // no match found
|
return 0; // no match found
|
||||||
@@ -7100,7 +7105,7 @@ req_more_codes_from_term(void)
|
|||||||
char *key_name = key_names[xt_index_out];
|
char *key_name = key_names[xt_index_out];
|
||||||
|
|
||||||
MAY_WANT_TO_LOG_THIS;
|
MAY_WANT_TO_LOG_THIS;
|
||||||
LOG_TR("Requesting XT %d: %s", xt_index_out, key_name);
|
LOG_TRN("Requesting XT %d: %s", xt_index_out, key_name);
|
||||||
if (key_name[2] != NUL)
|
if (key_name[2] != NUL)
|
||||||
sprintf(buf, "\033P+q%02x%02x%02x\033\\", key_name[0], key_name[1], key_name[2]);
|
sprintf(buf, "\033P+q%02x%02x%02x\033\\", key_name[0], key_name[1], key_name[2]);
|
||||||
else
|
else
|
||||||
@@ -7154,7 +7159,7 @@ got_code_from_term(char_u *code, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_TR("Received XT %d: %s", xt_index_in, (char *)name);
|
LOG_TRN("Received XT %d: %s", xt_index_in, (char *)name);
|
||||||
|
|
||||||
if (key_names[i] != NULL)
|
if (key_names[i] != NULL)
|
||||||
{
|
{
|
||||||
|
@@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1237,
|
||||||
/**/
|
/**/
|
||||||
1236,
|
1236,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user