Skip to content
This repository was archived by the owner on May 1, 2023. It is now read-only.

Commit 3530f83

Browse files
Kunal Chakrabortifacebook-github-bot
Kunal Chakraborti
authored andcommitted
Back out "Update fmt to 8.1.1"
Summary: Original commit changeset: 1bdb91c5731d Original Phabricator Diff: D33713304 (c243002) (Note: this ignores all push blocking failures!) Differential Revision: D33864749 fbshipit-source-id: c3a621c89d62216720fa9ee86593c3e6481a6e9c
1 parent c243002 commit 3530f83

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+9380
-56678
lines changed

deps/fmt/.clang-format

Lines changed: 0 additions & 8 deletions
This file was deleted.

deps/fmt/CMakeLists.txt

Lines changed: 44 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,29 @@
1-
cmake_minimum_required(VERSION 3.1...3.18)
1+
cmake_minimum_required(VERSION 3.1.0)
22

3-
# Fallback for using newer policies on CMake <3.12.
4-
if(${CMAKE_VERSION} VERSION_LESS 3.12)
3+
# Use newer policies if available, up to most recent tested version of CMake.
4+
if(${CMAKE_VERSION} VERSION_LESS 3.11)
55
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
6+
else()
7+
cmake_policy(VERSION 3.11)
68
endif()
79

810
# Determine if fmt is built as a subproject (using add_subdirectory)
911
# or if it is the master project.
10-
if (NOT DEFINED FMT_MASTER_PROJECT)
11-
set(FMT_MASTER_PROJECT OFF)
12-
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
13-
set(FMT_MASTER_PROJECT ON)
14-
message(STATUS "CMake version: ${CMAKE_VERSION}")
15-
endif ()
12+
set(MASTER_PROJECT OFF)
13+
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
14+
set(MASTER_PROJECT ON)
15+
message(STATUS "CMake version: ${CMAKE_VERSION}")
1616
endif ()
1717

1818
# Joins arguments and places the results in ${result_var}.
1919
function(join result_var)
20-
set(result "")
20+
set(result )
2121
foreach (arg ${ARGN})
2222
set(result "${result}${arg}")
2323
endforeach ()
2424
set(${result_var} "${result}" PARENT_SCOPE)
2525
endfunction()
2626

27-
function(enable_module target)
28-
if (MSVC)
29-
set(BMI ${CMAKE_CURRENT_BINARY_DIR}/${target}.ifc)
30-
target_compile_options(${target}
31-
PRIVATE /interface /ifcOutput ${BMI}
32-
INTERFACE /reference fmt=${BMI})
33-
endif ()
34-
set_target_properties(${target} PROPERTIES ADDITIONAL_CLEAN_FILES ${BMI})
35-
set_source_files_properties(${BMI} PROPERTIES GENERATED ON)
36-
endfunction()
37-
3827
include(CMakeParseArguments)
3928

4029
# Sets a cache variable with a docstring joined from multiple arguments:
@@ -57,7 +46,7 @@ endfunction()
5746
# Set the default CMAKE_BUILD_TYPE to Release.
5847
# This should be done before the project command since the latter can set
5948
# CMAKE_BUILD_TYPE itself (it does so for nmake).
60-
if (FMT_MASTER_PROJECT AND NOT CMAKE_BUILD_TYPE)
49+
if (MASTER_PROJECT AND NOT CMAKE_BUILD_TYPE)
6150
set_verbose(CMAKE_BUILD_TYPE Release CACHE STRING
6251
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or "
6352
"CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
@@ -66,41 +55,20 @@ endif ()
6655
project(FMT CXX)
6756
include(GNUInstallDirs)
6857
set_verbose(FMT_INC_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE STRING
69-
"Installation directory for include files, a relative path that "
70-
"will be joined with ${CMAKE_INSTALL_PREFIX} or an absolute path.")
58+
"Installation directory for include files, a relative path "
59+
"that will be joined to ${CMAKE_INSTALL_PREFIX}, or an arbitrary absolute path.")
7160

7261
option(FMT_PEDANTIC "Enable extra warnings and expensive tests." OFF)
7362
option(FMT_WERROR "Halt the compilation with an error on compiler warnings."
7463
OFF)
7564

