From 892c52158eaf4259bf7b63e0a84eeffdbe930571 Mon Sep 17 00:00:00 2001 From: Jonathan Poelen Date: Mon, 18 Jan 2021 01:27:24 +0100 Subject: checks -fdiagnostics-color=always before -fcolor-diagnostics (supported by clang and gcc) --- xmake/modules/core/tools/gcc.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index ef3fb4ce9..02b4b9bc6 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -363,12 +363,12 @@ function _has_color_diagnostics(self) if io.isatty() and (colors.color8() or colors.color256()) then local theme = colors.theme() if theme and theme:name() ~= "plain" then - -- for clang - if self:has_flags("-fcolor-diagnostics", "cxflags") then - colors_diagnostics = "-fcolor-diagnostics" -- for gcc - elseif self:has_flags("-fdiagnostics-color=always", "cxflags") then + if self:has_flags("-fdiagnostics-color=always", "cxflags") then colors_diagnostics = "-fdiagnostics-color=always" + -- for clang + elseif self:has_flags("-fcolor-diagnostics", "cxflags") then + colors_diagnostics = "-fcolor-diagnostics" end end end -- cgit v1.3.1