Gentle ping :)

Kind regards,
Torbjörn

On 2024-09-28 14:49, Torbjörn SVENSSON wrote:
Ok for trunk?

Changes since v1:

- Updated the commit message to mention the actual build error.
- Switch to checking the required define rather than the version number of 
MinGW.

--

The define ENABLE_VIRTUAL_TERMINAL_PROCESSING was introduced in MinGW
7.0

Build failure when building with MinGW 5.0.3:

.../gcc/diagnostic-color.cc:
In function 'bool should_colorize()':
.../gcc/diagnostic-color.cc:317:41:
error: 'ENABLE_VIRTUAL_TERMINAL_PROCESSING' was not declared in this
scope
        mode |= ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING;
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../gcc/diagnostic-color.cc:317:41:
note: suggested alternative: 'ENABLE_RTL_FLAG_CHECKING'
        mode |= ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING;
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                          ENABLE_RTL_FLAG_CHECKING
.../gcc/diagnostic-color.cc:
In function 'bool auto_enable_urls()':
.../gcc/diagnostic-color.cc:407:50:
error: 'ENABLE_VIRTUAL_TERMINAL_PROCESSING' was not declared in this
scope
    if (GetConsoleMode (handle, &mode) && !(mode & 
ENABLE_VIRTUAL_TERMINAL_PROCESSING))
                                                   
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../gcc/diagnostic-color.cc:407:50:
note: suggested alternative: 'ENABLE_RTL_FLAG_CHECKING'
    if (GetConsoleMode (handle, &mode) && !(mode & 
ENABLE_VIRTUAL_TERMINAL_PROCESSING))
                                                   
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                   ENABLE_RTL_FLAG_CHECKING
Makefile:1195: recipe for target 'diagnostic-color.o' failed
make[1]: *** [diagnostic-color.o] Error 1

gcc/ChangeLog:

        * gcc/diagnostic-color.cc: Conditionally enable terminal
        processing based on define availability.
        * gcc/pretty-print.cc: Likewise.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svens...@foss.st.com>
---
  gcc/diagnostic-color.cc | 8 +++++++-
  gcc/pretty-print.cc     | 6 +++++-
  2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/gcc/diagnostic-color.cc b/gcc/diagnostic-color.cc
index 8b195d023eb..2ad708c06e6 100644
--- a/gcc/diagnostic-color.cc
+++ b/gcc/diagnostic-color.cc
@@ -311,12 +311,14 @@ should_colorize (void)
    if ((handle != INVALID_HANDLE_VALUE) && (handle != NULL))
      isconsole = GetConsoleMode (handle, &mode);
+#ifdef ENABLE_VIRTUAL_TERMINAL_PROCESSING
    if (isconsole)
      {
        /* Try to enable processing of VT100 escape sequences */
        mode |= ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING;
        SetConsoleMode (handle, mode);
      }
+#endif
return isconsole;
  #else
@@ -404,7 +406,11 @@ auto_enable_urls ()
    /* If ansi escape sequences aren't supported by the console, then URLs will
       print mangled from mingw_ansi_fputs's console API translation. It 
wouldn't
       be useful even if this weren't the case.  */
-  if (GetConsoleMode (handle, &mode) && !(mode & 
ENABLE_VIRTUAL_TERMINAL_PROCESSING))
+  if (GetConsoleMode (handle, &mode)
+#ifdef ENABLE_VIRTUAL_TERMINAL_PROCESSING
+      && !(mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING)
+#endif
+      )
      return false;
  #endif
diff --git a/gcc/pretty-print.cc b/gcc/pretty-print.cc
index 68c145e2d53..ea75442c6a4 100644
--- a/gcc/pretty-print.cc
+++ b/gcc/pretty-print.cc
@@ -679,7 +679,11 @@ mingw_ansi_fputs (const char *str, FILE *fp)
    /* Don't mess up stdio functions with Windows APIs.  */
    fflush (fp);
- if (GetConsoleMode (h, &mode) && !(mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING))
+  if (GetConsoleMode (h, &mode)
+#ifdef ENABLE_VIRTUAL_TERMINAL_PROCESSING
+      && !(mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING)
+#endif
+      )
      /* If it is a console, and doesn't support ANSI escape codes, translate
         them as needed.  */
      for (;;)

Reply via email to