7665
# Options that control generation of various targets.
77-
option(FMT_DOC "Generate the doc target." ${FMT_MASTER_PROJECT})
78-
option(FMT_INSTALL "Generate the install target." ${FMT_MASTER_PROJECT})
79-
option(FMT_TEST "Generate the test target." ${FMT_MASTER_PROJECT})
66+
option(FMT_DOC "Generate the doc target." ${MASTER_PROJECT})
67+
option(FMT_INSTALL "Generate the install target." ${MASTER_PROJECT})
68+
option(FMT_TEST "Generate the test target." ${MASTER_PROJECT})
8069
option(FMT_FUZZ "Generate the fuzz target." OFF)
8170
option(FMT_CUDA_TEST "Generate the cuda-test target." OFF)
8271
option(FMT_OS "Include core requiring OS (Windows/Posix) " ON)
83-
option(FMT_MODULE "Build a module instead of a traditional library." OFF)
84-
option(FMT_SYSTEM_HEADERS "Expose headers with marking them as system." OFF)
85-
86-
set(FMT_CAN_MODULE OFF)
87-
if (CMAKE_CXX_STANDARD GREATER 17 AND
88-
# msvc 16.10-pre4
89-
MSVC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.29.30035)
90-
set(FMT_CAN_MODULE OFF)
91-
endif ()
92-
if (NOT FMT_CAN_MODULE)
93-
set(FMT_MODULE OFF)
94-
message(STATUS "Module support is disabled.")
95-
endif ()
96-
if (FMT_TEST AND FMT_MODULE)
97-
# The tests require {fmt} to be compiled as traditional library
98-
message(STATUS "Testing is incompatible with build mode 'module'.")
99-
endif ()
100-
set(FMT_SYSTEM_HEADERS_ATTRIBUTE "")
101-
if (FMT_SYSTEM_HEADERS)
102-
set(FMT_SYSTEM_HEADERS_ATTRIBUTE SYSTEM)
103-
endif ()
10472

10573
# Get version from core.h
10674
file(READ include/fmt/core.h core_h)
@@ -136,36 +104,24 @@ if (${index} GREATER -1)
136104
endif ()
137105
message(STATUS "Required features: ${FMT_REQUIRED_FEATURES}")
138106

139-
if (FMT_MASTER_PROJECT AND NOT DEFINED CMAKE_CXX_VISIBILITY_PRESET)
140-
set_verbose(CMAKE_CXX_VISIBILITY_PRESET hidden CACHE STRING
141-
"Preset for the export of private symbols")
142-
set_property(CACHE CMAKE_CXX_VISIBILITY_PRESET PROPERTY STRINGS
143-
hidden default)
144-
endif ()
145-
146-
if (FMT_MASTER_PROJECT AND NOT DEFINED CMAKE_VISIBILITY_INLINES_HIDDEN)
147-
set_verbose(CMAKE_VISIBILITY_INLINES_HIDDEN ON CACHE BOOL
148-
"Whether to add a compile flag to hide symbols of inline functions")
149-
endif ()
150-
151107
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
152108
set(PEDANTIC_COMPILE_FLAGS -pedantic-errors -Wall -Wextra -pedantic
153109
-Wold-style-cast -Wundef
154110
-Wredundant-decls -Wwrite-strings -Wpointer-arith
155111
-Wcast-qual -Wformat=2 -Wmissing-include-dirs
156-
-Wcast-align
112+
-Wcast-align -Wnon-virtual-dtor
157113
-Wctor-dtor-privacy -Wdisabled-optimization
158114
-Winvalid-pch -Woverloaded-virtual
159-
-Wconversion -Wundef
160-
-Wno-ctor-dtor-privacy -Wno-format-nonliteral)
115+
-Wconversion -Wswitch-enum
116+
-Wno-ctor-dtor-privacy -Wno-format-nonliteral -Wno-shadow)
161117
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
162-
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS}
118+
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wnoexcept
163119
-Wno-dangling-else -Wno-unused-local-typedefs)
164120
endif ()
165121
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
166122
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wdouble-promotion
167123
-Wtrampolines -Wzero-as-null-pointer-constant -Wuseless-cast
168-
-Wvector-operation-performance -Wsized-deallocation -Wshadow)
124+
-Wvector-operation-performance -Wsized-deallocation)
169125
endif ()
170126
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
171127
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wshift-overflow=2
@@ -175,9 +131,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
175131
endif ()
176132

