Bug: TestLogging.cpp:92:3: error: ?SprintfLiteral? was not declared in this scope
Status: RESOLVED
Priority: --
Resolution: FIXED
Created: 2021-02-03 15:02:53+00:00
Resolved: 2021-02-07 09:54:58+00:00

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0

Steps to reproduce:

Build on Solaris failed with following error:

```
16:06.36 In file included from Unified_cpp_xpcom_tests_gtest1.cpp:74:
16:06.36 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp: In function ?void WriteTestLogFile(const char*, uint32_t)?:
16:06.36 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp:32:5: error: ?SprintfLiteral? was not declared in this scope
16:06.36    32 |     SprintfLiteral(buf, WHOLE_LINE, i);
16:06.36       |     ^~~~~~~~~~~~~~
16:06.38 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp: In member function ?virtual void Logging_DoesNothingWhenNotNeededExact_Test::TestBody()?: 16:06.38 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp:70:3: error: ?SprintfLiteral? was not declared in this scope
16:06.38    70 |   SprintfLiteral(
16:06.38       |   ^~~~~~~~~~~~~~
16:06.39 Undefined                      first referenced
16:06.39  symbol                            in file
16:06.39 av_hwframe_ctx_alloc                libmozavcodec.so.symbols
16:06.39 ld: warning: symbol referencing errors
16:06.40 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp: In member function ?virtual void Logging_DoesNothingWhenNotNeededInexact_Test::TestBody()?:
16:06.40 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp:92:3: error: ?SprintfLiteral? was not declared in this scope
16:06.40    92 |   SprintfLiteral(
16:06.40       |   ^~~~~~~~~~~~~~
16:06.41 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp: In member function ?virtual void Logging_LimitsToLessThanSize_Test::TestBody()?:
16:06.41 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp:115:3: error: ?SprintfLiteral? was not declared in this scope
16:06.41   115 |   SprintfLiteral(
16:06.41       |   ^~~~~~~~~~~~~~
16:06.43 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp: In member function ?virtual void Logging_MayCutLongLinesExact_Test::TestBody()?:
16:06.43 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp:136:3: error: ?SprintfLiteral? was not declared in this scope
16:06.43   136 |   SprintfLiteral(
16:06.43       |   ^~~~~~~~~~~~~~
16:06.44 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp: In member function ?virtual void Logging_MayCutLongLinesInexact_Test::TestBody()?:
16:06.44 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp:161:3: error: ?SprintfLiteral? was not declared in this scope
16:06.44   161 |   SprintfLiteral(
16:06.44       |   ^~~~~~~~~~~~~~
```

The first bad revision is:
changeset:   565810:da3640fcab7b
user:        Nick Alexander <nalexander@mozilla.com>
date:        Tue Feb 02 20:35:01 2021 -0800
description:
	Bug 1687549 - Allow to limit MOZ_LOG file with `maxsize:N` when using `append`. r=xpcom-reviewers,kmag

	The existing `append` option allows to accumulate logs. The `rotate:N`
	option added in Bug 1244306 allows to limit the growth of the log, but
	it's both incompatible with `append` and not well suited for a single
	cumulative historical log across multiple runs, since it's unclear how
	to manage the current log file index across invocations.  Continuously
	limiting the file size for each log message is technically
	challenging.

	This commit pursues a much simpler approach.  When `maxsize:N` is
	specified with `append`, before a log file is opened, it "tails" the
	file to be at most N // 2 bytes long.  It tries to keep lines intact
	at low runtime memory cost, but allows very long lines may be cut.

	This implementation wants an atomic file rename operation, which is
	supported on Win32 and POSIX OSes only at this time.  On other OSes, a
	compile time error will be raised.

	Differential Revision: https://phabricator.services.mozilla.com/D103405