patch 9.1.1237: Compile error with C89 compiler in term.c

Commit: 
https://github.com/vim/vim/commit/2726821d389e08f8bb5630de1ee2d39ce0f53197
Author: Hirohito Higashi <h.east....@gmail.com>
Date:   Tue Mar 25 20:08:32 2025 +0100

    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....@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/term.c b/src/term.c
index b356ca2b6..b8626cd19 100644
--- a/src/term.c
+++ b/src/term.c
@@ -67,15 +67,20 @@ static int term_is_builtin(char_u *name);
 static int term_7to8bit(char_u *p);
 static void accept_modifiers_for_function_keys(void);
 
-#  if 0  // Change to 1 to enable ch_log() calls for termresponse debugging.
-#   define DEBUG_TERMRESPONSE
-#   define LOG_TR(fmt,...)  \
-               ch_log(NULL, "TermResp: %s " fmt,           \
-                   must_redraw == UPD_NOT_VALID ? "NV"     \
-                   : must_redraw == UPD_CLEAR ? "CL" : "  ", ##__VA_ARGS__)
-#  else
-#   define LOG_TR(fmt,...) do { /**/ } while (0)
-#  endif
+#if 0  // Change to 1 to enable ch_log() calls for termresponse debugging.
+# define DEBUG_TERMRESPONSE
+# define LOG_TR1(str) \
+               ch_log(NULL, "TermResp: %s " str, \
+                       must_redraw == UPD_NOT_VALID ? "NV" \
+                       : must_redraw == UPD_CLEAR ? "CL" : "  ")
+# define LOG_TRN(fmt,...) \
+               ch_log(NULL, "TermResp: %s " fmt, \
+                       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
 static char *invoke_tgetent(char_u *, char_u *);
@@ -1691,7 +1696,7 @@ may_adjust_color_count(int val)
     {
        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
     redraw_asap(UPD_CLEAR);
@@ -2300,7 +2305,7 @@ set_termname(char_u *term)
     full_screen = TRUE;                // we can use termcap codes from now on
     set_term_defaults();       // use current values as defaults
 #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
     write_t_8u_state = FALSE;
 #endif
@@ -4080,7 +4085,7 @@ may_req_termresponse(void)
            && *T_CRV != NUL)
     {
        MAY_WANT_TO_LOG_THIS;
-       LOG_TR("Sending CRV request");
+       LOG_TR1("Sending CRV request");
        out_str(T_CRV);
        termrequest_sent(&crv_status);
        // 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
        // entering termcap mode.
        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
        // may be CSI 1;2R, which is the same as <S-F3>.
        term_windgoto(1, 0);
@@ -4148,7 +4153,7 @@ check_terminal_behavior(void)
        // handles test sequence incorrectly, a garbage string is displayed and
        // the cursor does move.
        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
        // character width check.
        term_windgoto(2, 0);
@@ -4199,7 +4204,7 @@ may_req_bg_color(void)
        if (rfg_status.tr_progress == STATUS_GET && *T_RFG != NUL)
        {
            MAY_WANT_TO_LOG_THIS;
-           LOG_TR("Sending FG request");
+           LOG_TR1("Sending FG request");
            out_str(T_RFG);
            termrequest_sent(&rfg_status);
            didit = TRUE;
@@ -4210,7 +4215,7 @@ may_req_bg_color(void)
        if (rbg_status.tr_progress == STATUS_GET && *T_RBG != NUL)
        {
            MAY_WANT_TO_LOG_THIS;
-           LOG_TR("Sending BG request");
+           LOG_TR1("Sending BG request");
            out_str(T_RBG);
            termrequest_sent(&rbg_status);
            didit = TRUE;
@@ -4821,7 +4826,7 @@ switch_to_8bit(void)
        need_gather = TRUE;             // need to fill termleader[]
     }
     detected_8bit = TRUE;
-    LOG_TR("Switching to 8 bit");
+    LOG_TR1("Switching to 8 bit");
 }
 
 #ifdef CHECK_DOUBLE_CLICK
@@ -4974,7 +4979,7 @@ handle_u7_response(int *arg, char_u *tp UNUSED, int 
csi_len UNUSED)
     {
        char *aw = NULL;
 
-       LOG_TR("Received U7 status: %s", tp);
+       LOG_TRN("Received U7 status: %s", tp);
        u7_status.tr_progress = STATUS_GOT;
        did_cursorhold = TRUE;
        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);
 
-               LOG_TR("set 'ambiwidth', redraw_asap(): %d", r);
+               LOG_TRN("set 'ambiwidth', redraw_asap(): %d", r);
            }
 #else
            redraw_asap(UPD_CLEAR);
@@ -5007,7 +5012,7 @@ handle_u7_response(int *arg, char_u *tp UNUSED, int 
csi_len UNUSED)
     {
        int value;
 
-       LOG_TR("Received compatibility test result: %s", tp);
+       LOG_TRN("Received compatibility test result: %s", tp);
        xcc_status.tr_progress = STATUS_GOT;
 
        // Third row: xterm compatibility test.
@@ -5031,7 +5036,7 @@ handle_version_response(int first, int *arg, int argc, 
char_u *tp)
     // version.
     int version = arg[1];
 
-    LOG_TR("Received CRV response: %s", tp);
+    LOG_TRN("Received CRV response: %s", tp);
     crv_status.tr_progress = STATUS_GOT;
     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.
        if (version >= 141 && p_xtermcodes)
        {
-           LOG_TR("Enable checking for XT codes");
+           LOG_TR1("Enable checking for XT codes");
            check_for_codes = TRUE;
            need_gather = TRUE;
            req_codes_from_term();
@@ -5244,7 +5249,7 @@ handle_version_response(int first, int *arg, int argc, 
char_u *tp)
                && *T_CRS != NUL)
        {
            MAY_WANT_TO_LOG_THIS;
-           LOG_TR("Sending cursor style request");
+           LOG_TR1("Sending cursor style request");
            out_str(T_CRS);
            termrequest_sent(&rcs_status);
            need_flush = TRUE;
@@ -5259,7 +5264,7 @@ handle_version_response(int first, int *arg, int argc, 
char_u *tp)
                && *T_CRC != NUL)
        {
            MAY_WANT_TO_LOG_THIS;
-           LOG_TR("Sending cursor blink mode request");
+           LOG_TR1("Sending cursor blink mode request");
            out_str(T_CRC);
            termrequest_sent(&rbm_status);
            need_flush = TRUE;
@@ -5631,7 +5636,7 @@ handle_csi(
     {
        initial_cursor_blink = (arg[1] == '1');
        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[1] = (int)KE_IGNORE;
        *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 +
                                             *tp_b) ? "light" : "dark";
 
-                       LOG_TR("Received RBG response: %s", tp);
+                       LOG_TRN("Received RBG response: %s", tp);
 #ifdef FEAT_TERMRESPONSE
                        rbg_status.tr_progress = STATUS_GOT;
 # 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)
                    else
                    {
-                       LOG_TR("Received RFG response: %s", tp);
+                       LOG_TRN("Received RFG response: %s", tp);
                        rfg_status.tr_progress = STATUS_GOT;
                        fg_r = rval;
                        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)
     {
-       LOG_TR("not enough characters for RB");
+       LOG_TR1("not enough characters for RB");
        return FAIL;
     }
     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;
 
-    LOG_TR("Received DCS response: %s", (char*)tp);
+    LOG_TRN("Received DCS response: %s", (char*)tp);
     j = 1 + (tp[0] == ESC);
     if (len < j + 3)
        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;
                rcs_status.tr_progress = STATUS_GOT;
 #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[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
        // truncated at any point.
-       LOG_TR("not enough characters for XT");
+       LOG_TR1("not enough characters for XT");
        return FAIL;
     }
     return OK;
@@ -6267,7 +6272,7 @@ check_termcode(
                {
 #ifdef DEBUG_TERMRESPONSE
                    if (resp == -1)
-                       LOG_TR("Not enough characters for CSI sequence");
+                       LOG_TR1("Not enough characters for CSI sequence");
 #endif
                    return resp;
                }
@@ -6558,7 +6563,7 @@ check_termcode(
     }
 
 #ifdef FEAT_TERMRESPONSE
-    LOG_TR("normal character");
+    LOG_TR1("normal character");
 #endif
 
     return 0;                      // no match found
@@ -7100,7 +7105,7 @@ req_more_codes_from_term(void)
        char *key_name = key_names[xt_index_out];
 
        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)
            sprintf(buf, " P+q%02x%02x%02x \", key_name[0], key_name[1], 
key_name[2]);
        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)
        {
diff --git a/src/version.c b/src/version.c
index a4b60029d..ac7d719a5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1237,
 /**/
     1236,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1tx9k0-00FHVi-VL%40256bit.org.

Raspunde prin e-mail lui