177133
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
178-
set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -pedantic -Wconversion -Wundef
179-
-Wdeprecated -Wweak-vtables -Wshadow
180-
-Wno-gnu-zero-variadic-macro-arguments)
134+
set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -pedantic -Wconversion
135+
-Wno-sign-conversion -Wdeprecated -Wweak-vtables)
181136
check_cxx_compiler_flag(-Wzero-as-null-pointer-constant HAS_NULLPTR_WARNING)
182137
if (HAS_NULLPTR_WARNING)
183138
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS}
@@ -191,7 +146,7 @@ if (MSVC)
191146
set(WERROR_FLAG /WX)
192147
endif ()
193148

194-
if (FMT_MASTER_PROJECT AND CMAKE_GENERATOR MATCHES "Visual Studio")
149+
if (MASTER_PROJECT AND CMAKE_GENERATOR MATCHES "Visual Studio")
195150
# If Microsoft SDK is installed create script run-msbuild.bat that
196151
# calls SetEnv.cmd to set up build environment and runs msbuild.
197152
# It is useful when building Visual Studio projects with the SDK
@@ -230,12 +185,9 @@ function(add_headers VAR)
230185
endfunction()
231186

232187
# Define the fmt library, its includes and the needed defines.
233-
add_headers(FMT_HEADERS args.h chrono.h color.h compile.h core.h format.h
234-
format-inl.h locale.h os.h ostream.h printf.h ranges.h
235-
xchar.h)
236-
if (FMT_MODULE)
237-
set(FMT_SOURCES src/fmt.cc)
238-
elseif (FMT_OS)
188+
add_headers(FMT_HEADERS chrono.h color.h compile.h core.h format.h format-inl.h
189+
locale.h os.h ostream.h posix.h printf.h ranges.h)
190+
if (FMT_OS)
239191
set(FMT_SOURCES src/format.cc src/os.cc)
240192
else()
241193
set(FMT_SOURCES src/format.cc)
@@ -249,10 +201,7 @@ if (HAVE_STRTOD_L)
249201
endif ()
250202

251203
if (MINGW)
252-
check_cxx_compiler_flag("-Wa,-mbig-obj" FMT_HAS_MBIG_OBJ)
253-
if (${FMT_HAS_MBIG_OBJ})
254-
target_compile_options(fmt PUBLIC "-Wa,-mbig-obj")
255-
endif()
204+
target_compile_options(fmt PUBLIC "-Wa,-mbig-obj")
256205
endif ()
257206

258207
if (FMT_WERROR)
@@ -261,13 +210,10 @@ endif ()
261210
if (FMT_PEDANTIC)
262211
target_compile_options(fmt PRIVATE ${PEDANTIC_COMPILE_FLAGS})
263212
endif ()
264-
if (FMT_MODULE)
265-
enable_module(fmt)
266-
endif ()
267213

268214
target_compile_features(fmt INTERFACE ${FMT_REQUIRED_FEATURES})
269215

270-
target_include_directories(fmt ${FMT_SYSTEM_HEADERS_ATTRIBUTE} PUBLIC
216+
target_include_directories(fmt PUBLIC
271217
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
272218
$<INSTALL_INTERFACE:${FMT_INC_DIR}>)
273219

@@ -285,8 +231,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
285231
endif ()
286232

287233
if (BUILD_SHARED_LIBS)
288-
if (UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" AND
289-
NOT EMSCRIPTEN)
234+
if (UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" AND NOT EMSCRIPTEN)
290235
# Fix rpmlint warning:
291236
# unused-direct-shlib-dependency /usr/lib/libformat.so.1.1.0 /lib/libm.so.6.
292237
target_link_libraries(fmt -Wl,--as-needed)
@@ -303,30 +248,28 @@ add_library(fmt::fmt-header-only ALIAS fmt-header-only)
303248
target_compile_definitions(fmt-header-only INTERFACE FMT_HEADER_ONLY=1)
304249
target_compile_features(fmt-header-only INTERFACE ${FMT_REQUIRED_FEATURES})
305250

306-
target_include_directories(fmt-header-only ${FMT_SYSTEM_HEADERS_ATTRIBUTE} INTERFACE
251+
target_include_directories(fmt-header-only INTERFACE
307252
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
308253
$<INSTALL_INTERFACE:${FMT_INC_DIR}>)
309254

310255
# Install targets.
311256
if (FMT_INSTALL)
312257
include(CMakePackageConfigHelpers)
313258
set_verbose(FMT_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/fmt CACHE STRING
314-
"Installation directory for cmake files, a relative path that "
315-
"will be joined with ${CMAKE_INSTALL_PREFIX} or an absolute "
316-
"path.")
259+
"Installation directory for cmake files, a relative path "
260+
"that will be joined to ${CMAKE_INSTALL_PREFIX}, or an arbitrary absolute path.")
317261
set(version_config ${PROJECT_BINARY_DIR}/fmt-config-version.cmake)
318262
set(project_config ${PROJECT_BINARY_DIR}/fmt-config.cmake)
319263
set(pkgconfig ${PROJECT_BINARY_DIR}/fmt.pc)
320264
set(targets_export_name fmt-targets)
321265

322266
set_verbose(FMT_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING
323-
"Installation directory for libraries, a relative path that "
324-
"will be joined to ${CMAKE_INSTALL_PREFIX} or an absolute path.")
267+
"Installation directory for libraries, a relative path "
268+
"that will be joined to ${CMAKE_INSTALL_PREFIX}, or an arbitrary absolute path.")
325269

326270
set_verbose(FMT_PKGCONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig CACHE PATH
327-
"Installation directory for pkgconfig (.pc) files, a relative "
328-
"path that will be joined with ${CMAKE_INSTALL_PREFIX} or an "
329-
"absolute path.")
271+
"Installation directory for pkgconfig (.pc) files, a relative path "
272+
"that will be joined to ${CMAKE_INSTALL_PREFIX}, or an arbitrary absolute path.")
330273

