Hi,
I found an issue with log4cxx built from sources on Ubuntu 18.04 (gcc 7.3). When I execute "make check", I get the error shown below. I attached a simple patch to fix the issue. The detailed info is below: * Host: Ubuntu 18.04.1 LTS * gcc: gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0 * repository: master branch (171e980fdd31e09e36841) on http://gitbox.apache.org/repos/asf/logging-log4cxx.git Thank you ERROR: --------------------------------------------------------------------------------------------------------------------------------------------------------- make[4]: Entering directory '/home/me/projects/basics/logging-log4cxx/src/test/cpp' depbase=`echo helpers/transcodertestcase.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ g++ -DPACKAGE_NAME=\"log4cxx\" -DPACKAGE_TARNAME=\"log4cxx\" -DPACKAGE_VERSION=\"0.11.0\" -DPACKAGE_STRING=\"log4cxx\ 0.11.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"log4cxx\" -DVERSION=\"0.11.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_MBSRTOWCS=1 -DHAVE_WCSTOMBS=1 -DHAVE_SYSLOG=1 -DHAVE_FWIDE=1 -I. -I../../../src/main/include -I../../../src/main/include -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/usr/include/apr-1.0 -I/usr/local/apr/include/apr-1 -g -O2 -MT helpers/transcodertestcase.o -MD -MP -MF $depbase.Tpo -c -o helpers/transcodertestcase.o helpers/transcodertestcase.cpp &&\ mv -f $depbase.Tpo $depbase.Po helpers/transcodertestcase.cpp: In member function 'void TranscoderTestCase::encodeCharsetName3()': helpers/transcodertestcase.cpp:334:68: error: narrowing conversion of '128' from 'int' to 'log4cxx::logchar {aka char}' inside { } [-Wnarrowing] logchar unsupported[] = { 0x1F, 0x7F, 0x80, 0x81, 0x00 }; ^ helpers/transcodertestcase.cpp:334:68: error: narrowing conversion of '129' from 'int' to 'log4cxx::logchar {aka char}' inside { } [-Wnarrowing] Makefile:994: recipe for target 'helpers/transcodertestcase.o' failed --------------------------------------------------------------------------------------------------------------------------------------------------------- PATCH: diff --git a/src/test/cpp/helpers/transcodertestcase.cpp b/src/test/cpp/helpers/transcodertestcase.cpp index 6eafc150..32aafe13 100644 --- a/src/test/cpp/helpers/transcodertestcase.cpp +++ b/src/test/cpp/helpers/transcodertestcase.cpp @@ -331,7 +331,7 @@ public: } void encodeCharsetName3() { - logchar unsupported[] = { 0x1F, 0x7F, 0x80, 0x81, 0x00 }; + logchar unsupported[] = { 0x1F, 0x7F, (logchar)0x80, (logchar)0x81, 0x00 }; std::string encoded(Transcoder::encodeCharsetName(LogString(unsupported))); LOGUNIT_ASSERT_EQUAL(std::string("????"), encoded); } ********************************************************************** DISCLAIMER: Privileged and/or Confidential information may be contained in this message. If you are not the addressee of this message, you may not copy, use or deliver this message to anyone. In such event, you should destroy the message and kindly notify the sender by reply e-mail. It is understood that opinions or conclusions that do not relate to the official business of the company are neither given nor endorsed by the company. Thank You.
diff --git a/src/test/cpp/helpers/transcodertestcase.cpp b/src/test/cpp/helpers/transcodertestcase.cpp index 6eafc150..32aafe13 100644 --- a/src/test/cpp/helpers/transcodertestcase.cpp +++ b/src/test/cpp/helpers/transcodertestcase.cpp @@ -331,7 +331,7 @@ public: } void encodeCharsetName3() { - logchar unsupported[] = { 0x1F, 0x7F, 0x80, 0x81, 0x00 }; + logchar unsupported[] = { 0x1F, 0x7F, (logchar)0x80, (logchar)0x81, 0x00 }; std::string encoded(Transcoder::encodeCharsetName(LogString(unsupported))); LOGUNIT_ASSERT_EQUAL(std::string("????"), encoded); }