mlog: remove direct calls to log_once

This was never meant to be public API, log(once=True) is for that.
pull/11074/head
Dylan Baker 2 years ago committed by Eli Schwartz
parent d17e3ce6ba
commit 73c054ced6
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 6
      mesonbuild/compilers/c.py
  2. 2
      mesonbuild/interpreter/interpreter.py
  3. 8
      mesonbuild/mlog.py

@ -484,10 +484,10 @@ class VisualStudioCCompiler(MSVCCompiler, VisualStudioLikeCCompilerMixin, CCompi
args = [] args = []
std = options[OptionKey('std', machine=self.for_machine, lang=self.language)] std = options[OptionKey('std', machine=self.for_machine, lang=self.language)]
if std.value.startswith('gnu'): if std.value.startswith('gnu'):
mlog.log_once( mlog.log(
'cl.exe does not actually support gnu standards, and meson ' 'cl.exe does not actually support gnu standards, and meson '
'will instead demote to the nearest ISO C standard. This ' 'will instead demote to the nearest ISO C standard. This '
'may cause compilation to fail.') 'may cause compilation to fail.', once=True)
# As of MVSC 16.8, /std:c11 and /std:c17 are the only valid C standard options. # As of MVSC 16.8, /std:c11 and /std:c17 are the only valid C standard options.
if std.value in {'c11', 'gnu1x', 'gnu11'}: if std.value in {'c11', 'gnu1x', 'gnu11'}:
args.append('/std:c11') args.append('/std:c11')
@ -540,7 +540,7 @@ class IntelClCCompiler(IntelVisualStudioLikeCompiler, VisualStudioLikeCCompilerM
key = OptionKey('std', machine=self.for_machine, lang=self.language) key = OptionKey('std', machine=self.for_machine, lang=self.language)
std = options[key] std = options[key]
if std.value == 'c89': if std.value == 'c89':
mlog.log_once("ICL doesn't explicitly implement c89, setting the standard to 'none', which is close.") mlog.log("ICL doesn't explicitly implement c89, setting the standard to 'none', which is close.", once=True)
elif std.value != 'none': elif std.value != 'none':
args.append('/Qstd:' + std.value) args.append('/Qstd:' + std.value)
return args return args

@ -1497,7 +1497,7 @@ class Interpreter(InterpreterBase, HoldableObject):
try: try:
skip_sanity_check = self.should_skip_sanity_check(for_machine) skip_sanity_check = self.should_skip_sanity_check(for_machine)
if skip_sanity_check: if skip_sanity_check:
mlog.log_once('Cross compiler sanity tests disabled via the cross file.') mlog.log('Cross compiler sanity tests disabled via the cross file.', once=True)
comp = compilers.detect_compiler_for(self.environment, lang, for_machine, skip_sanity_check) comp = compilers.detect_compiler_for(self.environment, lang, for_machine, skip_sanity_check)
if comp is None: if comp is None:
raise InvalidArguments(f'Tried to use unknown language "{lang}".') raise InvalidArguments(f'Tried to use unknown language "{lang}".')

@ -268,7 +268,7 @@ def log(*args: TV_Loggable, is_error: bool = False,
sep: T.Optional[str] = None, sep: T.Optional[str] = None,
end: T.Optional[str] = None) -> None: end: T.Optional[str] = None) -> None:
if once: if once:
log_once(*args, is_error=is_error, nested=nested, sep=sep, end=end) _log_once(*args, is_error=is_error, nested=nested, sep=sep, end=end)
else: else:
_log(*args, is_error=is_error, nested=nested, sep=sep, end=end) _log(*args, is_error=is_error, nested=nested, sep=sep, end=end)
@ -285,9 +285,9 @@ def _log(*args: TV_Loggable, is_error: bool = False,
if not log_errors_only or is_error: if not log_errors_only or is_error:
force_print(*arr, nested=nested, sep=sep, end=end) force_print(*arr, nested=nested, sep=sep, end=end)
def log_once(*args: TV_Loggable, is_error: bool = False, def _log_once(*args: TV_Loggable, is_error: bool = False,
nested: bool = True, sep: T.Optional[str] = None, nested: bool = True, sep: T.Optional[str] = None,
end: T.Optional[str] = None) -> None: end: T.Optional[str] = None) -> None:
"""Log variant that only prints a given message one time per meson invocation. """Log variant that only prints a given message one time per meson invocation.
This considers ansi decorated values by the values they wrap without This considers ansi decorated values by the values they wrap without

Loading…
Cancel
Save