331274
# Generate the version, config and target files into the build directory.
332275
write_basic_package_version_file(
@@ -347,13 +290,6 @@ if (FMT_INSTALL)
347290
INSTALL_DESTINATION ${FMT_CMAKE_DIR})
348291

349292
set(INSTALL_TARGETS fmt fmt-header-only)
350-
351-
# Install the library and headers.
352-
install(TARGETS ${INSTALL_TARGETS} EXPORT ${targets_export_name}
353-
LIBRARY DESTINATION ${FMT_LIB_DIR}
354-
ARCHIVE DESTINATION ${FMT_LIB_DIR}
355-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
356-
357293
# Use a namespace because CMake provides better diagnostics for namespaced
358294
# imported targets.
359295
export(TARGETS ${INSTALL_TARGETS} NAMESPACE fmt::
@@ -366,6 +302,12 @@ if (FMT_INSTALL)
366302
install(EXPORT ${targets_export_name} DESTINATION ${FMT_CMAKE_DIR}
367303
NAMESPACE fmt::)
368304

305+
# Install the library and headers.
306+
install(TARGETS ${INSTALL_TARGETS} EXPORT ${targets_export_name}
307+
LIBRARY DESTINATION ${FMT_LIB_DIR}
308+
ARCHIVE DESTINATION ${FMT_LIB_DIR}
309+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
310+
369311
install(FILES $<TARGET_PDB_FILE:${INSTALL_TARGETS}>
370312
DESTINATION ${FMT_LIB_DIR} OPTIONAL)
371313
install(FILES ${FMT_HEADERS} DESTINATION "${FMT_INC_DIR}/fmt")
@@ -384,17 +326,11 @@ endif ()
384326
# Control fuzzing independent of the unit tests.
385327
if (FMT_FUZZ)
386328
add_subdirectory(test/fuzzing)
387-
388-
# The FMT_FUZZ macro is used to prevent resource exhaustion in fuzzing
389-
# mode and make fuzzing practically possible. It is similar to
390-
# FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION but uses a different name to
391-
# avoid interfering with fuzzing of projects that use {fmt}.
392-
# See also https://llvm.org/docs/LibFuzzer.html#fuzzer-friendly-build-mode.
393329
target_compile_definitions(fmt PUBLIC FMT_FUZZ)
394330
endif ()
395331

396332
set(gitignore ${PROJECT_SOURCE_DIR}/.gitignore)
397-
if (FMT_MASTER_PROJECT AND EXISTS ${gitignore})
333+
if (MASTER_PROJECT AND EXISTS ${gitignore})
398334
# Get the list of ignored files from .gitignore.
399335
file (STRINGS ${gitignore} lines)
400336
list(REMOVE_ITEM lines /doc/html)

deps/fmt/CONTRIBUTING.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,4 @@ exceptions:
1414
* snake_case should be used instead of UpperCamelCase for function and type
1515
names
1616

17-
All documentation must adhere to the [Google Developer Documentation Style
18-
Guide](https://developers.google.com/style).
19-
2017
Thanks for contributing!

0 commit comments

Comments
 (0)