* supress gcc variadic warnings

* shorthand of format usage https://github.com/cppformat/cppformat/issues/49#issuecomment-48116104
This commit is contained in:
HarpyWar 2014-07-06 20:37:11 +04:00
parent 596b50e7ce
commit 50b7df5b24
3 changed files with 28 additions and 8 deletions

View file

@ -30,6 +30,32 @@ option(WITH_PGSQL "include PostgreSQL user accounts support" OFF)
option(WITH_ODBC "include ODBC user accounts support" OFF)
include(ConfigureChecks.cmake)
if (CMAKE_COMPILER_IS_GNUCXX)
# Determine GCC version.
message("Determining GCC version.")
EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
ARGS --version
OUTPUT_VARIABLE _GCC_VERSION)
STRING(REGEX REPLACE ".* ([0-9])\\.([0-9])\\.([0-9]) .*" "\\1\\2\\3"
_GCC_VERSION ${_GCC_VERSION})
message(" GCC version is ${_GCC_VERSION}")
# Add -Wno-longlong if the GCC version is < 4.0.0. Add -pedantic flag
# but disable warnings for variadic macros with GCC >= 4.0.0. Earlier
# versions warn because of anonymous variadic macros in pedantic mode
# but do not have a flag to disable these warnings.
if (400 GREATER _GCC_VERSION)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-long")
else (400 GREATER _GCC_VERSION)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-variadic-macros")
endif (400 GREATER _GCC_VERSION)
# Pass CXX flags to flags.
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSEQAN_CXX_FLAGS_=\"${CMAKE_CXX_FLAGS}\"")
endif (CMAKE_COMPILER_IS_GNUCXX)
subdirs(src conf man files)
if(WITH_LUA)
add_subdirectory(lua)

View file

@ -17,11 +17,7 @@ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/var/status")
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/var/ DESTINATION ${LOCALSTATEDIR})
install(FILES ad000001.mng ad000001.smk ad000002.mng ad000003.mng
ad000004.mng ad000075.mng chathelp-war3-default.txt
chathelp-war3-enUS.txt chathelp-war3-frFR.txt chathelp-war3-ruRU.txt
chathelp-war3-zhCN.txt newaccount-default.txt newaccount-enUS.txt
newbie.save termsofservice-default.txt termsofservice-enUS.txt
tos_default.txt tos-unicode_default.txt
ad000004.mng ad000075.mng newbie.save
bnserver.ini bnserver-D2DV.ini bnserver-D2XP.ini bnserver-WAR3.ini
ver-ix86-1.mpq IX86ver1.mpq PMACver1.mpq XMACver1.mpq
icons.bni icons_STAR.bni icons-WAR3.bni

View file

@ -184,9 +184,7 @@ namespace pvpgn
if (!(format = _find_string(fmt, lang)))
format = fmt;
fmt::Writer out;
out.write(format, args);
output = out.str();
output = fmt::format(format, args);
}
catch (const std::exception& e)
{