Skip to content

Commit 2726821

Browse files
h-eastchrisbra
authored andcommitted
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 <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 35cb036 commit 2726821

2 files changed

Lines changed: 42 additions & 35 deletions

File tree

src/term.c

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,20 @@ static int term_is_builtin(char_u *name);
6767
static int term_7to8bit(char_u *p);
6868
static void accept_modifiers_for_function_keys(void);
6969

70-
# if 0 // Change to 1 to enable ch_log() calls for termresponse debugging.
71-
# define DEBUG_TERMRESPONSE
72-
# define LOG_TR(fmt,...) \
73-
ch_log(NULL, "TermResp: %s " fmt, \
74-
must_redraw == UPD_NOT_VALID ? "NV" \
75-
: must_redraw == UPD_CLEAR ? "CL" : " ", ##__VA_ARGS__)
76-
# else
77-
# define LOG_TR(fmt,...) do { /**/ } while (0)
78-
# endif
70+
#if 0 // Change to 1 to enable ch_log() calls for termresponse debugging.
71+
# define DEBUG_TERMRESPONSE
72+
# define LOG_TR1(str) \
73+
ch_log(NULL, "TermResp: %s " str, \
74+
must_redraw == UPD_NOT_VALID ? "NV" \
75+
: must_redraw == UPD_CLEAR ? "CL" : " ")
76+
# define LOG_TRN(fmt,...) \
77+
ch_log(NULL, "TermResp: %s " fmt, \
78+
must_redraw == UPD_NOT_VALID ? "NV" \
79+
: must_redraw == UPD_CLEAR ? "CL" : " ", __VA_ARGS__)
80+
#else
81+
# define LOG_TR1(str) do { /**/ } while (0)
82+
# define LOG_TRN(fmt,...) do { /**/ } while (0)
83+
#endif
7984

8085
#ifdef HAVE_TGETENT
8186
static char *invoke_tgetent(char_u *, char_u *);
@@ -1691,7 +1696,7 @@ may_adjust_color_count(int val)
16911696
{
16921697
int r = redraw_asap(UPD_CLEAR);
16931698

1694-
LOG_TR("Received t_Co, redraw_asap(): %d", r);
1699+
LOG_TRN("Received t_Co, redraw_asap(): %d", r);
16951700
}
16961701
#else
16971702
redraw_asap(UPD_CLEAR);
@@ -2300,7 +2305,7 @@ set_termname(char_u *term)
23002305
full_screen = TRUE; // we can use termcap codes from now on
23012306
set_term_defaults(); // use current values as defaults
23022307
#ifdef FEAT_TERMRESPONSE
2303-
LOG_TR("setting crv_status to STATUS_GET");
2308+
LOG_TR1("setting crv_status to STATUS_GET");
23042309
crv_status.tr_progress = STATUS_GET; // Get terminal version later
23052310
write_t_8u_state = FALSE;
23062311
#endif
@@ -4080,7 +4085,7 @@ may_req_termresponse(void)
40804085
&& *T_CRV != NUL)
40814086
{
40824087
MAY_WANT_TO_LOG_THIS;
4083-
LOG_TR("Sending CRV request");
4088+
LOG_TR1("Sending CRV request");
40844089
out_str(T_CRV);
40854090
termrequest_sent(&crv_status);
40864091
// check for the characters now, otherwise they might be eaten by
@@ -4119,7 +4124,7 @@ check_terminal_behavior(void)
41194124
// changes cursor position, so it must be called immediately after
41204125
// entering termcap mode.
41214126
MAY_WANT_TO_LOG_THIS;
4122-
LOG_TR("Sending request for ambiwidth check");
4127+
LOG_TR1("Sending request for ambiwidth check");
41234128
// Do this in the second row. In the first row the returned sequence
41244129
// may be CSI 1;2R, which is the same as <S-F3>.
41254130
term_windgoto(1, 0);
@@ -4148,7 +4153,7 @@ check_terminal_behavior(void)
41484153
// handles test sequence incorrectly, a garbage string is displayed and
41494154
// the cursor does move.
41504155
MAY_WANT_TO_LOG_THIS;
4151-
LOG_TR("Sending xterm compatibility test sequence.");
4156+
LOG_TR1("Sending xterm compatibility test sequence.");
41524157
// Do this in the third row. Second row is used by ambiguous
41534158
// character width check.
41544159
term_windgoto(2, 0);
@@ -4199,7 +4204,7 @@ may_req_bg_color(void)
41994204
if (rfg_status.tr_progress == STATUS_GET && *T_RFG != NUL)
42004205
{
42014206
MAY_WANT_TO_LOG_THIS;
4202-
LOG_TR("Sending FG request");
4207+
LOG_TR1("Sending FG request");
42034208
out_str(T_RFG);
42044209
termrequest_sent(&rfg_status);
42054210
didit = TRUE;
@@ -4210,7 +4215,7 @@ may_req_bg_color(void)
42104215
if (rbg_status.tr_progress == STATUS_GET && *T_RBG != NUL)
42114216
{
42124217
MAY_WANT_TO_LOG_THIS;
4213-
LOG_TR("Sending BG request");
4218+
LOG_TR1("Sending BG request");
42144219
out_str(T_RBG);
42154220
termrequest_sent(&rbg_status);
42164221
didit = TRUE;
@@ -4821,7 +4826,7 @@ switch_to_8bit(void)
48214826
need_gather = TRUE; // need to fill termleader[]
48224827
}
48234828
detected_8bit = TRUE;
4824-
LOG_TR("Switching to 8 bit");
4829+
LOG_TR1("Switching to 8 bit");
48254830
}
48264831

48274832
#ifdef CHECK_DOUBLE_CLICK
@@ -4974,7 +4979,7 @@ handle_u7_response(int *arg, char_u *tp UNUSED, int csi_len UNUSED)
49744979
{
49754980
char *aw = NULL;
49764981

4977-
LOG_TR("Received U7 status: %s", tp);
4982+
LOG_TRN("Received U7 status: %s", tp);
49784983
u7_status.tr_progress = STATUS_GOT;
49794984
did_cursorhold = TRUE;
49804985
if (arg[1] == 2)
@@ -4991,7 +4996,7 @@ handle_u7_response(int *arg, char_u *tp UNUSED, int csi_len UNUSED)
49914996
{
49924997
int r = redraw_asap(UPD_CLEAR);
49934998

4994-
LOG_TR("set 'ambiwidth', redraw_asap(): %d", r);
4999+
LOG_TRN("set 'ambiwidth', redraw_asap(): %d", r);
49955000
}
49965001
#else
49975002
redraw_asap(UPD_CLEAR);
@@ -5007,7 +5012,7 @@ handle_u7_response(int *arg, char_u *tp UNUSED, int csi_len UNUSED)
50075012
{
50085013
int value;
50095014

5010-
LOG_TR("Received compatibility test result: %s", tp);
5015+
LOG_TRN("Received compatibility test result: %s", tp);
50115016
xcc_status.tr_progress = STATUS_GOT;
50125017

50135018
// Third row: xterm compatibility test.
@@ -5031,7 +5036,7 @@ handle_version_response(int first, int *arg, int argc, char_u *tp)
50315036
// version.
50325037
int version = arg[1];
50335038

5034-
LOG_TR("Received CRV response: %s", tp);
5039+
LOG_TRN("Received CRV response: %s", tp);
50355040
crv_status.tr_progress = STATUS_GOT;
50365041
did_cursorhold = TRUE;
50375042

@@ -5074,7 +5079,7 @@ handle_version_response(int first, int *arg, int argc, char_u *tp)
50745079
// terminals the request should be ignored.
50755080
if (version >= 141 && p_xtermcodes)
50765081
{
5077-
LOG_TR("Enable checking for XT codes");
5082+
LOG_TR1("Enable checking for XT codes");
50785083
check_for_codes = TRUE;
50795084
need_gather = TRUE;
50805085
req_codes_from_term();
@@ -5244,7 +5249,7 @@ handle_version_response(int first, int *arg, int argc, char_u *tp)
52445249
&& *T_CRS != NUL)
52455250
{
52465251
MAY_WANT_TO_LOG_THIS;
5247-
LOG_TR("Sending cursor style request");
5252+
LOG_TR1("Sending cursor style request");
52485253
out_str(T_CRS);
52495254
termrequest_sent(&rcs_status);
52505255
need_flush = TRUE;
@@ -5259,7 +5264,7 @@ handle_version_response(int first, int *arg, int argc, char_u *tp)
52595264
&& *T_CRC != NUL)
52605265
{
52615266
MAY_WANT_TO_LOG_THIS;
5262-
LOG_TR("Sending cursor blink mode request");
5267+
LOG_TR1("Sending cursor blink mode request");
52635268
out_str(T_CRC);
52645269
termrequest_sent(&rbm_status);
52655270
need_flush = TRUE;
@@ -5631,7 +5636,7 @@ handle_csi(
56315636
{
56325637
initial_cursor_blink = (arg[1] == '1');
56335638
rbm_status.tr_progress = STATUS_GOT;
5634-
LOG_TR("Received cursor blinking mode response: %s", tp);
5639+
LOG_TRN("Received cursor blinking mode response: %s", tp);
56355640
key_name[0] = (int)KS_EXTRA;
56365641
key_name[1] = (int)KE_IGNORE;
56375642
*slen = csi_len;
@@ -5764,7 +5769,7 @@ handle_osc(char_u *tp, char_u *argp, int len, char_u *key_name, int *slen)
57645769
char *new_bg_val = (3 * '6' < *tp_r + *tp_g +
57655770
*tp_b) ? "light" : "dark";
57665771

5767-
LOG_TR("Received RBG response: %s", tp);
5772+
LOG_TRN("Received RBG response: %s", tp);
57685773
#ifdef FEAT_TERMRESPONSE
57695774
rbg_status.tr_progress = STATUS_GOT;
57705775
# ifdef FEAT_TERMINAL
@@ -5786,7 +5791,7 @@ handle_osc(char_u *tp, char_u *argp, int len, char_u *key_name, int *slen)
57865791
#if defined(FEAT_TERMRESPONSE) && defined(FEAT_TERMINAL)
57875792
else
57885793
{
5789-
LOG_TR("Received RFG response: %s", tp);
5794+
LOG_TRN("Received RFG response: %s", tp);
57905795
rfg_status.tr_progress = STATUS_GOT;
57915796
fg_r = rval;
57925797
fg_g = gval;
@@ -5809,7 +5814,7 @@ handle_osc(char_u *tp, char_u *argp, int len, char_u *key_name, int *slen)
58095814
}
58105815
if (i == len)
58115816
{
5812-
LOG_TR("not enough characters for RB");
5817+
LOG_TR1("not enough characters for RB");
58135818
return FAIL;
58145819
}
58155820
return OK;
@@ -5839,7 +5844,7 @@ handle_dcs(char_u *tp, char_u *argp, int len, char_u *key_name, int *slen)
58395844
{
58405845
int i, j;
58415846

5842-
LOG_TR("Received DCS response: %s", (char*)tp);
5847+
LOG_TRN("Received DCS response: %s", (char*)tp);
58435848
j = 1 + (tp[0] == ESC);
58445849
if (len < j + 3)
58455850
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)
58965901
(number & 1) ? FALSE : TRUE;
58975902
rcs_status.tr_progress = STATUS_GOT;
58985903
#endif
5899-
LOG_TR("Received cursor shape response: %s", tp);
5904+
LOG_TRN("Received cursor shape response: %s", tp);
59005905

59015906
key_name[0] = (int)KS_EXTRA;
59025907
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)
59155920
{
59165921
// These codes arrive many together, each code can be
59175922
// truncated at any point.
5918-
LOG_TR("not enough characters for XT");
5923+
LOG_TR1("not enough characters for XT");
59195924
return FAIL;
59205925
}
59215926
return OK;
@@ -6267,7 +6272,7 @@ check_termcode(
62676272
{
62686273
#ifdef DEBUG_TERMRESPONSE
62696274
if (resp == -1)
6270-
LOG_TR("Not enough characters for CSI sequence");
6275+
LOG_TR1("Not enough characters for CSI sequence");
62716276
#endif
62726277
return resp;
62736278
}
@@ -6558,7 +6563,7 @@ check_termcode(
65586563
}
65596564

65606565
#ifdef FEAT_TERMRESPONSE
6561-
LOG_TR("normal character");
6566+
LOG_TR1("normal character");
65626567
#endif
65636568

65646569
return 0; // no match found
@@ -7100,7 +7105,7 @@ req_more_codes_from_term(void)
71007105
char *key_name = key_names[xt_index_out];
71017106

71027107
MAY_WANT_TO_LOG_THIS;
7103-
LOG_TR("Requesting XT %d: %s", xt_index_out, key_name);
7108+
LOG_TRN("Requesting XT %d: %s", xt_index_out, key_name);
71047109
if (key_name[2] != NUL)
71057110
sprintf(buf, "\033P+q%02x%02x%02x\033\\", key_name[0], key_name[1], key_name[2]);
71067111
else
@@ -7154,7 +7159,7 @@ got_code_from_term(char_u *code, int len)
71547159
}
71557160
}
71567161

7157-
LOG_TR("Received XT %d: %s", xt_index_in, (char *)name);
7162+
LOG_TRN("Received XT %d: %s", xt_index_in, (char *)name);
71587163

71597164
if (key_names[i] != NULL)
71607165
{

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
1237,
707709
/**/
708710
1236,
709711
/**/

0 commit comments

Comments
 (0)