Skip to content

Commit ae9f20c

Browse files
authored
Merge pull request #4554 from facebook/no_legacy
Remove legacy support by default
2 parents e00ddf6 + 1dae4f0 commit ae9f20c

File tree

15 files changed

+67
-45
lines changed

15 files changed

+67
-45
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
v1.6.0 (Dec 2025)
2+
api: legacy format support is now disabled by default
3+
build: `ZSTD_LEGACY_SUPPORT` defaults to `0` in Makefile and CMake
4+
15
V1.5.7 (Feb 2025)
26
fix: compression bug in 32-bit mode associated with long-lasting sessions
37
api: new method `ZSTD_compressSequencesAndLiterals()` (#4217, #4232)

build/VS2008/zstd/zstd.vcproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
Name="VCCLCompilerTool"
4646
Optimization="0"
4747
AdditionalIncludeDirectories="$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\dictBuilder;$(SolutionDir)..\..\lib\compress"
48-
PreprocessorDefinitions="ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE"
48+
PreprocessorDefinitions="ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;_DEBUG;_CONSOLE"
4949
MinimalRebuild="true"
5050
BasicRuntimeChecks="3"
5151
RuntimeLibrary="3"
@@ -122,7 +122,7 @@
122122
EnableIntrinsicFunctions="true"
123123
OmitFramePointers="true"
124124
AdditionalIncludeDirectories="$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\dictBuilder;$(SolutionDir)..\..\lib\compress"
125-
PreprocessorDefinitions="ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE"
125+
PreprocessorDefinitions="ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;NDEBUG;_CONSOLE"
126126
RuntimeLibrary="0"
127127
EnableFunctionLevelLinking="true"
128128
UsePrecompiledHeader="0"
@@ -197,7 +197,7 @@
197197
Name="VCCLCompilerTool"
198198
Optimization="0"
199199
AdditionalIncludeDirectories="$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\dictBuilder;$(SolutionDir)..\..\lib\compress"
200-
PreprocessorDefinitions="ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE"
200+
PreprocessorDefinitions="ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;_DEBUG;_CONSOLE"
201201
MinimalRebuild="true"
202202
BasicRuntimeChecks="3"
203203
RuntimeLibrary="3"
@@ -275,7 +275,7 @@
275275
EnableIntrinsicFunctions="true"
276276
OmitFramePointers="true"
277277
AdditionalIncludeDirectories="$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\dictBuilder;$(SolutionDir)..\..\lib\compress"
278-
PreprocessorDefinitions="ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE"
278+
PreprocessorDefinitions="ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;NDEBUG;_CONSOLE"
279279
RuntimeLibrary="0"
280280
EnableFunctionLevelLinking="true"
281281
UsePrecompiledHeader="0"

build/VS2008/zstdlib/zstdlib.vcproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
Name="VCCLCompilerTool"
4646
Optimization="0"
4747
AdditionalIncludeDirectories="$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\dictBuilder"
48-
PreprocessorDefinitions="ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE"
48+
PreprocessorDefinitions="ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;_DEBUG;_CONSOLE"
4949
MinimalRebuild="true"
5050
BasicRuntimeChecks="3"
5151
RuntimeLibrary="3"
@@ -121,7 +121,7 @@
121121
EnableIntrinsicFunctions="true"
122122
OmitFramePointers="true"
123123
AdditionalIncludeDirectories="$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\dictBuilder"
124-
PreprocessorDefinitions="ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE"
124+
PreprocessorDefinitions="ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;NDEBUG;_CONSOLE"
125125
RuntimeLibrary="0"
126126
EnableFunctionLevelLinking="true"
127127
UsePrecompiledHeader="0"
@@ -195,7 +195,7 @@
195195
Name="VCCLCompilerTool"
196196
Optimization="0"
197197
AdditionalIncludeDirectories="$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\dictBuilder"
198-
PreprocessorDefinitions="ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE"
198+
PreprocessorDefinitions="ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;_DEBUG;_CONSOLE"
199199
MinimalRebuild="true"
200200
BasicRuntimeChecks="3"
201201
RuntimeLibrary="3"
@@ -272,7 +272,7 @@
272272
EnableIntrinsicFunctions="true"
273273
OmitFramePointers="true"
274274
AdditionalIncludeDirectories="$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\programs\legacy;$(SolutionDir)..\..\lib\dictBuilder"
275-
PreprocessorDefinitions="ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE"
275+
PreprocessorDefinitions="ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;NDEBUG;_CONSOLE"
276276
RuntimeLibrary="0"
277277
EnableFunctionLevelLinking="true"
278278
UsePrecompiledHeader="0"

build/VS2010/libzstd-dll/libzstd-dll.vcxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
</PrecompiledHeader>
170170
<WarningLevel>Level4</WarningLevel>
171171
<Optimization>Disabled</Optimization>
172-
<PreprocessorDefinitions>ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
172+
<PreprocessorDefinitions>ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
173173
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
174174
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
175175
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
@@ -188,7 +188,7 @@
188188
</PrecompiledHeader>
189189
<WarningLevel>Level4</WarningLevel>
190190
<Optimization>Disabled</Optimization>
191-
<PreprocessorDefinitions>ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
191+
<PreprocessorDefinitions>ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
192192
<TreatWarningAsError>true</TreatWarningAsError>
193193
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
194194
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@@ -208,7 +208,7 @@
208208
<Optimization>MaxSpeed</Optimization>
209209
<FunctionLevelLinking>true</FunctionLevelLinking>
210210
<IntrinsicFunctions>true</IntrinsicFunctions>
211-
<PreprocessorDefinitions>ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
211+
<PreprocessorDefinitions>ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
212212
<EnablePREfast>false</EnablePREfast>
213213
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
214214
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
@@ -229,7 +229,7 @@
229229
<Optimization>MaxSpeed</Optimization>
230230
<FunctionLevelLinking>true</FunctionLevelLinking>
231231
<IntrinsicFunctions>true</IntrinsicFunctions>
232-
<PreprocessorDefinitions>ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
232+
<PreprocessorDefinitions>ZSTD_DLL_EXPORT=1;ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
233233
<TreatWarningAsError>false</TreatWarningAsError>
234234
<EnablePREfast>false</EnablePREfast>
235235
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>

build/VS2010/libzstd/libzstd.vcxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
</PrecompiledHeader>
163163
<WarningLevel>Level4</WarningLevel>
164164
<Optimization>Disabled</Optimization>
165-
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
165+
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
166166
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
167167
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
168168
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
@@ -181,7 +181,7 @@
181181
</PrecompiledHeader>
182182
<WarningLevel>Level4</WarningLevel>
183183
<Optimization>Disabled</Optimization>
184-
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
184+
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
185185
<TreatWarningAsError>true</TreatWarningAsError>
186186
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
187187
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@@ -201,7 +201,7 @@
201201
<Optimization>MaxSpeed</Optimization>
202202
<FunctionLevelLinking>true</FunctionLevelLinking>
203203
<IntrinsicFunctions>true</IntrinsicFunctions>
204-
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
204+
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
205205
<EnablePREfast>false</EnablePREfast>
206206
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
207207
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
@@ -222,7 +222,7 @@
222222
<Optimization>MaxSpeed</Optimization>
223223
<FunctionLevelLinking>true</FunctionLevelLinking>
224224
<IntrinsicFunctions>true</IntrinsicFunctions>
225-
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
225+
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
226226
<TreatWarningAsError>false</TreatWarningAsError>
227227
<EnablePREfast>false</EnablePREfast>
228228
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>

build/VS2010/zstd/zstd.vcxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
</PrecompiledHeader>
188188
<WarningLevel>Level4</WarningLevel>
189189
<Optimization>Disabled</Optimization>
190-
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
190+
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
191191
<TreatWarningAsError>true</TreatWarningAsError>
192192
<EnablePREfast>false</EnablePREfast>
193193
<EnableEnhancedInstructionSet>$(InstructionSet)</EnableEnhancedInstructionSet>
@@ -204,7 +204,7 @@
204204
</PrecompiledHeader>
205205
<WarningLevel>Level4</WarningLevel>
206206
<Optimization>Disabled</Optimization>
207-
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
207+
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
208208
<TreatWarningAsError>true</TreatWarningAsError>
209209
<EnablePREfast>false</EnablePREfast>
210210
<EnableEnhancedInstructionSet>$(InstructionSet)</EnableEnhancedInstructionSet>
@@ -223,7 +223,7 @@
223223
<Optimization>MaxSpeed</Optimization>
224224
<FunctionLevelLinking>true</FunctionLevelLinking>
225225
<IntrinsicFunctions>true</IntrinsicFunctions>
226-
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
226+
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
227227
<EnablePREfast>false</EnablePREfast>
228228
<TreatWarningAsError>false</TreatWarningAsError>
229229
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -245,7 +245,7 @@
245245
<Optimization>MaxSpeed</Optimization>
246246
<FunctionLevelLinking>true</FunctionLevelLinking>
247247
<IntrinsicFunctions>true</IntrinsicFunctions>
248-
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
248+
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
249249
<TreatWarningAsError>false</TreatWarningAsError>
250250
<EnablePREfast>false</EnablePREfast>
251251
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>

build/cmake/CMakeModules/ZstdOptions.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# ZSTD Build Options Configuration
33
# ################################################################
44

5-
# Legacy support configuration
6-
option(ZSTD_LEGACY_SUPPORT "Enable legacy format support" ON)
5+
# Legacy support configuration (disabled by default)
6+
option(ZSTD_LEGACY_SUPPORT "Enable legacy format support" OFF)
77

88
if(ZSTD_LEGACY_SUPPORT)
99
message(STATUS "ZSTD_LEGACY_SUPPORT enabled")

build/meson/meson_options.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
# Read guidelines from https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
1212

13-
option('legacy_level', type: 'integer', min: 0, max: 7, value: 5,
14-
description: 'Support any legacy format: 7 to 1 for v0.7+ to v0.1+')
13+
option('legacy_level', type: 'integer', min: 0, max: 7, value: 0,
14+
description: 'Support legacy format: 0=disabled, 1-7=support v0.1+ to v0.7+')
1515
option('debug_level', type: 'integer', min: 0, max: 9, value: 1,
1616
description: 'Enable run-time debug. See lib/common/debug.h')
1717
option('backtrace', type: 'feature', value: 'disabled',

lib/BUCK

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ cxx_library(
5757
srcs=glob(['legacy/*.c']),
5858
deps=[':common'],
5959
exported_preprocessor_flags=[
60-
'-DZSTD_LEGACY_SUPPORT=4',
60+
'-DZSTD_LEGACY_SUPPORT=0',
6161
],
6262
)
6363

lib/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ including commands variables, staged install, directory variables and standard t
1212
- `make` : generates both static and dynamic libraries
1313
- `make install` : install libraries, headers and pkg-config in local system directories
1414

15-
`libzstd` default scope is extensive, including compression, decompression, dictionary builder,
16-
and support for decoding legacy formats >= v0.5.0 by default.
15+
`libzstd` default scope includes compression, decompression, and dictionary builder.
16+
Note: starting v1.6.0, support for decoding legacy formats is disabled by default.
17+
See _modular build_ below to learn how to enable it.
1718
The scope can be reduced on demand (see paragraph _modular build_).
1819

1920
#### Multiarch Support
@@ -99,7 +100,7 @@ The file structure is designed to make this selection manually achievable for an
99100
Specifying a number limits versions supported to that version onward.
100101
For example, `ZSTD_LEGACY_SUPPORT=2` means : "support legacy formats >= v0.2.0".
101102
Conversely, `ZSTD_LEGACY_SUPPORT=0` means "do __not__ support legacy formats".
102-
By default, this build macro is set as `ZSTD_LEGACY_SUPPORT=5`.
103+
By default, this build macro is set as `ZSTD_LEGACY_SUPPORT=0` (disabled).
103104
Decoding supported legacy format is a transparent capability triggered within decompression functions.
104105
It's also allowed to invoke legacy API directly, exposed in `lib/legacy/zstd_legacy.h`.
105106
Each version does also provide its own set of advanced API.

0 commit comments

Comments
 (0)