From kwrobot at kitware.com Tue Jul 1 00:01:12 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 1 Jul 2014 00:01:12 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1271-g949715f Message-ID: <20140701040112.DBF692CC58@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 949715f027f738cb3558b69f5288f7655945ea80 (commit) from 1a575a91d22d5ae5f3b8f73ad67f478ece3f9565 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=949715f027f738cb3558b69f5288f7655945ea80 commit 949715f027f738cb3558b69f5288f7655945ea80 Author: Kitware Robot AuthorDate: Tue Jul 1 00:01:07 2014 -0400 Commit: Kitware Robot CommitDate: Tue Jul 1 00:01:07 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b074230..f5e0bc1 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140630) +set(CMake_VERSION_PATCH 20140701) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From eike at sf-mail.de Tue Jul 1 01:55:38 2014 From: eike at sf-mail.de (Rolf Eike Beer) Date: Tue, 1 Jul 2014 01:55:38 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4028-g4c5d48a Message-ID: <20140701055538.62B2B2C566@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 4c5d48a66f93d79cb3866eb19b72a06346d64ed0 (commit) via 9d9cd12afae57560cdfa81dbd97ae41f4d73c957 (commit) from 724348323c1b882f127d90df0714faedc6461804 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4c5d48a66f93d79cb3866eb19b72a06346d64ed0 commit 4c5d48a66f93d79cb3866eb19b72a06346d64ed0 Merge: 7243483 9d9cd12 Author: Rolf Eike Beer AuthorDate: Tue Jul 1 01:55:37 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 1 01:55:37 2014 -0400 Merge topic 'FindVTK-drop-4.0-support' into next 9d9cd12a FindVTK: unset temporary variables http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9d9cd12afae57560cdfa81dbd97ae41f4d73c957 commit 9d9cd12afae57560cdfa81dbd97ae41f4d73c957 Author: Rolf Eike Beer AuthorDate: Tue Jul 1 07:55:23 2014 +0200 Commit: Rolf Eike Beer CommitDate: Tue Jul 1 07:55:23 2014 +0200 FindVTK: unset temporary variables diff --git a/Modules/FindVTK.cmake b/Modules/FindVTK.cmake index f61b70c..60f48dd 100644 --- a/Modules/FindVTK.cmake +++ b/Modules/FindVTK.cmake @@ -56,6 +56,8 @@ if(NOT VTK_FOUND) set(_VTK_QUIET QUIET) endif() find_package(VTK ${_VTK_REQUIRED} ${_VTK_QUIET} NO_MODULE) + unset(_VTK_REQUIRED) + unset(_VTK_QUIET) endif() if(VTK_FOUND) ----------------------------------------------------------------------- Summary of changes: Modules/FindVTK.cmake | 2 ++ 1 file changed, 2 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 1 08:36:52 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 1 Jul 2014 08:36:52 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4030-g76ace1c Message-ID: <20140701123652.508C72E0CA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 76ace1c96f1112d54d3de915296b7c47b659df54 (commit) via 18ac6713e8657cca8fc791bcd581a47a7be6ebce (commit) from 4c5d48a66f93d79cb3866eb19b72a06346d64ed0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=76ace1c96f1112d54d3de915296b7c47b659df54 commit 76ace1c96f1112d54d3de915296b7c47b659df54 Merge: 4c5d48a 18ac671 Author: Brad King AuthorDate: Tue Jul 1 08:36:51 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 1 08:36:51 2014 -0400 Merge topic 'FindJNI-ppc64le' into next 18ac6713 FindJNI: search for ppc64 on ppc64le as well http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=18ac6713e8657cca8fc791bcd581a47a7be6ebce commit 18ac6713e8657cca8fc791bcd581a47a7be6ebce Author: Dinar Valeev AuthorDate: Mon Jun 30 18:29:20 2014 +0200 Commit: Dinar Valeev CommitDate: Tue Jul 1 12:07:37 2014 +0200 FindJNI: search for ppc64 on ppc64le as well IcedTea 2.5 have changed libarch for ppc64le to ppc64. Adjust FindJNI to look for both for backward compatibility. Signed-off-by: Dinar Valeev diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index 6a496af..3dcb0d0 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -55,7 +55,7 @@ macro(java_append_library_directories _var) # endianess of the underlying system. set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le") - set(_java_libarch "ppc64le") + set(_java_libarch "ppc64" "ppc64le") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") set(_java_libarch "ppc64" "ppc") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") ----------------------------------------------------------------------- Summary of changes: Modules/FindJNI.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From clinton at elemtech.com Tue Jul 1 08:40:06 2014 From: clinton at elemtech.com (Clinton Stimpson) Date: Tue, 1 Jul 2014 08:40:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4033-gf547928 Message-ID: <20140701124006.B71FD2CA11@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f54792849a4d32c124e8a231af42873e9700cea1 (commit) via 9571214e55cb8b86dadb26b6b1d696ef488bdd4b (commit) via 949715f027f738cb3558b69f5288f7655945ea80 (commit) from 76ace1c96f1112d54d3de915296b7c47b659df54 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f54792849a4d32c124e8a231af42873e9700cea1 commit f54792849a4d32c124e8a231af42873e9700cea1 Merge: 76ace1c 9571214 Author: Clinton Stimpson AuthorDate: Tue Jul 1 08:40:06 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 1 08:40:06 2014 -0400 Merge topic 'encoding-bugs' into next 9571214e Encoding: Replace some system calls with kwsys calls which handle unicode. 949715f0 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9571214e55cb8b86dadb26b6b1d696ef488bdd4b commit 9571214e55cb8b86dadb26b6b1d696ef488bdd4b Author: Clinton Stimpson AuthorDate: Tue Jul 1 06:37:21 2014 -0600 Commit: Clinton Stimpson CommitDate: Tue Jul 1 06:38:35 2014 -0600 Encoding: Replace some system calls with kwsys calls which handle unicode. diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 61c6eb3..e47365a 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3172,15 +3172,7 @@ cmFileCommand::HandleUploadCommand(std::vector const& args) return false; } - struct stat st; - if(::stat(filename.c_str(), &st)) - { - std::string errStr = "UPLOAD cannot stat file '"; - errStr += filename + "'."; - this->SetError(errStr); - fclose(fin); - return false; - } + unsigned long file_size = cmsys::SystemTools::FileLength(filename.c_str()); ::CURL *curl; ::curl_global_init(CURL_GLOBAL_DEFAULT); @@ -3270,7 +3262,7 @@ cmFileCommand::HandleUploadCommand(std::vector const& args) // and give the size of the upload (optional) res = ::curl_easy_setopt(curl, - CURLOPT_INFILESIZE, static_cast(st.st_size)); + CURLOPT_INFILESIZE, static_cast(file_size)); check_curl_result(res, "UPLOAD cannot set input file size: "); res = ::curl_easy_perform(curl); diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index ac26503..6fd6ab7 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -33,15 +33,13 @@ std::string cmTimestamp::CurrentTime( std::string cmTimestamp::FileModificationTime(const char* path, const std::string& formatString, bool utcFlag) { - struct stat info; - memset(&info, 0, sizeof(info)); - - if(stat(path, &info) != 0) + if(!cmsys::SystemTools::FileExists(path)) { return std::string(); } - return CreateTimestampFromTimeT(info.st_mtime, formatString, utcFlag); + time_t mtime = cmsys::SystemTools::ModifiedTime(path); + return CreateTimestampFromTimeT(mtime, formatString, utcFlag); } //---------------------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- Source/cmFileCommand.cxx | 12 ++---------- Source/cmTimestamp.cxx | 8 +++----- 3 files changed, 6 insertions(+), 16 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 1 08:41:10 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 1 Jul 2014 08:41:10 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4035-g1d09e3f Message-ID: <20140701124110.0A3752CC11@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 1d09e3f54f388bf9f228c9b4b8f3cfc581f5f8c2 (commit) via 117e7e1177a0ec49afaa4af65b71f413c810e177 (commit) from f54792849a4d32c124e8a231af42873e9700cea1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1d09e3f54f388bf9f228c9b4b8f3cfc581f5f8c2 commit 1d09e3f54f388bf9f228c9b4b8f3cfc581f5f8c2 Merge: f547928 117e7e1 Author: Brad King AuthorDate: Tue Jul 1 08:41:09 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 1 08:41:09 2014 -0400 Merge topic 'FindVTK-drop-4.0-support' into next 117e7e11 FindVTK: Drop support for finding VTK 4.0 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=117e7e1177a0ec49afaa4af65b71f413c810e177 commit 117e7e1177a0ec49afaa4af65b71f413c810e177 Author: Brad King AuthorDate: Fri Jun 27 10:35:35 2014 -0400 Commit: Brad King CommitDate: Tue Jul 1 08:41:52 2014 -0400 FindVTK: Drop support for finding VTK 4.0 Convert to a simple thin-wrapper around the find_package(VTK NO_MODULE). This makes the code much simpler and improves error messages. diff --git a/Help/release/dev/FindVTK.rst b/Help/release/dev/FindVTK.rst new file mode 100644 index 0000000..1cc9fc4 --- /dev/null +++ b/Help/release/dev/FindVTK.rst @@ -0,0 +1,6 @@ +FindVTK +------- + +* The :module:`FindVTK` module dropped support for finding VTK 4.0. + It is now a thin-wrapper around ``find_package(VTK ... NO_MODULE)``. + This produces much clearer error messages when VTK is not found. diff --git a/Modules/FindVTK.cmake b/Modules/FindVTK.cmake index bcc7f87..60f48dd 100644 --- a/Modules/FindVTK.cmake +++ b/Modules/FindVTK.cmake @@ -10,18 +10,6 @@ # :: # # VTK_FOUND - Set to true when VTK is found. -# VTK_USE_FILE - CMake file to use VTK. -# VTK_MAJOR_VERSION - The VTK major version number. -# VTK_MINOR_VERSION - The VTK minor version number -# (odd non-release). -# VTK_BUILD_VERSION - The VTK patch level -# (meaningless for odd minor). -# VTK_INCLUDE_DIRS - Include directories for VTK -# VTK_LIBRARY_DIRS - Link directories for VTK libraries -# VTK_KITS - List of VTK kits, in CAPS -# (COMMON,IO,) etc. -# VTK_LANGUAGES - List of wrapped languages, in CAPS -# (TCL, PYHTON,) etc. # # The following cache entries must be set by the user to locate VTK: # @@ -43,7 +31,7 @@ # instead. #============================================================================= -# Copyright 2001-2009 Kitware, Inc. +# Copyright 2001-2014 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -55,102 +43,24 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -# Assume not found. -set(VTK_FOUND 0) - -# VTK 4.0 did not provide VTKConfig.cmake. -if("${VTK_FIND_VERSION}" VERSION_LESS 4.1) - set(_VTK_40_ALLOW 1) - if(VTK_FIND_VERSION) - set(_VTK_40_ONLY 1) - endif() -endif() - -# Construct consistent error messages for use below. -set(VTK_DIR_DESCRIPTION "directory containing VTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/vtk for an installation.") -if(_VTK_40_ALLOW) - set(VTK_DIR_DESCRIPTION "${VTK_DIR_DESCRIPTION} For VTK 4.0, this is the location of UseVTK.cmake. This is either the root of the build tree or PREFIX/include/vtk for an installation.") -endif() -set(VTK_DIR_MESSAGE "VTK not found. Set the VTK_DIR cmake cache entry to the ${VTK_DIR_DESCRIPTION}") - -# Check whether VTK 4.0 has already been found. -if(_VTK_40_ALLOW AND VTK_DIR) - if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake) - set(VTK_FOUND 1) - include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings. - endif() -endif() - # Use the Config mode of the find_package() command to find VTKConfig. # If this succeeds (possibly because VTK_DIR is already set), the # command will have already loaded VTKConfig.cmake and set VTK_FOUND. -if(NOT _VTK_40_ONLY AND NOT VTK_FOUND) - find_package(VTK QUIET NO_MODULE) -endif() - -# Special search for VTK 4.0. -if(_VTK_40_ALLOW AND NOT VTK_DIR) - # Old scripts may set these directories in the CMakeCache.txt file. - # They can tell us where to find VTKConfig.cmake. - set(VTK_DIR_SEARCH_LEGACY "") - if(VTK_BINARY_PATH AND USE_BUILT_VTK) - set(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} ${VTK_BINARY_PATH}) - endif() - if(VTK_INSTALL_PATH AND USE_INSTALLED_VTK) - set(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} - ${VTK_INSTALL_PATH}/lib/vtk) +if(NOT VTK_FOUND) + set(_VTK_REQUIRED "") + if(VTK_FIND_REQUIRED) + set(_VTK_REQUIRED REQUIRED) endif() - - # Look for UseVTK.cmake in build trees or under /include/vtk. - find_path(VTK_DIR - NAMES UseVTK.cmake - PATH_SUFFIXES vtk-4.0 vtk - HINTS ENV VTK_DIR - - PATHS - - # Support legacy cache files. - ${VTK_DIR_SEARCH_LEGACY} - - # Read from the CMakeSetup registry entries. It is likely that - # VTK will have been recently built. - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10] - - # Help the user find it if we cannot. - DOC "The ${VTK_DIR_DESCRIPTION}" - ) - - if(VTK_DIR) - if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake) - set(VTK_FOUND 1) - include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings. - else() - # We found the wrong version. Pretend we did not find it. - set(VTK_DIR "VTK_DIR-NOTFOUND" CACHE PATH "The ${VTK_DIR_DESCRIPTION}" FORCE) - endif() + set(_VTK_QUIET "") + if(VTK_FIND_QUIETLY) + set(_VTK_QUIET QUIET) endif() + find_package(VTK ${_VTK_REQUIRED} ${_VTK_QUIET} NO_MODULE) + unset(_VTK_REQUIRED) + unset(_VTK_QUIET) endif() -#----------------------------------------------------------------------------- if(VTK_FOUND) # Set USE_VTK_FILE for backward-compatibility. set(USE_VTK_FILE ${VTK_USE_FILE}) -else() - # VTK not found, explain to the user how to specify its location. - if(VTK_FIND_REQUIRED) - message(FATAL_ERROR ${VTK_DIR_MESSAGE}) - else() - if(NOT VTK_FIND_QUIETLY) - message(STATUS ${VTK_DIR_MESSAGE}) - endif() - endif() endif() ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 1 09:23:16 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 1 Jul 2014 09:23:16 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1273-g31ec558 Message-ID: <20140701132316.EAA902DB9F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 31ec558be1b58f63d055d13a63c31ac874c6ea9c (commit) via 117e7e1177a0ec49afaa4af65b71f413c810e177 (commit) from 949715f027f738cb3558b69f5288f7655945ea80 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=31ec558be1b58f63d055d13a63c31ac874c6ea9c commit 31ec558be1b58f63d055d13a63c31ac874c6ea9c Merge: 949715f 117e7e1 Author: Brad King AuthorDate: Tue Jul 1 09:23:15 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 1 09:23:15 2014 -0400 Merge topic 'FindVTK-drop-4.0-support' 117e7e11 FindVTK: Drop support for finding VTK 4.0 ----------------------------------------------------------------------- Summary of changes: Help/release/dev/FindVTK.rst | 6 +++ Modules/FindVTK.cmake | 112 +++++------------------------------------- 2 files changed, 17 insertions(+), 101 deletions(-) create mode 100644 Help/release/dev/FindVTK.rst hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 1 09:23:18 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 1 Jul 2014 09:23:18 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1275-g9750a55 Message-ID: <20140701132318.A0DBA2DBA5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 9750a5581dde5192f3cc59edb849a01bd6351a49 (commit) via 32bcec5fab8a92590bfc2efafe29f2403bbab4dd (commit) from 31ec558be1b58f63d055d13a63c31ac874c6ea9c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9750a5581dde5192f3cc59edb849a01bd6351a49 commit 9750a5581dde5192f3cc59edb849a01bd6351a49 Merge: 31ec558 32bcec5 Author: Brad King AuthorDate: Tue Jul 1 09:23:17 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 1 09:23:17 2014 -0400 Merge topic 'cuda_osx_clang' 32bcec5f FindCUDA: Fix OSX Clang & no C language enabled ----------------------------------------------------------------------- Summary of changes: Modules/FindCUDA.cmake | 14 ++++++++++++-- Modules/FindCUDA/run_nvcc.cmake | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 1 09:23:20 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 1 Jul 2014 09:23:20 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1279-ge4767a2 Message-ID: <20140701132320.558872DBA4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via e4767a2b6dd8787b69a66abd5ca1c6e2eb69543b (commit) via 93371ed592b85ccc179845dbd6e6018ca2193659 (commit) via 7243c95129fd8cd0d01495d33848663c796f91db (commit) via a33cf6d08853ea4c79324bdd36c04f311a23f20a (commit) from 9750a5581dde5192f3cc59edb849a01bd6351a49 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e4767a2b6dd8787b69a66abd5ca1c6e2eb69543b commit e4767a2b6dd8787b69a66abd5ca1c6e2eb69543b Merge: 9750a55 93371ed Author: Brad King AuthorDate: Tue Jul 1 09:23:19 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 1 09:23:19 2014 -0400 Merge topic 'ninja-no-phony-sources' 93371ed5 Ninja: Skip generating empty phony rules 7243c951 Ninja: Don't limit custom cmd side-effects to build folder (#14972) a33cf6d0 Ninja: Consider only custom commands deps as side-effects (#14972) ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalNinjaGenerator.cxx | 44 +++++++++++++++---------------------- Source/cmGlobalNinjaGenerator.h | 9 ++++---- Source/cmNinjaTargetGenerator.cxx | 32 ++++++++++++++++----------- Source/cmNinjaTargetGenerator.h | 3 ++- 4 files changed, 44 insertions(+), 44 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 1 09:23:22 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 1 Jul 2014 09:23:22 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1284-g623123a Message-ID: <20140701132322.047932DBAD@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 623123aaa0dce491c3d2a365912ef8c443c8d553 (commit) via 9998d78d630dec9532a40d4423e4deabcd3252b2 (commit) via 6eee5d7449fd92d4dcb5ba06e0f38c87d00f9065 (commit) via f0f15b93bd98cf95d61b5a110a9e2cb5e9ea0f57 (commit) via 8707814e788e07f92c776a922af57f525e77452c (commit) from e4767a2b6dd8787b69a66abd5ca1c6e2eb69543b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=623123aaa0dce491c3d2a365912ef8c443c8d553 commit 623123aaa0dce491c3d2a365912ef8c443c8d553 Merge: e4767a2 9998d78 Author: Brad King AuthorDate: Tue Jul 1 09:23:21 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 1 09:23:21 2014 -0400 Merge topic 'test-speedup-RunCMake.include_directories' 9998d78d Tests: Speed up RunCMake.include_directories test 6eee5d74 Tests: Drop broken and now unused RunCMake_TEST_FILE option f0f15b93 Tests: Refactor RunCMake.include_directories to drop RunCMake_TEST_FILE 8707814e Tests: Refactor RunCMake.File_Generate to drop RunCMake_TEST_FILE ----------------------------------------------------------------------- Summary of changes: Tests/RunCMake/File_Generate/CMakeLists.txt | 5 ++- .../File_Generate/EmptyCondition1-stderr.txt | 2 +- .../File_Generate/EmptyCondition2-stderr.txt | 2 +- Tests/RunCMake/File_Generate/RunCMakeTest.cmake | 4 +- Tests/RunCMake/RunCMake.cmake | 5 +-- .../BinaryDirectoryInInterface.cmake | 2 +- Tests/RunCMake/include_directories/CMakeLists.txt | 7 +++- .../include_directories/DebugIncludes-stderr.txt | 12 +++--- .../include_directories/DebugIncludes.cmake | 2 +- .../include_directories/DirInInstallPrefix.cmake | 2 +- .../include_directories/ImportedTarget.cmake | 2 +- .../InstallPrefixInInterface.cmake | 2 +- .../include_directories/RelativePathInGenex.cmake | 2 +- .../RelativePathInInterface.cmake | 2 +- .../include_directories/RunCMakeTest.cmake | 40 ++++++++++++-------- .../SourceDirectoryInInterface.cmake | 2 +- .../include_directories/TID-bad-target-stderr.txt | 2 +- .../include_directories/export-NOWARN.cmake | 2 +- .../include_directories/incomplete-genex.cmake | 2 +- 19 files changed, 55 insertions(+), 44 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 1 09:24:08 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 1 Jul 2014 09:24:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4040-g679d78b Message-ID: <20140701132408.BCD002DB9E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 679d78b5407a56268cb85cad9812d051f5fd4dc1 (commit) via 623123aaa0dce491c3d2a365912ef8c443c8d553 (commit) via e4767a2b6dd8787b69a66abd5ca1c6e2eb69543b (commit) via 9750a5581dde5192f3cc59edb849a01bd6351a49 (commit) via 31ec558be1b58f63d055d13a63c31ac874c6ea9c (commit) from 1d09e3f54f388bf9f228c9b4b8f3cfc581f5f8c2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=679d78b5407a56268cb85cad9812d051f5fd4dc1 commit 679d78b5407a56268cb85cad9812d051f5fd4dc1 Merge: 1d09e3f 623123a Author: Brad King AuthorDate: Tue Jul 1 09:25:16 2014 -0400 Commit: Brad King CommitDate: Tue Jul 1 09:25:16 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 1 10:17:09 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 1 Jul 2014 10:17:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4042-gec1a6fd Message-ID: <20140701141709.91F062DAC9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ec1a6fdf6567f8c6d365787fa6c36691b666e616 (commit) via ac8879ce91a61703c9c3fc1e06316dbe8d5a8786 (commit) from 679d78b5407a56268cb85cad9812d051f5fd4dc1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ec1a6fdf6567f8c6d365787fa6c36691b666e616 commit ec1a6fdf6567f8c6d365787fa6c36691b666e616 Merge: 679d78b ac8879c Author: Brad King AuthorDate: Tue Jul 1 10:17:08 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 1 10:17:08 2014 -0400 Merge topic 'ninja-link-order-only-dependencies' into next ac8879ce Ninja: Add order-only dependencies to link commands (#14728) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ac8879ce91a61703c9c3fc1e06316dbe8d5a8786 commit ac8879ce91a61703c9c3fc1e06316dbe8d5a8786 Author: Ben Boeckel AuthorDate: Tue Jul 1 10:14:27 2014 -0400 Commit: Brad King CommitDate: Tue Jul 1 10:14:28 2014 -0400 Ninja: Add order-only dependencies to link commands (#14728) A library or executable target that consists only of a reference to an object library may have no sources to compile or custom commands to run. The command in the target is the link (or archive) command. Add missing order-only dependencies to link commands so that target ordering dependencies are satisfied for it without depending on an intermediate compilation rule. Extend the ObjectLibrary test to cover this case. Co-Author: Brad King diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index cfcf9f4..15a1b32 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -608,6 +608,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() std::string(cmake::GetCMakeFilesDirectoryPostSlash()) + target.GetName() + ".rsp"; + // Gather order-only dependencies. + cmNinjaDeps orderOnlyDeps; + this->GetLocalGenerator()->AppendTargetDepends(this->GetTarget(), + orderOnlyDeps); + // Write the build statement for this target. globalGen.WriteBuild(this->GetBuildFileStream(), comment.str(), @@ -615,7 +620,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() outputs, explicitDeps, implicitDeps, - emptyDeps, + orderOnlyDeps, vars, rspfile, commandLineLengthLimit); diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt index 0aeefaa..75c34d8 100644 --- a/Tests/ObjectLibrary/CMakeLists.txt +++ b/Tests/ObjectLibrary/CMakeLists.txt @@ -59,4 +59,10 @@ add_executable(UseABinternal ${dummy} $ $ $ ) +# Test target-level dependencies of executable without sources. +file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/UseABinternalDep.cmake) +add_custom_target(UseABinternalDep COMMAND ${CMAKE_COMMAND} -E touch UseABinternalDep.cmake) +add_custom_command(TARGET UseABinternal POST_BUILD COMMAND ${CMAKE_COMMAND} -P UseABinternalDep.cmake) +add_dependencies(UseABinternal UseABinternalDep) + add_subdirectory(ExportLanguages) ----------------------------------------------------------------------- Summary of changes: Source/cmNinjaNormalTargetGenerator.cxx | 7 ++++++- Tests/ObjectLibrary/CMakeLists.txt | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 1 10:23:56 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 1 Jul 2014 10:23:56 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4044-ge06be31 Message-ID: <20140701142356.254AA2E14D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via e06be31bb496b997cecc2eb60a415231036b1845 (commit) via 902c90636e1942c12a19f880239267fb30fd7367 (commit) from ec1a6fdf6567f8c6d365787fa6c36691b666e616 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e06be31bb496b997cecc2eb60a415231036b1845 commit e06be31bb496b997cecc2eb60a415231036b1845 Merge: ec1a6fd 902c906 Author: Brad King AuthorDate: Tue Jul 1 10:23:55 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 1 10:23:55 2014 -0400 Merge topic 'tests-add_test-NAME' into next 902c9063 Tests: Use add_test(NAME) signature in add_test_macro http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=902c90636e1942c12a19f880239267fb30fd7367 commit 902c90636e1942c12a19f880239267fb30fd7367 Author: Ben Boeckel AuthorDate: Tue Jul 1 10:24:47 2014 -0400 Commit: Brad King CommitDate: Tue Jul 1 10:24:48 2014 -0400 Tests: Use add_test(NAME) signature in add_test_macro This will allow generator expressions to be used in test arguments. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index cf7bd75..cb455e0 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -3,7 +3,7 @@ macro(ADD_TEST_MACRO NAME COMMAND) string(REPLACE "." "/" dir "${NAME}") string(REGEX REPLACE "[^.]*\\." "" proj "${NAME}") - add_test(${NAME} ${CMAKE_CTEST_COMMAND} + add_test(NAME "${NAME}" COMMAND "${CMAKE_CTEST_COMMAND}" --build-and-test "${CMake_SOURCE_DIR}/Tests/${dir}" "${CMake_BINARY_DIR}/Tests/${dir}" ----------------------------------------------------------------------- Summary of changes: Tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From eike at sf-mail.de Tue Jul 1 16:16:46 2014 From: eike at sf-mail.de (Rolf Eike Beer) Date: Tue, 1 Jul 2014 16:16:46 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4046-gbff2b31 Message-ID: <20140701201646.43F0E2E1DF@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via bff2b3192d74473ff00a497a9ba656a62ecb5398 (commit) via 5217ad26a6897cb6d74d91ef8be3fd58f71705ea (commit) from e06be31bb496b997cecc2eb60a415231036b1845 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bff2b3192d74473ff00a497a9ba656a62ecb5398 commit bff2b3192d74473ff00a497a9ba656a62ecb5398 Merge: e06be31 5217ad2 Author: Rolf Eike Beer AuthorDate: Tue Jul 1 16:16:45 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 1 16:16:45 2014 -0400 Merge topic 'memcheck-test-no-lang' into next 5217ad26 CTestTestMemcheck: do not search for compilers http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5217ad26a6897cb6d74d91ef8be3fd58f71705ea commit 5217ad26a6897cb6d74d91ef8be3fd58f71705ea Author: Rolf Eike Beer AuthorDate: Tue Jul 1 22:14:51 2014 +0200 Commit: Rolf Eike Beer CommitDate: Tue Jul 1 22:14:51 2014 +0200 CTestTestMemcheck: do not search for compilers diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt.in b/Tests/CTestTestMemcheck/CMakeLists.txt.in index e28e56a..d15d148 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt.in +++ b/Tests/CTestTestMemcheck/CMakeLists.txt.in @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 2.8.9) -project(CTestTestMemcheck at SUBTEST_NAME@) +project(CTestTestMemcheck at SUBTEST_NAME@ NONE) include(CTest) add_test(NAME RunCMake COMMAND "${CMAKE_COMMAND}" --version) ----------------------------------------------------------------------- Summary of changes: Tests/CTestTestMemcheck/CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From eike at sf-mail.de Tue Jul 1 16:31:35 2014 From: eike at sf-mail.de (Rolf Eike Beer) Date: Tue, 1 Jul 2014 16:31:35 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4048-gc920002 Message-ID: <20140701203135.0A1BD2EFA7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via c920002c6991ea1264011d4acf84e84130e36a68 (commit) via 7269e69ffa9a77bccd7eec9435463d85c0762493 (commit) from bff2b3192d74473ff00a497a9ba656a62ecb5398 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c920002c6991ea1264011d4acf84e84130e36a68 commit c920002c6991ea1264011d4acf84e84130e36a68 Merge: bff2b31 7269e69 Author: Rolf Eike Beer AuthorDate: Tue Jul 1 16:31:34 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 1 16:31:34 2014 -0400 Merge topic 'ExternalProject_test' into next 7269e69f ExternalProject test: remove unused file http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7269e69ffa9a77bccd7eec9435463d85c0762493 commit 7269e69ffa9a77bccd7eec9435463d85c0762493 Author: Rolf Eike Beer AuthorDate: Tue Jul 1 22:30:33 2014 +0200 Commit: Rolf Eike Beer CommitDate: Tue Jul 1 22:30:33 2014 +0200 ExternalProject test: remove unused file diff --git a/Tests/ExternalProject/TryCheckout.cmake b/Tests/ExternalProject/TryCheckout.cmake deleted file mode 100644 index 6a396c3..0000000 --- a/Tests/ExternalProject/TryCheckout.cmake +++ /dev/null @@ -1,54 +0,0 @@ -find_package(CVS) -find_package(Subversion) - - -function(try_cvs_checkout repository module dir result_var) - # Assume cvs checkouts will not work: - set(${result_var} 0 PARENT_SCOPE) - - if(CVS_EXECUTABLE) - message(STATUS "try_cvs_checkout") - - # Ensure directory exists so we can call cvs in it: - file(MAKE_DIRECTORY "${dir}") - - # Try to do the cvs checkout command: - execute_process(COMMAND ${CVS_EXECUTABLE} -d ${repository} co ${module} - WORKING_DIRECTORY ${dir} - TIMEOUT 30 - RESULT_VARIABLE rv) - - # If it worked, cvs checkouts will work: - if(rv EQUAL 0) - set(${result_var} 1 PARENT_SCOPE) - endif() - - message(STATUS "try_cvs_checkout -- done") - endif() -endfunction() - - -function(try_svn_checkout repository dir result_var) - # Assume svn checkouts will not work: - set(${result_var} 0 PARENT_SCOPE) - - if(Subversion_SVN_EXECUTABLE) - message(STATUS "try_svn_checkout") - - # Ensure directory exists so we can call svn in it: - file(MAKE_DIRECTORY "${dir}") - - # Try to do the svn checkout command: - execute_process(COMMAND ${Subversion_SVN_EXECUTABLE} co ${repository} ${dir} - WORKING_DIRECTORY ${dir} - TIMEOUT 30 - RESULT_VARIABLE rv) - - # If it worked, svn checkouts will work: - if(rv EQUAL 0) - set(${result_var} 1 PARENT_SCOPE) - endif() - - message(STATUS "try_svn_checkout -- done") - endif() -endfunction() ----------------------------------------------------------------------- Summary of changes: Tests/ExternalProject/TryCheckout.cmake | 54 ------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 Tests/ExternalProject/TryCheckout.cmake hooks/post-receive -- CMake From steveire at gmail.com Tue Jul 1 17:58:43 2014 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 1 Jul 2014 17:58:43 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4050-g500a267 Message-ID: <20140701215843.D7D1F2EB6B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 500a2674a590d171994bcc4a4ec5ff93e8e95197 (commit) via 75f52e2c5f99dc20b054385c7bf99ce0b823dd9f (commit) from c920002c6991ea1264011d4acf84e84130e36a68 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=500a2674a590d171994bcc4a4ec5ff93e8e95197 commit 500a2674a590d171994bcc4a4ec5ff93e8e95197 Merge: c920002 75f52e2 Author: Stephen Kelly AuthorDate: Tue Jul 1 17:58:43 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 1 17:58:43 2014 -0400 Merge topic 'fix-circular-transitive-properties-segfault' into next 75f52e2c Remove backtrace from linking APIs. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=75f52e2c5f99dc20b054385c7bf99ce0b823dd9f commit 75f52e2c5f99dc20b054385c7bf99ce0b823dd9f Author: Stephen Kelly AuthorDate: Tue Jul 1 23:53:02 2014 +0200 Commit: Stephen Kelly CommitDate: Tue Jul 1 23:57:59 2014 +0200 Remove backtrace from linking APIs. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index c230ac6..b648eb2 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1098,8 +1098,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode std::vector tgts; target->GetTransitivePropertyTargets(context->Config, - headTarget, tgts, - &context->Backtrace); + headTarget, tgts); if (!tgts.empty()) { linkedTargetsContent = diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 8e334ff..d27293a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3730,10 +3730,9 @@ void cmTarget::ExpandLinkItems(std::string const& prop, std::string const& config, cmTarget const* headTarget, bool usage_requirements_only, - std::vector& items, - cmListFileBacktrace *backtrace) const + std::vector& items) const { - cmGeneratorExpression ge(backtrace); + cmGeneratorExpression ge; cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0); if(usage_requirements_only) { @@ -6079,7 +6078,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface( // Imported targets have their own link interface. if(this->IsImported()) { - return this->GetImportLinkInterface(config, head, false, 0); + return this->GetImportLinkInterface(config, head, false); } // Link interfaces are not supported for executables that do not @@ -6101,7 +6100,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface( cmTargetInternals::OptionalLinkInterface iface; iface.ExplicitLibraries = this->ComputeLinkInterfaceLibraries(config, iface, head, false, - iface.Exists, 0); + iface.Exists); if (iface.Exists) { this->Internal->ComputeLinkInterface(this, config, iface, @@ -6125,14 +6124,12 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface( cmTarget::LinkInterface const* cmTarget::GetLinkInterfaceLibraries(const std::string& config, cmTarget const* head, - bool usage_requirements_only, - cmListFileBacktrace *backtrace) const + bool usage_requirements_only) const { // Imported targets have their own link interface. if(this->IsImported()) { - return this->GetImportLinkInterface(config, head, - usage_requirements_only, backtrace); + return this->GetImportLinkInterface(config, head, usage_requirements_only); } // Link interfaces are not supported for executables that do not @@ -6158,7 +6155,7 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config, iface.ExplicitLibraries = this->ComputeLinkInterfaceLibraries(config, iface, head, usage_requirements_only, - iface.Exists, backtrace); + iface.Exists); // Store the information for this configuration. cmTargetInternals::LinkInterfaceMapType::value_type entry(key, iface); @@ -6172,8 +6169,7 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config, cmTarget::LinkInterface const* cmTarget::GetImportLinkInterface(const std::string& config, cmTarget const* headTarget, - bool usage_requirements_only, - cmListFileBacktrace *backtrace) const + bool usage_requirements_only) const { cmTarget::ImportInfo const* info = this->GetImportInfo(config); if(!info) @@ -6195,7 +6191,7 @@ cmTarget::GetImportLinkInterface(const std::string& config, cmSystemTools::ExpandListArgument(info->Languages, iface.Languages); this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config, headTarget, usage_requirements_only, - iface.Libraries, backtrace); + iface.Libraries); { std::vector deps; cmSystemTools::ExpandListArgument(info->SharedDeps, deps); @@ -6220,7 +6216,7 @@ void processILibs(const std::string& config, { tgts.push_back(item.Target); if(cmTarget::LinkInterface const* iface = - item.Target->GetLinkInterfaceLibraries(config, headTarget, false, 0)) + item.Target->GetLinkInterfaceLibraries(config, headTarget, false)) { for(std::vector::const_iterator it = iface->Libraries.begin(); @@ -6258,8 +6254,7 @@ cmTarget::GetLinkImplementationClosure(const std::string& config) const //---------------------------------------------------------------------------- void cmTarget::GetTransitivePropertyTargets(const std::string& config, cmTarget const* headTarget, - std::vector &tgts, - cmListFileBacktrace *backtrace) const + std::vector &tgts) const { // The $ expression may be in a link interface to specify private // link dependencies that are otherwise excluded from usage requirements. @@ -6272,7 +6267,7 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, this->GetPolicyStatusCMP0022() != cmPolicies::OLD; if(cmTarget::LinkInterface const* iface = this->GetLinkInterfaceLibraries(config, headTarget, - usage_requirements_only, backtrace)) + usage_requirements_only)) { for(std::vector::const_iterator it = iface->Libraries.begin(); it != iface->Libraries.end(); ++it) @@ -6287,11 +6282,10 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, //---------------------------------------------------------------------------- const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, - LinkInterface& iface, - cmTarget const* headTarget, - bool usage_requirements_only, - bool &exists, - cmListFileBacktrace *backtrace) const + LinkInterface& iface, + cmTarget const* headTarget, + bool usage_requirements_only, + bool &exists) const { // Construct the property name suffix for this configuration. std::string suffix = "_"; @@ -6377,7 +6371,7 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, // The interface libraries have been explicitly set. this->ExpandLinkItems(linkIfaceProp, explicitLibraries, config, headTarget, usage_requirements_only, - iface.Libraries, backtrace); + iface.Libraries); } else if (this->PolicyStatusCMP0022 == cmPolicies::WARN || this->PolicyStatusCMP0022 == cmPolicies::OLD) @@ -6401,7 +6395,7 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, { this->ExpandLinkItems(newProp, newExplicitLibraries, config, headTarget, usage_requirements_only, - ifaceLibs, backtrace); + ifaceLibs); } if (ifaceLibs != impl->Libraries) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 8b18cb7..9d1f966 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -281,12 +281,10 @@ public: cmTarget const* headTarget) const; LinkInterface const* GetLinkInterfaceLibraries(const std::string& config, cmTarget const* headTarget, - bool usage_requirements_only, - cmListFileBacktrace *backtrace) const; + bool usage_requirements_only) const; void GetTransitivePropertyTargets(const std::string& config, cmTarget const* headTarget, - std::vector &libs, - cmListFileBacktrace *backtrace = 0) const; + std::vector &libs) const; std::vector const& GetLinkImplementationClosure(const std::string& config) const; @@ -760,15 +758,13 @@ private: LinkInterface const* GetImportLinkInterface(const std::string& config, cmTarget const* head, - bool usage_requirements_only, - cmListFileBacktrace *backtrace) const; + bool usage_requirements_only) const; const char* ComputeLinkInterfaceLibraries(const std::string& config, - LinkInterface& iface, - cmTarget const* head, - bool usage_requirements_only, - bool &exists, - cmListFileBacktrace* backtrace) const; + LinkInterface& iface, + cmTarget const* head, + bool usage_requirements_only, + bool &exists) const; LinkImplementation const* GetLinkImplementationLibrariesInternal(const std::string& config, @@ -784,8 +780,7 @@ private: void ExpandLinkItems(std::string const& prop, std::string const& value, std::string const& config, cmTarget const* headTarget, bool usage_requirements_only, - std::vector& items, - cmListFileBacktrace *backtrace) const; + std::vector& items) const; void LookupLinkItems(std::vector const& names, std::vector& items) const; diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-stderr.txt index 3d1da50..5cfeb0a 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-stderr.txt +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at LinkImplementationCycle4.cmake:14 \(target_link_libraries\): +CMake Error: Error evaluating generator expression: \$ @@ -6,5 +6,3 @@ CMake Error at LinkImplementationCycle4.cmake:14 \(target_link_libraries\): \$ expression in link libraries evaluation depends on target property which is transitive over the link libraries, creating a recursion. -Call Stack \(most recent call first\): - CMakeLists.txt:8 \(include\) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-stderr.txt index 28bbc12..5cfeb0a 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-stderr.txt +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at LinkImplementationCycle5.cmake:10 \(target_link_libraries\): +CMake Error: Error evaluating generator expression: \$ @@ -6,5 +6,3 @@ CMake Error at LinkImplementationCycle5.cmake:10 \(target_link_libraries\): \$ expression in link libraries evaluation depends on target property which is transitive over the link libraries, creating a recursion. -Call Stack \(most recent call first\): - CMakeLists.txt:8 \(include\) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-stderr.txt index 1ea624d..5cfeb0a 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-stderr.txt +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at LinkImplementationCycle6.cmake:14 \(target_link_libraries\): +CMake Error: Error evaluating generator expression: \$ @@ -6,5 +6,3 @@ CMake Error at LinkImplementationCycle6.cmake:14 \(target_link_libraries\): \$ expression in link libraries evaluation depends on target property which is transitive over the link libraries, creating a recursion. -Call Stack \(most recent call first\): - CMakeLists.txt:8 \(include\) ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpressionEvaluator.cxx | 3 +- Source/cmTarget.cxx | 42 +++++++++----------- Source/cmTarget.h | 21 ++++------ .../LinkImplementationCycle4-stderr.txt | 4 +- .../LinkImplementationCycle5-stderr.txt | 4 +- .../LinkImplementationCycle6-stderr.txt | 4 +- 6 files changed, 30 insertions(+), 48 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Tue Jul 1 18:11:38 2014 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 1 Jul 2014 18:11:38 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4053-g0440d72 Message-ID: <20140701221139.063532DA61@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 0440d7201686f779a477570b2bcdd8c25d9df7db (commit) via 65aa5442b72aa8dda61088bdc0ffa2aa45965646 (commit) via 61ce6547424821710d0fbebf06b0eb411a630253 (commit) from 500a2674a590d171994bcc4a4ec5ff93e8e95197 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0440d7201686f779a477570b2bcdd8c25d9df7db commit 0440d7201686f779a477570b2bcdd8c25d9df7db Merge: 500a267 65aa544 Author: Stephen Kelly AuthorDate: Tue Jul 1 18:11:37 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 1 18:11:37 2014 -0400 Merge topic 'fix-circular-transitive-properties-segfault' into next 65aa5442 Target: Return null when a transitive property is not defined. 61ce6547 Genex: Fix stack overflow in transitive property evaluation. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65aa5442b72aa8dda61088bdc0ffa2aa45965646 commit 65aa5442b72aa8dda61088bdc0ffa2aa45965646 Author: Stephen Kelly AuthorDate: Sun May 11 14:28:24 2014 +0200 Commit: Stephen Kelly CommitDate: Wed Jul 2 00:10:58 2014 +0200 Target: Return null when a transitive property is not defined. Commit v2.8.11~310^2~1 (Keep track of INCLUDE_DIRECTORIES as a vector of structs., 2012-11-19) added special case of INCLUDE_DIRECTORIES for the purpose of origin-tracking of individual entries in the property. It introduced a bug in that it returned an empty string instead of '0' in the case that no includes have been set. Commit v2.8.11~289^2~2 (Handle INTERFACE properties transitively for includes and defines., 2012-09-23) introduced transitive handling of the property through the link implementation, together with a whitelist of properties which would be evaluated transitively. Because of the bug introduced previously, the 'prop' in TargetPropertyNode is non-null, meaning that the content (the empty string) would be evaluated as a generator expression. This was harmless as the follow-up code was only for 'INTERFACE_' variants of target properties, so the effect was the same. Commits v2.8.11~280^2~2 (Keep track of properties used to determine linker libraries., 2012-11-05) and v2.8.11~280^2~1 (Add API to calculate link-interface-dependent bool properties or error., 2013-01-06) added a way to track and report errors on properties which both determine and are determined by the link implementation. This was later used in generator expression evaluation by commit v2.8.11~252^2~2 (Make INTERFACE determined properties readable in generator expressions., 2013-01-19). If a property is unset (null), and the link implementation of the target was not being evaluated, this commit made it possible to evaluate the property from the link implementation instead. If the link implementation was being evaluated, an empty string was returned from the generator expression evaluation, which might be later reported as an error. The above logic was written for 'compatible interface' properties, but in fact it should have also included other properties. Because of the empty-string-instead-of-null bug, this code block is not entered for the INCLUDE_DIRECTORIES property. At this point, however, the bug still does not significantly affect behavior, because the follow-up code is still a no-op for the INCLUDE_DIRECTORIES property, and an empty string is returned regardless. Commit v2.8.11~189^2~6 (Use the link information as a source of compile definitions and includes., 2013-02-12) refactored the logic, but also without a change in behavior. Commit v2.8.11~156^2~2 (Expand includes and defines transitively in 'external' genexes., 2013-02-13) refactored the logic again, this time with a change of behavior. The INCLUDE_DIRECTORIES property was then mapped to INTERFACE_INCLUDE_DIRECTORIES during transitive generator expression evaluation. Because the transitive evaluation involved evaluation of the link implementation, this introduced a recursive loop and a segfault with code like: add_library(empty1 ...) add_library(empty2 ...) target_link_libraries(empty1 PRIVATE $<$,/foo/bar>:empty2> ) As there is no real use-case for reading a target property like that while evaluating the link implementation, this went unnoticed. The same pattern was followed for other special-cased reads of transitive target properties such as COMPILE_DEFINITIONS. The segfault was fixed in the parent commit, but change the property to return null when appropriate for other future uses. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index aa0ed56..d27293a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3265,6 +3265,11 @@ const char *cmTarget::GetProperty(const std::string& prop, } if(prop == "INCLUDE_DIRECTORIES") { + if (this->Internal->IncludeDirectoriesEntries.empty()) + { + return 0; + } + static std::string output; output = ""; std::string sep; @@ -3283,6 +3288,11 @@ const char *cmTarget::GetProperty(const std::string& prop, } if(prop == "COMPILE_OPTIONS") { + if (this->Internal->CompileOptionsEntries.empty()) + { + return 0; + } + static std::string output; output = ""; std::string sep; @@ -3301,6 +3311,11 @@ const char *cmTarget::GetProperty(const std::string& prop, } if(prop == "COMPILE_FEATURES") { + if (this->Internal->CompileFeaturesEntries.empty()) + { + return 0; + } + static std::string output; output = ""; std::string sep; @@ -3319,6 +3334,11 @@ const char *cmTarget::GetProperty(const std::string& prop, } if(prop == "COMPILE_DEFINITIONS") { + if (this->Internal->CompileDefinitionsEntries.empty()) + { + return 0; + } + static std::string output; output = ""; std::string sep; @@ -3337,6 +3357,11 @@ const char *cmTarget::GetProperty(const std::string& prop, } if(prop == "LINK_LIBRARIES") { + if (this->Internal->LinkImplementationPropertyEntries.empty()) + { + return 0; + } + static std::string output; output = ""; std::string sep; @@ -3359,6 +3384,11 @@ const char *cmTarget::GetProperty(const std::string& prop, if(prop == "SOURCES") { + if (this->Internal->SourceEntries.empty()) + { + return 0; + } + cmOStringStream ss; const char* sep = ""; typedef cmTargetInternals::TargetPropertyEntry http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=61ce6547424821710d0fbebf06b0eb411a630253 commit 61ce6547424821710d0fbebf06b0eb411a630253 Author: Stephen Kelly AuthorDate: Sun May 11 16:04:53 2014 +0200 Commit: Stephen Kelly CommitDate: Wed Jul 2 00:09:38 2014 +0200 Genex: Fix stack overflow in transitive property evaluation. Commit v2.8.11~156^2~2 (Expand includes and defines transitively in 'external' genexes., 2013-02-13) introduced a recursive loop and a stack overflow during evaluation of a link implementation which depends on a transitive property, such as add_library(empty1 ...) add_library(empty2 ...) target_link_libraries(empty1 PRIVATE $<$,/foo/bar>:empty2> ) There is no use-case for code like that currently, but it should not cause a stack overflow. Avoid the recursion by reporting an error early if a case like this is found. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index c925869..b648eb2 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1028,6 +1028,19 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode { if (dagCheckerParent->EvaluatingLinkLibraries()) { +#define TRANSITIVE_PROPERTY_COMPARE(PROPERTY) \ + (#PROPERTY == propertyName || "INTERFACE_" #PROPERTY == propertyName) || + if (CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_COMPARE) + false) + { + reportError(context, content->GetOriginalExpression(), + "$ expression in link libraries " + "evaluation depends on target property which is transitive " + "over the link libraries, creating a recursion."); + return std::string(); + } +#undef TRANSITIVE_PROPERTY_COMPARE + if(!prop) { return std::string(); diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-stderr.txt new file mode 100644 index 0000000..7e002f5 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at LinkImplementationCycle1.cmake:5 \(target_link_libraries\): + Error evaluating generator expression: + + \$ + + \$ expression in link libraries evaluation depends on + target property which is transitive over the link libraries, creating a + recursion. +Call Stack \(most recent call first\): + CMakeLists.txt:8 \(include\) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1.cmake new file mode 100644 index 0000000..4b60214 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1.cmake @@ -0,0 +1,8 @@ + +add_library(empty1 empty.cpp) +add_library(empty2 empty.cpp) + +target_link_libraries(empty1 + LINK_PUBLIC + $<$,/foo/bar>:empty2> +) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-stderr.txt new file mode 100644 index 0000000..2f72de6 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at LinkImplementationCycle2.cmake:5 \(target_link_libraries\): + Error evaluating generator expression: + + \$ + + \$ expression in link libraries evaluation depends on + target property which is transitive over the link libraries, creating a + recursion. +Call Stack \(most recent call first\): + CMakeLists.txt:8 \(include\) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2.cmake new file mode 100644 index 0000000..557eac1 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2.cmake @@ -0,0 +1,8 @@ + +add_library(empty1 empty.cpp) +add_library(empty2 empty.cpp) + +target_link_libraries(empty1 + LINK_PUBLIC + $<$,/foo/bar>:empty2> +) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3.cmake new file mode 100644 index 0000000..0f921d4 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3.cmake @@ -0,0 +1,10 @@ + +add_library(empty1 empty.cpp) +add_library(empty2 empty.cpp) + +# This is OK, because evaluating the INCLUDE_DIRECTORIES is not affected by +# the content of the INTERFACE_LINK_LIBRARIES. +target_link_libraries(empty1 + INTERFACE + $<$,/foo/bar>:empty2> +) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-stderr.txt new file mode 100644 index 0000000..5cfeb0a --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-stderr.txt @@ -0,0 +1,8 @@ +CMake Error: + Error evaluating generator expression: + + \$ + + \$ expression in link libraries evaluation depends on + target property which is transitive over the link libraries, creating a + recursion. diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4.cmake new file mode 100644 index 0000000..ab6d0b2 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4.cmake @@ -0,0 +1,14 @@ + +add_library(empty1 empty.cpp) +add_library(empty2 empty.cpp) + +# The INTERFACE_INCLUDE_DIRECTORIES do not depend on the link interface. +# On its own, this is fine. It is only when used by empty3 that an error +# is appropriately issued. +target_link_libraries(empty1 + INTERFACE + $<$,/foo/bar>:empty2> +) + +add_library(empty3 empty.cpp) +target_link_libraries(empty3 empty1) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-stderr.txt new file mode 100644 index 0000000..5cfeb0a --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-stderr.txt @@ -0,0 +1,8 @@ +CMake Error: + Error evaluating generator expression: + + \$ + + \$ expression in link libraries evaluation depends on + target property which is transitive over the link libraries, creating a + recursion. diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5.cmake new file mode 100644 index 0000000..dc180e3 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5.cmake @@ -0,0 +1,10 @@ + +add_library(empty1 INTERFACE IMPORTED) +add_library(empty2 INTERFACE IMPORTED) + +set_property(TARGET empty1 PROPERTY INTERFACE_LINK_LIBRARIES + $<$,/foo/bar>:empty2> +) + +add_library(empty3 empty.cpp) +target_link_libraries(empty3 empty1) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-stderr.txt new file mode 100644 index 0000000..5cfeb0a --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-stderr.txt @@ -0,0 +1,8 @@ +CMake Error: + Error evaluating generator expression: + + \$ + + \$ expression in link libraries evaluation depends on + target property which is transitive over the link libraries, creating a + recursion. diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6.cmake new file mode 100644 index 0000000..91252d0 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6.cmake @@ -0,0 +1,14 @@ + +add_library(empty1 SHARED empty.cpp) +add_library(empty2 SHARED empty.cpp) + +# The INTERFACE_INCLUDE_DIRECTORIES do not depend on the link interface. +# On its own, this is fine. It is only when used by empty3 that an error +# is appropriately issued. +target_link_libraries(empty1 + INTERFACE + $<$,/foo/bar>:empty2> +) + +add_library(empty3 SHARED empty.cpp) +target_link_libraries(empty3 empty1) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake index 0ee3238..645a57d 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake @@ -15,3 +15,9 @@ run_cmake(BadInvalidName5) run_cmake(BadInvalidName6) run_cmake(BadInvalidName7) run_cmake(BadInvalidName8) +run_cmake(LinkImplementationCycle1) +run_cmake(LinkImplementationCycle2) +run_cmake(LinkImplementationCycle3) +run_cmake(LinkImplementationCycle4) +run_cmake(LinkImplementationCycle5) +run_cmake(LinkImplementationCycle6) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/empty.cpp b/Tests/RunCMake/TargetPropertyGeneratorExpressions/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jul 2 00:01:13 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 2 Jul 2014 00:01:13 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1285-g3597c3b Message-ID: <20140702040113.C93A52EF87@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 3597c3b9869f4339fd0cad059f1282d02b20150a (commit) from 623123aaa0dce491c3d2a365912ef8c443c8d553 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3597c3b9869f4339fd0cad059f1282d02b20150a commit 3597c3b9869f4339fd0cad059f1282d02b20150a Author: Kitware Robot AuthorDate: Wed Jul 2 00:01:12 2014 -0400 Commit: Kitware Robot CommitDate: Wed Jul 2 00:01:12 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f5e0bc1..27405be 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140701) +set(CMake_VERSION_PATCH 20140702) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 2 09:17:16 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 2 Jul 2014 09:17:16 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4055-gfa6c373 Message-ID: <20140702131716.26909309DE@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via fa6c373f9e172e6592a2f3b7ecc28ea7c1e06042 (commit) via b3012d206652854b49e154bf831f76d7d9942797 (commit) from 0440d7201686f779a477570b2bcdd8c25d9df7db (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fa6c373f9e172e6592a2f3b7ecc28ea7c1e06042 commit fa6c373f9e172e6592a2f3b7ecc28ea7c1e06042 Merge: 0440d72 b3012d2 Author: Brad King AuthorDate: Wed Jul 2 09:17:15 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 2 09:17:15 2014 -0400 Merge topic 'no-cross-install_name_tool' into next b3012d20 OS X: Only search for install_name_tool if the toolchain has it http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b3012d206652854b49e154bf831f76d7d9942797 commit b3012d206652854b49e154bf831f76d7d9942797 Author: Florent Castelli AuthorDate: Tue Jul 1 20:34:26 2014 +0200 Commit: Brad King CommitDate: Wed Jul 2 09:17:45 2014 -0400 OS X: Only search for install_name_tool if the toolchain has it When cross compiling, toolchains won't have install_name_tool, which is provided by Xcode and command line tools on OS X. This is a Mach-O specific utility and not required on all platforms. diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 829b6ff..5b5bda8 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -68,7 +68,7 @@ endif() # on Apple there really should be install_name_tool -if(APPLE) +if(CMAKE_PLATFORM_HAS_INSTALLNAME) find_program(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) if(NOT CMAKE_INSTALL_NAME_TOOL) ----------------------------------------------------------------------- Summary of changes: Modules/CMakeFindBinUtils.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 2 09:40:59 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 2 Jul 2014 09:40:59 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4057-gba12dd1 Message-ID: <20140702134059.DB4B3302D0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ba12dd176aecaedc288a9eefecb0d1adfce4b55e (commit) via 4121316f7cf670a0e0a1af0082c69d3279ae2f58 (commit) from fa6c373f9e172e6592a2f3b7ecc28ea7c1e06042 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ba12dd176aecaedc288a9eefecb0d1adfce4b55e commit ba12dd176aecaedc288a9eefecb0d1adfce4b55e Merge: fa6c373 4121316 Author: Brad King AuthorDate: Wed Jul 2 09:40:59 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 2 09:40:59 2014 -0400 Merge topic 'no-cross-install_name_tool' into next 4121316f CMakeFindBinUtils: Remove outdated comment http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4121316f7cf670a0e0a1af0082c69d3279ae2f58 commit 4121316f7cf670a0e0a1af0082c69d3279ae2f58 Author: Brad King AuthorDate: Wed Jul 2 09:42:02 2014 -0400 Commit: Brad King CommitDate: Wed Jul 2 09:42:02 2014 -0400 CMakeFindBinUtils: Remove outdated comment diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 5b5bda8..dda28bd 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -66,8 +66,6 @@ else() endif() - -# on Apple there really should be install_name_tool if(CMAKE_PLATFORM_HAS_INSTALLNAME) find_program(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) ----------------------------------------------------------------------- Summary of changes: Modules/CMakeFindBinUtils.cmake | 2 -- 1 file changed, 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 2 09:41:20 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 2 Jul 2014 09:41:20 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4059-g3811d18 Message-ID: <20140702134120.8868D3032A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 3811d18a7e1e1a7a70ce5ec35bea55e9f3c5f00d (commit) via 591a7388cf8cd26377d901195c9946b51c44cdfb (commit) from ba12dd176aecaedc288a9eefecb0d1adfce4b55e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3811d18a7e1e1a7a70ce5ec35bea55e9f3c5f00d commit 3811d18a7e1e1a7a70ce5ec35bea55e9f3c5f00d Merge: ba12dd1 591a738 Author: Brad King AuthorDate: Wed Jul 2 09:41:19 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 2 09:41:19 2014 -0400 Merge topic 'no-cross-install_name_tool' into next 591a7388 OS X: Only search for install_name_tool if the toolchain has it http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=591a7388cf8cd26377d901195c9946b51c44cdfb commit 591a7388cf8cd26377d901195c9946b51c44cdfb Author: Florent Castelli AuthorDate: Tue Jul 1 20:34:26 2014 +0200 Commit: Brad King CommitDate: Wed Jul 2 09:42:22 2014 -0400 OS X: Only search for install_name_tool if the toolchain has it When cross compiling, toolchains won't have install_name_tool, which is provided by Xcode and command line tools on OS X. This is a Mach-O specific utility and not required on all platforms. diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 829b6ff..dda28bd 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -66,9 +66,7 @@ else() endif() - -# on Apple there really should be install_name_tool -if(APPLE) +if(CMAKE_PLATFORM_HAS_INSTALLNAME) find_program(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) if(NOT CMAKE_INSTALL_NAME_TOOL) ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 2 09:50:26 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 2 Jul 2014 09:50:26 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4061-g1ded851 Message-ID: <20140702135026.BC9C031044@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 1ded8512c30c0627739cdd900f47efa6787cb948 (commit) via 71c981a213a463d05b4bdc73dfb445c80ce2a476 (commit) from 3811d18a7e1e1a7a70ce5ec35bea55e9f3c5f00d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1ded8512c30c0627739cdd900f47efa6787cb948 commit 1ded8512c30c0627739cdd900f47efa6787cb948 Merge: 3811d18 71c981a Author: Brad King AuthorDate: Wed Jul 2 09:50:26 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 2 09:50:26 2014 -0400 Merge topic 'libarchive-encoding' into next 71c981a2 Encoding: Fix potential encoding issues with libarchive on Windows. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=71c981a213a463d05b4bdc73dfb445c80ce2a476 commit 71c981a213a463d05b4bdc73dfb445c80ce2a476 Author: Clinton Stimpson AuthorDate: Thu Jun 12 06:46:40 2014 -0600 Commit: Brad King CommitDate: Wed Jul 2 09:49:45 2014 -0400 Encoding: Fix potential encoding issues with libarchive on Windows. Because the 8bit string encoding in libarchive can be different than the 8bit string encoding in CMake, change to call the wide version of libarchive functions. They are different if CMake is configured to use UTF-8 as the internal encoding. Create helper functions for some libarchive calls to use wstring internally on platforms supporting it. diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index 58f7573..3b0ead5 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -25,6 +25,28 @@ static std::string cm_archive_error_string(struct archive* a) } //---------------------------------------------------------------------------- +static void cm_archive_entry_copy_pathname(struct archive_entry* e, + const std::string& dest) +{ +#if cmsys_STL_HAS_WSTRING + archive_entry_copy_pathname_w(e, cmsys::Encoding::ToWide(dest).c_str()); +#else + archive_entry_copy_pathname(e, dest.c_str()); +#endif +} + +//---------------------------------------------------------------------------- +static void cm_archive_entry_copy_sourcepath(struct archive_entry* e, + const std::string& file) +{ +#if cmsys_STL_HAS_WSTRING + archive_entry_copy_sourcepath_w(e, cmsys::Encoding::ToWide(file).c_str()); +#else + archive_entry_copy_sourcepath(e, file.c_str()); +#endif +} + +//---------------------------------------------------------------------------- class cmArchiveWrite::Entry { struct archive_entry* Object; @@ -237,8 +259,8 @@ bool cmArchiveWrite::AddFile(const char* file, std::cout << dest << "\n"; } Entry e; - archive_entry_copy_sourcepath(e, file); - archive_entry_set_pathname(e, dest.c_str()); + cm_archive_entry_copy_sourcepath(e, file); + cm_archive_entry_copy_pathname(e, dest); if(archive_read_disk_entry_from_file(this->Disk, e, -1, 0) != ARCHIVE_OK) { this->Error = "archive_read_disk_entry_from_file: "; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 2e417cb..d0fa834 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -91,6 +91,31 @@ extern char** environ; # endif #endif +#if defined(CMAKE_BUILD_WITH_CMAKE) +static std::string +cm_archive_entry_pathname(struct archive_entry *entry) +{ +#if cmsys_STL_HAS_WSTRING + return cmsys::Encoding::ToNarrow( + archive_entry_pathname_w(entry)).c_str(); +#else + return archive_entry_pathname(entry); +#endif +} + +static int cm_archive_read_open_file(struct archive* a, + const char* file, + int block_size) +{ +#if cmsys_STL_HAS_WSTRING + std::wstring wfile = cmsys::Encoding::ToWide(file); + return archive_read_open_filename_w(a, wfile.c_str(), block_size); +#else + return archive_read_open_filename(a, file, block_size); +#endif +} +#endif + #ifdef _WIN32 class cmSystemToolsWindowsHandle { @@ -1581,7 +1606,7 @@ namespace{ } strftime(tmp, sizeof(tmp), fmt, localtime(&tim)); fprintf(out, " %s ", tmp); - fprintf(out, "%s", archive_entry_pathname(entry)); + fprintf(out, "%s", cm_archive_entry_pathname(entry).c_str()); /* Extra information for links. */ if (archive_entry_hardlink(entry)) /* Hard link */ @@ -1641,7 +1666,7 @@ bool extract_tar(const char* outFileName, bool verbose, archive_read_support_compression_all(a); archive_read_support_format_all(a); struct archive_entry *entry; - int r = archive_read_open_file(a, outFileName, 10240); + int r = cm_archive_read_open_file(a, outFileName, 10240); if(r) { cmSystemTools::Error("Problem with archive_read_open_file(): ", @@ -1666,7 +1691,7 @@ bool extract_tar(const char* outFileName, bool verbose, if(extract) { cmSystemTools::Stdout("x "); - cmSystemTools::Stdout(archive_entry_pathname(entry)); + cmSystemTools::Stdout(cm_archive_entry_pathname(entry).c_str()); } else { @@ -1676,7 +1701,7 @@ bool extract_tar(const char* outFileName, bool verbose, } else if(!extract) { - cmSystemTools::Stdout(archive_entry_pathname(entry)); + cmSystemTools::Stdout(cm_archive_entry_pathname(entry).c_str()); cmSystemTools::Stdout("\n"); } if(extract) @@ -1706,7 +1731,8 @@ bool extract_tar(const char* outFileName, bool verbose, else if(const char* linktext = archive_entry_symlink(entry)) { std::cerr << "cmake -E tar: warning: skipping symbolic link \"" - << archive_entry_pathname(entry) << "\" -> \"" + << cm_archive_entry_pathname(entry) + << "\" -> \"" << linktext << "\"." << std::endl; } #endif @@ -1715,7 +1741,7 @@ bool extract_tar(const char* outFileName, bool verbose, cmSystemTools::Error("Problem with archive_write_header(): ", archive_error_string(ext)); cmSystemTools::Error("Current file: ", - archive_entry_pathname(entry)); + cm_archive_entry_pathname(entry).c_str()); break; } } ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 2 09:54:45 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 2 Jul 2014 09:54:45 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1287-g2eed2fd Message-ID: <20140702135445.640B131489@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 2eed2fd2bb42a9ac5c6f271b1e6d4abe47166b9c (commit) via 71c981a213a463d05b4bdc73dfb445c80ce2a476 (commit) from 3597c3b9869f4339fd0cad059f1282d02b20150a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2eed2fd2bb42a9ac5c6f271b1e6d4abe47166b9c commit 2eed2fd2bb42a9ac5c6f271b1e6d4abe47166b9c Merge: 3597c3b 71c981a Author: Brad King AuthorDate: Wed Jul 2 09:54:44 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 2 09:54:44 2014 -0400 Merge topic 'libarchive-encoding' 71c981a2 Encoding: Fix potential encoding issues with libarchive on Windows. ----------------------------------------------------------------------- Summary of changes: Source/cmArchiveWrite.cxx | 26 ++++++++++++++++++++++++-- Source/cmSystemTools.cxx | 38 ++++++++++++++++++++++++++++++++------ 2 files changed, 56 insertions(+), 8 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 2 09:54:47 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 2 Jul 2014 09:54:47 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1289-g164bd68 Message-ID: <20140702135447.0C5FC3148B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 164bd68a030dcaa658ad7828b7f7b7762cbace74 (commit) via 18ac6713e8657cca8fc791bcd581a47a7be6ebce (commit) from 2eed2fd2bb42a9ac5c6f271b1e6d4abe47166b9c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=164bd68a030dcaa658ad7828b7f7b7762cbace74 commit 164bd68a030dcaa658ad7828b7f7b7762cbace74 Merge: 2eed2fd 18ac671 Author: Brad King AuthorDate: Wed Jul 2 09:54:46 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 2 09:54:46 2014 -0400 Merge topic 'FindJNI-ppc64le' 18ac6713 FindJNI: search for ppc64 on ppc64le as well ----------------------------------------------------------------------- Summary of changes: Modules/FindJNI.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 2 09:54:48 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 2 Jul 2014 09:54:48 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1291-g94fbf33 Message-ID: <20140702135448.9FF9831489@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 94fbf33ad1fb8e304fb8ba1847b1a74e09e05f13 (commit) via 9571214e55cb8b86dadb26b6b1d696ef488bdd4b (commit) from 164bd68a030dcaa658ad7828b7f7b7762cbace74 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=94fbf33ad1fb8e304fb8ba1847b1a74e09e05f13 commit 94fbf33ad1fb8e304fb8ba1847b1a74e09e05f13 Merge: 164bd68 9571214 Author: Brad King AuthorDate: Wed Jul 2 09:54:47 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 2 09:54:47 2014 -0400 Merge topic 'encoding-bugs' 9571214e Encoding: Replace some system calls with kwsys calls which handle unicode. ----------------------------------------------------------------------- Summary of changes: Source/cmFileCommand.cxx | 12 ++---------- Source/cmTimestamp.cxx | 8 +++----- 2 files changed, 5 insertions(+), 15 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 2 09:54:50 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 2 Jul 2014 09:54:50 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1293-ge2a12b8 Message-ID: <20140702135450.3C23131490@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via e2a12b8a58e0b96ef974463d4412fa804e3af297 (commit) via ac8879ce91a61703c9c3fc1e06316dbe8d5a8786 (commit) from 94fbf33ad1fb8e304fb8ba1847b1a74e09e05f13 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e2a12b8a58e0b96ef974463d4412fa804e3af297 commit e2a12b8a58e0b96ef974463d4412fa804e3af297 Merge: 94fbf33 ac8879c Author: Brad King AuthorDate: Wed Jul 2 09:54:49 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 2 09:54:49 2014 -0400 Merge topic 'ninja-link-order-only-dependencies' ac8879ce Ninja: Add order-only dependencies to link commands (#14728) ----------------------------------------------------------------------- Summary of changes: Source/cmNinjaNormalTargetGenerator.cxx | 7 ++++++- Tests/ObjectLibrary/CMakeLists.txt | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 2 09:54:52 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 2 Jul 2014 09:54:52 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1296-g2ea0d6b Message-ID: <20140702135452.1E0C831494@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 2ea0d6ba278e67f1fd6f2f78f2df9951a46eb4a4 (commit) via 65aa5442b72aa8dda61088bdc0ffa2aa45965646 (commit) via 61ce6547424821710d0fbebf06b0eb411a630253 (commit) from e2a12b8a58e0b96ef974463d4412fa804e3af297 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2ea0d6ba278e67f1fd6f2f78f2df9951a46eb4a4 commit 2ea0d6ba278e67f1fd6f2f78f2df9951a46eb4a4 Merge: e2a12b8 65aa544 Author: Brad King AuthorDate: Wed Jul 2 09:54:50 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 2 09:54:50 2014 -0400 Merge topic 'fix-circular-transitive-properties-segfault' 65aa5442 Target: Return null when a transitive property is not defined. 61ce6547 Genex: Fix stack overflow in transitive property evaluation. ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpressionEvaluator.cxx | 13 +++++++++ Source/cmTarget.cxx | 30 ++++++++++++++++++++ .../LinkImplementationCycle1-result.txt} | 0 .../LinkImplementationCycle1-stderr.txt | 10 +++++++ .../LinkImplementationCycle1.cmake | 8 ++++++ .../LinkImplementationCycle2-result.txt} | 0 .../LinkImplementationCycle2-stderr.txt | 10 +++++++ .../LinkImplementationCycle2.cmake | 8 ++++++ .../LinkImplementationCycle3-result.txt} | 0 .../LinkImplementationCycle3-stderr.txt} | 0 .../LinkImplementationCycle3.cmake | 10 +++++++ .../LinkImplementationCycle4-result.txt} | 0 .../LinkImplementationCycle4-stderr.txt | 8 ++++++ .../LinkImplementationCycle4.cmake | 14 +++++++++ .../LinkImplementationCycle5-result.txt} | 0 .../LinkImplementationCycle5-stderr.txt | 8 ++++++ .../LinkImplementationCycle5.cmake | 10 +++++++ .../LinkImplementationCycle6-result.txt} | 0 .../LinkImplementationCycle6-stderr.txt | 8 ++++++ .../LinkImplementationCycle6.cmake | 14 +++++++++ .../RunCMakeTest.cmake | 6 ++++ .../empty.cpp | 0 22 files changed, 157 insertions(+) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => TargetPropertyGeneratorExpressions/LinkImplementationCycle1-result.txt} (100%) create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1-stderr.txt create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle1.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => TargetPropertyGeneratorExpressions/LinkImplementationCycle2-result.txt} (100%) create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2-stderr.txt create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle2.cmake copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => TargetPropertyGeneratorExpressions/LinkImplementationCycle3-result.txt} (100%) copy Tests/RunCMake/{CMP0022/CMP0022-NOWARN-exe-stderr.txt => TargetPropertyGeneratorExpressions/LinkImplementationCycle3-stderr.txt} (100%) create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => TargetPropertyGeneratorExpressions/LinkImplementationCycle4-result.txt} (100%) create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4-stderr.txt create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle4.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => TargetPropertyGeneratorExpressions/LinkImplementationCycle5-result.txt} (100%) create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5-stderr.txt create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle5.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => TargetPropertyGeneratorExpressions/LinkImplementationCycle6-result.txt} (100%) create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6-stderr.txt create mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle6.cmake copy Tests/RunCMake/{CMP0022 => TargetPropertyGeneratorExpressions}/empty.cpp (100%) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 2 09:54:53 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 2 Jul 2014 09:54:53 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1298-g33bdcde Message-ID: <20140702135453.B166B3149C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 33bdcdea809e5f59f943686f4440b9125d721b00 (commit) via 902c90636e1942c12a19f880239267fb30fd7367 (commit) from 2ea0d6ba278e67f1fd6f2f78f2df9951a46eb4a4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=33bdcdea809e5f59f943686f4440b9125d721b00 commit 33bdcdea809e5f59f943686f4440b9125d721b00 Merge: 2ea0d6b 902c906 Author: Brad King AuthorDate: Wed Jul 2 09:54:52 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 2 09:54:52 2014 -0400 Merge topic 'tests-add_test-NAME' 902c9063 Tests: Use add_test(NAME) signature in add_test_macro ----------------------------------------------------------------------- Summary of changes: Tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 2 09:54:55 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 2 Jul 2014 09:54:55 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1300-g38c9edd Message-ID: <20140702135455.568BB3149E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 38c9eddad87511ddcb252e0363bdf14ef9b3b866 (commit) via 5217ad26a6897cb6d74d91ef8be3fd58f71705ea (commit) from 33bdcdea809e5f59f943686f4440b9125d721b00 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=38c9eddad87511ddcb252e0363bdf14ef9b3b866 commit 38c9eddad87511ddcb252e0363bdf14ef9b3b866 Merge: 33bdcde 5217ad2 Author: Brad King AuthorDate: Wed Jul 2 09:54:54 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 2 09:54:54 2014 -0400 Merge topic 'memcheck-test-no-lang' 5217ad26 CTestTestMemcheck: do not search for compilers ----------------------------------------------------------------------- Summary of changes: Tests/CTestTestMemcheck/CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 2 09:54:56 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 2 Jul 2014 09:54:56 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1302-g477b072 Message-ID: <20140702135456.F1229314A0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 477b07213a806c825f95fdfacd444028e1783dc2 (commit) via 7269e69ffa9a77bccd7eec9435463d85c0762493 (commit) from 38c9eddad87511ddcb252e0363bdf14ef9b3b866 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=477b07213a806c825f95fdfacd444028e1783dc2 commit 477b07213a806c825f95fdfacd444028e1783dc2 Merge: 38c9edd 7269e69 Author: Brad King AuthorDate: Wed Jul 2 09:54:56 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 2 09:54:56 2014 -0400 Merge topic 'ExternalProject_test' 7269e69f ExternalProject test: remove unused file ----------------------------------------------------------------------- Summary of changes: Tests/ExternalProject/TryCheckout.cmake | 54 ------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 Tests/ExternalProject/TryCheckout.cmake hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 2 09:55:23 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 2 Jul 2014 09:55:23 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4071-gf3ebed9 Message-ID: <20140702135523.1935B314CD@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f3ebed934d8996b719e61555f375f07c96d889db (commit) via 477b07213a806c825f95fdfacd444028e1783dc2 (commit) via 38c9eddad87511ddcb252e0363bdf14ef9b3b866 (commit) via 33bdcdea809e5f59f943686f4440b9125d721b00 (commit) via 2ea0d6ba278e67f1fd6f2f78f2df9951a46eb4a4 (commit) via e2a12b8a58e0b96ef974463d4412fa804e3af297 (commit) via 94fbf33ad1fb8e304fb8ba1847b1a74e09e05f13 (commit) via 164bd68a030dcaa658ad7828b7f7b7762cbace74 (commit) via 2eed2fd2bb42a9ac5c6f271b1e6d4abe47166b9c (commit) via 3597c3b9869f4339fd0cad059f1282d02b20150a (commit) from 1ded8512c30c0627739cdd900f47efa6787cb948 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f3ebed934d8996b719e61555f375f07c96d889db commit f3ebed934d8996b719e61555f375f07c96d889db Merge: 1ded851 477b072 Author: Brad King AuthorDate: Wed Jul 2 09:56:32 2014 -0400 Commit: Brad King CommitDate: Wed Jul 2 09:56:32 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 2 10:08:54 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 2 Jul 2014 10:08:54 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4084-gdb98e04 Message-ID: <20140702140854.D46C131DC6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via db98e04debb3b13fbacc3359edfb0b8047079513 (commit) via 3c8f6b1d0c29a8fdb35d8a72ae91f7820254fedb (commit) via e77a094d103eb2bbb24e55e4356fb4c8b44483a8 (commit) via ba76e7ef85d2ef4be25fb60f9409deb273de4dd1 (commit) via fd021b9f9d3a6881438e01d8ffc9d6f39339f8ad (commit) via 361f99b53d92f6c31205818fb0cf18ac35a678c1 (commit) via 36c4c139b8364817f02bb95f18c1f1d0ba53371d (commit) via 586ff5f3aab418ee13b6c978ea2e5e9c6b7c2060 (commit) via 3843c41f9919a5a2e510e93cb5b404201f211aa9 (commit) via 81f1bfe261a02e63d6b5d54767b61a7b8bbccb99 (commit) via 2cf120cf89deb4c7e92d060f4796299cbe825adc (commit) via 0e9f7a1e576ceb9e5c7f4933ec0cdd9c27dec529 (commit) via 3cb21f27cab42789744ee383664fb11dcb8ac800 (commit) from f3ebed934d8996b719e61555f375f07c96d889db (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=db98e04debb3b13fbacc3359edfb0b8047079513 commit db98e04debb3b13fbacc3359edfb0b8047079513 Merge: f3ebed9 3c8f6b1 Author: Brad King AuthorDate: Wed Jul 2 10:08:53 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 2 10:08:53 2014 -0400 Merge topic 'refactor-usage-requirement-evaluation' into next 3c8f6b1d cmTarget: Simplify INTERFACE_INCLUDE_DIRECTORIES usage requirement lookup e77a094d cmTarget: Simplify CMP0027 logic in processIncludeDirectories ba76e7ef cmTarget: Add to LinkImplementation whether each library was a genex fd021b9f cmTarget: Simplify INTERFACE_COMPILE_FEATURES usage requirement lookup 361f99b5 cmTarget: Simplify INTERFACE_COMPILE_DEFINITIONS usage requirement lookup 36c4c139 cmTarget: Simplify INTERFACE_COMPILE_OPTIONS usage requirement lookup 586ff5f3 cmTarget: Simplify INTERFACE_SOURCES usage requirement lookup 3843c41f cmTarget: Add method to add usage requirements from linked interfaces 81f1bfe2 cmTarget: Add to LinkImplementation a backtrace for each library 2cf120cf cmTarget: Refactor LinkImplementation to allow more information 0e9f7a1e cmGeneratorExpressionEvaluator: Shorten some long lines 3cb21f27 cmComputeLinkDepends: Convert AddLinkEntries to a template http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3c8f6b1d0c29a8fdb35d8a72ae91f7820254fedb commit 3c8f6b1d0c29a8fdb35d8a72ae91f7820254fedb Author: Brad King AuthorDate: Mon Jun 30 13:23:49 2014 -0400 Commit: Brad King CommitDate: Wed Jul 2 09:57:36 2014 -0400 cmTarget: Simplify INTERFACE_INCLUDE_DIRECTORIES usage requirement lookup Use the AddInterfaceEntries helper to avoid duplication. In TargetPropertyEntry, replace the TargetName string member with a reference to the full cmLinkImplItem that produced the entry. This is possible because the cmLinkImplItem is available in AddInterfaceEntries (it was not available in GetIncludeDirectories). Having the full cmLinkImplItem allows processIncludeDirectories to implement CMP0027 OLD behavior without repeating the target name lookup. Update the RunCMake.CompatibleInterface test DebugProperties case expected output for the new order of the messages. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 7cb3268..94da3c2 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -165,14 +165,16 @@ public: std::set UtilityItems; bool UtilityItemsDone; - struct TargetPropertyEntry { + class TargetPropertyEntry { + static cmLinkImplItem NoLinkImplItem; + public: TargetPropertyEntry(cmsys::auto_ptr cge, - const std::string &targetName = std::string()) - : ge(cge), TargetName(targetName) + cmLinkImplItem const& item = NoLinkImplItem) + : ge(cge), LinkImplItem(item) {} const cmsys::auto_ptr ge; std::vector CachedEntries; - const std::string TargetName; + cmLinkImplItem const& LinkImplItem; }; std::vector IncludeDirectoriesEntries; std::vector CompileOptionsEntries; @@ -206,6 +208,8 @@ public: std::map CacheLinkImplementationClosureDone; }; +cmLinkImplItem cmTargetInternals::TargetPropertyEntry::NoLinkImplItem; + //---------------------------------------------------------------------------- void deleteAndClear( std::vector &entries) @@ -2012,24 +2016,10 @@ static void processIncludeDirectories(cmTarget const* tgt, for (std::vector::const_iterator it = entries.begin(), end = entries.end(); it != end; ++it) { - std::string targetName = (*it)->TargetName; - bool checkCMP0027 = false; - if(!cmGeneratorExpression::IsValidTargetName(targetName) - && cmGeneratorExpression::Find(targetName) != std::string::npos) - { - std::string evaluatedTargetName; - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(targetName); - evaluatedTargetName = cge->Evaluate(mf, config, false, tgt, 0, 0); - checkCMP0027 = evaluatedTargetName != targetName; - targetName = evaluatedTargetName; - } - cmTarget *dependentTarget = mf->FindTargetToUse(targetName); - - const bool fromImported = - dependentTarget && dependentTarget->IsImported(); - + cmLinkImplItem const& item = (*it)->LinkImplItem; + std::string const& targetName = item; + bool const fromImported = item.Target && item.Target->IsImported(); + bool const checkCMP0027 = item.FromGenex; bool testIsOff = true; bool cacheIncludes = false; std::vector& entryIncludes = (*it)->CachedEntries; @@ -2200,45 +2190,9 @@ cmTarget::GetIncludeDirectories(const std::string& config) const if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[config]) { - for (std::vector::const_iterator - it = this->Internal->LinkImplementationPropertyEntries.begin(), - end = this->Internal->LinkImplementationPropertyEntries.end(); - it != end; ++it) - { - if (!cmGeneratorExpression::IsValidTargetName(it->Value) - && cmGeneratorExpression::Find(it->Value) == std::string::npos) - { - continue; - } - { - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(it->Value); - std::string result = cge->Evaluate(this->Makefile, config, - false, this, 0, 0); - if (!this->Makefile->FindTargetToUse(result)) - { - continue; - } - } - std::string includeGenex = "$Value + ",INTERFACE_INCLUDE_DIRECTORIES>"; - if (cmGeneratorExpression::Find(it->Value) != std::string::npos) - { - // Because it->Value is a generator expression, ensure that it - // evaluates to the non-empty string before being used in the - // TARGET_PROPERTY expression. - includeGenex = "$<$Value + ">:" + includeGenex + ">"; - } - cmGeneratorExpression ge(&it->Backtrace); - cmsys::auto_ptr cge = ge.Parse( - includeGenex); - - this->Internal - ->CachedLinkInterfaceIncludeDirectoriesEntries[config].push_back( - new cmTargetInternals::TargetPropertyEntry(cge, - it->Value)); - } + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_INCLUDE_DIRECTORIES", + this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[config]); if(this->Makefile->IsOn("APPLE")) { diff --git a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt index 82a34d5..17b8a5c 100644 --- a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt +++ b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt @@ -1,11 +1,4 @@ CMake Debug Log: - Boolean compatibility of property "BOOL_PROP7" for target - "CompatibleInterface" \(result: "FALSE"\): - - \* Target "CompatibleInterface" property is implied by use. - \* Target "iface1" property value "FALSE" \(Agree\) -+ -CMake Debug Log: Boolean compatibility of property "BOOL_PROP1" for target "CompatibleInterface" \(result: "TRUE"\): @@ -47,6 +40,13 @@ CMake Debug Log: \* Target "iface2" property value "FALSE" \(Agree\) + CMake Debug Log: + Boolean compatibility of property "BOOL_PROP7" for target + "CompatibleInterface" \(result: "FALSE"\): + + \* Target "CompatibleInterface" property is implied by use. + \* Target "iface1" property value "FALSE" \(Agree\) ++ +CMake Debug Log: String compatibility of property "STRING_PROP1" for target "CompatibleInterface" \(result: "prop1"\): http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e77a094d103eb2bbb24e55e4356fb4c8b44483a8 commit e77a094d103eb2bbb24e55e4356fb4c8b44483a8 Author: Brad King AuthorDate: Mon Jun 30 11:41:54 2014 -0400 Commit: Brad King CommitDate: Wed Jul 2 09:57:36 2014 -0400 cmTarget: Simplify CMP0027 logic in processIncludeDirectories Evaluate and lookup the target name only once per TargetPropertyEntry instead of repeating it for each include directory entry. Use a local checkCMP0027 variable to record whether the policy should be checked. Evaluate the target name as a generator expression only if it looks like one. Lookup the target by name only after evaluation of generator expressions. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 8272af3..7cb3268 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2012,6 +2012,24 @@ static void processIncludeDirectories(cmTarget const* tgt, for (std::vector::const_iterator it = entries.begin(), end = entries.end(); it != end; ++it) { + std::string targetName = (*it)->TargetName; + bool checkCMP0027 = false; + if(!cmGeneratorExpression::IsValidTargetName(targetName) + && cmGeneratorExpression::Find(targetName) != std::string::npos) + { + std::string evaluatedTargetName; + cmGeneratorExpression ge; + cmsys::auto_ptr cge = + ge.Parse(targetName); + evaluatedTargetName = cge->Evaluate(mf, config, false, tgt, 0, 0); + checkCMP0027 = evaluatedTargetName != targetName; + targetName = evaluatedTargetName; + } + cmTarget *dependentTarget = mf->FindTargetToUse(targetName); + + const bool fromImported = + dependentTarget && dependentTarget->IsImported(); + bool testIsOff = true; bool cacheIncludes = false; std::vector& entryIncludes = (*it)->CachedEntries; @@ -2037,36 +2055,12 @@ static void processIncludeDirectories(cmTarget const* tgt, for(std::vector::iterator li = entryIncludes.begin(); li != entryIncludes.end(); ++li) { - std::string targetName = (*it)->TargetName; - std::string evaluatedTargetName; - { - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(targetName); - evaluatedTargetName = cge->Evaluate(mf, config, false, tgt, 0, 0); - } - - cmTarget *dependentTarget = mf->FindTargetToUse(targetName); - - const bool fromImported = dependentTarget - && dependentTarget->IsImported(); - - cmTarget *evaluatedDependentTarget = - (targetName != evaluatedTargetName) - ? mf->FindTargetToUse(evaluatedTargetName) - : 0; - - targetName = evaluatedTargetName; - - const bool fromEvaluatedImported = evaluatedDependentTarget - && evaluatedDependentTarget->IsImported(); - - if ((fromImported || fromEvaluatedImported) + if (fromImported && !cmSystemTools::FileExists(li->c_str())) { cmOStringStream e; cmake::MessageType messageType = cmake::FATAL_ERROR; - if (fromEvaluatedImported) + if (checkCMP0027) { switch(tgt->GetPolicyStatusCMP0027()) { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ba76e7ef85d2ef4be25fb60f9409deb273de4dd1 commit ba76e7ef85d2ef4be25fb60f9409deb273de4dd1 Author: Brad King AuthorDate: Mon Jun 30 11:39:09 2014 -0400 Commit: Brad King CommitDate: Wed Jul 2 09:57:36 2014 -0400 cmTarget: Add to LinkImplementation whether each library was a genex Implementation of CMP0027 OLD behavior needs to know whether each entry in LinkImplementation::Libraries came from a generator expression or not. Add a FromGenex member to cmLinkImplItem to record this. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 175ceba..8272af3 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6510,12 +6510,9 @@ void cmTarget::ComputeLinkImplementation(const std::string& config, cmGeneratorExpression ge(&le->Backtrace); cmsys::auto_ptr const cge = ge.Parse(le->Value); - cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, - config, - false, - head, - &dagChecker), - llibs); + std::string const evaluated = + cge->Evaluate(this->Makefile, config, false, head, &dagChecker); + cmSystemTools::ExpandListArgument(evaluated, llibs); for(std::vector::const_iterator li = llibs.begin(); li != llibs.end(); ++li) @@ -6563,7 +6560,8 @@ void cmTarget::ComputeLinkImplementation(const std::string& config, // The entry is meant for this configuration. impl.Libraries.push_back( - cmLinkImplItem(name, this->FindTargetToLink(name), le->Backtrace)); + cmLinkImplItem(name, this->FindTargetToLink(name), + le->Backtrace, evaluated != le->Value)); } std::set const& seenProps = cge->GetSeenTargetProperties(); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 5f2a557..dc67f1e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -57,14 +57,16 @@ public: class cmLinkImplItem: public cmLinkItem { public: - cmLinkImplItem(): cmLinkItem(), Backtrace(0) {} + cmLinkImplItem(): cmLinkItem(), Backtrace(0), FromGenex(false) {} cmLinkImplItem(std::string const& n, cmTarget const* t, - cmListFileBacktrace const& bt): - cmLinkItem(n, t), Backtrace(bt) {} + cmListFileBacktrace const& bt, + bool fromGenex): + cmLinkItem(n, t), Backtrace(bt), FromGenex(fromGenex) {} cmLinkImplItem(cmLinkImplItem const& r): - cmLinkItem(r), Backtrace(r.Backtrace) {} + cmLinkItem(r), Backtrace(r.Backtrace), FromGenex(r.FromGenex) {} cmListFileBacktrace Backtrace; + bool FromGenex; }; struct cmTargetLinkInformationMap: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd021b9f9d3a6881438e01d8ffc9d6f39339f8ad commit fd021b9f9d3a6881438e01d8ffc9d6f39339f8ad Author: Brad King AuthorDate: Thu Jun 19 13:39:25 2014 -0400 Commit: Brad King CommitDate: Wed Jul 2 09:57:35 2014 -0400 cmTarget: Simplify INTERFACE_COMPILE_FEATURES usage requirement lookup Use the AddInterfaceEntries helper to avoid duplication. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 8ff83fb..175ceba 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2615,45 +2615,9 @@ void cmTarget::GetCompileFeatures(std::vector &result, if (!this->Internal->CacheLinkInterfaceCompileFeaturesDone[config]) { - for (std::vector::const_iterator - it = this->Internal->LinkImplementationPropertyEntries.begin(), - end = this->Internal->LinkImplementationPropertyEntries.end(); - it != end; ++it) - { - if (!cmGeneratorExpression::IsValidTargetName(it->Value) - && cmGeneratorExpression::Find(it->Value) == std::string::npos) - { - continue; - } - { - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(it->Value); - std::string targetResult = cge->Evaluate(this->Makefile, config, - false, this, 0, 0); - if (!this->Makefile->FindTargetToUse(targetResult)) - { - continue; - } - } - std::string featureGenex = "$Value + ",INTERFACE_COMPILE_FEATURES>"; - if (cmGeneratorExpression::Find(it->Value) != std::string::npos) - { - // Because it->Value is a generator expression, ensure that it - // evaluates to the non-empty string before being used in the - // TARGET_PROPERTY expression. - featureGenex = "$<$Value + ">:" + featureGenex + ">"; - } - cmGeneratorExpression ge(&it->Backtrace); - cmsys::auto_ptr cge = ge.Parse( - featureGenex); - - this->Internal - ->CachedLinkInterfaceCompileFeaturesEntries[config].push_back( - new cmTargetInternals::TargetPropertyEntry(cge, - it->Value)); - } + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_COMPILE_FEATURES", + this->Internal->CachedLinkInterfaceCompileFeaturesEntries[config]); } processCompileFeatures(this, http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=361f99b53d92f6c31205818fb0cf18ac35a678c1 commit 361f99b53d92f6c31205818fb0cf18ac35a678c1 Author: Brad King AuthorDate: Thu Jun 19 13:38:51 2014 -0400 Commit: Brad King CommitDate: Wed Jul 2 09:57:35 2014 -0400 cmTarget: Simplify INTERFACE_COMPILE_DEFINITIONS usage requirement lookup Use the AddInterfaceEntries helper to avoid duplication. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b4b1d95..8ff83fb 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2504,45 +2504,9 @@ void cmTarget::GetCompileDefinitions(std::vector &list, if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config]) { - for (std::vector::const_iterator - it = this->Internal->LinkImplementationPropertyEntries.begin(), - end = this->Internal->LinkImplementationPropertyEntries.end(); - it != end; ++it) - { - if (!cmGeneratorExpression::IsValidTargetName(it->Value) - && cmGeneratorExpression::Find(it->Value) == std::string::npos) - { - continue; - } - { - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(it->Value); - std::string targetResult = cge->Evaluate(this->Makefile, config, - false, this, 0, 0); - if (!this->Makefile->FindTargetToUse(targetResult)) - { - continue; - } - } - std::string defsGenex = "$Value + ",INTERFACE_COMPILE_DEFINITIONS>"; - if (cmGeneratorExpression::Find(it->Value) != std::string::npos) - { - // Because it->Value is a generator expression, ensure that it - // evaluates to the non-empty string before being used in the - // TARGET_PROPERTY expression. - defsGenex = "$<$Value + ">:" + defsGenex + ">"; - } - cmGeneratorExpression ge(&it->Backtrace); - cmsys::auto_ptr cge = ge.Parse( - defsGenex); - - this->Internal - ->CachedLinkInterfaceCompileDefinitionsEntries[config].push_back( - new cmTargetInternals::TargetPropertyEntry(cge, - it->Value)); - } + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_COMPILE_DEFINITIONS", + this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[config]); if (!config.empty()) { std::string configPropName = "COMPILE_DEFINITIONS_" http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=36c4c139b8364817f02bb95f18c1f1d0ba53371d commit 36c4c139b8364817f02bb95f18c1f1d0ba53371d Author: Brad King AuthorDate: Thu Jun 19 13:38:26 2014 -0400 Commit: Brad King CommitDate: Wed Jul 2 09:57:35 2014 -0400 cmTarget: Simplify INTERFACE_COMPILE_OPTIONS usage requirement lookup Use the AddInterfaceEntries helper to avoid duplication. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 418e5e5..b4b1d95 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2430,45 +2430,9 @@ void cmTarget::GetCompileOptions(std::vector &result, if (!this->Internal->CacheLinkInterfaceCompileOptionsDone[config]) { - for (std::vector::const_iterator - it = this->Internal->LinkImplementationPropertyEntries.begin(), - end = this->Internal->LinkImplementationPropertyEntries.end(); - it != end; ++it) - { - if (!cmGeneratorExpression::IsValidTargetName(it->Value) - && cmGeneratorExpression::Find(it->Value) == std::string::npos) - { - continue; - } - { - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(it->Value); - std::string targetResult = cge->Evaluate(this->Makefile, config, - false, this, 0, 0); - if (!this->Makefile->FindTargetToUse(targetResult)) - { - continue; - } - } - std::string optionGenex = "$Value + ",INTERFACE_COMPILE_OPTIONS>"; - if (cmGeneratorExpression::Find(it->Value) != std::string::npos) - { - // Because it->Value is a generator expression, ensure that it - // evaluates to the non-empty string before being used in the - // TARGET_PROPERTY expression. - optionGenex = "$<$Value + ">:" + optionGenex + ">"; - } - cmGeneratorExpression ge(&it->Backtrace); - cmsys::auto_ptr cge = ge.Parse( - optionGenex); - - this->Internal - ->CachedLinkInterfaceCompileOptionsEntries[config].push_back( - new cmTargetInternals::TargetPropertyEntry(cge, - it->Value)); - } + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_COMPILE_OPTIONS", + this->Internal->CachedLinkInterfaceCompileOptionsEntries[config]); } processCompileOptions(this, http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=586ff5f3aab418ee13b6c978ea2e5e9c6b7c2060 commit 586ff5f3aab418ee13b6c978ea2e5e9c6b7c2060 Author: Brad King AuthorDate: Thu Jun 19 13:37:30 2014 -0400 Commit: Brad King CommitDate: Wed Jul 2 09:57:35 2014 -0400 cmTarget: Simplify INTERFACE_SOURCES usage requirement lookup Use the AddInterfaceEntries helper to avoid duplication. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 8d294a3..418e5e5 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -774,45 +774,9 @@ void cmTarget::GetSourceFiles(std::vector &files, if (!this->Internal->CacheLinkInterfaceSourcesDone[config]) { - for (std::vector::const_iterator - it = this->Internal->LinkImplementationPropertyEntries.begin(), - end = this->Internal->LinkImplementationPropertyEntries.end(); - it != end; ++it) - { - if (!cmGeneratorExpression::IsValidTargetName(it->Value) - && cmGeneratorExpression::Find(it->Value) == std::string::npos) - { - continue; - } - { - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(it->Value); - std::string targetResult = cge->Evaluate(this->Makefile, config, - false, this, 0, &dagChecker); - if (!this->Makefile->FindTargetToUse(targetResult)) - { - continue; - } - } - std::string sourceGenex = "$Value + ",INTERFACE_SOURCES>"; - if (cmGeneratorExpression::Find(it->Value) != std::string::npos) - { - // Because it->Value is a generator expression, ensure that it - // evaluates to the non-empty string before being used in the - // TARGET_PROPERTY expression. - sourceGenex = "$<$Value + ">:" + sourceGenex + ">"; - } - cmGeneratorExpression ge(&it->Backtrace); - cmsys::auto_ptr cge = ge.Parse( - sourceGenex); - - this->Internal - ->CachedLinkInterfaceSourcesEntries[config].push_back( - new cmTargetInternals::TargetPropertyEntry(cge, - it->Value)); - } + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_SOURCES", + this->Internal->CachedLinkInterfaceSourcesEntries[config]); } std::vector::size_type numFilesBefore = files.size(); diff --git a/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt b/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt index a5d5d50..3a7f480 100644 --- a/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt +++ b/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt @@ -1,7 +1,9 @@ -CMake Error: +CMake Error at LINK_LANGUAGE-genex.cmake:[0-9]+ \(target_link_libraries\): Error evaluating generator expression: \$ LINKER_LANGUAGE target property can not be used while evaluating link - libraries + libraries for a static library +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt b/Tests/RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt index 2d7a3c9..d8bc238 100644 --- a/Tests/RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt +++ b/Tests/RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt @@ -1,7 +1,9 @@ -CMake Error: +CMake Error at link-libraries-TARGET_FILE-genex.cmake:[0-9]+ \(target_link_libraries\): Error evaluating generator expression: \$ Expressions which require the linker language may not be used while evaluating link libraries +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3843c41f9919a5a2e510e93cb5b404201f211aa9 commit 3843c41f9919a5a2e510e93cb5b404201f211aa9 Author: Brad King AuthorDate: Mon Jun 30 10:47:21 2014 -0400 Commit: Brad King CommitDate: Wed Jul 2 09:57:35 2014 -0400 cmTarget: Add method to add usage requirements from linked interfaces Create a cmTargetInternals::AddInterfaceEntries method to construct a $ generator expression and evaluate it for every target in the link implementation. This will be useful to de-duplicate such evaluation for each usage requirement separately. The new method will soon be used in the implementation of the INTERFACE_* usage requirement lookup methods (GetSourceFiles, GetCompileOptions, GetCompileDefinitions, GetCompileFeatures, GetIncludeDirectories). It is necessary for these methods to determine whether an expression in LinkImplementationPropertyEntries evaluates to a target or not because generator expression evaluation reports an error for non-targets and we construct a $ expression for each entry that is a target. The implementation of each usage requirement currently processes the LinkImplementationPropertyEntries and evaluates all generator expressions to determine targets. That is no longer necessary because GetLinkImplementationLibraries now returns resolved and cached targets together with their name. Use it to implement AddInterfaceEntries. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 911c0c2..8d294a3 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -181,6 +181,10 @@ public: std::vector SourceEntries; std::vector LinkImplementationPropertyEntries; + void AddInterfaceEntries( + cmTarget const* thisTarget, std::string const& config, + std::string const& prop, std::vector& entries); + std::map > CachedLinkInterfaceIncludeDirectoriesEntries; std::map > @@ -6551,6 +6555,31 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, } //---------------------------------------------------------------------------- +void cmTargetInternals::AddInterfaceEntries( + cmTarget const* thisTarget, std::string const& config, + std::string const& prop, std::vector& entries) +{ + if(cmTarget::LinkImplementation const* impl = + thisTarget->GetLinkImplementationLibraries(config)) + { + for (std::vector::const_iterator + it = impl->Libraries.begin(), end = impl->Libraries.end(); + it != end; ++it) + { + if(it->Target) + { + std::string genex = + "$"; + cmGeneratorExpression ge(&it->Backtrace); + cmsys::auto_ptr cge = ge.Parse(genex); + entries.push_back( + new cmTargetInternals::TargetPropertyEntry(cge, *it)); + } + } + } +} + +//---------------------------------------------------------------------------- cmTarget::LinkImplementation const* cmTarget::GetLinkImplementation(const std::string& config) const { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=81f1bfe261a02e63d6b5d54767b61a7b8bbccb99 commit 81f1bfe261a02e63d6b5d54767b61a7b8bbccb99 Author: Brad King AuthorDate: Mon Jun 30 10:43:36 2014 -0400 Commit: Brad King CommitDate: Wed Jul 2 09:57:34 2014 -0400 cmTarget: Add to LinkImplementation a backtrace for each library Allow clients to provide backtrace context on evaluation diagnostics. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 6c2d867..911c0c2 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6678,7 +6678,7 @@ void cmTarget::ComputeLinkImplementation(const std::string& config, // The entry is meant for this configuration. impl.Libraries.push_back( - cmLinkImplItem(name, this->FindTargetToLink(name))); + cmLinkImplItem(name, this->FindTargetToLink(name), le->Backtrace)); } std::set const& seenProps = cge->GetSeenTargetProperties(); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 8578c51..5f2a557 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -57,12 +57,14 @@ public: class cmLinkImplItem: public cmLinkItem { public: - cmLinkImplItem(): cmLinkItem() {} + cmLinkImplItem(): cmLinkItem(), Backtrace(0) {} cmLinkImplItem(std::string const& n, - cmTarget const* t): - cmLinkItem(n, t) {} + cmTarget const* t, + cmListFileBacktrace const& bt): + cmLinkItem(n, t), Backtrace(bt) {} cmLinkImplItem(cmLinkImplItem const& r): - cmLinkItem(r) {} + cmLinkItem(r), Backtrace(r.Backtrace) {} + cmListFileBacktrace Backtrace; }; struct cmTargetLinkInformationMap: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2cf120cf89deb4c7e92d060f4796299cbe825adc commit 2cf120cf89deb4c7e92d060f4796299cbe825adc Author: Brad King AuthorDate: Mon Jun 30 10:38:59 2014 -0400 Commit: Brad King CommitDate: Wed Jul 2 09:57:34 2014 -0400 cmTarget: Refactor LinkImplementation to allow more information Create a cmLinkImplItem class derived from cmLinkItem so more information can be added to link implementation entries than link interface entries. Convert the LinkImplementation Libraries member to hold it. Update client sites accordingly. diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 3929af4..75d3967 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -255,7 +255,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // A target should not depend on itself. emitted.insert(depender->GetName()); - for(std::vector::const_iterator + for(std::vector::const_iterator lib = impl->Libraries.begin(); lib != impl->Libraries.end(); ++lib) { diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index cf112ec..13eac3b 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -844,7 +844,7 @@ getLinkedTargetsContent( std::string getLinkedTargetsContent( - std::vector const &libraries, + std::vector const &libraries, cmTarget const* target, cmTarget const* headTarget, cmGeneratorExpressionContext *context, @@ -852,7 +852,7 @@ getLinkedTargetsContent( const std::string &interfacePropertyName) { std::vector tgts; - for (std::vector::const_iterator + for (std::vector::const_iterator it = libraries.begin(); it != libraries.end(); ++it) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index fd82d17..eccb06a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -475,8 +475,8 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, } std::set uniqueDeps; - for(std::vector::const_iterator li = impl->Libraries.begin(); - li != impl->Libraries.end(); ++li) + for(std::vector::const_iterator + li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { cmTarget const* tgt = li->Target; if (!tgt) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d27293a..6c2d867 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2281,7 +2281,7 @@ cmTarget::GetIncludeDirectories(const std::string& config) const if(this->Makefile->IsOn("APPLE")) { LinkImplementation const* impl = this->GetLinkImplementation(config); - for(std::vector::const_iterator + for(std::vector::const_iterator it = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) { @@ -3675,7 +3675,8 @@ void cmTarget::ComputeLinkClosure(const std::string& config, // Add interface languages from linked targets. cmTargetCollectLinkLanguages cll(this, config, languages, this); - for(std::vector::const_iterator li = impl->Libraries.begin(); + for(std::vector::const_iterator + li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { cll.Visit(*li); @@ -6242,7 +6243,8 @@ cmTarget::GetLinkImplementationClosure(const std::string& config) const cmTarget::LinkImplementation const* impl = this->GetLinkImplementationLibraries(config); - for(std::vector::const_iterator it = impl->Libraries.begin(); + for(std::vector::const_iterator + it = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) { processILibs(config, this, *it, tgts , emitted); @@ -6383,7 +6385,9 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, // The link implementation is the default link interface. LinkImplementation const* impl = this->GetLinkImplementationLibrariesInternal(config, headTarget); - iface.Libraries = impl->Libraries; + iface.Libraries.insert(iface.Libraries.end(), + impl->Libraries.begin(), + impl->Libraries.end()); if(this->PolicyStatusCMP0022 == cmPolicies::WARN && !this->Internal->PolicyWarnedCMP0022 && !usage_requirements_only) { @@ -6397,12 +6401,12 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, headTarget, usage_requirements_only, ifaceLibs); } - if (ifaceLibs != impl->Libraries) + if (ifaceLibs != iface.Libraries) { std::string oldLibraries; std::string newLibraries; const char *sep = ""; - for(std::vector::const_iterator it + for(std::vector::const_iterator it = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) { oldLibraries += sep; @@ -6470,7 +6474,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, { cmTarget::LinkImplementation const* impl = thisTarget->GetLinkImplementation(config); - for(std::vector::const_iterator + for(std::vector::const_iterator li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { if(emitted.insert(*li).second) @@ -6674,7 +6678,7 @@ void cmTarget::ComputeLinkImplementation(const std::string& config, // The entry is meant for this configuration. impl.Libraries.push_back( - cmLinkItem(name, this->FindTargetToLink(name))); + cmLinkImplItem(name, this->FindTargetToLink(name))); } std::set const& seenProps = cge->GetSeenTargetProperties(); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 9d1f966..8578c51 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -54,6 +54,16 @@ public: cmLinkItem(cmLinkItem const& r): std_string(r), Target(r.Target) {} cmTarget const* Target; }; +class cmLinkImplItem: public cmLinkItem +{ +public: + cmLinkImplItem(): cmLinkItem() {} + cmLinkImplItem(std::string const& n, + cmTarget const* t): + cmLinkItem(n, t) {} + cmLinkImplItem(cmLinkImplItem const& r): + cmLinkItem(r) {} +}; struct cmTargetLinkInformationMap: public std::map @@ -296,7 +306,7 @@ public: std::vector Languages; // Libraries linked directly in this configuration. - std::vector Libraries; + std::vector Libraries; // Libraries linked directly in other configurations. // Needed only for OLD behavior of CMP0003. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0e9f7a1e576ceb9e5c7f4933ec0cdd9c27dec529 commit 0e9f7a1e576ceb9e5c7f4933ec0cdd9c27dec529 Author: Brad King AuthorDate: Mon Jun 30 10:31:01 2014 -0400 Commit: Brad King CommitDate: Wed Jul 2 09:57:34 2014 -0400 cmGeneratorExpressionEvaluator: Shorten some long lines Adjust the definitions of getLinkedTargetsContent to avoid long lines. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index b648eb2..cf112ec 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -799,13 +799,14 @@ static const char* targetPropertyTransitiveWhitelist[] = { #undef TRANSITIVE_PROPERTY_NAME -std::string getLinkedTargetsContent( - std::vector &targets, - cmTarget const* target, - cmTarget const* headTarget, - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker, - const std::string &interfacePropertyName) +std::string +getLinkedTargetsContent( + std::vector &targets, + cmTarget const* target, + cmTarget const* headTarget, + cmGeneratorExpressionContext *context, + cmGeneratorExpressionDAGChecker *dagChecker, + const std::string &interfacePropertyName) { cmGeneratorExpression ge(&context->Backtrace); @@ -841,12 +842,14 @@ std::string getLinkedTargetsContent( return linkedTargetsContent; } -std::string getLinkedTargetsContent(std::vector const &libraries, - cmTarget const* target, - cmTarget const* headTarget, - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker, - const std::string &interfacePropertyName) +std::string +getLinkedTargetsContent( + std::vector const &libraries, + cmTarget const* target, + cmTarget const* headTarget, + cmGeneratorExpressionContext *context, + cmGeneratorExpressionDAGChecker *dagChecker, + const std::string &interfacePropertyName) { std::vector tgts; for (std::vector::const_iterator http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3cb21f27cab42789744ee383664fb11dcb8ac800 commit 3cb21f27cab42789744ee383664fb11dcb8ac800 Author: Brad King AuthorDate: Mon Jun 30 10:28:08 2014 -0400 Commit: Brad King CommitDate: Wed Jul 2 09:57:34 2014 -0400 cmComputeLinkDepends: Convert AddLinkEntries to a template Allow the method to be called with a vector of any type that can be converted to cmLinkItem. diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 6170e92..c13da50 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -553,15 +553,16 @@ void cmComputeLinkDepends::AddDirectLinkEntries() } //---------------------------------------------------------------------------- +template void cmComputeLinkDepends::AddLinkEntries( - int depender_index, std::vector const& libs) + int depender_index, std::vector const& libs) { // Track inferred dependency sets implied by this list. std::map dependSets; // Loop over the libraries linked directly by the depender. - for(std::vector::const_iterator li = libs.begin(); + for(typename std::vector::const_iterator li = libs.begin(); li != libs.end(); ++li) { // Skip entries that will resolve to the target getting linked or diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 3207ecb..a931726 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -80,8 +80,8 @@ private: int AddLinkEntry(cmLinkItem const& item); void AddVarLinkEntries(int depender_index, const char* value); void AddDirectLinkEntries(); - void AddLinkEntries(int depender_index, - std::vector const& libs); + template + void AddLinkEntries(int depender_index, std::vector const& libs); cmTarget const* FindTargetToLink(int depender_index, const std::string& name); ----------------------------------------------------------------------- Summary of changes: Source/cmComputeLinkDepends.cxx | 5 +- Source/cmComputeLinkDepends.h | 4 +- Source/cmComputeTargetDepends.cxx | 2 +- Source/cmGeneratorExpressionEvaluator.cxx | 31 +- Source/cmGeneratorTarget.cxx | 4 +- Source/cmTarget.cxx | 313 +++++--------------- Source/cmTarget.h | 16 +- .../CompatibleInterface/DebugProperties-stderr.txt | 14 +- .../Languages/LINK_LANGUAGE-genex-stderr.txt | 6 +- .../link-libraries-TARGET_FILE-genex-stderr.txt | 4 +- 10 files changed, 128 insertions(+), 271 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 2 10:39:39 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 2 Jul 2014 10:39:39 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4086-g402be9c Message-ID: <20140702143939.573E53044B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 402be9c58e49356d556b41dd01c8e66266d2b6fc (commit) via f33d875a844114945f3e698266639a63401f6ac1 (commit) from db98e04debb3b13fbacc3359edfb0b8047079513 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=402be9c58e49356d556b41dd01c8e66266d2b6fc commit 402be9c58e49356d556b41dd01c8e66266d2b6fc Merge: db98e04 f33d875 Author: Brad King AuthorDate: Wed Jul 2 10:39:38 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 2 10:39:38 2014 -0400 Merge topic 'ctest-S-message-STATUS' into next f33d875a CTest: Implement message(STATUS) output for 'ctest -S' scripts http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f33d875a844114945f3e698266639a63401f6ac1 commit f33d875a844114945f3e698266639a63401f6ac1 Author: Brad King AuthorDate: Wed Jul 2 10:23:23 2014 -0400 Commit: Brad King CommitDate: Wed Jul 2 10:39:30 2014 -0400 CTest: Implement message(STATUS) output for 'ctest -S' scripts Send status messages to the CTest HANDLER_OUTPUT log since they are part of the script handler output. This also ensures they appear inline with other test command handler output. diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 567acfc..f050148 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -317,6 +317,15 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg) return retVal; } +static void ctestScriptProgressCallback(const char *m, float, void* cd) +{ + cmCTest* ctest = static_cast(cd); + if(m && *m) + { + cmCTestLog(ctest, HANDLER_OUTPUT, "-- " << m << std::endl); + } +} + void cmCTestScriptHandler::CreateCMake() { // create a cmake instance to read the configuration script @@ -334,6 +343,8 @@ void cmCTestScriptHandler::CreateCMake() this->LocalGenerator = this->GlobalGenerator->CreateLocalGenerator(); this->Makefile = this->LocalGenerator->GetMakefile(); + this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest); + // Set CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR. // Also, some commands need Makefile->GetCurrentDirectory(). std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); ----------------------------------------------------------------------- Summary of changes: Source/CTest/cmCTestScriptHandler.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 2 10:39:46 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 2 Jul 2014 10:39:46 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4088-g93704c1 Message-ID: <20140702143946.E264030479@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 93704c1fe754edf720125be6992e404438ee8014 (commit) via 15e61f9bd96d528bc50217de1fcd8285fd033cf2 (commit) from 402be9c58e49356d556b41dd01c8e66266d2b6fc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=93704c1fe754edf720125be6992e404438ee8014 commit 93704c1fe754edf720125be6992e404438ee8014 Merge: 402be9c 15e61f9 Author: Brad King AuthorDate: Wed Jul 2 10:39:46 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 2 10:39:46 2014 -0400 Merge topic 'fix-CTestTestTimeout-output-order' into next 15e61f9b Tests: Fix CTestTestTimeout output order to match regex http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=15e61f9bd96d528bc50217de1fcd8285fd033cf2 commit 15e61f9bd96d528bc50217de1fcd8285fd033cf2 Author: Brad King AuthorDate: Wed Jul 2 10:37:42 2014 -0400 Commit: Brad King CommitDate: Wed Jul 2 10:40:17 2014 -0400 Tests: Fix CTestTestTimeout output order to match regex Print the "timeout correctly killed" message using message(STATUS) so that 'ctest -S' puts it in the same pipe as the rest of the test command handler output. This ensures it shows up in the same order every time. diff --git a/Tests/CTestTestTimeout/test.cmake.in b/Tests/CTestTestTimeout/test.cmake.in index 68c74d8..af53383 100644 --- a/Tests/CTestTestTimeout/test.cmake.in +++ b/Tests/CTestTestTimeout/test.cmake.in @@ -32,7 +32,7 @@ if(EXISTS "${log}") if(after_sleep) message(FATAL_ERROR "Log indicates timeout did not kill child.") else() - message("Log indicates timeout correctly killed child.") + message(STATUS "Log indicates timeout correctly killed child.") endif() else() message(FATAL_ERROR "Log does not exist:\n ${log}") ----------------------------------------------------------------------- Summary of changes: Tests/CTestTestTimeout/test.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From steveire at gmail.com Wed Jul 2 13:39:23 2014 From: steveire at gmail.com (Stephen Kelly) Date: Wed, 2 Jul 2014 13:39:23 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4090-gb723147 Message-ID: <20140702173924.176C430D2B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via b72314722defab702e034288f06941157206a668 (commit) via b47c125ff7f088c87183e6ad60850aefdaf43757 (commit) from 93704c1fe754edf720125be6992e404438ee8014 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b72314722defab702e034288f06941157206a668 commit b72314722defab702e034288f06941157206a668 Merge: 93704c1 b47c125 Author: Stephen Kelly AuthorDate: Wed Jul 2 13:39:22 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 2 13:39:22 2014 -0400 Merge topic 'WriteCompilerDetectionHeader-valid-prefix' into next b47c125f WCDH: Ensure that the prefix argument to the macro is valid. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b47c125ff7f088c87183e6ad60850aefdaf43757 commit b47c125ff7f088c87183e6ad60850aefdaf43757 Author: Stephen Kelly AuthorDate: Fri Jun 13 11:39:47 2014 +0200 Commit: Stephen Kelly CommitDate: Wed Jul 2 19:37:04 2014 +0200 WCDH: Ensure that the prefix argument to the macro is valid. The prefix must be a C-identifier because it is written as the prefix of preprocessor macros and possibly structs. diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index 593176c..86137e2 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -235,6 +235,14 @@ function(write_compiler_detection_header message(FATAL_ERROR "Unparsed arguments: ${_WCD_UNPARSED_ARGUMENTS}") endif() + if (prefix_arg STREQUAL "") + message(FATAL_ERROR "A prefix must be specified") + endif() + string(MAKE_C_IDENTIFIER ${prefix_arg} cleaned_prefix) + if (NOT prefix_arg STREQUAL cleaned_prefix) + message(FATAL_ERROR "The prefix must be a valid C identifier.") + endif() + if(NOT _WCD_VERSION) set(_WCD_VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION}) endif() diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt new file mode 100644 index 0000000..cf8578e --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*/Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + A prefix must be specified +Call Stack \(most recent call first\): + EmptyPrefix.cmake:[0-9]+ \(write_compiler_detection_header\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix.cmake new file mode 100644 index 0000000..eda6b18 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix.cmake @@ -0,0 +1,10 @@ + +include(WriteCompilerDetectionHeader) + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile" + PREFIX "" + VERSION 3.1 + COMPILERS GNU + FEATURES cxx_final +) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt new file mode 100644 index 0000000..ea1bf67 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*/Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + The prefix must be a valid C identifier. +Call Stack \(most recent call first\): + InvalidPrefix.cmake:[0-9]+ \(write_compiler_detection_header\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix.cmake new file mode 100644 index 0000000..6599f35 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix.cmake @@ -0,0 +1,10 @@ + +include(WriteCompilerDetectionHeader) + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile" + PREFIX "0compile" + VERSION 3.1 + COMPILERS GNU + FEATURES cxx_final +) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake index be79d41..6dded44 100644 --- a/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake @@ -10,3 +10,5 @@ run_cmake(OldVersion) run_cmake(InvalidCompiler) run_cmake(InvalidFeature) run_cmake(InvalidCXXFeature) +run_cmake(EmptyPrefix) +run_cmake(InvalidPrefix) ----------------------------------------------------------------------- Summary of changes: Modules/WriteCompilerDetectionHeader.cmake | 8 ++++++++ .../EmptyPrefix-result.txt} | 0 .../WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt | 5 +++++ .../{ExtraArgs.cmake => EmptyPrefix.cmake} | 4 ++-- .../InvalidPrefix-result.txt} | 0 .../WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt | 5 +++++ .../{ExtraArgs.cmake => InvalidPrefix.cmake} | 4 ++-- Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake | 2 ++ 8 files changed, 24 insertions(+), 4 deletions(-) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => WriteCompilerDetectionHeader/EmptyPrefix-result.txt} (100%) create mode 100644 Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt copy Tests/RunCMake/WriteCompilerDetectionHeader/{ExtraArgs.cmake => EmptyPrefix.cmake} (85%) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => WriteCompilerDetectionHeader/InvalidPrefix-result.txt} (100%) create mode 100644 Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt copy Tests/RunCMake/WriteCompilerDetectionHeader/{ExtraArgs.cmake => InvalidPrefix.cmake} (82%) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 3 00:01:13 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 3 Jul 2014 00:01:13 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1303-g6d1ad67 Message-ID: <20140703040113.A565D32AE7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 6d1ad670771271bbdd7e3ff3bfa19474049cc139 (commit) from 477b07213a806c825f95fdfacd444028e1783dc2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6d1ad670771271bbdd7e3ff3bfa19474049cc139 commit 6d1ad670771271bbdd7e3ff3bfa19474049cc139 Author: Kitware Robot AuthorDate: Thu Jul 3 00:01:12 2014 -0400 Commit: Kitware Robot CommitDate: Thu Jul 3 00:01:12 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 27405be..0677d51 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140702) +set(CMake_VERSION_PATCH 20140703) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 3 10:15:18 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 3 Jul 2014 10:15:18 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4092-g3ecd134 Message-ID: <20140703141518.D34753242B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 3ecd1347b54bbfa2745880de9631f86ae4b90305 (commit) via a74dd22288761fc0056c6400ed45a50bbd6f8a81 (commit) from b72314722defab702e034288f06941157206a668 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3ecd1347b54bbfa2745880de9631f86ae4b90305 commit 3ecd1347b54bbfa2745880de9631f86ae4b90305 Merge: b723147 a74dd22 Author: Brad King AuthorDate: Thu Jul 3 10:15:18 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 3 10:15:18 2014 -0400 Merge topic 'refactor-usage-requirement-evaluation' into next a74dd222 cmTarget: Workaround old compiler bugs in vector<>::insert http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a74dd22288761fc0056c6400ed45a50bbd6f8a81 commit a74dd22288761fc0056c6400ed45a50bbd6f8a81 Author: Brad King AuthorDate: Thu Jul 3 09:18:16 2014 -0400 Commit: Brad King CommitDate: Thu Jul 3 09:28:40 2014 -0400 cmTarget: Workaround old compiler bugs in vector<>::insert Sun CC 5.9 and VS 6 have trouble inserting at the end of a vector when a type conversion is required. Use std::copy with std::back_inserter instead. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 94da3c2..0a7724c 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6193,9 +6193,8 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, // The link implementation is the default link interface. LinkImplementation const* impl = this->GetLinkImplementationLibrariesInternal(config, headTarget); - iface.Libraries.insert(iface.Libraries.end(), - impl->Libraries.begin(), - impl->Libraries.end()); + std::copy(impl->Libraries.begin(), impl->Libraries.end(), + std::back_inserter(iface.Libraries)); if(this->PolicyStatusCMP0022 == cmPolicies::WARN && !this->Internal->PolicyWarnedCMP0022 && !usage_requirements_only) { ----------------------------------------------------------------------- Summary of changes: Source/cmTarget.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From ben.boeckel at kitware.com Thu Jul 3 10:24:20 2014 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Thu, 3 Jul 2014 10:24:20 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4095-g436841e Message-ID: <20140703142420.3EC513308A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 436841e506cc7590c7558dcd0d38acb1532aaac3 (commit) via 5ca1d3d59c9a0c7df7db335fe225896480e4873f (commit) via 6d1ad670771271bbdd7e3ff3bfa19474049cc139 (commit) from 3ecd1347b54bbfa2745880de9631f86ae4b90305 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=436841e506cc7590c7558dcd0d38acb1532aaac3 commit 436841e506cc7590c7558dcd0d38acb1532aaac3 Merge: 3ecd134 5ca1d3d Author: Ben Boeckel AuthorDate: Thu Jul 3 10:24:19 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 3 10:24:19 2014 -0400 Merge topic 'dev/export-from-obj-libs' into next 5ca1d3d5 GenerateExportHeader: support exporting from OBJECT libraries 6d1ad670 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5ca1d3d59c9a0c7df7db335fe225896480e4873f commit 5ca1d3d59c9a0c7df7db335fe225896480e4873f Author: Ben Boeckel AuthorDate: Thu Jul 3 10:23:40 2014 -0400 Commit: Ben Boeckel CommitDate: Thu Jul 3 10:23:40 2014 -0400 GenerateExportHeader: support exporting from OBJECT libraries diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 66d300a..f00b577 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -363,6 +363,7 @@ function(GENERATE_EXPORT_HEADER TARGET_LIBRARY) get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE) if(NOT ${type} STREQUAL "STATIC_LIBRARY" AND NOT ${type} STREQUAL "SHARED_LIBRARY" + AND NOT ${type} STREQUAL "OBJECT_LIBRARY" AND NOT ${type} STREQUAL "MODULE_LIBRARY") message(WARNING "This macro can only be used with libraries") return() ----------------------------------------------------------------------- Summary of changes: Modules/GenerateExportHeader.cmake | 1 + Source/CMakeVersion.cmake | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From eike at sf-mail.de Thu Jul 3 12:14:05 2014 From: eike at sf-mail.de (Rolf Eike Beer) Date: Thu, 3 Jul 2014 12:14:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4097-g0ee0028 Message-ID: <20140703161405.052203247D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 0ee0028503b8d94804fd4f22ee443621e9137d52 (commit) via 92af3664c922b4b3127700c426a01ab5fec097b8 (commit) from 436841e506cc7590c7558dcd0d38acb1532aaac3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0ee0028503b8d94804fd4f22ee443621e9137d52 commit 0ee0028503b8d94804fd4f22ee443621e9137d52 Merge: 436841e 92af366 Author: Rolf Eike Beer AuthorDate: Thu Jul 3 12:14:03 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 3 12:14:03 2014 -0400 Merge topic 'ExternalProject_test' into next 92af3664 Tests: split the ExternalProject test http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=92af3664c922b4b3127700c426a01ab5fec097b8 commit 92af3664c922b4b3127700c426a01ab5fec097b8 Author: Rolf Eike Beer AuthorDate: Thu Jul 3 18:11:49 2014 +0200 Commit: Rolf Eike Beer CommitDate: Thu Jul 3 18:12:08 2014 +0200 Tests: split the ExternalProject test Move the subtests that test with local projects into their own test. The reason is that on slower or crowded machines the test may reach the limit of 25 minutes and therefore fail while it would pass if it was given enough time. The split is roughly 3:1 with regard to the execution time, with the new ExternalProjectLocal test being the faster one. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index cb455e0..dc4f894 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1249,6 +1249,21 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set_tests_properties(ExternalProject PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) + add_test(ExternalProjectLocal ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/ExternalProjectLocal" + "${CMake_BINARY_DIR}/Tests/ExternalProjectLocal" + ${build_generator_args} + --build-project ExternalProjectLocalTest + --build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProjectLocal" + --force-new-ctest-process + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectLocal") + set_tests_properties(ExternalProjectLocal PROPERTIES + TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) + add_test(ExternalProjectUpdateSetup ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate" diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index 0ed5561..2f74121 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -3,6 +3,8 @@ project(ExternalProjectTest NONE) include(ExternalProject) +# Test ExternalProject, especially with checkouts from VCS + find_package(CVS) find_package(Subversion) find_package(Git) @@ -23,33 +25,6 @@ set(binary_base "${base}/Build") set_property(DIRECTORY PROPERTY EP_BASE ${base}) set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test) -if(NOT DEFINED can_build_tutorial_step5) - set(can_build_tutorial_step5 1) - - # Tutorial Step5 cannot build correctly using Visual Studio 6 - # on Windows 98 if the path of its build tree exceeds 72 - # characters in length... So don't attempt to build it - # in a long path on Win98: - # - if(CMAKE_SYSTEM STREQUAL "Windows-4.10") - string(LENGTH "${binary_base}/TutorialStep5-Local" n) - if(n GREATER 72) - set(can_build_tutorial_step5 0) - endif() - endif() - - # The ExternalProject builds of Tutorial Step5 cannot be built - # correctly 2nd and later times in an in-source build... - # (because the CMakeCache.txt from the real in-source build of - # the Tests/Tutorial/Step5 directory gets copied when we do - # the "source directory copy" step... but it still refers to - # its original path which yields a configure error.) So: - # - if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") - set(can_build_tutorial_step5 0) - endif() -endif() - add_custom_target(NonExternalProjectTarget COMMAND ${CMAKE_COMMAND} -E echo NonExternalProjectTarget) @@ -116,142 +91,6 @@ ExternalProject_Add(${proj} set_property(TARGET ${proj} PROPERTY FOLDER "") -# Local DIR: -# -if(can_build_tutorial_step5) - set(proj TutorialStep5-Local) - ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" - CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= - CMAKE_ARGS -G ${CMAKE_GENERATOR} - TEST_BEFORE_INSTALL 1 - LOG_INSTALL 1 - ) - set_property(TARGET ${proj} PROPERTY FOLDER "Local") - ExternalProject_Get_Property(${proj} install_dir) - set(TutorialStep5_install_dir ${install_dir}) - - set(proj TutorialStep5-Local-TestAfterInstall) - ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -G ${CMAKE_GENERATOR} - TEST_AFTER_INSTALL 1 - LOG_TEST 1 - ) - set_property(TARGET ${proj} PROPERTY FOLDER "Local") -endif() - - -# Local TAR: -# -set(proj TutorialStep1-LocalTAR) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar" - URL_MD5 a87c5b47c0201c09ddfe1d5738fdb1e3 - LIST_SEPARATOR :: - PATCH_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake - CMAKE_GENERATOR "${CMAKE_GENERATOR}" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= - -DTEST_LIST:STRING=A::B::C - INSTALL_COMMAND "" - LOG_CONFIGURE 1 -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/TAR") - -set(proj TutorialStep1-LocalNoDirTAR) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar" - URL_MD5 d09e3d370c5c908fa035c30939ee438e - LIST_SEPARATOR @@ - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -G ${CMAKE_GENERATOR} - -DTEST_LIST:STRING=1@@2@@3 - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/TAR") -ExternalProject_Add_Step(${proj} mypatch - COMMAND ${CMAKE_COMMAND} -E echo "This is a custom external project step." - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake - WORKING_DIRECTORY - DEPENDEES download - DEPENDERS configure - ) - - -# Local TGZ: -# -set(proj TutorialStep1-LocalTGZ) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tgz" - URL_MD5 38c648e817339c356f6be00eeed79bd0 - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -G ${CMAKE_GENERATOR} - INSTALL_COMMAND "" - LOG_BUILD 1 -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ") - -set(proj TutorialStep1-LocalNoDirTGZ) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tgz" - URL_HASH SHA256=496229e2a5ed620a37c385ad9406004a18026beab8b55dd2c4565d4b7f1d5383 - CMAKE_GENERATOR "${CMAKE_GENERATOR}" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ") - - -# Local BZ2: -# -# (The bz2 tests are here just to verify that the bz2 decompression is executed -# during a test suite run... The configure and build commands are set to -# nothing to make the test quicker. To make this more complete, I should add -# a diff between this and the TGZ source tree since that one does build...) -# -set(proj TutorialStep1-LocalBZ2) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar.bz2" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/BZ2") - -set(proj TutorialStep1-LocalNoDirBZ2) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar.bz2" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/BZ2") - - -# Local ZIP: -# -# (The zip tests are here just to verify that the zip decompression is executed -# during a test suite run... The configure and build commands are set to -# nothing to make the test quicker. To make this more complete, I should add -# a diff between this and the TGZ source tree since that one does build...) -# -set(proj TutorialStep1-LocalZIP) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.zip" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/ZIP") - -set(proj TutorialStep1-LocalNoDirZIP) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.zip" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/ZIP") - - # CVS-based tests: # set(do_cvs_tests 0) @@ -337,10 +176,6 @@ if(do_cvs_tests) INSTALL_COMMAND "" DEPENDS "SetupLocalCVSRepository" DEPENDS "EmptyNoOpProject" - DEPENDS "TutorialStep1-LocalTAR" - DEPENDS "TutorialStep1-LocalNoDirTAR" - DEPENDS "TutorialStep1-LocalTGZ" - DEPENDS "TutorialStep1-LocalNoDirTGZ" DEPENDS "TutorialStep1-CVS-20090626" DEPENDS "TutorialStep1-CVS-testtag1" ) @@ -612,29 +447,6 @@ enable_testing() # # BuildTree tests: # -if(can_build_tutorial_step5) - add_test(TutorialStep5-Local-BuildTreeTest - "${binary_base}/TutorialStep5-Local/Tutorial" 42) - set_property(TEST TutorialStep5-Local-BuildTreeTest - APPEND PROPERTY LABELS Step5 BuildTree) -endif() - -add_test(TutorialStep1-LocalTAR-BuildTreeTest - "${binary_base}/TutorialStep1-LocalTAR/EP-Tutorial" 36) -set_property(TEST TutorialStep1-LocalTAR-BuildTreeTest - APPEND PROPERTY LABELS TAR) - -add_test(TutorialStep1-LocalNoDirTAR-BuildTreeTest - "${binary_base}/TutorialStep1-LocalNoDirTAR/EP-Tutorial" 25) - -add_test(TutorialStep1-LocalTGZ-BuildTreeTest - "${binary_base}/TutorialStep1-LocalTGZ/Tutorial" 16) -set_property(TEST TutorialStep1-LocalTGZ-BuildTreeTest - APPEND PROPERTY LABELS TGZ) - -add_test(TutorialStep1-LocalNoDirTGZ-BuildTreeTest - "${binary_base}/TutorialStep1-LocalNoDirTGZ/Tutorial" 9) - if(do_cvs_tests) add_test(TutorialStep1-CVS-20090626-BuildTreeTest "${binary_base}/TutorialStep1-CVS-20090626/Tutorial" 4) @@ -669,17 +481,6 @@ if(do_git_tests) endif() -# InstallTree tests: -# -if(can_build_tutorial_step5) - add_test(TutorialStep5-InstallTreeTest - "${TutorialStep5_install_dir}/bin/Tutorial" 49) - set_property(TEST TutorialStep5-InstallTreeTest - APPEND PROPERTY LABELS Step5 InstallTree) -endif() - - -message(STATUS "can_build_tutorial_step5='${can_build_tutorial_step5}'") message(STATUS "do_cvs_tests='${do_cvs_tests}'") message(STATUS "do_svn_tests='${do_svn_tests}'") message(STATUS "do_git_tests='${do_git_tests}' GIT_EXECUTABLE='${GIT_EXECUTABLE}'") diff --git a/Tests/ExternalProjectLocal/CMakeLists.txt b/Tests/ExternalProjectLocal/CMakeLists.txt new file mode 100644 index 0000000..f942197 --- /dev/null +++ b/Tests/ExternalProjectLocal/CMakeLists.txt @@ -0,0 +1,229 @@ +cmake_minimum_required(VERSION 2.8) +project(ExternalProjectLocalTest NONE) + +include(ExternalProject) + +# Test ExternalProject with local projects + +option(ExternalProjectTest_USE_FOLDERS "Enable folder grouping in IDEs." ON) +if(ExternalProjectTest_USE_FOLDERS) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) +else() + set_property(GLOBAL PROPERTY USE_FOLDERS OFF) +endif() + +set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER + "CMakePredefinedTargets-in-ExternalProjectTest") + +set(base "${CMAKE_BINARY_DIR}/CMakeExternals") +set(binary_base "${base}/Build") +set_property(DIRECTORY PROPERTY EP_BASE ${base}) +set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test) + +if(NOT DEFINED can_build_tutorial_step5) + set(can_build_tutorial_step5 1) + + # Tutorial Step5 cannot build correctly using Visual Studio 6 + # on Windows 98 if the path of its build tree exceeds 72 + # characters in length... So don't attempt to build it + # in a long path on Win98: + # + if(CMAKE_SYSTEM STREQUAL "Windows-4.10") + string(LENGTH "${binary_base}/TutorialStep5-Local" n) + if(n GREATER 72) + set(can_build_tutorial_step5 0) + endif() + endif() + + # The ExternalProject builds of Tutorial Step5 cannot be built + # correctly 2nd and later times in an in-source build... + # (because the CMakeCache.txt from the real in-source build of + # the Tests/Tutorial/Step5 directory gets copied when we do + # the "source directory copy" step... but it still refers to + # its original path which yields a configure error.) So: + # + if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") + set(can_build_tutorial_step5 0) + endif() +endif() + +# Local DIR: +# +if(can_build_tutorial_step5) + set(proj TutorialStep5-Local) + ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" + CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= + CMAKE_ARGS -G ${CMAKE_GENERATOR} + TEST_BEFORE_INSTALL 1 + LOG_INSTALL 1 + ) + set_property(TARGET ${proj} PROPERTY FOLDER "Local") + ExternalProject_Get_Property(${proj} install_dir) + set(TutorialStep5_install_dir ${install_dir}) + + set(proj TutorialStep5-Local-TestAfterInstall) + ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -G ${CMAKE_GENERATOR} + TEST_AFTER_INSTALL 1 + LOG_TEST 1 + ) + set_property(TARGET ${proj} PROPERTY FOLDER "Local") +endif() + + +# Local TAR: +# +set(proj TutorialStep1-LocalTAR) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar" + URL_MD5 a87c5b47c0201c09ddfe1d5738fdb1e3 + LIST_SEPARATOR :: + PATCH_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= + -DTEST_LIST:STRING=A::B::C + INSTALL_COMMAND "" + LOG_CONFIGURE 1 +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/TAR") + +set(proj TutorialStep1-LocalNoDirTAR) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar" + URL_MD5 d09e3d370c5c908fa035c30939ee438e + LIST_SEPARATOR @@ + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -G ${CMAKE_GENERATOR} + -DTEST_LIST:STRING=1@@2@@3 + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/TAR") +ExternalProject_Add_Step(${proj} mypatch + COMMAND ${CMAKE_COMMAND} -E echo "This is a custom external project step." + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake + WORKING_DIRECTORY + DEPENDEES download + DEPENDERS configure + ) + + +# Local TGZ: +# +set(proj TutorialStep1-LocalTGZ) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tgz" + URL_MD5 38c648e817339c356f6be00eeed79bd0 + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -G ${CMAKE_GENERATOR} + INSTALL_COMMAND "" + LOG_BUILD 1 +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ") + +set(proj TutorialStep1-LocalNoDirTGZ) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tgz" + URL_HASH SHA256=496229e2a5ed620a37c385ad9406004a18026beab8b55dd2c4565d4b7f1d5383 + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ") + + +# Local BZ2: +# +# (The bz2 tests are here just to verify that the bz2 decompression is executed +# during a test suite run... The configure and build commands are set to +# nothing to make the test quicker. To make this more complete, I should add +# a diff between this and the TGZ source tree since that one does build...) +# +set(proj TutorialStep1-LocalBZ2) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar.bz2" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/BZ2") + +set(proj TutorialStep1-LocalNoDirBZ2) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar.bz2" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/BZ2") + + +# Local ZIP: +# +# (The zip tests are here just to verify that the zip decompression is executed +# during a test suite run... The configure and build commands are set to +# nothing to make the test quicker. To make this more complete, I should add +# a diff between this and the TGZ source tree since that one does build...) +# +set(proj TutorialStep1-LocalZIP) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.zip" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/ZIP") + +set(proj TutorialStep1-LocalNoDirZIP) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.zip" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/ZIP") + + +# Test the testable built/installed products: +# +enable_testing() + + +# Do at least a smoke test of a built executable from each +# project's build directory... +# +# BuildTree tests: +# +if(can_build_tutorial_step5) + add_test(TutorialStep5-Local-BuildTreeTest + "${binary_base}/TutorialStep5-Local/Tutorial" 42) + set_property(TEST TutorialStep5-Local-BuildTreeTest + APPEND PROPERTY LABELS Step5 BuildTree) +endif() + +add_test(TutorialStep1-LocalTAR-BuildTreeTest + "${binary_base}/TutorialStep1-LocalTAR/EP-Tutorial" 36) +set_property(TEST TutorialStep1-LocalTAR-BuildTreeTest + APPEND PROPERTY LABELS TAR) + +add_test(TutorialStep1-LocalNoDirTAR-BuildTreeTest + "${binary_base}/TutorialStep1-LocalNoDirTAR/EP-Tutorial" 25) + +add_test(TutorialStep1-LocalTGZ-BuildTreeTest + "${binary_base}/TutorialStep1-LocalTGZ/Tutorial" 16) +set_property(TEST TutorialStep1-LocalTGZ-BuildTreeTest + APPEND PROPERTY LABELS TGZ) + +add_test(TutorialStep1-LocalNoDirTGZ-BuildTreeTest + "${binary_base}/TutorialStep1-LocalNoDirTGZ/Tutorial" 9) + +# InstallTree tests: +# +if(can_build_tutorial_step5) + add_test(TutorialStep5-InstallTreeTest + "${TutorialStep5_install_dir}/bin/Tutorial" 49) + set_property(TEST TutorialStep5-InstallTreeTest + APPEND PROPERTY LABELS Step5 InstallTree) +endif() + + +message(STATUS "can_build_tutorial_step5='${can_build_tutorial_step5}'") diff --git a/Tests/ExternalProject/Step1.tar b/Tests/ExternalProjectLocal/Step1.tar similarity index 100% rename from Tests/ExternalProject/Step1.tar rename to Tests/ExternalProjectLocal/Step1.tar diff --git a/Tests/ExternalProject/Step1.tar.bz2 b/Tests/ExternalProjectLocal/Step1.tar.bz2 similarity index 100% rename from Tests/ExternalProject/Step1.tar.bz2 rename to Tests/ExternalProjectLocal/Step1.tar.bz2 diff --git a/Tests/ExternalProject/Step1.tgz b/Tests/ExternalProjectLocal/Step1.tgz similarity index 100% rename from Tests/ExternalProject/Step1.tgz rename to Tests/ExternalProjectLocal/Step1.tgz diff --git a/Tests/ExternalProject/Step1.zip b/Tests/ExternalProjectLocal/Step1.zip similarity index 100% rename from Tests/ExternalProject/Step1.zip rename to Tests/ExternalProjectLocal/Step1.zip diff --git a/Tests/ExternalProject/Step1NoDir.tar b/Tests/ExternalProjectLocal/Step1NoDir.tar similarity index 100% rename from Tests/ExternalProject/Step1NoDir.tar rename to Tests/ExternalProjectLocal/Step1NoDir.tar diff --git a/Tests/ExternalProject/Step1NoDir.tar.bz2 b/Tests/ExternalProjectLocal/Step1NoDir.tar.bz2 similarity index 100% rename from Tests/ExternalProject/Step1NoDir.tar.bz2 rename to Tests/ExternalProjectLocal/Step1NoDir.tar.bz2 diff --git a/Tests/ExternalProject/Step1NoDir.tgz b/Tests/ExternalProjectLocal/Step1NoDir.tgz similarity index 100% rename from Tests/ExternalProject/Step1NoDir.tgz rename to Tests/ExternalProjectLocal/Step1NoDir.tgz diff --git a/Tests/ExternalProject/Step1NoDir.zip b/Tests/ExternalProjectLocal/Step1NoDir.zip similarity index 100% rename from Tests/ExternalProject/Step1NoDir.zip rename to Tests/ExternalProjectLocal/Step1NoDir.zip diff --git a/Tests/ExternalProject/Step1Patch.cmake b/Tests/ExternalProjectLocal/Step1Patch.cmake similarity index 100% rename from Tests/ExternalProject/Step1Patch.cmake rename to Tests/ExternalProjectLocal/Step1Patch.cmake ----------------------------------------------------------------------- Summary of changes: Tests/CMakeLists.txt | 15 ++ Tests/ExternalProject/CMakeLists.txt | 203 +---------------- Tests/ExternalProjectLocal/CMakeLists.txt | 229 ++++++++++++++++++++ .../Step1.tar | Bin 5632 -> 5632 bytes .../Step1.tar.bz2 | Bin 904 -> 904 bytes .../Step1.tgz | Bin 791 -> 791 bytes .../Step1.zip | Bin 1074 -> 1074 bytes .../Step1NoDir.tar | Bin 5120 -> 5120 bytes .../Step1NoDir.tar.bz2 | Bin 852 -> 852 bytes .../Step1NoDir.tgz | Bin 770 -> 770 bytes .../Step1NoDir.zip | Bin 1038 -> 1038 bytes .../Step1Patch.cmake | 0 12 files changed, 246 insertions(+), 201 deletions(-) create mode 100644 Tests/ExternalProjectLocal/CMakeLists.txt rename Tests/{ExternalProject => ExternalProjectLocal}/Step1.tar (100%) rename Tests/{ExternalProject => ExternalProjectLocal}/Step1.tar.bz2 (100%) rename Tests/{ExternalProject => ExternalProjectLocal}/Step1.tgz (100%) rename Tests/{ExternalProject => ExternalProjectLocal}/Step1.zip (100%) rename Tests/{ExternalProject => ExternalProjectLocal}/Step1NoDir.tar (100%) rename Tests/{ExternalProject => ExternalProjectLocal}/Step1NoDir.tar.bz2 (100%) rename Tests/{ExternalProject => ExternalProjectLocal}/Step1NoDir.tgz (100%) rename Tests/{ExternalProject => ExternalProjectLocal}/Step1NoDir.zip (100%) rename Tests/{ExternalProject => ExternalProjectLocal}/Step1Patch.cmake (100%) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jul 4 00:01:27 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 4 Jul 2014 00:01:27 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1304-g256bf34 Message-ID: <20140704040128.0FBE932C05@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 256bf34ef9a0a8e83381ac94a56b9bf96693f89d (commit) from 6d1ad670771271bbdd7e3ff3bfa19474049cc139 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=256bf34ef9a0a8e83381ac94a56b9bf96693f89d commit 256bf34ef9a0a8e83381ac94a56b9bf96693f89d Author: Kitware Robot AuthorDate: Fri Jul 4 00:01:24 2014 -0400 Commit: Kitware Robot CommitDate: Fri Jul 4 00:01:24 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0677d51..744dc41 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140703) +set(CMake_VERSION_PATCH 20140704) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sat Jul 5 00:01:30 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 5 Jul 2014 00:01:30 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1305-gaafef59 Message-ID: <20140705040130.2291537F82@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via aafef594bf9caabb9c19b1e6c931f15a7c09459e (commit) from 256bf34ef9a0a8e83381ac94a56b9bf96693f89d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aafef594bf9caabb9c19b1e6c931f15a7c09459e commit aafef594bf9caabb9c19b1e6c931f15a7c09459e Author: Kitware Robot AuthorDate: Sat Jul 5 00:01:08 2014 -0400 Commit: Kitware Robot CommitDate: Sat Jul 5 00:01:08 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 744dc41..6eb57cb 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140704) +set(CMake_VERSION_PATCH 20140705) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Jul 6 00:01:35 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 6 Jul 2014 00:01:35 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1306-gfdfb3a1 Message-ID: <20140706040135.EC4EF3993A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via fdfb3a1e8631bcf4eeef8cd719ba99c4b8f9b3c5 (commit) from aafef594bf9caabb9c19b1e6c931f15a7c09459e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fdfb3a1e8631bcf4eeef8cd719ba99c4b8f9b3c5 commit fdfb3a1e8631bcf4eeef8cd719ba99c4b8f9b3c5 Author: Kitware Robot AuthorDate: Sun Jul 6 00:01:13 2014 -0400 Commit: Kitware Robot CommitDate: Sun Jul 6 00:01:13 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6eb57cb..97af7ac 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140705) +set(CMake_VERSION_PATCH 20140706) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 7 00:01:38 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 7 Jul 2014 00:01:38 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1307-gd39e7f1 Message-ID: <20140707040138.16F81395BE@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via d39e7f1259abe3057f057445b62d3aaf0b0961a1 (commit) from fdfb3a1e8631bcf4eeef8cd719ba99c4b8f9b3c5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d39e7f1259abe3057f057445b62d3aaf0b0961a1 commit d39e7f1259abe3057f057445b62d3aaf0b0961a1 Author: Kitware Robot AuthorDate: Mon Jul 7 00:01:07 2014 -0400 Commit: Kitware Robot CommitDate: Mon Jul 7 00:01:07 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 97af7ac..8321e0a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140706) +set(CMake_VERSION_PATCH 20140707) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 08:47:06 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 08:47:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4102-gdda1412 Message-ID: <20140707124706.150CD38A1C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via dda1412ca0ced365f48d8ce8cc1df0af490e2398 (commit) via d39e7f1259abe3057f057445b62d3aaf0b0961a1 (commit) via fdfb3a1e8631bcf4eeef8cd719ba99c4b8f9b3c5 (commit) via aafef594bf9caabb9c19b1e6c931f15a7c09459e (commit) via 256bf34ef9a0a8e83381ac94a56b9bf96693f89d (commit) from 0ee0028503b8d94804fd4f22ee443621e9137d52 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dda1412ca0ced365f48d8ce8cc1df0af490e2398 commit dda1412ca0ced365f48d8ce8cc1df0af490e2398 Merge: 0ee0028 d39e7f1 Author: Brad King AuthorDate: Mon Jul 7 08:48:16 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 08:48:16 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 08:54:18 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 08:54:18 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4115-g5be1d3d Message-ID: <20140707125418.BB32B38F46@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 5be1d3d4f1f62492e826a9b05f4171d1d88c24b6 (commit) via 93790506f52cb4e420be6a1a6988613380ecb1bc (commit) via b5b098ebb39c97f3420eb7c24f0d4d5bc2d15a5a (commit) via 5e07dcf7c8e884380e1ad5ab64ba3bcdef601eee (commit) via f77b384cf6a4e9206e6067b7bfe0677a962268c4 (commit) via 61ef8daad5d15256daec08eeb0437fdece330001 (commit) via d9586f83f11f56d8d9f88892f543918f50e9525c (commit) via 3156275bc74e355f8309617344693a0f14b7a370 (commit) via 363cd33ebe5a8fb495fffc07cf39c59082e83bbf (commit) via 251e835b3f7320f0099d003de5a675af58e62e46 (commit) via 848c8ccf18e325e0d2833ac468f733261832feca (commit) via f85ccf23eeec08fff46c0788b8ee357b3f5220e4 (commit) via 82e91e34872fd8fa394d14f1e4fac60f9e993a35 (commit) from dda1412ca0ced365f48d8ce8cc1df0af490e2398 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5be1d3d4f1f62492e826a9b05f4171d1d88c24b6 commit 5be1d3d4f1f62492e826a9b05f4171d1d88c24b6 Merge: dda1412 9379050 Author: Brad King AuthorDate: Mon Jul 7 08:54:16 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 7 08:54:16 2014 -0400 Merge topic 'refactor-usage-requirement-evaluation' into next 93790506 cmTarget: Simplify INTERFACE_INCLUDE_DIRECTORIES usage requirement lookup b5b098eb cmTarget: Simplify CMP0027 logic in processIncludeDirectories 5e07dcf7 cmTarget: Add to LinkImplementation whether each library was a genex f77b384c cmTarget: Simplify INTERFACE_COMPILE_FEATURES usage requirement lookup 61ef8daa cmTarget: Simplify INTERFACE_COMPILE_DEFINITIONS usage requirement lookup d9586f83 cmTarget: Simplify INTERFACE_COMPILE_OPTIONS usage requirement lookup 3156275b cmTarget: Simplify INTERFACE_SOURCES usage requirement lookup 363cd33e cmTarget: Add method to add usage requirements from linked interfaces 251e835b cmTarget: Add to LinkImplementation a backtrace for each library 848c8ccf cmTarget: Refactor LinkImplementation to allow more information f85ccf23 cmGeneratorExpressionEvaluator: Shorten some long lines 82e91e34 cmComputeLinkDepends: Convert AddLinkEntries to a template http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=93790506f52cb4e420be6a1a6988613380ecb1bc commit 93790506f52cb4e420be6a1a6988613380ecb1bc Author: Brad King AuthorDate: Mon Jun 30 13:23:49 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 08:52:42 2014 -0400 cmTarget: Simplify INTERFACE_INCLUDE_DIRECTORIES usage requirement lookup Use the AddInterfaceEntries helper to avoid duplication. In TargetPropertyEntry, replace the TargetName string member with a reference to the full cmLinkImplItem that produced the entry. This is possible because the cmLinkImplItem is available in AddInterfaceEntries (it was not available in GetIncludeDirectories). Having the full cmLinkImplItem allows processIncludeDirectories to implement CMP0027 OLD behavior without repeating the target name lookup. Update the RunCMake.CompatibleInterface test DebugProperties case expected output for the new order of the messages. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0c96c91..0a7724c 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -165,14 +165,16 @@ public: std::set UtilityItems; bool UtilityItemsDone; - struct TargetPropertyEntry { + class TargetPropertyEntry { + static cmLinkImplItem NoLinkImplItem; + public: TargetPropertyEntry(cmsys::auto_ptr cge, - const std::string &targetName = std::string()) - : ge(cge), TargetName(targetName) + cmLinkImplItem const& item = NoLinkImplItem) + : ge(cge), LinkImplItem(item) {} const cmsys::auto_ptr ge; std::vector CachedEntries; - const std::string TargetName; + cmLinkImplItem const& LinkImplItem; }; std::vector IncludeDirectoriesEntries; std::vector CompileOptionsEntries; @@ -206,6 +208,8 @@ public: std::map CacheLinkImplementationClosureDone; }; +cmLinkImplItem cmTargetInternals::TargetPropertyEntry::NoLinkImplItem; + //---------------------------------------------------------------------------- void deleteAndClear( std::vector &entries) @@ -2012,24 +2016,10 @@ static void processIncludeDirectories(cmTarget const* tgt, for (std::vector::const_iterator it = entries.begin(), end = entries.end(); it != end; ++it) { - std::string targetName = (*it)->TargetName; - bool checkCMP0027 = false; - if(!cmGeneratorExpression::IsValidTargetName(targetName) - && cmGeneratorExpression::Find(targetName) != std::string::npos) - { - std::string evaluatedTargetName; - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(targetName); - evaluatedTargetName = cge->Evaluate(mf, config, false, tgt, 0, 0); - checkCMP0027 = evaluatedTargetName != targetName; - targetName = evaluatedTargetName; - } - cmTarget *dependentTarget = mf->FindTargetToUse(targetName); - - const bool fromImported = - dependentTarget && dependentTarget->IsImported(); - + cmLinkImplItem const& item = (*it)->LinkImplItem; + std::string const& targetName = item; + bool const fromImported = item.Target && item.Target->IsImported(); + bool const checkCMP0027 = item.FromGenex; bool testIsOff = true; bool cacheIncludes = false; std::vector& entryIncludes = (*it)->CachedEntries; @@ -2200,45 +2190,9 @@ cmTarget::GetIncludeDirectories(const std::string& config) const if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[config]) { - for (std::vector::const_iterator - it = this->Internal->LinkImplementationPropertyEntries.begin(), - end = this->Internal->LinkImplementationPropertyEntries.end(); - it != end; ++it) - { - if (!cmGeneratorExpression::IsValidTargetName(it->Value) - && cmGeneratorExpression::Find(it->Value) == std::string::npos) - { - continue; - } - { - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(it->Value); - std::string result = cge->Evaluate(this->Makefile, config, - false, this, 0, 0); - if (!this->Makefile->FindTargetToUse(result)) - { - continue; - } - } - std::string includeGenex = "$Value + ",INTERFACE_INCLUDE_DIRECTORIES>"; - if (cmGeneratorExpression::Find(it->Value) != std::string::npos) - { - // Because it->Value is a generator expression, ensure that it - // evaluates to the non-empty string before being used in the - // TARGET_PROPERTY expression. - includeGenex = "$<$Value + ">:" + includeGenex + ">"; - } - cmGeneratorExpression ge(&it->Backtrace); - cmsys::auto_ptr cge = ge.Parse( - includeGenex); - - this->Internal - ->CachedLinkInterfaceIncludeDirectoriesEntries[config].push_back( - new cmTargetInternals::TargetPropertyEntry(cge, - it->Value)); - } + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_INCLUDE_DIRECTORIES", + this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[config]); if(this->Makefile->IsOn("APPLE")) { diff --git a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt index 82a34d5..17b8a5c 100644 --- a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt +++ b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt @@ -1,11 +1,4 @@ CMake Debug Log: - Boolean compatibility of property "BOOL_PROP7" for target - "CompatibleInterface" \(result: "FALSE"\): - - \* Target "CompatibleInterface" property is implied by use. - \* Target "iface1" property value "FALSE" \(Agree\) -+ -CMake Debug Log: Boolean compatibility of property "BOOL_PROP1" for target "CompatibleInterface" \(result: "TRUE"\): @@ -47,6 +40,13 @@ CMake Debug Log: \* Target "iface2" property value "FALSE" \(Agree\) + CMake Debug Log: + Boolean compatibility of property "BOOL_PROP7" for target + "CompatibleInterface" \(result: "FALSE"\): + + \* Target "CompatibleInterface" property is implied by use. + \* Target "iface1" property value "FALSE" \(Agree\) ++ +CMake Debug Log: String compatibility of property "STRING_PROP1" for target "CompatibleInterface" \(result: "prop1"\): http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b5b098ebb39c97f3420eb7c24f0d4d5bc2d15a5a commit b5b098ebb39c97f3420eb7c24f0d4d5bc2d15a5a Author: Brad King AuthorDate: Mon Jun 30 11:41:54 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 08:52:41 2014 -0400 cmTarget: Simplify CMP0027 logic in processIncludeDirectories Evaluate and lookup the target name only once per TargetPropertyEntry instead of repeating it for each include directory entry. Use a local checkCMP0027 variable to record whether the policy should be checked. Evaluate the target name as a generator expression only if it looks like one. Lookup the target by name only after evaluation of generator expressions. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 9ba8456..0c96c91 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2012,6 +2012,24 @@ static void processIncludeDirectories(cmTarget const* tgt, for (std::vector::const_iterator it = entries.begin(), end = entries.end(); it != end; ++it) { + std::string targetName = (*it)->TargetName; + bool checkCMP0027 = false; + if(!cmGeneratorExpression::IsValidTargetName(targetName) + && cmGeneratorExpression::Find(targetName) != std::string::npos) + { + std::string evaluatedTargetName; + cmGeneratorExpression ge; + cmsys::auto_ptr cge = + ge.Parse(targetName); + evaluatedTargetName = cge->Evaluate(mf, config, false, tgt, 0, 0); + checkCMP0027 = evaluatedTargetName != targetName; + targetName = evaluatedTargetName; + } + cmTarget *dependentTarget = mf->FindTargetToUse(targetName); + + const bool fromImported = + dependentTarget && dependentTarget->IsImported(); + bool testIsOff = true; bool cacheIncludes = false; std::vector& entryIncludes = (*it)->CachedEntries; @@ -2037,36 +2055,12 @@ static void processIncludeDirectories(cmTarget const* tgt, for(std::vector::iterator li = entryIncludes.begin(); li != entryIncludes.end(); ++li) { - std::string targetName = (*it)->TargetName; - std::string evaluatedTargetName; - { - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(targetName); - evaluatedTargetName = cge->Evaluate(mf, config, false, tgt, 0, 0); - } - - cmTarget *dependentTarget = mf->FindTargetToUse(targetName); - - const bool fromImported = dependentTarget - && dependentTarget->IsImported(); - - cmTarget *evaluatedDependentTarget = - (targetName != evaluatedTargetName) - ? mf->FindTargetToUse(evaluatedTargetName) - : 0; - - targetName = evaluatedTargetName; - - const bool fromEvaluatedImported = evaluatedDependentTarget - && evaluatedDependentTarget->IsImported(); - - if ((fromImported || fromEvaluatedImported) + if (fromImported && !cmSystemTools::FileExists(li->c_str())) { cmOStringStream e; cmake::MessageType messageType = cmake::FATAL_ERROR; - if (fromEvaluatedImported) + if (checkCMP0027) { switch(tgt->GetPolicyStatusCMP0027()) { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5e07dcf7c8e884380e1ad5ab64ba3bcdef601eee commit 5e07dcf7c8e884380e1ad5ab64ba3bcdef601eee Author: Brad King AuthorDate: Mon Jun 30 11:39:09 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 08:52:41 2014 -0400 cmTarget: Add to LinkImplementation whether each library was a genex Implementation of CMP0027 OLD behavior needs to know whether each entry in LinkImplementation::Libraries came from a generator expression or not. Add a FromGenex member to cmLinkImplItem to record this. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 98a9920..9ba8456 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6509,12 +6509,9 @@ void cmTarget::ComputeLinkImplementation(const std::string& config, cmGeneratorExpression ge(&le->Backtrace); cmsys::auto_ptr const cge = ge.Parse(le->Value); - cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, - config, - false, - head, - &dagChecker), - llibs); + std::string const evaluated = + cge->Evaluate(this->Makefile, config, false, head, &dagChecker); + cmSystemTools::ExpandListArgument(evaluated, llibs); for(std::vector::const_iterator li = llibs.begin(); li != llibs.end(); ++li) @@ -6562,7 +6559,8 @@ void cmTarget::ComputeLinkImplementation(const std::string& config, // The entry is meant for this configuration. impl.Libraries.push_back( - cmLinkImplItem(name, this->FindTargetToLink(name), le->Backtrace)); + cmLinkImplItem(name, this->FindTargetToLink(name), + le->Backtrace, evaluated != le->Value)); } std::set const& seenProps = cge->GetSeenTargetProperties(); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 5f2a557..dc67f1e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -57,14 +57,16 @@ public: class cmLinkImplItem: public cmLinkItem { public: - cmLinkImplItem(): cmLinkItem(), Backtrace(0) {} + cmLinkImplItem(): cmLinkItem(), Backtrace(0), FromGenex(false) {} cmLinkImplItem(std::string const& n, cmTarget const* t, - cmListFileBacktrace const& bt): - cmLinkItem(n, t), Backtrace(bt) {} + cmListFileBacktrace const& bt, + bool fromGenex): + cmLinkItem(n, t), Backtrace(bt), FromGenex(fromGenex) {} cmLinkImplItem(cmLinkImplItem const& r): - cmLinkItem(r), Backtrace(r.Backtrace) {} + cmLinkItem(r), Backtrace(r.Backtrace), FromGenex(r.FromGenex) {} cmListFileBacktrace Backtrace; + bool FromGenex; }; struct cmTargetLinkInformationMap: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f77b384cf6a4e9206e6067b7bfe0677a962268c4 commit f77b384cf6a4e9206e6067b7bfe0677a962268c4 Author: Brad King AuthorDate: Thu Jun 19 13:39:25 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 08:52:41 2014 -0400 cmTarget: Simplify INTERFACE_COMPILE_FEATURES usage requirement lookup Use the AddInterfaceEntries helper to avoid duplication. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e35167e..98a9920 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2615,45 +2615,9 @@ void cmTarget::GetCompileFeatures(std::vector &result, if (!this->Internal->CacheLinkInterfaceCompileFeaturesDone[config]) { - for (std::vector::const_iterator - it = this->Internal->LinkImplementationPropertyEntries.begin(), - end = this->Internal->LinkImplementationPropertyEntries.end(); - it != end; ++it) - { - if (!cmGeneratorExpression::IsValidTargetName(it->Value) - && cmGeneratorExpression::Find(it->Value) == std::string::npos) - { - continue; - } - { - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(it->Value); - std::string targetResult = cge->Evaluate(this->Makefile, config, - false, this, 0, 0); - if (!this->Makefile->FindTargetToUse(targetResult)) - { - continue; - } - } - std::string featureGenex = "$Value + ",INTERFACE_COMPILE_FEATURES>"; - if (cmGeneratorExpression::Find(it->Value) != std::string::npos) - { - // Because it->Value is a generator expression, ensure that it - // evaluates to the non-empty string before being used in the - // TARGET_PROPERTY expression. - featureGenex = "$<$Value + ">:" + featureGenex + ">"; - } - cmGeneratorExpression ge(&it->Backtrace); - cmsys::auto_ptr cge = ge.Parse( - featureGenex); - - this->Internal - ->CachedLinkInterfaceCompileFeaturesEntries[config].push_back( - new cmTargetInternals::TargetPropertyEntry(cge, - it->Value)); - } + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_COMPILE_FEATURES", + this->Internal->CachedLinkInterfaceCompileFeaturesEntries[config]); } processCompileFeatures(this, http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=61ef8daad5d15256daec08eeb0437fdece330001 commit 61ef8daad5d15256daec08eeb0437fdece330001 Author: Brad King AuthorDate: Thu Jun 19 13:38:51 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 08:52:41 2014 -0400 cmTarget: Simplify INTERFACE_COMPILE_DEFINITIONS usage requirement lookup Use the AddInterfaceEntries helper to avoid duplication. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 2cc21f5..e35167e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2504,45 +2504,9 @@ void cmTarget::GetCompileDefinitions(std::vector &list, if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config]) { - for (std::vector::const_iterator - it = this->Internal->LinkImplementationPropertyEntries.begin(), - end = this->Internal->LinkImplementationPropertyEntries.end(); - it != end; ++it) - { - if (!cmGeneratorExpression::IsValidTargetName(it->Value) - && cmGeneratorExpression::Find(it->Value) == std::string::npos) - { - continue; - } - { - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(it->Value); - std::string targetResult = cge->Evaluate(this->Makefile, config, - false, this, 0, 0); - if (!this->Makefile->FindTargetToUse(targetResult)) - { - continue; - } - } - std::string defsGenex = "$Value + ",INTERFACE_COMPILE_DEFINITIONS>"; - if (cmGeneratorExpression::Find(it->Value) != std::string::npos) - { - // Because it->Value is a generator expression, ensure that it - // evaluates to the non-empty string before being used in the - // TARGET_PROPERTY expression. - defsGenex = "$<$Value + ">:" + defsGenex + ">"; - } - cmGeneratorExpression ge(&it->Backtrace); - cmsys::auto_ptr cge = ge.Parse( - defsGenex); - - this->Internal - ->CachedLinkInterfaceCompileDefinitionsEntries[config].push_back( - new cmTargetInternals::TargetPropertyEntry(cge, - it->Value)); - } + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_COMPILE_DEFINITIONS", + this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[config]); if (!config.empty()) { std::string configPropName = "COMPILE_DEFINITIONS_" http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d9586f83f11f56d8d9f88892f543918f50e9525c commit d9586f83f11f56d8d9f88892f543918f50e9525c Author: Brad King AuthorDate: Thu Jun 19 13:38:26 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 08:52:40 2014 -0400 cmTarget: Simplify INTERFACE_COMPILE_OPTIONS usage requirement lookup Use the AddInterfaceEntries helper to avoid duplication. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a87e98d..2cc21f5 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2430,45 +2430,9 @@ void cmTarget::GetCompileOptions(std::vector &result, if (!this->Internal->CacheLinkInterfaceCompileOptionsDone[config]) { - for (std::vector::const_iterator - it = this->Internal->LinkImplementationPropertyEntries.begin(), - end = this->Internal->LinkImplementationPropertyEntries.end(); - it != end; ++it) - { - if (!cmGeneratorExpression::IsValidTargetName(it->Value) - && cmGeneratorExpression::Find(it->Value) == std::string::npos) - { - continue; - } - { - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(it->Value); - std::string targetResult = cge->Evaluate(this->Makefile, config, - false, this, 0, 0); - if (!this->Makefile->FindTargetToUse(targetResult)) - { - continue; - } - } - std::string optionGenex = "$Value + ",INTERFACE_COMPILE_OPTIONS>"; - if (cmGeneratorExpression::Find(it->Value) != std::string::npos) - { - // Because it->Value is a generator expression, ensure that it - // evaluates to the non-empty string before being used in the - // TARGET_PROPERTY expression. - optionGenex = "$<$Value + ">:" + optionGenex + ">"; - } - cmGeneratorExpression ge(&it->Backtrace); - cmsys::auto_ptr cge = ge.Parse( - optionGenex); - - this->Internal - ->CachedLinkInterfaceCompileOptionsEntries[config].push_back( - new cmTargetInternals::TargetPropertyEntry(cge, - it->Value)); - } + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_COMPILE_OPTIONS", + this->Internal->CachedLinkInterfaceCompileOptionsEntries[config]); } processCompileOptions(this, http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3156275bc74e355f8309617344693a0f14b7a370 commit 3156275bc74e355f8309617344693a0f14b7a370 Author: Brad King AuthorDate: Thu Jun 19 13:37:30 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 08:52:40 2014 -0400 cmTarget: Simplify INTERFACE_SOURCES usage requirement lookup Use the AddInterfaceEntries helper to avoid duplication. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0ad4ffb..a87e98d 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -774,45 +774,9 @@ void cmTarget::GetSourceFiles(std::vector &files, if (!this->Internal->CacheLinkInterfaceSourcesDone[config]) { - for (std::vector::const_iterator - it = this->Internal->LinkImplementationPropertyEntries.begin(), - end = this->Internal->LinkImplementationPropertyEntries.end(); - it != end; ++it) - { - if (!cmGeneratorExpression::IsValidTargetName(it->Value) - && cmGeneratorExpression::Find(it->Value) == std::string::npos) - { - continue; - } - { - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(it->Value); - std::string targetResult = cge->Evaluate(this->Makefile, config, - false, this, 0, &dagChecker); - if (!this->Makefile->FindTargetToUse(targetResult)) - { - continue; - } - } - std::string sourceGenex = "$Value + ",INTERFACE_SOURCES>"; - if (cmGeneratorExpression::Find(it->Value) != std::string::npos) - { - // Because it->Value is a generator expression, ensure that it - // evaluates to the non-empty string before being used in the - // TARGET_PROPERTY expression. - sourceGenex = "$<$Value + ">:" + sourceGenex + ">"; - } - cmGeneratorExpression ge(&it->Backtrace); - cmsys::auto_ptr cge = ge.Parse( - sourceGenex); - - this->Internal - ->CachedLinkInterfaceSourcesEntries[config].push_back( - new cmTargetInternals::TargetPropertyEntry(cge, - it->Value)); - } + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_SOURCES", + this->Internal->CachedLinkInterfaceSourcesEntries[config]); } std::vector::size_type numFilesBefore = files.size(); diff --git a/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt b/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt index a5d5d50..3a7f480 100644 --- a/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt +++ b/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt @@ -1,7 +1,9 @@ -CMake Error: +CMake Error at LINK_LANGUAGE-genex.cmake:[0-9]+ \(target_link_libraries\): Error evaluating generator expression: \$ LINKER_LANGUAGE target property can not be used while evaluating link - libraries + libraries for a static library +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt b/Tests/RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt index 2d7a3c9..d8bc238 100644 --- a/Tests/RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt +++ b/Tests/RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt @@ -1,7 +1,9 @@ -CMake Error: +CMake Error at link-libraries-TARGET_FILE-genex.cmake:[0-9]+ \(target_link_libraries\): Error evaluating generator expression: \$ Expressions which require the linker language may not be used while evaluating link libraries +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=363cd33ebe5a8fb495fffc07cf39c59082e83bbf commit 363cd33ebe5a8fb495fffc07cf39c59082e83bbf Author: Brad King AuthorDate: Mon Jun 30 10:47:21 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 08:52:40 2014 -0400 cmTarget: Add method to add usage requirements from linked interfaces Create a cmTargetInternals::AddInterfaceEntries method to construct a $ generator expression and evaluate it for every target in the link implementation. This will be useful to de-duplicate such evaluation for each usage requirement separately. The new method will soon be used in the implementation of the INTERFACE_* usage requirement lookup methods (GetSourceFiles, GetCompileOptions, GetCompileDefinitions, GetCompileFeatures, GetIncludeDirectories). It is necessary for these methods to determine whether an expression in LinkImplementationPropertyEntries evaluates to a target or not because generator expression evaluation reports an error for non-targets and we construct a $ expression for each entry that is a target. The implementation of each usage requirement currently processes the LinkImplementationPropertyEntries and evaluates all generator expressions to determine targets. That is no longer necessary because GetLinkImplementationLibraries now returns resolved and cached targets together with their name. Use it to implement AddInterfaceEntries. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 6bc4273..0ad4ffb 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -181,6 +181,10 @@ public: std::vector SourceEntries; std::vector LinkImplementationPropertyEntries; + void AddInterfaceEntries( + cmTarget const* thisTarget, std::string const& config, + std::string const& prop, std::vector& entries); + std::map > CachedLinkInterfaceIncludeDirectoriesEntries; std::map > @@ -6550,6 +6554,31 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, } //---------------------------------------------------------------------------- +void cmTargetInternals::AddInterfaceEntries( + cmTarget const* thisTarget, std::string const& config, + std::string const& prop, std::vector& entries) +{ + if(cmTarget::LinkImplementation const* impl = + thisTarget->GetLinkImplementationLibraries(config)) + { + for (std::vector::const_iterator + it = impl->Libraries.begin(), end = impl->Libraries.end(); + it != end; ++it) + { + if(it->Target) + { + std::string genex = + "$"; + cmGeneratorExpression ge(&it->Backtrace); + cmsys::auto_ptr cge = ge.Parse(genex); + entries.push_back( + new cmTargetInternals::TargetPropertyEntry(cge, *it)); + } + } + } +} + +//---------------------------------------------------------------------------- cmTarget::LinkImplementation const* cmTarget::GetLinkImplementation(const std::string& config) const { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=251e835b3f7320f0099d003de5a675af58e62e46 commit 251e835b3f7320f0099d003de5a675af58e62e46 Author: Brad King AuthorDate: Mon Jun 30 10:43:36 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 08:52:40 2014 -0400 cmTarget: Add to LinkImplementation a backtrace for each library Allow clients to provide backtrace context on evaluation diagnostics. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 94b339b..6bc4273 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6677,7 +6677,7 @@ void cmTarget::ComputeLinkImplementation(const std::string& config, // The entry is meant for this configuration. impl.Libraries.push_back( - cmLinkImplItem(name, this->FindTargetToLink(name))); + cmLinkImplItem(name, this->FindTargetToLink(name), le->Backtrace)); } std::set const& seenProps = cge->GetSeenTargetProperties(); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 8578c51..5f2a557 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -57,12 +57,14 @@ public: class cmLinkImplItem: public cmLinkItem { public: - cmLinkImplItem(): cmLinkItem() {} + cmLinkImplItem(): cmLinkItem(), Backtrace(0) {} cmLinkImplItem(std::string const& n, - cmTarget const* t): - cmLinkItem(n, t) {} + cmTarget const* t, + cmListFileBacktrace const& bt): + cmLinkItem(n, t), Backtrace(bt) {} cmLinkImplItem(cmLinkImplItem const& r): - cmLinkItem(r) {} + cmLinkItem(r), Backtrace(r.Backtrace) {} + cmListFileBacktrace Backtrace; }; struct cmTargetLinkInformationMap: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=848c8ccf18e325e0d2833ac468f733261832feca commit 848c8ccf18e325e0d2833ac468f733261832feca Author: Brad King AuthorDate: Mon Jun 30 10:38:59 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 08:52:39 2014 -0400 cmTarget: Refactor LinkImplementation to allow more information Create a cmLinkImplItem class derived from cmLinkItem so more information can be added to link implementation entries than link interface entries. Convert the LinkImplementation Libraries member to hold it. Update client sites accordingly. diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 3929af4..75d3967 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -255,7 +255,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // A target should not depend on itself. emitted.insert(depender->GetName()); - for(std::vector::const_iterator + for(std::vector::const_iterator lib = impl->Libraries.begin(); lib != impl->Libraries.end(); ++lib) { diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index cf112ec..13eac3b 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -844,7 +844,7 @@ getLinkedTargetsContent( std::string getLinkedTargetsContent( - std::vector const &libraries, + std::vector const &libraries, cmTarget const* target, cmTarget const* headTarget, cmGeneratorExpressionContext *context, @@ -852,7 +852,7 @@ getLinkedTargetsContent( const std::string &interfacePropertyName) { std::vector tgts; - for (std::vector::const_iterator + for (std::vector::const_iterator it = libraries.begin(); it != libraries.end(); ++it) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index fd82d17..eccb06a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -475,8 +475,8 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, } std::set uniqueDeps; - for(std::vector::const_iterator li = impl->Libraries.begin(); - li != impl->Libraries.end(); ++li) + for(std::vector::const_iterator + li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { cmTarget const* tgt = li->Target; if (!tgt) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d27293a..94b339b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2281,7 +2281,7 @@ cmTarget::GetIncludeDirectories(const std::string& config) const if(this->Makefile->IsOn("APPLE")) { LinkImplementation const* impl = this->GetLinkImplementation(config); - for(std::vector::const_iterator + for(std::vector::const_iterator it = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) { @@ -3675,7 +3675,8 @@ void cmTarget::ComputeLinkClosure(const std::string& config, // Add interface languages from linked targets. cmTargetCollectLinkLanguages cll(this, config, languages, this); - for(std::vector::const_iterator li = impl->Libraries.begin(); + for(std::vector::const_iterator + li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { cll.Visit(*li); @@ -6242,7 +6243,8 @@ cmTarget::GetLinkImplementationClosure(const std::string& config) const cmTarget::LinkImplementation const* impl = this->GetLinkImplementationLibraries(config); - for(std::vector::const_iterator it = impl->Libraries.begin(); + for(std::vector::const_iterator + it = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) { processILibs(config, this, *it, tgts , emitted); @@ -6383,7 +6385,8 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, // The link implementation is the default link interface. LinkImplementation const* impl = this->GetLinkImplementationLibrariesInternal(config, headTarget); - iface.Libraries = impl->Libraries; + std::copy(impl->Libraries.begin(), impl->Libraries.end(), + std::back_inserter(iface.Libraries)); if(this->PolicyStatusCMP0022 == cmPolicies::WARN && !this->Internal->PolicyWarnedCMP0022 && !usage_requirements_only) { @@ -6397,12 +6400,12 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, headTarget, usage_requirements_only, ifaceLibs); } - if (ifaceLibs != impl->Libraries) + if (ifaceLibs != iface.Libraries) { std::string oldLibraries; std::string newLibraries; const char *sep = ""; - for(std::vector::const_iterator it + for(std::vector::const_iterator it = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) { oldLibraries += sep; @@ -6470,7 +6473,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, { cmTarget::LinkImplementation const* impl = thisTarget->GetLinkImplementation(config); - for(std::vector::const_iterator + for(std::vector::const_iterator li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { if(emitted.insert(*li).second) @@ -6674,7 +6677,7 @@ void cmTarget::ComputeLinkImplementation(const std::string& config, // The entry is meant for this configuration. impl.Libraries.push_back( - cmLinkItem(name, this->FindTargetToLink(name))); + cmLinkImplItem(name, this->FindTargetToLink(name))); } std::set const& seenProps = cge->GetSeenTargetProperties(); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 9d1f966..8578c51 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -54,6 +54,16 @@ public: cmLinkItem(cmLinkItem const& r): std_string(r), Target(r.Target) {} cmTarget const* Target; }; +class cmLinkImplItem: public cmLinkItem +{ +public: + cmLinkImplItem(): cmLinkItem() {} + cmLinkImplItem(std::string const& n, + cmTarget const* t): + cmLinkItem(n, t) {} + cmLinkImplItem(cmLinkImplItem const& r): + cmLinkItem(r) {} +}; struct cmTargetLinkInformationMap: public std::map @@ -296,7 +306,7 @@ public: std::vector Languages; // Libraries linked directly in this configuration. - std::vector Libraries; + std::vector Libraries; // Libraries linked directly in other configurations. // Needed only for OLD behavior of CMP0003. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f85ccf23eeec08fff46c0788b8ee357b3f5220e4 commit f85ccf23eeec08fff46c0788b8ee357b3f5220e4 Author: Brad King AuthorDate: Mon Jun 30 10:31:01 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 08:52:39 2014 -0400 cmGeneratorExpressionEvaluator: Shorten some long lines Adjust the definitions of getLinkedTargetsContent to avoid long lines. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index b648eb2..cf112ec 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -799,13 +799,14 @@ static const char* targetPropertyTransitiveWhitelist[] = { #undef TRANSITIVE_PROPERTY_NAME -std::string getLinkedTargetsContent( - std::vector &targets, - cmTarget const* target, - cmTarget const* headTarget, - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker, - const std::string &interfacePropertyName) +std::string +getLinkedTargetsContent( + std::vector &targets, + cmTarget const* target, + cmTarget const* headTarget, + cmGeneratorExpressionContext *context, + cmGeneratorExpressionDAGChecker *dagChecker, + const std::string &interfacePropertyName) { cmGeneratorExpression ge(&context->Backtrace); @@ -841,12 +842,14 @@ std::string getLinkedTargetsContent( return linkedTargetsContent; } -std::string getLinkedTargetsContent(std::vector const &libraries, - cmTarget const* target, - cmTarget const* headTarget, - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker, - const std::string &interfacePropertyName) +std::string +getLinkedTargetsContent( + std::vector const &libraries, + cmTarget const* target, + cmTarget const* headTarget, + cmGeneratorExpressionContext *context, + cmGeneratorExpressionDAGChecker *dagChecker, + const std::string &interfacePropertyName) { std::vector tgts; for (std::vector::const_iterator http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=82e91e34872fd8fa394d14f1e4fac60f9e993a35 commit 82e91e34872fd8fa394d14f1e4fac60f9e993a35 Author: Brad King AuthorDate: Mon Jun 30 10:28:08 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 08:52:36 2014 -0400 cmComputeLinkDepends: Convert AddLinkEntries to a template Allow the method to be called with a vector of any type that can be converted to cmLinkItem. diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 6170e92..c13da50 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -553,15 +553,16 @@ void cmComputeLinkDepends::AddDirectLinkEntries() } //---------------------------------------------------------------------------- +template void cmComputeLinkDepends::AddLinkEntries( - int depender_index, std::vector const& libs) + int depender_index, std::vector const& libs) { // Track inferred dependency sets implied by this list. std::map dependSets; // Loop over the libraries linked directly by the depender. - for(std::vector::const_iterator li = libs.begin(); + for(typename std::vector::const_iterator li = libs.begin(); li != libs.end(); ++li) { // Skip entries that will resolve to the target getting linked or diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 3207ecb..a931726 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -80,8 +80,8 @@ private: int AddLinkEntry(cmLinkItem const& item); void AddVarLinkEntries(int depender_index, const char* value); void AddDirectLinkEntries(); - void AddLinkEntries(int depender_index, - std::vector const& libs); + template + void AddLinkEntries(int depender_index, std::vector const& libs); cmTarget const* FindTargetToLink(int depender_index, const std::string& name); ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 08:54:27 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 08:54:27 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1309-gf59ad29 Message-ID: <20140707125427.B6BE938F4C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via f59ad29a0e4fd3bbeda6f3ac06c68c1c6c989dc6 (commit) via 591a7388cf8cd26377d901195c9946b51c44cdfb (commit) from d39e7f1259abe3057f057445b62d3aaf0b0961a1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f59ad29a0e4fd3bbeda6f3ac06c68c1c6c989dc6 commit f59ad29a0e4fd3bbeda6f3ac06c68c1c6c989dc6 Merge: d39e7f1 591a738 Author: Brad King AuthorDate: Mon Jul 7 08:54:25 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 7 08:54:25 2014 -0400 Merge topic 'no-cross-install_name_tool' 591a7388 OS X: Only search for install_name_tool if the toolchain has it ----------------------------------------------------------------------- Summary of changes: Modules/CMakeFindBinUtils.cmake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 08:54:29 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 08:54:29 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1311-gdcac4a3 Message-ID: <20140707125429.8B1E138F61@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via dcac4a3ff421810dd87dee173330e704f9270e98 (commit) via f33d875a844114945f3e698266639a63401f6ac1 (commit) from f59ad29a0e4fd3bbeda6f3ac06c68c1c6c989dc6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dcac4a3ff421810dd87dee173330e704f9270e98 commit dcac4a3ff421810dd87dee173330e704f9270e98 Merge: f59ad29 f33d875 Author: Brad King AuthorDate: Mon Jul 7 08:54:28 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 7 08:54:28 2014 -0400 Merge topic 'ctest-S-message-STATUS' f33d875a CTest: Implement message(STATUS) output for 'ctest -S' scripts ----------------------------------------------------------------------- Summary of changes: Source/CTest/cmCTestScriptHandler.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 08:54:31 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 08:54:31 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1313-g55c38b0 Message-ID: <20140707125431.5061E38F4A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 55c38b0077fe4c56eafbc4f6a5aa3f6b83839c2c (commit) via 15e61f9bd96d528bc50217de1fcd8285fd033cf2 (commit) from dcac4a3ff421810dd87dee173330e704f9270e98 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=55c38b0077fe4c56eafbc4f6a5aa3f6b83839c2c commit 55c38b0077fe4c56eafbc4f6a5aa3f6b83839c2c Merge: dcac4a3 15e61f9 Author: Brad King AuthorDate: Mon Jul 7 08:54:30 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 7 08:54:30 2014 -0400 Merge topic 'fix-CTestTestTimeout-output-order' 15e61f9b Tests: Fix CTestTestTimeout output order to match regex ----------------------------------------------------------------------- Summary of changes: Tests/CTestTestTimeout/test.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 08:54:36 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 08:54:36 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1315-gc9feebb Message-ID: <20140707125436.57B1C38F61@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c9feebb9e88532680c0cbd6066f9ffaf45f747b1 (commit) via b47c125ff7f088c87183e6ad60850aefdaf43757 (commit) from 55c38b0077fe4c56eafbc4f6a5aa3f6b83839c2c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c9feebb9e88532680c0cbd6066f9ffaf45f747b1 commit c9feebb9e88532680c0cbd6066f9ffaf45f747b1 Merge: 55c38b0 b47c125 Author: Brad King AuthorDate: Mon Jul 7 08:54:33 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 7 08:54:33 2014 -0400 Merge topic 'WriteCompilerDetectionHeader-valid-prefix' b47c125f WCDH: Ensure that the prefix argument to the macro is valid. ----------------------------------------------------------------------- Summary of changes: Modules/WriteCompilerDetectionHeader.cmake | 8 ++++++++ .../EmptyPrefix-result.txt} | 0 .../WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt | 5 +++++ .../{ExtraArgs.cmake => EmptyPrefix.cmake} | 4 ++-- .../InvalidPrefix-result.txt} | 0 .../WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt | 5 +++++ .../{ExtraArgs.cmake => InvalidPrefix.cmake} | 4 ++-- Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake | 2 ++ 8 files changed, 24 insertions(+), 4 deletions(-) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => WriteCompilerDetectionHeader/EmptyPrefix-result.txt} (100%) create mode 100644 Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt copy Tests/RunCMake/WriteCompilerDetectionHeader/{ExtraArgs.cmake => EmptyPrefix.cmake} (85%) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => WriteCompilerDetectionHeader/InvalidPrefix-result.txt} (100%) create mode 100644 Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt copy Tests/RunCMake/WriteCompilerDetectionHeader/{ExtraArgs.cmake => InvalidPrefix.cmake} (82%) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 08:54:37 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 08:54:37 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1317-gf1626aa Message-ID: <20140707125437.E5FA338F6C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via f1626aa1013d0101333f05840263676cb0a7b9cd (commit) via 5ca1d3d59c9a0c7df7db335fe225896480e4873f (commit) from c9feebb9e88532680c0cbd6066f9ffaf45f747b1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f1626aa1013d0101333f05840263676cb0a7b9cd commit f1626aa1013d0101333f05840263676cb0a7b9cd Merge: c9feebb 5ca1d3d Author: Brad King AuthorDate: Mon Jul 7 08:54:37 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 7 08:54:37 2014 -0400 Merge topic 'dev/export-from-obj-libs' 5ca1d3d5 GenerateExportHeader: support exporting from OBJECT libraries ----------------------------------------------------------------------- Summary of changes: Modules/GenerateExportHeader.cmake | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 08:54:39 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 08:54:39 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1319-g51fcb7b Message-ID: <20140707125439.D0DB438F6C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 51fcb7b1b68c3094c181e0f7207f177a2ad1e7b4 (commit) via 92af3664c922b4b3127700c426a01ab5fec097b8 (commit) from f1626aa1013d0101333f05840263676cb0a7b9cd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51fcb7b1b68c3094c181e0f7207f177a2ad1e7b4 commit 51fcb7b1b68c3094c181e0f7207f177a2ad1e7b4 Merge: f1626aa 92af366 Author: Brad King AuthorDate: Mon Jul 7 08:54:38 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 7 08:54:38 2014 -0400 Merge topic 'ExternalProject_test' 92af3664 Tests: split the ExternalProject test ----------------------------------------------------------------------- Summary of changes: Tests/CMakeLists.txt | 15 ++ Tests/ExternalProject/CMakeLists.txt | 203 +---------------- Tests/ExternalProjectLocal/CMakeLists.txt | 229 ++++++++++++++++++++ .../Step1.tar | Bin 5632 -> 5632 bytes .../Step1.tar.bz2 | Bin 904 -> 904 bytes .../Step1.tgz | Bin 791 -> 791 bytes .../Step1.zip | Bin 1074 -> 1074 bytes .../Step1NoDir.tar | Bin 5120 -> 5120 bytes .../Step1NoDir.tar.bz2 | Bin 852 -> 852 bytes .../Step1NoDir.tgz | Bin 770 -> 770 bytes .../Step1NoDir.zip | Bin 1038 -> 1038 bytes .../Step1Patch.cmake | 0 12 files changed, 246 insertions(+), 201 deletions(-) create mode 100644 Tests/ExternalProjectLocal/CMakeLists.txt rename Tests/{ExternalProject => ExternalProjectLocal}/Step1.tar (100%) rename Tests/{ExternalProject => ExternalProjectLocal}/Step1.tar.bz2 (100%) rename Tests/{ExternalProject => ExternalProjectLocal}/Step1.tgz (100%) rename Tests/{ExternalProject => ExternalProjectLocal}/Step1.zip (100%) rename Tests/{ExternalProject => ExternalProjectLocal}/Step1NoDir.tar (100%) rename Tests/{ExternalProject => ExternalProjectLocal}/Step1NoDir.tar.bz2 (100%) rename Tests/{ExternalProject => ExternalProjectLocal}/Step1NoDir.tgz (100%) rename Tests/{ExternalProject => ExternalProjectLocal}/Step1NoDir.zip (100%) rename Tests/{ExternalProject => ExternalProjectLocal}/Step1Patch.cmake (100%) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 08:54:41 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 08:54:41 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1332-g61be345 Message-ID: <20140707125441.889B938F6E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 61be345115b5f2c402286be7fa3e6df0c2f5f0ac (commit) via 93790506f52cb4e420be6a1a6988613380ecb1bc (commit) via b5b098ebb39c97f3420eb7c24f0d4d5bc2d15a5a (commit) via 5e07dcf7c8e884380e1ad5ab64ba3bcdef601eee (commit) via f77b384cf6a4e9206e6067b7bfe0677a962268c4 (commit) via 61ef8daad5d15256daec08eeb0437fdece330001 (commit) via d9586f83f11f56d8d9f88892f543918f50e9525c (commit) via 3156275bc74e355f8309617344693a0f14b7a370 (commit) via 363cd33ebe5a8fb495fffc07cf39c59082e83bbf (commit) via 251e835b3f7320f0099d003de5a675af58e62e46 (commit) via 848c8ccf18e325e0d2833ac468f733261832feca (commit) via f85ccf23eeec08fff46c0788b8ee357b3f5220e4 (commit) via 82e91e34872fd8fa394d14f1e4fac60f9e993a35 (commit) from 51fcb7b1b68c3094c181e0f7207f177a2ad1e7b4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=61be345115b5f2c402286be7fa3e6df0c2f5f0ac commit 61be345115b5f2c402286be7fa3e6df0c2f5f0ac Merge: 51fcb7b 9379050 Author: Brad King AuthorDate: Mon Jul 7 08:54:40 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 7 08:54:40 2014 -0400 Merge topic 'refactor-usage-requirement-evaluation' 93790506 cmTarget: Simplify INTERFACE_INCLUDE_DIRECTORIES usage requirement lookup b5b098eb cmTarget: Simplify CMP0027 logic in processIncludeDirectories 5e07dcf7 cmTarget: Add to LinkImplementation whether each library was a genex f77b384c cmTarget: Simplify INTERFACE_COMPILE_FEATURES usage requirement lookup 61ef8daa cmTarget: Simplify INTERFACE_COMPILE_DEFINITIONS usage requirement lookup d9586f83 cmTarget: Simplify INTERFACE_COMPILE_OPTIONS usage requirement lookup 3156275b cmTarget: Simplify INTERFACE_SOURCES usage requirement lookup 363cd33e cmTarget: Add method to add usage requirements from linked interfaces 251e835b cmTarget: Add to LinkImplementation a backtrace for each library 848c8ccf cmTarget: Refactor LinkImplementation to allow more information f85ccf23 cmGeneratorExpressionEvaluator: Shorten some long lines 82e91e34 cmComputeLinkDepends: Convert AddLinkEntries to a template ----------------------------------------------------------------------- Summary of changes: Source/cmComputeLinkDepends.cxx | 5 +- Source/cmComputeLinkDepends.h | 4 +- Source/cmComputeTargetDepends.cxx | 2 +- Source/cmGeneratorExpressionEvaluator.cxx | 31 +- Source/cmGeneratorTarget.cxx | 4 +- Source/cmTarget.cxx | 312 +++++--------------- Source/cmTarget.h | 16 +- .../CompatibleInterface/DebugProperties-stderr.txt | 14 +- .../Languages/LINK_LANGUAGE-genex-stderr.txt | 6 +- .../link-libraries-TARGET_FILE-genex-stderr.txt | 4 +- 10 files changed, 127 insertions(+), 271 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 08:55:15 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 08:55:15 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4123-gdf9e487 Message-ID: <20140707125515.9EBE638FA8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via df9e4875a66e7351d194a9cfe2423e25f61d5e3f (commit) via 61be345115b5f2c402286be7fa3e6df0c2f5f0ac (commit) via 51fcb7b1b68c3094c181e0f7207f177a2ad1e7b4 (commit) via f1626aa1013d0101333f05840263676cb0a7b9cd (commit) via c9feebb9e88532680c0cbd6066f9ffaf45f747b1 (commit) via 55c38b0077fe4c56eafbc4f6a5aa3f6b83839c2c (commit) via dcac4a3ff421810dd87dee173330e704f9270e98 (commit) via f59ad29a0e4fd3bbeda6f3ac06c68c1c6c989dc6 (commit) from 5be1d3d4f1f62492e826a9b05f4171d1d88c24b6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=df9e4875a66e7351d194a9cfe2423e25f61d5e3f commit df9e4875a66e7351d194a9cfe2423e25f61d5e3f Merge: 5be1d3d 61be345 Author: Brad King AuthorDate: Mon Jul 7 08:56:25 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 08:56:25 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 08:58:54 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 08:58:54 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4127-g8c3d453 Message-ID: <20140707125854.785B939234@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 8c3d453b704708014ddf6b6e9fc4f2edabd64b47 (commit) via ce04e9ba60cc923006e2e00afa3e9e7bda01dbf9 (commit) via de4f3e2c82a92a7dfc6305a09cc32d9d5c6e8c34 (commit) via 54bf5858cd4153f41a2414dbe8d1278268eccb58 (commit) from df9e4875a66e7351d194a9cfe2423e25f61d5e3f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c3d453b704708014ddf6b6e9fc4f2edabd64b47 commit 8c3d453b704708014ddf6b6e9fc4f2edabd64b47 Merge: df9e487 ce04e9b Author: Brad King AuthorDate: Mon Jul 7 08:58:52 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 7 08:58:52 2014 -0400 Merge topic 'allow-OBJECT-library-extra-sources' into next ce04e9ba add_library: Allow arbitrary non-linked sources in OBJECT libraries de4f3e2c Tests: Fix broken dependency in ObjectLibrary test 54bf5858 Tests: Resolve TODO comment left in ObjectLibrary test http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ce04e9ba60cc923006e2e00afa3e9e7bda01dbf9 commit ce04e9ba60cc923006e2e00afa3e9e7bda01dbf9 Author: Brad King AuthorDate: Wed Jul 2 15:38:10 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 08:58:08 2014 -0400 add_library: Allow arbitrary non-linked sources in OBJECT libraries Loosen this restriction on OBJECT libraries to allow source files of any name to be generated by custom commands or listed for reference in IDE projects so long as they would not affect linking of a normal library. Update the rejection message to be more specific about the looser restriction. Extend the ObjectLibrary test to cover a ".cmake" file generated by a custom command in an OBJECT library. diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst index f19b5c0..f86f3c5 100644 --- a/Help/command/add_library.rst +++ b/Help/command/add_library.rst @@ -94,7 +94,8 @@ object library name. For example: will include objlib's object files in a library and an executable along with those compiled from their own sources. Object libraries -may contain only sources (and headers) that compile to object files. +may contain only sources that compile, header files, and other files +that would not affect linking of a normal library (e.g. ``.txt``). They may contain custom commands generating such sources, but not ``PRE_BUILD``, ``PRE_LINK``, or ``POST_BUILD`` commands. Object libraries cannot be imported, exported, installed, or linked. Some native build diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index eccb06a..64c5822 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -38,7 +38,8 @@ void reportBadObjLib(std::vector const& badObjLib, { e << " " << (*i)->GetLocation().GetName() << "\n"; } - e << "but may contain only headers and sources that compile."; + e << "but may contain only sources that compile, header files, and " + "other files that would not affect linking of a normal library."; cm->IssueMessage(cmake::FATAL_ERROR, e.str(), target->GetBacktrace()); } @@ -205,10 +206,6 @@ struct TagVisitor else { DoAccept::Result>::Do(this->Data, sf); - if(this->IsObjLib && ext != "txt") - { - this->BadObjLibFiles.push_back(sf); - } } } }; diff --git a/Tests/ObjectLibrary/A/CMakeLists.txt b/Tests/ObjectLibrary/A/CMakeLists.txt index 3fba9f8..696752f 100644 --- a/Tests/ObjectLibrary/A/CMakeLists.txt +++ b/Tests/ObjectLibrary/A/CMakeLists.txt @@ -11,5 +11,11 @@ add_custom_command( ${CMAKE_CURRENT_BINARY_DIR}/a1.c ) -add_library(A OBJECT a1.c a2.c) +file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/a.cmake) +add_custom_command( + OUTPUT a.cmake + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/a.cmake + ) + +add_library(A OBJECT a1.c a2.c a.cmake) target_include_directories(A PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt index 75c34d8..e9f553e 100644 --- a/Tests/ObjectLibrary/CMakeLists.txt +++ b/Tests/ObjectLibrary/CMakeLists.txt @@ -12,6 +12,7 @@ add_library(Cshared SHARED c.c $ $) add_executable(UseCshared main.c) set_property(TARGET UseCshared PROPERTY COMPILE_DEFINITIONS SHARED_C) target_link_libraries(UseCshared Cshared) +add_custom_command(TARGET UseCshared POST_BUILD COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/A/a.cmake) add_executable(UseCinternal main.c c.c $ $) diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt index b31225b..a09552b 100644 --- a/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt @@ -3,6 +3,7 @@ CMake Error at BadObjSource1.cmake:1 \(add_library\): bad.def - but may contain only headers and sources that compile. + but may contain only sources that compile, header files, and other files + that would not affect linking of a normal library. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt index 906cf0b..b91ffd0 100644 --- a/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt @@ -3,6 +3,7 @@ CMake Error at BadObjSource2.cmake:1 \(add_library\): bad.obj - but may contain only headers and sources that compile. + but may contain only sources that compile, header files, and other files + that would not affect linking of a normal library. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=de4f3e2c82a92a7dfc6305a09cc32d9d5c6e8c34 commit de4f3e2c82a92a7dfc6305a09cc32d9d5c6e8c34 Author: Brad King AuthorDate: Wed Jul 2 15:07:04 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 08:58:08 2014 -0400 Tests: Fix broken dependency in ObjectLibrary test The add_custom_command DEPENDS option needs a full path. diff --git a/Tests/ObjectLibrary/A/CMakeLists.txt b/Tests/ObjectLibrary/A/CMakeLists.txt index 1b40e8a..3fba9f8 100644 --- a/Tests/ObjectLibrary/A/CMakeLists.txt +++ b/Tests/ObjectLibrary/A/CMakeLists.txt @@ -6,7 +6,7 @@ add_definitions(-DA_DEF) add_custom_command( OUTPUT a1.c - DEPENDS a1.c.in + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/a1.c.in COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/a1.c.in ${CMAKE_CURRENT_BINARY_DIR}/a1.c ) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=54bf5858cd4153f41a2414dbe8d1278268eccb58 commit 54bf5858cd4153f41a2414dbe8d1278268eccb58 Author: Brad King AuthorDate: Wed Jul 2 14:40:59 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 08:58:08 2014 -0400 Tests: Resolve TODO comment left in ObjectLibrary test We now have a generic way to add -fPIC without explicitly modifying CMAKE_C_FLAGS, so use it. diff --git a/Tests/ObjectLibrary/A/CMakeLists.txt b/Tests/ObjectLibrary/A/CMakeLists.txt index 55778ea..1b40e8a 100644 --- a/Tests/ObjectLibrary/A/CMakeLists.txt +++ b/Tests/ObjectLibrary/A/CMakeLists.txt @@ -1,9 +1,6 @@ project(ObjectLibraryA C) # Add -fPIC so objects can be used in shared libraries. -# TODO: Need property for this. -if(CMAKE_SHARED_LIBRARY_C_FLAGS AND NOT WATCOM) - set(CMAKE_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS} ${CMAKE_C_FLAGS}") -endif() +set(CMAKE_POSITION_INDEPENDENT_CODE ON) add_definitions(-DA_DEF) diff --git a/Tests/ObjectLibrary/B/CMakeLists.txt b/Tests/ObjectLibrary/B/CMakeLists.txt index a567f96..2158084 100644 --- a/Tests/ObjectLibrary/B/CMakeLists.txt +++ b/Tests/ObjectLibrary/B/CMakeLists.txt @@ -5,10 +5,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") endif() # Add -fPIC so objects can be used in shared libraries. -# TODO: Need property for this. -if(CMAKE_SHARED_LIBRARY_C_FLAGS AND NOT WATCOM) - set(CMAKE_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS} ${CMAKE_C_FLAGS}") -endif() +set(CMAKE_POSITION_INDEPENDENT_CODE ON) add_library(B OBJECT b1.c b2.c) target_include_directories(B PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) ----------------------------------------------------------------------- Summary of changes: Help/command/add_library.rst | 3 ++- Source/cmGeneratorTarget.cxx | 7 ++----- Tests/ObjectLibrary/A/CMakeLists.txt | 15 +++++++++------ Tests/ObjectLibrary/B/CMakeLists.txt | 5 +---- Tests/ObjectLibrary/CMakeLists.txt | 1 + Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt | 3 ++- Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt | 3 ++- 7 files changed, 19 insertions(+), 18 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 09:20:32 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 09:20:32 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4129-gd23f713 Message-ID: <20140707132032.DD1FA395F2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d23f7134cd2e83d96eec48dd2bc704cedf8a34fc (commit) via 7400695ee3dbe0375876c7ffc2b68f356142ae79 (commit) from 8c3d453b704708014ddf6b6e9fc4f2edabd64b47 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d23f7134cd2e83d96eec48dd2bc704cedf8a34fc commit d23f7134cd2e83d96eec48dd2bc704cedf8a34fc Merge: 8c3d453 7400695 Author: Brad King AuthorDate: Mon Jul 7 09:20:32 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 7 09:20:32 2014 -0400 Merge topic 'FindSWIG-swig3.0' into next 7400695e FindSWIG: Add support for swig 3.0 application http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7400695ee3dbe0375876c7ffc2b68f356142ae79 commit 7400695ee3dbe0375876c7ffc2b68f356142ae79 Author: Sylvain Joubert AuthorDate: Sat Jul 5 14:55:36 2014 +0200 Commit: Brad King CommitDate: Mon Jul 7 09:18:50 2014 -0400 FindSWIG: Add support for swig 3.0 application diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake index 8bd4048..818d1f2 100644 --- a/Modules/FindSWIG.cmake +++ b/Modules/FindSWIG.cmake @@ -25,6 +25,7 @@ #============================================================================= # Copyright 2004-2009 Kitware, Inc. # Copyright 2011 Mathieu Malaterre +# Copyright 2014 Sylvain Joubert # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -36,7 +37,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -find_program(SWIG_EXECUTABLE NAMES swig2.0 swig) +find_program(SWIG_EXECUTABLE NAMES swig3.0 swig2.0 swig) if(SWIG_EXECUTABLE) execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib ----------------------------------------------------------------------- Summary of changes: Modules/FindSWIG.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 10:51:57 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 10:51:57 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4132-gae3b051 Message-ID: <20140707145157.078B338F9A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ae3b051f3d7df69ccc09db9b8dbe3cabe2df05e2 (commit) via 5f525da0e3d4f6c50cc24a93cc792ee025939701 (commit) via 3d127627f8e28d97ecc44515e274b3780ae3f4b9 (commit) from d23f7134cd2e83d96eec48dd2bc704cedf8a34fc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ae3b051f3d7df69ccc09db9b8dbe3cabe2df05e2 commit ae3b051f3d7df69ccc09db9b8dbe3cabe2df05e2 Merge: d23f713 5f525da Author: Brad King AuthorDate: Mon Jul 7 10:51:55 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 7 10:51:55 2014 -0400 Merge topic 'update-kwsys' into next 5f525da0 Merge branch 'upstream-kwsys' into update-kwsys 3d127627 KWSys 2014-07-02 (c2a329ce) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5f525da0e3d4f6c50cc24a93cc792ee025939701 commit 5f525da0e3d4f6c50cc24a93cc792ee025939701 Merge: 61be345 3d12762 Author: Brad King AuthorDate: Mon Jul 7 09:04:27 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 09:04:27 2014 -0400 Merge branch 'upstream-kwsys' into update-kwsys http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3d127627f8e28d97ecc44515e274b3780ae3f4b9 commit 3d127627f8e28d97ecc44515e274b3780ae3f4b9 Author: KWSys Robot AuthorDate: Wed Jul 2 08:57:17 2014 -0600 Commit: Brad King CommitDate: Mon Jul 7 09:04:19 2014 -0400 KWSys 2014-07-02 (c2a329ce) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ c2a329ce | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' c282e64f..c2a329ce Chuck Atkins (3): e4bba930 Directory: Make sure the /* suffix uses correct slashes 97817ce7 SystemTools: Refactor test file and directory locations 8f991ab0 SystemTools: Use extended paths on Windows for > 256 length Clinton Stimpson (1): c2a329ce Encoding: Fixes uses of stat() on Windows to work with unicode. Change-Id: I8e3aa1ba66ce80900cb25a692287495b911dcbd0 diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e6a226..8ca4360 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1171,10 +1171,9 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestsCxx ${KWSYS_CXX_TEST_SRCS}) SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY LABELS ${KWSYS_LABELS_EXE}) TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE}TestsCxx ${KWSYS_NAMESPACE}) - SET(TEST_SYSTEMTOOLS_BIN_FILE - "${CMAKE_CURRENT_SOURCE_DIR}/testSystemTools.bin") - SET(TEST_SYSTEMTOOLS_SRC_FILE - "${CMAKE_CURRENT_SOURCE_DIR}/testSystemTools.cxx") + + SET(TEST_SYSTEMTOOLS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + SET(TEST_SYSTEMTOOLS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") CONFIGURE_FILE( ${PROJECT_SOURCE_DIR}/testSystemTools.h.in ${PROJECT_BINARY_DIR}/testSystemTools.h) diff --git a/Directory.cxx b/Directory.cxx index d54e607..b305fd7 100644 --- a/Directory.cxx +++ b/Directory.cxx @@ -113,15 +113,24 @@ bool Directory::Load(const char* name) #endif char* buf; size_t n = strlen(name); - if ( name[n - 1] == '/' ) + if ( name[n - 1] == '/' || name[n - 1] == '\\' ) { buf = new char[n + 1 + 1]; sprintf(buf, "%s*", name); } else { + // Make sure the slashes in the wildcard suffix are consistent with the + // rest of the path buf = new char[n + 2 + 1]; - sprintf(buf, "%s/*", name); + if ( strchr(name, '\\') ) + { + sprintf(buf, "%s\\*", name); + } + else + { + sprintf(buf, "%s/*", name); + } } struct _wfinddata_t data; // data of current file diff --git a/SystemTools.cxx b/SystemTools.cxx index 704cbbc..db94510 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -187,17 +187,34 @@ static inline char *realpath(const char *path, char *resolved_path) } #endif +#ifdef _WIN32 +static time_t windows_filetime_to_posix_time(const FILETIME& ft) +{ + LARGE_INTEGER date; + date.HighPart = ft.dwHighDateTime; + date.LowPart = ft.dwLowDateTime; + + // removes the diff between 1970 and 1601 + date.QuadPart -= ((LONGLONG)(369 * 365 + 89) * 24 * 3600 * 10000000); + + // converts back from 100-nanoseconds to seconds + return date.QuadPart / 10000000; +} +#endif + #if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) #include inline int Mkdir(const char* dir) { - return _wmkdir(KWSYS_NAMESPACE::Encoding::ToWide(dir).c_str()); + return _wmkdir( + KWSYS_NAMESPACE::SystemTools::ConvertToWindowsExtendedPath(dir).c_str()); } inline int Rmdir(const char* dir) { - return _wrmdir(KWSYS_NAMESPACE::Encoding::ToWide(dir).c_str()); + return _wrmdir( + KWSYS_NAMESPACE::SystemTools::ConvertToWindowsExtendedPath(dir).c_str()); } inline const char* Getcwd(char* buf, unsigned int len) { @@ -609,7 +626,7 @@ const char* SystemTools::GetExecutableExtension() FILE* SystemTools::Fopen(const char* file, const char* mode) { #ifdef _WIN32 - return _wfopen(Encoding::ToWide(file).c_str(), + return _wfopen(SystemTools::ConvertToWindowsExtendedPath(file).c_str(), Encoding::ToWide(mode).c_str()); #else return fopen(file, mode); @@ -1081,7 +1098,8 @@ bool SystemTools::FileExists(const char* filename) } return access(filename, R_OK) == 0; #elif defined(_WIN32) - return (GetFileAttributesW(Encoding::ToWide(filename).c_str()) + return (GetFileAttributesW( + SystemTools::ConvertToWindowsExtendedPath(filename).c_str()) != INVALID_FILE_ATTRIBUTES); #else return access(filename, R_OK) == 0; @@ -1137,10 +1155,11 @@ bool SystemTools::Touch(const char* filename, bool create) return false; } #if defined(_WIN32) && !defined(__CYGWIN__) - HANDLE h = CreateFileW(Encoding::ToWide(filename).c_str(), - FILE_WRITE_ATTRIBUTES, - FILE_SHARE_WRITE, 0, OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, 0); + HANDLE h = CreateFileW( + SystemTools::ConvertToWindowsExtendedPath(filename).c_str(), + FILE_WRITE_ATTRIBUTES, + FILE_SHARE_WRITE, 0, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, 0); if(!h) { return false; @@ -1242,13 +1261,15 @@ bool SystemTools::FileTimeCompare(const char* f1, const char* f2, // Windows version. Get the modification time from extended file attributes. WIN32_FILE_ATTRIBUTE_DATA f1d; WIN32_FILE_ATTRIBUTE_DATA f2d; - if(!GetFileAttributesExW(Encoding::ToWide(f1).c_str(), - GetFileExInfoStandard, &f1d)) + if(!GetFileAttributesExW( + SystemTools::ConvertToWindowsExtendedPath(f1).c_str(), + GetFileExInfoStandard, &f1d)) { return false; } - if(!GetFileAttributesExW(Encoding::ToWide(f2).c_str(), - GetFileExInfoStandard, &f2d)) + if(!GetFileAttributesExW( + SystemTools::ConvertToWindowsExtendedPath(f2).c_str(), + GetFileExInfoStandard, &f2d)) { return false; } @@ -1830,6 +1851,71 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path) } } +#ifdef _WIN32 +// Convert local paths to UNC style paths +kwsys_stl::wstring +SystemTools::ConvertToWindowsExtendedPath(const kwsys_stl::string &source) +{ + kwsys_stl::wstring wsource = Encoding::ToWide(source); + + // Resolve any relative paths + DWORD wfull_len; + + /* The +3 is a workaround for a bug in some versions of GetFullPathNameW that + * won't return a large enough buffer size if the input is too small */ + wfull_len = GetFullPathNameW(wsource.c_str(), 0, NULL, NULL) + 3; + kwsys_stl::vector wfull(wfull_len); + GetFullPathNameW(wsource.c_str(), wfull_len, &wfull[0], NULL); + + /* This should get the correct size without any extra padding from the + * previous size workaround. */ + wfull_len = static_cast(wcslen(&wfull[0])); + + if(wfull_len >= 2 && isalpha(wfull[0]) && wfull[1] == L':') + { /* C:\Foo\bar\FooBar.txt */ + return L"\\\\?\\" + kwsys_stl::wstring(&wfull[0]); + } + else if(wfull_len >= 2 && wfull[0] == L'\\' && wfull[1] == L'\\') + { /* Starts with \\ */ + if(wfull_len >= 4 && wfull[2] == L'?' && wfull[3] == L'\\') + { /* Starts with \\?\ */ + if(wfull_len >= 8 && wfull[4] == L'U' && wfull[5] == L'N' && + wfull[6] == L'C' && wfull[7] == L'\\') + { /* \\?\UNC\Foo\bar\FooBar.txt */ + return kwsys_stl::wstring(&wfull[0]); + } + else if(wfull_len >= 6 && isalpha(wfull[4]) && wfull[5] == L':') + { /* \\?\C:\Foo\bar\FooBar.txt */ + return kwsys_stl::wstring(&wfull[0]); + } + else if(wfull_len >= 5) + { /* \\?\Foo\bar\FooBar.txt */ + return L"\\\\?\\UNC\\" + kwsys_stl::wstring(&wfull[4]); + } + } + else if(wfull_len >= 4 && wfull[2] == L'.' && wfull[3] == L'\\') + { /* Starts with \\.\ a device name */ + if(wfull_len >= 6 && isalpha(wfull[4]) && wfull[5] == L':') + { /* \\.\C:\Foo\bar\FooBar.txt */ + return L"\\\\?\\" + kwsys_stl::wstring(&wfull[4]); + } + else if(wfull_len >= 5) + { /* \\.\Foo\bar\ Device name is left unchanged */ + return kwsys_stl::wstring(&wfull[0]); + } + } + else if(wfull_len >= 3) + { /* \\Foo\bar\FooBar.txt */ + return L"\\\\?\\UNC\\" + kwsys_stl::wstring(&wfull[2]); + } + } + + // If this case has been reached, then the path is invalid. Leave it + // unchanged + return Encoding::ToWide(source); +} +#endif + // change // to /, and escape any spaces in the path kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const char* path) { @@ -1960,17 +2046,19 @@ bool SystemTools::FilesDiffer(const char* source, #if defined(_WIN32) WIN32_FILE_ATTRIBUTE_DATA statSource; - if (GetFileAttributesExW(Encoding::ToWide(source).c_str(), - GetFileExInfoStandard, - &statSource) == 0) + if (GetFileAttributesExW( + SystemTools::ConvertToWindowsExtendedPath(source).c_str(), + GetFileExInfoStandard, + &statSource) == 0) { return true; } WIN32_FILE_ATTRIBUTE_DATA statDestination; - if (GetFileAttributesExW(Encoding::ToWide(destination).c_str(), - GetFileExInfoStandard, - &statDestination) == 0) + if (GetFileAttributesExW( + SystemTools::ConvertToWindowsExtendedPath(destination).c_str(), + GetFileExInfoStandard, + &statDestination) == 0) { return true; } @@ -2191,7 +2279,12 @@ bool SystemTools::CopyADirectory(const char* source, const char* destination, bool always) { Directory dir; +#ifdef _WIN32 + dir.Load(Encoding::ToNarrow( + SystemTools::ConvertToWindowsExtendedPath(source)).c_str()); +#else dir.Load(source); +#endif size_t fileNum; if ( !SystemTools::MakeDirectory(destination) ) { @@ -2234,15 +2327,28 @@ bool SystemTools::CopyADirectory(const char* source, const char* destination, // return size of file; also returns zero if no file exists unsigned long SystemTools::FileLength(const char* filename) { - struct stat fs; - if (stat(filename, &fs) != 0) + unsigned long length = 0; +#ifdef _WIN32 + WIN32_FILE_ATTRIBUTE_DATA fs; + if (GetFileAttributesExW( + SystemTools::ConvertToWindowsExtendedPath(filename).c_str(), + GetFileExInfoStandard, &fs) != 0) { - return 0; + /* To support the full 64-bit file size, use fs.nFileSizeHigh + * and fs.nFileSizeLow to construct the 64 bit size + + length = ((__int64)fs.nFileSizeHigh << 32) + fs.nFileSizeLow; + */ + length = static_cast(fs.nFileSizeLow); } - else +#else + struct stat fs; + if (stat(filename, &fs) == 0) { - return static_cast(fs.st_size); + length = static_cast(fs.st_size); } +#endif + return length; } int SystemTools::Strucmp(const char *s1, const char *s2) @@ -2261,29 +2367,47 @@ int SystemTools::Strucmp(const char *s1, const char *s2) // return file's modified time long int SystemTools::ModifiedTime(const char* filename) { - struct stat fs; - if (stat(filename, &fs) != 0) + long int mt = 0; +#ifdef _WIN32 + WIN32_FILE_ATTRIBUTE_DATA fs; + if (GetFileAttributesExW( + SystemTools::ConvertToWindowsExtendedPath(filename).c_str(), + GetFileExInfoStandard, + &fs) != 0) { - return 0; + mt = windows_filetime_to_posix_time(fs.ftLastWriteTime); } - else +#else + struct stat fs; + if (stat(filename, &fs) == 0) { - return static_cast(fs.st_mtime); + mt = static_cast(fs.st_mtime); } +#endif + return mt; } // return file's creation time long int SystemTools::CreationTime(const char* filename) { - struct stat fs; - if (stat(filename, &fs) != 0) + long int ct = 0; +#ifdef _WIN32 + WIN32_FILE_ATTRIBUTE_DATA fs; + if (GetFileAttributesExW( + SystemTools::ConvertToWindowsExtendedPath(filename).c_str(), + GetFileExInfoStandard, + &fs) != 0) { - return 0; + ct = windows_filetime_to_posix_time(fs.ftCreationTime); } - else +#else + struct stat fs; + if (stat(filename, &fs) == 0) { - return fs.st_ctime >= 0 ? static_cast(fs.st_ctime) : 0; + ct = fs.st_ctime >= 0 ? static_cast(fs.st_ctime) : 0; } +#endif + return ct; } bool SystemTools::ConvertDateMacroString(const char *str, time_t *tmt) @@ -2406,7 +2530,8 @@ bool SystemTools::RemoveFile(const char* source) SystemTools::SetPermissions(source, S_IWRITE); #endif #ifdef _WIN32 - bool res = _wunlink(Encoding::ToWide(source).c_str()) != 0 ? false : true; + bool res = + _wunlink(SystemTools::ConvertToWindowsExtendedPath(source).c_str()) == 0; #else bool res = unlink(source) != 0 ? false : true; #endif @@ -2435,7 +2560,12 @@ bool SystemTools::RemoveADirectory(const char* source) } Directory dir; +#ifdef _WIN32 + dir.Load(Encoding::ToNarrow( + SystemTools::ConvertToWindowsExtendedPath(source)).c_str()); +#else dir.Load(source); +#endif size_t fileNum; for (fileNum = 0; fileNum < dir.GetNumberOfFiles(); ++fileNum) { @@ -2849,7 +2979,8 @@ bool SystemTools::FileIsDirectory(const char* name) // Now check the file node type. #if defined( _WIN32 ) - DWORD attr = GetFileAttributesW(Encoding::ToWide(name).c_str()); + DWORD attr = GetFileAttributesW( + SystemTools::ConvertToWindowsExtendedPath(name).c_str()); if (attr != INVALID_FILE_ATTRIBUTES) { return (attr & FILE_ATTRIBUTE_DIRECTORY) != 0; @@ -4041,7 +4172,7 @@ bool SystemTools::GetShortPath(const kwsys_stl::string& path, kwsys_stl::string& kwsys_stl::wstring wtempPath = Encoding::ToWide(tempPath); kwsys_stl::vector buffer(wtempPath.size()+1); buffer[0] = 0; - ret = GetShortPathNameW(Encoding::ToWide(tempPath).c_str(), + ret = GetShortPathNameW(wtempPath.c_str(), &buffer[0], static_cast(wtempPath.size())); if(buffer[0] == 0 || ret > wtempPath.size()) @@ -4279,7 +4410,8 @@ bool SystemTools::GetPermissions(const char* file, mode_t& mode) } #if defined(_WIN32) - DWORD attr = GetFileAttributesW(Encoding::ToWide(file).c_str()); + DWORD attr = GetFileAttributesW( + SystemTools::ConvertToWindowsExtendedPath(file).c_str()); if(attr == INVALID_FILE_ATTRIBUTES) { return false; @@ -4331,7 +4463,8 @@ bool SystemTools::SetPermissions(const char* file, mode_t mode) return false; } #ifdef _WIN32 - if ( _wchmod(Encoding::ToWide(file).c_str(), mode) < 0 ) + if ( _wchmod(SystemTools::ConvertToWindowsExtendedPath(file).c_str(), + mode) < 0 ) #else if ( chmod(file, mode) < 0 ) #endif diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in index fb55848..b7c7206 100644 --- a/SystemTools.hxx.in +++ b/SystemTools.hxx.in @@ -249,7 +249,18 @@ public: * Replace Windows file system slashes with Unix-style slashes. */ static void ConvertToUnixSlashes(kwsys_stl::string& path); - + +#ifdef _WIN32 + /** + * Convert the path to an extended length path to avoid MAX_PATH length + * limitations on Windows. If the input is a local path the result will be + * prefixed with \\?\; if the input is instead a network path, the result + * will be prefixed with \\?\UNC\. All output will also be converted to + * absolute paths with Windows-style backslashes. + **/ + static kwsys_stl::wstring ConvertToWindowsExtendedPath(const kwsys_stl::string&); +#endif + /** * For windows this calls ConvertToWindowsOutputPath and for unix * it calls ConvertToUnixOutputPath diff --git a/testDynamicLoader.cxx b/testDynamicLoader.cxx index 1bff707..58adb84 100644 --- a/testDynamicLoader.cxx +++ b/testDynamicLoader.cxx @@ -108,7 +108,7 @@ int testDynamicLoader(int argc, char *argv[]) // Make sure that inexistent lib is giving correct result res += TestDynamicLoader("azerty_", "foo_bar",0,0,0); // Make sure that random binary file cannot be assimilated as dylib - res += TestDynamicLoader(TEST_SYSTEMTOOLS_BIN_FILE, "wp",0,0,0); + res += TestDynamicLoader(TEST_SYSTEMTOOLS_SOURCE_DIR "/testSystemTools.bin", "wp",0,0,0); #endif #ifdef __linux__ diff --git a/testSystemTools.cxx b/testSystemTools.cxx index 69825a8..8b21081 100644 --- a/testSystemTools.cxx +++ b/testSystemTools.cxx @@ -98,32 +98,124 @@ static bool CheckEscapeChars(kwsys_stl::string input, static bool CheckFileOperations() { bool res = true; - - if (kwsys::SystemTools::DetectFileType(TEST_SYSTEMTOOLS_BIN_FILE) != + const kwsys_stl::string testBinFile(TEST_SYSTEMTOOLS_SOURCE_DIR + "/testSystemTools.bin"); + const kwsys_stl::string testTxtFile(TEST_SYSTEMTOOLS_SOURCE_DIR + "/testSystemTools.cxx"); + const kwsys_stl::string testNewDir(TEST_SYSTEMTOOLS_BINARY_DIR + "/testSystemToolsNewDir"); + const kwsys_stl::string testNewFile(testNewDir + "/testNewFile.txt"); + + if (kwsys::SystemTools::DetectFileType(testBinFile.c_str()) != kwsys::SystemTools::FileTypeBinary) { kwsys_ios::cerr << "Problem with DetectFileType - failed to detect type of: " - << TEST_SYSTEMTOOLS_BIN_FILE << kwsys_ios::endl; + << testBinFile << kwsys_ios::endl; res = false; } - if (kwsys::SystemTools::DetectFileType(TEST_SYSTEMTOOLS_SRC_FILE) != + if (kwsys::SystemTools::DetectFileType(testTxtFile.c_str()) != kwsys::SystemTools::FileTypeText) { kwsys_ios::cerr << "Problem with DetectFileType - failed to detect type of: " - << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; + << testTxtFile << kwsys_ios::endl; res = false; } - - if (kwsys::SystemTools::FileLength(TEST_SYSTEMTOOLS_BIN_FILE) != 766) + + if (kwsys::SystemTools::FileLength(testBinFile.c_str()) != 766) { kwsys_ios::cerr << "Problem with FileLength - incorrect length for: " - << TEST_SYSTEMTOOLS_BIN_FILE << kwsys_ios::endl; - res = false; + << testBinFile << kwsys_ios::endl; + res = false; + } + + if (!kwsys::SystemTools::MakeDirectory(testNewDir.c_str())) + { + kwsys_ios::cerr + << "Problem with MakeDirectory for: " + << testNewDir << kwsys_ios::endl; + res = false; + } + + if (!kwsys::SystemTools::Touch(testNewFile.c_str(), true)) + { + kwsys_ios::cerr + << "Problem with Touch for: " + << testNewFile << kwsys_ios::endl; + res = false; + } + + if (!kwsys::SystemTools::RemoveFile(testNewFile.c_str())) + { + kwsys_ios::cerr + << "Problem with RemoveFile: " + << testNewFile << kwsys_ios::endl; + res = false; + } + + kwsys::SystemTools::Touch(testNewFile.c_str(), true); + if (!kwsys::SystemTools::RemoveADirectory(testNewDir.c_str())) + { + kwsys_ios::cerr + << "Problem with RemoveADirectory for: " + << testNewDir << kwsys_ios::endl; + res = false; + } + +#ifdef KWSYS_TEST_SYSTEMTOOLS_LONG_PATHS + // Perform the same file and directory creation and deletion tests but + // with paths > 256 characters in length. + + const kwsys_stl::string testNewLongDir( + TEST_SYSTEMTOOLS_BINARY_DIR "/" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "01234567890123"); + const kwsys_stl::string testNewLongFile(testNewLongDir + "/" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "0123456789.txt"); + + if (!kwsys::SystemTools::MakeDirectory(testNewLongDir.c_str())) + { + kwsys_ios::cerr + << "Problem with MakeDirectory for: " + << testNewLongDir << kwsys_ios::endl; + res = false; + } + + if (!kwsys::SystemTools::Touch(testNewLongFile.c_str(), true)) + { + kwsys_ios::cerr + << "Problem with Touch for: " + << testNewLongFile << kwsys_ios::endl; + res = false; + } + + if (!kwsys::SystemTools::RemoveFile(testNewLongFile.c_str())) + { + kwsys_ios::cerr + << "Problem with RemoveFile: " + << testNewLongFile << kwsys_ios::endl; + res = false; + } + + kwsys::SystemTools::Touch(testNewLongFile.c_str(), true); + if (!kwsys::SystemTools::RemoveADirectory(testNewLongDir.c_str())) + { + kwsys_ios::cerr + << "Problem with RemoveADirectory for: " + << testNewLongDir << kwsys_ios::endl; + res = false; } +#endif return res; } @@ -138,7 +230,7 @@ static bool CheckStringOperations() { kwsys_ios::cerr << "Problem with CapitalizedWords " - << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; + << '"' << test << '"' << kwsys_ios::endl; res = false; } @@ -148,7 +240,7 @@ static bool CheckStringOperations() { kwsys_ios::cerr << "Problem with UnCapitalizedWords " - << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; + << '"' << test << '"' << kwsys_ios::endl; res = false; } @@ -158,7 +250,7 @@ static bool CheckStringOperations() { kwsys_ios::cerr << "Problem with AddSpaceBetweenCapitalizedWords " - << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; + << '"' << test << '"' << kwsys_ios::endl; res = false; } @@ -168,7 +260,7 @@ static bool CheckStringOperations() { kwsys_ios::cerr << "Problem with AppendStrings " - << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; + << "\"Mary Had A\" \" Little Lamb.\"" << kwsys_ios::endl; res = false; } delete [] cres; @@ -179,7 +271,7 @@ static bool CheckStringOperations() { kwsys_ios::cerr << "Problem with AppendStrings " - << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; + << "\"Mary Had\" \" A \" \"Little Lamb.\"" << kwsys_ios::endl; res = false; } delete [] cres; @@ -188,7 +280,7 @@ static bool CheckStringOperations() { kwsys_ios::cerr << "Problem with CountChar " - << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; + << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; res = false; } @@ -198,7 +290,7 @@ static bool CheckStringOperations() { kwsys_ios::cerr << "Problem with RemoveChars " - << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; + << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; res = false; } delete [] cres; @@ -209,7 +301,7 @@ static bool CheckStringOperations() { kwsys_ios::cerr << "Problem with RemoveCharsButUpperHex " - << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; + << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; res = false; } delete [] cres; @@ -221,7 +313,7 @@ static bool CheckStringOperations() { kwsys_ios::cerr << "Problem with ReplaceChars " - << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; + << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; res = false; } delete [] cres2; @@ -231,7 +323,7 @@ static bool CheckStringOperations() { kwsys_ios::cerr << "Problem with StringStartsWith " - << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; + << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; res = false; } @@ -240,7 +332,7 @@ static bool CheckStringOperations() { kwsys_ios::cerr << "Problem with StringEndsWith " - << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; + << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; res = false; } @@ -249,7 +341,7 @@ static bool CheckStringOperations() { kwsys_ios::cerr << "Problem with DuplicateString " - << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; + << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; res = false; } delete [] cres; @@ -260,7 +352,7 @@ static bool CheckStringOperations() { kwsys_ios::cerr << "Problem with CropString " - << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; + << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; res = false; } @@ -271,16 +363,124 @@ static bool CheckStringOperations() { kwsys_ios::cerr << "Problem with Split " - << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; - res = false; + << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; + res = false; + } + +#ifdef _WIN32 + if (kwsys::SystemTools::ConvertToWindowsExtendedPath + ("L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") != + L"\\\\?\\L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") + { + kwsys_ios::cerr + << "Problem with ConvertToWindowsExtendedPath " + << "\"L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"" + << kwsys_ios::endl; + res = false; } + if (kwsys::SystemTools::ConvertToWindowsExtendedPath + ("L:/Local Mojo/Hex Power Pack/Iffy Voodoo") != + L"\\\\?\\L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") + { + kwsys_ios::cerr + << "Problem with ConvertToWindowsExtendedPath " + << "\"L:/Local Mojo/Hex Power Pack/Iffy Voodoo\"" + << kwsys_ios::endl; + res = false; + } + + if (kwsys::SystemTools::ConvertToWindowsExtendedPath + ("\\\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") != + L"\\\\?\\UNC\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") + { + kwsys_ios::cerr + << "Problem with ConvertToWindowsExtendedPath " + << "\"\\\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"" + << kwsys_ios::endl; + res = false; + } + + if (kwsys::SystemTools::ConvertToWindowsExtendedPath + ("//Foo/Local Mojo/Hex Power Pack/Iffy Voodoo") != + L"\\\\?\\UNC\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") + { + kwsys_ios::cerr + << "Problem with ConvertToWindowsExtendedPath " + << "\"//Foo/Local Mojo/Hex Power Pack/Iffy Voodoo\"" + << kwsys_ios::endl; + res = false; + } + + if (kwsys::SystemTools::ConvertToWindowsExtendedPath("//") != + L"//") + { + kwsys_ios::cerr + << "Problem with ConvertToWindowsExtendedPath " + << "\"//\"" + << kwsys_ios::endl; + res = false; + } + + if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\") != + L"\\\\.\\") + { + kwsys_ios::cerr + << "Problem with ConvertToWindowsExtendedPath " + << "\"\\\\.\\\"" + << kwsys_ios::endl; + res = false; + } + + if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X") != + L"\\\\.\\X") + { + kwsys_ios::cerr + << "Problem with ConvertToWindowsExtendedPath " + << "\"\\\\.\\X\"" + << kwsys_ios::endl; + res = false; + } + + if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X:") != + L"\\\\?\\X:") + { + kwsys_ios::cerr + << "Problem with ConvertToWindowsExtendedPath " + << "\"\\\\.\\X:\"" + << kwsys_ios::endl; + res = false; + } + + if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X:\\") != + L"\\\\?\\X:\\") + { + kwsys_ios::cerr + << "Problem with ConvertToWindowsExtendedPath " + << "\"\\\\.\\X:\\\"" + << kwsys_ios::endl; + res = false; + } + + if (kwsys::SystemTools::ConvertToWindowsExtendedPath("NUL") != + L"\\\\.\\NUL") + { + kwsys_ios::cerr + << "Problem with ConvertToWindowsExtendedPath " + << "\"NUL\"" + << kwsys_ios::endl; + res = false; + } + +#endif + if (kwsys::SystemTools::ConvertToWindowsOutputPath ("L://Local Mojo/Hex Power Pack/Iffy Voodoo") != "\"L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"") { kwsys_ios::cerr << "Problem with ConvertToWindowsOutputPath " + << "\"L://Local Mojo/Hex Power Pack/Iffy Voodoo\"" << kwsys_ios::endl; res = false; } @@ -291,6 +491,7 @@ static bool CheckStringOperations() { kwsys_ios::cerr << "Problem with ConvertToWindowsOutputPath " + << "\"//grayson/Local Mojo/Hex Power Pack/Iffy Voodoo\"" << kwsys_ios::endl; res = false; } @@ -301,6 +502,7 @@ static bool CheckStringOperations() { kwsys_ios::cerr << "Problem with ConvertToUnixOutputPath " + << "\"//Local Mojo/Hex Power Pack/Iffy Voodoo\"" << kwsys_ios::endl; res = false; } @@ -308,14 +510,17 @@ static bool CheckStringOperations() int targc; char **targv; kwsys::SystemTools::ConvertWindowsCommandLineToUnixArguments - ("\"Local Mojo\\Voodoo.asp\" -CastHex \"D:\\My Secret Mojo\\Voodoo.mp3\"", &targc, &targv); + ("\"Local Mojo\\Voodoo.asp\" -CastHex \"D:\\My Secret Mojo\\Voodoo.mp3\"", + &targc, &targv); if (targc != 4 || strcmp(targv[1],"Local Mojo\\Voodoo.asp") || strcmp(targv[2],"-CastHex") || strcmp(targv[3],"D:\\My Secret Mojo\\Voodoo.mp3")) { kwsys_ios::cerr << "Problem with ConvertWindowsCommandLineToUnixArguments" - << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; + << "\'\"Local Mojo\\Voodoo.asp\" " + << "-CastHex \"D:\\My Secret Mojo\\Voodoo.mp3\"\'" + << kwsys_ios::endl; res = false; } for (;targc >=0; --targc) diff --git a/testSystemTools.h.in b/testSystemTools.h.in index 4b94bb6..66f0f72 100644 --- a/testSystemTools.h.in +++ b/testSystemTools.h.in @@ -14,7 +14,8 @@ #define EXECUTABLE_OUTPUT_PATH "@CMAKE_CURRENT_BINARY_DIR@" -#define TEST_SYSTEMTOOLS_BIN_FILE "@TEST_SYSTEMTOOLS_BIN_FILE@" -#define TEST_SYSTEMTOOLS_SRC_FILE "@TEST_SYSTEMTOOLS_SRC_FILE@" +#define TEST_SYSTEMTOOLS_SOURCE_DIR "@TEST_SYSTEMTOOLS_SOURCE_DIR@" +#define TEST_SYSTEMTOOLS_BINARY_DIR "@TEST_SYSTEMTOOLS_BINARY_DIR@" +#cmakedefine KWSYS_TEST_SYSTEMTOOLS_LONG_PATHS #endif ----------------------------------------------------------------------- Summary of changes: Source/kwsys/CMakeLists.txt | 7 +- Source/kwsys/Directory.cxx | 13 +- Source/kwsys/SystemTools.cxx | 209 +++++++++++++++++++++++------ Source/kwsys/SystemTools.hxx.in | 13 +- Source/kwsys/testDynamicLoader.cxx | 2 +- Source/kwsys/testSystemTools.cxx | 257 ++++++++++++++++++++++++++++++++---- Source/kwsys/testSystemTools.h.in | 5 +- 7 files changed, 432 insertions(+), 74 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 11:04:07 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 11:04:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4134-gc3faff3 Message-ID: <20140707150407.0A49739AA1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via c3faff3094fa3f67ea72900801f2eea278654ef4 (commit) via 49f32168546ea8f2ef8e6a2e65c114c07edd0e69 (commit) from ae3b051f3d7df69ccc09db9b8dbe3cabe2df05e2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c3faff3094fa3f67ea72900801f2eea278654ef4 commit c3faff3094fa3f67ea72900801f2eea278654ef4 Merge: ae3b051 49f3216 Author: Brad King AuthorDate: Mon Jul 7 11:04:06 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 7 11:04:06 2014 -0400 Merge topic 'CMakeExpandImportedTargets-CMP0045' into next 49f32168 CMakeExpandImportedTargets: Do not read property on non-target (#15008) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49f32168546ea8f2ef8e6a2e65c114c07edd0e69 commit 49f32168546ea8f2ef8e6a2e65c114c07edd0e69 Author: Brad King AuthorDate: Mon Jul 7 10:58:43 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 10:58:43 2014 -0400 CMakeExpandImportedTargets: Do not read property on non-target (#15008) Avoid behavior that is disallowed by CMP0045. Check whether a target exists before trying to read its properties. diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake index 0752e04..b6ab7ef 100644 --- a/Modules/CMakeExpandImportedTargets.cmake +++ b/Modules/CMakeExpandImportedTargets.cmake @@ -71,7 +71,11 @@ function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT ) set(_CCSR_NEW_REQ_LIBS ) set(_CHECK_FOR_IMPORTED_TARGETS FALSE) foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) - get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS) + if(TARGET "${_CURRENT_LIB}") + get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS) + else() + set(_importedConfigs "") + endif() if (_importedConfigs) # message(STATUS "Detected imported target ${_CURRENT_LIB}") # Ok, so this is an imported target. @@ -123,7 +127,11 @@ function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT ) # all remaining imported target names (there shouldn't be any left anyway). set(_CCSR_NEW_REQ_LIBS ) foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) - get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS) + if(TARGET "${_CURRENT_LIB}") + get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS) + else() + set(_importedConfigs "") + endif() if (NOT _importedConfigs) list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" ) # message(STATUS "final: appending ${_CURRENT_LIB}") ----------------------------------------------------------------------- Summary of changes: Modules/CMakeExpandImportedTargets.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 11:31:34 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 11:31:34 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4136-gb8eab3e Message-ID: <20140707153134.220B939718@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via b8eab3e43c2a3520afdd310441ff3a83131cc70a (commit) via 38d3fe0785e7691d19d015b43d2bb9d6d17bbd1f (commit) from c3faff3094fa3f67ea72900801f2eea278654ef4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b8eab3e43c2a3520afdd310441ff3a83131cc70a commit b8eab3e43c2a3520afdd310441ff3a83131cc70a Merge: c3faff3 38d3fe0 Author: Brad King AuthorDate: Mon Jul 7 11:31:33 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 7 11:31:33 2014 -0400 Merge topic 'build-KWIML-always' into next 38d3fe07 Tests: Build and test KWIML even when testing an external CMake http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=38d3fe0785e7691d19d015b43d2bb9d6d17bbd1f commit 38d3fe0785e7691d19d015b43d2bb9d6d17bbd1f Author: Brad King AuthorDate: Mon Jul 7 11:23:13 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 11:32:06 2014 -0400 Tests: Build and test KWIML even when testing an external CMake The CMake_TEST_EXTERNAL_CMAKE option added by commit 9608ef6f (Tests: Optionally configure tests exclusively, 2014-03-03) is intended to allow one to run the CMake test suite with a compiler that may not be supported for hosting the build of CMake itself. However, we currently use the CMake test infrastructure to test KWIML everywhere that CMake supports. In order to continue testing KWIML even in places that CMake itself does not build, include it even when testing an external CMake. diff --git a/CMakeLists.txt b/CMakeLists.txt index 41ff4a6..e210f74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,12 +201,6 @@ endmacro() #----------------------------------------------------------------------- macro (CMAKE_BUILD_UTILITIES) #--------------------------------------------------------------------- - # Create the KWIML library for CMake. - set(KWIML cmIML) - set(KWIML_HEADER_ROOT ${CMake_BINARY_DIR}/Utilities) - add_subdirectory(Utilities/KWIML) - - #--------------------------------------------------------------------- # Create the kwsys library for CMake. set(KWSYS_NAMESPACE cmsys) set(KWSYS_USE_SystemTools 1) @@ -465,6 +459,11 @@ if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x") set(CMAKE_TESTS_CDASH_SERVER "http://open.cdash.org") endif() +# Create the KWIML library for CMake. +set(KWIML cmIML) +set(KWIML_HEADER_ROOT ${CMake_BINARY_DIR}/Utilities) +add_subdirectory(Utilities/KWIML) + if(NOT CMake_TEST_EXTERNAL_CMAKE) # build the utilities (a macro defined in this file) CMAKE_BUILD_UTILITIES() ----------------------------------------------------------------------- Summary of changes: CMakeLists.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 14:39:06 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 14:39:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4138-g621ae93 Message-ID: <20140707183906.CF3C6283A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 621ae93243cff7d8896cb7ac4cddd6a0364747b2 (commit) via 33aa35a7e8bbfb32c516f1c866b93cf101151b93 (commit) from b8eab3e43c2a3520afdd310441ff3a83131cc70a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=621ae93243cff7d8896cb7ac4cddd6a0364747b2 commit 621ae93243cff7d8896cb7ac4cddd6a0364747b2 Merge: b8eab3e 33aa35a Author: Brad King AuthorDate: Mon Jul 7 14:39:06 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 7 14:39:06 2014 -0400 Merge topic 'allow-OBJECT-library-extra-sources' into next 33aa35a7 Help: Add notes for topic 'allow-OBJECT-library-extra-sources' http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=33aa35a7e8bbfb32c516f1c866b93cf101151b93 commit 33aa35a7e8bbfb32c516f1c866b93cf101151b93 Author: Brad King AuthorDate: Mon Jul 7 14:39:53 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 14:39:53 2014 -0400 Help: Add notes for topic 'allow-OBJECT-library-extra-sources' diff --git a/Help/release/dev/allow-OBJECT-library-extra-sources.rst b/Help/release/dev/allow-OBJECT-library-extra-sources.rst new file mode 100644 index 0000000..472fcdc --- /dev/null +++ b/Help/release/dev/allow-OBJECT-library-extra-sources.rst @@ -0,0 +1,6 @@ +allow-OBJECT-library-extra-sources +---------------------------------- + +* :ref:`Object Libraries` may now have extra sources that do not + compile to object files so long as they would not affect linking + of a normal library (e.g. ``.dat`` is okay but not ``.def``). ----------------------------------------------------------------------- Summary of changes: Help/release/dev/allow-OBJECT-library-extra-sources.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/allow-OBJECT-library-extra-sources.rst hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 14:44:44 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 14:44:44 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4140-gc91c14f Message-ID: <20140707184444.8A88D38DB8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via c91c14f28c3f31981305f5de6a440144e41f0d01 (commit) via d17688e42569c5e6c99c64338981943c5945067b (commit) from 621ae93243cff7d8896cb7ac4cddd6a0364747b2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c91c14f28c3f31981305f5de6a440144e41f0d01 commit c91c14f28c3f31981305f5de6a440144e41f0d01 Merge: 621ae93 d17688e Author: Brad King AuthorDate: Mon Jul 7 14:44:43 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 7 14:44:43 2014 -0400 Merge topic 'export-from-obj-libs' into next d17688e4 Help: Add notes for topic 'export-from-obj-libs' http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d17688e42569c5e6c99c64338981943c5945067b commit d17688e42569c5e6c99c64338981943c5945067b Author: Brad King AuthorDate: Mon Jul 7 14:44:28 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 14:44:28 2014 -0400 Help: Add notes for topic 'export-from-obj-libs' diff --git a/Help/release/dev/export-from-obj-libs.rst b/Help/release/dev/export-from-obj-libs.rst new file mode 100644 index 0000000..6d58288 --- /dev/null +++ b/Help/release/dev/export-from-obj-libs.rst @@ -0,0 +1,5 @@ +export-from-obj-libs +-------------------- + +* The :module:`GenerateExportHeader` module ``generate_export_header`` + function learned to allow use with :ref:`Object Libraries`. ----------------------------------------------------------------------- Summary of changes: Help/release/dev/export-from-obj-libs.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Help/release/dev/export-from-obj-libs.rst hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 15:08:38 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 15:08:38 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1334-g4e7983b Message-ID: <20140707190838.97F7939D2E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 4e7983bc06219e24ff37699b66a1e1697d2fc171 (commit) via d17688e42569c5e6c99c64338981943c5945067b (commit) from 61be345115b5f2c402286be7fa3e6df0c2f5f0ac (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4e7983bc06219e24ff37699b66a1e1697d2fc171 commit 4e7983bc06219e24ff37699b66a1e1697d2fc171 Merge: 61be345 d17688e Author: Brad King AuthorDate: Mon Jul 7 15:08:37 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 7 15:08:37 2014 -0400 Merge topic 'export-from-obj-libs' d17688e4 Help: Add notes for topic 'export-from-obj-libs' ----------------------------------------------------------------------- Summary of changes: Help/release/dev/export-from-obj-libs.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Help/release/dev/export-from-obj-libs.rst hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 7 15:08:59 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 7 Jul 2014 15:08:59 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4142-g1d7e20c Message-ID: <20140707190859.0F91539D3D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 1d7e20ccc0a1a1bc7013dada619e8f6a7a85382a (commit) via 4e7983bc06219e24ff37699b66a1e1697d2fc171 (commit) from c91c14f28c3f31981305f5de6a440144e41f0d01 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1d7e20ccc0a1a1bc7013dada619e8f6a7a85382a commit 1d7e20ccc0a1a1bc7013dada619e8f6a7a85382a Merge: c91c14f 4e7983b Author: Brad King AuthorDate: Mon Jul 7 15:10:10 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 15:10:10 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From cmake-commits at cmake.org Mon Jul 7 15:26:51 2014 From: cmake-commits at cmake.org (cmake-commits at cmake.org) Date: Mon, 7 Jul 2014 15:26:51 -0400 (EDT) Subject: [Cmake-commits] CMake branch, hooks, updated. b9b952190a736e30ef33f2a75cf4aab45bcb3b5a Message-ID: <20140707192651.3103139595@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, hooks has been updated via b9b952190a736e30ef33f2a75cf4aab45bcb3b5a (commit) from 11679f83379b6cf5141cf79af56ab7ff966ef797 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b9b952190a736e30ef33f2a75cf4aab45bcb3b5a commit b9b952190a736e30ef33f2a75cf4aab45bcb3b5a Author: Brad King AuthorDate: Mon Jul 7 15:18:38 2014 -0400 Commit: Brad King CommitDate: Mon Jul 7 15:19:30 2014 -0400 Add .gitattributes to tell git to use LF newlines These hook scripts execute with bash and need LF newlines. Set eol=lf to get LF newlines even when core.autocrlf is enabled. While at it, also enable whitespace=indent-with-non-tab. diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..246b99e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +.git* export-ignore +* eol=lf whitespace=indent-with-non-tab ----------------------------------------------------------------------- Summary of changes: .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes hooks/post-receive -- CMake From bill.hoffman at kitware.com Mon Jul 7 16:20:14 2014 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Mon, 7 Jul 2014 16:20:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4144-gf2fb315 Message-ID: <20140707202014.1397338EC5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f2fb31516ac8b563c0305169a95337551b60f016 (commit) via b83fbc252732d2cc2b579489e788dc0284e34526 (commit) from 1d7e20ccc0a1a1bc7013dada619e8f6a7a85382a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f2fb31516ac8b563c0305169a95337551b60f016 commit f2fb31516ac8b563c0305169a95337551b60f016 Merge: 1d7e20c b83fbc2 Author: Bill Hoffman AuthorDate: Mon Jul 7 16:20:12 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 7 16:20:12 2014 -0400 Merge topic 'thread-sanitizer' into next b83fbc25 add support for ThreadSanitizer http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b83fbc252732d2cc2b579489e788dc0284e34526 commit b83fbc252732d2cc2b579489e788dc0284e34526 Author: Bill Hoffman AuthorDate: Mon Jul 7 15:58:02 2014 -0400 Commit: Bill Hoffman CommitDate: Mon Jul 7 16:18:26 2014 -0400 add support for ThreadSanitizer This commit adds support for ThreadSanitizer to ctest. ThreadSanitizer is part of the clang compiler and also gcc 4.8 and later. You have to compile the code with special flags. Then your code gets the the ThreadSanitizer ability built into it. To pass options to the ThreadSanitizer you use an environment variable. This commit teaches ctest to parse the output from ThreadSanitizer and send it to CDash. diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 983bf22..05a7b33 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -344,6 +344,7 @@ Variables for CTest /variable/CTEST_MEMORYCHECK_COMMAND /variable/CTEST_MEMORYCHECK_COMMAND_OPTIONS /variable/CTEST_MEMORYCHECK_SUPPRESSIONS_FILE + /variable/CTEST_MEMORYCHECK_TYPE /variable/CTEST_NIGHTLY_START_TIME /variable/CTEST_P4_CLIENT /variable/CTEST_P4_COMMAND diff --git a/Help/variable/CTEST_MEMORYCHECK_TYPE.rst b/Help/variable/CTEST_MEMORYCHECK_TYPE.rst new file mode 100644 index 0000000..f7875da --- /dev/null +++ b/Help/variable/CTEST_MEMORYCHECK_TYPE.rst @@ -0,0 +1,6 @@ +CTEST_MEMORYCHECK_TYPE +------------------------- + +Specify the CTest ``MemoryCheckType`` setting +in a :manual:`ctest(1)` dashboard client script. +Valid values are Valgrind, Purify, BoundsChecker, and ThreadSanitizer. diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx index 535c993..939b4dc 100644 --- a/Source/CTest/cmCTestMemCheckCommand.cxx +++ b/Source/CTest/cmCTestMemCheckCommand.cxx @@ -21,6 +21,8 @@ cmCTestGenericHandler* cmCTestMemCheckCommand::InitializeActualHandler() = this->CTest->GetInitializedHandler("memcheck"); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, + "MemoryCheckType", "CTEST_MEMORYCHECK_TYPE"); + this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "MemoryCheckCommand", "CTEST_MEMORYCHECK_COMMAND"); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "MemoryCheckCommandOptions", "CTEST_MEMORYCHECK_COMMAND_OPTIONS"); diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 7b50174..bcf09ad 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include #include "cmMakefile.h" #include "cmXMLSafe.h" @@ -124,60 +125,7 @@ public: #define BOUNDS_CHECKER_MARKER \ "******######*****Begin BOUNDS CHECKER XML******######******" -//---------------------------------------------------------------------- -static const char* cmCTestMemCheckResultStrings[] = { - "ABR", - "ABW", - "ABWL", - "COR", - "EXU", - "FFM", - "FIM", - "FMM", - "FMR", - "FMW", - "FUM", - "IPR", - "IPW", - "MAF", - "MLK", - "MPK", - "NPR", - "ODS", - "PAR", - "PLK", - "UMC", - "UMR", - 0 -}; - -//---------------------------------------------------------------------- -static const char* cmCTestMemCheckResultLongStrings[] = { - "Threading Problem", - "ABW", - "ABWL", - "COR", - "EXU", - "FFM", - "FIM", - "Mismatched deallocation", - "FMR", - "FMW", - "FUM", - "IPR", - "IPW", - "MAF", - "Memory Leak", - "Potential Memory Leak", - "NPR", - "ODS", - "Invalid syscall param", - "PLK", - "Uninitialized Memory Conditional", - "Uninitialized Memory Read", - 0 -}; //---------------------------------------------------------------------- @@ -186,12 +134,14 @@ cmCTestMemCheckHandler::cmCTestMemCheckHandler() this->MemCheck = true; this->CustomMaximumPassedTestOutputSize = 0; this->CustomMaximumFailedTestOutputSize = 0; + this->LogWithPID = false; } //---------------------------------------------------------------------- void cmCTestMemCheckHandler::Initialize() { this->Superclass::Initialize(); + this->LogWithPID = false; this->CustomMaximumPassedTestOutputSize = 0; this->CustomMaximumFailedTestOutputSize = 0; this->MemoryTester = ""; @@ -199,12 +149,6 @@ void cmCTestMemCheckHandler::Initialize() this->MemoryTesterOptions.clear(); this->MemoryTesterStyle = UNKNOWN; this->MemoryTesterOutputFile = ""; - int cc; - for ( cc = 0; cc < NO_MEMORY_FAULT; cc ++ ) - { - this->MemoryTesterGlobalResults[cc] = 0; - } - } //---------------------------------------------------------------------- @@ -249,8 +193,8 @@ void cmCTestMemCheckHandler::GenerateTestCommand( index = stream.str(); for ( pp = 0; pp < this->MemoryTesterDynamicOptions.size(); pp ++ ) { - std::string arg = this->MemoryTesterDynamicOptions[pp]; - std::string::size_type pos = arg.find("??"); + std::string arg = this->MemoryTesterDynamicOptions[pp]; + std::string::size_type pos = arg.find("??"); if (pos != std::string::npos) { arg.replace(pos, 2, index); @@ -260,18 +204,125 @@ void cmCTestMemCheckHandler::GenerateTestCommand( memcheckcommand += arg; memcheckcommand += "\""; } + // Create a copy of the memory tester environment variable. + // This is used for memory testing programs that pass options + // via environment varaibles. + std::string memTesterEnvironmentVariable = + this->MemoryTesterEnvironmentVariable; for ( pp = 0; pp < this->MemoryTesterOptions.size(); pp ++ ) { - args.push_back(this->MemoryTesterOptions[pp]); - memcheckcommand += " \""; - memcheckcommand += this->MemoryTesterOptions[pp]; - memcheckcommand += "\""; + if(memTesterEnvironmentVariable.size()) + { + // If we are using env to pass options, append all the options to + // this string with space separation. + memTesterEnvironmentVariable += " " + this->MemoryTesterOptions[pp]; + } + // for regular options just add them to args and memcheckcommand + // which is just used for display + else + { + args.push_back(this->MemoryTesterOptions[pp]); + memcheckcommand += " \""; + memcheckcommand += this->MemoryTesterOptions[pp]; + memcheckcommand += "\""; + } + } + // if this is an env option type, then add the env string as a single + // argument. + if(memTesterEnvironmentVariable.size()) + { + std::string::size_type pos = memTesterEnvironmentVariable.find("??"); + if (pos != std::string::npos) + { + memTesterEnvironmentVariable.replace(pos, 2, index); + } + memcheckcommand += " " + memTesterEnvironmentVariable; + args.push_back(memTesterEnvironmentVariable); } cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Memory check command: " << memcheckcommand << std::endl); } //---------------------------------------------------------------------- +void cmCTestMemCheckHandler::InitializeResultsVectors() +{ + // fill these members +// cmsys::vector ResultStrings; +// cmsys::vector ResultStringsLong; +// cmsys::vector GlobalResults; + this->ResultStringsLong.clear(); + this->ResultStrings.clear(); + this->GlobalResults.clear(); + // If we are working with style checkers that dynamically fill + // the results strings then return. + if(this->MemoryTesterStyle > cmCTestMemCheckHandler::BOUNDS_CHECKER) + { + return; + } + + // define the standard set of errors + //---------------------------------------------------------------------- + static const char* cmCTestMemCheckResultStrings[] = { + "ABR", + "ABW", + "ABWL", + "COR", + "EXU", + "FFM", + "FIM", + "FMM", + "FMR", + "FMW", + "FUM", + "IPR", + "IPW", + "MAF", + "MLK", + "MPK", + "NPR", + "ODS", + "PAR", + "PLK", + "UMC", + "UMR", + 0 + }; +//---------------------------------------------------------------------- + static const char* cmCTestMemCheckResultLongStrings[] = { + "Threading Problem", + "ABW", + "ABWL", + "COR", + "EXU", + "FFM", + "FIM", + "Mismatched deallocation", + "FMR", + "FMW", + "FUM", + "IPR", + "IPW", + "MAF", + "Memory Leak", + "Potential Memory Leak", + "NPR", + "ODS", + "Invalid syscall param", + "PLK", + "Uninitialized Memory Conditional", + "Uninitialized Memory Read", + 0 + }; + this->GlobalResults.clear(); + for(int i =0; cmCTestMemCheckResultStrings[i] != 0; ++i) + { + this->ResultStrings.push_back(cmCTestMemCheckResultStrings[i]); + this->ResultStringsLong.push_back(cmCTestMemCheckResultLongStrings[i]); + this->GlobalResults.push_back(0); + } +} + +//---------------------------------------------------------------------- void cmCTestMemCheckHandler::PopulateCustomVectors(cmMakefile *mf) { this->cmCTestTestHandler::PopulateCustomVectors(mf); @@ -283,6 +334,8 @@ void cmCTestMemCheckHandler::PopulateCustomVectors(cmMakefile *mf) this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_MEMCHECK_IGNORE", this->CustomTestsIgnore); + this->CTest->SetCTestConfigurationFromCMakeVariable( + mf, "CMakeCommand", "CMAKE_COMMAND"); } //---------------------------------------------------------------------- @@ -292,7 +345,6 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) { return; } - this->CTest->StartXML(os, this->AppendXML); os << "MemoryTesterStyle ) @@ -306,6 +358,9 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) case cmCTestMemCheckHandler::BOUNDS_CHECKER: os << "BoundsChecker"; break; + case cmCTestMemCheckHandler::THREAD_SANITIZER: + os << "ThreadSanitizer"; + break; default: os << "Unknown"; } @@ -333,8 +388,7 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) { cmCTestTestResult *result = &this->TestResults[cc]; std::string memcheckstr; - int memcheckresults[cmCTestMemCheckHandler::NO_MEMORY_FAULT]; - int kk; + std::vector memcheckresults(this->ResultStrings.size(), 0); bool res = this->ProcessMemCheckOutput(result->Output, memcheckstr, memcheckresults); if ( res && result->Status == cmCTestMemCheckHandler::COMPLETED ) @@ -345,16 +399,17 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) static_cast(this->CustomMaximumFailedTestOutputSize)); this->WriteTestResultHeader(os, result); os << "\t\t" << std::endl; - for ( kk = 0; cmCTestMemCheckResultLongStrings[kk]; kk ++ ) + for(std::vector::size_type kk = 0; + kk < memcheckresults.size(); ++kk) { if ( memcheckresults[kk] ) { - os << "\t\t\tResultStringsLong[kk] << "\">" << memcheckresults[kk] << "" << std::endl; } - this->MemoryTesterGlobalResults[kk] += memcheckresults[kk]; + this->GlobalResults[kk] += memcheckresults[kk]; } std::string logTag; @@ -383,9 +438,9 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) cmCTestLog(this->CTest, HANDLER_OUTPUT, "Memory checking results:" << std::endl); os << "\t" << std::endl; - for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ ) + for ( cc = 0; cc < this->GlobalResults.size(); cc ++ ) { - if ( this->MemoryTesterGlobalResults[cc] ) + if ( this->GlobalResults[cc] ) { #ifdef cerr # undef cerr @@ -393,9 +448,9 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) std::cerr.width(35); #define cerr no_cerr cmCTestLog(this->CTest, HANDLER_OUTPUT, - cmCTestMemCheckResultLongStrings[cc] << " - " - << this->MemoryTesterGlobalResults[cc] << std::endl); - os << "\t\tResultStringsLong[cc] << " - " + << this->GlobalResults[cc] << std::endl); + os << "\t\tResultStringsLong[cc] << "\"/>" << std::endl; } } @@ -410,13 +465,13 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) os << "" << std::endl; this->CTest->EndXML(os); - - } //---------------------------------------------------------------------- bool cmCTestMemCheckHandler::InitializeMemoryChecking() { + this->MemoryTesterEnvironmentVariable = ""; + this->MemoryTester = ""; // Setup the command if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration( "MemoryCheckCommand").c_str()) ) @@ -426,7 +481,9 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() std::string testerName = cmSystemTools::GetFilenameName(this->MemoryTester); // determine the checker type - if ( testerName.find("valgrind") != std::string::npos ) + if ( testerName.find("valgrind") != std::string::npos || + this->CTest->GetCTestConfiguration("MemoryCheckType") + == "Valgrind") { this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND; } @@ -464,12 +521,38 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() = this->CTest->GetCTestConfiguration("BoundsCheckerCommand").c_str(); this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER; } - else + if ( this->CTest->GetCTestConfiguration("MemoryCheckType") + == "ThreadSanitizer") + { + this->MemoryTester + = this->CTest->GetCTestConfiguration("CMakeCommand").c_str(); + this->MemoryTesterStyle = cmCTestMemCheckHandler::THREAD_SANITIZER; + this->LogWithPID = true; // even if we give the log file the pid is added + } + // Check the MemoryCheckType + if(this->MemoryTesterStyle == cmCTestMemCheckHandler::UNKNOWN) + { + std::string checkType = + this->CTest->GetCTestConfiguration("MemoryCheckType"); + if(checkType == "Purify") + { + this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY; + } + else if(checkType == "BoundsChecker") + { + this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER; + } + else if(checkType == "Valgrind") + { + this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND; + } + } + if(this->MemoryTester.size() == 0 ) { cmCTestLog(this->CTest, WARNING, - "Memory checker (MemoryCheckCommand) " - "not set, or cannot find the specified program." - << std::endl); + "Memory checker (MemoryCheckCommand) " + "not set, or cannot find the specified program." + << std::endl); return false; } @@ -568,6 +651,20 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() this->MemoryTesterOptions.push_back("/M"); break; } + case cmCTestMemCheckHandler::THREAD_SANITIZER: + { + // To pass arguments to ThreadSanitizer the environment variable + // TSAN_OPTIONS is used. This is done with the cmake -E env command. + // The MemoryTesterDynamicOptions is setup with the -E env + // Then the MemoryTesterEnvironmentVariable gets the + // TSAN_OPTIONS string with the log_path in it. + this->MemoryTesterDynamicOptions.push_back("-E"); + this->MemoryTesterDynamicOptions.push_back("env"); + std::string outputFile = "TSAN_OPTIONS=log_path=\"" + + this->MemoryTesterOutputFile + "\""; + this->MemoryTesterEnvironmentVariable = outputFile; + break; + } default: cmCTestLog(this->CTest, ERROR_MESSAGE, "Do not understand memory checker: " << this->MemoryTester @@ -575,24 +672,20 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() return false; } - std::vector::size_type cc; - for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ ) - { - this->MemoryTesterGlobalResults[cc] = 0; - } + this->InitializeResultsVectors(); + // std::vector::size_type cc; + // for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ ) + // { + // this->MemoryTesterGlobalResults[cc] = 0; + // } return true; } //---------------------------------------------------------------------- -bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str, - std::string& log, int* results) +bool cmCTestMemCheckHandler:: +ProcessMemCheckOutput(const std::string& str, + std::string& log, std::vector& results) { - std::string::size_type cc; - for ( cc = 0; cc < cmCTestMemCheckHandler::NO_MEMORY_FAULT; cc ++ ) - { - results[cc] = 0; - } - if ( this->MemoryTesterStyle == cmCTestMemCheckHandler::VALGRIND ) { return this->ProcessMemCheckValgrindOutput(str, log, results); @@ -602,6 +695,11 @@ bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str, return this->ProcessMemCheckPurifyOutput(str, log, results); } else if ( this->MemoryTesterStyle == + cmCTestMemCheckHandler::THREAD_SANITIZER ) + { + return this->ProcessMemCheckThreadSanitizerOutput(str, log, results); + } + else if ( this->MemoryTesterStyle == cmCTestMemCheckHandler::BOUNDS_CHECKER ) { return this->ProcessMemCheckBoundsCheckerOutput(str, log, results); @@ -612,15 +710,68 @@ bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str, log.append("None that I know"); log = str; } - - return true; } +std::vector::size_type cmCTestMemCheckHandler::FindOrAddWarning( + const std::string& warning) +{ + for(std::vector::size_type i =0; + i < this->ResultStrings.size(); ++i) + { + if(this->ResultStrings[i] == warning) + { + return i; + } + } + this->GlobalResults.push_back(0); // this must stay the same size + this->ResultStrings.push_back(warning); + this->ResultStringsLong.push_back(warning); + return this->ResultStrings.size()-1; +} +//---------------------------------------------------------------------- +bool cmCTestMemCheckHandler::ProcessMemCheckThreadSanitizerOutput( + const std::string& str, std::string& log, + std::vector& result) +{ + cmsys::RegularExpression + sanitizerWarning("WARNING: ThreadSanitizer: (.*) \\(pid=.*\\)"); + int defects = 0; + std::vector lines; + cmSystemTools::Split(str.c_str(), lines); + cmOStringStream ostr; + log = ""; + for( std::vector::iterator i = lines.begin(); + i != lines.end(); ++i) + { + if(sanitizerWarning.find(*i)) + { + std::string warning = sanitizerWarning.match(1); + std::vector::size_type idx = this->FindOrAddWarning(warning); + if(result.size() == 0 || idx > result.size()-1) + { + result.push_back(1); + } + else + { + result[idx]++; + } + defects++; + ostr << "" << this->ResultStrings[idx] << " "; + } + ostr << cmXMLSafe(*i) << std::endl; + } + log = ostr.str(); + if(defects) + { + return false; + } + return true; +} //---------------------------------------------------------------------- bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( const std::string& str, std::string& log, - int* results) + std::vector& results) { std::vector lines; cmSystemTools::Split(str.c_str(), lines); @@ -634,19 +785,19 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( for( std::vector::iterator i = lines.begin(); i != lines.end(); ++i) { - int failure = cmCTestMemCheckHandler::NO_MEMORY_FAULT; + std::vector::size_type failure = this->ResultStrings.size(); if ( pfW.find(*i) ) { - int cc; - for ( cc = 0; cc < cmCTestMemCheckHandler::NO_MEMORY_FAULT; cc ++ ) + std::vector::size_type cc; + for ( cc = 0; cc < this->ResultStrings.size(); cc ++ ) { - if ( pfW.match(1) == cmCTestMemCheckResultStrings[cc] ) + if ( pfW.match(1) == this->ResultStrings[cc] ) { failure = cc; break; } } - if ( cc == cmCTestMemCheckHandler::NO_MEMORY_FAULT ) + if ( cc == this->ResultStrings.size() ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown Purify memory fault: " << pfW.match(1) << std::endl); @@ -654,9 +805,9 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( << std::endl; } } - if ( failure != NO_MEMORY_FAULT ) + if ( failure != this->ResultStrings.size() ) { - ostr << "" << cmCTestMemCheckResultStrings[failure] << " "; + ostr << "" << this->ResultStrings[failure] << " "; results[failure] ++; defects ++; } @@ -674,7 +825,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( //---------------------------------------------------------------------- bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( const std::string& str, std::string& log, - int* results) + std::vector& results) { std::vector lines; cmSystemTools::Split(str.c_str(), lines); @@ -803,7 +954,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( if ( failure != cmCTestMemCheckHandler::NO_MEMORY_FAULT ) { - ostr << "" << cmCTestMemCheckResultStrings[failure] << " "; + ostr << "" << this->ResultStrings[failure] << " "; results[failure] ++; defects ++; } @@ -855,7 +1006,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( //---------------------------------------------------------------------- bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( const std::string& str, std::string& log, - int* results) + std::vector& results) { log = ""; double sttime = cmSystemTools::GetTime(); @@ -909,6 +1060,26 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( return true; } +// PostProcessTest memcheck results +void +cmCTestMemCheckHandler::PostProcessTest(cmCTestTestResult& res, + int test) +{ + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "PostProcessTest memcheck results for : " + << res.Name << std::endl); + if(this->MemoryTesterStyle + == cmCTestMemCheckHandler::BOUNDS_CHECKER) + { + this->PostProcessBoundsCheckerTest(res, test); + } + else + { + this->AppendMemTesterOutput(res, test); + } +} + + // This method puts the bounds checker output file into the output // for the test void @@ -951,35 +1122,16 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, } void -cmCTestMemCheckHandler::PostProcessPurifyTest(cmCTestTestResult& res, - int test) -{ - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "PostProcessPurifyTest for : " - << res.Name << std::endl); - this->AppendMemTesterOutput(res, test); -} - -void -cmCTestMemCheckHandler::PostProcessValgrindTest(cmCTestTestResult& res, - int test) -{ - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "PostProcessValgrindTest for : " - << res.Name << std::endl); - this->AppendMemTesterOutput(res, test); -} - -void cmCTestMemCheckHandler::AppendMemTesterOutput(cmCTestTestResult& res, int test) { std::string ofile = this->TestOutputFileName(test); - if ( ofile.empty() ) { return; } + // put ifs in scope so file can be deleted if needed + { cmsys::ifstream ifs(ofile.c_str()); if ( !ifs ) { @@ -993,6 +1145,12 @@ cmCTestMemCheckHandler::AppendMemTesterOutput(cmCTestTestResult& res, res.Output += line; res.Output += "\n"; } + } + if(this->LogWithPID) + { + cmSystemTools::RemoveFile(ofile.c_str()); + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: "<< ofile <<"\n"); + } } std::string @@ -1005,14 +1163,29 @@ cmCTestMemCheckHandler::TestOutputFileName(int test) std::string ofile = this->MemoryTesterOutputFile; std::string::size_type pos = ofile.find("??"); ofile.replace(pos, 2, index); - - if ( !cmSystemTools::FileExists(ofile.c_str()) ) + if(this->LogWithPID) + { + ofile += ".*"; + cmsys::Glob g; + g.FindFiles(ofile); + if(g.GetFiles().size() == 0) + { + std::string log = "Cannot find memory tester output file: " + + ofile; + cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl); + ofile = ""; + } + else + { + ofile = g.GetFiles()[0]; + } + } + else if ( !cmSystemTools::FileExists(ofile.c_str()) ) { std::string log = "Cannot find memory tester output file: " + ofile; cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl); ofile = ""; } - return ofile; } diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 20a38bb..ffe57f6 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -15,7 +15,10 @@ #include "cmCTestTestHandler.h" +#include "cmStandardIncludes.h" #include "cmListFileCache.h" +#include +#include class cmMakefile; @@ -45,7 +48,9 @@ private: UNKNOWN = 0, VALGRIND, PURIFY, - BOUNDS_CHECKER + BOUNDS_CHECKER, + // checkers after hear do not use the standard error list + THREAD_SANITIZER }; public: enum { // Memory faults @@ -93,7 +98,17 @@ private: std::vector MemoryTesterOptions; int MemoryTesterStyle; std::string MemoryTesterOutputFile; - int MemoryTesterGlobalResults[NO_MEMORY_FAULT]; + std::string MemoryTesterEnvironmentVariable; + // these are used to store the types of errors that can show up + std::vector ResultStrings; + std::vector ResultStringsLong; + std::vector GlobalResults; + bool LogWithPID; // does log file add pid + + std::vector::size_type FindOrAddWarning(const std::string& warning); + // initialize the ResultStrings and ResultStringsLong for + // this type of checker + void InitializeResultsVectors(); ///! Initialize memory checking subsystem. bool InitializeMemoryChecking(); @@ -110,17 +125,22 @@ private: //string. After running, log holds the output and results hold the //different memmory errors. bool ProcessMemCheckOutput(const std::string& str, - std::string& log, int* results); + std::string& log, std::vector& results); bool ProcessMemCheckValgrindOutput(const std::string& str, - std::string& log, int* results); + std::string& log, + std::vector& results); bool ProcessMemCheckPurifyOutput(const std::string& str, - std::string& log, int* results); + std::string& log, + std::vector& results); + bool ProcessMemCheckThreadSanitizerOutput(const std::string& str, + std::string& log, + std::vector& results); bool ProcessMemCheckBoundsCheckerOutput(const std::string& str, - std::string& log, int* results); + std::string& log, + std::vector& results); - void PostProcessPurifyTest(cmCTestTestResult& res, int test); + void PostProcessTest(cmCTestTestResult& res, int test); void PostProcessBoundsCheckerTest(cmCTestTestResult& res, int test); - void PostProcessValgrindTest(cmCTestTestResult& res, int test); ///! append MemoryTesterOutputFile to the test log void AppendMemTesterOutput(cmCTestTestHandler::cmCTestTestResult& res, diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 385388d..bdd8c02 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -392,20 +392,7 @@ void cmCTestRunTest::MemCheckPostProcess() << this->TestResult.Name << std::endl); cmCTestMemCheckHandler * handler = static_cast (this->TestHandler); - switch ( handler->MemoryTesterStyle ) - { - case cmCTestMemCheckHandler::VALGRIND: - handler->PostProcessValgrindTest(this->TestResult, this->Index); - break; - case cmCTestMemCheckHandler::PURIFY: - handler->PostProcessPurifyTest(this->TestResult, this->Index); - break; - case cmCTestMemCheckHandler::BOUNDS_CHECKER: - handler->PostProcessBoundsCheckerTest(this->TestResult, this->Index); - break; - default: - break; - } + handler->PostProcessTest(this->TestResult, this->Index); } //---------------------------------------------------------------------- diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index 8984463..f470835 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -103,6 +103,19 @@ unset(CTEST_EXTRA_CONFIG) unset(CTEST_EXTRA_CODE) unset(CMAKELISTS_EXTRA_CODE) +# add ThreadSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"report_bugs=1 history_size=5 exitcode=55\") +") + +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" +-P \"${CMAKE_CURRENT_SOURCE_DIR}/testThreadSanitizer.cmake\") +") +gen_mc_test_internal(DummyThreadSanitizer "" -DMEMCHECK_TYPE=ThreadSanitizer) +set(CMAKELISTS_EXTRA_CODE ) +set(CTEST_EXTRA_CODE) + gen_mc_test(DummyPurify "\${PSEUDO_PURIFY}") gen_mc_test(DummyValgrind "\${PSEUDO_VALGRIND}") gen_mc_test(DummyBC "\${PSEUDO_BC}") @@ -189,6 +202,11 @@ set_tests_properties(CTestTestMemcheckDummyValgrindTwoTargets PROPERTIES PASS_REGULAR_EXPRESSION "\nMemory check project ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets\n.*\n *Start 1: RunCMake\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.1.log\" \"-q\".*\n *Start 2: RunCMakeAgain\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.2.log\" \"-q\".*\n") +set_tests_properties(CTestTestMemcheckDummyThreadSanitizer PROPERTIES + PASS_REGULAR_EXPRESSION + ".*Memory checking results:.*data race.* - 1.*data race on vptr .ctor/dtor vs virtual call. - 1.*heap-use-after-free - 1.*thread leak - 1.*destroy of a locked mutex - 1.*double lock of a mutex - 1.*unlock of an unlocked mutex .or by a wrong thread. - 1.*read lock of a write locked mutex - 1.*read unlock of a write locked mutex - 1.*signal-unsafe call inside of a signal - 1.*signal handler spoils errno - 1.*lock-order-inversion .potential deadlock. - 1.*") + + # Xcode 2.x forgets to create the output directory before linking # the individual architectures. if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") diff --git a/Tests/CTestTestMemcheck/test.cmake.in b/Tests/CTestTestMemcheck/test.cmake.in index 471e5a5..87195c5 100644 --- a/Tests/CTestTestMemcheck/test.cmake.in +++ b/Tests/CTestTestMemcheck/test.cmake.in @@ -15,6 +15,7 @@ set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") set(CTEST_MEMORYCHECK_COMMAND "@CHECKER_COMMAND@") +set(CTEST_MEMORYCHECK_TYPE "${MEMCHECK_TYPE}") @CTEST_EXTRA_CODE@ diff --git a/Tests/CTestTestMemcheck/testThreadSanitizer.cmake b/Tests/CTestTestMemcheck/testThreadSanitizer.cmake new file mode 100644 index 0000000..d591931 --- /dev/null +++ b/Tests/CTestTestMemcheck/testThreadSanitizer.cmake @@ -0,0 +1,47 @@ +# this file simulates a program that has been built with thread sanitizer +# options + +message("TSAN_OPTIONS = [$ENV{TSAN_OPTIONS}]") +string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{TSAN_OPTIONS}") +message("LOG_FILE=[${LOG_FILE}]") + +set(error_types + "data race" + "data race on vptr (ctor/dtor vs virtual call)" + "heap-use-after-free" + "thread leak" + "destroy of a locked mutex" + "double lock of a mutex" + "unlock of an unlocked mutex (or by a wrong thread)" + "read lock of a write locked mutex" + "read unlock of a write locked mutex" + "signal-unsafe call inside of a signal" + "signal handler spoils errno" + "lock-order-inversion (potential deadlock)" + ) + +# clear the log file +file(REMOVE "${LOG_FILE}.2343") + +# create an error of each type of thread santizer +# these names come from tsan_report.cc in llvm +foreach(error_type ${error_types} ) + + file(APPEND "${LOG_FILE}.2343" +"================== +WARNING: ThreadSanitizer: ${error_type} (pid=27978) + Write of size 4 at 0x7fe017ce906c by thread T1: + #0 Thread1 ??:0 (exe+0x000000000bb0) + #1 :0 (libtsan.so.0+0x00000001b279) + + Previous write of size 4 at 0x7fe017ce906c by main thread: + #0 main ??:0 (exe+0x000000000c3c) + + Thread T1 (tid=27979, running) created by main thread at: + #0 :0 (libtsan.so.0+0x00000001ed7b) + #1 main ??:0 (exe+0x000000000c2c) + +SUMMARY: ThreadSanitizer: ${error_type} ??:0 Thread1 +================== +") +endforeach() ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-variables.7.rst | 1 + Help/variable/CTEST_MEMORYCHECK_TYPE.rst | 6 + Source/CTest/cmCTestMemCheckCommand.cxx | 2 + Source/CTest/cmCTestMemCheckHandler.cxx | 439 ++++++++++++++------- Source/CTest/cmCTestMemCheckHandler.h | 36 +- Source/CTest/cmCTestRunTest.cxx | 15 +- Tests/CTestTestMemcheck/CMakeLists.txt | 18 + Tests/CTestTestMemcheck/test.cmake.in | 1 + Tests/CTestTestMemcheck/testThreadSanitizer.cmake | 47 +++ 9 files changed, 410 insertions(+), 155 deletions(-) create mode 100644 Help/variable/CTEST_MEMORYCHECK_TYPE.rst create mode 100644 Tests/CTestTestMemcheck/testThreadSanitizer.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 8 00:01:47 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 8 Jul 2014 00:01:47 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1335-g49c830d Message-ID: <20140708040147.EC69F391FE@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 49c830d597bbd8322c7b41847eac3012064b0b7d (commit) from 4e7983bc06219e24ff37699b66a1e1697d2fc171 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49c830d597bbd8322c7b41847eac3012064b0b7d commit 49c830d597bbd8322c7b41847eac3012064b0b7d Author: Kitware Robot AuthorDate: Tue Jul 8 00:01:13 2014 -0400 Commit: Kitware Robot CommitDate: Tue Jul 8 00:01:13 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8321e0a..d76db9b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140707) +set(CMake_VERSION_PATCH 20140708) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 8 09:02:59 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 8 Jul 2014 09:02:59 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4146-g7a9c33d Message-ID: <20140708130259.58C0839C04@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 7a9c33d47919d0554e2bfb78442c3afc67b12bb1 (commit) via 16dd50960cb25552ce4c0242b8a23114d8846ccd (commit) from f2fb31516ac8b563c0305169a95337551b60f016 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7a9c33d47919d0554e2bfb78442c3afc67b12bb1 commit 7a9c33d47919d0554e2bfb78442c3afc67b12bb1 Merge: f2fb315 16dd509 Author: Brad King AuthorDate: Tue Jul 8 09:02:58 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 8 09:02:58 2014 -0400 Merge topic 'allow-OBJECT-library-extra-sources' into next 16dd5096 Tests: Workaround VS 6 problem in ObjectLibrary test http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=16dd50960cb25552ce4c0242b8a23114d8846ccd commit 16dd50960cb25552ce4c0242b8a23114d8846ccd Author: Brad King AuthorDate: Tue Jul 8 09:01:55 2014 -0400 Commit: Brad King CommitDate: Tue Jul 8 09:01:55 2014 -0400 Tests: Workaround VS 6 problem in ObjectLibrary test diff --git a/Tests/ObjectLibrary/A/CMakeLists.txt b/Tests/ObjectLibrary/A/CMakeLists.txt index 696752f..c24c5ed 100644 --- a/Tests/ObjectLibrary/A/CMakeLists.txt +++ b/Tests/ObjectLibrary/A/CMakeLists.txt @@ -11,7 +11,12 @@ add_custom_command( ${CMAKE_CURRENT_BINARY_DIR}/a1.c ) -file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/a.cmake) +# Remove the custom command output to be sure it runs in an +# incremental test. Skip this on VS 6 because it sometimes +# re-runs CMake after the custom command runs. +if(NOT CMAKE_GENERATOR STREQUAL "Visual Studio 6") + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/a.cmake) +endif() add_custom_command( OUTPUT a.cmake COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/a.cmake ----------------------------------------------------------------------- Summary of changes: Tests/ObjectLibrary/A/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From ben.boeckel at kitware.com Tue Jul 8 10:20:04 2014 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Tue, 8 Jul 2014 10:20:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4151-g3c6c197 Message-ID: <20140708142004.8A6FB38E4D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 3c6c1970758fbee09b4c72d85cb27097717a0c9c (commit) via 6208c285c8ae43d566474f488a00967b74ee4389 (commit) via dc2e26df01eb4230a69c43a05b867fce330f57a4 (commit) via d2803fbac6ca20c998ff5364e79f0841eba6c579 (commit) via 49c830d597bbd8322c7b41847eac3012064b0b7d (commit) from 7a9c33d47919d0554e2bfb78442c3afc67b12bb1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3c6c1970758fbee09b4c72d85cb27097717a0c9c commit 3c6c1970758fbee09b4c72d85cb27097717a0c9c Merge: 7a9c33d 6208c28 Author: Ben Boeckel AuthorDate: Tue Jul 8 10:20:03 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 8 10:20:03 2014 -0400 Merge topic 'dev/custom-target-performance' into next 6208c285 cmMakefile: Defer dependency calculations dc2e26df cmMakefile: Avoid excess source files d2803fba cmMakefile: Add a CreateSource method 49c830d5 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6208c285c8ae43d566474f488a00967b74ee4389 commit 6208c285c8ae43d566474f488a00967b74ee4389 Author: Ben Boeckel AuthorDate: Fri Mar 21 22:27:59 2014 -0400 Commit: Ben Boeckel CommitDate: Tue Jul 8 10:13:51 2014 -0400 cmMakefile: Defer dependency calculations diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 452d3f6..2218e2f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1056,16 +1056,16 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, } } - // Construct a complete list of dependencies. - std::vector depends2(depends); - if(!main_dependency.empty()) - { - depends2.push_back(main_dependency); - } - // Attach the custom command to the file. if(file) { + // Construct a complete list of dependencies. + std::vector depends2(depends); + if(!main_dependency.empty()) + { + depends2.push_back(main_dependency); + } + cmCustomCommand* cc = new cmCustomCommand(this, outputs, depends2, commandLines, comment, workingDir); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc2e26df01eb4230a69c43a05b867fce330f57a4 commit dc2e26df01eb4230a69c43a05b867fce330f57a4 Author: Ben Boeckel AuthorDate: Wed Mar 12 17:29:04 2014 -0400 Commit: Ben Boeckel CommitDate: Tue Jul 8 10:13:51 2014 -0400 cmMakefile: Avoid excess source files When there are no commands, a main_dependency is not required and when there are also no dependencies, nothing is required. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c4543d7..452d3f6 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -989,7 +989,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, // Choose a source file on which to store the custom command. cmSourceFile* file = 0; - if(!main_dependency.empty()) + if(!commandLines.empty() && !main_dependency.empty()) { // The main dependency was specified. Use it unless a different // custom command already used it. @@ -1257,28 +1257,31 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName, } // Store the custom command in the target. - std::string force = this->GetStartOutputDirectory(); - force += cmake::GetCMakeFilesDirectory(); - force += "/"; - force += utilityName; - std::string no_main_dependency = ""; - bool no_replace = false; - this->AddCustomCommandToOutput(force, depends, - no_main_dependency, - commandLines, comment, - workingDirectory, no_replace, - escapeOldStyle); - cmSourceFile* sf = target->AddSourceCMP0049(force); - - // The output is not actually created so mark it symbolic. - if(sf) - { - sf->SetProperty("SYMBOLIC", "1"); - } - else - { - cmSystemTools::Error("Could not get source file entry for ", - force.c_str()); + if (!commandLines.empty() || !depends.empty()) + { + std::string force = this->GetStartOutputDirectory(); + force += cmake::GetCMakeFilesDirectory(); + force += "/"; + force += utilityName; + std::string no_main_dependency = ""; + bool no_replace = false; + this->AddCustomCommandToOutput(force, depends, + no_main_dependency, + commandLines, comment, + workingDirectory, no_replace, + escapeOldStyle); + cmSourceFile* sf = target->AddSourceCMP0049(force); + + // The output is not actually created so mark it symbolic. + if(sf) + { + sf->SetProperty("SYMBOLIC", "1"); + } + else + { + cmSystemTools::Error("Could not get source file entry for ", + force.c_str()); + } } return target; } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d2803fbac6ca20c998ff5364e79f0841eba6c579 commit d2803fbac6ca20c998ff5364e79f0841eba6c579 Author: Ben Boeckel AuthorDate: Tue Mar 11 18:04:11 2014 -0400 Commit: Ben Boeckel CommitDate: Tue Jul 8 10:13:50 2014 -0400 cmMakefile: Add a CreateSource method The GetOrCreateSource searches the source file listing again, but some callers know that it already didn't exist. diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx index 8a96289..7667a85 100644 --- a/Source/cmGetSourceFilePropertyCommand.cxx +++ b/Source/cmGetSourceFilePropertyCommand.cxx @@ -29,7 +29,7 @@ bool cmGetSourceFilePropertyCommand // for the location we must create a source file first if (!sf && args[2] == "LOCATION") { - sf = this->Makefile->GetOrCreateSource(file); + sf = this->Makefile->CreateSource(file); } if(sf) { diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 412c998..c4543d7 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1010,11 +1010,9 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, file = 0; } } - else + else if (!file) { - // The main dependency does not have a custom command or we are - // allowed to replace it. Use it to store the command. - file = this->GetOrCreateSource(main_dependency); + file = this->CreateSource(main_dependency); } } @@ -1041,8 +1039,11 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, } // Create a cmSourceFile for the rule file. - file = this->GetOrCreateSource(outName, true); - file->SetProperty("__CMAKE_RULE", "1"); + if (!file) + { + file = this->CreateSource(outName, true); + file->SetProperty("__CMAKE_RULE", "1"); + } } // Always create the output sources and mark them generated. @@ -3451,6 +3452,19 @@ cmSourceFile* cmMakefile::GetSource(const std::string& sourceName) const } //---------------------------------------------------------------------------- +cmSourceFile* cmMakefile::CreateSource(const std::string& sourceName, + bool generated) +{ + cmSourceFile* sf = new cmSourceFile(this, sourceName); + if(generated) + { + sf->SetProperty("GENERATED", "1"); + } + this->SourceFiles.push_back(sf); + return sf; +} + +//---------------------------------------------------------------------------- cmSourceFile* cmMakefile::GetOrCreateSource(const std::string& sourceName, bool generated) { @@ -3460,13 +3474,7 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const std::string& sourceName, } else { - cmSourceFile* sf = new cmSourceFile(this, sourceName); - if(generated) - { - sf->SetProperty("GENERATED", "1"); - } - this->SourceFiles.push_back(sf); - return sf; + return this->CreateSource(sourceName, generated); } } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index d5ffd98..3a40c1c 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -560,6 +560,13 @@ public: */ cmSourceFile* GetSource(const std::string& sourceName) const; + /** Create the source file and return it. generated + * indicates if it is a generated file, this is used in determining + * how to create the source file instance e.g. name + */ + cmSourceFile* CreateSource(const std::string& sourceName, + bool generated = false); + /** Get a cmSourceFile pointer for a given source name, if the name is * not found, then create the source file and return it. generated * indicates if it is a generated file, this is used in determining ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- Source/cmGetSourceFilePropertyCommand.cxx | 2 +- Source/cmMakefile.cxx | 97 ++++++++++++++++------------- Source/cmMakefile.h | 7 +++ 4 files changed, 63 insertions(+), 45 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jul 9 00:01:47 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 9 Jul 2014 00:01:47 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1336-g0e5c7ae Message-ID: <20140709040147.E1DE639EA6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 0e5c7aefe3a34df86d5b2f7388726c21c8f69e4f (commit) from 49c830d597bbd8322c7b41847eac3012064b0b7d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0e5c7aefe3a34df86d5b2f7388726c21c8f69e4f commit 0e5c7aefe3a34df86d5b2f7388726c21c8f69e4f Author: Kitware Robot AuthorDate: Wed Jul 9 00:01:07 2014 -0400 Commit: Kitware Robot CommitDate: Wed Jul 9 00:01:07 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d76db9b..c37587c 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140708) +set(CMake_VERSION_PATCH 20140709) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 9 09:45:28 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 9 Jul 2014 09:45:28 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4153-gd6304b7 Message-ID: <20140709134528.038633A1E2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d6304b7d78d3310ee3b1b9a30bb3ab712c12af53 (commit) via 2c470b775ab54f565383c95200d16dc42d94fe17 (commit) from 3c6c1970758fbee09b4c72d85cb27097717a0c9c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d6304b7d78d3310ee3b1b9a30bb3ab712c12af53 commit d6304b7d78d3310ee3b1b9a30bb3ab712c12af53 Merge: 3c6c197 2c470b7 Author: Brad King AuthorDate: Wed Jul 9 09:45:27 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 9 09:45:27 2014 -0400 Merge topic 'allow-OBJECT-library-extra-sources' into next 2c470b77 add_library: Allow arbitrary non-linked sources in OBJECT libraries http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2c470b775ab54f565383c95200d16dc42d94fe17 commit 2c470b775ab54f565383c95200d16dc42d94fe17 Author: Brad King AuthorDate: Wed Jul 2 15:38:10 2014 -0400 Commit: Brad King CommitDate: Wed Jul 9 09:43:42 2014 -0400 add_library: Allow arbitrary non-linked sources in OBJECT libraries Loosen this restriction on OBJECT libraries to allow source files of any name to be generated by custom commands or listed for reference in IDE projects so long as they would not affect linking of a normal library. Update the rejection message to be more specific about the looser restriction. Extend the ObjectLibrary test to cover a ".cmake" file generated by a custom command in an OBJECT library. diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst index f19b5c0..f86f3c5 100644 --- a/Help/command/add_library.rst +++ b/Help/command/add_library.rst @@ -94,7 +94,8 @@ object library name. For example: will include objlib's object files in a library and an executable along with those compiled from their own sources. Object libraries -may contain only sources (and headers) that compile to object files. +may contain only sources that compile, header files, and other files +that would not affect linking of a normal library (e.g. ``.txt``). They may contain custom commands generating such sources, but not ``PRE_BUILD``, ``PRE_LINK``, or ``POST_BUILD`` commands. Object libraries cannot be imported, exported, installed, or linked. Some native build diff --git a/Help/release/dev/allow-OBJECT-library-extra-sources.rst b/Help/release/dev/allow-OBJECT-library-extra-sources.rst new file mode 100644 index 0000000..472fcdc --- /dev/null +++ b/Help/release/dev/allow-OBJECT-library-extra-sources.rst @@ -0,0 +1,6 @@ +allow-OBJECT-library-extra-sources +---------------------------------- + +* :ref:`Object Libraries` may now have extra sources that do not + compile to object files so long as they would not affect linking + of a normal library (e.g. ``.dat`` is okay but not ``.def``). diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index eccb06a..64c5822 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -38,7 +38,8 @@ void reportBadObjLib(std::vector const& badObjLib, { e << " " << (*i)->GetLocation().GetName() << "\n"; } - e << "but may contain only headers and sources that compile."; + e << "but may contain only sources that compile, header files, and " + "other files that would not affect linking of a normal library."; cm->IssueMessage(cmake::FATAL_ERROR, e.str(), target->GetBacktrace()); } @@ -205,10 +206,6 @@ struct TagVisitor else { DoAccept::Result>::Do(this->Data, sf); - if(this->IsObjLib && ext != "txt") - { - this->BadObjLibFiles.push_back(sf); - } } } }; diff --git a/Tests/ObjectLibrary/A/CMakeLists.txt b/Tests/ObjectLibrary/A/CMakeLists.txt index 3fba9f8..c24c5ed 100644 --- a/Tests/ObjectLibrary/A/CMakeLists.txt +++ b/Tests/ObjectLibrary/A/CMakeLists.txt @@ -11,5 +11,16 @@ add_custom_command( ${CMAKE_CURRENT_BINARY_DIR}/a1.c ) -add_library(A OBJECT a1.c a2.c) +# Remove the custom command output to be sure it runs in an +# incremental test. Skip this on VS 6 because it sometimes +# re-runs CMake after the custom command runs. +if(NOT CMAKE_GENERATOR STREQUAL "Visual Studio 6") + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/a.cmake) +endif() +add_custom_command( + OUTPUT a.cmake + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/a.cmake + ) + +add_library(A OBJECT a1.c a2.c a.cmake) target_include_directories(A PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt index 75c34d8..e9f553e 100644 --- a/Tests/ObjectLibrary/CMakeLists.txt +++ b/Tests/ObjectLibrary/CMakeLists.txt @@ -12,6 +12,7 @@ add_library(Cshared SHARED c.c $ $) add_executable(UseCshared main.c) set_property(TARGET UseCshared PROPERTY COMPILE_DEFINITIONS SHARED_C) target_link_libraries(UseCshared Cshared) +add_custom_command(TARGET UseCshared POST_BUILD COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/A/a.cmake) add_executable(UseCinternal main.c c.c $ $) diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt index b31225b..a09552b 100644 --- a/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt @@ -3,6 +3,7 @@ CMake Error at BadObjSource1.cmake:1 \(add_library\): bad.def - but may contain only headers and sources that compile. + but may contain only sources that compile, header files, and other files + that would not affect linking of a normal library. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt index 906cf0b..b91ffd0 100644 --- a/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt @@ -3,6 +3,7 @@ CMake Error at BadObjSource2.cmake:1 \(add_library\): bad.obj - but may contain only headers and sources that compile. + but may contain only sources that compile, header files, and other files + that would not affect linking of a normal library. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 9 09:48:29 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 9 Jul 2014 09:48:29 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4155-ge1831ef Message-ID: <20140709134829.86DF73A44B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via e1831ef5f272dfb703645ae7b53f38e108cbe397 (commit) via 49948f72214f6e3a4acb566f773ac3ad86e6c68c (commit) from d6304b7d78d3310ee3b1b9a30bb3ab712c12af53 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e1831ef5f272dfb703645ae7b53f38e108cbe397 commit e1831ef5f272dfb703645ae7b53f38e108cbe397 Merge: d6304b7 49948f7 Author: Brad King AuthorDate: Wed Jul 9 09:48:28 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 9 09:48:28 2014 -0400 Merge topic 'thread-sanitizer' into next 49948f72 ctest_memcheck: Add support for ThreadSanitizer http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49948f72214f6e3a4acb566f773ac3ad86e6c68c commit 49948f72214f6e3a4acb566f773ac3ad86e6c68c Author: Bill Hoffman AuthorDate: Mon Jul 7 15:58:02 2014 -0400 Commit: Brad King CommitDate: Wed Jul 9 09:48:35 2014 -0400 ctest_memcheck: Add support for ThreadSanitizer This commit adds support for ThreadSanitizer to ctest. ThreadSanitizer is part of the clang compiler and also gcc 4.8 and later. You have to compile the code with special flags. Then your code gets the the ThreadSanitizer ability built into it. To pass options to the ThreadSanitizer you use an environment variable. This commit teaches ctest to parse the output from ThreadSanitizer and send it to CDash. diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 983bf22..05a7b33 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -344,6 +344,7 @@ Variables for CTest /variable/CTEST_MEMORYCHECK_COMMAND /variable/CTEST_MEMORYCHECK_COMMAND_OPTIONS /variable/CTEST_MEMORYCHECK_SUPPRESSIONS_FILE + /variable/CTEST_MEMORYCHECK_TYPE /variable/CTEST_NIGHTLY_START_TIME /variable/CTEST_P4_CLIENT /variable/CTEST_P4_COMMAND diff --git a/Help/variable/CTEST_MEMORYCHECK_TYPE.rst b/Help/variable/CTEST_MEMORYCHECK_TYPE.rst new file mode 100644 index 0000000..f7875da --- /dev/null +++ b/Help/variable/CTEST_MEMORYCHECK_TYPE.rst @@ -0,0 +1,6 @@ +CTEST_MEMORYCHECK_TYPE +------------------------- + +Specify the CTest ``MemoryCheckType`` setting +in a :manual:`ctest(1)` dashboard client script. +Valid values are Valgrind, Purify, BoundsChecker, and ThreadSanitizer. diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx index 535c993..939b4dc 100644 --- a/Source/CTest/cmCTestMemCheckCommand.cxx +++ b/Source/CTest/cmCTestMemCheckCommand.cxx @@ -21,6 +21,8 @@ cmCTestGenericHandler* cmCTestMemCheckCommand::InitializeActualHandler() = this->CTest->GetInitializedHandler("memcheck"); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, + "MemoryCheckType", "CTEST_MEMORYCHECK_TYPE"); + this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "MemoryCheckCommand", "CTEST_MEMORYCHECK_COMMAND"); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "MemoryCheckCommandOptions", "CTEST_MEMORYCHECK_COMMAND_OPTIONS"); diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 7b50174..bcf09ad 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include #include "cmMakefile.h" #include "cmXMLSafe.h" @@ -124,60 +125,7 @@ public: #define BOUNDS_CHECKER_MARKER \ "******######*****Begin BOUNDS CHECKER XML******######******" -//---------------------------------------------------------------------- -static const char* cmCTestMemCheckResultStrings[] = { - "ABR", - "ABW", - "ABWL", - "COR", - "EXU", - "FFM", - "FIM", - "FMM", - "FMR", - "FMW", - "FUM", - "IPR", - "IPW", - "MAF", - "MLK", - "MPK", - "NPR", - "ODS", - "PAR", - "PLK", - "UMC", - "UMR", - 0 -}; - -//---------------------------------------------------------------------- -static const char* cmCTestMemCheckResultLongStrings[] = { - "Threading Problem", - "ABW", - "ABWL", - "COR", - "EXU", - "FFM", - "FIM", - "Mismatched deallocation", - "FMR", - "FMW", - "FUM", - "IPR", - "IPW", - "MAF", - "Memory Leak", - "Potential Memory Leak", - "NPR", - "ODS", - "Invalid syscall param", - "PLK", - "Uninitialized Memory Conditional", - "Uninitialized Memory Read", - 0 -}; //---------------------------------------------------------------------- @@ -186,12 +134,14 @@ cmCTestMemCheckHandler::cmCTestMemCheckHandler() this->MemCheck = true; this->CustomMaximumPassedTestOutputSize = 0; this->CustomMaximumFailedTestOutputSize = 0; + this->LogWithPID = false; } //---------------------------------------------------------------------- void cmCTestMemCheckHandler::Initialize() { this->Superclass::Initialize(); + this->LogWithPID = false; this->CustomMaximumPassedTestOutputSize = 0; this->CustomMaximumFailedTestOutputSize = 0; this->MemoryTester = ""; @@ -199,12 +149,6 @@ void cmCTestMemCheckHandler::Initialize() this->MemoryTesterOptions.clear(); this->MemoryTesterStyle = UNKNOWN; this->MemoryTesterOutputFile = ""; - int cc; - for ( cc = 0; cc < NO_MEMORY_FAULT; cc ++ ) - { - this->MemoryTesterGlobalResults[cc] = 0; - } - } //---------------------------------------------------------------------- @@ -249,8 +193,8 @@ void cmCTestMemCheckHandler::GenerateTestCommand( index = stream.str(); for ( pp = 0; pp < this->MemoryTesterDynamicOptions.size(); pp ++ ) { - std::string arg = this->MemoryTesterDynamicOptions[pp]; - std::string::size_type pos = arg.find("??"); + std::string arg = this->MemoryTesterDynamicOptions[pp]; + std::string::size_type pos = arg.find("??"); if (pos != std::string::npos) { arg.replace(pos, 2, index); @@ -260,18 +204,125 @@ void cmCTestMemCheckHandler::GenerateTestCommand( memcheckcommand += arg; memcheckcommand += "\""; } + // Create a copy of the memory tester environment variable. + // This is used for memory testing programs that pass options + // via environment varaibles. + std::string memTesterEnvironmentVariable = + this->MemoryTesterEnvironmentVariable; for ( pp = 0; pp < this->MemoryTesterOptions.size(); pp ++ ) { - args.push_back(this->MemoryTesterOptions[pp]); - memcheckcommand += " \""; - memcheckcommand += this->MemoryTesterOptions[pp]; - memcheckcommand += "\""; + if(memTesterEnvironmentVariable.size()) + { + // If we are using env to pass options, append all the options to + // this string with space separation. + memTesterEnvironmentVariable += " " + this->MemoryTesterOptions[pp]; + } + // for regular options just add them to args and memcheckcommand + // which is just used for display + else + { + args.push_back(this->MemoryTesterOptions[pp]); + memcheckcommand += " \""; + memcheckcommand += this->MemoryTesterOptions[pp]; + memcheckcommand += "\""; + } + } + // if this is an env option type, then add the env string as a single + // argument. + if(memTesterEnvironmentVariable.size()) + { + std::string::size_type pos = memTesterEnvironmentVariable.find("??"); + if (pos != std::string::npos) + { + memTesterEnvironmentVariable.replace(pos, 2, index); + } + memcheckcommand += " " + memTesterEnvironmentVariable; + args.push_back(memTesterEnvironmentVariable); } cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Memory check command: " << memcheckcommand << std::endl); } //---------------------------------------------------------------------- +void cmCTestMemCheckHandler::InitializeResultsVectors() +{ + // fill these members +// cmsys::vector ResultStrings; +// cmsys::vector ResultStringsLong; +// cmsys::vector GlobalResults; + this->ResultStringsLong.clear(); + this->ResultStrings.clear(); + this->GlobalResults.clear(); + // If we are working with style checkers that dynamically fill + // the results strings then return. + if(this->MemoryTesterStyle > cmCTestMemCheckHandler::BOUNDS_CHECKER) + { + return; + } + + // define the standard set of errors + //---------------------------------------------------------------------- + static const char* cmCTestMemCheckResultStrings[] = { + "ABR", + "ABW", + "ABWL", + "COR", + "EXU", + "FFM", + "FIM", + "FMM", + "FMR", + "FMW", + "FUM", + "IPR", + "IPW", + "MAF", + "MLK", + "MPK", + "NPR", + "ODS", + "PAR", + "PLK", + "UMC", + "UMR", + 0 + }; +//---------------------------------------------------------------------- + static const char* cmCTestMemCheckResultLongStrings[] = { + "Threading Problem", + "ABW", + "ABWL", + "COR", + "EXU", + "FFM", + "FIM", + "Mismatched deallocation", + "FMR", + "FMW", + "FUM", + "IPR", + "IPW", + "MAF", + "Memory Leak", + "Potential Memory Leak", + "NPR", + "ODS", + "Invalid syscall param", + "PLK", + "Uninitialized Memory Conditional", + "Uninitialized Memory Read", + 0 + }; + this->GlobalResults.clear(); + for(int i =0; cmCTestMemCheckResultStrings[i] != 0; ++i) + { + this->ResultStrings.push_back(cmCTestMemCheckResultStrings[i]); + this->ResultStringsLong.push_back(cmCTestMemCheckResultLongStrings[i]); + this->GlobalResults.push_back(0); + } +} + +//---------------------------------------------------------------------- void cmCTestMemCheckHandler::PopulateCustomVectors(cmMakefile *mf) { this->cmCTestTestHandler::PopulateCustomVectors(mf); @@ -283,6 +334,8 @@ void cmCTestMemCheckHandler::PopulateCustomVectors(cmMakefile *mf) this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_MEMCHECK_IGNORE", this->CustomTestsIgnore); + this->CTest->SetCTestConfigurationFromCMakeVariable( + mf, "CMakeCommand", "CMAKE_COMMAND"); } //---------------------------------------------------------------------- @@ -292,7 +345,6 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) { return; } - this->CTest->StartXML(os, this->AppendXML); os << "MemoryTesterStyle ) @@ -306,6 +358,9 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) case cmCTestMemCheckHandler::BOUNDS_CHECKER: os << "BoundsChecker"; break; + case cmCTestMemCheckHandler::THREAD_SANITIZER: + os << "ThreadSanitizer"; + break; default: os << "Unknown"; } @@ -333,8 +388,7 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) { cmCTestTestResult *result = &this->TestResults[cc]; std::string memcheckstr; - int memcheckresults[cmCTestMemCheckHandler::NO_MEMORY_FAULT]; - int kk; + std::vector memcheckresults(this->ResultStrings.size(), 0); bool res = this->ProcessMemCheckOutput(result->Output, memcheckstr, memcheckresults); if ( res && result->Status == cmCTestMemCheckHandler::COMPLETED ) @@ -345,16 +399,17 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) static_cast(this->CustomMaximumFailedTestOutputSize)); this->WriteTestResultHeader(os, result); os << "\t\t" << std::endl; - for ( kk = 0; cmCTestMemCheckResultLongStrings[kk]; kk ++ ) + for(std::vector::size_type kk = 0; + kk < memcheckresults.size(); ++kk) { if ( memcheckresults[kk] ) { - os << "\t\t\tResultStringsLong[kk] << "\">" << memcheckresults[kk] << "" << std::endl; } - this->MemoryTesterGlobalResults[kk] += memcheckresults[kk]; + this->GlobalResults[kk] += memcheckresults[kk]; } std::string logTag; @@ -383,9 +438,9 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) cmCTestLog(this->CTest, HANDLER_OUTPUT, "Memory checking results:" << std::endl); os << "\t" << std::endl; - for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ ) + for ( cc = 0; cc < this->GlobalResults.size(); cc ++ ) { - if ( this->MemoryTesterGlobalResults[cc] ) + if ( this->GlobalResults[cc] ) { #ifdef cerr # undef cerr @@ -393,9 +448,9 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) std::cerr.width(35); #define cerr no_cerr cmCTestLog(this->CTest, HANDLER_OUTPUT, - cmCTestMemCheckResultLongStrings[cc] << " - " - << this->MemoryTesterGlobalResults[cc] << std::endl); - os << "\t\tResultStringsLong[cc] << " - " + << this->GlobalResults[cc] << std::endl); + os << "\t\tResultStringsLong[cc] << "\"/>" << std::endl; } } @@ -410,13 +465,13 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) os << "" << std::endl; this->CTest->EndXML(os); - - } //---------------------------------------------------------------------- bool cmCTestMemCheckHandler::InitializeMemoryChecking() { + this->MemoryTesterEnvironmentVariable = ""; + this->MemoryTester = ""; // Setup the command if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration( "MemoryCheckCommand").c_str()) ) @@ -426,7 +481,9 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() std::string testerName = cmSystemTools::GetFilenameName(this->MemoryTester); // determine the checker type - if ( testerName.find("valgrind") != std::string::npos ) + if ( testerName.find("valgrind") != std::string::npos || + this->CTest->GetCTestConfiguration("MemoryCheckType") + == "Valgrind") { this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND; } @@ -464,12 +521,38 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() = this->CTest->GetCTestConfiguration("BoundsCheckerCommand").c_str(); this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER; } - else + if ( this->CTest->GetCTestConfiguration("MemoryCheckType") + == "ThreadSanitizer") + { + this->MemoryTester + = this->CTest->GetCTestConfiguration("CMakeCommand").c_str(); + this->MemoryTesterStyle = cmCTestMemCheckHandler::THREAD_SANITIZER; + this->LogWithPID = true; // even if we give the log file the pid is added + } + // Check the MemoryCheckType + if(this->MemoryTesterStyle == cmCTestMemCheckHandler::UNKNOWN) + { + std::string checkType = + this->CTest->GetCTestConfiguration("MemoryCheckType"); + if(checkType == "Purify") + { + this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY; + } + else if(checkType == "BoundsChecker") + { + this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER; + } + else if(checkType == "Valgrind") + { + this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND; + } + } + if(this->MemoryTester.size() == 0 ) { cmCTestLog(this->CTest, WARNING, - "Memory checker (MemoryCheckCommand) " - "not set, or cannot find the specified program." - << std::endl); + "Memory checker (MemoryCheckCommand) " + "not set, or cannot find the specified program." + << std::endl); return false; } @@ -568,6 +651,20 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() this->MemoryTesterOptions.push_back("/M"); break; } + case cmCTestMemCheckHandler::THREAD_SANITIZER: + { + // To pass arguments to ThreadSanitizer the environment variable + // TSAN_OPTIONS is used. This is done with the cmake -E env command. + // The MemoryTesterDynamicOptions is setup with the -E env + // Then the MemoryTesterEnvironmentVariable gets the + // TSAN_OPTIONS string with the log_path in it. + this->MemoryTesterDynamicOptions.push_back("-E"); + this->MemoryTesterDynamicOptions.push_back("env"); + std::string outputFile = "TSAN_OPTIONS=log_path=\"" + + this->MemoryTesterOutputFile + "\""; + this->MemoryTesterEnvironmentVariable = outputFile; + break; + } default: cmCTestLog(this->CTest, ERROR_MESSAGE, "Do not understand memory checker: " << this->MemoryTester @@ -575,24 +672,20 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() return false; } - std::vector::size_type cc; - for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ ) - { - this->MemoryTesterGlobalResults[cc] = 0; - } + this->InitializeResultsVectors(); + // std::vector::size_type cc; + // for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ ) + // { + // this->MemoryTesterGlobalResults[cc] = 0; + // } return true; } //---------------------------------------------------------------------- -bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str, - std::string& log, int* results) +bool cmCTestMemCheckHandler:: +ProcessMemCheckOutput(const std::string& str, + std::string& log, std::vector& results) { - std::string::size_type cc; - for ( cc = 0; cc < cmCTestMemCheckHandler::NO_MEMORY_FAULT; cc ++ ) - { - results[cc] = 0; - } - if ( this->MemoryTesterStyle == cmCTestMemCheckHandler::VALGRIND ) { return this->ProcessMemCheckValgrindOutput(str, log, results); @@ -602,6 +695,11 @@ bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str, return this->ProcessMemCheckPurifyOutput(str, log, results); } else if ( this->MemoryTesterStyle == + cmCTestMemCheckHandler::THREAD_SANITIZER ) + { + return this->ProcessMemCheckThreadSanitizerOutput(str, log, results); + } + else if ( this->MemoryTesterStyle == cmCTestMemCheckHandler::BOUNDS_CHECKER ) { return this->ProcessMemCheckBoundsCheckerOutput(str, log, results); @@ -612,15 +710,68 @@ bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str, log.append("None that I know"); log = str; } - - return true; } +std::vector::size_type cmCTestMemCheckHandler::FindOrAddWarning( + const std::string& warning) +{ + for(std::vector::size_type i =0; + i < this->ResultStrings.size(); ++i) + { + if(this->ResultStrings[i] == warning) + { + return i; + } + } + this->GlobalResults.push_back(0); // this must stay the same size + this->ResultStrings.push_back(warning); + this->ResultStringsLong.push_back(warning); + return this->ResultStrings.size()-1; +} +//---------------------------------------------------------------------- +bool cmCTestMemCheckHandler::ProcessMemCheckThreadSanitizerOutput( + const std::string& str, std::string& log, + std::vector& result) +{ + cmsys::RegularExpression + sanitizerWarning("WARNING: ThreadSanitizer: (.*) \\(pid=.*\\)"); + int defects = 0; + std::vector lines; + cmSystemTools::Split(str.c_str(), lines); + cmOStringStream ostr; + log = ""; + for( std::vector::iterator i = lines.begin(); + i != lines.end(); ++i) + { + if(sanitizerWarning.find(*i)) + { + std::string warning = sanitizerWarning.match(1); + std::vector::size_type idx = this->FindOrAddWarning(warning); + if(result.size() == 0 || idx > result.size()-1) + { + result.push_back(1); + } + else + { + result[idx]++; + } + defects++; + ostr << "" << this->ResultStrings[idx] << " "; + } + ostr << cmXMLSafe(*i) << std::endl; + } + log = ostr.str(); + if(defects) + { + return false; + } + return true; +} //---------------------------------------------------------------------- bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( const std::string& str, std::string& log, - int* results) + std::vector& results) { std::vector lines; cmSystemTools::Split(str.c_str(), lines); @@ -634,19 +785,19 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( for( std::vector::iterator i = lines.begin(); i != lines.end(); ++i) { - int failure = cmCTestMemCheckHandler::NO_MEMORY_FAULT; + std::vector::size_type failure = this->ResultStrings.size(); if ( pfW.find(*i) ) { - int cc; - for ( cc = 0; cc < cmCTestMemCheckHandler::NO_MEMORY_FAULT; cc ++ ) + std::vector::size_type cc; + for ( cc = 0; cc < this->ResultStrings.size(); cc ++ ) { - if ( pfW.match(1) == cmCTestMemCheckResultStrings[cc] ) + if ( pfW.match(1) == this->ResultStrings[cc] ) { failure = cc; break; } } - if ( cc == cmCTestMemCheckHandler::NO_MEMORY_FAULT ) + if ( cc == this->ResultStrings.size() ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown Purify memory fault: " << pfW.match(1) << std::endl); @@ -654,9 +805,9 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( << std::endl; } } - if ( failure != NO_MEMORY_FAULT ) + if ( failure != this->ResultStrings.size() ) { - ostr << "" << cmCTestMemCheckResultStrings[failure] << " "; + ostr << "" << this->ResultStrings[failure] << " "; results[failure] ++; defects ++; } @@ -674,7 +825,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( //---------------------------------------------------------------------- bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( const std::string& str, std::string& log, - int* results) + std::vector& results) { std::vector lines; cmSystemTools::Split(str.c_str(), lines); @@ -803,7 +954,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( if ( failure != cmCTestMemCheckHandler::NO_MEMORY_FAULT ) { - ostr << "" << cmCTestMemCheckResultStrings[failure] << " "; + ostr << "" << this->ResultStrings[failure] << " "; results[failure] ++; defects ++; } @@ -855,7 +1006,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( //---------------------------------------------------------------------- bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( const std::string& str, std::string& log, - int* results) + std::vector& results) { log = ""; double sttime = cmSystemTools::GetTime(); @@ -909,6 +1060,26 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( return true; } +// PostProcessTest memcheck results +void +cmCTestMemCheckHandler::PostProcessTest(cmCTestTestResult& res, + int test) +{ + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "PostProcessTest memcheck results for : " + << res.Name << std::endl); + if(this->MemoryTesterStyle + == cmCTestMemCheckHandler::BOUNDS_CHECKER) + { + this->PostProcessBoundsCheckerTest(res, test); + } + else + { + this->AppendMemTesterOutput(res, test); + } +} + + // This method puts the bounds checker output file into the output // for the test void @@ -951,35 +1122,16 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, } void -cmCTestMemCheckHandler::PostProcessPurifyTest(cmCTestTestResult& res, - int test) -{ - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "PostProcessPurifyTest for : " - << res.Name << std::endl); - this->AppendMemTesterOutput(res, test); -} - -void -cmCTestMemCheckHandler::PostProcessValgrindTest(cmCTestTestResult& res, - int test) -{ - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "PostProcessValgrindTest for : " - << res.Name << std::endl); - this->AppendMemTesterOutput(res, test); -} - -void cmCTestMemCheckHandler::AppendMemTesterOutput(cmCTestTestResult& res, int test) { std::string ofile = this->TestOutputFileName(test); - if ( ofile.empty() ) { return; } + // put ifs in scope so file can be deleted if needed + { cmsys::ifstream ifs(ofile.c_str()); if ( !ifs ) { @@ -993,6 +1145,12 @@ cmCTestMemCheckHandler::AppendMemTesterOutput(cmCTestTestResult& res, res.Output += line; res.Output += "\n"; } + } + if(this->LogWithPID) + { + cmSystemTools::RemoveFile(ofile.c_str()); + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: "<< ofile <<"\n"); + } } std::string @@ -1005,14 +1163,29 @@ cmCTestMemCheckHandler::TestOutputFileName(int test) std::string ofile = this->MemoryTesterOutputFile; std::string::size_type pos = ofile.find("??"); ofile.replace(pos, 2, index); - - if ( !cmSystemTools::FileExists(ofile.c_str()) ) + if(this->LogWithPID) + { + ofile += ".*"; + cmsys::Glob g; + g.FindFiles(ofile); + if(g.GetFiles().size() == 0) + { + std::string log = "Cannot find memory tester output file: " + + ofile; + cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl); + ofile = ""; + } + else + { + ofile = g.GetFiles()[0]; + } + } + else if ( !cmSystemTools::FileExists(ofile.c_str()) ) { std::string log = "Cannot find memory tester output file: " + ofile; cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl); ofile = ""; } - return ofile; } diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 20a38bb..ffe57f6 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -15,7 +15,10 @@ #include "cmCTestTestHandler.h" +#include "cmStandardIncludes.h" #include "cmListFileCache.h" +#include +#include class cmMakefile; @@ -45,7 +48,9 @@ private: UNKNOWN = 0, VALGRIND, PURIFY, - BOUNDS_CHECKER + BOUNDS_CHECKER, + // checkers after hear do not use the standard error list + THREAD_SANITIZER }; public: enum { // Memory faults @@ -93,7 +98,17 @@ private: std::vector MemoryTesterOptions; int MemoryTesterStyle; std::string MemoryTesterOutputFile; - int MemoryTesterGlobalResults[NO_MEMORY_FAULT]; + std::string MemoryTesterEnvironmentVariable; + // these are used to store the types of errors that can show up + std::vector ResultStrings; + std::vector ResultStringsLong; + std::vector GlobalResults; + bool LogWithPID; // does log file add pid + + std::vector::size_type FindOrAddWarning(const std::string& warning); + // initialize the ResultStrings and ResultStringsLong for + // this type of checker + void InitializeResultsVectors(); ///! Initialize memory checking subsystem. bool InitializeMemoryChecking(); @@ -110,17 +125,22 @@ private: //string. After running, log holds the output and results hold the //different memmory errors. bool ProcessMemCheckOutput(const std::string& str, - std::string& log, int* results); + std::string& log, std::vector& results); bool ProcessMemCheckValgrindOutput(const std::string& str, - std::string& log, int* results); + std::string& log, + std::vector& results); bool ProcessMemCheckPurifyOutput(const std::string& str, - std::string& log, int* results); + std::string& log, + std::vector& results); + bool ProcessMemCheckThreadSanitizerOutput(const std::string& str, + std::string& log, + std::vector& results); bool ProcessMemCheckBoundsCheckerOutput(const std::string& str, - std::string& log, int* results); + std::string& log, + std::vector& results); - void PostProcessPurifyTest(cmCTestTestResult& res, int test); + void PostProcessTest(cmCTestTestResult& res, int test); void PostProcessBoundsCheckerTest(cmCTestTestResult& res, int test); - void PostProcessValgrindTest(cmCTestTestResult& res, int test); ///! append MemoryTesterOutputFile to the test log void AppendMemTesterOutput(cmCTestTestHandler::cmCTestTestResult& res, diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 385388d..bdd8c02 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -392,20 +392,7 @@ void cmCTestRunTest::MemCheckPostProcess() << this->TestResult.Name << std::endl); cmCTestMemCheckHandler * handler = static_cast (this->TestHandler); - switch ( handler->MemoryTesterStyle ) - { - case cmCTestMemCheckHandler::VALGRIND: - handler->PostProcessValgrindTest(this->TestResult, this->Index); - break; - case cmCTestMemCheckHandler::PURIFY: - handler->PostProcessPurifyTest(this->TestResult, this->Index); - break; - case cmCTestMemCheckHandler::BOUNDS_CHECKER: - handler->PostProcessBoundsCheckerTest(this->TestResult, this->Index); - break; - default: - break; - } + handler->PostProcessTest(this->TestResult, this->Index); } //---------------------------------------------------------------------- diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index 8984463..f470835 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -103,6 +103,19 @@ unset(CTEST_EXTRA_CONFIG) unset(CTEST_EXTRA_CODE) unset(CMAKELISTS_EXTRA_CODE) +# add ThreadSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"report_bugs=1 history_size=5 exitcode=55\") +") + +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" +-P \"${CMAKE_CURRENT_SOURCE_DIR}/testThreadSanitizer.cmake\") +") +gen_mc_test_internal(DummyThreadSanitizer "" -DMEMCHECK_TYPE=ThreadSanitizer) +set(CMAKELISTS_EXTRA_CODE ) +set(CTEST_EXTRA_CODE) + gen_mc_test(DummyPurify "\${PSEUDO_PURIFY}") gen_mc_test(DummyValgrind "\${PSEUDO_VALGRIND}") gen_mc_test(DummyBC "\${PSEUDO_BC}") @@ -189,6 +202,11 @@ set_tests_properties(CTestTestMemcheckDummyValgrindTwoTargets PROPERTIES PASS_REGULAR_EXPRESSION "\nMemory check project ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets\n.*\n *Start 1: RunCMake\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.1.log\" \"-q\".*\n *Start 2: RunCMakeAgain\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.2.log\" \"-q\".*\n") +set_tests_properties(CTestTestMemcheckDummyThreadSanitizer PROPERTIES + PASS_REGULAR_EXPRESSION + ".*Memory checking results:.*data race.* - 1.*data race on vptr .ctor/dtor vs virtual call. - 1.*heap-use-after-free - 1.*thread leak - 1.*destroy of a locked mutex - 1.*double lock of a mutex - 1.*unlock of an unlocked mutex .or by a wrong thread. - 1.*read lock of a write locked mutex - 1.*read unlock of a write locked mutex - 1.*signal-unsafe call inside of a signal - 1.*signal handler spoils errno - 1.*lock-order-inversion .potential deadlock. - 1.*") + + # Xcode 2.x forgets to create the output directory before linking # the individual architectures. if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") diff --git a/Tests/CTestTestMemcheck/test.cmake.in b/Tests/CTestTestMemcheck/test.cmake.in index 471e5a5..87195c5 100644 --- a/Tests/CTestTestMemcheck/test.cmake.in +++ b/Tests/CTestTestMemcheck/test.cmake.in @@ -15,6 +15,7 @@ set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") set(CTEST_MEMORYCHECK_COMMAND "@CHECKER_COMMAND@") +set(CTEST_MEMORYCHECK_TYPE "${MEMCHECK_TYPE}") @CTEST_EXTRA_CODE@ diff --git a/Tests/CTestTestMemcheck/testThreadSanitizer.cmake b/Tests/CTestTestMemcheck/testThreadSanitizer.cmake new file mode 100644 index 0000000..d591931 --- /dev/null +++ b/Tests/CTestTestMemcheck/testThreadSanitizer.cmake @@ -0,0 +1,47 @@ +# this file simulates a program that has been built with thread sanitizer +# options + +message("TSAN_OPTIONS = [$ENV{TSAN_OPTIONS}]") +string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{TSAN_OPTIONS}") +message("LOG_FILE=[${LOG_FILE}]") + +set(error_types + "data race" + "data race on vptr (ctor/dtor vs virtual call)" + "heap-use-after-free" + "thread leak" + "destroy of a locked mutex" + "double lock of a mutex" + "unlock of an unlocked mutex (or by a wrong thread)" + "read lock of a write locked mutex" + "read unlock of a write locked mutex" + "signal-unsafe call inside of a signal" + "signal handler spoils errno" + "lock-order-inversion (potential deadlock)" + ) + +# clear the log file +file(REMOVE "${LOG_FILE}.2343") + +# create an error of each type of thread santizer +# these names come from tsan_report.cc in llvm +foreach(error_type ${error_types} ) + + file(APPEND "${LOG_FILE}.2343" +"================== +WARNING: ThreadSanitizer: ${error_type} (pid=27978) + Write of size 4 at 0x7fe017ce906c by thread T1: + #0 Thread1 ??:0 (exe+0x000000000bb0) + #1 :0 (libtsan.so.0+0x00000001b279) + + Previous write of size 4 at 0x7fe017ce906c by main thread: + #0 main ??:0 (exe+0x000000000c3c) + + Thread T1 (tid=27979, running) created by main thread at: + #0 :0 (libtsan.so.0+0x00000001ed7b) + #1 main ??:0 (exe+0x000000000c2c) + +SUMMARY: ThreadSanitizer: ${error_type} ??:0 Thread1 +================== +") +endforeach() ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 9 09:52:50 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 9 Jul 2014 09:52:50 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4157-gb5a1c27 Message-ID: <20140709135250.E391C3AC9F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via b5a1c27295e789f46c2568555e76fc89ca26cddb (commit) via 7c80ce6f057a7d97b049fe152a6f9d914093da5f (commit) from e1831ef5f272dfb703645ae7b53f38e108cbe397 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b5a1c27295e789f46c2568555e76fc89ca26cddb commit b5a1c27295e789f46c2568555e76fc89ca26cddb Merge: e1831ef 7c80ce6 Author: Brad King AuthorDate: Wed Jul 9 09:52:50 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 9 09:52:50 2014 -0400 Merge topic 'thread-sanitizer' into next 7c80ce6f Help: Add notes for topic 'thread-sanitizer' http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7c80ce6f057a7d97b049fe152a6f9d914093da5f commit 7c80ce6f057a7d97b049fe152a6f9d914093da5f Author: Brad King AuthorDate: Wed Jul 9 09:50:45 2014 -0400 Commit: Brad King CommitDate: Wed Jul 9 09:50:45 2014 -0400 Help: Add notes for topic 'thread-sanitizer' diff --git a/Help/release/dev/thread-sanitizer.rst b/Help/release/dev/thread-sanitizer.rst new file mode 100644 index 0000000..f38e8e1 --- /dev/null +++ b/Help/release/dev/thread-sanitizer.rst @@ -0,0 +1,5 @@ +thread-sanitizer +---------------- + +* The :command:`ctest_memcheck` command learned to support + ``ThreadSanitizer``. ----------------------------------------------------------------------- Summary of changes: Help/release/dev/thread-sanitizer.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Help/release/dev/thread-sanitizer.rst hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 9 10:02:40 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 9 Jul 2014 10:02:40 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1339-gd30acf3 Message-ID: <20140709140240.8D5573AFF5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via d30acf347b557ca2f9b83f5955e3ffdb74416a87 (commit) via 5f525da0e3d4f6c50cc24a93cc792ee025939701 (commit) via 3d127627f8e28d97ecc44515e274b3780ae3f4b9 (commit) from 0e5c7aefe3a34df86d5b2f7388726c21c8f69e4f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d30acf347b557ca2f9b83f5955e3ffdb74416a87 commit d30acf347b557ca2f9b83f5955e3ffdb74416a87 Merge: 0e5c7ae 5f525da Author: Brad King AuthorDate: Wed Jul 9 10:02:39 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 9 10:02:39 2014 -0400 Merge topic 'update-kwsys' 5f525da0 Merge branch 'upstream-kwsys' into update-kwsys 3d127627 KWSys 2014-07-02 (c2a329ce) ----------------------------------------------------------------------- Summary of changes: Source/kwsys/CMakeLists.txt | 7 +- Source/kwsys/Directory.cxx | 13 +- Source/kwsys/SystemTools.cxx | 209 +++++++++++++++++++++++------ Source/kwsys/SystemTools.hxx.in | 13 +- Source/kwsys/testDynamicLoader.cxx | 2 +- Source/kwsys/testSystemTools.cxx | 257 ++++++++++++++++++++++++++++++++---- Source/kwsys/testSystemTools.h.in | 5 +- 7 files changed, 432 insertions(+), 74 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 9 10:02:42 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 9 Jul 2014 10:02:42 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1341-g77e4f54 Message-ID: <20140709140242.A78B43AFF6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 77e4f5490e3a14a265b931f79bcb621d164389d6 (commit) via 49f32168546ea8f2ef8e6a2e65c114c07edd0e69 (commit) from d30acf347b557ca2f9b83f5955e3ffdb74416a87 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=77e4f5490e3a14a265b931f79bcb621d164389d6 commit 77e4f5490e3a14a265b931f79bcb621d164389d6 Merge: d30acf3 49f3216 Author: Brad King AuthorDate: Wed Jul 9 10:02:41 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 9 10:02:41 2014 -0400 Merge topic 'CMakeExpandImportedTargets-CMP0045' 49f32168 CMakeExpandImportedTargets: Do not read property on non-target (#15008) ----------------------------------------------------------------------- Summary of changes: Modules/CMakeExpandImportedTargets.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 9 10:02:44 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 9 Jul 2014 10:02:44 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1343-g49910f1 Message-ID: <20140709140244.9F9C73AFFA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 49910f1a2c9819a848b8d3b4c15d970039d7f101 (commit) via 7400695ee3dbe0375876c7ffc2b68f356142ae79 (commit) from 77e4f5490e3a14a265b931f79bcb621d164389d6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49910f1a2c9819a848b8d3b4c15d970039d7f101 commit 49910f1a2c9819a848b8d3b4c15d970039d7f101 Merge: 77e4f54 7400695 Author: Brad King AuthorDate: Wed Jul 9 10:02:43 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 9 10:02:43 2014 -0400 Merge topic 'FindSWIG-swig3.0' 7400695e FindSWIG: Add support for swig 3.0 application ----------------------------------------------------------------------- Summary of changes: Modules/FindSWIG.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 9 10:02:46 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 9 Jul 2014 10:02:46 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1347-ge187351 Message-ID: <20140709140246.65E523B002@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via e187351c5f7c1c1ef844df6be4d19bfd303266ae (commit) via 2c470b775ab54f565383c95200d16dc42d94fe17 (commit) via de4f3e2c82a92a7dfc6305a09cc32d9d5c6e8c34 (commit) via 54bf5858cd4153f41a2414dbe8d1278268eccb58 (commit) from 49910f1a2c9819a848b8d3b4c15d970039d7f101 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e187351c5f7c1c1ef844df6be4d19bfd303266ae commit e187351c5f7c1c1ef844df6be4d19bfd303266ae Merge: 49910f1 2c470b7 Author: Brad King AuthorDate: Wed Jul 9 10:02:45 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 9 10:02:45 2014 -0400 Merge topic 'allow-OBJECT-library-extra-sources' 2c470b77 add_library: Allow arbitrary non-linked sources in OBJECT libraries de4f3e2c Tests: Fix broken dependency in ObjectLibrary test 54bf5858 Tests: Resolve TODO comment left in ObjectLibrary test ----------------------------------------------------------------------- Summary of changes: Help/command/add_library.rst | 3 ++- .../dev/allow-OBJECT-library-extra-sources.rst | 6 ++++++ Source/cmGeneratorTarget.cxx | 7 ++----- Tests/ObjectLibrary/A/CMakeLists.txt | 20 ++++++++++++++------ Tests/ObjectLibrary/B/CMakeLists.txt | 5 +---- Tests/ObjectLibrary/CMakeLists.txt | 1 + .../ObjectLibrary/BadObjSource1-stderr.txt | 3 ++- .../ObjectLibrary/BadObjSource2-stderr.txt | 3 ++- 8 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 Help/release/dev/allow-OBJECT-library-extra-sources.rst hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 9 10:02:48 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 9 Jul 2014 10:02:48 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1351-gaaea11e Message-ID: <20140709140248.076E93B002@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via aaea11e3531918612887263c7e926fca40964b1a (commit) via 6208c285c8ae43d566474f488a00967b74ee4389 (commit) via dc2e26df01eb4230a69c43a05b867fce330f57a4 (commit) via d2803fbac6ca20c998ff5364e79f0841eba6c579 (commit) from e187351c5f7c1c1ef844df6be4d19bfd303266ae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aaea11e3531918612887263c7e926fca40964b1a commit aaea11e3531918612887263c7e926fca40964b1a Merge: e187351 6208c28 Author: Brad King AuthorDate: Wed Jul 9 10:02:47 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 9 10:02:47 2014 -0400 Merge topic 'dev/custom-target-performance' 6208c285 cmMakefile: Defer dependency calculations dc2e26df cmMakefile: Avoid excess source files d2803fba cmMakefile: Add a CreateSource method ----------------------------------------------------------------------- Summary of changes: Source/cmGetSourceFilePropertyCommand.cxx | 2 +- Source/cmMakefile.cxx | 97 ++++++++++++++++------------- Source/cmMakefile.h | 7 +++ 3 files changed, 62 insertions(+), 44 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 9 10:02:49 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 9 Jul 2014 10:02:49 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1354-g55d3e88 Message-ID: <20140709140249.E31463B002@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 55d3e88fb7eb5cfdb58c5617133dfaf70d3b0547 (commit) via 7c80ce6f057a7d97b049fe152a6f9d914093da5f (commit) via 49948f72214f6e3a4acb566f773ac3ad86e6c68c (commit) from aaea11e3531918612887263c7e926fca40964b1a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=55d3e88fb7eb5cfdb58c5617133dfaf70d3b0547 commit 55d3e88fb7eb5cfdb58c5617133dfaf70d3b0547 Merge: aaea11e 7c80ce6 Author: Brad King AuthorDate: Wed Jul 9 10:02:48 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 9 10:02:48 2014 -0400 Merge topic 'thread-sanitizer' 7c80ce6f Help: Add notes for topic 'thread-sanitizer' 49948f72 ctest_memcheck: Add support for ThreadSanitizer ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-variables.7.rst | 1 + Help/release/dev/thread-sanitizer.rst | 5 + Help/variable/CTEST_MEMORYCHECK_TYPE.rst | 6 + Source/CTest/cmCTestMemCheckCommand.cxx | 2 + Source/CTest/cmCTestMemCheckHandler.cxx | 439 ++++++++++++++------- Source/CTest/cmCTestMemCheckHandler.h | 36 +- Source/CTest/cmCTestRunTest.cxx | 15 +- Tests/CTestTestMemcheck/CMakeLists.txt | 18 + Tests/CTestTestMemcheck/test.cmake.in | 1 + Tests/CTestTestMemcheck/testThreadSanitizer.cmake | 47 +++ 10 files changed, 415 insertions(+), 155 deletions(-) create mode 100644 Help/release/dev/thread-sanitizer.rst create mode 100644 Help/variable/CTEST_MEMORYCHECK_TYPE.rst create mode 100644 Tests/CTestTestMemcheck/testThreadSanitizer.cmake hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 9 10:03:24 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 9 Jul 2014 10:03:24 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4165-g91c0838 Message-ID: <20140709140324.F09BE3B020@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 91c083862a078f4c37ef7088ff2edd0833719a61 (commit) via 55d3e88fb7eb5cfdb58c5617133dfaf70d3b0547 (commit) via aaea11e3531918612887263c7e926fca40964b1a (commit) via e187351c5f7c1c1ef844df6be4d19bfd303266ae (commit) via 49910f1a2c9819a848b8d3b4c15d970039d7f101 (commit) via 77e4f5490e3a14a265b931f79bcb621d164389d6 (commit) via d30acf347b557ca2f9b83f5955e3ffdb74416a87 (commit) via 0e5c7aefe3a34df86d5b2f7388726c21c8f69e4f (commit) from b5a1c27295e789f46c2568555e76fc89ca26cddb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=91c083862a078f4c37ef7088ff2edd0833719a61 commit 91c083862a078f4c37ef7088ff2edd0833719a61 Merge: b5a1c27 55d3e88 Author: Brad King AuthorDate: Wed Jul 9 10:04:36 2014 -0400 Commit: Brad King CommitDate: Wed Jul 9 10:04:36 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 9 12:57:14 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 9 Jul 2014 12:57:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4167-g58fb132 Message-ID: <20140709165714.6C8253AC15@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 58fb132fd71d372d9f39b8fdd9753630d91b64f4 (commit) via cfab942e5ff8463f8053564e68179da110280b43 (commit) from 91c083862a078f4c37ef7088ff2edd0833719a61 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=58fb132fd71d372d9f39b8fdd9753630d91b64f4 commit 58fb132fd71d372d9f39b8fdd9753630d91b64f4 Merge: 91c0838 cfab942 Author: Brad King AuthorDate: Wed Jul 9 12:57:13 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 9 12:57:13 2014 -0400 Merge topic 'doc-package-target-import-once' into next cfab942e Help: Update cmake-packages.7 examples to import targets only once http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cfab942e5ff8463f8053564e68179da110280b43 commit cfab942e5ff8463f8053564e68179da110280b43 Author: Brad King AuthorDate: Wed Jul 9 12:54:22 2014 -0400 Commit: Brad King CommitDate: Wed Jul 9 12:57:19 2014 -0400 Help: Update cmake-packages.7 examples to import targets only once Package configuration files should load their targets files at most once in a given scope. Update our ClimbingStats example to show how to do this. diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst index c4cca6d..5badd48 100644 --- a/Help/manual/cmake-packages.7.rst +++ b/Help/manual/cmake-packages.7.rst @@ -385,9 +385,12 @@ In this case, the ``ClimbingStatsConfig.cmake`` file could be as simple as: .. code-block:: cmake - include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") + if(NOT TARGET Upstream::ClimbingStats) + include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") + endif() -As this allows downstreams to use the ``IMPORTED`` targets. If any macros +This allows downstreams to use the ``IMPORTED`` targets, and guards +against importing the targets more than once. If any macros should be provided by the ``ClimbingStats`` package, they should be in a separate file which is installed to the same location as the ``ClimbingStatsConfig.cmake`` file, and included from there. @@ -454,7 +457,9 @@ dependencies of a package should be found in the ``Config.cmake`` file: include(CMakeFindDependencyMacro) find_dependency(Stats 2.6.4) - include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") + if(NOT TARGET Upstream::ClimbingStats) + include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") + endif() include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsMacros.cmake") The ``find_dependency`` macro also sets ``ClimbingStats_FOUND`` to ``False`` if @@ -471,7 +476,9 @@ be true. This can be tested with logic in the package configuration file: include(CMakeFindDependencyMacro) find_dependency(Stats 2.6.4) - include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") + if(NOT TARGET Upstream::ClimbingStats) + include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") + endif() include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsMacros.cmake") set(_supported_components Plot Table) ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-packages.7.rst | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 9 13:20:09 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 9 Jul 2014 13:20:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4169-ge884baa Message-ID: <20140709172009.E67453AB00@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via e884baa631df6c5c9556eb9b3f351366e37bf92c (commit) via e51f2a7b6cd45a3422f01dbecf3bdc63a84545ab (commit) from 58fb132fd71d372d9f39b8fdd9753630d91b64f4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e884baa631df6c5c9556eb9b3f351366e37bf92c commit e884baa631df6c5c9556eb9b3f351366e37bf92c Merge: 58fb132 e51f2a7 Author: Brad King AuthorDate: Wed Jul 9 13:20:09 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 9 13:20:09 2014 -0400 Merge topic 'interface-sources-target-objects' into next e51f2a7b Allow INTERFACE_SOURCES to specify $ (#14970) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e51f2a7b6cd45a3422f01dbecf3bdc63a84545ab commit e51f2a7b6cd45a3422f01dbecf3bdc63a84545ab Author: Brad King AuthorDate: Wed Jul 9 13:11:38 2014 -0400 Commit: Brad King CommitDate: Wed Jul 9 13:11:38 2014 -0400 Allow INTERFACE_SOURCES to specify $ (#14970) Fix cmTarget::GetSourceFiles to set EvaluateForBuildsystem on the $ generator expression so that the $ generator expression is allowed within an INTERFACE_SOURCES value. Extend the InterfaceLibrary test to cover this case. Extend the RunCMake.TargetObjects test to cover failure of $ when used through $ in a non-buildsystem context. diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index a7402f7..1ce9a7e 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -107,6 +107,12 @@ they may not be installed, exported, or used in the right hand side of :command:`target_link_libraries`. They also may not be used as the ``TARGET`` in a use of the :command:`add_custom_command(TARGET)` command signature. +Although object libraries may not be named directly in calls to +the :command:`target_link_libraries` command, they can be "linked" +indirectly by using an :ref:`Interface Library ` +whose :prop_tgt:`INTERFACE_SOURCES` target property is set to name +``$``. + Build Specification and Usage Requirements ========================================== diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 13eac3b..3b83cd3 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1210,6 +1210,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode { cmGeneratorExpression ge(&context->Backtrace); cmsys::auto_ptr cge = ge.Parse(prop); + cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); std::string result = cge->Evaluate(context->Makefile, context->Config, context->Quiet, diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0a7724c..667c2a4 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6375,6 +6375,7 @@ void cmTargetInternals::AddInterfaceEntries( "$"; cmGeneratorExpression ge(&it->Backtrace); cmsys::auto_ptr cge = ge.Parse(genex); + cge->SetEvaluateForBuildsystem(true); entries.push_back( new cmTargetInternals::TargetPropertyEntry(cge, *it)); } diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt index d4f49c2..fe202dd 100644 --- a/Tests/InterfaceLibrary/CMakeLists.txt +++ b/Tests/InterfaceLibrary/CMakeLists.txt @@ -18,8 +18,12 @@ set_property(TARGET imp::iface APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMEPRO set_property(TARGET imp::iface PROPERTY INTERFACE_SOMEPROP OFF) set_property(TARGET imp::iface PROPERTY INTERFACE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist.cpp) +add_library(objlib OBJECT obj.cpp) +add_library(iface_objlib INTERFACE) +target_sources(iface_objlib INTERFACE $) + add_executable(InterfaceLibrary definetestexe.cpp) -target_link_libraries(InterfaceLibrary iface_nodepends headeriface subiface) +target_link_libraries(InterfaceLibrary iface_nodepends headeriface subiface iface_objlib) add_subdirectory(libsdir) diff --git a/Tests/InterfaceLibrary/definetestexe.cpp b/Tests/InterfaceLibrary/definetestexe.cpp index 30f2925..9044076 100644 --- a/Tests/InterfaceLibrary/definetestexe.cpp +++ b/Tests/InterfaceLibrary/definetestexe.cpp @@ -15,9 +15,10 @@ #error Expected IFACE_HEADER_BUILDDIR #endif +extern int obj(); extern int sub(); int main(int,char**) { - return sub(); + return obj() + sub(); } diff --git a/Tests/InterfaceLibrary/obj.cpp b/Tests/InterfaceLibrary/obj.cpp new file mode 100644 index 0000000..ee6f5fe --- /dev/null +++ b/Tests/InterfaceLibrary/obj.cpp @@ -0,0 +1 @@ +int obj() { return 0; } diff --git a/Tests/RunCMake/TargetObjects/BadContext-stderr.txt b/Tests/RunCMake/TargetObjects/BadContext-stderr.txt index 92f2c91..2d31f79 100644 --- a/Tests/RunCMake/TargetObjects/BadContext-stderr.txt +++ b/Tests/RunCMake/TargetObjects/BadContext-stderr.txt @@ -1,4 +1,14 @@ -CMake Error at BadContext.cmake:2 \(file\): +CMake Error at BadContext.cmake:4 \(file\): + Error evaluating generator expression: + + \$ + + The evaluation of the TARGET_OBJECTS generator expression is only suitable + for consumption by CMake. It is not suitable for writing out elsewhere. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadContext.cmake:5 \(file\): Error evaluating generator expression: \$ diff --git a/Tests/RunCMake/TargetObjects/BadContext.cmake b/Tests/RunCMake/TargetObjects/BadContext.cmake index 67962a4..5d7e33e 100644 --- a/Tests/RunCMake/TargetObjects/BadContext.cmake +++ b/Tests/RunCMake/TargetObjects/BadContext.cmake @@ -1,4 +1,7 @@ +add_library(iface INTERFACE) +target_sources(iface INTERFACE $) file(GENERATE OUTPUT test_output CONTENT $) +file(GENERATE OUTPUT test_output2 CONTENT $) install(FILES $ DESTINATION objects) ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-buildsystem.7.rst | 6 ++++++ Source/cmGeneratorExpressionEvaluator.cxx | 1 + Source/cmTarget.cxx | 1 + Tests/InterfaceLibrary/CMakeLists.txt | 6 +++++- Tests/InterfaceLibrary/definetestexe.cpp | 3 ++- Tests/InterfaceLibrary/obj.cpp | 1 + Tests/RunCMake/TargetObjects/BadContext-stderr.txt | 12 +++++++++++- Tests/RunCMake/TargetObjects/BadContext.cmake | 3 +++ 8 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 Tests/InterfaceLibrary/obj.cpp hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 10 00:01:51 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 10 Jul 2014 00:01:51 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1355-g7e5c9c1 Message-ID: <20140710040151.459A83B060@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 7e5c9c152677d397d03b8573f16225359171201a (commit) from 55d3e88fb7eb5cfdb58c5617133dfaf70d3b0547 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7e5c9c152677d397d03b8573f16225359171201a commit 7e5c9c152677d397d03b8573f16225359171201a Author: Kitware Robot AuthorDate: Thu Jul 10 00:01:08 2014 -0400 Commit: Kitware Robot CommitDate: Thu Jul 10 00:01:08 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c37587c..2c3ad63 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140709) +set(CMake_VERSION_PATCH 20140710) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 10 09:01:29 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 10 Jul 2014 09:01:29 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4171-gcd2351a Message-ID: <20140710130129.553133CD8F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via cd2351a279d2cd5ad5a46f9c3680e4beebde42f6 (commit) via e47ada5ba3d23a1dce733c58d637a8720b3e10cb (commit) from e884baa631df6c5c9556eb9b3f351366e37bf92c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cd2351a279d2cd5ad5a46f9c3680e4beebde42f6 commit cd2351a279d2cd5ad5a46f9c3680e4beebde42f6 Merge: e884baa e47ada5 Author: Brad King AuthorDate: Thu Jul 10 09:01:28 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 10 09:01:28 2014 -0400 Merge topic 'interface-sources-target-objects' into next e47ada5b Tests: Fix RunCMake.TargetObjects for multi-config generators http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e47ada5ba3d23a1dce733c58d637a8720b3e10cb commit e47ada5ba3d23a1dce733c58d637a8720b3e10cb Author: Brad King AuthorDate: Thu Jul 10 08:59:22 2014 -0400 Commit: Brad King CommitDate: Thu Jul 10 08:59:22 2014 -0400 Tests: Fix RunCMake.TargetObjects for multi-config generators The generator expression error may be repeated for each configuration to be generated. Update the expected output accordingly. diff --git a/Tests/RunCMake/TargetObjects/BadContext-stderr.txt b/Tests/RunCMake/TargetObjects/BadContext-stderr.txt index 2d31f79..b78189e 100644 --- a/Tests/RunCMake/TargetObjects/BadContext-stderr.txt +++ b/Tests/RunCMake/TargetObjects/BadContext-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at BadContext.cmake:4 \(file\): +(CMake Error at BadContext.cmake:4 \(file\): Error evaluating generator expression: \$ @@ -7,8 +7,8 @@ CMake Error at BadContext.cmake:4 \(file\): for consumption by CMake. It is not suitable for writing out elsewhere. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) -+ -CMake Error at BadContext.cmake:5 \(file\): +*)+ +(CMake Error at BadContext.cmake:5 \(file\): Error evaluating generator expression: \$ @@ -17,7 +17,7 @@ CMake Error at BadContext.cmake:5 \(file\): for consumption by CMake. It is not suitable for writing out elsewhere. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) -+ +*)+ CMake Error: Error evaluating generator expression: ----------------------------------------------------------------------- Summary of changes: Tests/RunCMake/TargetObjects/BadContext-stderr.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 10 09:14:11 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 10 Jul 2014 09:14:11 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4174-gde47322 Message-ID: <20140710131411.1247D3BD87@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via de47322e69c37221b19f85b0a490a77a2e1646ec (commit) via 908433bd1d335ed37a8c48d6d13a94188120ca89 (commit) via 7e5c9c152677d397d03b8573f16225359171201a (commit) from cd2351a279d2cd5ad5a46f9c3680e4beebde42f6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=de47322e69c37221b19f85b0a490a77a2e1646ec commit de47322e69c37221b19f85b0a490a77a2e1646ec Merge: cd2351a 908433b Author: Brad King AuthorDate: Thu Jul 10 09:14:10 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 10 09:14:10 2014 -0400 Merge topic 'install-cfbundle-directory' into next 908433bd OS X: Install CFBundles as complete directories 7e5c9c15 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=908433bd1d335ed37a8c48d6d13a94188120ca89 commit 908433bd1d335ed37a8c48d6d13a94188120ca89 Author: Tim Blechmann AuthorDate: Wed Jul 9 20:01:11 2014 +0200 Commit: Brad King CommitDate: Thu Jul 10 09:13:14 2014 -0400 OS X: Install CFBundles as complete directories Install CFBundles as directories just like frameworks and application bundles. diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 85df91d..8a1c53e 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -215,6 +215,20 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, filesFrom.push_back(from1); filesTo.push_back(to1); } + else if(this->Target->IsCFBundleOnApple()) + { + // Install the whole app bundle directory. + type = cmInstallType_DIRECTORY; + literal_args += " USE_SOURCE_PERMISSIONS"; + + std::string targetNameBase = targetName.substr(0, targetName.find('/')); + + std::string from1 = fromDirConfig + targetNameBase; + std::string to1 = toDir + targetName; + + filesFrom.push_back(from1); + filesTo.push_back(to1); + } else { bool haveNamelink = false; ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- Source/cmInstallTargetGenerator.cxx | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 10 10:45:09 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 10 Jul 2014 10:45:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4176-gccd2612 Message-ID: <20140710144509.29CA13C35E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ccd2612f1630cb99448e8cab2ff44fbf90a1dca4 (commit) via d2f68588caba8f9df5756fc5c52d6e54d2caa6a5 (commit) from de47322e69c37221b19f85b0a490a77a2e1646ec (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ccd2612f1630cb99448e8cab2ff44fbf90a1dca4 commit ccd2612f1630cb99448e8cab2ff44fbf90a1dca4 Merge: de47322 d2f6858 Author: Brad King AuthorDate: Thu Jul 10 10:45:08 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 10 10:45:08 2014 -0400 Merge topic 'doc-CMAKE_LANG_PLATFORM_ID' into next d2f68588 Help: Document possible values of CMAKE__PLATFORM_ID (#15012) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d2f68588caba8f9df5756fc5c52d6e54d2caa6a5 commit d2f68588caba8f9df5756fc5c52d6e54d2caa6a5 Author: Philipp Moeller AuthorDate: Thu Jul 10 10:38:50 2014 -0400 Commit: Brad King CommitDate: Thu Jul 10 10:45:17 2014 -0400 Help: Document possible values of CMAKE__PLATFORM_ID (#15012) Also add a note for anyone who might change CMakePlatformId.h.in to keep the documentation up to date. diff --git a/Help/variable/CMAKE_LANG_PLATFORM_ID.rst b/Help/variable/CMAKE_LANG_PLATFORM_ID.rst index 1b243e3..f50e480 100644 --- a/Help/variable/CMAKE_LANG_PLATFORM_ID.rst +++ b/Help/variable/CMAKE_LANG_PLATFORM_ID.rst @@ -1,6 +1,40 @@ CMAKE__PLATFORM_ID ------------------------ -An internal variable subject to change. +Platform identification string. -This is used in determining the platform and is subject to change. +A short string unique to the platform. Possible values include: + +:: + + AIX + BSDOS + BeOS + Cygwin + DOS + Darwin + FreeBSD + HP-UX + Haiku + IRIX + Linux + MP-RAS + MinGW + NetBSD + OS2 + OSF1 + OpenBSD + QNX + RISCos + SCO_SV + SINIX + SunOS + Tru64 + ULTRIX + UNIX_SV + Windows + Windows3x + Xenix + +This variable is not guaranteed to be defined for all platforms. +An empty string represents an unknown platform. diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index bc26c07..f182d46 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -1,4 +1,5 @@ -/* Identify known platforms by name. */ +/* Identify known platforms by name. If you add a platform here, also + document it in "Help/variable/CMAKE_LANG_PLATFORM_ID.rst". */ #if defined(__linux) || defined(__linux__) || defined(linux) # define PLATFORM_ID "Linux" ----------------------------------------------------------------------- Summary of changes: Help/variable/CMAKE_LANG_PLATFORM_ID.rst | 38 ++++++++++++++++++++++++++++-- Modules/CMakePlatformId.h.in | 3 ++- 2 files changed, 38 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 10 10:55:28 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 10 Jul 2014 10:55:28 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4178-gd084dfd Message-ID: <20140710145528.D678E3CD81@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d084dfd112cf51e8865cef42b7a6388a229b4b10 (commit) via 108b62bae89efcd9f0a2680ea6bf30edee602d58 (commit) from ccd2612f1630cb99448e8cab2ff44fbf90a1dca4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d084dfd112cf51e8865cef42b7a6388a229b4b10 commit d084dfd112cf51e8865cef42b7a6388a229b4b10 Merge: ccd2612 108b62b Author: Brad King AuthorDate: Thu Jul 10 10:55:28 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 10 10:55:28 2014 -0400 Merge topic 'doc-genex-id-values' into next 108b62ba Help: Link to variables corresponding to id and version expressions (#15012) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=108b62bae89efcd9f0a2680ea6bf30edee602d58 commit 108b62bae89efcd9f0a2680ea6bf30edee602d58 Author: Brad King AuthorDate: Thu Jul 10 10:51:52 2014 -0400 Commit: Brad King CommitDate: Thu Jul 10 10:51:52 2014 -0400 Help: Link to variables corresponding to id and version expressions (#15012) In the cmake-generator-expressions(7) manual, link to the variables that correspond to the PLATFORM_ID, C_COMPILER_ID, CXX_COMPILER_ID, C_COMPILER_VERSION, and CXX_COMPILER_VERSION generator expressions. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index f04702e..0491128 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -116,15 +116,20 @@ than 4.2.0. ``$`` Configuration name ``$`` - The CMake-id of the platform + The CMake-id of the platform. + See also the :variable:`CMAKE__PLATFORM_ID` variable. ``$`` The CMake-id of the C compiler used. + See also the :variable:`CMAKE__COMPILER_ID` variable. ``$`` The CMake-id of the CXX compiler used. + See also the :variable:`CMAKE__COMPILER_ID` variable. ``$`` The version of the C compiler used. + See also the :variable:`CMAKE__COMPILER_VERSION` variable. ``$`` The version of the CXX compiler used. + See also the :variable:`CMAKE__COMPILER_VERSION` variable. ``$`` Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a target. ``$`` ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 10 12:54:37 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 10 Jul 2014 12:54:37 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4180-g5d14a03 Message-ID: <20140710165437.A56DE3D7C0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 5d14a037105ba9074afab1b134af91aa8edeabd0 (commit) via a3ac67cc3f8d9b4df9c93f65db28c494c8883811 (commit) from d084dfd112cf51e8865cef42b7a6388a229b4b10 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5d14a037105ba9074afab1b134af91aa8edeabd0 commit 5d14a037105ba9074afab1b134af91aa8edeabd0 Merge: d084dfd a3ac67c Author: Brad King AuthorDate: Thu Jul 10 12:54:37 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 10 12:54:37 2014 -0400 Merge topic 'install-cfbundle-directory' into next a3ac67cc OS X: Install CFBundles as complete directories http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a3ac67cc3f8d9b4df9c93f65db28c494c8883811 commit a3ac67cc3f8d9b4df9c93f65db28c494c8883811 Author: Tim Blechmann AuthorDate: Wed Jul 9 20:01:11 2014 +0200 Commit: Brad King CommitDate: Thu Jul 10 12:54:10 2014 -0400 OS X: Install CFBundles as complete directories Install CFBundles as directories just like frameworks and application bundles. diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 7a39f45..38d369e 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -213,6 +213,20 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, filesFrom.push_back(from1); filesTo.push_back(to1); } + else if(this->Target->IsCFBundleOnApple()) + { + // Install the whole app bundle directory. + type = cmInstallType_DIRECTORY; + literal_args += " USE_SOURCE_PERMISSIONS"; + + std::string targetNameBase = targetName.substr(0, targetName.find('/')); + + std::string from1 = fromDirConfig + targetNameBase; + std::string to1 = toDir + targetName; + + filesFrom.push_back(from1); + filesTo.push_back(to1); + } else { bool haveNamelink = false; ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 10 14:19:02 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 10 Jul 2014 14:19:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4182-gef1a3b5 Message-ID: <20140710181902.EC11F3D8DB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ef1a3b5951d834299eea6400949c2a94fdf3ad0a (commit) via fcca1eb90e6d1383e27ceb30c03b739ea30fe180 (commit) from 5d14a037105ba9074afab1b134af91aa8edeabd0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ef1a3b5951d834299eea6400949c2a94fdf3ad0a commit ef1a3b5951d834299eea6400949c2a94fdf3ad0a Merge: 5d14a03 fcca1eb Author: Brad King AuthorDate: Thu Jul 10 14:19:01 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 10 14:19:01 2014 -0400 Merge topic 'FindCurses-overhaul' into next fcca1eb9 FindCurses: Overhaul Curses and NCurses search logic http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fcca1eb90e6d1383e27ceb30c03b739ea30fe180 commit fcca1eb90e6d1383e27ceb30c03b739ea30fe180 Author: Brad King AuthorDate: Thu Jul 10 14:06:45 2014 -0400 Commit: Brad King CommitDate: Thu Jul 10 14:13:11 2014 -0400 FindCurses: Overhaul Curses and NCurses search logic Simplify the logic by never finding "ncurses/ncurses.h" or "ncurses/curses.h". Instead always find either "ncurses.h" or "curses.h" and report the include directory as ".../ncurses" if necessary. This also avoids asking applications to provide conditional inclusion of both "ncurses/ncurses.h" and "ncurses.h". Furthermore, it produces a more consistent result by finding only a single location for headers and never claiming that both "ncurses.h" and "ncurses/ncurses.h" exist. They might be from separate and incompatible packages. While at it, provide the CURSES_INCLUDE_DIRS result variable to be consistent with other modules. diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index 9b633c7..5c61090 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -2,28 +2,46 @@ # FindCurses # ---------- # -# Find the curses include file and library +# Find the curses or ncurses include file and library. # +# Result Variables +# ^^^^^^^^^^^^^^^^ # +# This module defines the following variables: # -# :: +# ``CURSES_FOUND`` +# True if Curses is found. +# ``CURSES_INCLUDE_DIRS`` +# The include directories needed to use Curses. +# ``CURSES_LIBRARIES`` +# The libraries needed to use Curses. +# ``CURSES_HAVE_CURSES_H`` +# True if curses.h is available. +# ``CURSES_HAVE_NCURSES_H`` +# True if ncurses.h is available. # -# CURSES_FOUND - system has Curses -# CURSES_INCLUDE_DIR - the Curses include directory -# CURSES_LIBRARIES - The libraries needed to use Curses -# CURSES_HAVE_CURSES_H - true if curses.h is available -# CURSES_HAVE_NCURSES_H - true if ncurses.h is available -# CURSES_HAVE_NCURSES_NCURSES_H - true if ncurses/ncurses.h is available -# CURSES_HAVE_NCURSES_CURSES_H - true if ncurses/curses.h is available -# CURSES_LIBRARY - set for backwards compatibility with 2.4 CMake +# Set ``CURSES_NEED_NCURSES`` to ``TRUE`` before the +# ``find_package(Curses)`` call if NCurses functionality is required. # +# Backward Compatibility +# ^^^^^^^^^^^^^^^^^^^^^^ # +# The following variable are provided for backward compatibility: # -# Set CURSES_NEED_NCURSES to TRUE before the find_package() command if -# NCurses functionality is required. +# ``CURSES_HAVE_NCURSES_NCURSES_H`` +# Always false. Used to be true if ``ncurses/ncurses.h`` is available. +# ``CURSES_HAVE_NCURSES_CURSES_H`` +# Always false. Used to be true if ``ncurses/curses.h`` is available. +# ``CURSES_INCLUDE_DIR`` +# Path to Curses include. Use ``CURSES_INCLUDE_DIRS`` instead. +# ``CURSES_LIBRARY`` +# Path to Curses library. Use ``CURSES_LIBRARIES`` instead. +# +# Currently if the headers are in a ``ncurses/`` directory the +# path(s) in ``CURSES_INCLUDE_DIRS`` will simply point at that. #============================================================================= -# Copyright 2001-2009 Kitware, Inc. +# Copyright 2001-2014 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -84,61 +102,38 @@ if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES) endif() - -if(NOT CURSES_USE_NCURSES) - find_file(CURSES_HAVE_CURSES_H curses.h ) - find_path(CURSES_CURSES_H_PATH curses.h ) - get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH) - get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) - - # for compatibility with older FindCurses.cmake this has to be in the cache - # FORCE must not be used since this would break builds which preload a cache wqith these variables set - set(CURSES_INCLUDE_PATH "${CURSES_CURSES_H_PATH}" - CACHE FILEPATH "The curses include path") - set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}" - CACHE FILEPATH "The curses library") -else() -# we need to find ncurses +if(CURSES_USE_NCURSES) get_filename_component(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH) get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) - find_file(CURSES_HAVE_NCURSES_H ncurses.h) - find_file(CURSES_HAVE_NCURSES_NCURSES_H ncurses/ncurses.h) - find_file(CURSES_HAVE_NCURSES_CURSES_H ncurses/curses.h) - find_file(CURSES_HAVE_CURSES_H curses.h - HINTS "${_cursesParentDir}/include") - - find_path(CURSES_NCURSES_INCLUDE_PATH ncurses.h ncurses/ncurses.h - ncurses/curses.h) - find_path(CURSES_NCURSES_INCLUDE_PATH curses.h - HINTS "${_cursesParentDir}/include") - - # for compatibility with older FindCurses.cmake this has to be in the cache - # FORCE must not be used since this would break builds which preload - # however if the value of the variable has NOTFOUND in it, then - # it is OK to force, and we need to force in order to have it work. - # a cache wqith these variables set - # only put ncurses include and library into - # variables if they are found - if(NOT CURSES_NCURSES_INCLUDE_PATH AND CURSES_HAVE_NCURSES_NCURSES_H) - get_filename_component(CURSES_NCURSES_INCLUDE_PATH - "${CURSES_HAVE_NCURSES_NCURSES_H}" PATH) + # Use CURSES_NCURSES_INCLUDE_PATH if set, for compatibility. + if(CURSES_NCURSES_INCLUDE_PATH) + find_path(CURSES_INCLUDE_PATH + NAMES ncurses.h curses.h + PATHS ${CURSES_NCURSES_INCLUDE_PATH} + NO_DEFAULT_PATH + ) endif() - if(CURSES_NCURSES_INCLUDE_PATH AND CURSES_NCURSES_LIBRARY) - set( FORCE_IT ) - if(CURSES_INCLUDE_PATH MATCHES NOTFOUND) - set(FORCE_IT FORCE) - endif() - set(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}" - CACHE FILEPATH "The curses include path" ${FORCE_IT}) - set( FORCE_IT) - if(CURSES_LIBRARY MATCHES NOTFOUND) - set(FORCE_IT FORCE) - endif() - set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}" - CACHE FILEPATH "The curses library" ${FORCE_IT}) + + find_path(CURSES_INCLUDE_PATH + NAMES ncurses.h curses.h + HINTS "${_cursesParentDir}/include" + PATH_SUFFIXES ncurses + ) + + # Previous versions of FindCurses provided these values. + if(NOT DEFINED CURSES_LIBRARY) + set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}") endif() + # Previous versions of FindCurses also looked for ncurses/ncurses.h + # and told projects to #include instead of just + # #include . Now we just report the include/ncurses + # directory instead, so just pretend that ncurses/ncurses.h is + # never available. + set(CURSES_HAVE_NCURSES_NCURSES_H "CURSES_HAVE_NCURSES_NCURSES_H-NOTFOUND") + set(CURSES_HAVE_NCURSES_CURSES_H "CURSES_HAVE_NCURSES_CURSES_H-NOTFOUND") + CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" cbreak "" CURSES_NCURSES_HAS_CBREAK) if(NOT CURSES_NCURSES_HAS_CBREAK) @@ -147,6 +142,39 @@ else() CHECK_LIBRARY_EXISTS("${CURSES_EXTRA_LIBRARY}" cbreak "" CURSES_TINFO_HAS_CBREAK) endif() +else() + get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH) + get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) + + find_path(CURSES_INCLUDE_PATH + NAMES curses.h + HINTS "${_cursesParentDir}/include" + ) + + # Previous versions of FindCurses provided these values. + if(NOT DEFINED CURSES_CURSES_H_PATH) + set(CURSES_CURSES_H_PATH "${CURSES_INCLUDE_PATH}") + endif() + if(NOT DEFINED CURSES_LIBRARY) + set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}") + endif() +endif() + +# Previous versions of FindCurses did a separate find_file for +# ncurses.h and curses.h. Report the results as it would have. +if(NOT DEFINED CURSES_HAVE_NCURSES_H) + if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses.h") + set(CURSES_HAVE_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses.h") + else() + set(CURSES_HAVE_NCURSES_H "CURSES_HAVE_NCURSES_H-NOTFOUND") + endif() +endif() +if(NOT DEFINED CURSES_HAVE_CURSES_H) + if(EXISTS "${CURSES_INCLUDE_PATH}/curses.h") + set(CURSES_HAVE_CURSES_H "${CURSES_INCLUDE_PATH}/curses.h") + else() + set(CURSES_HAVE_CURSES_H "CURSES_HAVE_CURSES_H-NOTFOUND") + endif() endif() if (NOT CURSES_TINFO_HAS_CBREAK) @@ -157,11 +185,10 @@ endif() find_library(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}") find_library(CURSES_FORM_LIBRARY form ) -# for compatibility with older FindCurses.cmake this has to be in the cache -# FORCE must not be used since this would break builds which preload a cache -# qith these variables set -set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}" - CACHE FILEPATH "The curses form library") +# Previous versions of FindCurses provided these values. +if(NOT DEFINED FORM_LIBRARY) + set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}") +endif() # Need to provide the *_LIBRARIES set(CURSES_LIBRARIES ${CURSES_LIBRARY}) @@ -174,8 +201,9 @@ if(CURSES_FORM_LIBRARY) set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY}) endif() -# Proper name is *_INCLUDE_DIR -set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) +# Provide the *_INCLUDE_DIRS result. +set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_PATH}) +set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # compatibility # handle the QUIETLY and REQUIRED arguments and set CURSES_FOUND to TRUE if # all listed variables are TRUE @@ -185,18 +213,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG mark_as_advanced( CURSES_INCLUDE_PATH - CURSES_LIBRARY - CURSES_CURSES_INCLUDE_PATH CURSES_CURSES_LIBRARY - CURSES_NCURSES_INCLUDE_PATH CURSES_NCURSES_LIBRARY CURSES_EXTRA_LIBRARY - FORM_LIBRARY - CURSES_LIBRARIES - CURSES_INCLUDE_DIR - CURSES_CURSES_HAS_WSYNCUP - CURSES_NCURSES_HAS_WSYNCUP - CURSES_NCURSES_HAS_CBREAK - CURSES_TINFO_HAS_CBREAK ) - ----------------------------------------------------------------------- Summary of changes: Modules/FindCurses.cmake | 177 +++++++++++++++++++++++++--------------------- 1 file changed, 97 insertions(+), 80 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 10 14:40:57 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 10 Jul 2014 14:40:57 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4184-g41550f2 Message-ID: <20140710184057.AFE643CB36@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 41550f2d90eed9327fee873611a2e9f5094b5614 (commit) via 5d8738468f3eb6f45035d1f77c23ef5fdf490af6 (commit) from ef1a3b5951d834299eea6400949c2a94fdf3ad0a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=41550f2d90eed9327fee873611a2e9f5094b5614 commit 41550f2d90eed9327fee873611a2e9f5094b5614 Merge: ef1a3b5 5d87384 Author: Brad King AuthorDate: Thu Jul 10 14:40:56 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 10 14:40:56 2014 -0400 Merge topic 'vs-RC-flags' into next 5d873846 VS: Fix handling of non-preprocessor flags in CMAKE_RC_FLAGS http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5d8738468f3eb6f45035d1f77c23ef5fdf490af6 commit 5d8738468f3eb6f45035d1f77c23ef5fdf490af6 Author: Martin Mitas AuthorDate: Thu Jul 10 01:01:18 2014 +0200 Commit: Brad King CommitDate: Thu Jul 10 14:33:27 2014 -0400 VS: Fix handling of non-preprocessor flags in CMAKE_RC_FLAGS Teach the VS >= 10 generator to honor flags other than -I and -D in the CMAKE_RC_FLAGS[_] variable. Place them within the ResourceCompile .vcxproj element under AdditionalOptions. Also add a rudimentary flag map to map '-n' to 'NullTerminateStrings'. diff --git a/Source/cmVS10RCFlagTable.h b/Source/cmVS10RCFlagTable.h new file mode 100644 index 0000000..9049986 --- /dev/null +++ b/Source/cmVS10RCFlagTable.h @@ -0,0 +1,7 @@ +static cmVS7FlagTable cmVS10RCFlagTable[] = +{ + //Bool Properties + {"NullTerminateStrings", "n", "", "true", 0}, + + {0,0,0,0,0} +}; diff --git a/Source/cmVS11RCFlagTable.h b/Source/cmVS11RCFlagTable.h new file mode 100644 index 0000000..a7d2de1 --- /dev/null +++ b/Source/cmVS11RCFlagTable.h @@ -0,0 +1,7 @@ +static cmVS7FlagTable cmVS11RCFlagTable[] = +{ + //Bool Properties + {"NullTerminateStrings", "n", "", "true", 0}, + + {0,0,0,0,0} +}; diff --git a/Source/cmVS12RCFlagTable.h b/Source/cmVS12RCFlagTable.h new file mode 100644 index 0000000..1551c66 --- /dev/null +++ b/Source/cmVS12RCFlagTable.h @@ -0,0 +1,7 @@ +static cmVS7FlagTable cmVS12RCFlagTable[] = +{ + //Bool Properties + {"NullTerminateStrings", "n", "", "true", 0}, + + {0,0,0,0,0} +}; diff --git a/Source/cmVS14RCFlagTable.h b/Source/cmVS14RCFlagTable.h new file mode 100644 index 0000000..ebd8d65 --- /dev/null +++ b/Source/cmVS14RCFlagTable.h @@ -0,0 +1,7 @@ +static cmVS7FlagTable cmVS14RCFlagTable[] = +{ + //Bool Properties + {"NullTerminateStrings", "n", "", "true", 0}, + + {0,0,0,0,0} +}; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 1e09ed9..0458bd6 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -21,15 +21,19 @@ #include "cmLocalVisualStudio7Generator.h" #include "cmCustomCommandGenerator.h" #include "cmVS10CLFlagTable.h" +#include "cmVS10RCFlagTable.h" #include "cmVS10LinkFlagTable.h" #include "cmVS10LibFlagTable.h" #include "cmVS11CLFlagTable.h" +#include "cmVS11RCFlagTable.h" #include "cmVS11LinkFlagTable.h" #include "cmVS11LibFlagTable.h" #include "cmVS12CLFlagTable.h" +#include "cmVS12RCFlagTable.h" #include "cmVS12LinkFlagTable.h" #include "cmVS12LibFlagTable.h" #include "cmVS14CLFlagTable.h" +#include "cmVS14RCFlagTable.h" #include "cmVS14LinkFlagTable.h" #include "cmVS14LibFlagTable.h" @@ -49,6 +53,20 @@ cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetClFlagTable() const { return cmVS10CLFlagTable; } } +cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetRcFlagTable() const +{ + cmLocalVisualStudioGenerator::VSVersion + v = this->LocalGenerator->GetVersion(); + if(v >= cmLocalVisualStudioGenerator::VS14) + { return cmVS14RCFlagTable; } + else if(v >= cmLocalVisualStudioGenerator::VS12) + { return cmVS12RCFlagTable; } + else if(v == cmLocalVisualStudioGenerator::VS11) + { return cmVS11RCFlagTable; } + else + { return cmVS10RCFlagTable; } +} + cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLibFlagTable() const { cmLocalVisualStudioGenerator::VSVersion @@ -212,6 +230,10 @@ void cmVisualStudio10TargetGenerator::Generate() { return; } + if(!this->ComputeRcOptions()) + { + return; + } if(!this->ComputeLinkOptions()) { return; @@ -1504,15 +1526,59 @@ OutputIncludes(std::vector const & includes) +//---------------------------------------------------------------------------- +bool cmVisualStudio10TargetGenerator::ComputeRcOptions() +{ + std::vector const* configs = + this->GlobalGenerator->GetConfigurations(); + for(std::vector::const_iterator i = configs->begin(); + i != configs->end(); ++i) + { + if(!this->ComputeRcOptions(*i)) + { + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- +bool cmVisualStudio10TargetGenerator::ComputeRcOptions( + std::string const& configName) +{ + cmsys::auto_ptr pOptions( + new Options(this->LocalGenerator, Options::ResourceCompiler, + this->GetRcFlagTable())); + Options& rcOptions = *pOptions; + + std::string CONFIG = cmSystemTools::UpperCase(configName); + std::string rcConfigFlagsVar = std::string("CMAKE_RC_FLAGS_") + CONFIG; + std::string flags = + std::string(this->Makefile->GetSafeDefinition("CMAKE_RC_FLAGS")) + + std::string(" ") + + std::string(this->Makefile->GetSafeDefinition(rcConfigFlagsVar)); + + rcOptions.Parse(flags.c_str()); + this->RcOptions[configName] = pOptions.release(); + return true; +} + void cmVisualStudio10TargetGenerator:: WriteRCOptions(std::string const& configName, std::vector const & includes) { this->WriteString("\n", 2); + + // Preprocessor definitions and includes are shared with clOptions. Options& clOptions = *(this->ClOptions[configName]); clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", "\n", "RC"); this->OutputIncludes(includes); + + Options& rcOptions = *(this->RcOptions[configName]); + rcOptions.OutputFlagMap(*this->BuildFileStream, " "); + rcOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); + this->WriteString("\n", 2); } diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 8f2faca..6bdb40a 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -72,6 +72,8 @@ private: bool ComputeClOptions(std::string const& configName); void WriteClOptions(std::string const& config, std::vector const & includes); + bool ComputeRcOptions(); + bool ComputeRcOptions(std::string const& config); void WriteRCOptions(std::string const& config, std::vector const & includes); bool ComputeLinkOptions(); @@ -101,6 +103,7 @@ private: bool IsResxHeader(const std::string& headerFile); cmIDEFlagTable const* GetClFlagTable() const; + cmIDEFlagTable const* GetRcFlagTable() const; cmIDEFlagTable const* GetLibFlagTable() const; cmIDEFlagTable const* GetLinkFlagTable() const; @@ -108,6 +111,7 @@ private: typedef cmVisualStudioGeneratorOptions Options; typedef std::map OptionsMap; OptionsMap ClOptions; + OptionsMap RcOptions; OptionsMap LinkOptions; std::string PathToVcxproj; cmTarget* Target; diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h index 214b893..47a7c62 100644 --- a/Source/cmVisualStudioGeneratorOptions.h +++ b/Source/cmVisualStudioGeneratorOptions.h @@ -27,6 +27,7 @@ public: enum Tool { Compiler, + ResourceCompiler, Linker, FortranCompiler }; ----------------------------------------------------------------------- Summary of changes: Source/cmVS10RCFlagTable.h | 7 +++ Source/cmVS11RCFlagTable.h | 7 +++ Source/cmVS12RCFlagTable.h | 7 +++ Source/cmVS14RCFlagTable.h | 7 +++ Source/cmVisualStudio10TargetGenerator.cxx | 66 ++++++++++++++++++++++++++++ Source/cmVisualStudio10TargetGenerator.h | 4 ++ Source/cmVisualStudioGeneratorOptions.h | 1 + 7 files changed, 99 insertions(+) create mode 100644 Source/cmVS10RCFlagTable.h create mode 100644 Source/cmVS11RCFlagTable.h create mode 100644 Source/cmVS12RCFlagTable.h create mode 100644 Source/cmVS14RCFlagTable.h hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 10 16:00:21 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 10 Jul 2014 16:00:21 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4186-gf84890e Message-ID: <20140710200021.80C113D9CE@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f84890e5852aef9f3910faab1a7546156753d12e (commit) via f45ede61a1e5282f432b169217028c80c12c77a3 (commit) from 41550f2d90eed9327fee873611a2e9f5094b5614 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f84890e5852aef9f3910faab1a7546156753d12e commit f84890e5852aef9f3910faab1a7546156753d12e Merge: 41550f2 f45ede6 Author: Brad King AuthorDate: Thu Jul 10 16:00:20 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 10 16:00:20 2014 -0400 Merge topic 'refactor-link-internals' into next f45ede61 cmTarget: Fix CMP0022 OLD breakage from recent refactoring http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f45ede61a1e5282f432b169217028c80c12c77a3 commit f45ede61a1e5282f432b169217028c80c12c77a3 Author: Brad King AuthorDate: Thu Jul 10 15:50:15 2014 -0400 Commit: Brad King CommitDate: Thu Jul 10 16:01:04 2014 -0400 cmTarget: Fix CMP0022 OLD breakage from recent refactoring In commit 7b0834e9 (cmTarget: Refactor internal LinkImplementation map, 2014-06-19) cmTarget::GetLinkImplementationLibrariesInternal was changed accidentally to pass "this" to ComputeLinkImplementation instead of "head". Change it back. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index aa0ed56..a6303e9 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6568,7 +6568,7 @@ cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config, if(!impl.LibrariesDone) { impl.LibrariesDone = true; - this->ComputeLinkImplementation(config, impl, this); + this->ComputeLinkImplementation(config, impl, head); } return &impl; } ----------------------------------------------------------------------- Summary of changes: Source/cmTarget.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 10 16:17:06 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 10 Jul 2014 16:17:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4188-g5d8a1a1 Message-ID: <20140710201706.DB9F53D6F3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 5d8a1a14d87e42343701453617de0bf335cb64bf (commit) via 7e1283e48c54424b38444f78c983fc32a287ee80 (commit) from f84890e5852aef9f3910faab1a7546156753d12e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5d8a1a14d87e42343701453617de0bf335cb64bf commit 5d8a1a14d87e42343701453617de0bf335cb64bf Merge: f84890e 7e1283e Author: Brad King AuthorDate: Thu Jul 10 16:17:06 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 10 16:17:06 2014 -0400 Merge topic 'wince-fix-dll-linking' into next 7e1283e4 MSVC: Fix linking of DLLs on WinCE (#15013) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7e1283e48c54424b38444f78c983fc32a287ee80 commit 7e1283e48c54424b38444f78c983fc32a287ee80 Author: Brad King AuthorDate: Thu Jul 10 15:06:19 2014 -0400 Commit: Brad King CommitDate: Thu Jul 10 15:10:32 2014 -0400 MSVC: Fix linking of DLLs on WinCE (#15013) On WinCE we must link both shared libraries and executables with the /subsystem:windowsce flag. Teach Platform/Windows-MSVC to pass it to the linker in both cases. Suggested-by: Gunnar Roth diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index e29aaf4..cfef536 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -39,12 +39,14 @@ endif() set(WIN32 1) if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE") - set(CMAKE_CREATE_WIN32_EXE "/subsystem:windowsce /entry:WinMainCRTStartup") - set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce /entry:mainACRTStartup") + set(CMAKE_CREATE_WIN32_EXE "/entry:WinMainCRTStartup") + set(CMAKE_CREATE_CONSOLE_EXE "/entry:mainACRTStartup") + set(_PLATFORM_LINK_FLAGS " /subsystem:windowsce") set(WINCE 1) else() set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows") set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console") + set(_PLATFORM_LINK_FLAGS "") endif() if(CMAKE_GENERATOR MATCHES "Visual Studio 6") @@ -235,7 +237,7 @@ macro(__windows_compiler_msvc lang) set(_CMAKE_VS_LINK_EXE " -E vs_link_exe ") endif() set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - "${_CMAKE_VS_LINK_DLL} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /dll /version:. ${CMAKE_END_TEMP_FILE}") + "${_CMAKE_VS_LINK_DLL} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /dll /version:.${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}) set(CMAKE_${lang}_CREATE_STATIC_LIBRARY " /lib ${CMAKE_CL_NOLOGO} /out: ") @@ -249,7 +251,7 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) set(CMAKE_${lang}_LINK_EXECUTABLE - "${_CMAKE_VS_LINK_EXE} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /version:. ${CMAKE_END_TEMP_FILE}") + "${_CMAKE_VS_LINK_EXE} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /version:.${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}") set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}") ----------------------------------------------------------------------- Summary of changes: Modules/Platform/Windows-MSVC.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jul 11 00:01:54 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 11 Jul 2014 00:01:54 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1356-gc9b5e34 Message-ID: <20140711040154.9F5373DA9B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c9b5e341875e7d51d94c06e3d264f020b288d26c (commit) from 7e5c9c152677d397d03b8573f16225359171201a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c9b5e341875e7d51d94c06e3d264f020b288d26c commit c9b5e341875e7d51d94c06e3d264f020b288d26c Author: Kitware Robot AuthorDate: Fri Jul 11 00:01:07 2014 -0400 Commit: Kitware Robot CommitDate: Fri Jul 11 00:01:07 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2c3ad63..7bf43cb 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140710) +set(CMake_VERSION_PATCH 20140711) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sat Jul 12 00:02:10 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 12 Jul 2014 00:02:10 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1357-g2eadd12 Message-ID: <20140712040210.800D13DF66@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 2eadd127e9d5cad03f6a596bb01dfc682734f7b6 (commit) from c9b5e341875e7d51d94c06e3d264f020b288d26c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2eadd127e9d5cad03f6a596bb01dfc682734f7b6 commit 2eadd127e9d5cad03f6a596bb01dfc682734f7b6 Author: Kitware Robot AuthorDate: Sat Jul 12 00:01:18 2014 -0400 Commit: Kitware Robot CommitDate: Sat Jul 12 00:01:18 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7bf43cb..609af5d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140711) +set(CMake_VERSION_PATCH 20140712) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Jul 13 00:02:02 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 13 Jul 2014 00:02:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1358-g6ac04ae Message-ID: <20140713040202.040673DC34@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 6ac04aee51ab3cb9c05efb6f6195bf34f9609fae (commit) from 2eadd127e9d5cad03f6a596bb01dfc682734f7b6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6ac04aee51ab3cb9c05efb6f6195bf34f9609fae commit 6ac04aee51ab3cb9c05efb6f6195bf34f9609fae Author: Kitware Robot AuthorDate: Sun Jul 13 00:01:06 2014 -0400 Commit: Kitware Robot CommitDate: Sun Jul 13 00:01:06 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 609af5d..ae7dc17 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140712) +set(CMake_VERSION_PATCH 20140713) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 14 00:02:07 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 14 Jul 2014 00:02:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1359-gedf94b6 Message-ID: <20140714040207.87DF03EFC8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via edf94b6588ceba9196a1b5ef3a4579114bebab39 (commit) from 6ac04aee51ab3cb9c05efb6f6195bf34f9609fae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=edf94b6588ceba9196a1b5ef3a4579114bebab39 commit edf94b6588ceba9196a1b5ef3a4579114bebab39 Author: Kitware Robot AuthorDate: Mon Jul 14 00:01:07 2014 -0400 Commit: Kitware Robot CommitDate: Mon Jul 14 00:01:07 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ae7dc17..0de45a0 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140713) +set(CMake_VERSION_PATCH 20140714) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 09:08:38 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 09:08:38 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4190-g63675f1 Message-ID: <20140714130838.9AAB440558@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 63675f1f5f6584ab45ae5fb55e23a49a7fb2f7c2 (commit) via affe9d56a2e17683dc87c457c27cad7f39b0ad56 (commit) from 5d8a1a14d87e42343701453617de0bf335cb64bf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=63675f1f5f6584ab45ae5fb55e23a49a7fb2f7c2 commit 63675f1f5f6584ab45ae5fb55e23a49a7fb2f7c2 Merge: 5d8a1a1 affe9d5 Author: Brad King AuthorDate: Mon Jul 14 09:08:37 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 09:08:37 2014 -0400 Merge topic 'interface-sources-target-objects' into next affe9d56 Allow INTERFACE_SOURCES to specify $ (#14970) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=affe9d56a2e17683dc87c457c27cad7f39b0ad56 commit affe9d56a2e17683dc87c457c27cad7f39b0ad56 Author: Brad King AuthorDate: Wed Jul 9 13:11:38 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 09:09:32 2014 -0400 Allow INTERFACE_SOURCES to specify $ (#14970) Fix cmTarget::GetSourceFiles to set EvaluateForBuildsystem on the $ generator expression so that the $ generator expression is allowed within an INTERFACE_SOURCES value. Extend the InterfaceLibrary test to cover this case. Extend the RunCMake.TargetObjects test to cover failure of $ when used through $ in a non-buildsystem context. diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index a7402f7..1ce9a7e 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -107,6 +107,12 @@ they may not be installed, exported, or used in the right hand side of :command:`target_link_libraries`. They also may not be used as the ``TARGET`` in a use of the :command:`add_custom_command(TARGET)` command signature. +Although object libraries may not be named directly in calls to +the :command:`target_link_libraries` command, they can be "linked" +indirectly by using an :ref:`Interface Library ` +whose :prop_tgt:`INTERFACE_SOURCES` target property is set to name +``$``. + Build Specification and Usage Requirements ========================================== diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 13eac3b..3b83cd3 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1210,6 +1210,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode { cmGeneratorExpression ge(&context->Backtrace); cmsys::auto_ptr cge = ge.Parse(prop); + cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); std::string result = cge->Evaluate(context->Makefile, context->Config, context->Quiet, diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0a7724c..667c2a4 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6375,6 +6375,7 @@ void cmTargetInternals::AddInterfaceEntries( "$"; cmGeneratorExpression ge(&it->Backtrace); cmsys::auto_ptr cge = ge.Parse(genex); + cge->SetEvaluateForBuildsystem(true); entries.push_back( new cmTargetInternals::TargetPropertyEntry(cge, *it)); } diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt index d4f49c2..fe202dd 100644 --- a/Tests/InterfaceLibrary/CMakeLists.txt +++ b/Tests/InterfaceLibrary/CMakeLists.txt @@ -18,8 +18,12 @@ set_property(TARGET imp::iface APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMEPRO set_property(TARGET imp::iface PROPERTY INTERFACE_SOMEPROP OFF) set_property(TARGET imp::iface PROPERTY INTERFACE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist.cpp) +add_library(objlib OBJECT obj.cpp) +add_library(iface_objlib INTERFACE) +target_sources(iface_objlib INTERFACE $) + add_executable(InterfaceLibrary definetestexe.cpp) -target_link_libraries(InterfaceLibrary iface_nodepends headeriface subiface) +target_link_libraries(InterfaceLibrary iface_nodepends headeriface subiface iface_objlib) add_subdirectory(libsdir) diff --git a/Tests/InterfaceLibrary/definetestexe.cpp b/Tests/InterfaceLibrary/definetestexe.cpp index 30f2925..9044076 100644 --- a/Tests/InterfaceLibrary/definetestexe.cpp +++ b/Tests/InterfaceLibrary/definetestexe.cpp @@ -15,9 +15,10 @@ #error Expected IFACE_HEADER_BUILDDIR #endif +extern int obj(); extern int sub(); int main(int,char**) { - return sub(); + return obj() + sub(); } diff --git a/Tests/InterfaceLibrary/obj.cpp b/Tests/InterfaceLibrary/obj.cpp new file mode 100644 index 0000000..ee6f5fe --- /dev/null +++ b/Tests/InterfaceLibrary/obj.cpp @@ -0,0 +1 @@ +int obj() { return 0; } diff --git a/Tests/RunCMake/TargetObjects/BadContext-stderr.txt b/Tests/RunCMake/TargetObjects/BadContext-stderr.txt index 92f2c91..b78189e 100644 --- a/Tests/RunCMake/TargetObjects/BadContext-stderr.txt +++ b/Tests/RunCMake/TargetObjects/BadContext-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at BadContext.cmake:2 \(file\): +(CMake Error at BadContext.cmake:4 \(file\): Error evaluating generator expression: \$ @@ -7,7 +7,17 @@ CMake Error at BadContext.cmake:2 \(file\): for consumption by CMake. It is not suitable for writing out elsewhere. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) -+ +*)+ +(CMake Error at BadContext.cmake:5 \(file\): + Error evaluating generator expression: + + \$ + + The evaluation of the TARGET_OBJECTS generator expression is only suitable + for consumption by CMake. It is not suitable for writing out elsewhere. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +*)+ CMake Error: Error evaluating generator expression: diff --git a/Tests/RunCMake/TargetObjects/BadContext.cmake b/Tests/RunCMake/TargetObjects/BadContext.cmake index 67962a4..5d7e33e 100644 --- a/Tests/RunCMake/TargetObjects/BadContext.cmake +++ b/Tests/RunCMake/TargetObjects/BadContext.cmake @@ -1,4 +1,7 @@ +add_library(iface INTERFACE) +target_sources(iface INTERFACE $) file(GENERATE OUTPUT test_output CONTENT $) +file(GENERATE OUTPUT test_output2 CONTENT $) install(FILES $ DESTINATION objects) ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 09:12:52 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 09:12:52 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4192-g6d39a8c Message-ID: <20140714131252.239593F010@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 6d39a8c3e6919743e63e332ff7c6f4aa4dcbbee2 (commit) via ac4a1c4667d99e2457409e5219ce7ce69f500772 (commit) from 63675f1f5f6584ab45ae5fb55e23a49a7fb2f7c2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6d39a8c3e6919743e63e332ff7c6f4aa4dcbbee2 commit 6d39a8c3e6919743e63e332ff7c6f4aa4dcbbee2 Merge: 63675f1 ac4a1c4 Author: Brad King AuthorDate: Mon Jul 14 09:12:51 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 09:12:51 2014 -0400 Merge topic 'FindCurses-overhaul' into next ac4a1c46 Revert "FindCurses: Overhaul Curses and NCurses search logic" http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ac4a1c4667d99e2457409e5219ce7ce69f500772 commit ac4a1c4667d99e2457409e5219ce7ce69f500772 Author: Brad King AuthorDate: Mon Jul 14 09:12:43 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 09:13:59 2014 -0400 Revert "FindCurses: Overhaul Curses and NCurses search logic" This reverts commit fcca1eb90e6d1383e27ceb30c03b739ea30fe180. The NCurses headers expect to include each other as "ncurses/...". diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index 5c61090..6b8b196 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -2,46 +2,28 @@ # FindCurses # ---------- # -# Find the curses or ncurses include file and library. +# Find the curses include file and library # -# Result Variables -# ^^^^^^^^^^^^^^^^ # -# This module defines the following variables: # -# ``CURSES_FOUND`` -# True if Curses is found. -# ``CURSES_INCLUDE_DIRS`` -# The include directories needed to use Curses. -# ``CURSES_LIBRARIES`` -# The libraries needed to use Curses. -# ``CURSES_HAVE_CURSES_H`` -# True if curses.h is available. -# ``CURSES_HAVE_NCURSES_H`` -# True if ncurses.h is available. +# :: # -# Set ``CURSES_NEED_NCURSES`` to ``TRUE`` before the -# ``find_package(Curses)`` call if NCurses functionality is required. +# CURSES_FOUND - system has Curses +# CURSES_INCLUDE_DIR - the Curses include directory +# CURSES_LIBRARIES - The libraries needed to use Curses +# CURSES_HAVE_CURSES_H - true if curses.h is available +# CURSES_HAVE_NCURSES_H - true if ncurses.h is available +# CURSES_HAVE_NCURSES_NCURSES_H - true if ncurses/ncurses.h is available +# CURSES_HAVE_NCURSES_CURSES_H - true if ncurses/curses.h is available +# CURSES_LIBRARY - set for backwards compatibility with 2.4 CMake # -# Backward Compatibility -# ^^^^^^^^^^^^^^^^^^^^^^ # -# The following variable are provided for backward compatibility: # -# ``CURSES_HAVE_NCURSES_NCURSES_H`` -# Always false. Used to be true if ``ncurses/ncurses.h`` is available. -# ``CURSES_HAVE_NCURSES_CURSES_H`` -# Always false. Used to be true if ``ncurses/curses.h`` is available. -# ``CURSES_INCLUDE_DIR`` -# Path to Curses include. Use ``CURSES_INCLUDE_DIRS`` instead. -# ``CURSES_LIBRARY`` -# Path to Curses library. Use ``CURSES_LIBRARIES`` instead. -# -# Currently if the headers are in a ``ncurses/`` directory the -# path(s) in ``CURSES_INCLUDE_DIRS`` will simply point at that. +# Set CURSES_NEED_NCURSES to TRUE before the find_package() command if +# NCurses functionality is required. #============================================================================= -# Copyright 2001-2014 Kitware, Inc. +# Copyright 2001-2009 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -102,38 +84,61 @@ if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES) endif() -if(CURSES_USE_NCURSES) + +if(NOT CURSES_USE_NCURSES) + find_file(CURSES_HAVE_CURSES_H curses.h ) + find_path(CURSES_CURSES_H_PATH curses.h ) + get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH) + get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) + + # for compatibility with older FindCurses.cmake this has to be in the cache + # FORCE must not be used since this would break builds which preload a cache wqith these variables set + set(CURSES_INCLUDE_PATH "${CURSES_CURSES_H_PATH}" + CACHE FILEPATH "The curses include path") + set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}" + CACHE FILEPATH "The curses library") +else() +# we need to find ncurses get_filename_component(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH) get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) - # Use CURSES_NCURSES_INCLUDE_PATH if set, for compatibility. - if(CURSES_NCURSES_INCLUDE_PATH) - find_path(CURSES_INCLUDE_PATH - NAMES ncurses.h curses.h - PATHS ${CURSES_NCURSES_INCLUDE_PATH} - NO_DEFAULT_PATH - ) + find_file(CURSES_HAVE_NCURSES_H ncurses.h) + find_file(CURSES_HAVE_NCURSES_NCURSES_H ncurses/ncurses.h) + find_file(CURSES_HAVE_NCURSES_CURSES_H ncurses/curses.h) + find_file(CURSES_HAVE_CURSES_H curses.h + HINTS "${_cursesParentDir}/include") + + find_path(CURSES_NCURSES_INCLUDE_PATH ncurses.h ncurses/ncurses.h + ncurses/curses.h) + find_path(CURSES_NCURSES_INCLUDE_PATH curses.h + HINTS "${_cursesParentDir}/include") + + # for compatibility with older FindCurses.cmake this has to be in the cache + # FORCE must not be used since this would break builds which preload + # however if the value of the variable has NOTFOUND in it, then + # it is OK to force, and we need to force in order to have it work. + # a cache wqith these variables set + # only put ncurses include and library into + # variables if they are found + if(NOT CURSES_NCURSES_INCLUDE_PATH AND CURSES_HAVE_NCURSES_NCURSES_H) + get_filename_component(CURSES_NCURSES_INCLUDE_PATH + "${CURSES_HAVE_NCURSES_NCURSES_H}" PATH) endif() - - find_path(CURSES_INCLUDE_PATH - NAMES ncurses.h curses.h - HINTS "${_cursesParentDir}/include" - PATH_SUFFIXES ncurses - ) - - # Previous versions of FindCurses provided these values. - if(NOT DEFINED CURSES_LIBRARY) - set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}") + if(CURSES_NCURSES_INCLUDE_PATH AND CURSES_NCURSES_LIBRARY) + set( FORCE_IT ) + if(CURSES_INCLUDE_PATH MATCHES NOTFOUND) + set(FORCE_IT FORCE) + endif() + set(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}" + CACHE FILEPATH "The curses include path" ${FORCE_IT}) + set( FORCE_IT) + if(CURSES_LIBRARY MATCHES NOTFOUND) + set(FORCE_IT FORCE) + endif() + set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}" + CACHE FILEPATH "The curses library" ${FORCE_IT}) endif() - # Previous versions of FindCurses also looked for ncurses/ncurses.h - # and told projects to #include instead of just - # #include . Now we just report the include/ncurses - # directory instead, so just pretend that ncurses/ncurses.h is - # never available. - set(CURSES_HAVE_NCURSES_NCURSES_H "CURSES_HAVE_NCURSES_NCURSES_H-NOTFOUND") - set(CURSES_HAVE_NCURSES_CURSES_H "CURSES_HAVE_NCURSES_CURSES_H-NOTFOUND") - CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" cbreak "" CURSES_NCURSES_HAS_CBREAK) if(NOT CURSES_NCURSES_HAS_CBREAK) @@ -142,39 +147,6 @@ if(CURSES_USE_NCURSES) CHECK_LIBRARY_EXISTS("${CURSES_EXTRA_LIBRARY}" cbreak "" CURSES_TINFO_HAS_CBREAK) endif() -else() - get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH) - get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) - - find_path(CURSES_INCLUDE_PATH - NAMES curses.h - HINTS "${_cursesParentDir}/include" - ) - - # Previous versions of FindCurses provided these values. - if(NOT DEFINED CURSES_CURSES_H_PATH) - set(CURSES_CURSES_H_PATH "${CURSES_INCLUDE_PATH}") - endif() - if(NOT DEFINED CURSES_LIBRARY) - set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}") - endif() -endif() - -# Previous versions of FindCurses did a separate find_file for -# ncurses.h and curses.h. Report the results as it would have. -if(NOT DEFINED CURSES_HAVE_NCURSES_H) - if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses.h") - set(CURSES_HAVE_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses.h") - else() - set(CURSES_HAVE_NCURSES_H "CURSES_HAVE_NCURSES_H-NOTFOUND") - endif() -endif() -if(NOT DEFINED CURSES_HAVE_CURSES_H) - if(EXISTS "${CURSES_INCLUDE_PATH}/curses.h") - set(CURSES_HAVE_CURSES_H "${CURSES_INCLUDE_PATH}/curses.h") - else() - set(CURSES_HAVE_CURSES_H "CURSES_HAVE_CURSES_H-NOTFOUND") - endif() endif() if (NOT CURSES_TINFO_HAS_CBREAK) @@ -185,10 +157,11 @@ endif() find_library(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}") find_library(CURSES_FORM_LIBRARY form ) -# Previous versions of FindCurses provided these values. -if(NOT DEFINED FORM_LIBRARY) - set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}") -endif() +# for compatibility with older FindCurses.cmake this has to be in the cache +# FORCE must not be used since this would break builds which preload a cache +# qith these variables set +set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}" + CACHE FILEPATH "The curses form library") # Need to provide the *_LIBRARIES set(CURSES_LIBRARIES ${CURSES_LIBRARY}) @@ -201,9 +174,8 @@ if(CURSES_FORM_LIBRARY) set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY}) endif() -# Provide the *_INCLUDE_DIRS result. -set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_PATH}) -set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # compatibility +# Proper name is *_INCLUDE_DIR +set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # handle the QUIETLY and REQUIRED arguments and set CURSES_FOUND to TRUE if # all listed variables are TRUE @@ -213,7 +185,17 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG mark_as_advanced( CURSES_INCLUDE_PATH + CURSES_LIBRARY + CURSES_CURSES_INCLUDE_PATH CURSES_CURSES_LIBRARY + CURSES_NCURSES_INCLUDE_PATH CURSES_NCURSES_LIBRARY CURSES_EXTRA_LIBRARY + FORM_LIBRARY + CURSES_LIBRARIES + CURSES_INCLUDE_DIR + CURSES_CURSES_HAS_WSYNCUP + CURSES_NCURSES_HAS_WSYNCUP + CURSES_NCURSES_HAS_CBREAK + CURSES_TINFO_HAS_CBREAK ) ----------------------------------------------------------------------- Summary of changes: Modules/FindCurses.cmake | 176 +++++++++++++++++++++------------------------- 1 file changed, 79 insertions(+), 97 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 09:13:39 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 09:13:39 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4198-g6d8091e Message-ID: <20140714131339.7B6D63F15C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 6d8091e3c6f7889fc66cca65c863784a5ae1f2c2 (commit) via ccf2fca1fa3a6ef7209299d21cacec0309655d4f (commit) via edf94b6588ceba9196a1b5ef3a4579114bebab39 (commit) via 6ac04aee51ab3cb9c05efb6f6195bf34f9609fae (commit) via 2eadd127e9d5cad03f6a596bb01dfc682734f7b6 (commit) via c9b5e341875e7d51d94c06e3d264f020b288d26c (commit) from 6d39a8c3e6919743e63e332ff7c6f4aa4dcbbee2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6d8091e3c6f7889fc66cca65c863784a5ae1f2c2 commit 6d8091e3c6f7889fc66cca65c863784a5ae1f2c2 Merge: 6d39a8c ccf2fca Author: Brad King AuthorDate: Mon Jul 14 09:13:38 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 09:13:38 2014 -0400 Merge topic 'FindCurses-blank-at-eof' into next ccf2fca1 FindCurses: Remove blank line at end of file edf94b65 CMake Nightly Date Stamp 6ac04aee CMake Nightly Date Stamp 2eadd127 CMake Nightly Date Stamp c9b5e341 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ccf2fca1fa3a6ef7209299d21cacec0309655d4f commit ccf2fca1fa3a6ef7209299d21cacec0309655d4f Author: Brad King AuthorDate: Mon Jul 14 09:14:49 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 09:14:49 2014 -0400 FindCurses: Remove blank line at end of file diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index 9b633c7..6b8b196 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -199,4 +199,3 @@ mark_as_advanced( CURSES_NCURSES_HAS_CBREAK CURSES_TINFO_HAS_CBREAK ) - ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 09:28:54 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 09:28:54 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4200-g3904f16 Message-ID: <20140714132854.D32E640272@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 3904f162d52c8a146f05be144149078e2a7458b5 (commit) via cb6551ea9ae1f2e2c109ff63e26d6986186616e3 (commit) from 6d8091e3c6f7889fc66cca65c863784a5ae1f2c2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3904f162d52c8a146f05be144149078e2a7458b5 commit 3904f162d52c8a146f05be144149078e2a7458b5 Merge: 6d8091e cb6551e Author: Brad King AuthorDate: Mon Jul 14 09:28:54 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 09:28:54 2014 -0400 Merge topic 'doc-CMAKE_LANG_PLATFORM_ID' into next cb6551ea Revert "Help: Document possible values of CMAKE__PLATFORM_ID (#15012)" http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cb6551ea9ae1f2e2c109ff63e26d6986186616e3 commit cb6551ea9ae1f2e2c109ff63e26d6986186616e3 Author: Brad King AuthorDate: Mon Jul 14 09:29:36 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 09:29:36 2014 -0400 Revert "Help: Document possible values of CMAKE__PLATFORM_ID (#15012)" This reverts commit d2f68588caba8f9df5756fc5c52d6e54d2caa6a5. This variable is still supposed to be internal. CMAKE_SYSTEM_NAME is the public one. diff --git a/Help/variable/CMAKE_LANG_PLATFORM_ID.rst b/Help/variable/CMAKE_LANG_PLATFORM_ID.rst index f50e480..1b243e3 100644 --- a/Help/variable/CMAKE_LANG_PLATFORM_ID.rst +++ b/Help/variable/CMAKE_LANG_PLATFORM_ID.rst @@ -1,40 +1,6 @@ CMAKE__PLATFORM_ID ------------------------ -Platform identification string. +An internal variable subject to change. -A short string unique to the platform. Possible values include: - -:: - - AIX - BSDOS - BeOS - Cygwin - DOS - Darwin - FreeBSD - HP-UX - Haiku - IRIX - Linux - MP-RAS - MinGW - NetBSD - OS2 - OSF1 - OpenBSD - QNX - RISCos - SCO_SV - SINIX - SunOS - Tru64 - ULTRIX - UNIX_SV - Windows - Windows3x - Xenix - -This variable is not guaranteed to be defined for all platforms. -An empty string represents an unknown platform. +This is used in determining the platform and is subject to change. diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index f182d46..bc26c07 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -1,5 +1,4 @@ -/* Identify known platforms by name. If you add a platform here, also - document it in "Help/variable/CMAKE_LANG_PLATFORM_ID.rst". */ +/* Identify known platforms by name. */ #if defined(__linux) || defined(__linux__) || defined(linux) # define PLATFORM_ID "Linux" ----------------------------------------------------------------------- Summary of changes: Help/variable/CMAKE_LANG_PLATFORM_ID.rst | 38 ++---------------------------- Modules/CMakePlatformId.h.in | 3 +-- 2 files changed, 3 insertions(+), 38 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 09:33:54 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 09:33:54 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4202-g26d8dc8 Message-ID: <20140714133354.C8781405AA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 26d8dc89e1560a71bb8ac90882aca8553e44bcb4 (commit) via 6444f8be084d4c7b52230a89b16fe5a218349978 (commit) from 3904f162d52c8a146f05be144149078e2a7458b5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=26d8dc89e1560a71bb8ac90882aca8553e44bcb4 commit 26d8dc89e1560a71bb8ac90882aca8553e44bcb4 Merge: 3904f16 6444f8b Author: Brad King AuthorDate: Mon Jul 14 09:33:54 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 09:33:54 2014 -0400 Merge topic 'doc-genex-id-values' into next 6444f8be Help: Fix PLATFORM_ID corresponding var http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6444f8be084d4c7b52230a89b16fe5a218349978 commit 6444f8be084d4c7b52230a89b16fe5a218349978 Author: Brad King AuthorDate: Mon Jul 14 09:31:51 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 09:31:51 2014 -0400 Help: Fix PLATFORM_ID corresponding var diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 0491128..9e82674 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -117,7 +117,7 @@ than 4.2.0. Configuration name ``$`` The CMake-id of the platform. - See also the :variable:`CMAKE__PLATFORM_ID` variable. + See also the :variable:`CMAKE_SYSTEM_NAME` variable. ``$`` The CMake-id of the C compiler used. See also the :variable:`CMAKE__COMPILER_ID` variable. ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 09:34:34 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 09:34:34 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4204-gc67f185 Message-ID: <20140714133434.AC383405D7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via c67f1851d6c393061f6ffde3322a216ac93ea4fb (commit) via 5690a963e92f4b5d04b348bb3b2cefe6a9cfec9a (commit) from 26d8dc89e1560a71bb8ac90882aca8553e44bcb4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c67f1851d6c393061f6ffde3322a216ac93ea4fb commit c67f1851d6c393061f6ffde3322a216ac93ea4fb Merge: 26d8dc8 5690a96 Author: Brad King AuthorDate: Mon Jul 14 09:34:34 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 09:34:34 2014 -0400 Merge topic 'doc-genex-id-values' into next 5690a963 Help: Link to variables corresponding to id and version expressions (#15012) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5690a963e92f4b5d04b348bb3b2cefe6a9cfec9a commit 5690a963e92f4b5d04b348bb3b2cefe6a9cfec9a Author: Brad King AuthorDate: Thu Jul 10 10:51:52 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 09:35:23 2014 -0400 Help: Link to variables corresponding to id and version expressions (#15012) In the cmake-generator-expressions(7) manual, link to the variables that correspond to the PLATFORM_ID, C_COMPILER_ID, CXX_COMPILER_ID, C_COMPILER_VERSION, and CXX_COMPILER_VERSION generator expressions. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index f04702e..9e82674 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -116,15 +116,20 @@ than 4.2.0. ``$`` Configuration name ``$`` - The CMake-id of the platform + The CMake-id of the platform. + See also the :variable:`CMAKE_SYSTEM_NAME` variable. ``$`` The CMake-id of the C compiler used. + See also the :variable:`CMAKE__COMPILER_ID` variable. ``$`` The CMake-id of the CXX compiler used. + See also the :variable:`CMAKE__COMPILER_ID` variable. ``$`` The version of the C compiler used. + See also the :variable:`CMAKE__COMPILER_VERSION` variable. ``$`` The version of the CXX compiler used. + See also the :variable:`CMAKE__COMPILER_VERSION` variable. ``$`` Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a target. ``$`` ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 09:37:50 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 09:37:50 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1361-g27fb86d Message-ID: <20140714133750.5B058406C0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 27fb86d72e254802e595f9e9fb1df10cf15fcf03 (commit) via 38d3fe0785e7691d19d015b43d2bb9d6d17bbd1f (commit) from edf94b6588ceba9196a1b5ef3a4579114bebab39 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=27fb86d72e254802e595f9e9fb1df10cf15fcf03 commit 27fb86d72e254802e595f9e9fb1df10cf15fcf03 Merge: edf94b6 38d3fe0 Author: Brad King AuthorDate: Mon Jul 14 09:37:49 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 09:37:49 2014 -0400 Merge topic 'build-KWIML-always' 38d3fe07 Tests: Build and test KWIML even when testing an external CMake ----------------------------------------------------------------------- Summary of changes: CMakeLists.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 09:37:52 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 09:37:52 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1363-gcb867dc Message-ID: <20140714133752.12BD6406C8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via cb867dc4f4bb17d3fd9a5182ac8b789a9dc01818 (commit) via cfab942e5ff8463f8053564e68179da110280b43 (commit) from 27fb86d72e254802e595f9e9fb1df10cf15fcf03 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cb867dc4f4bb17d3fd9a5182ac8b789a9dc01818 commit cb867dc4f4bb17d3fd9a5182ac8b789a9dc01818 Merge: 27fb86d cfab942 Author: Brad King AuthorDate: Mon Jul 14 09:37:51 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 09:37:51 2014 -0400 Merge topic 'doc-package-target-import-once' cfab942e Help: Update cmake-packages.7 examples to import targets only once ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-packages.7.rst | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 09:37:53 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 09:37:53 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1365-g47bf22e Message-ID: <20140714133753.D0753406C2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 47bf22e121947169af53acbe89a30ff48fd2d75e (commit) via affe9d56a2e17683dc87c457c27cad7f39b0ad56 (commit) from cb867dc4f4bb17d3fd9a5182ac8b789a9dc01818 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=47bf22e121947169af53acbe89a30ff48fd2d75e commit 47bf22e121947169af53acbe89a30ff48fd2d75e Merge: cb867dc affe9d5 Author: Brad King AuthorDate: Mon Jul 14 09:37:52 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 09:37:52 2014 -0400 Merge topic 'interface-sources-target-objects' affe9d56 Allow INTERFACE_SOURCES to specify $ (#14970) ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-buildsystem.7.rst | 6 ++++++ Source/cmGeneratorExpressionEvaluator.cxx | 1 + Source/cmTarget.cxx | 1 + Tests/InterfaceLibrary/CMakeLists.txt | 6 +++++- Tests/InterfaceLibrary/definetestexe.cpp | 3 ++- Tests/InterfaceLibrary/obj.cpp | 1 + Tests/RunCMake/TargetObjects/BadContext-stderr.txt | 14 ++++++++++++-- Tests/RunCMake/TargetObjects/BadContext.cmake | 3 +++ 8 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 Tests/InterfaceLibrary/obj.cpp hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 09:37:55 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 09:37:55 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1367-g5fc5047 Message-ID: <20140714133755.E0EBD406CB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 5fc50479bfb13e5ed181aff9dde7aa739deada84 (commit) via a3ac67cc3f8d9b4df9c93f65db28c494c8883811 (commit) from 47bf22e121947169af53acbe89a30ff48fd2d75e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5fc50479bfb13e5ed181aff9dde7aa739deada84 commit 5fc50479bfb13e5ed181aff9dde7aa739deada84 Merge: 47bf22e a3ac67c Author: Brad King AuthorDate: Mon Jul 14 09:37:54 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 09:37:54 2014 -0400 Merge topic 'install-cfbundle-directory' a3ac67cc OS X: Install CFBundles as complete directories ----------------------------------------------------------------------- Summary of changes: Source/cmInstallTargetGenerator.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 09:37:58 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 09:37:58 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1369-g23eb0aa Message-ID: <20140714133758.097DD406D0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 23eb0aaef56bf66e6f584e82b57c7291e41667cb (commit) via 7e1283e48c54424b38444f78c983fc32a287ee80 (commit) from 5fc50479bfb13e5ed181aff9dde7aa739deada84 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=23eb0aaef56bf66e6f584e82b57c7291e41667cb commit 23eb0aaef56bf66e6f584e82b57c7291e41667cb Merge: 5fc5047 7e1283e Author: Brad King AuthorDate: Mon Jul 14 09:37:57 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 09:37:57 2014 -0400 Merge topic 'wince-fix-dll-linking' 7e1283e4 MSVC: Fix linking of DLLs on WinCE (#15013) ----------------------------------------------------------------------- Summary of changes: Modules/Platform/Windows-MSVC.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 09:38:00 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 09:38:00 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1371-gf1b33fc Message-ID: <20140714133800.111C4406C8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via f1b33fccd166c1b9b2455ed19ecab7172a93db7e (commit) via 5d8738468f3eb6f45035d1f77c23ef5fdf490af6 (commit) from 23eb0aaef56bf66e6f584e82b57c7291e41667cb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f1b33fccd166c1b9b2455ed19ecab7172a93db7e commit f1b33fccd166c1b9b2455ed19ecab7172a93db7e Merge: 23eb0aa 5d87384 Author: Brad King AuthorDate: Mon Jul 14 09:37:59 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 09:37:59 2014 -0400 Merge topic 'vs-RC-flags' 5d873846 VS: Fix handling of non-preprocessor flags in CMAKE_RC_FLAGS ----------------------------------------------------------------------- Summary of changes: Source/cmVS10RCFlagTable.h | 7 +++ Source/cmVS11RCFlagTable.h | 7 +++ Source/cmVS12RCFlagTable.h | 7 +++ Source/cmVS14RCFlagTable.h | 7 +++ Source/cmVisualStudio10TargetGenerator.cxx | 66 ++++++++++++++++++++++++++++ Source/cmVisualStudio10TargetGenerator.h | 4 ++ Source/cmVisualStudioGeneratorOptions.h | 1 + 7 files changed, 99 insertions(+) create mode 100644 Source/cmVS10RCFlagTable.h create mode 100644 Source/cmVS11RCFlagTable.h create mode 100644 Source/cmVS12RCFlagTable.h create mode 100644 Source/cmVS14RCFlagTable.h hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 09:38:01 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 09:38:01 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1373-g5ba3cbb Message-ID: <20140714133801.C2D1C406D2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 5ba3cbbd24b8ad80d63b829584666ee9a4c37f1a (commit) via f45ede61a1e5282f432b169217028c80c12c77a3 (commit) from f1b33fccd166c1b9b2455ed19ecab7172a93db7e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5ba3cbbd24b8ad80d63b829584666ee9a4c37f1a commit 5ba3cbbd24b8ad80d63b829584666ee9a4c37f1a Merge: f1b33fc f45ede6 Author: Brad King AuthorDate: Mon Jul 14 09:38:00 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 09:38:00 2014 -0400 Merge topic 'refactor-link-internals' f45ede61 cmTarget: Fix CMP0022 OLD breakage from recent refactoring ----------------------------------------------------------------------- Summary of changes: Source/cmTarget.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 09:38:03 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 09:38:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1375-g9124ec1 Message-ID: <20140714133803.60E68406D2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 9124ec1c94fcfc68eb06a27a0c0cbd70360bd4a9 (commit) via 5690a963e92f4b5d04b348bb3b2cefe6a9cfec9a (commit) from 5ba3cbbd24b8ad80d63b829584666ee9a4c37f1a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9124ec1c94fcfc68eb06a27a0c0cbd70360bd4a9 commit 9124ec1c94fcfc68eb06a27a0c0cbd70360bd4a9 Merge: 5ba3cbb 5690a96 Author: Brad King AuthorDate: Mon Jul 14 09:38:02 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 09:38:02 2014 -0400 Merge topic 'doc-genex-id-values' 5690a963 Help: Link to variables corresponding to id and version expressions (#15012) ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 09:40:49 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 09:40:49 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4213-g1378f48 Message-ID: <20140714134049.E03343EF43@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 1378f485a15ff8bc99a483f4f3fbfff48bcacdae (commit) via 9124ec1c94fcfc68eb06a27a0c0cbd70360bd4a9 (commit) via 5ba3cbbd24b8ad80d63b829584666ee9a4c37f1a (commit) via f1b33fccd166c1b9b2455ed19ecab7172a93db7e (commit) via 23eb0aaef56bf66e6f584e82b57c7291e41667cb (commit) via 5fc50479bfb13e5ed181aff9dde7aa739deada84 (commit) via 47bf22e121947169af53acbe89a30ff48fd2d75e (commit) via cb867dc4f4bb17d3fd9a5182ac8b789a9dc01818 (commit) via 27fb86d72e254802e595f9e9fb1df10cf15fcf03 (commit) from c67f1851d6c393061f6ffde3322a216ac93ea4fb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1378f485a15ff8bc99a483f4f3fbfff48bcacdae commit 1378f485a15ff8bc99a483f4f3fbfff48bcacdae Merge: c67f185 9124ec1 Author: Brad King AuthorDate: Mon Jul 14 09:41:54 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 09:41:54 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 09:42:41 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 09:42:41 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1377-gc72642f Message-ID: <20140714134241.2EDDD3F20B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c72642f927e65e66f602406380349f928a961e77 (commit) via ccf2fca1fa3a6ef7209299d21cacec0309655d4f (commit) from 9124ec1c94fcfc68eb06a27a0c0cbd70360bd4a9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c72642f927e65e66f602406380349f928a961e77 commit c72642f927e65e66f602406380349f928a961e77 Merge: 9124ec1 ccf2fca Author: Brad King AuthorDate: Mon Jul 14 09:42:40 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 09:42:40 2014 -0400 Merge topic 'FindCurses-blank-at-eof' ccf2fca1 FindCurses: Remove blank line at end of file ----------------------------------------------------------------------- Summary of changes: Modules/FindCurses.cmake | 1 - 1 file changed, 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 09:43:02 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 09:43:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4215-ga159995 Message-ID: <20140714134302.EEBB33F26D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via a159995cc1af2563601fe840e85ab875ea347a37 (commit) via c72642f927e65e66f602406380349f928a961e77 (commit) from 1378f485a15ff8bc99a483f4f3fbfff48bcacdae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a159995cc1af2563601fe840e85ab875ea347a37 commit a159995cc1af2563601fe840e85ab875ea347a37 Merge: 1378f48 c72642f Author: Brad King AuthorDate: Mon Jul 14 09:44:11 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 09:44:11 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 10:02:14 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 10:02:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4223-g3219a61 Message-ID: <20140714140214.575E3404A2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 3219a6127fc6fbcaac53cbe224e7eb6681818471 (commit) via 102eea60cd636e06ab87bc94a4b326682d7464f1 (commit) via b0f57408512b194923b6c9e5e79a08bc324c552e (commit) via c69e8a5580bd034dcaa1d7d53976200600b26b82 (commit) via 4db3990e9f3c11add85cba339b7a976f6f0fd3c5 (commit) via 4b8130b8de223674d567bdff5e156b1bdc1d5c27 (commit) via 4c763dd1f1c922606660e275372cc6313ac42535 (commit) via 190cabe7c1641482529bba34d46a38e4e33a2384 (commit) from a159995cc1af2563601fe840e85ab875ea347a37 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3219a6127fc6fbcaac53cbe224e7eb6681818471 commit 3219a6127fc6fbcaac53cbe224e7eb6681818471 Merge: a159995 102eea6 Author: Brad King AuthorDate: Mon Jul 14 10:02:13 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 10:02:13 2014 -0400 Merge topic 'refactor-link-internals' into next 102eea60 cmTarget: Simplify internal ComputeLinkInterfaceLibraries method b0f57408 cmTarget: Move ComputeLinkInterfaceLibraries to internals c69e8a55 cmTarget: Refactor internal LinkInterface map 4db3990e cmTarget: Drop 'head' argument from processSources 4b8130b8 cmTarget: Drop 'head' argument from GetSourceFiles 4c763dd1 cmTarget: Drop 'head' argument from GetLanguages 190cabe7 cmTarget: Drop 'head' argument from ComputeLinkImplementationLanguages http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=102eea60cd636e06ab87bc94a4b326682d7464f1 commit 102eea60cd636e06ab87bc94a4b326682d7464f1 Author: Brad King AuthorDate: Thu Jul 10 17:15:39 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 10:00:51 2014 -0400 cmTarget: Simplify internal ComputeLinkInterfaceLibraries method Now that the method can see the full OptionalLinkInterface structure, store information there instead of passing it through arguments. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 663b15e..826a44b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -122,14 +122,12 @@ public: void ComputeLinkInterface(cmTarget const* thisTarget, const std::string& config, OptionalLinkInterface& iface, - cmTarget const* head, - const char *explicitLibraries) const; - const char* ComputeLinkInterfaceLibraries(cmTarget const* thisTarget, - const std::string& config, - OptionalLinkInterface& iface, - cmTarget const* head, - bool usage_requirements_only, - bool &exists); + cmTarget const* head) const; + void ComputeLinkInterfaceLibraries(cmTarget const* thisTarget, + const std::string& config, + OptionalLinkInterface& iface, + cmTarget const* head, + bool usage_requirements_only); typedef std::map LinkInterfaceMapType; @@ -5908,17 +5906,15 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface( if(!iface.LibrariesDone) { iface.LibrariesDone = true; - iface.ExplicitLibraries = - this->Internal->ComputeLinkInterfaceLibraries( - this, config, iface, head, false, iface.Exists); + this->Internal->ComputeLinkInterfaceLibraries( + this, config, iface, head, false); } if(!iface.AllDone) { iface.AllDone = true; if(iface.Exists) { - this->Internal->ComputeLinkInterface(this, config, iface, - head, iface.ExplicitLibraries); + this->Internal->ComputeLinkInterface(this, config, iface, head); } } @@ -5956,9 +5952,8 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config, if(!iface.LibrariesDone) { iface.LibrariesDone = true; - iface.ExplicitLibraries = - this->Internal->ComputeLinkInterfaceLibraries( - this, config, iface, head, usage_requirements_only, iface.Exists); + this->Internal->ComputeLinkInterfaceLibraries( + this, config, iface, head, usage_requirements_only); } return iface.Exists? &iface : 0; @@ -6081,14 +6076,13 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, } //---------------------------------------------------------------------------- -const char* +void cmTargetInternals::ComputeLinkInterfaceLibraries( cmTarget const* thisTarget, const std::string& config, OptionalLinkInterface& iface, cmTarget const* headTarget, - bool usage_requirements_only, - bool &exists) + bool usage_requirements_only) { // Construct the property name suffix for this configuration. std::string suffix = "_"; @@ -6165,10 +6159,10 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( (thisTarget->GetType() == cmTarget::EXECUTABLE || (thisTarget->GetType() == cmTarget::MODULE_LIBRARY))) { - exists = false; - return 0; + return; } - exists = true; + iface.Exists = true; + iface.ExplicitLibraries = explicitLibraries; if(explicitLibraries) { @@ -6247,17 +6241,15 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( } } } - return explicitLibraries; } //---------------------------------------------------------------------------- void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, const std::string& config, OptionalLinkInterface& iface, - cmTarget const* headTarget, - const char* explicitLibraries) const + cmTarget const* headTarget) const { - if(explicitLibraries) + if(iface.ExplicitLibraries) { if(thisTarget->GetType() == cmTarget::SHARED_LIBRARY || thisTarget->GetType() == cmTarget::STATIC_LIBRARY http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b0f57408512b194923b6c9e5e79a08bc324c552e commit b0f57408512b194923b6c9e5e79a08bc324c552e Author: Brad King AuthorDate: Thu Jul 10 17:05:35 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 09:55:52 2014 -0400 cmTarget: Move ComputeLinkInterfaceLibraries to internals There are no external callers, and this will allow the method to see the full OptionalLinkInterface internal structure. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 3361a81..663b15e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -124,6 +124,12 @@ public: OptionalLinkInterface& iface, cmTarget const* head, const char *explicitLibraries) const; + const char* ComputeLinkInterfaceLibraries(cmTarget const* thisTarget, + const std::string& config, + OptionalLinkInterface& iface, + cmTarget const* head, + bool usage_requirements_only, + bool &exists); typedef std::map LinkInterfaceMapType; @@ -5903,8 +5909,8 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface( { iface.LibrariesDone = true; iface.ExplicitLibraries = - this->ComputeLinkInterfaceLibraries(config, iface, head, false, - iface.Exists); + this->Internal->ComputeLinkInterfaceLibraries( + this, config, iface, head, false, iface.Exists); } if(!iface.AllDone) { @@ -5951,9 +5957,8 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config, { iface.LibrariesDone = true; iface.ExplicitLibraries = - this->ComputeLinkInterfaceLibraries(config, iface, head, - usage_requirements_only, - iface.Exists); + this->Internal->ComputeLinkInterfaceLibraries( + this, config, iface, head, usage_requirements_only, iface.Exists); } return iface.Exists? &iface : 0; @@ -6076,11 +6081,14 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, } //---------------------------------------------------------------------------- -const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, - LinkInterface& iface, - cmTarget const* headTarget, - bool usage_requirements_only, - bool &exists) const +const char* +cmTargetInternals::ComputeLinkInterfaceLibraries( + cmTarget const* thisTarget, + const std::string& config, + OptionalLinkInterface& iface, + cmTarget const* headTarget, + bool usage_requirements_only, + bool &exists) { // Construct the property name suffix for this configuration. std::string suffix = "_"; @@ -6097,15 +6105,15 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, // libraries and executables that export symbols. const char* explicitLibraries = 0; std::string linkIfaceProp; - if(this->PolicyStatusCMP0022 != cmPolicies::OLD && - this->PolicyStatusCMP0022 != cmPolicies::WARN) + if(thisTarget->PolicyStatusCMP0022 != cmPolicies::OLD && + thisTarget->PolicyStatusCMP0022 != cmPolicies::WARN) { // CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES. linkIfaceProp = "INTERFACE_LINK_LIBRARIES"; - explicitLibraries = this->GetProperty(linkIfaceProp); + explicitLibraries = thisTarget->GetProperty(linkIfaceProp); } - else if(this->GetType() == cmTarget::SHARED_LIBRARY || - this->IsExecutableWithExports()) + else if(thisTarget->GetType() == cmTarget::SHARED_LIBRARY || + thisTarget->IsExecutableWithExports()) { // CMP0022 OLD behavior is to use LINK_INTERFACE_LIBRARIES if set on a // shared lib or executable. @@ -6113,31 +6121,32 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, // Lookup the per-configuration property. linkIfaceProp = "LINK_INTERFACE_LIBRARIES"; linkIfaceProp += suffix; - explicitLibraries = this->GetProperty(linkIfaceProp); + explicitLibraries = thisTarget->GetProperty(linkIfaceProp); // If not set, try the generic property. if(!explicitLibraries) { linkIfaceProp = "LINK_INTERFACE_LIBRARIES"; - explicitLibraries = this->GetProperty(linkIfaceProp); + explicitLibraries = thisTarget->GetProperty(linkIfaceProp); } } - if(explicitLibraries && this->PolicyStatusCMP0022 == cmPolicies::WARN && - !this->Internal->PolicyWarnedCMP0022) + if(explicitLibraries && + thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN && + !this->PolicyWarnedCMP0022) { // Compare the explicitly set old link interface properties to the // preferred new link interface property one and warn if different. const char* newExplicitLibraries = - this->GetProperty("INTERFACE_LINK_LIBRARIES"); + thisTarget->GetProperty("INTERFACE_LINK_LIBRARIES"); if (newExplicitLibraries && strcmp(newExplicitLibraries, explicitLibraries) != 0) { cmOStringStream w; w << - (this->Makefile->GetPolicies() + (thisTarget->Makefile->GetPolicies() ->GetPolicyWarning(cmPolicies::CMP0022)) << "\n" - "Target \"" << this->GetName() << "\" has an " + "Target \"" << thisTarget->GetName() << "\" has an " "INTERFACE_LINK_LIBRARIES property which differs from its " << linkIfaceProp << " properties." "\n" @@ -6145,16 +6154,16 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, " " << newExplicitLibraries << "\n" << linkIfaceProp << ":\n" " " << (explicitLibraries ? explicitLibraries : "(empty)") << "\n"; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); - this->Internal->PolicyWarnedCMP0022 = true; + thisTarget->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->PolicyWarnedCMP0022 = true; } } // There is no implicit link interface for executables or modules // so if none was explicitly set then there is no link interface. if(!explicitLibraries && - (this->GetType() == cmTarget::EXECUTABLE || - (this->GetType() == cmTarget::MODULE_LIBRARY))) + (thisTarget->GetType() == cmTarget::EXECUTABLE || + (thisTarget->GetType() == cmTarget::MODULE_LIBRARY))) { exists = false; return 0; @@ -6164,34 +6173,34 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, if(explicitLibraries) { // The interface libraries have been explicitly set. - this->ExpandLinkItems(linkIfaceProp, explicitLibraries, config, - headTarget, usage_requirements_only, - iface.Libraries); + thisTarget->ExpandLinkItems(linkIfaceProp, explicitLibraries, config, + headTarget, usage_requirements_only, + iface.Libraries); } - else if (this->PolicyStatusCMP0022 == cmPolicies::WARN - || this->PolicyStatusCMP0022 == cmPolicies::OLD) + else if (thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN + || thisTarget->PolicyStatusCMP0022 == cmPolicies::OLD) // If CMP0022 is NEW then the plain tll signature sets the // INTERFACE_LINK_LIBRARIES, so if we get here then the project // cleared the property explicitly and we should not fall back // to the link implementation. { // The link implementation is the default link interface. - LinkImplementation const* impl = - this->GetLinkImplementationLibrariesInternal(config, headTarget); + cmTarget::LinkImplementation const* impl = + thisTarget->GetLinkImplementationLibrariesInternal(config, headTarget); std::copy(impl->Libraries.begin(), impl->Libraries.end(), std::back_inserter(iface.Libraries)); - if(this->PolicyStatusCMP0022 == cmPolicies::WARN && - !this->Internal->PolicyWarnedCMP0022 && !usage_requirements_only) + if(thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN && + !this->PolicyWarnedCMP0022 && !usage_requirements_only) { // Compare the link implementation fallback link interface to the // preferred new link interface property and warn if different. std::vector ifaceLibs; std::string newProp = "INTERFACE_LINK_LIBRARIES"; - if(const char* newExplicitLibraries = this->GetProperty(newProp)) + if(const char* newExplicitLibraries = thisTarget->GetProperty(newProp)) { - this->ExpandLinkItems(newProp, newExplicitLibraries, config, - headTarget, usage_requirements_only, - ifaceLibs); + thisTarget->ExpandLinkItems(newProp, newExplicitLibraries, config, + headTarget, usage_requirements_only, + ifaceLibs); } if (ifaceLibs != iface.Libraries) { @@ -6220,9 +6229,9 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, cmOStringStream w; w << - (this->Makefile->GetPolicies() + (thisTarget->Makefile->GetPolicies() ->GetPolicyWarning(cmPolicies::CMP0022)) << "\n" - "Target \"" << this->GetName() << "\" has an " + "Target \"" << thisTarget->GetName() << "\" has an " "INTERFACE_LINK_LIBRARIES property. " "This should be preferred as the source of the link interface " "for this library but because CMP0022 is not set CMake is " @@ -6233,8 +6242,8 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, " " << newLibraries << "\n" "Link implementation:\n" " " << oldLibraries << "\n"; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); - this->Internal->PolicyWarnedCMP0022 = true; + thisTarget->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->PolicyWarnedCMP0022 = true; } } } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 39a0667..aa18590 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -771,12 +771,6 @@ private: GetImportLinkInterface(const std::string& config, cmTarget const* head, bool usage_requirements_only) const; - const char* ComputeLinkInterfaceLibraries(const std::string& config, - LinkInterface& iface, - cmTarget const* head, - bool usage_requirements_only, - bool &exists) const; - LinkImplementation const* GetLinkImplementationLibrariesInternal(const std::string& config, cmTarget const* head) const; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c69e8a5580bd034dcaa1d7d53976200600b26b82 commit c69e8a5580bd034dcaa1d7d53976200600b26b82 Author: Brad King AuthorDate: Thu Jul 10 16:59:16 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 09:51:51 2014 -0400 cmTarget: Refactor internal LinkInterface map Create the map entry up front and store in it boolean values indicating which pieces of the LinkInterface structure have been populated. This approach leads to shorter code that is easier to follow too. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d1938d1..3361a81 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -112,9 +112,11 @@ public: struct OptionalLinkInterface: public cmTarget::LinkInterface { OptionalLinkInterface(): - Exists(false), Complete(false), ExplicitLibraries(0) {} + LibrariesDone(false), AllDone(false), + Exists(false), ExplicitLibraries(0) {} + bool LibrariesDone; + bool AllDone; bool Exists; - bool Complete; const char* ExplicitLibraries; }; void ComputeLinkInterface(cmTarget const* thisTarget, @@ -5895,32 +5897,26 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface( // Lookup any existing link interface for this configuration. TargetConfigPair key(head, cmSystemTools::UpperCase(config)); - cmTargetInternals::LinkInterfaceMapType::iterator - i = this->Internal->LinkInterfaceMap.find(key); - if(i == this->Internal->LinkInterfaceMap.end()) + cmTargetInternals::OptionalLinkInterface& + iface = this->Internal->LinkInterfaceMap[key]; + if(!iface.LibrariesDone) { - // Compute the link interface for this configuration. - cmTargetInternals::OptionalLinkInterface iface; + iface.LibrariesDone = true; iface.ExplicitLibraries = this->ComputeLinkInterfaceLibraries(config, iface, head, false, iface.Exists); - if (iface.Exists) + } + if(!iface.AllDone) + { + iface.AllDone = true; + if(iface.Exists) { this->Internal->ComputeLinkInterface(this, config, iface, head, iface.ExplicitLibraries); } - - // Store the information for this configuration. - cmTargetInternals::LinkInterfaceMapType::value_type entry(key, iface); - i = this->Internal->LinkInterfaceMap.insert(entry).first; - } - else if(!i->second.Complete && i->second.Exists) - { - this->Internal->ComputeLinkInterface(this, config, i->second, head, - i->second.ExplicitLibraries); } - return i->second.Exists ? &i->second : 0; + return iface.Exists? &iface : 0; } //---------------------------------------------------------------------------- @@ -5950,22 +5946,17 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config, this->Internal->LinkInterfaceUsageRequirementsOnlyMap : this->Internal->LinkInterfaceMap); - cmTargetInternals::LinkInterfaceMapType::iterator i = lim.find(key); - if(i == lim.end()) + cmTargetInternals::OptionalLinkInterface& iface = lim[key]; + if(!iface.LibrariesDone) { - // Compute the link interface for this configuration. - cmTargetInternals::OptionalLinkInterface iface; + iface.LibrariesDone = true; iface.ExplicitLibraries = this->ComputeLinkInterfaceLibraries(config, iface, head, usage_requirements_only, iface.Exists); - - // Store the information for this configuration. - cmTargetInternals::LinkInterfaceMapType::value_type entry(key, iface); - i = lim.insert(entry).first; } - return i->second.Exists ? &i->second : 0; + return iface.Exists? &iface : 0; } //---------------------------------------------------------------------------- @@ -6348,7 +6339,6 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, sscanf(reps, "%u", &iface.Multiplicity); } } - iface.Complete = true; } //---------------------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4db3990e9f3c11add85cba339b7a976f6f0fd3c5 commit 4db3990e9f3c11add85cba339b7a976f6f0fd3c5 Author: Brad King AuthorDate: Thu Jul 10 16:12:05 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 09:46:53 2014 -0400 cmTarget: Drop 'head' argument from processSources No call sites need it to be anything but 'this'. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 5865c61..d1938d1 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -624,7 +624,6 @@ static bool processSources(cmTarget const* tgt, std::vector &srcs, std::set &uniqueSrcs, cmGeneratorExpressionDAGChecker *dagChecker, - cmTarget const* head, std::string const& config, bool debugSources) { cmMakefile *mf = tgt->GetMakefile(); @@ -641,7 +640,7 @@ static bool processSources(cmTarget const* tgt, cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, config, false, - head ? head : tgt, + tgt, tgt, dagChecker), entrySources); @@ -771,7 +770,6 @@ void cmTarget::GetSourceFiles(std::vector &files, files, uniqueSrcs, &dagChecker, - this, config, debugSources); @@ -788,7 +786,6 @@ void cmTarget::GetSourceFiles(std::vector &files, files, uniqueSrcs, &dagChecker, - this, config, debugSources); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4b8130b8de223674d567bdff5e156b1bdc1d5c27 commit 4b8130b8de223674d567bdff5e156b1bdc1d5c27 Author: Brad King AuthorDate: Thu Jul 10 16:07:31 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 09:46:53 2014 -0400 cmTarget: Drop 'head' argument from GetSourceFiles No call sites need it to be anything but 'this'. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e1ce4dd..5865c61 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -158,8 +158,8 @@ public: typedef std::map LinkClosureMapType; LinkClosureMapType LinkClosureMap; - typedef std::map > - SourceFilesMapType; + typedef std::map > + SourceFilesMapType; SourceFilesMapType SourceFilesMap; std::set UtilityItems; @@ -707,8 +707,7 @@ static bool processSources(cmTarget const* tgt, //---------------------------------------------------------------------------- void cmTarget::GetSourceFiles(std::vector &files, - const std::string& config, - cmTarget const* head) const + const std::string& config) const { assert(this->GetType() != INTERFACE_LIBRARY); @@ -772,7 +771,7 @@ void cmTarget::GetSourceFiles(std::vector &files, files, uniqueSrcs, &dagChecker, - head, + this, config, debugSources); @@ -789,7 +788,7 @@ void cmTarget::GetSourceFiles(std::vector &files, files, uniqueSrcs, &dagChecker, - head, + this, config, debugSources); @@ -868,12 +867,11 @@ cmTarget::GetConfigCommonSourceFiles(std::vector& files) const //---------------------------------------------------------------------------- void cmTarget::GetSourceFiles(std::vector &files, - const std::string& config, - cmTarget const* head) const + const std::string& config) const { // Lookup any existing link implementation for this configuration. - TargetConfigPair key(head, cmSystemTools::UpperCase(config)); + std::string key = cmSystemTools::UpperCase(config); if(!this->LinkImplementationLanguageIsContextDependent) { @@ -890,7 +888,7 @@ void cmTarget::GetSourceFiles(std::vector &files, else { std::vector srcs; - this->GetSourceFiles(srcs, config, head); + this->GetSourceFiles(srcs, config); std::set emitted; @@ -5422,7 +5420,7 @@ void cmTarget::GetLanguages(std::set& languages, const std::string& config) const { std::vector sourceFiles; - this->GetSourceFiles(sourceFiles, config, this); + this->GetSourceFiles(sourceFiles, config); for(std::vector::const_iterator i = sourceFiles.begin(); i != sourceFiles.end(); ++i) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index d5fb5e8..39a0667 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -161,8 +161,7 @@ public: * Get the list of the source files used by this target */ void GetSourceFiles(std::vector &files, - const std::string& config, - cmTarget const* head = 0) const; + const std::string& config) const; bool GetConfigCommonSourceFiles(std::vector& files) const; /** @@ -711,8 +710,7 @@ private: bool contentOnly) const; void GetSourceFiles(std::vector &files, - const std::string& config, - cmTarget const* head = 0) const; + const std::string& config) const; private: std::string Name; std::vector PreBuildCommands; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4c763dd1f1c922606660e275372cc6313ac42535 commit 4c763dd1f1c922606660e275372cc6313ac42535 Author: Brad King AuthorDate: Thu Jul 10 16:06:36 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 09:46:53 2014 -0400 cmTarget: Drop 'head' argument from GetLanguages No call sites need it to be anything but 'this'. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d74c66b..e1ce4dd 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -5419,11 +5419,10 @@ cmTarget::GetObjectLibrariesCMP0026(std::vector& objlibs) const //---------------------------------------------------------------------------- void cmTarget::GetLanguages(std::set& languages, - const std::string& config, - cmTarget const* head) const + const std::string& config) const { std::vector sourceFiles; - this->GetSourceFiles(sourceFiles, config, head); + this->GetSourceFiles(sourceFiles, config, this); for(std::vector::const_iterator i = sourceFiles.begin(); i != sourceFiles.end(); ++i) { @@ -5459,7 +5458,7 @@ void cmTarget::GetLanguages(std::set& languages, for(std::vector::const_iterator i = objectLibraries.begin(); i != objectLibraries.end(); ++i) { - (*i)->GetLanguages(languages, config, head); + (*i)->GetLanguages(languages, config); } } @@ -6551,7 +6550,7 @@ cmTarget::ComputeLinkImplementationLanguages(const std::string& config, // This target needs runtime libraries for its source languages. std::set languages; // Get languages used in our source files. - this->GetLanguages(languages, config, this); + this->GetLanguages(languages, config); // Copy the set of langauges to the link implementation. for(std::set::iterator li = languages.begin(); li != languages.end(); ++li) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 908e4ba..d5fb5e8 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -491,8 +491,7 @@ public: // information to forward these property changes to the targets // until we have per-target object file properties. void GetLanguages(std::set& languages, - std::string const& config, - cmTarget const* head = 0) const; + std::string const& config) const; /** Return whether this target is an executable with symbol exports enabled. */ http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=190cabe7c1641482529bba34d46a38e4e33a2384 commit 190cabe7c1641482529bba34d46a38e4e33a2384 Author: Brad King AuthorDate: Thu Jul 10 16:02:46 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 09:46:53 2014 -0400 cmTarget: Drop 'head' argument from ComputeLinkImplementationLanguages No call sites need it to be anything but 'this'. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a740bc3..d74c66b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6405,7 +6405,7 @@ cmTarget::GetLinkImplementation(const std::string& config) const if(!impl.LanguagesDone) { impl.LanguagesDone = true; - this->ComputeLinkImplementationLanguages(config, impl, this); + this->ComputeLinkImplementationLanguages(config, impl); } return &impl; } @@ -6546,13 +6546,12 @@ void cmTarget::ComputeLinkImplementation(const std::string& config, //---------------------------------------------------------------------------- void cmTarget::ComputeLinkImplementationLanguages(const std::string& config, - LinkImplementation& impl, - cmTarget const* head) const + LinkImplementation& impl) const { // This target needs runtime libraries for its source languages. std::set languages; // Get languages used in our source files. - this->GetLanguages(languages, config, head); + this->GetLanguages(languages, config, this); // Copy the set of langauges to the link implementation. for(std::set::iterator li = languages.begin(); li != languages.end(); ++li) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index dc67f1e..908e4ba 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -787,8 +787,7 @@ private: LinkImplementation& impl, cmTarget const* head) const; void ComputeLinkImplementationLanguages(const std::string& config, - LinkImplementation& impl, - cmTarget const* head) const; + LinkImplementation& impl) const; void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const; void ExpandLinkItems(std::string const& prop, std::string const& value, ----------------------------------------------------------------------- Summary of changes: Source/cmTarget.cxx | 192 +++++++++++++++++++++++---------------------------- Source/cmTarget.h | 18 ++--- 2 files changed, 92 insertions(+), 118 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 10:25:09 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 10:25:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4225-gc292fe9 Message-ID: <20140714142509.737BD40158@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via c292fe995df032426d27821514aae2f9b3e2edb7 (commit) via 1ca0c0e94ac39c895d5896b0193cbc7b963ff087 (commit) from 3219a6127fc6fbcaac53cbe224e7eb6681818471 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c292fe995df032426d27821514aae2f9b3e2edb7 commit c292fe995df032426d27821514aae2f9b3e2edb7 Merge: 3219a61 1ca0c0e Author: Brad King AuthorDate: Mon Jul 14 10:25:08 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 10:25:08 2014 -0400 Merge topic 'refactor-link-internals' into next 1ca0c0e9 cmTarget: Refactor internal imported LinkInterface map http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1ca0c0e94ac39c895d5896b0193cbc7b963ff087 commit 1ca0c0e94ac39c895d5896b0193cbc7b963ff087 Author: Brad King AuthorDate: Mon Jul 14 10:21:24 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 10:21:46 2014 -0400 cmTarget: Refactor internal imported LinkInterface map Create the map entry up front and store in it a boolean value indicating whether the LinkInterface structure has been populated. This approach leads to shorter code that is easier to follow too. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 826a44b..79be1db 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -135,7 +135,7 @@ public: LinkInterfaceMapType LinkInterfaceUsageRequirementsOnlyMap; bool PolicyWarnedCMP0022; - typedef std::map + typedef std::map ImportLinkInterfaceMapType; ImportLinkInterfaceMapType ImportLinkInterfaceMap; ImportLinkInterfaceMapType ImportLinkInterfaceUsageRequirementsOnlyMap; @@ -5977,26 +5977,21 @@ cmTarget::GetImportLinkInterface(const std::string& config, this->Internal->ImportLinkInterfaceUsageRequirementsOnlyMap : this->Internal->ImportLinkInterfaceMap); - cmTargetInternals::ImportLinkInterfaceMapType::iterator i = lim.find(key); - if(i == lim.end()) + cmTargetInternals::OptionalLinkInterface& iface = lim[key]; + if(!iface.AllDone) { - LinkInterface iface; + iface.AllDone = true; iface.Multiplicity = info->Multiplicity; cmSystemTools::ExpandListArgument(info->Languages, iface.Languages); this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config, headTarget, usage_requirements_only, iface.Libraries); - { std::vector deps; cmSystemTools::ExpandListArgument(info->SharedDeps, deps); this->LookupLinkItems(deps, iface.SharedDeps); } - cmTargetInternals::ImportLinkInterfaceMapType::value_type - entry(key, iface); - i = lim.insert(entry).first; - } - return &i->second; + return &iface; } //---------------------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/cmTarget.cxx | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 11:25:42 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 11:25:42 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4227-gb16ffbd Message-ID: <20140714152542.87AA54039B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via b16ffbd22ca372c99c1e538e0e0e0f9cbf6026ae (commit) via 6c8364e6cbda7e890eb185b4ca327286ba63e1fb (commit) from c292fe995df032426d27821514aae2f9b3e2edb7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b16ffbd22ca372c99c1e538e0e0e0f9cbf6026ae commit b16ffbd22ca372c99c1e538e0e0e0f9cbf6026ae Merge: c292fe9 6c8364e Author: Brad King AuthorDate: Mon Jul 14 11:25:41 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 11:25:41 2014 -0400 Merge topic 'FindCurses-overhaul' into next 6c8364e6 FindCurses: Overhaul Curses and NCurses search logic (#15011) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6c8364e6cbda7e890eb185b4ca327286ba63e1fb commit 6c8364e6cbda7e890eb185b4ca327286ba63e1fb Author: Brad King AuthorDate: Mon Jul 14 11:20:51 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 11:23:02 2014 -0400 FindCurses: Overhaul Curses and NCurses search logic (#15011) Produce a more consistent result by finding only a single include directory and reporting which headers may be included from it. The previous search for each header separately might find pieces from separate and incompatible packages. While at it, provide the CURSES_INCLUDE_DIRS result variable to be consistent with other modules. diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index 6b8b196..0184c39 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -2,28 +2,43 @@ # FindCurses # ---------- # -# Find the curses include file and library +# Find the curses or ncurses include file and library. # +# Result Variables +# ^^^^^^^^^^^^^^^^ # +# This module defines the following variables: # -# :: +# ``CURSES_FOUND`` +# True if Curses is found. +# ``CURSES_INCLUDE_DIRS`` +# The include directories needed to use Curses. +# ``CURSES_LIBRARIES`` +# The libraries needed to use Curses. +# ``CURSES_HAVE_CURSES_H`` +# True if curses.h is available. +# ``CURSES_HAVE_NCURSES_H`` +# True if ncurses.h is available. +# ``CURSES_HAVE_NCURSES_NCURSES_H`` +# True if ``ncurses/ncurses.h`` is available. +# ``CURSES_HAVE_NCURSES_CURSES_H`` +# True if ``ncurses/curses.h`` is available. # -# CURSES_FOUND - system has Curses -# CURSES_INCLUDE_DIR - the Curses include directory -# CURSES_LIBRARIES - The libraries needed to use Curses -# CURSES_HAVE_CURSES_H - true if curses.h is available -# CURSES_HAVE_NCURSES_H - true if ncurses.h is available -# CURSES_HAVE_NCURSES_NCURSES_H - true if ncurses/ncurses.h is available -# CURSES_HAVE_NCURSES_CURSES_H - true if ncurses/curses.h is available -# CURSES_LIBRARY - set for backwards compatibility with 2.4 CMake +# Set ``CURSES_NEED_NCURSES`` to ``TRUE`` before the +# ``find_package(Curses)`` call if NCurses functionality is required. # +# Backward Compatibility +# ^^^^^^^^^^^^^^^^^^^^^^ # +# The following variable are provided for backward compatibility: # -# Set CURSES_NEED_NCURSES to TRUE before the find_package() command if -# NCurses functionality is required. +# ``CURSES_INCLUDE_DIR`` +# Path to Curses include. Use ``CURSES_INCLUDE_DIRS`` instead. +# ``CURSES_LIBRARY`` +# Path to Curses library. Use ``CURSES_LIBRARIES`` instead. #============================================================================= -# Copyright 2001-2009 Kitware, Inc. +# Copyright 2001-2014 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -84,59 +99,27 @@ if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES) endif() - -if(NOT CURSES_USE_NCURSES) - find_file(CURSES_HAVE_CURSES_H curses.h ) - find_path(CURSES_CURSES_H_PATH curses.h ) - get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH) - get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) - - # for compatibility with older FindCurses.cmake this has to be in the cache - # FORCE must not be used since this would break builds which preload a cache wqith these variables set - set(CURSES_INCLUDE_PATH "${CURSES_CURSES_H_PATH}" - CACHE FILEPATH "The curses include path") - set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}" - CACHE FILEPATH "The curses library") -else() -# we need to find ncurses +if(CURSES_USE_NCURSES) get_filename_component(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH) get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) - find_file(CURSES_HAVE_NCURSES_H ncurses.h) - find_file(CURSES_HAVE_NCURSES_NCURSES_H ncurses/ncurses.h) - find_file(CURSES_HAVE_NCURSES_CURSES_H ncurses/curses.h) - find_file(CURSES_HAVE_CURSES_H curses.h - HINTS "${_cursesParentDir}/include") - - find_path(CURSES_NCURSES_INCLUDE_PATH ncurses.h ncurses/ncurses.h - ncurses/curses.h) - find_path(CURSES_NCURSES_INCLUDE_PATH curses.h - HINTS "${_cursesParentDir}/include") - - # for compatibility with older FindCurses.cmake this has to be in the cache - # FORCE must not be used since this would break builds which preload - # however if the value of the variable has NOTFOUND in it, then - # it is OK to force, and we need to force in order to have it work. - # a cache wqith these variables set - # only put ncurses include and library into - # variables if they are found - if(NOT CURSES_NCURSES_INCLUDE_PATH AND CURSES_HAVE_NCURSES_NCURSES_H) - get_filename_component(CURSES_NCURSES_INCLUDE_PATH - "${CURSES_HAVE_NCURSES_NCURSES_H}" PATH) + # Use CURSES_NCURSES_INCLUDE_PATH if set, for compatibility. + if(CURSES_NCURSES_INCLUDE_PATH) + find_path(CURSES_INCLUDE_PATH + NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h + PATHS ${CURSES_NCURSES_INCLUDE_PATH} + NO_DEFAULT_PATH + ) endif() - if(CURSES_NCURSES_INCLUDE_PATH AND CURSES_NCURSES_LIBRARY) - set( FORCE_IT ) - if(CURSES_INCLUDE_PATH MATCHES NOTFOUND) - set(FORCE_IT FORCE) - endif() - set(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}" - CACHE FILEPATH "The curses include path" ${FORCE_IT}) - set( FORCE_IT) - if(CURSES_LIBRARY MATCHES NOTFOUND) - set(FORCE_IT FORCE) - endif() - set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}" - CACHE FILEPATH "The curses library" ${FORCE_IT}) + + find_path(CURSES_INCLUDE_PATH + NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h + HINTS "${_cursesParentDir}/include" + ) + + # Previous versions of FindCurses provided these values. + if(NOT DEFINED CURSES_LIBRARY) + set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}") endif() CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" @@ -147,6 +130,52 @@ else() CHECK_LIBRARY_EXISTS("${CURSES_EXTRA_LIBRARY}" cbreak "" CURSES_TINFO_HAS_CBREAK) endif() +else() + get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH) + get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) + + find_path(CURSES_INCLUDE_PATH + NAMES curses.h + HINTS "${_cursesParentDir}/include" + ) + + # Previous versions of FindCurses provided these values. + if(NOT DEFINED CURSES_CURSES_H_PATH) + set(CURSES_CURSES_H_PATH "${CURSES_INCLUDE_PATH}") + endif() + if(NOT DEFINED CURSES_LIBRARY) + set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}") + endif() +endif() + +# Report whether each possible header name exists in the include directory. +if(NOT DEFINED CURSES_HAVE_NCURSES_NCURSES_H) + if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h") + set(CURSES_HAVE_NCURSES_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h") + else() + set(CURSES_HAVE_NCURSES_NCURSES_H "CURSES_HAVE_NCURSES_NCURSES_H-NOTFOUND") + endif() +endif() +if(NOT DEFINED CURSES_HAVE_NCURSES_CURSES_H) + if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/curses.h") + set(CURSES_HAVE_NCURSES_CURSES_H "${CURSES_INCLUDE_PATH}/ncurses/curses.h") + else() + set(CURSES_HAVE_NCURSES_CURSES_H "CURSES_HAVE_NCURSES_CURSES_H-NOTFOUND") + endif() +endif() +if(NOT DEFINED CURSES_HAVE_NCURSES_H) + if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses.h") + set(CURSES_HAVE_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses.h") + else() + set(CURSES_HAVE_NCURSES_H "CURSES_HAVE_NCURSES_H-NOTFOUND") + endif() +endif() +if(NOT DEFINED CURSES_HAVE_CURSES_H) + if(EXISTS "${CURSES_INCLUDE_PATH}/curses.h") + set(CURSES_HAVE_CURSES_H "${CURSES_INCLUDE_PATH}/curses.h") + else() + set(CURSES_HAVE_CURSES_H "CURSES_HAVE_CURSES_H-NOTFOUND") + endif() endif() if (NOT CURSES_TINFO_HAS_CBREAK) @@ -157,11 +186,10 @@ endif() find_library(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}") find_library(CURSES_FORM_LIBRARY form ) -# for compatibility with older FindCurses.cmake this has to be in the cache -# FORCE must not be used since this would break builds which preload a cache -# qith these variables set -set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}" - CACHE FILEPATH "The curses form library") +# Previous versions of FindCurses provided these values. +if(NOT DEFINED FORM_LIBRARY) + set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}") +endif() # Need to provide the *_LIBRARIES set(CURSES_LIBRARIES ${CURSES_LIBRARY}) @@ -174,8 +202,9 @@ if(CURSES_FORM_LIBRARY) set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY}) endif() -# Proper name is *_INCLUDE_DIR -set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) +# Provide the *_INCLUDE_DIRS result. +set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_PATH}) +set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # compatibility # handle the QUIETLY and REQUIRED arguments and set CURSES_FOUND to TRUE if # all listed variables are TRUE @@ -185,17 +214,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG mark_as_advanced( CURSES_INCLUDE_PATH - CURSES_LIBRARY - CURSES_CURSES_INCLUDE_PATH CURSES_CURSES_LIBRARY - CURSES_NCURSES_INCLUDE_PATH CURSES_NCURSES_LIBRARY CURSES_EXTRA_LIBRARY - FORM_LIBRARY - CURSES_LIBRARIES - CURSES_INCLUDE_DIR - CURSES_CURSES_HAS_WSYNCUP - CURSES_NCURSES_HAS_WSYNCUP - CURSES_NCURSES_HAS_CBREAK - CURSES_TINFO_HAS_CBREAK ) ----------------------------------------------------------------------- Summary of changes: Modules/FindCurses.cmake | 177 +++++++++++++++++++++++++--------------------- 1 file changed, 98 insertions(+), 79 deletions(-) hooks/post-receive -- CMake From ben.boeckel at kitware.com Mon Jul 14 12:55:35 2014 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Mon, 14 Jul 2014 12:55:35 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4229-g5872fac Message-ID: <20140714165535.B69773FAFE@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 5872fac134116adb2c3ffe0b493b46b157c9fac7 (commit) via 4b139169702dec37039869cc4af064c18e6789b8 (commit) from b16ffbd22ca372c99c1e538e0e0e0f9cbf6026ae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5872fac134116adb2c3ffe0b493b46b157c9fac7 commit 5872fac134116adb2c3ffe0b493b46b157c9fac7 Merge: b16ffbd 4b13916 Author: Ben Boeckel AuthorDate: Mon Jul 14 12:55:35 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 12:55:35 2014 -0400 Merge topic 'dev/fix-cmake-rule-property' into next 4b139169 cmMakefile: fix __CMAKE_RULE property setting http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4b139169702dec37039869cc4af064c18e6789b8 commit 4b139169702dec37039869cc4af064c18e6789b8 Author: Ben Boeckel AuthorDate: Mon Jul 14 12:55:04 2014 -0400 Commit: Ben Boeckel CommitDate: Mon Jul 14 12:55:04 2014 -0400 cmMakefile: fix __CMAKE_RULE property setting It got put into the condition by mistake. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 2218e2f..d3ca34a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1042,8 +1042,8 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, if (!file) { file = this->CreateSource(outName, true); - file->SetProperty("__CMAKE_RULE", "1"); } + file->SetProperty("__CMAKE_RULE", "1"); } // Always create the output sources and mark them generated. ----------------------------------------------------------------------- Summary of changes: Source/cmMakefile.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 14:41:14 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 14:41:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4234-g9e9d698 Message-ID: <20140714184114.EC5723F557@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 9e9d6984b765ce89cd29ee229973b6bd59fdcec4 (commit) via 8a205b980c8dc088aa2c9f91adb90d57a65fa560 (commit) via d57be904ae997e44ec9ac3b44722277f81936577 (commit) via b3b44d138e50b2c5b4a4d327aae9290dba56862d (commit) via 80cb12bb8bc14eb3e56f344d03254777351e5c74 (commit) from 5872fac134116adb2c3ffe0b493b46b157c9fac7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e9d6984b765ce89cd29ee229973b6bd59fdcec4 commit 9e9d6984b765ce89cd29ee229973b6bd59fdcec4 Merge: 5872fac 8a205b9 Author: Brad King AuthorDate: Mon Jul 14 14:41:13 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 14:41:13 2014 -0400 Merge topic 'target-legacy-depends-only-for-vs6' into next 8a205b98 cmTarget: Compile old-style link dependencies only for VS 6 d57be904 cmTarget: Run old-style link dependencies only for VS 6 b3b44d13 cmTarget: Rename old-style link dependencies code as "ForVS6" 80cb12bb export_library_dependencies: Use original link libraries internally http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8a205b980c8dc088aa2c9f91adb90d57a65fa560 commit 8a205b980c8dc088aa2c9f91adb90d57a65fa560 Author: Brad King AuthorDate: Mon Jul 14 14:39:20 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 14:39:20 2014 -0400 cmTarget: Compile old-style link dependencies only for VS 6 Compile all the "ForVS6" cmTarget members only on Windows. No other platforms support the VS 6 generator. diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 160a8fb..5e6c03e 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -214,8 +214,10 @@ public: */ virtual void FindMakeProgram(cmMakefile*); +#if defined(_WIN32) && !defined(__CYGWIN__) /** Is this the Visual Studio 6 generator? */ virtual bool IsForVS6() const { return false; } +#endif ///! Find a target by name by searching the local generators. cmTarget* FindTarget(const std::string& name, diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0d17dc2..aaae457 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -258,7 +258,9 @@ cmTarget::cmTarget() #undef INITIALIZE_TARGET_POLICY_MEMBER this->Makefile = 0; +#if defined(_WIN32) && !defined(__CYGWIN__) this->LinkLibrariesForVS6Analyzed = false; +#endif this->HaveInstallRule = false; this->DLLPlatform = false; this->IsApple = false; @@ -517,11 +519,13 @@ void cmTarget::FinishConfigure() // invalidation code in this source file is buggy. this->ClearLinkMaps(); +#if defined(_WIN32) && !defined(__CYGWIN__) // Do old-style link dependency analysis only for CM_USE_OLD_VS6. if(this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->IsForVS6()) { this->AnalyzeLibDependenciesForVS6(*this->Makefile); } +#endif } //---------------------------------------------------------------------------- @@ -1335,7 +1339,9 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, cmTarget::LibraryID tmp; tmp.first = lib; tmp.second = llt; +#if defined(_WIN32) && !defined(__CYGWIN__) this->LinkLibrariesForVS6.push_back( tmp ); +#endif this->OriginalLinkLibraries.push_back(tmp); this->ClearLinkMaps(); @@ -1401,6 +1407,7 @@ cmTarget::AddSystemIncludeDirectories(const std::vector &incs) } } +#if defined(_WIN32) && !defined(__CYGWIN__) //---------------------------------------------------------------------------- void cmTarget::AnalyzeLibDependenciesForVS6( const cmMakefile& mf ) @@ -1693,6 +1700,7 @@ void cmTarget::GatherDependenciesForVS6( const cmMakefile& mf, this->DeleteDependencyForVS6( dep_map, lib, lib); } } +#endif //---------------------------------------------------------------------------- static bool whiteListedInterfaceProperty(const std::string& prop) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index bd5417a..c2efb14 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -179,8 +179,6 @@ public: typedef std::pair LibraryID; typedef std::vector LinkLibraryVectorType; - const LinkLibraryVectorType &GetLinkLibrariesForVS6() const { - return this->LinkLibrariesForVS6;} const LinkLibraryVectorType &GetOriginalLinkLibraries() const {return this->OriginalLinkLibraries;} @@ -613,6 +611,11 @@ public: return this->MaxLanguageStandards; } +#if defined(_WIN32) && !defined(__CYGWIN__) + const LinkLibraryVectorType &GetLinkLibrariesForVS6() const { + return this->LinkLibrariesForVS6;} +#endif + private: bool HandleLocationPropertyPolicy(cmMakefile* context) const; @@ -622,6 +625,7 @@ private: std::vector > TLLCommands; +#if defined(_WIN32) && !defined(__CYGWIN__) /** * A list of direct dependencies. Use in conjunction with DependencyMap. */ @@ -672,6 +676,7 @@ private: DependencyMap& dep_map); void AnalyzeLibDependenciesForVS6( const cmMakefile& mf ); +#endif const char* GetSuffixVariableInternal(bool implib) const; const char* GetPrefixVariableInternal(bool implib) const; @@ -720,9 +725,11 @@ private: std::vector PreLinkCommands; std::vector PostBuildCommands; TargetType TargetTypeValue; - LinkLibraryVectorType LinkLibrariesForVS6; LinkLibraryVectorType PrevLinkedLibraries; +#if defined(_WIN32) && !defined(__CYGWIN__) + LinkLibraryVectorType LinkLibrariesForVS6; bool LinkLibrariesForVS6Analyzed; +#endif std::vector LinkDirectories; std::set LinkDirectoriesEmmitted; bool HaveInstallRule; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d57be904ae997e44ec9ac3b44722277f81936577 commit d57be904ae997e44ec9ac3b44722277f81936577 Author: Brad King AuthorDate: Mon Jul 14 14:38:58 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 14:38:58 2014 -0400 cmTarget: Run old-style link dependencies only for VS 6 Invoke it at runtime only with the VS 6 generator. No other generators need it. diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 6403429..160a8fb 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -214,6 +214,9 @@ public: */ virtual void FindMakeProgram(cmMakefile*); + /** Is this the Visual Studio 6 generator? */ + virtual bool IsForVS6() const { return false; } + ///! Find a target by name by searching the local generators. cmTarget* FindTarget(const std::string& name, bool excludeAliases = false) const; diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 2797e11..b2fd28f 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -91,6 +91,8 @@ public: virtual void FindMakeProgram(cmMakefile*); + virtual bool IsForVS6() const { return true; } + protected: virtual const char* GetIDEVersion() { return "6.0"; } private: diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c480669..0d17dc2 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -517,8 +517,11 @@ void cmTarget::FinishConfigure() // invalidation code in this source file is buggy. this->ClearLinkMaps(); - // Do old-style link dependency analysis. - this->AnalyzeLibDependenciesForVS6(*this->Makefile); + // Do old-style link dependency analysis only for CM_USE_OLD_VS6. + if(this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->IsForVS6()) + { + this->AnalyzeLibDependenciesForVS6(*this->Makefile); + } } //---------------------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b3b44d138e50b2c5b4a4d327aae9290dba56862d commit b3b44d138e50b2c5b4a4d327aae9290dba56862d Author: Brad King AuthorDate: Mon Jul 14 14:21:54 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 14:37:04 2014 -0400 cmTarget: Rename old-style link dependencies code as "ForVS6" The old link dependency analysis is now needed only for the VS 6 generator code delimited by CM_USE_OLD_VS6 to support project-provided project templates. Rename the related cmTarget members to be "ForVS6". diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 5db735f..c14fb2b 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1101,7 +1101,8 @@ void cmLocalVisualStudio6Generator } } // find link libraries - const cmTarget::LinkLibraryVectorType& libs = target.GetLinkLibraries(); + const cmTarget::LinkLibraryVectorType& libs = + target.GetLinkLibrariesForVS6(); cmTarget::LinkLibraryVectorType::const_iterator j; for(j = libs.begin(); j != libs.end(); ++j) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a740bc3..c480669 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -258,7 +258,7 @@ cmTarget::cmTarget() #undef INITIALIZE_TARGET_POLICY_MEMBER this->Makefile = 0; - this->LinkLibrariesAnalyzed = false; + this->LinkLibrariesForVS6Analyzed = false; this->HaveInstallRule = false; this->DLLPlatform = false; this->IsApple = false; @@ -518,7 +518,7 @@ void cmTarget::FinishConfigure() this->ClearLinkMaps(); // Do old-style link dependency analysis. - this->AnalyzeLibDependencies(*this->Makefile); + this->AnalyzeLibDependenciesForVS6(*this->Makefile); } //---------------------------------------------------------------------------- @@ -1332,7 +1332,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, cmTarget::LibraryID tmp; tmp.first = lib; tmp.second = llt; - this->LinkLibraries.push_back( tmp ); + this->LinkLibrariesForVS6.push_back( tmp ); this->OriginalLinkLibraries.push_back(tmp); this->ClearLinkMaps(); @@ -1400,7 +1400,7 @@ cmTarget::AddSystemIncludeDirectories(const std::vector &incs) //---------------------------------------------------------------------------- void -cmTarget::AnalyzeLibDependencies( const cmMakefile& mf ) +cmTarget::AnalyzeLibDependenciesForVS6( const cmMakefile& mf ) { // There are two key parts of the dependency analysis: (1) // determining the libraries in the link line, and (2) constructing @@ -1477,8 +1477,8 @@ cmTarget::AnalyzeLibDependencies( const cmMakefile& mf ) // eventually be removed. This code was moved here from the end of // old source list processing code which was called just before this // method. - for(LinkLibraryVectorType::iterator p = this->LinkLibraries.begin(); - p != this->LinkLibraries.end(); ++p) + for(LinkLibraryVectorType::iterator p = this->LinkLibrariesForVS6.begin(); + p != this->LinkLibrariesForVS6.end(); ++p) { this->Makefile->ExpandVariablesInString(p->first, true, true); } @@ -1490,22 +1490,22 @@ cmTarget::AnalyzeLibDependencies( const cmMakefile& mf ) // 1. Build the dependency graph // for(LinkLibraryVectorType::reverse_iterator lib - = this->LinkLibraries.rbegin(); - lib != this->LinkLibraries.rend(); ++lib) + = this->LinkLibrariesForVS6.rbegin(); + lib != this->LinkLibrariesForVS6.rend(); ++lib) { - this->GatherDependencies( mf, *lib, dep_map); + this->GatherDependenciesForVS6( mf, *lib, dep_map); } // 2. Remove any dependencies that are already satisfied in the original // link line. // - for(LinkLibraryVectorType::iterator lib = this->LinkLibraries.begin(); - lib != this->LinkLibraries.end(); ++lib) + for(LinkLibraryVectorType::iterator lib = this->LinkLibrariesForVS6.begin(); + lib != this->LinkLibrariesForVS6.end(); ++lib) { for( LinkLibraryVectorType::iterator lib2 = lib; - lib2 != this->LinkLibraries.end(); ++lib2) + lib2 != this->LinkLibrariesForVS6.end(); ++lib2) { - this->DeleteDependency( dep_map, *lib, *lib2); + this->DeleteDependencyForVS6( dep_map, *lib, *lib2); } } @@ -1514,43 +1514,43 @@ cmTarget::AnalyzeLibDependencies( const cmMakefile& mf ) // missing. Start from the back and keep adding. // std::set done, visited; - std::vector newLinkLibraries; + std::vector newLinkLibrariesForVS6; for(LinkLibraryVectorType::reverse_iterator lib = - this->LinkLibraries.rbegin(); - lib != this->LinkLibraries.rend(); ++lib) + this->LinkLibrariesForVS6.rbegin(); + lib != this->LinkLibrariesForVS6.rend(); ++lib) { // skip zero size library entries, this may happen // if a variable expands to nothing. if (lib->first.size() != 0) { - this->Emit( *lib, dep_map, done, visited, newLinkLibraries ); + this->EmitForVS6( *lib, dep_map, done, visited, newLinkLibrariesForVS6 ); } } // 4. Add the new libraries to the link line. // for( std::vector::reverse_iterator k = - newLinkLibraries.rbegin(); - k != newLinkLibraries.rend(); ++k ) + newLinkLibrariesForVS6.rbegin(); + k != newLinkLibrariesForVS6.rend(); ++k ) { // get the llt from the dep_map - this->LinkLibraries.push_back( std::make_pair(k->first,k->second) ); + this->LinkLibrariesForVS6.push_back( std::make_pair(k->first,k->second) ); } - this->LinkLibrariesAnalyzed = true; + this->LinkLibrariesForVS6Analyzed = true; } //---------------------------------------------------------------------------- -void cmTarget::InsertDependency( DependencyMap& depMap, - const LibraryID& lib, - const LibraryID& dep) +void cmTarget::InsertDependencyForVS6( DependencyMap& depMap, + const LibraryID& lib, + const LibraryID& dep) { depMap[lib].push_back(dep); } //---------------------------------------------------------------------------- -void cmTarget::DeleteDependency( DependencyMap& depMap, - const LibraryID& lib, - const LibraryID& dep) +void cmTarget::DeleteDependencyForVS6( DependencyMap& depMap, + const LibraryID& lib, + const LibraryID& dep) { // Make sure there is an entry in the map for lib. If so, delete all // dependencies to dep. There may be repeated entries because of @@ -1569,11 +1569,11 @@ void cmTarget::DeleteDependency( DependencyMap& depMap, } //---------------------------------------------------------------------------- -void cmTarget::Emit(const LibraryID lib, - const DependencyMap& dep_map, - std::set& emitted, - std::set& visited, - DependencyList& link_line ) +void cmTarget::EmitForVS6(const LibraryID lib, + const DependencyMap& dep_map, + std::set& emitted, + std::set& visited, + DependencyList& link_line ) { // It's already been emitted if( emitted.find(lib) != emitted.end() ) @@ -1619,7 +1619,7 @@ void cmTarget::Emit(const LibraryID lib, if( emitted.find(*i) == emitted.end() ) { // emit dependencies - Emit( *i, dep_map, emitted, visited, link_line ); + this->EmitForVS6( *i, dep_map, emitted, visited, link_line ); // emit self emitted.insert(*i); emitted_here.insert(*i); @@ -1632,9 +1632,9 @@ void cmTarget::Emit(const LibraryID lib, } //---------------------------------------------------------------------------- -void cmTarget::GatherDependencies( const cmMakefile& mf, - const LibraryID& lib, - DependencyMap& dep_map) +void cmTarget::GatherDependenciesForVS6( const cmMakefile& mf, + const LibraryID& lib, + DependencyMap& dep_map) { // If the library is already in the dependency map, then it has // already been fully processed. @@ -1678,8 +1678,8 @@ void cmTarget::GatherDependencies( const cmMakefile& mf, else { LibraryID lib2(l,llt); - this->InsertDependency( dep_map, lib, lib2); - this->GatherDependencies( mf, lib2, dep_map); + this->InsertDependencyForVS6( dep_map, lib, lib2); + this->GatherDependenciesForVS6( mf, lib2, dep_map); llt = cmTarget::GENERAL; } } @@ -1687,7 +1687,7 @@ void cmTarget::GatherDependencies( const cmMakefile& mf, end = depline.find( ";", start ); } // cannot depend on itself - this->DeleteDependency( dep_map, lib, lib); + this->DeleteDependencyForVS6( dep_map, lib, lib); } } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index dc67f1e..bd5417a 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -179,8 +179,8 @@ public: typedef std::pair LibraryID; typedef std::vector LinkLibraryVectorType; - const LinkLibraryVectorType &GetLinkLibraries() const { - return this->LinkLibraries;} + const LinkLibraryVectorType &GetLinkLibrariesForVS6() const { + return this->LinkLibrariesForVS6;} const LinkLibraryVectorType &GetOriginalLinkLibraries() const {return this->OriginalLinkLibraries;} @@ -638,16 +638,16 @@ private: /** * Inserts \a dep at the end of the dependency list of \a lib. */ - void InsertDependency( DependencyMap& depMap, - const LibraryID& lib, - const LibraryID& dep); + void InsertDependencyForVS6( DependencyMap& depMap, + const LibraryID& lib, + const LibraryID& dep); /* * Deletes \a dep from the dependency list of \a lib. */ - void DeleteDependency( DependencyMap& depMap, - const LibraryID& lib, - const LibraryID& dep); + void DeleteDependencyForVS6( DependencyMap& depMap, + const LibraryID& lib, + const LibraryID& dep); /** * Emits the library \a lib and all its dependencies into link_line. @@ -657,21 +657,21 @@ private: * link_line is in reverse order, in that the dependencies of a * library are listed before the library itself. */ - void Emit( const LibraryID lib, - const DependencyMap& dep_map, - std::set& emitted, - std::set& visited, - DependencyList& link_line); + void EmitForVS6( const LibraryID lib, + const DependencyMap& dep_map, + std::set& emitted, + std::set& visited, + DependencyList& link_line); /** * Finds the dependencies for \a lib and inserts them into \a * dep_map. */ - void GatherDependencies( const cmMakefile& mf, - const LibraryID& lib, - DependencyMap& dep_map); + void GatherDependenciesForVS6( const cmMakefile& mf, + const LibraryID& lib, + DependencyMap& dep_map); - void AnalyzeLibDependencies( const cmMakefile& mf ); + void AnalyzeLibDependenciesForVS6( const cmMakefile& mf ); const char* GetSuffixVariableInternal(bool implib) const; const char* GetPrefixVariableInternal(bool implib) const; @@ -720,9 +720,9 @@ private: std::vector PreLinkCommands; std::vector PostBuildCommands; TargetType TargetTypeValue; - LinkLibraryVectorType LinkLibraries; + LinkLibraryVectorType LinkLibrariesForVS6; LinkLibraryVectorType PrevLinkedLibraries; - bool LinkLibrariesAnalyzed; + bool LinkLibrariesForVS6Analyzed; std::vector LinkDirectories; std::set LinkDirectoriesEmmitted; bool HaveInstallRule; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=80cb12bb8bc14eb3e56f344d03254777351e5c74 commit 80cb12bb8bc14eb3e56f344d03254777351e5c74 Author: Brad King AuthorDate: Mon Jul 14 14:19:32 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 14:29:26 2014 -0400 export_library_dependencies: Use original link libraries internally This command was using the cmTarget::GetLinkLibraries method with a comment explaining how execution order gives it the dependencies before analysis. Just use cmTarget::GetOriginalLinkLibraries instead. diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index 688d2eb..cb150a7 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -108,14 +108,12 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const std::string targetEntry = target.GetName(); targetEntry += "_LIB_DEPENDS"; - // Construct the dependency variable value. It is safe to use - // the target GetLinkLibraries method here because this code is - // called at the end of configure but before generate so library - // dependencies have yet to be analyzed. Therefore the value - // will be the direct link dependencies. + // Construct the dependency variable value with the direct link + // dependencies. std::string valueOld; std::string valueNew; - cmTarget::LinkLibraryVectorType const& libs = target.GetLinkLibraries(); + cmTarget::LinkLibraryVectorType const& libs = + target.GetOriginalLinkLibraries(); for(cmTarget::LinkLibraryVectorType::const_iterator li = libs.begin(); li != libs.end(); ++li) { ----------------------------------------------------------------------- Summary of changes: Source/cmExportLibraryDependenciesCommand.cxx | 10 ++- Source/cmGlobalGenerator.h | 5 ++ Source/cmGlobalVisualStudio6Generator.h | 2 + Source/cmLocalVisualStudio6Generator.cxx | 3 +- Source/cmTarget.cxx | 91 ++++++++++++++----------- Source/cmTarget.h | 45 ++++++------ 6 files changed, 90 insertions(+), 66 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 15:05:15 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 15:05:15 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4236-g1879768 Message-ID: <20140714190515.09EB7400E1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 1879768f019fc8a68dc7e4a8c3431efe2da17ef7 (commit) via 90245fe86e4c5810034b5ac793609c2ecbfa07b8 (commit) from 9e9d6984b765ce89cd29ee229973b6bd59fdcec4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1879768f019fc8a68dc7e4a8c3431efe2da17ef7 commit 1879768f019fc8a68dc7e4a8c3431efe2da17ef7 Merge: 9e9d698 90245fe Author: Brad King AuthorDate: Mon Jul 14 15:05:14 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 15:05:14 2014 -0400 Merge topic 'FindImageMagick-pkgconfig' into next 90245fe8 FindImageMagick: Use pkgconfig hints if available (#14012) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90245fe86e4c5810034b5ac793609c2ecbfa07b8 commit 90245fe86e4c5810034b5ac793609c2ecbfa07b8 Author: Rex Dieter AuthorDate: Mon Jul 14 15:04:13 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 15:05:28 2014 -0400 FindImageMagick: Use pkgconfig hints if available (#14012) Tested-by: bastien ROUCARIES diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake index 4f0e687..f6c8b3a 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -95,14 +95,21 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +find_package(PkgConfig QUIET) + #--------------------------------------------------------------------- # Helper functions #--------------------------------------------------------------------- function(FIND_IMAGEMAGICK_API component header) set(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE) + pkg_check_modules(PC_${component} QUIET ${component}) + find_path(ImageMagick_${component}_INCLUDE_DIR NAMES ${header} + HINTS + ${PC_${component}_INCLUDEDIR} + ${PC_${component}_INCLUDE_DIRS} PATHS ${ImageMagick_INCLUDE_DIRS} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include" @@ -112,6 +119,9 @@ function(FIND_IMAGEMAGICK_API component header) ) find_library(ImageMagick_${component}_LIBRARY NAMES ${ARGN} + HINTS + ${PC_${component}_LIBDIR} + ${PC_${component}_LIB_DIRS} PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/lib" DOC "Path to the ImageMagick Magick++ library." ----------------------------------------------------------------------- Summary of changes: Modules/FindImageMagick.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 15:19:27 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 15:19:27 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1381-g2cb8eed Message-ID: <20140714191927.AB02E3FD26@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 2cb8eed6e3b2f2422de4d1193f3c255f88039375 (commit) via afc452fe210f5b46e5a2c9fbbde70b4e6880d4e9 (commit) via 6e9454dd7e63b0f926f77e0bd641f1edeffce8f2 (commit) via 8df37d6d5e5c1130d410f389fb3746f3aed0ec94 (commit) from c72642f927e65e66f602406380349f928a961e77 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 15:19:27 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 15:19:27 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4241-g90ecd17 Message-ID: <20140714191927.D6FCD3FD30@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 90ecd1721f2c2bcc7e2302c047e040a437c03aa5 (commit) via 2cb8eed6e3b2f2422de4d1193f3c255f88039375 (commit) via afc452fe210f5b46e5a2c9fbbde70b4e6880d4e9 (commit) via 6e9454dd7e63b0f926f77e0bd641f1edeffce8f2 (commit) via 8df37d6d5e5c1130d410f389fb3746f3aed0ec94 (commit) from 1879768f019fc8a68dc7e4a8c3431efe2da17ef7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90ecd1721f2c2bcc7e2302c047e040a437c03aa5 commit 90ecd1721f2c2bcc7e2302c047e040a437c03aa5 Merge: 1879768 2cb8eed Author: Brad King AuthorDate: Mon Jul 14 15:20:34 2014 -0400 Commit: Brad King CommitDate: Mon Jul 14 15:20:34 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 14 15:19:27 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 14 Jul 2014 15:19:27 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.0.0-17-gafc452f Message-ID: <20140714191927.E697E3FD3D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via afc452fe210f5b46e5a2c9fbbde70b4e6880d4e9 (commit) via 7e1283e48c54424b38444f78c983fc32a287ee80 (commit) via 6e9454dd7e63b0f926f77e0bd641f1edeffce8f2 (commit) via a3ac67cc3f8d9b4df9c93f65db28c494c8883811 (commit) via 8df37d6d5e5c1130d410f389fb3746f3aed0ec94 (commit) via 49f32168546ea8f2ef8e6a2e65c114c07edd0e69 (commit) from d08da54576e66336dd6c13219b5fe7cd1a361ac6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Modules/CMakeExpandImportedTargets.cmake | 12 ++++++++++-- Modules/Platform/Windows-MSVC.cmake | 10 ++++++---- Source/cmInstallTargetGenerator.cxx | 14 ++++++++++++++ 3 files changed, 30 insertions(+), 6 deletions(-) hooks/post-receive -- CMake From ben.boeckel at kitware.com Mon Jul 14 15:19:47 2014 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Mon, 14 Jul 2014 15:19:47 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4244-gddd524e Message-ID: <20140714191947.BD8243FD79@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ddd524eeba6310b556339471a6830469843d836b (commit) via 43a8c5526d12c1346793ced5a4be85b9e9a3d695 (commit) via 9270aa9a2d1ea05e7bd63ef5214f4fbaafd14d2e (commit) from 90ecd1721f2c2bcc7e2302c047e040a437c03aa5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ddd524eeba6310b556339471a6830469843d836b commit ddd524eeba6310b556339471a6830469843d836b Merge: 90ecd17 43a8c55 Author: Ben Boeckel AuthorDate: Mon Jul 14 15:19:47 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 14 15:19:47 2014 -0400 Merge topic 'dev/ison-isoff-performance' into next 43a8c552 SystemTools: Use a set in Is{On,Off} 9270aa9a IsOff: Use the length for the string construction http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=43a8c5526d12c1346793ced5a4be85b9e9a3d695 commit 43a8c5526d12c1346793ced5a4be85b9e9a3d695 Author: Ben Boeckel AuthorDate: Sat Feb 8 05:42:14 2014 -0500 Commit: Ben Boeckel CommitDate: Tue Jul 8 11:18:15 2014 -0400 SystemTools: Use a set in Is{On,Off} Also check before calling toupper() umpteen million times. diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index aa39c39..444e143 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -384,14 +384,28 @@ bool cmSystemTools::IsOn(const char* val) { return false; } - std::basic_string v = val; + size_t len = strlen(val); + if (len > 4) + { + return false; + } + std::basic_string v(val, len); + static std::set onValues; + if(onValues.empty()) + { + onValues.insert("ON"); + onValues.insert("1"); + onValues.insert("YES"); + onValues.insert("TRUE"); + onValues.insert("Y"); + } for(std::basic_string::iterator c = v.begin(); c != v.end(); c++) { *c = static_cast(toupper(*c)); } - return (v == "ON" || v == "1" || v == "YES" || v == "TRUE" || v == "Y"); + return (onValues.count(v) > 0); } bool cmSystemTools::IsNOTFOUND(const char* val) @@ -410,16 +424,31 @@ bool cmSystemTools::IsOff(const char* val) { return true; } - size_t len = val ? strlen(val) : 0; - std::basic_string v(val, len); + size_t len = strlen(val); + // Try and avoid toupper() for large strings. + if (len > 6) + { + return cmSystemTools::IsNOTFOUND(val); + } + static std::set offValues; + if(offValues.empty()) + { + offValues.insert("OFF"); + offValues.insert("0"); + offValues.insert("NO"); + offValues.insert("FALSE"); + offValues.insert("N"); + offValues.insert("IGNORE"); + } + // Try and avoid toupper(). + std::basic_string v(val, len); for(std::basic_string::iterator c = v.begin(); c != v.end(); c++) { *c = static_cast(toupper(*c)); } - return (v == "OFF" || v == "0" || v == "NO" || v == "FALSE" || - v == "N" || cmSystemTools::IsNOTFOUND(v.c_str()) || v == "IGNORE"); + return (offValues.count(v) > 0); } //---------------------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9270aa9a2d1ea05e7bd63ef5214f4fbaafd14d2e commit 9270aa9a2d1ea05e7bd63ef5214f4fbaafd14d2e Author: Ben Boeckel AuthorDate: Mon Sep 2 16:28:21 2013 -0400 Commit: Ben Boeckel CommitDate: Tue Jul 8 11:16:16 2014 -0400 IsOff: Use the length for the string construction No need to waste the calculation and force the string to call strlen again. diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 12a63b0..aa39c39 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -406,11 +406,12 @@ bool cmSystemTools::IsNOTFOUND(const char* val) bool cmSystemTools::IsOff(const char* val) { - if (!val || strlen(val) == 0) + if (!val || !*val) { return true; } - std::basic_string v = val; + size_t len = val ? strlen(val) : 0; + std::basic_string v(val, len); for(std::basic_string::iterator c = v.begin(); c != v.end(); c++) ----------------------------------------------------------------------- Summary of changes: Source/cmSystemTools.cxx | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 15 00:02:11 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 15 Jul 2014 00:02:11 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1382-g7bc8450 Message-ID: <20140715040211.81BFA3FCA3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 7bc84502513febf4e5e974f3d4285baa53f0afb9 (commit) from 2cb8eed6e3b2f2422de4d1193f3c255f88039375 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7bc84502513febf4e5e974f3d4285baa53f0afb9 commit 7bc84502513febf4e5e974f3d4285baa53f0afb9 Author: Kitware Robot AuthorDate: Tue Jul 15 00:01:07 2014 -0400 Commit: Kitware Robot CommitDate: Tue Jul 15 00:01:07 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0de45a0..9a1bcdd 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140714) +set(CMake_VERSION_PATCH 20140715) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From steveire at gmail.com Tue Jul 15 05:35:46 2014 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 15 Jul 2014 05:35:46 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4246-ga42edc6 Message-ID: <20140715093546.16C56405A4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via a42edc6661a8f9a6616a12c83ba9eaff5bfcea65 (commit) via ba858aa50c223980b94e9d78b41a1d315bb4d68c (commit) from ddd524eeba6310b556339471a6830469843d836b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a42edc6661a8f9a6616a12c83ba9eaff5bfcea65 commit a42edc6661a8f9a6616a12c83ba9eaff5bfcea65 Merge: ddd524e ba858aa Author: Stephen Kelly AuthorDate: Tue Jul 15 05:35:45 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 15 05:35:45 2014 -0400 Merge topic 'fix-QCC-compile-flags' into next ba858aa5 QNX: Add missing flags for configurations and artifact creation. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ba858aa50c223980b94e9d78b41a1d315bb4d68c commit ba858aa50c223980b94e9d78b41a1d315bb4d68c Author: Stephen Kelly AuthorDate: Tue Jul 15 11:01:36 2014 +0200 Commit: Stephen Kelly CommitDate: Tue Jul 15 11:34:35 2014 +0200 QNX: Add missing flags for configurations and artifact creation. Commit v3.0.0-rc1~111^2 (QNX: Introduce QCC compiler id for that QNX platform compiler., 2014-01-20) split handling of the QNX QCC compiler into a separate compiler-id. That refactoring results in the QCC compiler not using the CMake-compiler-id "GNU", which means that the __compiler_gnu macro is no longer executed for it. Add the missing pieces of the __compiler_gnu macro to the __compiler_qcc macro. It is also necessary to change the language conditional to dereference the lang macro parameter, which is another bug introduced by the same commit. The extra -lang-c++ flag is only necessary when the CXX compiler is specified as 'qcc' instead of 'QCC' in the toolchain file, which is why this bug was not noticed before. The flag is also necessary in that case when linking in order to find the appropriate standard libraries. The flag was not previously added when linking executables, so linking failed even with CMake 2.8.12 with the lower-case compiler-id. diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake index cc551bd..ce7eb8a 100644 --- a/Modules/Platform/QNX.cmake +++ b/Modules/Platform/QNX.cmake @@ -25,11 +25,28 @@ macro(__compiler_qcc lang) set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,") set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MMD,,-MT,,-MF,") - if (lang STREQUAL CXX) + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE") + set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") + + # Initial configuration flags. + set(CMAKE_${lang}_FLAGS_INIT "") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") + + if (${lang} STREQUAL CXX) # If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the # default for the driver is not c++. set(CMAKE_CXX_COMPILE_OBJECT " -lang-c++ -o -c ") + + set(CMAKE_CXX_LINK_EXECUTABLE + " -lang-c++ -o ") + + set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") endif() endmacro() ----------------------------------------------------------------------- Summary of changes: Modules/Platform/QNX.cmake | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 15 08:59:12 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 15 Jul 2014 08:59:12 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4248-g105bf85 Message-ID: <20140715125912.A842F4017C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 105bf85d309190e34eb31c2beba3cf52dc3a5252 (commit) via 0fee3f471204dd9cd47682590bf9f15da456183a (commit) from a42edc6661a8f9a6616a12c83ba9eaff5bfcea65 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=105bf85d309190e34eb31c2beba3cf52dc3a5252 commit 105bf85d309190e34eb31c2beba3cf52dc3a5252 Merge: a42edc6 0fee3f4 Author: Brad King AuthorDate: Tue Jul 15 08:59:11 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 15 08:59:11 2014 -0400 Merge topic 'doc-package-target-import-once' into next 0fee3f47 Revert "Help: Update cmake-packages.7 examples to import targets only once" http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0fee3f471204dd9cd47682590bf9f15da456183a commit 0fee3f471204dd9cd47682590bf9f15da456183a Author: Brad King AuthorDate: Tue Jul 15 08:58:52 2014 -0400 Commit: Brad King CommitDate: Tue Jul 15 08:59:11 2014 -0400 Revert "Help: Update cmake-packages.7 examples to import targets only once" This reverts commit cfab942e5ff8463f8053564e68179da110280b43. Since commit v2.8.11~362^2 (Generate an early-return guard in target Export files, 2012-11-30) an external include guard is not needed. diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst index 5badd48..c4cca6d 100644 --- a/Help/manual/cmake-packages.7.rst +++ b/Help/manual/cmake-packages.7.rst @@ -385,12 +385,9 @@ In this case, the ``ClimbingStatsConfig.cmake`` file could be as simple as: .. code-block:: cmake - if(NOT TARGET Upstream::ClimbingStats) - include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") - endif() + include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") -This allows downstreams to use the ``IMPORTED`` targets, and guards -against importing the targets more than once. If any macros +As this allows downstreams to use the ``IMPORTED`` targets. If any macros should be provided by the ``ClimbingStats`` package, they should be in a separate file which is installed to the same location as the ``ClimbingStatsConfig.cmake`` file, and included from there. @@ -457,9 +454,7 @@ dependencies of a package should be found in the ``Config.cmake`` file: include(CMakeFindDependencyMacro) find_dependency(Stats 2.6.4) - if(NOT TARGET Upstream::ClimbingStats) - include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") - endif() + include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsMacros.cmake") The ``find_dependency`` macro also sets ``ClimbingStats_FOUND`` to ``False`` if @@ -476,9 +471,7 @@ be true. This can be tested with logic in the package configuration file: include(CMakeFindDependencyMacro) find_dependency(Stats 2.6.4) - if(NOT TARGET Upstream::ClimbingStats) - include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") - endif() + include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsMacros.cmake") set(_supported_components Plot Table) ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-packages.7.rst | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Tue Jul 15 09:11:36 2014 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 15 Jul 2014 09:11:36 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4250-g2fbe31f Message-ID: <20140715131136.B7F4C3F53E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 2fbe31fab2ec28c42c9bee918653f3501500aca8 (commit) via dc6826633c42978521d742216e84aadca94f1729 (commit) from 105bf85d309190e34eb31c2beba3cf52dc3a5252 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2fbe31fab2ec28c42c9bee918653f3501500aca8 commit 2fbe31fab2ec28c42c9bee918653f3501500aca8 Merge: 105bf85 dc68266 Author: Stephen Kelly AuthorDate: Tue Jul 15 09:11:36 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 15 09:11:36 2014 -0400 Merge topic 'fix-QCC-compile-flags' into next dc682663 QNX: Add missing flags for configurations and artifact creation. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc6826633c42978521d742216e84aadca94f1729 commit dc6826633c42978521d742216e84aadca94f1729 Author: Stephen Kelly AuthorDate: Tue Jul 15 11:01:36 2014 +0200 Commit: Stephen Kelly CommitDate: Tue Jul 15 15:10:53 2014 +0200 QNX: Add missing flags for configurations and artifact creation. Commit v3.0.0-rc1~111^2 (QNX: Introduce QCC compiler id for that QNX platform compiler., 2014-01-20) split handling of the QNX QCC compiler into a separate compiler-id. That refactoring results in the QCC compiler not using the CMake-compiler-id "GNU", which means that the __compiler_gnu macro is no longer executed for it. Add the missing pieces of the __compiler_gnu macro to the __compiler_qcc macro. It is also necessary to change the language conditional to dereference the lang macro parameter, which is another bug introduced by the same commit. The extra -lang-c++ flag is only necessary when the CXX compiler is specified as 'qcc' instead of 'QCC' in the toolchain file, which is why this bug was not noticed before. The flag is also necessary in that case when linking in order to find the appropriate standard libraries. The flag was not previously added when linking executables, so linking failed even with CMake 2.8.12 with the lower-case compiler-id. diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake index cc551bd..ce7eb8a 100644 --- a/Modules/Platform/QNX.cmake +++ b/Modules/Platform/QNX.cmake @@ -25,11 +25,28 @@ macro(__compiler_qcc lang) set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,") set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MMD,,-MT,,-MF,") - if (lang STREQUAL CXX) + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE") + set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") + + # Initial configuration flags. + set(CMAKE_${lang}_FLAGS_INIT "") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") + + if (${lang} STREQUAL CXX) # If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the # default for the driver is not c++. set(CMAKE_CXX_COMPILE_OBJECT " -lang-c++ -o -c ") + + set(CMAKE_CXX_LINK_EXECUTABLE + " -lang-c++ -o ") + + set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") endif() endmacro() ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From daniele.domenichelli at gmail.com Tue Jul 15 09:14:12 2014 From: daniele.domenichelli at gmail.com (Daniele E. Domenichelli) Date: Tue, 15 Jul 2014 09:14:12 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4253-gf49799e Message-ID: <20140715131412.DEDDA3FA1D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f49799e996088f1bab6828be8df5ad818f45762e (commit) via e475c067c5f738d46cd28ce1a0cf03f7404590d8 (commit) via 7bc84502513febf4e5e974f3d4285baa53f0afb9 (commit) from 2fbe31fab2ec28c42c9bee918653f3501500aca8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f49799e996088f1bab6828be8df5ad818f45762e commit f49799e996088f1bab6828be8df5ad818f45762e Merge: 2fbe31f e475c06 Author: Daniele E. Domenichelli AuthorDate: Tue Jul 15 09:14:12 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 15 09:14:12 2014 -0400 Merge topic 'fix_Xcode_generator_name' into next e475c067 Fix Xcode generator name 7bc84502 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e475c067c5f738d46cd28ce1a0cf03f7404590d8 commit e475c067c5f738d46cd28ce1a0cf03f7404590d8 Author: Daniele E. Domenichelli AuthorDate: Tue Jul 15 10:45:53 2014 +0200 Commit: Daniele E. Domenichelli CommitDate: Tue Jul 15 10:46:34 2014 +0200 Fix Xcode generator name The generator name is "Xcode", not "XCode" diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index dc4f894..d25986b 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -77,7 +77,7 @@ if(BUILD_TESTING) # some old versions of make simply cannot handle spaces in paths if (MAKE_IS_GNU OR CMAKE_MAKE_PROGRAM MATCHES "nmake|gmake|wmake" OR - CMAKE_GENERATOR MATCHES "Visual Studio|XCode|Borland") + CMAKE_GENERATOR MATCHES "Visual Studio|Xcode|Borland") set(MAKE_SUPPORTS_SPACES 1) else() set(MAKE_SUPPORTS_SPACES 0) diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index f74d17e..145d312 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -1,7 +1,7 @@ include(RunCMake) run_cmake(CommandConflict) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio" OR "${RunCMake_GENERATOR}" MATCHES "XCode" ) +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio" OR "${RunCMake_GENERATOR}" MATCHES "Xcode" ) run_cmake(OutputConflict) endif() run_cmake(EmptyCondition1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- Tests/CMakeLists.txt | 2 +- Tests/RunCMake/File_Generate/RunCMakeTest.cmake | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 15 10:48:14 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 15 Jul 2014 10:48:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1384-g0bbebd3 Message-ID: <20140715144814.AD0D63F991@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 0bbebd3ca1f5e5dbf68444918d0ea1acc48cb776 (commit) via 0fee3f471204dd9cd47682590bf9f15da456183a (commit) from 7bc84502513febf4e5e974f3d4285baa53f0afb9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0bbebd3ca1f5e5dbf68444918d0ea1acc48cb776 commit 0bbebd3ca1f5e5dbf68444918d0ea1acc48cb776 Merge: 7bc8450 0fee3f4 Author: Brad King AuthorDate: Tue Jul 15 10:48:13 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 15 10:48:13 2014 -0400 Merge topic 'doc-package-target-import-once' 0fee3f47 Revert "Help: Update cmake-packages.7 examples to import targets only once" ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-packages.7.rst | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 15 10:48:16 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 15 Jul 2014 10:48:16 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1386-gd3076b1 Message-ID: <20140715144816.795543F9CF@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via d3076b1d51c25f076d3dbde7d94e06078040f124 (commit) via 90245fe86e4c5810034b5ac793609c2ecbfa07b8 (commit) from 0bbebd3ca1f5e5dbf68444918d0ea1acc48cb776 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d3076b1d51c25f076d3dbde7d94e06078040f124 commit d3076b1d51c25f076d3dbde7d94e06078040f124 Merge: 0bbebd3 90245fe Author: Brad King AuthorDate: Tue Jul 15 10:48:15 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 15 10:48:15 2014 -0400 Merge topic 'FindImageMagick-pkgconfig' 90245fe8 FindImageMagick: Use pkgconfig hints if available (#14012) ----------------------------------------------------------------------- Summary of changes: Modules/FindImageMagick.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 15 10:48:18 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 15 Jul 2014 10:48:18 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1388-g29abb3d Message-ID: <20140715144818.2193C3F993@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 29abb3dedb7eca410083ee1e5424fddd24b1d4d6 (commit) via 4b139169702dec37039869cc4af064c18e6789b8 (commit) from d3076b1d51c25f076d3dbde7d94e06078040f124 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=29abb3dedb7eca410083ee1e5424fddd24b1d4d6 commit 29abb3dedb7eca410083ee1e5424fddd24b1d4d6 Merge: d3076b1 4b13916 Author: Brad King AuthorDate: Tue Jul 15 10:48:17 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 15 10:48:17 2014 -0400 Merge topic 'dev/fix-cmake-rule-property' 4b139169 cmMakefile: fix __CMAKE_RULE property setting ----------------------------------------------------------------------- Summary of changes: Source/cmMakefile.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 15 10:48:19 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 15 Jul 2014 10:48:19 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1391-gc005d95 Message-ID: <20140715144819.C079A3F9D1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c005d9566226f15368af7d772734265fe8916289 (commit) via 43a8c5526d12c1346793ced5a4be85b9e9a3d695 (commit) via 9270aa9a2d1ea05e7bd63ef5214f4fbaafd14d2e (commit) from 29abb3dedb7eca410083ee1e5424fddd24b1d4d6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c005d9566226f15368af7d772734265fe8916289 commit c005d9566226f15368af7d772734265fe8916289 Merge: 29abb3d 43a8c55 Author: Brad King AuthorDate: Tue Jul 15 10:48:18 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 15 10:48:18 2014 -0400 Merge topic 'dev/ison-isoff-performance' 43a8c552 SystemTools: Use a set in Is{On,Off} 9270aa9a IsOff: Use the length for the string construction ----------------------------------------------------------------------- Summary of changes: Source/cmSystemTools.cxx | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 15 10:48:21 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 15 Jul 2014 10:48:21 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1393-g41fc008 Message-ID: <20140715144821.6F7813F9D2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 41fc00820ac5c61265a889dc15021fb2d26fe56f (commit) via 6c8364e6cbda7e890eb185b4ca327286ba63e1fb (commit) from c005d9566226f15368af7d772734265fe8916289 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=41fc00820ac5c61265a889dc15021fb2d26fe56f commit 41fc00820ac5c61265a889dc15021fb2d26fe56f Merge: c005d95 6c8364e Author: Brad King AuthorDate: Tue Jul 15 10:48:20 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 15 10:48:20 2014 -0400 Merge topic 'FindCurses-overhaul' 6c8364e6 FindCurses: Overhaul Curses and NCurses search logic (#15011) ----------------------------------------------------------------------- Summary of changes: Modules/FindCurses.cmake | 177 +++++++++++++++++++++++++--------------------- 1 file changed, 98 insertions(+), 79 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 15 10:48:23 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 15 Jul 2014 10:48:23 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1398-g49bf3e7 Message-ID: <20140715144823.6D2303F992@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 49bf3e7d8daab2a1e7ba435d011618bd2c516766 (commit) via 8a205b980c8dc088aa2c9f91adb90d57a65fa560 (commit) via d57be904ae997e44ec9ac3b44722277f81936577 (commit) via b3b44d138e50b2c5b4a4d327aae9290dba56862d (commit) via 80cb12bb8bc14eb3e56f344d03254777351e5c74 (commit) from 41fc00820ac5c61265a889dc15021fb2d26fe56f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49bf3e7d8daab2a1e7ba435d011618bd2c516766 commit 49bf3e7d8daab2a1e7ba435d011618bd2c516766 Merge: 41fc008 8a205b9 Author: Brad King AuthorDate: Tue Jul 15 10:48:22 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 15 10:48:22 2014 -0400 Merge topic 'target-legacy-depends-only-for-vs6' 8a205b98 cmTarget: Compile old-style link dependencies only for VS 6 d57be904 cmTarget: Run old-style link dependencies only for VS 6 b3b44d13 cmTarget: Rename old-style link dependencies code as "ForVS6" 80cb12bb export_library_dependencies: Use original link libraries internally ----------------------------------------------------------------------- Summary of changes: Source/cmExportLibraryDependenciesCommand.cxx | 10 ++- Source/cmGlobalGenerator.h | 5 ++ Source/cmGlobalVisualStudio6Generator.h | 2 + Source/cmLocalVisualStudio6Generator.cxx | 3 +- Source/cmTarget.cxx | 91 ++++++++++++++----------- Source/cmTarget.h | 45 ++++++------ 6 files changed, 90 insertions(+), 66 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 15 10:56:21 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 15 Jul 2014 10:56:21 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4260-g1a1cd48 Message-ID: <20140715145621.DD18940224@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 1a1cd48d9ca07d15b854bccdf81150c50ce4a3fc (commit) via 49bf3e7d8daab2a1e7ba435d011618bd2c516766 (commit) via 41fc00820ac5c61265a889dc15021fb2d26fe56f (commit) via c005d9566226f15368af7d772734265fe8916289 (commit) via 29abb3dedb7eca410083ee1e5424fddd24b1d4d6 (commit) via d3076b1d51c25f076d3dbde7d94e06078040f124 (commit) via 0bbebd3ca1f5e5dbf68444918d0ea1acc48cb776 (commit) from f49799e996088f1bab6828be8df5ad818f45762e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1a1cd48d9ca07d15b854bccdf81150c50ce4a3fc commit 1a1cd48d9ca07d15b854bccdf81150c50ce4a3fc Merge: f49799e 49bf3e7 Author: Brad King AuthorDate: Tue Jul 15 10:50:08 2014 -0400 Commit: Brad King CommitDate: Tue Jul 15 10:50:08 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From clinton at elemtech.com Tue Jul 15 13:19:19 2014 From: clinton at elemtech.com (Clinton Stimpson) Date: Tue, 15 Jul 2014 13:19:19 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4262-g9cfdb3b Message-ID: <20140715171919.EA8463FC5C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 9cfdb3b3a43de0366b59c18ee1dc86a24299eefd (commit) via 5e01ee2ea9b2062969710d8eed00620bbfc61608 (commit) from 1a1cd48d9ca07d15b854bccdf81150c50ce4a3fc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9cfdb3b3a43de0366b59c18ee1dc86a24299eefd commit 9cfdb3b3a43de0366b59c18ee1dc86a24299eefd Merge: 1a1cd48 5e01ee2 Author: Clinton Stimpson AuthorDate: Tue Jul 15 13:19:19 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 15 13:19:19 2014 -0400 Merge topic 'encoding-ctest-fixes' into next 5e01ee2e Encoding: Fix a few encoding problems with ctest. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5e01ee2ea9b2062969710d8eed00620bbfc61608 commit 5e01ee2ea9b2062969710d8eed00620bbfc61608 Author: Clinton Stimpson AuthorDate: Tue Jul 15 11:11:18 2014 -0600 Commit: Clinton Stimpson CommitDate: Tue Jul 15 11:12:57 2014 -0600 Encoding: Fix a few encoding problems with ctest. This also fixes some test failures on Windows when the name of the build directory contains non-ascii characters. diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 7c72cba..109905c 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -225,8 +225,8 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, std::string upload_as = url + "/" + remoteprefix + cmSystemTools::GetFilenameName(*file); - struct stat st; - if ( ::stat(local_file.c_str(), &st) ) + + if ( !cmSystemTools::FileExists(local_file.c_str()) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: " << local_file << std::endl); @@ -234,6 +234,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, ::curl_global_cleanup(); return false; } + unsigned long filelen = cmSystemTools::FileLength(local_file.c_str()); ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb"); *this->LogFile << "\tUpload file: " << local_file << " to " @@ -252,7 +253,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, // and give the size of the upload (optional) ::curl_easy_setopt(curl, CURLOPT_INFILESIZE, - static_cast(st.st_size)); + static_cast(filelen)); // and give curl the buffer for errors ::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer); @@ -466,8 +467,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, upload_as += md5; } - struct stat st; - if ( ::stat(local_file.c_str(), &st) ) + if( !cmSystemTools::FileExists(local_file.c_str()) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: " << local_file << std::endl); @@ -475,11 +475,12 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, ::curl_global_cleanup(); return false; } + unsigned long filelen = cmSystemTools::FileLength(local_file.c_str()); ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb"); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " << local_file << " to " - << upload_as << " Size: " << st.st_size << std::endl); + << upload_as << " Size: " << filelen << std::endl); // specify target ::curl_easy_setopt(curl,CURLOPT_URL, upload_as.c_str()); @@ -489,7 +490,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, // and give the size of the upload (optional) ::curl_easy_setopt(curl, CURLOPT_INFILESIZE, - static_cast(st.st_size)); + static_cast(filelen)); // and give curl the buffer for errors ::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer); diff --git a/Tests/CTestTestMemcheck/memtester.cxx.in b/Tests/CTestTestMemcheck/memtester.cxx.in index 55a34e3..fd8a2a8 100644 --- a/Tests/CTestTestMemcheck/memtester.cxx.in +++ b/Tests/CTestTestMemcheck/memtester.cxx.in @@ -1,11 +1,18 @@ #include +#include #include #define RETVAL @_retval@ int -main(int argc, char **argv) +main(int ac, char **av) { + setlocale(LC_CTYPE, ""); + cmsys::Encoding::CommandLineArguments args = + cmsys::Encoding::CommandLineArguments::Main(ac, av); + int argc = args.argc(); + const char* const* argv = args.argv(); + std::string exename = argv[0]; std::string logarg; bool nextarg = false; ----------------------------------------------------------------------- Summary of changes: Source/CTest/cmCTestSubmitHandler.cxx | 15 ++++++++------- Tests/CTestTestMemcheck/memtester.cxx.in | 9 ++++++++- 2 files changed, 16 insertions(+), 8 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 15 14:02:23 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 15 Jul 2014 14:02:23 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4265-g9ba0ee2 Message-ID: <20140715180223.5C98F402A3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 9ba0ee21f31631968832bfe2174d7d8426ce3d8c (commit) via 8722b540895a3959a932d6fbe349465c05a72492 (commit) via 1657c4a51e18a63ec5439e3a52e29787ad2e1f65 (commit) from 9cfdb3b3a43de0366b59c18ee1dc86a24299eefd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9ba0ee21f31631968832bfe2174d7d8426ce3d8c commit 9ba0ee21f31631968832bfe2174d7d8426ce3d8c Merge: 9cfdb3b 8722b54 Author: Brad King AuthorDate: Tue Jul 15 14:02:22 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 15 14:02:22 2014 -0400 Merge topic 'generalize-LINK_ONLY' into next 8722b540 Honor $ when checking interface properties 1657c4a5 Make $ available to projects (#14751) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8722b540895a3959a932d6fbe349465c05a72492 commit 8722b540895a3959a932d6fbe349465c05a72492 Author: Brad King AuthorDate: Tue Jul 15 11:34:02 2014 -0400 Commit: Brad King CommitDate: Tue Jul 15 13:23:50 2014 -0400 Honor $ when checking interface properties Callers of cmTarget::GetLinkImplementationClosure are interested in the set of targets whose interface properties propagate to the current target. This excludes targets guarded by $. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index bdf361e..c22d23e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6038,7 +6038,7 @@ void processILibs(const std::string& config, { tgts.push_back(item.Target); if(cmTarget::LinkInterface const* iface = - item.Target->GetLinkInterfaceLibraries(config, headTarget, false)) + item.Target->GetLinkInterfaceLibraries(config, headTarget, true)) { for(std::vector::const_iterator it = iface->Libraries.begin(); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1657c4a51e18a63ec5439e3a52e29787ad2e1f65 commit 1657c4a51e18a63ec5439e3a52e29787ad2e1f65 Author: Brad King AuthorDate: Tue Jul 15 11:14:49 2014 -0400 Commit: Brad King CommitDate: Tue Jul 15 13:23:30 2014 -0400 Make $ available to projects (#14751) Previously this generator expression was used internally by the target_link_libraries command to honor private linking requirements of static libraries in their INTERFACE_LINK_LIBRARIES. Remove the check that limits $ to this use case to make it available for project code to use too. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 9e82674..bc24798 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -188,6 +188,13 @@ property is non-empty:: Marks ``...`` as being the name of a target. This is required if exporting targets to multiple dependent export sets. The ``...`` must be a literal name of a target- it may not contain generator expressions. +``$`` + Content of ``...`` except when evaluated in a link interface while + propagating :ref:`Target Usage Requirements`, in which case it is the + empty string. + Intended for use only in an :prop_tgt:`INTERFACE_LINK_LIBRARIES` target + property, perhaps via the :command:`target_link_libraries` command, + to specify private link dependencies without other usage requirements. ``$`` Content of ``...`` when the property is exported using :command:`install(EXPORT)`, and empty otherwise. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index aaae457..bdf361e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3554,6 +3554,8 @@ void cmTarget::ExpandLinkItems(std::string const& prop, { cmGeneratorExpression ge; cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0); + // The $ expression may be in a link interface to specify private + // link dependencies that are otherwise excluded from usage requirements. if(usage_requirements_only) { dagChecker.SetTransitivePropertiesOnly(); @@ -6077,18 +6079,8 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, cmTarget const* headTarget, std::vector &tgts) const { - // The $ expression may be in a link interface to specify private - // link dependencies that are otherwise excluded from usage requirements. - // Currently $ is internal to CMake and only ever added by - // target_link_libraries for PRIVATE dependencies of STATIC libraries in - // INTERFACE_LINK_LIBRARIES which is used under CMP0022 NEW behavior. - bool usage_requirements_only = - this->GetType() == STATIC_LIBRARY && - this->GetPolicyStatusCMP0022() != cmPolicies::WARN && - this->GetPolicyStatusCMP0022() != cmPolicies::OLD; if(cmTarget::LinkInterface const* iface = - this->GetLinkInterfaceLibraries(config, headTarget, - usage_requirements_only)) + this->GetLinkInterfaceLibraries(config, headTarget, true)) { for(std::vector::const_iterator it = iface->Libraries.begin(); it != iface->Libraries.end(); ++it) diff --git a/Tests/InterfaceLinkLibraries/CMakeLists.txt b/Tests/InterfaceLinkLibraries/CMakeLists.txt index bd0cf74..9e14c44 100644 --- a/Tests/InterfaceLinkLibraries/CMakeLists.txt +++ b/Tests/InterfaceLinkLibraries/CMakeLists.txt @@ -9,6 +9,9 @@ target_compile_definitions(foo_shared INTERFACE FOO_LIBRARY) add_library(bar_shared SHARED bar_vs6_1.cpp) target_compile_definitions(bar_shared INTERFACE BAR_LIBRARY) set_property(TARGET bar_shared APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_shared) +add_library(zot_shared SHARED zot_vs6_1.cpp) +target_compile_definitions(zot_shared INTERFACE ZOT_LIBRARY) +set_property(TARGET bar_shared APPEND PROPERTY INTERFACE_LINK_LIBRARIES $) add_executable(shared_test main_vs6_1.cpp) set_property(TARGET shared_test APPEND PROPERTY LINK_LIBRARIES bar_shared) @@ -18,6 +21,9 @@ target_compile_definitions(foo_static INTERFACE FOO_LIBRARY) add_library(bar_static STATIC bar_vs6_2.cpp) target_compile_definitions(bar_static INTERFACE BAR_LIBRARY) set_property(TARGET bar_static APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_static) +add_library(zot_static STATIC zot_vs6_2.cpp) +target_compile_definitions(zot_static INTERFACE ZOT_LIBRARY) +set_property(TARGET bar_static APPEND PROPERTY INTERFACE_LINK_LIBRARIES $) add_executable(static_test main_vs6_2.cpp) set_property(TARGET static_test APPEND PROPERTY LINK_LIBRARIES bar_static) @@ -31,6 +37,9 @@ target_compile_definitions(bar_shared_private INTERFACE BAR_LIBRARY) target_compile_definitions(bar_shared_private PRIVATE BAR_USE_BANG) set_property(TARGET bar_shared_private APPEND PROPERTY LINK_LIBRARIES bang_shared_private) set_property(TARGET bar_shared_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_shared_private) +add_library(zot_shared_private SHARED zot_vs6_3.cpp) +target_compile_definitions(zot_shared_private INTERFACE ZOT_LIBRARY) +set_property(TARGET bar_shared_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES $) add_executable(shared_private_test main_vs6_3.cpp) set_property(TARGET shared_private_test APPEND PROPERTY LINK_LIBRARIES bar_shared_private) @@ -44,6 +53,9 @@ target_compile_definitions(bar_static_private INTERFACE BAR_LIBRARY) target_compile_definitions(bar_static_private PRIVATE BAR_USE_BANG) set_property(TARGET bar_static_private APPEND PROPERTY LINK_LIBRARIES bang_static_private) set_property(TARGET bar_static_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES $ foo_static_private) +add_library(zot_static_private STATIC zot_vs6_4.cpp) +target_compile_definitions(zot_static_private INTERFACE ZOT_LIBRARY) +set_property(TARGET bar_static_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES $) add_executable(InterfaceLinkLibraries main_vs6_4.cpp) set_property(TARGET InterfaceLinkLibraries APPEND PROPERTY LINK_LIBRARIES bar_static_private) diff --git a/Tests/InterfaceLinkLibraries/main.cpp b/Tests/InterfaceLinkLibraries/main.cpp index a54076a..6e1295a 100644 --- a/Tests/InterfaceLinkLibraries/main.cpp +++ b/Tests/InterfaceLinkLibraries/main.cpp @@ -11,9 +11,13 @@ #error Unexpected BANG_LIBRARY #endif -#include "bar.h" +#ifdef ZOT_LIBRARY +#error Unexpected ZOT_LIBRARY +#endif + +#include "zot.h" int main(void) { - return foo() + bar(); + return foo() + bar() + zot(); } diff --git a/Tests/InterfaceLinkLibraries/zot.cpp b/Tests/InterfaceLinkLibraries/zot.cpp new file mode 100644 index 0000000..69462b0 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot.cpp @@ -0,0 +1,6 @@ +#include "zot.h" + +int zot() +{ + return 0; +} diff --git a/Tests/InterfaceLinkLibraries/zot.h b/Tests/InterfaceLinkLibraries/zot.h new file mode 100644 index 0000000..5e4fb1e --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot.h @@ -0,0 +1,7 @@ + +#include "bar.h" + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int zot(); diff --git a/Tests/InterfaceLinkLibraries/zot_vs6_1.cpp b/Tests/InterfaceLinkLibraries/zot_vs6_1.cpp new file mode 100644 index 0000000..c588c5f --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot_vs6_1.cpp @@ -0,0 +1 @@ +#include "zot.cpp" diff --git a/Tests/InterfaceLinkLibraries/zot_vs6_2.cpp b/Tests/InterfaceLinkLibraries/zot_vs6_2.cpp new file mode 100644 index 0000000..c588c5f --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot_vs6_2.cpp @@ -0,0 +1 @@ +#include "zot.cpp" diff --git a/Tests/InterfaceLinkLibraries/zot_vs6_3.cpp b/Tests/InterfaceLinkLibraries/zot_vs6_3.cpp new file mode 100644 index 0000000..c588c5f --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot_vs6_3.cpp @@ -0,0 +1 @@ +#include "zot.cpp" diff --git a/Tests/InterfaceLinkLibraries/zot_vs6_4.cpp b/Tests/InterfaceLinkLibraries/zot_vs6_4.cpp new file mode 100644 index 0000000..c588c5f --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot_vs6_4.cpp @@ -0,0 +1 @@ +#include "zot.cpp" ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 7 +++++++ Source/cmTarget.cxx | 16 ++++------------ Tests/InterfaceLinkLibraries/CMakeLists.txt | 12 ++++++++++++ Tests/InterfaceLinkLibraries/main.cpp | 8 ++++++-- Tests/InterfaceLinkLibraries/zot.cpp | 6 ++++++ Tests/InterfaceLinkLibraries/{bar.h => zot.h} | 4 ++-- Tests/InterfaceLinkLibraries/zot_vs6_1.cpp | 1 + Tests/InterfaceLinkLibraries/zot_vs6_2.cpp | 1 + Tests/InterfaceLinkLibraries/zot_vs6_3.cpp | 1 + Tests/InterfaceLinkLibraries/zot_vs6_4.cpp | 1 + 10 files changed, 41 insertions(+), 16 deletions(-) create mode 100644 Tests/InterfaceLinkLibraries/zot.cpp copy Tests/InterfaceLinkLibraries/{bar.h => zot.h} (61%) create mode 100644 Tests/InterfaceLinkLibraries/zot_vs6_1.cpp create mode 100644 Tests/InterfaceLinkLibraries/zot_vs6_2.cpp create mode 100644 Tests/InterfaceLinkLibraries/zot_vs6_3.cpp create mode 100644 Tests/InterfaceLinkLibraries/zot_vs6_4.cpp hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 15 14:32:23 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 15 Jul 2014 14:32:23 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4267-g338096a Message-ID: <20140715183223.4441940475@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 338096a46bdf0c6354b0c6678de6717e386546ab (commit) via b8aa74842785fc6d5b56ad3745dbbcd9d93d257f (commit) from 9ba0ee21f31631968832bfe2174d7d8426ce3d8c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=338096a46bdf0c6354b0c6678de6717e386546ab commit 338096a46bdf0c6354b0c6678de6717e386546ab Merge: 9ba0ee2 b8aa748 Author: Brad King AuthorDate: Tue Jul 15 14:32:22 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 15 14:32:22 2014 -0400 Merge topic 'fix_Xcode_generator_name' into next b8aa7484 Tests: No SubDirSpaces on Xcode http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b8aa74842785fc6d5b56ad3745dbbcd9d93d257f commit b8aa74842785fc6d5b56ad3745dbbcd9d93d257f Author: Brad King AuthorDate: Tue Jul 15 14:33:21 2014 -0400 Commit: Brad King CommitDate: Tue Jul 15 14:33:21 2014 -0400 Tests: No SubDirSpaces on Xcode diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index d25986b..ca7fcdc 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1502,7 +1502,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) endif() - if(MAKE_SUPPORTS_SPACES) + if(MAKE_SUPPORTS_SPACES AND NOT CMAKE_GENERATOR STREQUAL "Xcode") add_test(SubDirSpaces ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubDirSpaces" ----------------------------------------------------------------------- Summary of changes: Tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From bill.hoffman at kitware.com Tue Jul 15 15:09:44 2014 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Tue, 15 Jul 2014 15:09:44 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4270-g35318f6 Message-ID: <20140715190944.C1DAF3F014@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 35318f60ed0af2b59a4bdb2b781b7af72bb3fc03 (commit) via 7a82885b41a63f6786489303c44351cbafe9b0c4 (commit) via 5f8a81b4d7a39007144fd1b0606a7ca3824d5928 (commit) from 338096a46bdf0c6354b0c6678de6717e386546ab (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=35318f60ed0af2b59a4bdb2b781b7af72bb3fc03 commit 35318f60ed0af2b59a4bdb2b781b7af72bb3fc03 Merge: 338096a 7a82885 Author: Bill Hoffman AuthorDate: Tue Jul 15 15:09:43 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 15 15:09:43 2014 -0400 Merge topic 'thread-sanitizer' into next 7a82885b Fix MemoryCheckType from ctest -T memcheck. 5f8a81b4 Add support for memory and leak sanitizer. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7a82885b41a63f6786489303c44351cbafe9b0c4 commit 7a82885b41a63f6786489303c44351cbafe9b0c4 Author: Bill Hoffman AuthorDate: Tue Jul 15 14:19:14 2014 -0400 Commit: Bill Hoffman CommitDate: Tue Jul 15 14:19:14 2014 -0400 Fix MemoryCheckType from ctest -T memcheck. Before this commit, you would have to run ctest -S mode to get MemoryCheckType to work. This is because CMAKE_COMMAND was not set. The fix was to use cmSystemTools::GetCMakeCommand instead. diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index 68fadf6..0420882 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -71,6 +71,7 @@ Compiler: @CMAKE_CXX_COMPILER@ PurifyCommand: @PURIFYCOMMAND@ ValgrindCommand: @VALGRIND_COMMAND@ ValgrindCommandOptions: @VALGRIND_COMMAND_OPTIONS@ +MemoryCheckType: @MEMORYCHECK_TYPE@ MemoryCheckCommand: @MEMORYCHECK_COMMAND@ MemoryCheckCommandOptions: @MEMORYCHECK_COMMAND_OPTIONS@ MemoryCheckSuppressionFile: @MEMORYCHECK_SUPPRESSIONS_FILE@ diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index a389359..ed57949 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -346,8 +346,8 @@ void cmCTestMemCheckHandler::PopulateCustomVectors(cmMakefile *mf) this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_MEMCHECK_IGNORE", this->CustomTestsIgnore); - this->CTest->SetCTestConfigurationFromCMakeVariable( - mf, "CMakeCommand", "CMAKE_COMMAND"); + std::string cmake = cmSystemTools::GetCMakeCommand(); + this->CTest->SetCTestConfiguration("CMakeCommand", cmake.c_str()); } //---------------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5f8a81b4d7a39007144fd1b0606a7ca3824d5928 commit 5f8a81b4d7a39007144fd1b0606a7ca3824d5928 Author: Bill Hoffman AuthorDate: Mon Jul 14 17:01:47 2014 -0400 Commit: Bill Hoffman CommitDate: Tue Jul 15 11:13:09 2014 -0400 Add support for memory and leak sanitizer. This adds support for memory and leak sanitizers. This is built into clang and gcc 4.8 and new compilers. It is activated with a -f switch during compile. diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index bcf09ad..a389359 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -45,11 +45,23 @@ static CatToErrorType cmCTestMemCheckBoundsChecker[] = { {0,0} }; +static void xmlReportError(int line, const char* msg, void* data) +{ + cmCTest* ctest = (cmCTest*)data; + cmCTestLog(ctest, ERROR_MESSAGE, + "Error parsing XML in stream at line " + << line << ": " << msg << std::endl); +} + // parse the xml file containing the results of last BoundsChecker run class cmBoundsCheckerParser : public cmXMLParser { public: - cmBoundsCheckerParser(cmCTest* c) { this->CTest = c;} + cmBoundsCheckerParser(cmCTest* c) + { + this->CTest = c; + this->SetErrorCallback(xmlReportError, (void*)c); + } void StartElement(const std::string& name, const char** atts) { if(name == "MemoryLeak" || @@ -361,6 +373,9 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) case cmCTestMemCheckHandler::THREAD_SANITIZER: os << "ThreadSanitizer"; break; + case cmCTestMemCheckHandler::ADDRESS_SANITIZER: + os << "AddressSanitizer"; + break; default: os << "Unknown"; } @@ -529,6 +544,14 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() this->MemoryTesterStyle = cmCTestMemCheckHandler::THREAD_SANITIZER; this->LogWithPID = true; // even if we give the log file the pid is added } + if ( this->CTest->GetCTestConfiguration("MemoryCheckType") + == "AddressSanitizer") + { + this->MemoryTester + = this->CTest->GetCTestConfiguration("CMakeCommand").c_str(); + this->MemoryTesterStyle = cmCTestMemCheckHandler::ADDRESS_SANITIZER; + this->LogWithPID = true; // even if we give the log file the pid is added + } // Check the MemoryCheckType if(this->MemoryTesterStyle == cmCTestMemCheckHandler::UNKNOWN) { @@ -651,6 +674,9 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() this->MemoryTesterOptions.push_back("/M"); break; } + // these two are almost the same but the env var used + // is different + case cmCTestMemCheckHandler::ADDRESS_SANITIZER: case cmCTestMemCheckHandler::THREAD_SANITIZER: { // To pass arguments to ThreadSanitizer the environment variable @@ -660,9 +686,16 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() // TSAN_OPTIONS string with the log_path in it. this->MemoryTesterDynamicOptions.push_back("-E"); this->MemoryTesterDynamicOptions.push_back("env"); - std::string outputFile = "TSAN_OPTIONS=log_path=\"" + std::string envVar = "TSAN_OPTIONS"; + std::string extraOptions; + if(this->MemoryTesterStyle == cmCTestMemCheckHandler::ADDRESS_SANITIZER) + { + envVar = "ASAN_OPTIONS"; + extraOptions = " detect_leaks=1"; + } + std::string outputFile = envVar + "=log_path=\"" + this->MemoryTesterOutputFile + "\""; - this->MemoryTesterEnvironmentVariable = outputFile; + this->MemoryTesterEnvironmentVariable = outputFile + extraOptions; break; } default: @@ -695,9 +728,11 @@ ProcessMemCheckOutput(const std::string& str, return this->ProcessMemCheckPurifyOutput(str, log, results); } else if ( this->MemoryTesterStyle == - cmCTestMemCheckHandler::THREAD_SANITIZER ) + cmCTestMemCheckHandler::THREAD_SANITIZER || + this->MemoryTesterStyle == + cmCTestMemCheckHandler::ADDRESS_SANITIZER) { - return this->ProcessMemCheckThreadSanitizerOutput(str, log, results); + return this->ProcessMemCheckSanitizerOutput(str, log, results); } else if ( this->MemoryTesterStyle == cmCTestMemCheckHandler::BOUNDS_CHECKER ) @@ -730,12 +765,21 @@ std::vector::size_type cmCTestMemCheckHandler::FindOrAddWarning( return this->ResultStrings.size()-1; } //---------------------------------------------------------------------- -bool cmCTestMemCheckHandler::ProcessMemCheckThreadSanitizerOutput( +bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput( const std::string& str, std::string& log, std::vector& result) { - cmsys::RegularExpression - sanitizerWarning("WARNING: ThreadSanitizer: (.*) \\(pid=.*\\)"); + std::string regex; + if(this->MemoryTesterStyle == cmCTestMemCheckHandler::THREAD_SANITIZER) + { + regex = "WARNING: ThreadSanitizer: (.*) \\(pid=.*\\)"; + } + else + { + regex = "ERROR: AddressSanitizer: (.*) on.*"; + } + cmsys::RegularExpression sanitizerWarning(regex); + cmsys::RegularExpression leakWarning("(Direct|Indirect) leak of .*"); int defects = 0; std::vector lines; cmSystemTools::Split(str.c_str(), lines); @@ -744,10 +788,18 @@ bool cmCTestMemCheckHandler::ProcessMemCheckThreadSanitizerOutput( for( std::vector::iterator i = lines.begin(); i != lines.end(); ++i) { - if(sanitizerWarning.find(*i)) + std::string resultFound; + if(leakWarning.find(*i)) + { + resultFound = leakWarning.match(1)+" leak"; + } + else if (sanitizerWarning.find(*i)) + { + resultFound = sanitizerWarning.match(1); + } + if(resultFound.size()) { - std::string warning = sanitizerWarning.match(1); - std::vector::size_type idx = this->FindOrAddWarning(warning); + std::vector::size_type idx = this->FindOrAddWarning(resultFound); if(result.size() == 0 || idx > result.size()-1) { result.push_back(1); diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index ffe57f6..2630fde 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -50,7 +50,8 @@ private: PURIFY, BOUNDS_CHECKER, // checkers after hear do not use the standard error list - THREAD_SANITIZER + THREAD_SANITIZER, + ADDRESS_SANITIZER }; public: enum { // Memory faults @@ -132,9 +133,9 @@ private: bool ProcessMemCheckPurifyOutput(const std::string& str, std::string& log, std::vector& results); - bool ProcessMemCheckThreadSanitizerOutput(const std::string& str, - std::string& log, - std::vector& results); + bool ProcessMemCheckSanitizerOutput(const std::string& str, + std::string& log, + std::vector& results); bool ProcessMemCheckBoundsCheckerOutput(const std::string& str, std::string& log, std::vector& results); diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx index a73fd70..391b874 100644 --- a/Source/cmXMLParser.cxx +++ b/Source/cmXMLParser.cxx @@ -20,6 +20,8 @@ cmXMLParser::cmXMLParser() { this->Parser = 0; this->ParseError = 0; + this->ReportCallback = 0; + this->ReportCallbackData = 0; } //---------------------------------------------------------------------------- @@ -233,6 +235,13 @@ void cmXMLParser::ReportXmlParseError() //---------------------------------------------------------------------------- void cmXMLParser::ReportError(int line, int, const char* msg) { - std::cerr << "Error parsing XML in stream at line " - << line << ": " << msg << std::endl; + if(this->ReportCallback) + { + this->ReportCallback(line, msg, this->ReportCallbackData); + } + else + { + std::cerr << "Error parsing XML in stream at line " + << line << ": " << msg << std::endl; + } } diff --git a/Source/cmXMLParser.h b/Source/cmXMLParser.h index 84a5a7d..e72da66 100644 --- a/Source/cmXMLParser.h +++ b/Source/cmXMLParser.h @@ -50,11 +50,18 @@ public: virtual int ParseChunk(const char* inputString, std::string::size_type length); virtual int CleanupParser(); - + typedef void (*ReportFunction)(int, const char*, void*); + void SetErrorCallback(ReportFunction f, void* d) + { + this->ReportCallback = f; + this->ReportCallbackData = d; + } protected: //! This variable is true if there was a parse error while parsing in //chunks. int ParseError; + ReportFunction ReportCallback; + void* ReportCallbackData; //1 Expat parser structure. Exists only during call to Parse(). void* Parser; diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index f470835..d16d432 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -113,9 +113,44 @@ set(CMAKELISTS_EXTRA_CODE -P \"${CMAKE_CURRENT_SOURCE_DIR}/testThreadSanitizer.cmake\") ") gen_mc_test_internal(DummyThreadSanitizer "" -DMEMCHECK_TYPE=ThreadSanitizer) +set_tests_properties(CTestTestMemcheckDummyThreadSanitizer PROPERTIES + PASS_REGULAR_EXPRESSION + ".*Memory checking results:.*data race.* - 1.*data race on vptr .ctor/dtor vs virtual call. - 1.*heap-use-after-free - 1.*thread leak - 1.*destroy of a locked mutex - 1.*double lock of a mutex - 1.*unlock of an unlocked mutex .or by a wrong thread. - 1.*read lock of a write locked mutex - 1.*read unlock of a write locked mutex - 1.*signal-unsafe call inside of a signal - 1.*signal handler spoils errno - 1.*lock-order-inversion .potential deadlock. - 1.*") set(CMAKELISTS_EXTRA_CODE ) set(CTEST_EXTRA_CODE) +# add LeakSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"report_bugs=1 history_size=5 exitcode=55\") +") + +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" +-P \"${CMAKE_CURRENT_SOURCE_DIR}/testLeakSanitizer.cmake\") +") +gen_mc_test_internal(DummyLeakSanitizer "" -DMEMCHECK_TYPE=AddressSanitizer) +set(CMAKELISTS_EXTRA_CODE ) +set(CTEST_EXTRA_CODE) +set_tests_properties(CTestTestMemcheckDummyLeakSanitizer PROPERTIES + PASS_REGULAR_EXPRESSION + ".*Memory checking results:.*Direct leak - 2.*Indirect leak - 1.*") +# add AddressSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"report_bugs=1 history_size=5 exitcode=55\") +") + +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" +-P \"${CMAKE_CURRENT_SOURCE_DIR}/testAddressSanitizer.cmake\") +") +gen_mc_test_internal(DummyAddressSanitizer "" -DMEMCHECK_TYPE=AddressSanitizer) +set(CMAKELISTS_EXTRA_CODE ) +set(CTEST_EXTRA_CODE) +set_tests_properties(CTestTestMemcheckDummyAddressSanitizer PROPERTIES + PASS_REGULAR_EXPRESSION + ".*Memory checking results:.*heap-buffer-overflow - 1.*") + + gen_mc_test(DummyPurify "\${PSEUDO_PURIFY}") gen_mc_test(DummyValgrind "\${PSEUDO_VALGRIND}") gen_mc_test(DummyBC "\${PSEUDO_BC}") @@ -202,10 +237,6 @@ set_tests_properties(CTestTestMemcheckDummyValgrindTwoTargets PROPERTIES PASS_REGULAR_EXPRESSION "\nMemory check project ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets\n.*\n *Start 1: RunCMake\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.1.log\" \"-q\".*\n *Start 2: RunCMakeAgain\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.2.log\" \"-q\".*\n") -set_tests_properties(CTestTestMemcheckDummyThreadSanitizer PROPERTIES - PASS_REGULAR_EXPRESSION - ".*Memory checking results:.*data race.* - 1.*data race on vptr .ctor/dtor vs virtual call. - 1.*heap-use-after-free - 1.*thread leak - 1.*destroy of a locked mutex - 1.*double lock of a mutex - 1.*unlock of an unlocked mutex .or by a wrong thread. - 1.*read lock of a write locked mutex - 1.*read unlock of a write locked mutex - 1.*signal-unsafe call inside of a signal - 1.*signal handler spoils errno - 1.*lock-order-inversion .potential deadlock. - 1.*") - # Xcode 2.x forgets to create the output directory before linking # the individual architectures. diff --git a/Tests/CTestTestMemcheck/testAddressSanitizer.cmake b/Tests/CTestTestMemcheck/testAddressSanitizer.cmake new file mode 100644 index 0000000..a359e28 --- /dev/null +++ b/Tests/CTestTestMemcheck/testAddressSanitizer.cmake @@ -0,0 +1,55 @@ +# this file simulates a program that has been built with thread sanitizer +# options + +message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]") +string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") +message("LOG_FILE=[${LOG_FILE}]") + +# clear the log file +file(REMOVE "${LOG_FILE}.2343") + +# create an error of each type of thread santizer +# these names come from tsan_report.cc in llvm + +file(APPEND "${LOG_FILE}.2343" +"================================================================= +==19278== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60080000bffc at pc 0x4009f1 bp 0x7fff82de6520 sp 0x7fff82de6518 +WRITE of size 4 at 0x60080000bffc thread T0 + #0 0x4009f0 (/home/kitware/msan/a.out+0x4009f0) + #1 0x7f18b02c876c (/lib/x86_64-linux-gnu/libc-2.15.so+0x2176c) + #2 0x400858 (/home/kitware/msan/a.out+0x400858) +0x60080000bffc is located 4 bytes to the right of 40-byte region [0x60080000bfd0,0x60080000bff8) +allocated by thread T0 here: + #0 0x7f18b088f9ca (/usr/lib/x86_64-linux-gnu/libasan.so.0.0.0+0x119ca) + #1 0x4009a2 (/home/kitware/msan/a.out+0x4009a2) + #2 0x7f18b02c876c (/lib/x86_64-linux-gnu/libc-2.15.so+0x2176c) +Shadow bytes around the buggy address: + 0x0c017fff97a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff97b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff97c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff97d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff97e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa +=>0x0c017fff97f0: fa fa fa fa fa fa fa fa fa fa 00 00 00 00 00[fa] + 0x0c017fff9800:fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff9810: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff9820: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff9830: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff9840: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa +Shadow byte legend (one shadow byte represents 8 application bytes): + Addressable: 00 + Partially addressable: 01 02 03 04 05 06 07 + Heap left redzone: fa + Heap righ redzone: fb + Freed Heap region: fd + Stack left redzone: f1 + Stack mid redzone: f2 + Stack right redzone: f3 + Stack partial redzone: f4 + Stack after return: f5 + Stack use after scope: f8 + Global redzone: f9 + Global init order: f6 + Poisoned by user: f7 + ASan internal: fe +==19278== ABORTING +") diff --git a/Tests/CTestTestMemcheck/testLeakSanitizer.cmake b/Tests/CTestTestMemcheck/testLeakSanitizer.cmake new file mode 100644 index 0000000..ca0a264 --- /dev/null +++ b/Tests/CTestTestMemcheck/testLeakSanitizer.cmake @@ -0,0 +1,36 @@ +# this file simulates a program that has been built with thread sanitizer +# options + +message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]") +string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") +message("LOG_FILE=[${LOG_FILE}]") + +# clear the log file +file(REMOVE "${LOG_FILE}.2343") + +# create an error of each type of thread santizer +# these names come from tsan_report.cc in llvm + +file(APPEND "${LOG_FILE}.2343" +"================================================================= +==25308==ERROR: LeakSanitizer: detected memory leaks + +Direct leak of 4360 byte(s) in 1 object(s) allocated from: + #0 0x46c669 in operator new[](unsigned long) (/home/kitware/msan/a.out+0x46c669) + #1 0x4823b4 in main /home/kitware/msan/memcheck.cxx:12 + #2 0x7fa72bee476c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 + +Direct leak of 76 byte(s) in 1 object(s) allocated from: + #0 0x46c669 in operator new[](unsigned long) (/home/kitware/msan/a.out+0x46c669) + #1 0x4821b8 in foo() /home/kitware/msan/memcheck.cxx:4 + #2 0x4823f2 in main /home/kitware/msan/memcheck.cxx:14 + #3 0x7fa72bee476c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 + +Indirect leak of 76 byte(s) in 1 object(s) allocated from: + #0 0x46c669 in operator new[](unsigned long) (/home/kitware/msan/a.out+0x46c669) + #1 0x4821b8 in foo() /home/kitware/msan/memcheck.cxx:4 + #2 0x4823f2 in main /home/kitware/msan/memcheck.cxx:14 + #3 0x7fa72bee476c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 + +SUMMARY: AddressSanitizer: 4436 byte(s) leaked in 2 allocation(s). +") ----------------------------------------------------------------------- Summary of changes: Modules/DartConfiguration.tcl.in | 1 + Source/CTest/cmCTestMemCheckHandler.cxx | 78 ++++++++++++++++---- Source/CTest/cmCTestMemCheckHandler.h | 9 ++- Source/cmXMLParser.cxx | 13 +++- Source/cmXMLParser.h | 9 ++- Tests/CTestTestMemcheck/CMakeLists.txt | 39 +++++++++- Tests/CTestTestMemcheck/testAddressSanitizer.cmake | 55 ++++++++++++++ Tests/CTestTestMemcheck/testLeakSanitizer.cmake | 36 +++++++++ 8 files changed, 216 insertions(+), 24 deletions(-) create mode 100644 Tests/CTestTestMemcheck/testAddressSanitizer.cmake create mode 100644 Tests/CTestTestMemcheck/testLeakSanitizer.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jul 16 00:02:21 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 16 Jul 2014 00:02:21 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1399-g3dce6aa Message-ID: <20140716040221.7164F403D3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 3dce6aa39d1dc2c1f88edebc91ab60de9d3ff6b1 (commit) from 49bf3e7d8daab2a1e7ba435d011618bd2c516766 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3dce6aa39d1dc2c1f88edebc91ab60de9d3ff6b1 commit 3dce6aa39d1dc2c1f88edebc91ab60de9d3ff6b1 Author: Kitware Robot AuthorDate: Wed Jul 16 00:01:13 2014 -0400 Commit: Kitware Robot CommitDate: Wed Jul 16 00:01:13 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9a1bcdd..e2849ca 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140715) +set(CMake_VERSION_PATCH 20140716) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 16 10:00:32 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 16 Jul 2014 10:00:32 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4273-g14ca24e Message-ID: <20140716140032.42B10402AA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 14ca24edb170aa43df9e8452f115b47e81687397 (commit) via 2427f523f629ee82847bc934be2cd6c6f1074560 (commit) via 54ed022ac89308fe24a473157f3c54d78b01c4e6 (commit) from 35318f60ed0af2b59a4bdb2b781b7af72bb3fc03 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=14ca24edb170aa43df9e8452f115b47e81687397 commit 14ca24edb170aa43df9e8452f115b47e81687397 Merge: 35318f6 2427f52 Author: Brad King AuthorDate: Wed Jul 16 10:00:31 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 16 10:00:31 2014 -0400 Merge topic 'fix_Xcode_generator_name' into next 2427f523 Tests: Xcode >= 3 passes SubDirSpaces 54ed022a Tests: Xcode < 2 is not multi-config http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2427f523f629ee82847bc934be2cd6c6f1074560 commit 2427f523f629ee82847bc934be2cd6c6f1074560 Author: Brad King AuthorDate: Wed Jul 16 09:59:15 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 09:59:15 2014 -0400 Tests: Xcode >= 3 passes SubDirSpaces diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index ca7fcdc..90cc9ef 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1502,7 +1502,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) endif() - if(MAKE_SUPPORTS_SPACES AND NOT CMAKE_GENERATOR STREQUAL "Xcode") + if(MAKE_SUPPORTS_SPACES AND + NOT (CMAKE_GENERATOR STREQUAL "Xcode" AND XCODE_VERSION VERSION_LESS 3)) add_test(SubDirSpaces ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubDirSpaces" http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=54ed022ac89308fe24a473157f3c54d78b01c4e6 commit 54ed022ac89308fe24a473157f3c54d78b01c4e6 Author: Brad King AuthorDate: Wed Jul 16 09:46:33 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 09:46:33 2014 -0400 Tests: Xcode < 2 is not multi-config diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 06272ce..ff3b9a0 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -18,6 +18,7 @@ endif() if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 2) set(TargetSources_ARGS -DXCODE_BELOW_2=1) + set(File_Generate_ARGS -DXCODE_BELOW_2=1) endif() add_RunCMake_test(CMP0019) diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index 145d312..dee0692 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -1,8 +1,8 @@ include(RunCMake) run_cmake(CommandConflict) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio" OR "${RunCMake_GENERATOR}" MATCHES "Xcode" ) - run_cmake(OutputConflict) +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode" AND NOT XCODE_BELOW_2) + run_cmake(OutputConflict) endif() run_cmake(EmptyCondition1) run_cmake(EmptyCondition2) ----------------------------------------------------------------------- Summary of changes: Tests/CMakeLists.txt | 3 ++- Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/File_Generate/RunCMakeTest.cmake | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 16 11:51:19 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 16 Jul 2014 11:51:19 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4276-g0218540 Message-ID: <20140716155119.233E9401D5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 02185409b19a0cf1caf57e29d7a90c1391f1425d (commit) via 1e005eadbc6e687217f484c0c2247a71124aa65e (commit) via 44726714322ca0b75628e234229f4583a480d7ec (commit) from 14ca24edb170aa43df9e8452f115b47e81687397 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=02185409b19a0cf1caf57e29d7a90c1391f1425d commit 02185409b19a0cf1caf57e29d7a90c1391f1425d Merge: 14ca24e 1e005ea Author: Brad King AuthorDate: Wed Jul 16 11:51:18 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 16 11:51:18 2014 -0400 Merge topic 'thread-sanitizer' into next 1e005ead CTest: Fix MemoryCheckType from 'ctest -T MemCheck' 44726714 ctest_memcheck: Add support for memory and leak sanitizer. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1e005eadbc6e687217f484c0c2247a71124aa65e commit 1e005eadbc6e687217f484c0c2247a71124aa65e Author: Bill Hoffman AuthorDate: Tue Jul 15 14:19:14 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 11:50:33 2014 -0400 CTest: Fix MemoryCheckType from 'ctest -T MemCheck' Before this commit, you would have to run ctest -S mode to get MemoryCheckType to work. This is because CMAKE_COMMAND was not set. The fix is to use cmSystemTools::GetCMakeCommand instead. diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index 68fadf6..0420882 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -71,6 +71,7 @@ Compiler: @CMAKE_CXX_COMPILER@ PurifyCommand: @PURIFYCOMMAND@ ValgrindCommand: @VALGRIND_COMMAND@ ValgrindCommandOptions: @VALGRIND_COMMAND_OPTIONS@ +MemoryCheckType: @MEMORYCHECK_TYPE@ MemoryCheckCommand: @MEMORYCHECK_COMMAND@ MemoryCheckCommandOptions: @MEMORYCHECK_COMMAND_OPTIONS@ MemoryCheckSuppressionFile: @MEMORYCHECK_SUPPRESSIONS_FILE@ diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index a389359..ed57949 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -346,8 +346,8 @@ void cmCTestMemCheckHandler::PopulateCustomVectors(cmMakefile *mf) this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_MEMCHECK_IGNORE", this->CustomTestsIgnore); - this->CTest->SetCTestConfigurationFromCMakeVariable( - mf, "CMakeCommand", "CMAKE_COMMAND"); + std::string cmake = cmSystemTools::GetCMakeCommand(); + this->CTest->SetCTestConfiguration("CMakeCommand", cmake.c_str()); } //---------------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=44726714322ca0b75628e234229f4583a480d7ec commit 44726714322ca0b75628e234229f4583a480d7ec Author: Bill Hoffman AuthorDate: Mon Jul 14 17:01:47 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 11:50:23 2014 -0400 ctest_memcheck: Add support for memory and leak sanitizer. This adds support for memory and leak sanitizers. This is built into clang and gcc 4.8 and new compilers. It is activated with a -f switch during compile. diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index bcf09ad..a389359 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -45,11 +45,23 @@ static CatToErrorType cmCTestMemCheckBoundsChecker[] = { {0,0} }; +static void xmlReportError(int line, const char* msg, void* data) +{ + cmCTest* ctest = (cmCTest*)data; + cmCTestLog(ctest, ERROR_MESSAGE, + "Error parsing XML in stream at line " + << line << ": " << msg << std::endl); +} + // parse the xml file containing the results of last BoundsChecker run class cmBoundsCheckerParser : public cmXMLParser { public: - cmBoundsCheckerParser(cmCTest* c) { this->CTest = c;} + cmBoundsCheckerParser(cmCTest* c) + { + this->CTest = c; + this->SetErrorCallback(xmlReportError, (void*)c); + } void StartElement(const std::string& name, const char** atts) { if(name == "MemoryLeak" || @@ -361,6 +373,9 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) case cmCTestMemCheckHandler::THREAD_SANITIZER: os << "ThreadSanitizer"; break; + case cmCTestMemCheckHandler::ADDRESS_SANITIZER: + os << "AddressSanitizer"; + break; default: os << "Unknown"; } @@ -529,6 +544,14 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() this->MemoryTesterStyle = cmCTestMemCheckHandler::THREAD_SANITIZER; this->LogWithPID = true; // even if we give the log file the pid is added } + if ( this->CTest->GetCTestConfiguration("MemoryCheckType") + == "AddressSanitizer") + { + this->MemoryTester + = this->CTest->GetCTestConfiguration("CMakeCommand").c_str(); + this->MemoryTesterStyle = cmCTestMemCheckHandler::ADDRESS_SANITIZER; + this->LogWithPID = true; // even if we give the log file the pid is added + } // Check the MemoryCheckType if(this->MemoryTesterStyle == cmCTestMemCheckHandler::UNKNOWN) { @@ -651,6 +674,9 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() this->MemoryTesterOptions.push_back("/M"); break; } + // these two are almost the same but the env var used + // is different + case cmCTestMemCheckHandler::ADDRESS_SANITIZER: case cmCTestMemCheckHandler::THREAD_SANITIZER: { // To pass arguments to ThreadSanitizer the environment variable @@ -660,9 +686,16 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() // TSAN_OPTIONS string with the log_path in it. this->MemoryTesterDynamicOptions.push_back("-E"); this->MemoryTesterDynamicOptions.push_back("env"); - std::string outputFile = "TSAN_OPTIONS=log_path=\"" + std::string envVar = "TSAN_OPTIONS"; + std::string extraOptions; + if(this->MemoryTesterStyle == cmCTestMemCheckHandler::ADDRESS_SANITIZER) + { + envVar = "ASAN_OPTIONS"; + extraOptions = " detect_leaks=1"; + } + std::string outputFile = envVar + "=log_path=\"" + this->MemoryTesterOutputFile + "\""; - this->MemoryTesterEnvironmentVariable = outputFile; + this->MemoryTesterEnvironmentVariable = outputFile + extraOptions; break; } default: @@ -695,9 +728,11 @@ ProcessMemCheckOutput(const std::string& str, return this->ProcessMemCheckPurifyOutput(str, log, results); } else if ( this->MemoryTesterStyle == - cmCTestMemCheckHandler::THREAD_SANITIZER ) + cmCTestMemCheckHandler::THREAD_SANITIZER || + this->MemoryTesterStyle == + cmCTestMemCheckHandler::ADDRESS_SANITIZER) { - return this->ProcessMemCheckThreadSanitizerOutput(str, log, results); + return this->ProcessMemCheckSanitizerOutput(str, log, results); } else if ( this->MemoryTesterStyle == cmCTestMemCheckHandler::BOUNDS_CHECKER ) @@ -730,12 +765,21 @@ std::vector::size_type cmCTestMemCheckHandler::FindOrAddWarning( return this->ResultStrings.size()-1; } //---------------------------------------------------------------------- -bool cmCTestMemCheckHandler::ProcessMemCheckThreadSanitizerOutput( +bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput( const std::string& str, std::string& log, std::vector& result) { - cmsys::RegularExpression - sanitizerWarning("WARNING: ThreadSanitizer: (.*) \\(pid=.*\\)"); + std::string regex; + if(this->MemoryTesterStyle == cmCTestMemCheckHandler::THREAD_SANITIZER) + { + regex = "WARNING: ThreadSanitizer: (.*) \\(pid=.*\\)"; + } + else + { + regex = "ERROR: AddressSanitizer: (.*) on.*"; + } + cmsys::RegularExpression sanitizerWarning(regex); + cmsys::RegularExpression leakWarning("(Direct|Indirect) leak of .*"); int defects = 0; std::vector lines; cmSystemTools::Split(str.c_str(), lines); @@ -744,10 +788,18 @@ bool cmCTestMemCheckHandler::ProcessMemCheckThreadSanitizerOutput( for( std::vector::iterator i = lines.begin(); i != lines.end(); ++i) { - if(sanitizerWarning.find(*i)) + std::string resultFound; + if(leakWarning.find(*i)) + { + resultFound = leakWarning.match(1)+" leak"; + } + else if (sanitizerWarning.find(*i)) + { + resultFound = sanitizerWarning.match(1); + } + if(resultFound.size()) { - std::string warning = sanitizerWarning.match(1); - std::vector::size_type idx = this->FindOrAddWarning(warning); + std::vector::size_type idx = this->FindOrAddWarning(resultFound); if(result.size() == 0 || idx > result.size()-1) { result.push_back(1); diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index ffe57f6..2630fde 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -50,7 +50,8 @@ private: PURIFY, BOUNDS_CHECKER, // checkers after hear do not use the standard error list - THREAD_SANITIZER + THREAD_SANITIZER, + ADDRESS_SANITIZER }; public: enum { // Memory faults @@ -132,9 +133,9 @@ private: bool ProcessMemCheckPurifyOutput(const std::string& str, std::string& log, std::vector& results); - bool ProcessMemCheckThreadSanitizerOutput(const std::string& str, - std::string& log, - std::vector& results); + bool ProcessMemCheckSanitizerOutput(const std::string& str, + std::string& log, + std::vector& results); bool ProcessMemCheckBoundsCheckerOutput(const std::string& str, std::string& log, std::vector& results); diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx index a73fd70..391b874 100644 --- a/Source/cmXMLParser.cxx +++ b/Source/cmXMLParser.cxx @@ -20,6 +20,8 @@ cmXMLParser::cmXMLParser() { this->Parser = 0; this->ParseError = 0; + this->ReportCallback = 0; + this->ReportCallbackData = 0; } //---------------------------------------------------------------------------- @@ -233,6 +235,13 @@ void cmXMLParser::ReportXmlParseError() //---------------------------------------------------------------------------- void cmXMLParser::ReportError(int line, int, const char* msg) { - std::cerr << "Error parsing XML in stream at line " - << line << ": " << msg << std::endl; + if(this->ReportCallback) + { + this->ReportCallback(line, msg, this->ReportCallbackData); + } + else + { + std::cerr << "Error parsing XML in stream at line " + << line << ": " << msg << std::endl; + } } diff --git a/Source/cmXMLParser.h b/Source/cmXMLParser.h index 84a5a7d..e72da66 100644 --- a/Source/cmXMLParser.h +++ b/Source/cmXMLParser.h @@ -50,11 +50,18 @@ public: virtual int ParseChunk(const char* inputString, std::string::size_type length); virtual int CleanupParser(); - + typedef void (*ReportFunction)(int, const char*, void*); + void SetErrorCallback(ReportFunction f, void* d) + { + this->ReportCallback = f; + this->ReportCallbackData = d; + } protected: //! This variable is true if there was a parse error while parsing in //chunks. int ParseError; + ReportFunction ReportCallback; + void* ReportCallbackData; //1 Expat parser structure. Exists only during call to Parse(). void* Parser; diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index f470835..d16d432 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -113,9 +113,44 @@ set(CMAKELISTS_EXTRA_CODE -P \"${CMAKE_CURRENT_SOURCE_DIR}/testThreadSanitizer.cmake\") ") gen_mc_test_internal(DummyThreadSanitizer "" -DMEMCHECK_TYPE=ThreadSanitizer) +set_tests_properties(CTestTestMemcheckDummyThreadSanitizer PROPERTIES + PASS_REGULAR_EXPRESSION + ".*Memory checking results:.*data race.* - 1.*data race on vptr .ctor/dtor vs virtual call. - 1.*heap-use-after-free - 1.*thread leak - 1.*destroy of a locked mutex - 1.*double lock of a mutex - 1.*unlock of an unlocked mutex .or by a wrong thread. - 1.*read lock of a write locked mutex - 1.*read unlock of a write locked mutex - 1.*signal-unsafe call inside of a signal - 1.*signal handler spoils errno - 1.*lock-order-inversion .potential deadlock. - 1.*") set(CMAKELISTS_EXTRA_CODE ) set(CTEST_EXTRA_CODE) +# add LeakSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"report_bugs=1 history_size=5 exitcode=55\") +") + +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" +-P \"${CMAKE_CURRENT_SOURCE_DIR}/testLeakSanitizer.cmake\") +") +gen_mc_test_internal(DummyLeakSanitizer "" -DMEMCHECK_TYPE=AddressSanitizer) +set(CMAKELISTS_EXTRA_CODE ) +set(CTEST_EXTRA_CODE) +set_tests_properties(CTestTestMemcheckDummyLeakSanitizer PROPERTIES + PASS_REGULAR_EXPRESSION + ".*Memory checking results:.*Direct leak - 2.*Indirect leak - 1.*") +# add AddressSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"report_bugs=1 history_size=5 exitcode=55\") +") + +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" +-P \"${CMAKE_CURRENT_SOURCE_DIR}/testAddressSanitizer.cmake\") +") +gen_mc_test_internal(DummyAddressSanitizer "" -DMEMCHECK_TYPE=AddressSanitizer) +set(CMAKELISTS_EXTRA_CODE ) +set(CTEST_EXTRA_CODE) +set_tests_properties(CTestTestMemcheckDummyAddressSanitizer PROPERTIES + PASS_REGULAR_EXPRESSION + ".*Memory checking results:.*heap-buffer-overflow - 1.*") + + gen_mc_test(DummyPurify "\${PSEUDO_PURIFY}") gen_mc_test(DummyValgrind "\${PSEUDO_VALGRIND}") gen_mc_test(DummyBC "\${PSEUDO_BC}") @@ -202,10 +237,6 @@ set_tests_properties(CTestTestMemcheckDummyValgrindTwoTargets PROPERTIES PASS_REGULAR_EXPRESSION "\nMemory check project ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets\n.*\n *Start 1: RunCMake\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.1.log\" \"-q\".*\n *Start 2: RunCMakeAgain\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.2.log\" \"-q\".*\n") -set_tests_properties(CTestTestMemcheckDummyThreadSanitizer PROPERTIES - PASS_REGULAR_EXPRESSION - ".*Memory checking results:.*data race.* - 1.*data race on vptr .ctor/dtor vs virtual call. - 1.*heap-use-after-free - 1.*thread leak - 1.*destroy of a locked mutex - 1.*double lock of a mutex - 1.*unlock of an unlocked mutex .or by a wrong thread. - 1.*read lock of a write locked mutex - 1.*read unlock of a write locked mutex - 1.*signal-unsafe call inside of a signal - 1.*signal handler spoils errno - 1.*lock-order-inversion .potential deadlock. - 1.*") - # Xcode 2.x forgets to create the output directory before linking # the individual architectures. diff --git a/Tests/CTestTestMemcheck/testAddressSanitizer.cmake b/Tests/CTestTestMemcheck/testAddressSanitizer.cmake new file mode 100644 index 0000000..a359e28 --- /dev/null +++ b/Tests/CTestTestMemcheck/testAddressSanitizer.cmake @@ -0,0 +1,55 @@ +# this file simulates a program that has been built with thread sanitizer +# options + +message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]") +string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") +message("LOG_FILE=[${LOG_FILE}]") + +# clear the log file +file(REMOVE "${LOG_FILE}.2343") + +# create an error of each type of thread santizer +# these names come from tsan_report.cc in llvm + +file(APPEND "${LOG_FILE}.2343" +"================================================================= +==19278== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60080000bffc at pc 0x4009f1 bp 0x7fff82de6520 sp 0x7fff82de6518 +WRITE of size 4 at 0x60080000bffc thread T0 + #0 0x4009f0 (/home/kitware/msan/a.out+0x4009f0) + #1 0x7f18b02c876c (/lib/x86_64-linux-gnu/libc-2.15.so+0x2176c) + #2 0x400858 (/home/kitware/msan/a.out+0x400858) +0x60080000bffc is located 4 bytes to the right of 40-byte region [0x60080000bfd0,0x60080000bff8) +allocated by thread T0 here: + #0 0x7f18b088f9ca (/usr/lib/x86_64-linux-gnu/libasan.so.0.0.0+0x119ca) + #1 0x4009a2 (/home/kitware/msan/a.out+0x4009a2) + #2 0x7f18b02c876c (/lib/x86_64-linux-gnu/libc-2.15.so+0x2176c) +Shadow bytes around the buggy address: + 0x0c017fff97a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff97b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff97c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff97d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff97e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa +=>0x0c017fff97f0: fa fa fa fa fa fa fa fa fa fa 00 00 00 00 00[fa] + 0x0c017fff9800:fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff9810: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff9820: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff9830: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff9840: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa +Shadow byte legend (one shadow byte represents 8 application bytes): + Addressable: 00 + Partially addressable: 01 02 03 04 05 06 07 + Heap left redzone: fa + Heap righ redzone: fb + Freed Heap region: fd + Stack left redzone: f1 + Stack mid redzone: f2 + Stack right redzone: f3 + Stack partial redzone: f4 + Stack after return: f5 + Stack use after scope: f8 + Global redzone: f9 + Global init order: f6 + Poisoned by user: f7 + ASan internal: fe +==19278== ABORTING +") diff --git a/Tests/CTestTestMemcheck/testLeakSanitizer.cmake b/Tests/CTestTestMemcheck/testLeakSanitizer.cmake new file mode 100644 index 0000000..ca0a264 --- /dev/null +++ b/Tests/CTestTestMemcheck/testLeakSanitizer.cmake @@ -0,0 +1,36 @@ +# this file simulates a program that has been built with thread sanitizer +# options + +message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]") +string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") +message("LOG_FILE=[${LOG_FILE}]") + +# clear the log file +file(REMOVE "${LOG_FILE}.2343") + +# create an error of each type of thread santizer +# these names come from tsan_report.cc in llvm + +file(APPEND "${LOG_FILE}.2343" +"================================================================= +==25308==ERROR: LeakSanitizer: detected memory leaks + +Direct leak of 4360 byte(s) in 1 object(s) allocated from: + #0 0x46c669 in operator new[](unsigned long) (/home/kitware/msan/a.out+0x46c669) + #1 0x4823b4 in main /home/kitware/msan/memcheck.cxx:12 + #2 0x7fa72bee476c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 + +Direct leak of 76 byte(s) in 1 object(s) allocated from: + #0 0x46c669 in operator new[](unsigned long) (/home/kitware/msan/a.out+0x46c669) + #1 0x4821b8 in foo() /home/kitware/msan/memcheck.cxx:4 + #2 0x4823f2 in main /home/kitware/msan/memcheck.cxx:14 + #3 0x7fa72bee476c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 + +Indirect leak of 76 byte(s) in 1 object(s) allocated from: + #0 0x46c669 in operator new[](unsigned long) (/home/kitware/msan/a.out+0x46c669) + #1 0x4821b8 in foo() /home/kitware/msan/memcheck.cxx:4 + #2 0x4823f2 in main /home/kitware/msan/memcheck.cxx:14 + #3 0x7fa72bee476c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 + +SUMMARY: AddressSanitizer: 4436 byte(s) leaked in 2 allocation(s). +") ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 16 11:51:22 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 16 Jul 2014 11:51:22 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1402-g66e88af Message-ID: <20140716155122.5D4EB401D7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 66e88af6d0e3fab6cba6876cf26dd30ebbb733fb (commit) via 1e005eadbc6e687217f484c0c2247a71124aa65e (commit) via 44726714322ca0b75628e234229f4583a480d7ec (commit) from 3dce6aa39d1dc2c1f88edebc91ab60de9d3ff6b1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=66e88af6d0e3fab6cba6876cf26dd30ebbb733fb commit 66e88af6d0e3fab6cba6876cf26dd30ebbb733fb Merge: 3dce6aa 1e005ea Author: Brad King AuthorDate: Wed Jul 16 11:51:21 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 16 11:51:21 2014 -0400 Merge topic 'thread-sanitizer' 1e005ead CTest: Fix MemoryCheckType from 'ctest -T MemCheck' 44726714 ctest_memcheck: Add support for memory and leak sanitizer. ----------------------------------------------------------------------- Summary of changes: Modules/DartConfiguration.tcl.in | 1 + Source/CTest/cmCTestMemCheckHandler.cxx | 78 ++++++++++++++++---- Source/CTest/cmCTestMemCheckHandler.h | 9 ++- Source/cmXMLParser.cxx | 13 +++- Source/cmXMLParser.h | 9 ++- Tests/CTestTestMemcheck/CMakeLists.txt | 39 +++++++++- Tests/CTestTestMemcheck/testAddressSanitizer.cmake | 55 ++++++++++++++ Tests/CTestTestMemcheck/testLeakSanitizer.cmake | 36 +++++++++ 8 files changed, 216 insertions(+), 24 deletions(-) create mode 100644 Tests/CTestTestMemcheck/testAddressSanitizer.cmake create mode 100644 Tests/CTestTestMemcheck/testLeakSanitizer.cmake hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 16 11:51:49 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 16 Jul 2014 11:51:49 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4279-g16b94d3 Message-ID: <20140716155149.5237D4022B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 16b94d3aed1dfb26279c1b5f445d7e4314e4bfea (commit) via 66e88af6d0e3fab6cba6876cf26dd30ebbb733fb (commit) via 3dce6aa39d1dc2c1f88edebc91ab60de9d3ff6b1 (commit) from 02185409b19a0cf1caf57e29d7a90c1391f1425d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=16b94d3aed1dfb26279c1b5f445d7e4314e4bfea commit 16b94d3aed1dfb26279c1b5f445d7e4314e4bfea Merge: 0218540 66e88af Author: Brad King AuthorDate: Wed Jul 16 11:52:56 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 11:52:56 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 16 12:50:10 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 16 Jul 2014 12:50:10 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4281-g36d8b35 Message-ID: <20140716165011.E64F2400FC@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 36d8b35b267b4fa11d16f53b8f0c088ced6500d5 (commit) via a94565ab204030537011516b63640df3feee0cf1 (commit) from 16b94d3aed1dfb26279c1b5f445d7e4314e4bfea (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=36d8b35b267b4fa11d16f53b8f0c088ced6500d5 commit 36d8b35b267b4fa11d16f53b8f0c088ced6500d5 Merge: 16b94d3 a94565a Author: Brad King AuthorDate: Wed Jul 16 12:50:09 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 16 12:50:09 2014 -0400 Merge topic 'compile-with-cray' into next a94565ab cmcurl: Fix a build failure with the Cray compiler on Linux (#15026) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a94565ab204030537011516b63640df3feee0cf1 commit a94565ab204030537011516b63640df3feee0cf1 Author: Chuck Atkins AuthorDate: Wed Jul 16 09:04:42 2014 -0500 Commit: Brad King CommitDate: Wed Jul 16 12:49:45 2014 -0400 cmcurl: Fix a build failure with the Cray compiler on Linux (#15026) The error is caused by a workaround for UNICOS. The workaround incorrectly uses the _CRAYC macro to determine if building for UNICOS. This macro will always be defined for the Cray C and C++ compiler regardless of the target platform, even when building for Linux. The correct macro should be _CRAY, which as per Cray documentation is only defined for UNICOS targeted builds. diff --git a/Utilities/cmcurl/hostip.c b/Utilities/cmcurl/hostip.c index fd555ef..83f1564 100644 --- a/Utilities/cmcurl/hostip.c +++ b/Utilities/cmcurl/hostip.c @@ -609,7 +609,7 @@ Curl_addrinfo *Curl_ip2addr(in_addr_t num, const char *hostname, int port) h = &buf->hostentry; h->h_addr_list = &buf->h_addr_list[0]; addrentry = &buf->addrentry; -#ifdef _CRAYC +#ifdef _CRAY /* On UNICOS, s_addr is a bit field and for some reason assigning to it * doesn't work. There must be a better fix than this ugly hack. */ ----------------------------------------------------------------------- Summary of changes: Utilities/cmcurl/hostip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 16 13:04:22 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 16 Jul 2014 13:04:22 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1411-ga0dc135 Message-ID: <20140716170422.CA63F407F2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a0dc1354fe5effa1ff484b441595f8bdb6da3533 (commit) via 1ca0c0e94ac39c895d5896b0193cbc7b963ff087 (commit) via 102eea60cd636e06ab87bc94a4b326682d7464f1 (commit) via b0f57408512b194923b6c9e5e79a08bc324c552e (commit) via c69e8a5580bd034dcaa1d7d53976200600b26b82 (commit) via 4db3990e9f3c11add85cba339b7a976f6f0fd3c5 (commit) via 4b8130b8de223674d567bdff5e156b1bdc1d5c27 (commit) via 4c763dd1f1c922606660e275372cc6313ac42535 (commit) via 190cabe7c1641482529bba34d46a38e4e33a2384 (commit) from 66e88af6d0e3fab6cba6876cf26dd30ebbb733fb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a0dc1354fe5effa1ff484b441595f8bdb6da3533 commit a0dc1354fe5effa1ff484b441595f8bdb6da3533 Merge: 66e88af 1ca0c0e Author: Brad King AuthorDate: Wed Jul 16 13:04:21 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 16 13:04:21 2014 -0400 Merge topic 'refactor-link-internals' 1ca0c0e9 cmTarget: Refactor internal imported LinkInterface map 102eea60 cmTarget: Simplify internal ComputeLinkInterfaceLibraries method b0f57408 cmTarget: Move ComputeLinkInterfaceLibraries to internals c69e8a55 cmTarget: Refactor internal LinkInterface map 4db3990e cmTarget: Drop 'head' argument from processSources 4b8130b8 cmTarget: Drop 'head' argument from GetSourceFiles 4c763dd1 cmTarget: Drop 'head' argument from GetLanguages 190cabe7 cmTarget: Drop 'head' argument from ComputeLinkImplementationLanguages ----------------------------------------------------------------------- Summary of changes: Source/cmTarget.cxx | 207 +++++++++++++++++++++++---------------------------- Source/cmTarget.h | 18 +---- 2 files changed, 97 insertions(+), 128 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 16 13:04:39 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 16 Jul 2014 13:04:39 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4283-gb9a2f27 Message-ID: <20140716170439.04438407F2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via b9a2f277a51aa87b142fa0f7b1e38b47f4dce2c5 (commit) via a0dc1354fe5effa1ff484b441595f8bdb6da3533 (commit) from 36d8b35b267b4fa11d16f53b8f0c088ced6500d5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b9a2f277a51aa87b142fa0f7b1e38b47f4dce2c5 commit b9a2f277a51aa87b142fa0f7b1e38b47f4dce2c5 Merge: 36d8b35 a0dc135 Author: Brad King AuthorDate: Wed Jul 16 13:05:52 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 13:05:52 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 16 13:06:34 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 16 Jul 2014 13:06:34 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4286-gbc237a1 Message-ID: <20140716170634.4D33C4080B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via bc237a1a2acace345b93ef313767e81e92461d2e (commit) via 63032f691bded7691c6c12581cccdedd1eaf4d78 (commit) via 989b2512fe6641e9cab8db0e2dbc8ec17ba6980d (commit) from b9a2f277a51aa87b142fa0f7b1e38b47f4dce2c5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bc237a1a2acace345b93ef313767e81e92461d2e commit bc237a1a2acace345b93ef313767e81e92461d2e Merge: b9a2f27 63032f6 Author: Brad King AuthorDate: Wed Jul 16 13:06:33 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 16 13:06:33 2014 -0400 Merge topic 'generalize-LINK_ONLY' into next 63032f69 Honor $ when checking interface properties 989b2512 Make $ available to projects (#14751) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=63032f691bded7691c6c12581cccdedd1eaf4d78 commit 63032f691bded7691c6c12581cccdedd1eaf4d78 Author: Brad King AuthorDate: Tue Jul 15 11:34:02 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 13:07:19 2014 -0400 Honor $ when checking interface properties Callers of cmTarget::GetLinkImplementationClosure are interested in the set of targets whose interface properties propagate to the current target. This excludes targets guarded by $. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ffdeb6a..cdece87 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6018,7 +6018,7 @@ void processILibs(const std::string& config, { tgts.push_back(item.Target); if(cmTarget::LinkInterface const* iface = - item.Target->GetLinkInterfaceLibraries(config, headTarget, false)) + item.Target->GetLinkInterfaceLibraries(config, headTarget, true)) { for(std::vector::const_iterator it = iface->Libraries.begin(); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=989b2512fe6641e9cab8db0e2dbc8ec17ba6980d commit 989b2512fe6641e9cab8db0e2dbc8ec17ba6980d Author: Brad King AuthorDate: Tue Jul 15 11:14:49 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 13:07:19 2014 -0400 Make $ available to projects (#14751) Previously this generator expression was used internally by the target_link_libraries command to honor private linking requirements of static libraries in their INTERFACE_LINK_LIBRARIES. Remove the check that limits $ to this use case to make it available for project code to use too. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 9e82674..bc24798 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -188,6 +188,13 @@ property is non-empty:: Marks ``...`` as being the name of a target. This is required if exporting targets to multiple dependent export sets. The ``...`` must be a literal name of a target- it may not contain generator expressions. +``$`` + Content of ``...`` except when evaluated in a link interface while + propagating :ref:`Target Usage Requirements`, in which case it is the + empty string. + Intended for use only in an :prop_tgt:`INTERFACE_LINK_LIBRARIES` target + property, perhaps via the :command:`target_link_libraries` command, + to specify private link dependencies without other usage requirements. ``$`` Content of ``...`` when the property is exported using :command:`install(EXPORT)`, and empty otherwise. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b4688c4..ffdeb6a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3555,6 +3555,8 @@ void cmTarget::ExpandLinkItems(std::string const& prop, { cmGeneratorExpression ge; cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0); + // The $ expression may be in a link interface to specify private + // link dependencies that are otherwise excluded from usage requirements. if(usage_requirements_only) { dagChecker.SetTransitivePropertiesOnly(); @@ -6057,18 +6059,8 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, cmTarget const* headTarget, std::vector &tgts) const { - // The $ expression may be in a link interface to specify private - // link dependencies that are otherwise excluded from usage requirements. - // Currently $ is internal to CMake and only ever added by - // target_link_libraries for PRIVATE dependencies of STATIC libraries in - // INTERFACE_LINK_LIBRARIES which is used under CMP0022 NEW behavior. - bool usage_requirements_only = - this->GetType() == STATIC_LIBRARY && - this->GetPolicyStatusCMP0022() != cmPolicies::WARN && - this->GetPolicyStatusCMP0022() != cmPolicies::OLD; if(cmTarget::LinkInterface const* iface = - this->GetLinkInterfaceLibraries(config, headTarget, - usage_requirements_only)) + this->GetLinkInterfaceLibraries(config, headTarget, true)) { for(std::vector::const_iterator it = iface->Libraries.begin(); it != iface->Libraries.end(); ++it) diff --git a/Tests/InterfaceLinkLibraries/CMakeLists.txt b/Tests/InterfaceLinkLibraries/CMakeLists.txt index bd0cf74..9e14c44 100644 --- a/Tests/InterfaceLinkLibraries/CMakeLists.txt +++ b/Tests/InterfaceLinkLibraries/CMakeLists.txt @@ -9,6 +9,9 @@ target_compile_definitions(foo_shared INTERFACE FOO_LIBRARY) add_library(bar_shared SHARED bar_vs6_1.cpp) target_compile_definitions(bar_shared INTERFACE BAR_LIBRARY) set_property(TARGET bar_shared APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_shared) +add_library(zot_shared SHARED zot_vs6_1.cpp) +target_compile_definitions(zot_shared INTERFACE ZOT_LIBRARY) +set_property(TARGET bar_shared APPEND PROPERTY INTERFACE_LINK_LIBRARIES $) add_executable(shared_test main_vs6_1.cpp) set_property(TARGET shared_test APPEND PROPERTY LINK_LIBRARIES bar_shared) @@ -18,6 +21,9 @@ target_compile_definitions(foo_static INTERFACE FOO_LIBRARY) add_library(bar_static STATIC bar_vs6_2.cpp) target_compile_definitions(bar_static INTERFACE BAR_LIBRARY) set_property(TARGET bar_static APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_static) +add_library(zot_static STATIC zot_vs6_2.cpp) +target_compile_definitions(zot_static INTERFACE ZOT_LIBRARY) +set_property(TARGET bar_static APPEND PROPERTY INTERFACE_LINK_LIBRARIES $) add_executable(static_test main_vs6_2.cpp) set_property(TARGET static_test APPEND PROPERTY LINK_LIBRARIES bar_static) @@ -31,6 +37,9 @@ target_compile_definitions(bar_shared_private INTERFACE BAR_LIBRARY) target_compile_definitions(bar_shared_private PRIVATE BAR_USE_BANG) set_property(TARGET bar_shared_private APPEND PROPERTY LINK_LIBRARIES bang_shared_private) set_property(TARGET bar_shared_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_shared_private) +add_library(zot_shared_private SHARED zot_vs6_3.cpp) +target_compile_definitions(zot_shared_private INTERFACE ZOT_LIBRARY) +set_property(TARGET bar_shared_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES $) add_executable(shared_private_test main_vs6_3.cpp) set_property(TARGET shared_private_test APPEND PROPERTY LINK_LIBRARIES bar_shared_private) @@ -44,6 +53,9 @@ target_compile_definitions(bar_static_private INTERFACE BAR_LIBRARY) target_compile_definitions(bar_static_private PRIVATE BAR_USE_BANG) set_property(TARGET bar_static_private APPEND PROPERTY LINK_LIBRARIES bang_static_private) set_property(TARGET bar_static_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES $ foo_static_private) +add_library(zot_static_private STATIC zot_vs6_4.cpp) +target_compile_definitions(zot_static_private INTERFACE ZOT_LIBRARY) +set_property(TARGET bar_static_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES $) add_executable(InterfaceLinkLibraries main_vs6_4.cpp) set_property(TARGET InterfaceLinkLibraries APPEND PROPERTY LINK_LIBRARIES bar_static_private) diff --git a/Tests/InterfaceLinkLibraries/main.cpp b/Tests/InterfaceLinkLibraries/main.cpp index a54076a..6e1295a 100644 --- a/Tests/InterfaceLinkLibraries/main.cpp +++ b/Tests/InterfaceLinkLibraries/main.cpp @@ -11,9 +11,13 @@ #error Unexpected BANG_LIBRARY #endif -#include "bar.h" +#ifdef ZOT_LIBRARY +#error Unexpected ZOT_LIBRARY +#endif + +#include "zot.h" int main(void) { - return foo() + bar(); + return foo() + bar() + zot(); } diff --git a/Tests/InterfaceLinkLibraries/zot.cpp b/Tests/InterfaceLinkLibraries/zot.cpp new file mode 100644 index 0000000..69462b0 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot.cpp @@ -0,0 +1,6 @@ +#include "zot.h" + +int zot() +{ + return 0; +} diff --git a/Tests/InterfaceLinkLibraries/zot.h b/Tests/InterfaceLinkLibraries/zot.h new file mode 100644 index 0000000..5e4fb1e --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot.h @@ -0,0 +1,7 @@ + +#include "bar.h" + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int zot(); diff --git a/Tests/InterfaceLinkLibraries/zot_vs6_1.cpp b/Tests/InterfaceLinkLibraries/zot_vs6_1.cpp new file mode 100644 index 0000000..c588c5f --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot_vs6_1.cpp @@ -0,0 +1 @@ +#include "zot.cpp" diff --git a/Tests/InterfaceLinkLibraries/zot_vs6_2.cpp b/Tests/InterfaceLinkLibraries/zot_vs6_2.cpp new file mode 100644 index 0000000..c588c5f --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot_vs6_2.cpp @@ -0,0 +1 @@ +#include "zot.cpp" diff --git a/Tests/InterfaceLinkLibraries/zot_vs6_3.cpp b/Tests/InterfaceLinkLibraries/zot_vs6_3.cpp new file mode 100644 index 0000000..c588c5f --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot_vs6_3.cpp @@ -0,0 +1 @@ +#include "zot.cpp" diff --git a/Tests/InterfaceLinkLibraries/zot_vs6_4.cpp b/Tests/InterfaceLinkLibraries/zot_vs6_4.cpp new file mode 100644 index 0000000..c588c5f --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot_vs6_4.cpp @@ -0,0 +1 @@ +#include "zot.cpp" ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 16 13:27:10 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 16 Jul 2014 13:27:10 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4288-gf63c00f Message-ID: <20140716172710.611294051D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f63c00f8b5257c41f3369cebf79a3217de3141d0 (commit) via 3b5f2b5dfbf9231922f8939339b6f78ed227ef9c (commit) from bc237a1a2acace345b93ef313767e81e92461d2e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f63c00f8b5257c41f3369cebf79a3217de3141d0 commit f63c00f8b5257c41f3369cebf79a3217de3141d0 Merge: bc237a1 3b5f2b5 Author: Brad King AuthorDate: Wed Jul 16 13:27:09 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 16 13:27:09 2014 -0400 Merge topic 'generalize-LINK_ONLY' into next 3b5f2b5d Tests: Teach CompatibleInterface to cover suppression with LINK_ONLY http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3b5f2b5dfbf9231922f8939339b6f78ed227ef9c commit 3b5f2b5dfbf9231922f8939339b6f78ed227ef9c Author: Brad King AuthorDate: Wed Jul 16 13:20:51 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 13:26:46 2014 -0400 Tests: Teach CompatibleInterface to cover suppression with LINK_ONLY diff --git a/Tests/CompatibleInterface/CMakeLists.txt b/Tests/CompatibleInterface/CMakeLists.txt index 350b518..668a97b 100644 --- a/Tests/CompatibleInterface/CMakeLists.txt +++ b/Tests/CompatibleInterface/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.0) project(CompatibleInterface) @@ -54,6 +54,15 @@ set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP2 200) add_executable(CompatibleInterface main.cpp) target_link_libraries(CompatibleInterface iface1) +add_library(foo STATIC foo.cpp) +add_library(bar SHARED bar.cpp) +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMEPROP) +set_property(TARGET foo PROPERTY INTERFACE_SOMEPROP ON) +# Use LINK_ONLY to suppress usage requirements and allow the check to pass. +set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES $) +set_property(TARGET CompatibleInterface PROPERTY SOMEPROP OFF) +target_link_libraries(CompatibleInterface bar) + set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP2 ON) set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP3 ON) set_property(TARGET CompatibleInterface PROPERTY STRING_PROP2 prop2) diff --git a/Tests/CompatibleInterface/bar.cpp b/Tests/CompatibleInterface/bar.cpp new file mode 100644 index 0000000..2e09900 --- /dev/null +++ b/Tests/CompatibleInterface/bar.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int bar() +{ + return 0; +} diff --git a/Tests/CompatibleInterface/foo.cpp b/Tests/CompatibleInterface/foo.cpp new file mode 100644 index 0000000..e05eb7e --- /dev/null +++ b/Tests/CompatibleInterface/foo.cpp @@ -0,0 +1,4 @@ +int foo() +{ + return 0; +} diff --git a/Tests/CompatibleInterface/main.cpp b/Tests/CompatibleInterface/main.cpp index e23625a..d20b64b 100644 --- a/Tests/CompatibleInterface/main.cpp +++ b/Tests/CompatibleInterface/main.cpp @@ -40,8 +40,14 @@ enum { #include "iface2.h" +int foo(); +#ifdef _WIN32 +__declspec(dllimport) +#endif +int bar(); + int main(int argc, char **argv) { Iface2 if2; - return if2.foo(); + return if2.foo() + foo() + bar(); } ----------------------------------------------------------------------- Summary of changes: Tests/CompatibleInterface/CMakeLists.txt | 11 ++++++++++- .../CMP0026/empty.cpp => CompatibleInterface/bar.cpp} | 2 +- .../DummyCXXFile.cxx => Tests/CompatibleInterface/foo.cpp | 2 +- Tests/CompatibleInterface/main.cpp | 8 +++++++- 4 files changed, 19 insertions(+), 4 deletions(-) copy Tests/{RunCMake/CMP0026/empty.cpp => CompatibleInterface/bar.cpp} (83%) copy Modules/DummyCXXFile.cxx => Tests/CompatibleInterface/foo.cpp (59%) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 16 13:28:51 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 16 Jul 2014 13:28:51 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4291-g20c6cc6 Message-ID: <20140716172851.4696E40599@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 20c6cc63a86f2a10e07d540e51aa29d6d5fcb4d1 (commit) via 6e7e881c57e8ff7295a1007d329708143b54baad (commit) via 0400cd5dd1be33ebcc2c2d5dba8233a78b1cee68 (commit) from f63c00f8b5257c41f3369cebf79a3217de3141d0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=20c6cc63a86f2a10e07d540e51aa29d6d5fcb4d1 commit 20c6cc63a86f2a10e07d540e51aa29d6d5fcb4d1 Merge: f63c00f 6e7e881 Author: Brad King AuthorDate: Wed Jul 16 13:28:50 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 16 13:28:50 2014 -0400 Merge topic 'generalize-LINK_ONLY' into next 6e7e881c Honor $ when checking interface properties 0400cd5d Make $ available to projects (#14751) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6e7e881c57e8ff7295a1007d329708143b54baad commit 6e7e881c57e8ff7295a1007d329708143b54baad Author: Brad King AuthorDate: Tue Jul 15 11:34:02 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 13:28:47 2014 -0400 Honor $ when checking interface properties Callers of cmTarget::GetLinkImplementationClosure are interested in the set of targets whose interface properties propagate to the current target. This excludes targets guarded by $. Teach the CompatibleInterface test to cover suppression of interface compatibility tests with $. Although this is not recommended in practice, it is a way of covering the above behavior. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ffdeb6a..cdece87 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6018,7 +6018,7 @@ void processILibs(const std::string& config, { tgts.push_back(item.Target); if(cmTarget::LinkInterface const* iface = - item.Target->GetLinkInterfaceLibraries(config, headTarget, false)) + item.Target->GetLinkInterfaceLibraries(config, headTarget, true)) { for(std::vector::const_iterator it = iface->Libraries.begin(); diff --git a/Tests/CompatibleInterface/CMakeLists.txt b/Tests/CompatibleInterface/CMakeLists.txt index 350b518..668a97b 100644 --- a/Tests/CompatibleInterface/CMakeLists.txt +++ b/Tests/CompatibleInterface/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.0) project(CompatibleInterface) @@ -54,6 +54,15 @@ set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP2 200) add_executable(CompatibleInterface main.cpp) target_link_libraries(CompatibleInterface iface1) +add_library(foo STATIC foo.cpp) +add_library(bar SHARED bar.cpp) +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMEPROP) +set_property(TARGET foo PROPERTY INTERFACE_SOMEPROP ON) +# Use LINK_ONLY to suppress usage requirements and allow the check to pass. +set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES $) +set_property(TARGET CompatibleInterface PROPERTY SOMEPROP OFF) +target_link_libraries(CompatibleInterface bar) + set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP2 ON) set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP3 ON) set_property(TARGET CompatibleInterface PROPERTY STRING_PROP2 prop2) diff --git a/Tests/CompatibleInterface/bar.cpp b/Tests/CompatibleInterface/bar.cpp new file mode 100644 index 0000000..2e09900 --- /dev/null +++ b/Tests/CompatibleInterface/bar.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int bar() +{ + return 0; +} diff --git a/Tests/CompatibleInterface/foo.cpp b/Tests/CompatibleInterface/foo.cpp new file mode 100644 index 0000000..e05eb7e --- /dev/null +++ b/Tests/CompatibleInterface/foo.cpp @@ -0,0 +1,4 @@ +int foo() +{ + return 0; +} diff --git a/Tests/CompatibleInterface/main.cpp b/Tests/CompatibleInterface/main.cpp index e23625a..d20b64b 100644 --- a/Tests/CompatibleInterface/main.cpp +++ b/Tests/CompatibleInterface/main.cpp @@ -40,8 +40,14 @@ enum { #include "iface2.h" +int foo(); +#ifdef _WIN32 +__declspec(dllimport) +#endif +int bar(); + int main(int argc, char **argv) { Iface2 if2; - return if2.foo(); + return if2.foo() + foo() + bar(); } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0400cd5dd1be33ebcc2c2d5dba8233a78b1cee68 commit 0400cd5dd1be33ebcc2c2d5dba8233a78b1cee68 Author: Brad King AuthorDate: Tue Jul 15 11:14:49 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 13:28:44 2014 -0400 Make $ available to projects (#14751) Previously this generator expression was used internally by the target_link_libraries command to honor private linking requirements of static libraries in their INTERFACE_LINK_LIBRARIES. Remove the check that limits $ to this use case to make it available for project code to use too. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 9e82674..bc24798 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -188,6 +188,13 @@ property is non-empty:: Marks ``...`` as being the name of a target. This is required if exporting targets to multiple dependent export sets. The ``...`` must be a literal name of a target- it may not contain generator expressions. +``$`` + Content of ``...`` except when evaluated in a link interface while + propagating :ref:`Target Usage Requirements`, in which case it is the + empty string. + Intended for use only in an :prop_tgt:`INTERFACE_LINK_LIBRARIES` target + property, perhaps via the :command:`target_link_libraries` command, + to specify private link dependencies without other usage requirements. ``$`` Content of ``...`` when the property is exported using :command:`install(EXPORT)`, and empty otherwise. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b4688c4..ffdeb6a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3555,6 +3555,8 @@ void cmTarget::ExpandLinkItems(std::string const& prop, { cmGeneratorExpression ge; cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0); + // The $ expression may be in a link interface to specify private + // link dependencies that are otherwise excluded from usage requirements. if(usage_requirements_only) { dagChecker.SetTransitivePropertiesOnly(); @@ -6057,18 +6059,8 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, cmTarget const* headTarget, std::vector &tgts) const { - // The $ expression may be in a link interface to specify private - // link dependencies that are otherwise excluded from usage requirements. - // Currently $ is internal to CMake and only ever added by - // target_link_libraries for PRIVATE dependencies of STATIC libraries in - // INTERFACE_LINK_LIBRARIES which is used under CMP0022 NEW behavior. - bool usage_requirements_only = - this->GetType() == STATIC_LIBRARY && - this->GetPolicyStatusCMP0022() != cmPolicies::WARN && - this->GetPolicyStatusCMP0022() != cmPolicies::OLD; if(cmTarget::LinkInterface const* iface = - this->GetLinkInterfaceLibraries(config, headTarget, - usage_requirements_only)) + this->GetLinkInterfaceLibraries(config, headTarget, true)) { for(std::vector::const_iterator it = iface->Libraries.begin(); it != iface->Libraries.end(); ++it) diff --git a/Tests/InterfaceLinkLibraries/CMakeLists.txt b/Tests/InterfaceLinkLibraries/CMakeLists.txt index bd0cf74..9e14c44 100644 --- a/Tests/InterfaceLinkLibraries/CMakeLists.txt +++ b/Tests/InterfaceLinkLibraries/CMakeLists.txt @@ -9,6 +9,9 @@ target_compile_definitions(foo_shared INTERFACE FOO_LIBRARY) add_library(bar_shared SHARED bar_vs6_1.cpp) target_compile_definitions(bar_shared INTERFACE BAR_LIBRARY) set_property(TARGET bar_shared APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_shared) +add_library(zot_shared SHARED zot_vs6_1.cpp) +target_compile_definitions(zot_shared INTERFACE ZOT_LIBRARY) +set_property(TARGET bar_shared APPEND PROPERTY INTERFACE_LINK_LIBRARIES $) add_executable(shared_test main_vs6_1.cpp) set_property(TARGET shared_test APPEND PROPERTY LINK_LIBRARIES bar_shared) @@ -18,6 +21,9 @@ target_compile_definitions(foo_static INTERFACE FOO_LIBRARY) add_library(bar_static STATIC bar_vs6_2.cpp) target_compile_definitions(bar_static INTERFACE BAR_LIBRARY) set_property(TARGET bar_static APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_static) +add_library(zot_static STATIC zot_vs6_2.cpp) +target_compile_definitions(zot_static INTERFACE ZOT_LIBRARY) +set_property(TARGET bar_static APPEND PROPERTY INTERFACE_LINK_LIBRARIES $) add_executable(static_test main_vs6_2.cpp) set_property(TARGET static_test APPEND PROPERTY LINK_LIBRARIES bar_static) @@ -31,6 +37,9 @@ target_compile_definitions(bar_shared_private INTERFACE BAR_LIBRARY) target_compile_definitions(bar_shared_private PRIVATE BAR_USE_BANG) set_property(TARGET bar_shared_private APPEND PROPERTY LINK_LIBRARIES bang_shared_private) set_property(TARGET bar_shared_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_shared_private) +add_library(zot_shared_private SHARED zot_vs6_3.cpp) +target_compile_definitions(zot_shared_private INTERFACE ZOT_LIBRARY) +set_property(TARGET bar_shared_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES $) add_executable(shared_private_test main_vs6_3.cpp) set_property(TARGET shared_private_test APPEND PROPERTY LINK_LIBRARIES bar_shared_private) @@ -44,6 +53,9 @@ target_compile_definitions(bar_static_private INTERFACE BAR_LIBRARY) target_compile_definitions(bar_static_private PRIVATE BAR_USE_BANG) set_property(TARGET bar_static_private APPEND PROPERTY LINK_LIBRARIES bang_static_private) set_property(TARGET bar_static_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES $ foo_static_private) +add_library(zot_static_private STATIC zot_vs6_4.cpp) +target_compile_definitions(zot_static_private INTERFACE ZOT_LIBRARY) +set_property(TARGET bar_static_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES $) add_executable(InterfaceLinkLibraries main_vs6_4.cpp) set_property(TARGET InterfaceLinkLibraries APPEND PROPERTY LINK_LIBRARIES bar_static_private) diff --git a/Tests/InterfaceLinkLibraries/main.cpp b/Tests/InterfaceLinkLibraries/main.cpp index a54076a..6e1295a 100644 --- a/Tests/InterfaceLinkLibraries/main.cpp +++ b/Tests/InterfaceLinkLibraries/main.cpp @@ -11,9 +11,13 @@ #error Unexpected BANG_LIBRARY #endif -#include "bar.h" +#ifdef ZOT_LIBRARY +#error Unexpected ZOT_LIBRARY +#endif + +#include "zot.h" int main(void) { - return foo() + bar(); + return foo() + bar() + zot(); } diff --git a/Tests/InterfaceLinkLibraries/zot.cpp b/Tests/InterfaceLinkLibraries/zot.cpp new file mode 100644 index 0000000..69462b0 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot.cpp @@ -0,0 +1,6 @@ +#include "zot.h" + +int zot() +{ + return 0; +} diff --git a/Tests/InterfaceLinkLibraries/zot.h b/Tests/InterfaceLinkLibraries/zot.h new file mode 100644 index 0000000..5e4fb1e --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot.h @@ -0,0 +1,7 @@ + +#include "bar.h" + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int zot(); diff --git a/Tests/InterfaceLinkLibraries/zot_vs6_1.cpp b/Tests/InterfaceLinkLibraries/zot_vs6_1.cpp new file mode 100644 index 0000000..c588c5f --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot_vs6_1.cpp @@ -0,0 +1 @@ +#include "zot.cpp" diff --git a/Tests/InterfaceLinkLibraries/zot_vs6_2.cpp b/Tests/InterfaceLinkLibraries/zot_vs6_2.cpp new file mode 100644 index 0000000..c588c5f --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot_vs6_2.cpp @@ -0,0 +1 @@ +#include "zot.cpp" diff --git a/Tests/InterfaceLinkLibraries/zot_vs6_3.cpp b/Tests/InterfaceLinkLibraries/zot_vs6_3.cpp new file mode 100644 index 0000000..c588c5f --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot_vs6_3.cpp @@ -0,0 +1 @@ +#include "zot.cpp" diff --git a/Tests/InterfaceLinkLibraries/zot_vs6_4.cpp b/Tests/InterfaceLinkLibraries/zot_vs6_4.cpp new file mode 100644 index 0000000..c588c5f --- /dev/null +++ b/Tests/InterfaceLinkLibraries/zot_vs6_4.cpp @@ -0,0 +1 @@ +#include "zot.cpp" ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 16 14:22:10 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 16 Jul 2014 14:22:10 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4301-g3703c03 Message-ID: <20140716182210.09E573FE9B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 3703c03888e80c56f5bfebc72f6b10fa59f9a8c7 (commit) via c45dd669abe746de2e9724044591d70397653d98 (commit) via 89095514a7f6d7075e8d2fda1b88445b87a3bec8 (commit) via 9d72df45057afd955d6bbb7ee2ceb62ab8dc777a (commit) via d5f0743d0f97fb44bcfaafd8680a00631d1c7d40 (commit) via 60bafeb68404dc37434644f56e98000b3b0fff81 (commit) via 8cb9105431bcc4bd206d92b7cd53cebdb1a783bd (commit) via 0a8fbac19a1d12adaa10873cc8fdb3dff164c981 (commit) via fb3518dc81ac1b776503d4369c6d375a706485d1 (commit) via 535fd6ce6d514deebc8c95424df83f73989f55a5 (commit) from 20c6cc63a86f2a10e07d540e51aa29d6d5fcb4d1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3703c03888e80c56f5bfebc72f6b10fa59f9a8c7 commit 3703c03888e80c56f5bfebc72f6b10fa59f9a8c7 Merge: 20c6cc6 c45dd66 Author: Brad King AuthorDate: Wed Jul 16 14:22:08 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 16 14:22:08 2014 -0400 Merge topic 'refactor-link-internals' into next c45dd669 cmTarget: Cache compatible interface property sets 89095514 cmTarget: Refactor GetLinkImplementationClosure internals 9d72df45 Genex: Adjust code layout slightly d5f0743d Genex: Refactor empty element strip 60bafeb6 Genex: Avoid repeated search of transitive property whitelist 8cb91054 Genex: Simplify TARGET_PROPERTY transitive lookup 0a8fbac1 cmTarget: Drop GetTransitivePropertyTargets method fb3518dc Refactor system include annotation propagation 535fd6ce cmTarget: Make GetLink*Libraries methods safer to use http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c45dd669abe746de2e9724044591d70397653d98 commit c45dd669abe746de2e9724044591d70397653d98 Author: Brad King AuthorDate: Wed Jul 16 11:16:28 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 13:38:22 2014 -0400 cmTarget: Cache compatible interface property sets Replace isLinkDependentProperty with a CompatibleInterfaces structure that records all the compatible interface properties in a set for each type. This avoids repeatedly traversing the link implementation closure and asking every target for its compatible interface properties. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d3a9beb..29029eb 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -171,6 +171,13 @@ public: }; std::map LinkImplClosureMap; + struct CompatibleInterfaces: public cmTarget::CompatibleInterfaces + { + CompatibleInterfaces(): Done(false) {} + bool Done; + }; + std::map CompatibleInterfacesMap; + typedef std::map > SourceFilesMapType; SourceFilesMapType SourceFilesMap; @@ -5303,44 +5310,6 @@ const char * cmTarget::GetLinkInterfaceDependentNumberMaxProperty( } //---------------------------------------------------------------------------- -bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p, - const std::string& interfaceProperty, - const std::string& config) -{ - std::vector const& deps = - tgt->GetLinkImplementationClosure(config); - - if(deps.empty()) - { - return false; - } - - for(std::vector::const_iterator li = deps.begin(); - li != deps.end(); ++li) - { - const char *prop = (*li)->GetProperty(interfaceProperty); - if (!prop) - { - continue; - } - - std::vector props; - cmSystemTools::ExpandListArgument(prop, props); - - for(std::vector::iterator pi = props.begin(); - pi != props.end(); ++pi) - { - if (*pi == p) - { - return true; - } - } - } - - return false; -} - -//---------------------------------------------------------------------------- bool cmTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p, const std::string& config) const { @@ -5349,9 +5318,7 @@ bool cmTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p, { return false; } - return (p == "POSITION_INDEPENDENT_CODE") || - isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_BOOL", - config); + return this->GetCompatibleInterfaces(config).PropsBool.count(p) > 0; } //---------------------------------------------------------------------------- @@ -5363,9 +5330,7 @@ bool cmTarget::IsLinkInterfaceDependentStringProperty(const std::string &p, { return false; } - return (p == "AUTOUIC_OPTIONS") || - isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_STRING", - config); + return this->GetCompatibleInterfaces(config).PropsString.count(p) > 0; } //---------------------------------------------------------------------------- @@ -5377,8 +5342,7 @@ bool cmTarget::IsLinkInterfaceDependentNumberMinProperty(const std::string &p, { return false; } - return isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_NUMBER_MIN", - config); + return this->GetCompatibleInterfaces(config).PropsNumberMin.count(p) > 0; } //---------------------------------------------------------------------------- @@ -5390,8 +5354,7 @@ bool cmTarget::IsLinkInterfaceDependentNumberMaxProperty(const std::string &p, { return false; } - return isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_NUMBER_MAX", - config); + return this->GetCompatibleInterfaces(config).PropsNumberMax.count(p) > 0; } //---------------------------------------------------------------------------- @@ -6059,6 +6022,40 @@ cmTarget::GetLinkImplementationClosure(const std::string& config) const } //---------------------------------------------------------------------------- +cmTarget::CompatibleInterfaces const& +cmTarget::GetCompatibleInterfaces(std::string const& config) const +{ + cmTargetInternals::CompatibleInterfaces& compat = + this->Internal->CompatibleInterfacesMap[config]; + if(!compat.Done) + { + compat.Done = true; + compat.PropsBool.insert("POSITION_INDEPENDENT_CODE"); + compat.PropsString.insert("AUTOUIC_OPTIONS"); + std::vector const& deps = + this->GetLinkImplementationClosure(config); + for(std::vector::const_iterator li = deps.begin(); + li != deps.end(); ++li) + { +#define CM_READ_COMPATIBLE_INTERFACE(X, x) \ + if(const char* prop = (*li)->GetProperty("COMPATIBLE_INTERFACE_" #X)) \ + { \ + std::vector props; \ + cmSystemTools::ExpandListArgument(prop, props); \ + std::copy(props.begin(), props.end(), \ + std::inserter(compat.Props##x, compat.Props##x.begin())); \ + } + CM_READ_COMPATIBLE_INTERFACE(BOOL, Bool) + CM_READ_COMPATIBLE_INTERFACE(STRING, String) + CM_READ_COMPATIBLE_INTERFACE(NUMBER_MIN, NumberMin) + CM_READ_COMPATIBLE_INTERFACE(NUMBER_MAX, NumberMax) +#undef CM_READ_COMPATIBLE_INTERFACE + } + } + return compat; +} + +//---------------------------------------------------------------------------- void cmTargetInternals::ComputeLinkInterfaceLibraries( cmTarget const* thisTarget, diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 1271272..486315e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -300,6 +300,16 @@ public: std::vector const& GetLinkImplementationClosure(const std::string& config) const; + struct CompatibleInterfaces + { + std::set PropsBool; + std::set PropsString; + std::set PropsNumberMax; + std::set PropsNumberMin; + }; + CompatibleInterfaces const& + GetCompatibleInterfaces(std::string const& config) const; + /** The link implementation specifies the direct library dependencies needed by the object files of the target. */ struct LinkImplementationLibraries http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=89095514a7f6d7075e8d2fda1b88445b87a3bec8 commit 89095514a7f6d7075e8d2fda1b88445b87a3bec8 Author: Brad King AuthorDate: Wed Jul 16 12:58:19 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 13:38:22 2014 -0400 cmTarget: Refactor GetLinkImplementationClosure internals Store the 'Done' flag directly in each map entry instead of using a separate map. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 8185bcc..d3a9beb 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -164,6 +164,13 @@ public: typedef std::map LinkClosureMapType; LinkClosureMapType LinkClosureMap; + struct LinkImplClosure: public std::vector + { + LinkImplClosure(): Done(false) {} + bool Done; + }; + std::map LinkImplClosureMap; + typedef std::map > SourceFilesMapType; SourceFilesMapType SourceFilesMap; @@ -203,15 +210,12 @@ public: CachedLinkInterfaceSourcesEntries; std::map > CachedLinkInterfaceCompileFeaturesEntries; - std::map > - CachedLinkImplementationClosure; std::map CacheLinkInterfaceIncludeDirectoriesDone; std::map CacheLinkInterfaceCompileDefinitionsDone; std::map CacheLinkInterfaceCompileOptionsDone; std::map CacheLinkInterfaceSourcesDone; std::map CacheLinkInterfaceCompileFeaturesDone; - std::map CacheLinkImplementationClosureDone; }; cmLinkImplItem cmTargetInternals::TargetPropertyEntry::NoLinkImplItem; @@ -6034,11 +6038,11 @@ void processILibs(const std::string& config, std::vector const& cmTarget::GetLinkImplementationClosure(const std::string& config) const { - std::vector& tgts = - this->Internal->CachedLinkImplementationClosure[config]; - if(!this->Internal->CacheLinkImplementationClosureDone[config]) + cmTargetInternals::LinkImplClosure& tgts = + this->Internal->LinkImplClosureMap[config]; + if(!tgts.Done) { - this->Internal->CacheLinkImplementationClosureDone[config] = true; + tgts.Done = true; std::set emitted; cmTarget::LinkImplementationLibraries const* impl http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9d72df45057afd955d6bbb7ee2ceb62ab8dc777a commit 9d72df45057afd955d6bbb7ee2ceb62ab8dc777a Author: Brad King AuthorDate: Tue Jul 15 15:19:44 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 13:31:30 2014 -0400 Genex: Adjust code layout slightly diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index db1d180..28879f1 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1039,8 +1039,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD( ASSERT_TRANSITIVE_PROPERTY_METHOD) false); - } #undef ASSERT_TRANSITIVE_PROPERTY_METHOD + } } std::string linkedTargetsContent; @@ -1090,9 +1090,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode } else if(!interfacePropertyName.empty()) { - const cmTarget::LinkImplementationLibraries *impl - = target->GetLinkImplementationLibraries(context->Config); - if(impl) + if(cmTarget::LinkImplementationLibraries const* impl = + target->GetLinkImplementationLibraries(context->Config)) { linkedTargetsContent = getLinkedTargetsContent(impl->Libraries, target, http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d5f0743d0f97fb44bcfaafd8680a00631d1c7d40 commit d5f0743d0f97fb44bcfaafd8680a00631d1c7d40 Author: Brad King AuthorDate: Tue Jul 15 15:22:08 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 13:31:30 2014 -0400 Genex: Refactor empty element strip In cmGeneratorExpressionEvaluator, teach getLinkedTargetsContent to call cmGeneratorExpression::StripEmptyListElements to transform its return value so that callers do not have to do so. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index ddcc39d..db1d180 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -841,6 +841,8 @@ getLinkedTargetsContent( context->HadContextSensitiveCondition = true; } } + linkedTargetsContent = + cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); return linkedTargetsContent; } @@ -1100,9 +1102,6 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode } } - linkedTargetsContent = - cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); - if (!prop) { if (target->IsImported() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=60bafeb68404dc37434644f56e98000b3b0fff81 commit 60bafeb68404dc37434644f56e98000b3b0fff81 Author: Brad King AuthorDate: Tue Jul 15 15:18:05 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 13:31:30 2014 -0400 Genex: Avoid repeated search of transitive property whitelist In cmGeneratorExpressionEvaluator, avoid searching through the list of transitive interface property names repeatedly during evaluation of TargetPropertyNode. Simply record the results of the first search for later re-use. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index d08c3c9..ddcc39d 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1044,12 +1044,18 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode std::string linkedTargetsContent; std::string interfacePropertyName; + bool isInterfaceProperty = false; #define POPULATE_INTERFACE_PROPERTY_NAME(prop) \ - if (propertyName == #prop || propertyName == "INTERFACE_" #prop) \ + if (propertyName == #prop) \ { \ interfacePropertyName = "INTERFACE_" #prop; \ } \ + else if (propertyName == "INTERFACE_" #prop) \ + { \ + interfacePropertyName = "INTERFACE_" #prop; \ + isInterfaceProperty = true; \ + } \ else CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(POPULATE_INTERFACE_PROPERTY_NAME) @@ -1065,17 +1071,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode } } #undef POPULATE_INTERFACE_PROPERTY_NAME - cmTarget const* headTarget = context->HeadTarget ? context->HeadTarget : target; - const char * const *transBegin = - cmArrayBegin(targetPropertyTransitiveWhitelist) + 1; - const char * const *transEnd = - cmArrayEnd(targetPropertyTransitiveWhitelist); - - if (std::find_if(transBegin, transEnd, - cmStrCmp(propertyName)) != transEnd) + if(isInterfaceProperty) { if(cmTarget::LinkInterfaceLibraries const* iface = target->GetLinkInterfaceLibraries(context->Config, headTarget, true)) @@ -1087,18 +1086,17 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode interfacePropertyName); } } - else if (std::find_if(transBegin, transEnd, - cmStrCmp(interfacePropertyName)) != transEnd) + else if(!interfacePropertyName.empty()) { const cmTarget::LinkImplementationLibraries *impl = target->GetLinkImplementationLibraries(context->Config); if(impl) { linkedTargetsContent = - getLinkedTargetsContent(impl->Libraries, target, - headTarget, - context, &dagChecker, - interfacePropertyName); + getLinkedTargetsContent(impl->Libraries, target, + headTarget, + context, &dagChecker, + interfacePropertyName); } } @@ -1178,32 +1176,27 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode return propContent ? propContent : ""; } } - for (size_t i = 1; - i < cmArraySize(targetPropertyTransitiveWhitelist); - ++i) + if(!interfacePropertyName.empty()) { - if (targetPropertyTransitiveWhitelist[i] == interfacePropertyName) - { - cmGeneratorExpression ge(&context->Backtrace); - cmsys::auto_ptr cge = ge.Parse(prop); - cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); - std::string result = cge->Evaluate(context->Makefile, + cmGeneratorExpression ge(&context->Backtrace); + cmsys::auto_ptr cge = ge.Parse(prop); + cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); + std::string result = cge->Evaluate(context->Makefile, context->Config, context->Quiet, headTarget, target, &dagChecker); - if (cge->GetHadContextSensitiveCondition()) - { - context->HadContextSensitiveCondition = true; - } - if (!linkedTargetsContent.empty()) - { - result += (result.empty() ? "" : ";") + linkedTargetsContent; - } - return result; + if (cge->GetHadContextSensitiveCondition()) + { + context->HadContextSensitiveCondition = true; + } + if (!linkedTargetsContent.empty()) + { + result += (result.empty() ? "" : ";") + linkedTargetsContent; } + return result; } return prop; } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8cb9105431bcc4bd206d92b7cd53cebdb1a783bd commit 8cb9105431bcc4bd206d92b7cd53cebdb1a783bd Author: Brad King AuthorDate: Tue Jul 15 11:50:32 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 13:31:30 2014 -0400 Genex: Simplify TARGET_PROPERTY transitive lookup In cmGeneratorExpressionEvaluator, make getLinkedTargetsContent a template so it can traverse over either the Libraries in a cmTarget LinkImplementationLibraries or a cmTarget LinkInterfaceLibraries. This also avoids creating a separate vector. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 19b3e16..d08c3c9 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -799,70 +799,49 @@ static const char* targetPropertyTransitiveWhitelist[] = { #undef TRANSITIVE_PROPERTY_NAME +template std::string getLinkedTargetsContent( - std::vector &targets, + std::vector const &libraries, cmTarget const* target, cmTarget const* headTarget, cmGeneratorExpressionContext *context, cmGeneratorExpressionDAGChecker *dagChecker, const std::string &interfacePropertyName) { - cmGeneratorExpression ge(&context->Backtrace); - + std::string linkedTargetsContent; std::string sep; std::string depString; - for (std::vector::const_iterator - it = targets.begin(); - it != targets.end(); ++it) + for (typename std::vector::const_iterator it = libraries.begin(); + it != libraries.end(); ++it) { - if (*it == target) - { - // Broken code can have a target in its own link interface. - // Don't follow such link interface entries so as not to create a - // self-referencing loop. - continue; + // Broken code can have a target in its own link interface. + // Don't follow such link interface entries so as not to create a + // self-referencing loop. + if (it->Target && it->Target != target) + { + depString += + sep + "$Target->GetName() + "," + interfacePropertyName + ">"; + sep = ";"; } - depString += - sep + "$GetName() + "," + interfacePropertyName + ">"; - sep = ";"; } - cmsys::auto_ptr cge = ge.Parse(depString); - std::string linkedTargetsContent = cge->Evaluate(target->GetMakefile(), - context->Config, - context->Quiet, - headTarget, - target, - dagChecker); - if (cge->GetHadContextSensitiveCondition()) - { - context->HadContextSensitiveCondition = true; - } - return linkedTargetsContent; -} - -std::string -getLinkedTargetsContent( - std::vector const &libraries, - cmTarget const* target, - cmTarget const* headTarget, - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker, - const std::string &interfacePropertyName) -{ - std::vector tgts; - for (std::vector::const_iterator - it = libraries.begin(); - it != libraries.end(); ++it) + if(!depString.empty()) { - if (it->Target) - { - tgts.push_back(it->Target); + cmGeneratorExpression ge(&context->Backtrace); + cmsys::auto_ptr cge = ge.Parse(depString); + linkedTargetsContent = cge->Evaluate(target->GetMakefile(), + context->Config, + context->Quiet, + headTarget, + target, + dagChecker); + if (cge->GetHadContextSensitiveCondition()) + { + context->HadContextSensitiveCondition = true; } } - return getLinkedTargetsContent(tgts, target, headTarget, context, - dagChecker, interfacePropertyName); + return linkedTargetsContent; } //---------------------------------------------------------------------------- @@ -1098,27 +1077,14 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode if (std::find_if(transBegin, transEnd, cmStrCmp(propertyName)) != transEnd) { - std::vector tgts; if(cmTarget::LinkInterfaceLibraries const* iface = target->GetLinkInterfaceLibraries(context->Config, headTarget, true)) { - for(std::vector::const_iterator - it = iface->Libraries.begin(); - it != iface->Libraries.end(); ++it) - { - if (it->Target) - { - tgts.push_back(it->Target); - } - } - } - if (!tgts.empty()) - { linkedTargetsContent = - getLinkedTargetsContent(tgts, target, - headTarget, - context, &dagChecker, - interfacePropertyName); + getLinkedTargetsContent(iface->Libraries, target, + headTarget, + context, &dagChecker, + interfacePropertyName); } } else if (std::find_if(transBegin, transEnd, http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0a8fbac19a1d12adaa10873cc8fdb3dff164c981 commit 0a8fbac19a1d12adaa10873cc8fdb3dff164c981 Author: Brad King AuthorDate: Tue Jul 15 11:42:43 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 13:31:29 2014 -0400 cmTarget: Drop GetTransitivePropertyTargets method Inline the implementation at the only remaining call site. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 1c15bd3..19b3e16 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1098,10 +1098,20 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode if (std::find_if(transBegin, transEnd, cmStrCmp(propertyName)) != transEnd) { - std::vector tgts; - target->GetTransitivePropertyTargets(context->Config, - headTarget, tgts); + if(cmTarget::LinkInterfaceLibraries const* iface = + target->GetLinkInterfaceLibraries(context->Config, headTarget, true)) + { + for(std::vector::const_iterator + it = iface->Libraries.begin(); + it != iface->Libraries.end(); ++it) + { + if (it->Target) + { + tgts.push_back(it->Target); + } + } + } if (!tgts.empty()) { linkedTargetsContent = diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b36a600..8185bcc 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6055,25 +6055,6 @@ cmTarget::GetLinkImplementationClosure(const std::string& config) const } //---------------------------------------------------------------------------- -void cmTarget::GetTransitivePropertyTargets(const std::string& config, - cmTarget const* headTarget, - std::vector &tgts) const -{ - if(cmTarget::LinkInterfaceLibraries const* iface = - this->GetLinkInterfaceLibraries(config, headTarget, true)) - { - for(std::vector::const_iterator it = iface->Libraries.begin(); - it != iface->Libraries.end(); ++it) - { - if (it->Target) - { - tgts.push_back(it->Target); - } - } - } -} - -//---------------------------------------------------------------------------- void cmTargetInternals::ComputeLinkInterfaceLibraries( cmTarget const* thisTarget, diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 8e21d4f..1271272 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -296,9 +296,6 @@ public: GetLinkInterfaceLibraries(const std::string& config, cmTarget const* headTarget, bool usage_requirements_only) const; - void GetTransitivePropertyTargets(const std::string& config, - cmTarget const* headTarget, - std::vector &libs) const; std::vector const& GetLinkImplementationClosure(const std::string& config) const; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fb3518dc81ac1b776503d4369c6d375a706485d1 commit fb3518dc81ac1b776503d4369c6d375a706485d1 Author: Brad King AuthorDate: Tue Jul 15 11:39:36 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 13:31:29 2014 -0400 Refactor system include annotation propagation Since commit v3.0.0-rc1~174^2~1 (cmTarget: Fix system include annotation propagation, 2014-01-01) the cmGeneratorTarget::IsSystemIncludeDirectory method needs to collect all targets that might provide INTERFACE_(|SYSTEM)_INCLUDE_DIRECTORIES for the current target. We now have cmTarget::GetLinkImplementationClosure to provide this, so use it. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 64c5822..f9b68d4 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -445,13 +445,6 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, if (iter == this->SystemIncludesCache.end()) { - cmTarget::LinkImplementation const* impl - = this->Target->GetLinkImplementation(config); - if(!impl) - { - return false; - } - cmGeneratorExpressionDAGChecker dagChecker( this->GetName(), "SYSTEM_INCLUDE_DIRECTORIES", 0, 0); @@ -471,35 +464,15 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, &dagChecker), result); } - std::set uniqueDeps; - for(std::vector::const_iterator - li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) + std::vector const& deps = + this->Target->GetLinkImplementationClosure(config); + for(std::vector::const_iterator + li = deps.begin(), le = deps.end(); li != le; ++li) { - cmTarget const* tgt = li->Target; - if (!tgt) - { - continue; - } - - if (uniqueDeps.insert(tgt).second) - { - handleSystemIncludesDep(this->Makefile, tgt, config, this->Target, - &dagChecker, result, excludeImported); - - std::vector deps; - tgt->GetTransitivePropertyTargets(config, this->Target, deps); - - for(std::vector::const_iterator di = deps.begin(); - di != deps.end(); ++di) - { - if (uniqueDeps.insert(*di).second) - { - handleSystemIncludesDep(this->Makefile, *di, config, this->Target, - &dagChecker, result, excludeImported); - } - } - } + handleSystemIncludesDep(this->Makefile, *li, config, this->Target, + &dagChecker, result, excludeImported); } + std::set unique; for(std::vector::iterator li = result.begin(); li != result.end(); ++li) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=535fd6ce6d514deebc8c95424df83f73989f55a5 commit 535fd6ce6d514deebc8c95424df83f73989f55a5 Author: Brad King AuthorDate: Tue Jul 15 16:12:07 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 13:31:29 2014 -0400 cmTarget: Make GetLink*Libraries methods safer to use Split the library lists out of LinkImplementation and LinkInterface into LinkImplementationLibraries and LinkInterfaceLibraries parent classes, respectively. Return these from GetLinkImplementationLibraries and GetLinkInterfaceLibraries, respectively, so that callers cannot access parts of the structures that have not been populated. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 3b83cd3..1c15bd3 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1114,7 +1114,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode else if (std::find_if(transBegin, transEnd, cmStrCmp(interfacePropertyName)) != transEnd) { - const cmTarget::LinkImplementation *impl + const cmTarget::LinkImplementationLibraries *impl = target->GetLinkImplementationLibraries(context->Config); if(impl) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index cdece87..b36a600 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4379,7 +4379,7 @@ bool cmTarget::HaveBuildTreeRPATH(const std::string& config) const { return false; } - if(LinkImplementation const* impl = + if(LinkImplementationLibraries const* impl = this->GetLinkImplementationLibraries(config)) { return !impl->Libraries.empty(); @@ -5935,7 +5935,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface( } //---------------------------------------------------------------------------- -cmTarget::LinkInterface const* +cmTarget::LinkInterfaceLibraries const* cmTarget::GetLinkInterfaceLibraries(const std::string& config, cmTarget const* head, bool usage_requirements_only) const @@ -6017,7 +6017,7 @@ void processILibs(const std::string& config, if (item.Target && emitted.insert(item.Target).second) { tgts.push_back(item.Target); - if(cmTarget::LinkInterface const* iface = + if(cmTarget::LinkInterfaceLibraries const* iface = item.Target->GetLinkInterfaceLibraries(config, headTarget, true)) { for(std::vector::const_iterator @@ -6041,7 +6041,7 @@ cmTarget::GetLinkImplementationClosure(const std::string& config) const this->Internal->CacheLinkImplementationClosureDone[config] = true; std::set emitted; - cmTarget::LinkImplementation const* impl + cmTarget::LinkImplementationLibraries const* impl = this->GetLinkImplementationLibraries(config); for(std::vector::const_iterator @@ -6059,7 +6059,7 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, cmTarget const* headTarget, std::vector &tgts) const { - if(cmTarget::LinkInterface const* iface = + if(cmTarget::LinkInterfaceLibraries const* iface = this->GetLinkInterfaceLibraries(config, headTarget, true)) { for(std::vector::const_iterator it = iface->Libraries.begin(); @@ -6177,7 +6177,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( // to the link implementation. { // The link implementation is the default link interface. - cmTarget::LinkImplementation const* impl = + cmTarget::LinkImplementationLibraries const* impl = thisTarget->GetLinkImplementationLibrariesInternal(config, headTarget); std::copy(impl->Libraries.begin(), impl->Libraries.end(), std::back_inserter(iface.Libraries)); @@ -6294,7 +6294,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, || thisTarget->PolicyStatusCMP0022 == cmPolicies::OLD) { // The link implementation is the default link interface. - cmTarget::LinkImplementation const* + cmTarget::LinkImplementationLibraries const* impl = thisTarget->GetLinkImplementationLibrariesInternal(config, headTarget); iface.ImplementationIsInterface = true; @@ -6345,7 +6345,7 @@ void cmTargetInternals::AddInterfaceEntries( cmTarget const* thisTarget, std::string const& config, std::string const& prop, std::vector& entries) { - if(cmTarget::LinkImplementation const* impl = + if(cmTarget::LinkImplementationLibraries const* impl = thisTarget->GetLinkImplementationLibraries(config)) { for (std::vector::const_iterator @@ -6383,7 +6383,7 @@ cmTarget::GetLinkImplementation(const std::string& config) const if(!impl.LibrariesDone) { impl.LibrariesDone = true; - this->ComputeLinkImplementation(config, impl, this); + this->ComputeLinkImplementationLibraries(config, impl, this); } if(!impl.LanguagesDone) { @@ -6394,14 +6394,14 @@ cmTarget::GetLinkImplementation(const std::string& config) const } //---------------------------------------------------------------------------- -cmTarget::LinkImplementation const* +cmTarget::LinkImplementationLibraries const* cmTarget::GetLinkImplementationLibraries(const std::string& config) const { return this->GetLinkImplementationLibrariesInternal(config, this); } //---------------------------------------------------------------------------- -cmTarget::LinkImplementation const* +cmTarget::LinkImplementationLibraries const* cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config, cmTarget const* head) const { @@ -6418,15 +6418,16 @@ cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config, if(!impl.LibrariesDone) { impl.LibrariesDone = true; - this->ComputeLinkImplementation(config, impl, head); + this->ComputeLinkImplementationLibraries(config, impl, head); } return &impl; } //---------------------------------------------------------------------------- -void cmTarget::ComputeLinkImplementation(const std::string& config, - LinkImplementation& impl, - cmTarget const* head) const +void +cmTarget::ComputeLinkImplementationLibraries(const std::string& config, + LinkImplementation& impl, + cmTarget const* head) const { // Collect libraries directly linked in this configuration. for (std::vector::const_iterator diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 4005443..8e21d4f 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -262,13 +262,15 @@ public: /** The link interface specifies transitive library dependencies and other information needed by targets that link to this target. */ - struct LinkInterface + struct LinkInterfaceLibraries { - // Languages whose runtime libraries must be linked. - std::vector Languages; - // Libraries listed in the interface. std::vector Libraries; + }; + struct LinkInterface: public LinkInterfaceLibraries + { + // Languages whose runtime libraries must be linked. + std::vector Languages; // Shared library dependencies needed for linking on some platforms. std::vector SharedDeps; @@ -290,22 +292,21 @@ public: if the target cannot be linked. */ LinkInterface const* GetLinkInterface(const std::string& config, cmTarget const* headTarget) const; - LinkInterface const* GetLinkInterfaceLibraries(const std::string& config, - cmTarget const* headTarget, - bool usage_requirements_only) const; + LinkInterfaceLibraries const* + GetLinkInterfaceLibraries(const std::string& config, + cmTarget const* headTarget, + bool usage_requirements_only) const; void GetTransitivePropertyTargets(const std::string& config, cmTarget const* headTarget, std::vector &libs) const; + std::vector const& GetLinkImplementationClosure(const std::string& config) const; /** The link implementation specifies the direct library dependencies needed by the object files of the target. */ - struct LinkImplementation + struct LinkImplementationLibraries { - // Languages whose runtime libraries must be linked. - std::vector Languages; - // Libraries linked directly in this configuration. std::vector Libraries; @@ -313,10 +314,15 @@ public: // Needed only for OLD behavior of CMP0003. std::vector WrongConfigLibraries; }; + struct LinkImplementation: public LinkImplementationLibraries + { + // Languages whose runtime libraries must be linked. + std::vector Languages; + }; LinkImplementation const* GetLinkImplementation(const std::string& config) const; - LinkImplementation const* + LinkImplementationLibraries const* GetLinkImplementationLibraries(const std::string& config) const; /** Link information from the transitive closure of the link @@ -778,12 +784,12 @@ private: GetImportLinkInterface(const std::string& config, cmTarget const* head, bool usage_requirements_only) const; - LinkImplementation const* + LinkImplementationLibraries const* GetLinkImplementationLibrariesInternal(const std::string& config, cmTarget const* head) const; - void ComputeLinkImplementation(const std::string& config, - LinkImplementation& impl, - cmTarget const* head) const; + void ComputeLinkImplementationLibraries(const std::string& config, + LinkImplementation& impl, + cmTarget const* head) const; void ComputeLinkImplementationLanguages(const std::string& config, LinkImplementation& impl) const; void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const; ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpressionEvaluator.cxx | 161 ++++++++++++----------------- Source/cmGeneratorTarget.cxx | 41 ++------ Source/cmTarget.cxx | 141 +++++++++++-------------- Source/cmTarget.h | 51 +++++---- 4 files changed, 165 insertions(+), 229 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 16 14:26:44 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 16 Jul 2014 14:26:44 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4303-gf9ce128 Message-ID: <20140716182644.7548B4037E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f9ce1282dc89482386760133abc34143c04edd1d (commit) via 10c5c82c1e255523757d4c4fe81b6ad742e81c8f (commit) from 3703c03888e80c56f5bfebc72f6b10fa59f9a8c7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f9ce1282dc89482386760133abc34143c04edd1d commit f9ce1282dc89482386760133abc34143c04edd1d Merge: 3703c03 10c5c82 Author: Brad King AuthorDate: Wed Jul 16 14:26:43 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 16 14:26:43 2014 -0400 Merge topic 'generalize-LINK_ONLY' into next 10c5c82c Help: Add notes for topic 'generalize-LINK_ONLY' http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=10c5c82c1e255523757d4c4fe81b6ad742e81c8f commit 10c5c82c1e255523757d4c4fe81b6ad742e81c8f Author: Brad King AuthorDate: Wed Jul 16 14:26:18 2014 -0400 Commit: Brad King CommitDate: Wed Jul 16 14:26:18 2014 -0400 Help: Add notes for topic 'generalize-LINK_ONLY' diff --git a/Help/release/dev/generalize-LINK_ONLY.rst b/Help/release/dev/generalize-LINK_ONLY.rst new file mode 100644 index 0000000..6dccbd5 --- /dev/null +++ b/Help/release/dev/generalize-LINK_ONLY.rst @@ -0,0 +1,6 @@ +generalize-LINK_ONLY +-------------------- + +* The :prop_tgt:`INTERFACE_LINK_LIBRARIES` target property now supports + a ``$`` + :manual:`generator expression `. ----------------------------------------------------------------------- Summary of changes: Help/release/dev/generalize-LINK_ONLY.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/generalize-LINK_ONLY.rst hooks/post-receive -- CMake From ben.boeckel at kitware.com Wed Jul 16 17:29:19 2014 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Wed, 16 Jul 2014 17:29:19 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4316-gc77871b Message-ID: <20140716212919.BDC4D40697@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via c77871bb8b938d98420f4e7cd833cc38b58fd748 (commit) via d0671f81c00adc4c75dd498daa8120717dcec8ec (commit) via 16daa081b0214a0e135397d1dbb8dd515e4adff8 (commit) via 52f88e5386b5a5382a547baaf118f95950e54b18 (commit) via fef60ce66937d89bab4a27e9f86330de337e1dac (commit) via 5a121dddb8a25bff44b95d56859a03032ca1b250 (commit) via ea0b15689dc24b248993505caadec04c0a5a5d9f (commit) via 99672f236bf0c6e6a7ebaf39efb1b6b3de3e41f3 (commit) via b035f02dd4ccbdc5e3907b174b2385e0ee641f48 (commit) via 104f3232a97243ad3c2b0f072ccb70ce59626208 (commit) via 87abdb835d5c484495b02e7bbaeba6e95254ba23 (commit) via 4cfa918a9ae983274a7995ca89fb46fdf570b00c (commit) via 85242b7df63a8097c5672c3053873aec371b6af7 (commit) from f9ce1282dc89482386760133abc34143c04edd1d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c77871bb8b938d98420f4e7cd833cc38b58fd748 commit c77871bb8b938d98420f4e7cd833cc38b58fd748 Merge: f9ce128 d0671f8 Author: Ben Boeckel AuthorDate: Wed Jul 16 17:29:18 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 16 17:29:18 2014 -0400 Merge topic 'dev/target-fastpaths' into next d0671f81 cmTarget: use a hash_map for cmTargets typedef 16daa081 cmTarget: help the optimizer a bit 52f88e53 cmTarget: use hash_set for sets of strings fef60ce6 genex: Allow genex caching of config genex on single-config generators 5a121ddd cmTarget: Allow caching of empty genex expansions ea0b1568 cmTarget: Only copy GenEx expansions when necessary 99672f23 cmTarget: Don't set properties on custom targets b035f02d cmTarget: Use static strings for special property names 104f3232 cmTarget: Sort special property checks 87abdb83 cmTarget: Fast path for regular properties 4cfa918a cmTarget: Factor out common code 85242b7d cmTarget: Use else/if trees rather than an if tree http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d0671f81c00adc4c75dd498daa8120717dcec8ec commit d0671f81c00adc4c75dd498daa8120717dcec8ec Author: Ben Boeckel AuthorDate: Tue Jun 10 13:07:24 2014 -0400 Commit: Ben Boeckel CommitDate: Wed Jul 16 17:29:06 2014 -0400 cmTarget: use a hash_map for cmTargets typedef diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 4005443..9064eec 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -18,6 +18,9 @@ #include "cmListFileCache.h" #include +#if defined(CMAKE_BUILD_WITH_CMAKE) +#include +#endif #define CM_FOR_EACH_TARGET_POLICY(F) \ F(CMP0003) \ @@ -831,7 +834,11 @@ private: mutable bool LinkImplementationLanguageIsContextDependent; }; +#ifdef CMAKE_BUILD_WITH_CMAKE +typedef cmsys::hash_map cmTargets; +#else typedef std::map cmTargets; +#endif class cmTargetSet: public std::set {}; class cmTargetManifest: public std::map {}; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=16daa081b0214a0e135397d1dbb8dd515e4adff8 commit 16daa081b0214a0e135397d1dbb8dd515e4adff8 Author: Ben Boeckel AuthorDate: Tue Jun 10 13:07:12 2014 -0400 Commit: Ben Boeckel CommitDate: Wed Jul 16 17:29:05 2014 -0400 cmTarget: help the optimizer a bit diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 9f3fbb3..47ca8dd 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -224,7 +224,7 @@ public: cmLinkImplItem cmTargetInternals::TargetPropertyEntry::NoLinkImplItem; //---------------------------------------------------------------------------- -void deleteAndClear( +static void deleteAndClear( std::vector &entries) { for (std::vector::const_iterator @@ -238,7 +238,7 @@ void deleteAndClear( } //---------------------------------------------------------------------------- -void deleteAndClear( +static void deleteAndClear( std::map > &entries) { @@ -2299,7 +2299,7 @@ static void processCompileOptionsInternal(cmTarget const* tgt, for(std::vector::iterator li = entryOptions->begin(); li != entryOptions->end(); ++li) { - std::string opt = *li; + std::string const& opt = *li; if(uniqueOptions.insert(opt).second) { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=52f88e5386b5a5382a547baaf118f95950e54b18 commit 52f88e5386b5a5382a547baaf118f95950e54b18 Author: Ben Boeckel AuthorDate: Tue Jun 10 10:29:16 2014 -0400 Commit: Ben Boeckel CommitDate: Wed Jul 16 17:29:05 2014 -0400 cmTarget: use hash_set for sets of strings 20% (!) performance improvement with Make's generate step on Slicer. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b93a1b0..9f3fbb3 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -25,6 +25,12 @@ #include // required for atof #include #include +#if defined(CMAKE_BUILD_WITH_CMAKE) +#include +#define UNORDERED_SET cmsys::hash_set +#else +#define UNORDERED_SET std::set +#endif const char* cmTarget::GetTargetTypeName(TargetType targetType) { @@ -642,7 +648,7 @@ bool cmTarget::IsBundleOnApple() const static bool processSources(cmTarget const* tgt, const std::vector &entries, std::vector &srcs, - std::set &uniqueSrcs, + UNORDERED_SET &uniqueSrcs, cmGeneratorExpressionDAGChecker *dagChecker, std::string const& config, bool debugSources) { @@ -784,7 +790,7 @@ void cmTarget::GetSourceFiles(std::vector &files, cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "SOURCES", 0, 0); - std::set uniqueSrcs; + UNORDERED_SET uniqueSrcs; bool contextDependentDirectSources = processSources(this, this->Internal->SourceEntries, files, @@ -1298,7 +1304,7 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s, = (sig == cmTarget::KeywordTLLSignature ? "keyword" : "plain"); s << "The uses of the " << sigString << " signature are here:\n"; - std::set emitted; + UNORDERED_SET emitted; for(std::vector::iterator it = sigs.begin(); it != sigs.end(); ++it) { @@ -1717,22 +1723,20 @@ static bool whiteListedInterfaceProperty(const std::string& prop) { return true; } - static const char* builtIns[] = { - // ###: This must remain sorted. It is processed with a binary search. - "COMPATIBLE_INTERFACE_BOOL", - "COMPATIBLE_INTERFACE_NUMBER_MAX", - "COMPATIBLE_INTERFACE_NUMBER_MIN", - "COMPATIBLE_INTERFACE_STRING", - "EXPORT_NAME", - "IMPORTED", - "NAME", - "TYPE" - }; + static UNORDERED_SET builtIns; + if (builtIns.empty()) + { + builtIns.insert("COMPATIBLE_INTERFACE_BOOL"); + builtIns.insert("COMPATIBLE_INTERFACE_NUMBER_MAX"); + builtIns.insert("COMPATIBLE_INTERFACE_NUMBER_MIN"); + builtIns.insert("COMPATIBLE_INTERFACE_STRING"); + builtIns.insert("EXPORT_NAME"); + builtIns.insert("IMPORTED"); + builtIns.insert("NAME"); + builtIns.insert("TYPE"); + } - if (std::binary_search(cmArrayBegin(builtIns), - cmArrayEnd(builtIns), - prop.c_str(), - cmStrCmp(prop))) + if (builtIns.count(prop)) { return true; } @@ -2017,7 +2021,7 @@ void cmTarget::InsertCompileDefinition(const cmValueWithOrigin &entry) static void processIncludeDirectories(cmTarget const* tgt, const std::vector &entries, std::vector &includes, - std::set &uniqueIncludes, + UNORDERED_SET &uniqueIncludes, cmGeneratorExpressionDAGChecker *dagChecker, const std::string& config, bool debugIncludes) { @@ -2166,7 +2170,7 @@ std::vector cmTarget::GetIncludeDirectories(const std::string& config) const { std::vector includes; - std::set uniqueIncludes; + UNORDERED_SET uniqueIncludes; cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "INCLUDE_DIRECTORIES", 0, 0); @@ -2258,7 +2262,7 @@ cmTarget::GetIncludeDirectories(const std::string& config) const static void processCompileOptionsInternal(cmTarget const* tgt, const std::vector &entries, std::vector &options, - std::set &uniqueOptions, + UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, const std::string& config, bool debugOptions, const char *logName) { @@ -2321,7 +2325,7 @@ static void processCompileOptionsInternal(cmTarget const* tgt, static void processCompileOptions(cmTarget const* tgt, const std::vector &entries, std::vector &options, - std::set &uniqueOptions, + UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, const std::string& config, bool debugOptions) { @@ -2358,7 +2362,7 @@ void cmTarget::GetAutoUicOptions(std::vector &result, void cmTarget::GetCompileOptions(std::vector &result, const std::string& config) const { - std::set uniqueOptions; + UNORDERED_SET uniqueOptions; cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "COMPILE_OPTIONS", 0, 0); @@ -2419,7 +2423,7 @@ void cmTarget::GetCompileOptions(std::vector &result, static void processCompileDefinitions(cmTarget const* tgt, const std::vector &entries, std::vector &options, - std::set &uniqueOptions, + UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, const std::string& config, bool debugOptions) { @@ -2432,7 +2436,7 @@ static void processCompileDefinitions(cmTarget const* tgt, void cmTarget::GetCompileDefinitions(std::vector &list, const std::string& config) const { - std::set uniqueOptions; + UNORDERED_SET uniqueOptions; cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "COMPILE_DEFINITIONS", 0, 0); @@ -2530,7 +2534,7 @@ void cmTarget::GetCompileDefinitions(std::vector &list, static void processCompileFeatures(cmTarget const* tgt, const std::vector &entries, std::vector &options, - std::set &uniqueOptions, + UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, const std::string& config, bool debugOptions) { @@ -2542,7 +2546,7 @@ static void processCompileFeatures(cmTarget const* tgt, void cmTarget::GetCompileFeatures(std::vector &result, const std::string& config) const { - std::set uniqueFeatures; + UNORDERED_SET uniqueFeatures; cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "COMPILE_FEATURES", @@ -3082,7 +3086,7 @@ const char *cmTarget::GetProperty(const std::string& prop, cmProperty::TARGET); } // Support "_LOCATION". - if(cmHasLiteralSuffix(prop, "_LOCATION")) + else if(cmHasLiteralSuffix(prop, "_LOCATION")) { std::string configName(prop.c_str(), prop.size() - 9); if(configName != "IMPORTED") @@ -3097,7 +3101,7 @@ const char *cmTarget::GetProperty(const std::string& prop, } } } - static std::set specialProps; + static UNORDERED_SET specialProps; #define MAKE_STATIC_PROP(PROP) \ static const std::string prop##PROP = #PROP MAKE_STATIC_PROP(LINK_LIBRARIES); @@ -3323,7 +3327,7 @@ class cmTargetCollectLinkLanguages public: cmTargetCollectLinkLanguages(cmTarget const* target, const std::string& config, - std::set& languages, + UNORDERED_SET& languages, cmTarget const* head): Config(config), Languages(languages), HeadTarget(head), Makefile(target->GetMakefile()), Target(target) @@ -3393,7 +3397,7 @@ public: } private: std::string Config; - std::set& Languages; + UNORDERED_SET& Languages; cmTarget const* HeadTarget; cmMakefile* Makefile; const cmTarget* Target; @@ -3430,7 +3434,7 @@ class cmTargetSelectLinker cmTarget const* Target; cmMakefile* Makefile; cmGlobalGenerator* GG; - std::set Preferred; + UNORDERED_SET Preferred; public: cmTargetSelectLinker(cmTarget const* target): Preference(0), Target(target) { @@ -3462,7 +3466,7 @@ public: e << "Target " << this->Target->GetName() << " contains multiple languages with the highest linker preference" << " (" << this->Preference << "):\n"; - for(std::set::const_iterator + for(UNORDERED_SET::const_iterator li = this->Preferred.begin(); li != this->Preferred.end(); ++li) { e << " " << *li << "\n"; @@ -3481,7 +3485,7 @@ void cmTarget::ComputeLinkClosure(const std::string& config, LinkClosure& lc) const { // Get languages built in this target. - std::set languages; + UNORDERED_SET languages; LinkImplementation const* impl = this->GetLinkImplementation(config); for(std::vector::const_iterator li = impl->Languages.begin(); li != impl->Languages.end(); ++li) @@ -3499,7 +3503,7 @@ void cmTarget::ComputeLinkClosure(const std::string& config, } // Store the transitive closure of languages. - for(std::set::const_iterator li = languages.begin(); + for(UNORDERED_SET::const_iterator li = languages.begin(); li != languages.end(); ++li) { lc.Languages.push_back(*li); @@ -3527,7 +3531,7 @@ void cmTarget::ComputeLinkClosure(const std::string& config, } // Now consider languages that propagate from linked targets. - for(std::set::const_iterator sit = languages.begin(); + for(UNORDERED_SET::const_iterator sit = languages.begin(); sit != languages.end(); ++sit) { std::string propagates = "CMAKE_"+*sit+"_LINKER_PREFERENCE_PROPAGATES"; @@ -6261,7 +6265,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, { // Shared libraries may have runtime implementation dependencies // on other shared libraries that are not in the interface. - std::set emitted; + UNORDERED_SET emitted; for(std::vector::const_iterator li = iface.Libraries.begin(); li != iface.Libraries.end(); ++li) { @@ -6835,6 +6839,7 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, if (!prop.empty()) { + // Use a std::set to keep the error message sorted. std::set props; std::set::const_iterator i = emittedBools.find(prop); if (i != emittedBools.end()) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fef60ce66937d89bab4a27e9f86330de337e1dac commit fef60ce66937d89bab4a27e9f86330de337e1dac Author: Ben Boeckel AuthorDate: Wed Apr 30 15:41:40 2014 -0400 Commit: Ben Boeckel CommitDate: Wed Jul 16 17:29:05 2014 -0400 genex: Allow genex caching of config genex on single-config generators The single-config generators do not make $ and $ generator expressions context-sensitive. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 3b83cd3..2581355 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -15,6 +15,7 @@ #include "cmGeneratorExpressionParser.h" #include "cmGeneratorExpressionDAGChecker.h" #include "cmGeneratorExpression.h" +#include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmSourceFile.h" @@ -688,7 +689,11 @@ static const struct ConfigurationNode : public cmGeneratorExpressionNode const GeneratorExpressionContent *, cmGeneratorExpressionDAGChecker *) const { - context->HadContextSensitiveCondition = true; + if (context->Makefile->GetLocalGenerator()-> + GetGlobalGenerator()->IsMultiConfig()) + { + context->HadContextSensitiveCondition = true; + } return context->Config; } } configurationNode; @@ -716,7 +721,11 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode "Expression syntax not recognized."); return std::string(); } - context->HadContextSensitiveCondition = true; + if (context->Makefile->GetLocalGenerator()-> + GetGlobalGenerator()->IsMultiConfig()) + { + context->HadContextSensitiveCondition = true; + } if (context->Config.empty()) { return parameters.front().empty() ? "1" : "0"; diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake index fa76f24..57c52e3 100644 --- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake @@ -9,7 +9,11 @@ run_cmake(RelativePathInInterface) run_cmake(ImportedTarget) run_cmake(RelativePathInGenex) run_cmake(CMP0021) -run_cmake(install_config) +if (CMAKE_CONFIGURATION_TYPES) + # $ is only context-dependent in multi-config + # generators. + run_cmake(install_config) +endif () run_cmake(incomplete-genex) run_cmake(export-NOWARN) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5a121dddb8a25bff44b95d56859a03032ca1b250 commit 5a121dddb8a25bff44b95d56859a03032ca1b250 Author: Ben Boeckel AuthorDate: Wed Apr 30 15:41:19 2014 -0400 Commit: Ben Boeckel CommitDate: Wed Jul 16 17:29:05 2014 -0400 cmTarget: Allow caching of empty genex expansions diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 25b37f8..b93a1b0 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -176,10 +176,11 @@ public: public: TargetPropertyEntry(cmsys::auto_ptr cge, cmLinkImplItem const& item = NoLinkImplItem) - : ge(cge), LinkImplItem(item) + : ge(cge), Cached(false), LinkImplItem(item) {} const cmsys::auto_ptr ge; std::vector CachedEntries; + bool Cached; cmLinkImplItem const& LinkImplItem; }; std::vector IncludeDirectoriesEntries; @@ -2269,7 +2270,7 @@ static void processCompileOptionsInternal(cmTarget const* tgt, std::vector& entriesRef = (*it)->CachedEntries; std::vector localEntries; std::vector* entryOptions = &entriesRef; - if(entryOptions->empty()) + if(!(*it)->Cached) { cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, config, @@ -2282,6 +2283,7 @@ static void processCompileOptionsInternal(cmTarget const* tgt, { // Cache the result. *entryOptions = localEntries; + (*it)->Cached = true; } else { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ea0b15689dc24b248993505caadec04c0a5a5d9f commit ea0b15689dc24b248993505caadec04c0a5a5d9f Author: Ben Boeckel AuthorDate: Mon Feb 10 01:24:42 2014 -0500 Commit: Ben Boeckel CommitDate: Wed Jul 16 17:29:05 2014 -0400 cmTarget: Only copy GenEx expansions when necessary diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 2d53ad2..25b37f8 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2266,25 +2266,32 @@ static void processCompileOptionsInternal(cmTarget const* tgt, for (std::vector::const_iterator it = entries.begin(), end = entries.end(); it != end; ++it) { - bool cacheOptions = false; - std::vector entryOptions = (*it)->CachedEntries; - if(entryOptions.empty()) + std::vector& entriesRef = (*it)->CachedEntries; + std::vector localEntries; + std::vector* entryOptions = &entriesRef; + if(entryOptions->empty()) { cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, config, false, tgt, dagChecker), - entryOptions); + localEntries); if (mf->IsGeneratingBuildSystem() && !(*it)->ge->GetHadContextSensitiveCondition()) { - cacheOptions = true; + // Cache the result. + *entryOptions = localEntries; + } + else + { + // Use the context-sensitive results here. + entryOptions = &localEntries; } } std::string usedOptions; for(std::vector::iterator - li = entryOptions.begin(); li != entryOptions.end(); ++li) + li = entryOptions->begin(); li != entryOptions->end(); ++li) { std::string opt = *li; @@ -2297,10 +2304,6 @@ static void processCompileOptionsInternal(cmTarget const* tgt, } } } - if (cacheOptions) - { - (*it)->CachedEntries = entryOptions; - } if (!usedOptions.empty()) { mf->GetCMakeInstance()->IssueMessage(cmake::LOG, http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=99672f236bf0c6e6a7ebaf39efb1b6b3de3e41f3 commit 99672f236bf0c6e6a7ebaf39efb1b6b3de3e41f3 Author: Ben Boeckel AuthorDate: Wed Mar 12 14:05:52 2014 -0400 Commit: Ben Boeckel CommitDate: Wed Jul 16 17:29:05 2014 -0400 cmTarget: Don't set properties on custom targets Properties are not required on custom targets. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 6d5df81..2d53ad2 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -328,7 +328,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->IsApple = this->Makefile->IsOn("APPLE"); // Setup default property values. - if (this->GetType() != INTERFACE_LIBRARY) + if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY) { this->SetPropertyDefault("INSTALL_NAME_DIR", 0); this->SetPropertyDefault("INSTALL_RPATH", ""); @@ -369,41 +369,44 @@ void cmTarget::SetMakefile(cmMakefile* mf) mf->GetConfigurations(configNames); // Setup per-configuration property default values. - const char* configProps[] = { - "ARCHIVE_OUTPUT_DIRECTORY_", - "LIBRARY_OUTPUT_DIRECTORY_", - "RUNTIME_OUTPUT_DIRECTORY_", - "PDB_OUTPUT_DIRECTORY_", - "COMPILE_PDB_OUTPUT_DIRECTORY_", - "MAP_IMPORTED_CONFIG_", - 0}; - for(std::vector::iterator ci = configNames.begin(); - ci != configNames.end(); ++ci) - { - std::string configUpper = cmSystemTools::UpperCase(*ci); - for(const char** p = configProps; *p; ++p) - { - if (this->TargetTypeValue == INTERFACE_LIBRARY - && strcmp(*p, "MAP_IMPORTED_CONFIG_") != 0) + if (this->GetType() != UTILITY) + { + const char* configProps[] = { + "ARCHIVE_OUTPUT_DIRECTORY_", + "LIBRARY_OUTPUT_DIRECTORY_", + "RUNTIME_OUTPUT_DIRECTORY_", + "PDB_OUTPUT_DIRECTORY_", + "COMPILE_PDB_OUTPUT_DIRECTORY_", + "MAP_IMPORTED_CONFIG_", + 0}; + for(std::vector::iterator ci = configNames.begin(); + ci != configNames.end(); ++ci) + { + std::string configUpper = cmSystemTools::UpperCase(*ci); + for(const char** p = configProps; *p; ++p) { - continue; + if (this->TargetTypeValue == INTERFACE_LIBRARY + && strcmp(*p, "MAP_IMPORTED_CONFIG_") != 0) + { + continue; + } + std::string property = *p; + property += configUpper; + this->SetPropertyDefault(property, 0); } - std::string property = *p; - property += configUpper; - this->SetPropertyDefault(property, 0); - } - // Initialize per-configuration name postfix property from the - // variable only for non-executable targets. This preserves - // compatibility with previous CMake versions in which executables - // did not support this variable. Projects may still specify the - // property directly. - if(this->TargetTypeValue != cmTarget::EXECUTABLE - && this->TargetTypeValue != cmTarget::INTERFACE_LIBRARY) - { - std::string property = cmSystemTools::UpperCase(*ci); - property += "_POSTFIX"; - this->SetPropertyDefault(property, 0); + // Initialize per-configuration name postfix property from the + // variable only for non-executable targets. This preserves + // compatibility with previous CMake versions in which executables + // did not support this variable. Projects may still specify the + // property directly. + if(this->TargetTypeValue != cmTarget::EXECUTABLE + && this->TargetTypeValue != cmTarget::INTERFACE_LIBRARY) + { + std::string property = cmSystemTools::UpperCase(*ci); + property += "_POSTFIX"; + this->SetPropertyDefault(property, 0); + } } } @@ -442,7 +445,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) } } - if (this->GetType() != INTERFACE_LIBRARY) + if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY) { this->SetPropertyDefault("C_VISIBILITY_PRESET", 0); this->SetPropertyDefault("CXX_VISIBILITY_PRESET", 0); @@ -454,7 +457,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) { this->SetProperty("POSITION_INDEPENDENT_CODE", "True"); } - if (this->GetType() != INTERFACE_LIBRARY) + if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY) { this->SetPropertyDefault("POSITION_INDEPENDENT_CODE", 0); } @@ -476,8 +479,11 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->PolicyStatusCMP0022 = cmPolicies::NEW; } - this->SetPropertyDefault("JOB_POOL_COMPILE", 0); - this->SetPropertyDefault("JOB_POOL_LINK", 0); + if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY) + { + this->SetPropertyDefault("JOB_POOL_COMPILE", 0); + this->SetPropertyDefault("JOB_POOL_LINK", 0); + } } //---------------------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b035f02dd4ccbdc5e3907b174b2385e0ee641f48 commit b035f02dd4ccbdc5e3907b174b2385e0ee641f48 Author: Ben Boeckel AuthorDate: Sat Feb 8 12:12:27 2014 -0500 Commit: Ben Boeckel CommitDate: Wed Jul 16 17:29:04 2014 -0400 cmTarget: Use static strings for special property names The function is called enough that the std::string/cstr comparisons are expensive from the strlen. Cache the strings for faster comparisons. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 2ed1f6d..6d5df81 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3037,7 +3037,8 @@ const char *cmTarget::GetProperty(const std::string& prop, this->GetType() == cmTarget::MODULE_LIBRARY || this->GetType() == cmTarget::UNKNOWN_LIBRARY) { - if(prop == "LOCATION") + static const std::string propLOCATION = "LOCATION"; + if(prop == propLOCATION) { if (!this->HandleLocationPropertyPolicy(context)) { @@ -3053,12 +3054,12 @@ const char *cmTarget::GetProperty(const std::string& prop, // cannot take into account the per-configuration name of the // target because the configuration type may not be known at // CMake time. - this->Properties.SetProperty("LOCATION", this->GetLocationForBuild(), + this->Properties.SetProperty(propLOCATION, this->GetLocationForBuild(), cmProperty::TARGET); } // Support "LOCATION_". - if(cmHasLiteralPrefix(prop, "LOCATION_")) + else if(cmHasLiteralPrefix(prop, "LOCATION_")) { if (!this->HandleLocationPropertyPolicy(context)) { @@ -3086,21 +3087,33 @@ const char *cmTarget::GetProperty(const std::string& prop, } } static std::set specialProps; +#define MAKE_STATIC_PROP(PROP) \ + static const std::string prop##PROP = #PROP + MAKE_STATIC_PROP(LINK_LIBRARIES); + MAKE_STATIC_PROP(TYPE); + MAKE_STATIC_PROP(INCLUDE_DIRECTORIES); + MAKE_STATIC_PROP(COMPILE_FEATURES); + MAKE_STATIC_PROP(COMPILE_OPTIONS); + MAKE_STATIC_PROP(COMPILE_DEFINITIONS); + MAKE_STATIC_PROP(IMPORTED); + MAKE_STATIC_PROP(NAME); + MAKE_STATIC_PROP(SOURCES); +#undef MAKE_STATIC_PROP if(specialProps.empty()) { - specialProps.insert("INCLUDE_DIRECTORIES"); - specialProps.insert("COMPILE_FEATURES"); - specialProps.insert("COMPILE_OPTIONS"); - specialProps.insert("COMPILE_DEFINITIONS"); - specialProps.insert("LINK_LIBRARIES"); - specialProps.insert("IMPORTED"); - specialProps.insert("NAME"); - specialProps.insert("SOURCES"); - specialProps.insert("TYPE"); + specialProps.insert(propLINK_LIBRARIES); + specialProps.insert(propTYPE); + specialProps.insert(propINCLUDE_DIRECTORIES); + specialProps.insert(propCOMPILE_FEATURES); + specialProps.insert(propCOMPILE_OPTIONS); + specialProps.insert(propCOMPILE_DEFINITIONS); + specialProps.insert(propIMPORTED); + specialProps.insert(propNAME); + specialProps.insert(propSOURCES); } if(specialProps.count(prop)) { - if(prop == "LINK_LIBRARIES") + if(prop == propLINK_LIBRARIES) { if (this->Internal->LinkImplementationPropertyEntries.empty()) { @@ -3122,11 +3135,11 @@ const char *cmTarget::GetProperty(const std::string& prop, return output.c_str(); } // the type property returns what type the target is - else if (prop == "TYPE") + else if (prop == propTYPE) { return cmTarget::GetTargetTypeName(this->GetType()); } - else if(prop == "INCLUDE_DIRECTORIES") + else if(prop == propINCLUDE_DIRECTORIES) { if (this->Internal->IncludeDirectoriesEntries.empty()) { @@ -3137,7 +3150,7 @@ const char *cmTarget::GetProperty(const std::string& prop, MakePropertyList(output, this->Internal->IncludeDirectoriesEntries); return output.c_str(); } - else if(prop == "COMPILE_FEATURES") + else if(prop == propCOMPILE_FEATURES) { if (this->Internal->CompileFeaturesEntries.empty()) { @@ -3148,7 +3161,7 @@ const char *cmTarget::GetProperty(const std::string& prop, MakePropertyList(output, this->Internal->CompileFeaturesEntries); return output.c_str(); } - else if(prop == "COMPILE_OPTIONS") + else if(prop == propCOMPILE_OPTIONS) { if (this->Internal->CompileOptionsEntries.empty()) { @@ -3159,7 +3172,7 @@ const char *cmTarget::GetProperty(const std::string& prop, MakePropertyList(output, this->Internal->CompileOptionsEntries); return output.c_str(); } - else if(prop == "COMPILE_DEFINITIONS") + else if(prop == propCOMPILE_DEFINITIONS) { if (this->Internal->CompileDefinitionsEntries.empty()) { @@ -3170,15 +3183,15 @@ const char *cmTarget::GetProperty(const std::string& prop, MakePropertyList(output, this->Internal->CompileDefinitionsEntries); return output.c_str(); } - else if (prop == "IMPORTED") + else if (prop == propIMPORTED) { return this->IsImported()?"TRUE":"FALSE"; } - else if (prop == "NAME") + else if (prop == propNAME) { return this->GetName().c_str(); } - else if(prop == "SOURCES") + else if(prop == propSOURCES) { if (this->Internal->SourceEntries.empty()) { @@ -4795,12 +4808,13 @@ bool cmTarget::IsNullImpliedByLinkLibraries(const std::string &p) const //---------------------------------------------------------------------------- template -PropertyType getTypedProperty(cmTarget const* tgt, const char *prop, +PropertyType getTypedProperty(cmTarget const* tgt, const std::string& prop, PropertyType *); //---------------------------------------------------------------------------- template<> -bool getTypedProperty(cmTarget const* tgt, const char *prop, bool *) +bool getTypedProperty(cmTarget const* tgt, const std::string& prop, + bool *) { return tgt->GetPropertyAsBool(prop); } @@ -4808,7 +4822,7 @@ bool getTypedProperty(cmTarget const* tgt, const char *prop, bool *) //---------------------------------------------------------------------------- template<> const char *getTypedProperty(cmTarget const* tgt, - const char *prop, + const std::string& prop, const char **) { return tgt->GetProperty(prop); @@ -5083,6 +5097,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, report += "\" property not set.\n"; } + std::string interfaceProperty = "INTERFACE_" + p; for(std::vector::const_iterator li = deps.begin(); li != deps.end(); ++li) @@ -5096,11 +5111,11 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, cmTarget const* theTarget = *li; const bool ifaceIsSet = theTarget->GetProperties() - .find("INTERFACE_" + p) + .find(interfaceProperty) != theTarget->GetProperties().end(); PropertyType ifacePropContent = getTypedProperty(theTarget, - ("INTERFACE_" + p).c_str(), 0); + interfaceProperty.c_str(), 0); std::string reportEntry; if (ifaceIsSet) @@ -6167,7 +6182,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( // Compare the link implementation fallback link interface to the // preferred new link interface property and warn if different. std::vector ifaceLibs; - std::string newProp = "INTERFACE_LINK_LIBRARIES"; + if(const char* newExplicitLibraries = this->GetProperty(newProp)) if(const char* newExplicitLibraries = thisTarget->GetProperty(newProp)) { thisTarget->ExpandLinkItems(newProp, newExplicitLibraries, config, @@ -6752,9 +6767,13 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, const cmComputeLinkInformation::ItemVector &deps = info->GetItems(); std::set emittedBools; + static std::string strBool = "COMPATIBLE_INTERFACE_BOOL"; std::set emittedStrings; + static std::string strString = "COMPATIBLE_INTERFACE_STRING"; std::set emittedMinNumbers; + static std::string strNumMin = "COMPATIBLE_INTERFACE_NUMBER_MIN"; std::set emittedMaxNumbers; + static std::string strNumMax = "COMPATIBLE_INTERFACE_NUMBER_MAX"; for(cmComputeLinkInformation::ItemVector::const_iterator li = deps.begin(); @@ -6766,14 +6785,14 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, } checkPropertyConsistency(this, li->Target, - std::string("COMPATIBLE_INTERFACE_BOOL"), + strBool, emittedBools, config, BoolType, 0); if (cmSystemTools::GetErrorOccuredFlag()) { return; } checkPropertyConsistency(this, li->Target, - std::string("COMPATIBLE_INTERFACE_STRING"), + strString, emittedStrings, config, StringType, 0); if (cmSystemTools::GetErrorOccuredFlag()) @@ -6781,7 +6800,7 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, return; } checkPropertyConsistency(this, li->Target, - std::string("COMPATIBLE_INTERFACE_NUMBER_MIN"), + strNumMin, emittedMinNumbers, config, NumberMinType, 0); if (cmSystemTools::GetErrorOccuredFlag()) @@ -6789,7 +6808,7 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, return; } checkPropertyConsistency(this, li->Target, - std::string("COMPATIBLE_INTERFACE_NUMBER_MAX"), + strNumMax, emittedMaxNumbers, config, NumberMaxType, 0); if (cmSystemTools::GetErrorOccuredFlag()) @@ -6809,22 +6828,22 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, std::set::const_iterator i = emittedBools.find(prop); if (i != emittedBools.end()) { - props.insert("COMPATIBLE_INTERFACE_BOOL"); + props.insert(strBool); } i = emittedStrings.find(prop); if (i != emittedStrings.end()) { - props.insert("COMPATIBLE_INTERFACE_STRING"); + props.insert(strString); } i = emittedMinNumbers.find(prop); if (i != emittedMinNumbers.end()) { - props.insert("COMPATIBLE_INTERFACE_NUMBER_MIN"); + props.insert(strNumMin); } i = emittedMaxNumbers.find(prop); if (i != emittedMaxNumbers.end()) { - props.insert("COMPATIBLE_INTERFACE_NUMBER_MAX"); + props.insert(strNumMax); } std::string propsString = *props.begin(); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=104f3232a97243ad3c2b0f072ccb70ce59626208 commit 104f3232a97243ad3c2b0f072ccb70ce59626208 Author: Ben Boeckel AuthorDate: Sat Feb 8 12:11:32 2014 -0500 Commit: Ben Boeckel CommitDate: Wed Jul 16 17:28:32 2014 -0400 cmTarget: Sort special property checks The LINK_LIBRARIES property is by *far* the most popular. Move it to the top. TYPE is second, but with more generator expression usage, that may change in the future. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0b4ea5e..2ed1f6d 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3100,26 +3100,41 @@ const char *cmTarget::GetProperty(const std::string& prop, } if(specialProps.count(prop)) { - if(prop == "INCLUDE_DIRECTORIES") + if(prop == "LINK_LIBRARIES") { - if (this->Internal->IncludeDirectoriesEntries.empty()) + if (this->Internal->LinkImplementationPropertyEntries.empty()) { return 0; } static std::string output; - MakePropertyList(output, this->Internal->IncludeDirectoriesEntries); + output = ""; + std::string sep; + for (std::vector::const_iterator + it = this->Internal->LinkImplementationPropertyEntries.begin(), + end = this->Internal->LinkImplementationPropertyEntries.end(); + it != end; ++it) + { + output += sep; + output += it->Value; + sep = ";"; + } return output.c_str(); } - else if(prop == "COMPILE_OPTIONS") + // the type property returns what type the target is + else if (prop == "TYPE") { - if (this->Internal->CompileOptionsEntries.empty()) + return cmTarget::GetTargetTypeName(this->GetType()); + } + else if(prop == "INCLUDE_DIRECTORIES") + { + if (this->Internal->IncludeDirectoriesEntries.empty()) { return 0; } static std::string output; - MakePropertyList(output, this->Internal->CompileOptionsEntries); + MakePropertyList(output, this->Internal->IncludeDirectoriesEntries); return output.c_str(); } else if(prop == "COMPILE_FEATURES") @@ -3133,36 +3148,26 @@ const char *cmTarget::GetProperty(const std::string& prop, MakePropertyList(output, this->Internal->CompileFeaturesEntries); return output.c_str(); } - else if(prop == "COMPILE_DEFINITIONS") + else if(prop == "COMPILE_OPTIONS") { - if (this->Internal->CompileDefinitionsEntries.empty()) + if (this->Internal->CompileOptionsEntries.empty()) { return 0; } static std::string output; - MakePropertyList(output, this->Internal->CompileDefinitionsEntries); + MakePropertyList(output, this->Internal->CompileOptionsEntries); return output.c_str(); } - else if(prop == "LINK_LIBRARIES") + else if(prop == "COMPILE_DEFINITIONS") { - if (this->Internal->LinkImplementationPropertyEntries.empty()) + if (this->Internal->CompileDefinitionsEntries.empty()) { return 0; } static std::string output; - output = ""; - std::string sep; - for (std::vector::const_iterator - it = this->Internal->LinkImplementationPropertyEntries.begin(), - end = this->Internal->LinkImplementationPropertyEntries.end(); - it != end; ++it) - { - output += sep; - output += it->Value; - sep = ";"; - } + MakePropertyList(output, this->Internal->CompileDefinitionsEntries); return output.c_str(); } else if (prop == "IMPORTED") @@ -3270,11 +3275,6 @@ const char *cmTarget::GetProperty(const std::string& prop, this->Properties.SetProperty("SOURCES", ss.str().c_str(), cmProperty::TARGET); } - // the type property returns what type the target is - else if (prop == "TYPE") - { - return cmTarget::GetTargetTypeName(this->GetType()); - } } bool chain = false; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=87abdb835d5c484495b02e7bbaeba6e95254ba23 commit 87abdb835d5c484495b02e7bbaeba6e95254ba23 Author: Ben Boeckel AuthorDate: Sat Feb 8 05:27:45 2014 -0500 Commit: Ben Boeckel CommitDate: Wed Jul 16 17:28:32 2014 -0400 cmTarget: Fast path for regular properties diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 8be14f3..0b4ea5e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3085,180 +3085,196 @@ const char *cmTarget::GetProperty(const std::string& prop, } } } - if(prop == "INCLUDE_DIRECTORIES") + static std::set specialProps; + if(specialProps.empty()) { - if (this->Internal->IncludeDirectoriesEntries.empty()) - { - return 0; - } - - static std::string output; - MakePropertyList(output, this->Internal->IncludeDirectoriesEntries); - return output.c_str(); + specialProps.insert("INCLUDE_DIRECTORIES"); + specialProps.insert("COMPILE_FEATURES"); + specialProps.insert("COMPILE_OPTIONS"); + specialProps.insert("COMPILE_DEFINITIONS"); + specialProps.insert("LINK_LIBRARIES"); + specialProps.insert("IMPORTED"); + specialProps.insert("NAME"); + specialProps.insert("SOURCES"); + specialProps.insert("TYPE"); } - else if(prop == "COMPILE_OPTIONS") + if(specialProps.count(prop)) { - if (this->Internal->CompileOptionsEntries.empty()) + if(prop == "INCLUDE_DIRECTORIES") { - return 0; - } + if (this->Internal->IncludeDirectoriesEntries.empty()) + { + return 0; + } - static std::string output; - MakePropertyList(output, this->Internal->CompileOptionsEntries); - return output.c_str(); - } - else if(prop == "COMPILE_FEATURES") - { - if (this->Internal->CompileFeaturesEntries.empty()) - { - return 0; + static std::string output; + MakePropertyList(output, this->Internal->IncludeDirectoriesEntries); + return output.c_str(); } - - static std::string output; - MakePropertyList(output, this->Internal->CompileFeaturesEntries); - return output.c_str(); - } - else if(prop == "COMPILE_DEFINITIONS") - { - if (this->Internal->CompileDefinitionsEntries.empty()) + else if(prop == "COMPILE_OPTIONS") { - return 0; + if (this->Internal->CompileOptionsEntries.empty()) + { + return 0; + } + + static std::string output; + MakePropertyList(output, this->Internal->CompileOptionsEntries); + return output.c_str(); } + else if(prop == "COMPILE_FEATURES") + { + if (this->Internal->CompileFeaturesEntries.empty()) + { + return 0; + } - static std::string output; - MakePropertyList(output, this->Internal->CompileDefinitionsEntries); - return output.c_str(); - } - else if(prop == "LINK_LIBRARIES") - { - if (this->Internal->LinkImplementationPropertyEntries.empty()) + static std::string output; + MakePropertyList(output, this->Internal->CompileFeaturesEntries); + return output.c_str(); + } + else if(prop == "COMPILE_DEFINITIONS") { - return 0; + if (this->Internal->CompileDefinitionsEntries.empty()) + { + return 0; + } + + static std::string output; + MakePropertyList(output, this->Internal->CompileDefinitionsEntries); + return output.c_str(); } + else if(prop == "LINK_LIBRARIES") + { + if (this->Internal->LinkImplementationPropertyEntries.empty()) + { + return 0; + } - static std::string output; - output = ""; - std::string sep; - for (std::vector::const_iterator - it = this->Internal->LinkImplementationPropertyEntries.begin(), - end = this->Internal->LinkImplementationPropertyEntries.end(); - it != end; ++it) + static std::string output; + output = ""; + std::string sep; + for (std::vector::const_iterator + it = this->Internal->LinkImplementationPropertyEntries.begin(), + end = this->Internal->LinkImplementationPropertyEntries.end(); + it != end; ++it) + { + output += sep; + output += it->Value; + sep = ";"; + } + return output.c_str(); + } + else if (prop == "IMPORTED") { - output += sep; - output += it->Value; - sep = ";"; + return this->IsImported()?"TRUE":"FALSE"; } - return output.c_str(); - } - else if (prop == "IMPORTED") - { - return this->IsImported()?"TRUE":"FALSE"; - } - else if (prop == "NAME") - { - return this->GetName().c_str(); - } - else if(prop == "SOURCES") - { - if (this->Internal->SourceEntries.empty()) + else if (prop == "NAME") { - return 0; + return this->GetName().c_str(); } - - cmOStringStream ss; - const char* sep = ""; - typedef cmTargetInternals::TargetPropertyEntry - TargetPropertyEntry; - for(std::vector::const_iterator - i = this->Internal->SourceEntries.begin(); - i != this->Internal->SourceEntries.end(); ++i) + else if(prop == "SOURCES") { - std::string entry = (*i)->ge->GetInput(); + if (this->Internal->SourceEntries.empty()) + { + return 0; + } - std::vector files; - cmSystemTools::ExpandListArgument(entry, files); - for (std::vector::const_iterator - li = files.begin(); li != files.end(); ++li) + cmOStringStream ss; + const char* sep = ""; + typedef cmTargetInternals::TargetPropertyEntry + TargetPropertyEntry; + for(std::vector::const_iterator + i = this->Internal->SourceEntries.begin(); + i != this->Internal->SourceEntries.end(); ++i) { - if(cmHasLiteralPrefix(*li, "$size() - 1] == '>') - { - std::string objLibName = li->substr(17, li->size()-18); + std::string entry = (*i)->ge->GetInput(); - if (cmGeneratorExpression::Find(objLibName) != std::string::npos) + std::vector files; + cmSystemTools::ExpandListArgument(entry, files); + for (std::vector::const_iterator + li = files.begin(); li != files.end(); ++li) + { + if(cmHasLiteralPrefix(*li, "$size() - 1] == '>') { - ss << sep; - sep = ";"; - ss << *li; - continue; - } + std::string objLibName = li->substr(17, li->size()-18); - bool addContent = false; - bool noMessage = true; - cmOStringStream e; - cmake::MessageType messageType = cmake::AUTHOR_WARNING; - switch(context->GetPolicyStatus(cmPolicies::CMP0051)) - { - case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0051)) << "\n"; - noMessage = false; - case cmPolicies::OLD: - break; - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::NEW: - addContent = true; - } - if (!noMessage) - { - e << "Target \"" << this->Name << "\" contains $ " - "generator expression in its sources list. This content was not " - "previously part of the SOURCES property when that property was " - "read at configure time. Code reading that property needs to be " - "adapted to ignore the generator expression using the " - "string(GENEX_STRIP) command."; - context->IssueMessage(messageType, e.str()); + if (cmGeneratorExpression::Find(objLibName) != std::string::npos) + { + ss << sep; + sep = ";"; + ss << *li; + continue; + } + + bool addContent = false; + bool noMessage = true; + cmOStringStream e; + cmake::MessageType messageType = cmake::AUTHOR_WARNING; + switch(context->GetPolicyStatus(cmPolicies::CMP0051)) + { + case cmPolicies::WARN: + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0051)) << "\n"; + noMessage = false; + case cmPolicies::OLD: + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: + addContent = true; + } + if (!noMessage) + { + e << "Target \"" << this->Name << "\" contains $ " + "generator expression in its sources list. This content was not " + "previously part of the SOURCES property when that property was " + "read at configure time. Code reading that property needs to be " + "adapted to ignore the generator expression using the " + "string(GENEX_STRIP) command."; + context->IssueMessage(messageType, e.str()); + } + if (addContent) + { + ss << sep; + sep = ";"; + ss << *li; + } } - if (addContent) + else if (cmGeneratorExpression::Find(*li) == std::string::npos) { ss << sep; sep = ";"; ss << *li; } - } - else if (cmGeneratorExpression::Find(*li) == std::string::npos) - { - ss << sep; - sep = ";"; - ss << *li; - } - else - { - cmSourceFile *sf = this->Makefile->GetOrCreateSource(*li); - // Construct what is known about this source file location. - cmSourceFileLocation const& location = sf->GetLocation(); - std::string sname = location.GetDirectory(); - if(!sname.empty()) + else { - sname += "/"; - } - sname += location.GetName(); + cmSourceFile *sf = this->Makefile->GetOrCreateSource(*li); + // Construct what is known about this source file location. + cmSourceFileLocation const& location = sf->GetLocation(); + std::string sname = location.GetDirectory(); + if(!sname.empty()) + { + sname += "/"; + } + sname += location.GetName(); - ss << sep; - sep = ";"; - // Append this list entry. - ss << sname; + ss << sep; + sep = ";"; + // Append this list entry. + ss << sname; + } } } + this->Properties.SetProperty("SOURCES", ss.str().c_str(), + cmProperty::TARGET); + } + // the type property returns what type the target is + else if (prop == "TYPE") + { + return cmTarget::GetTargetTypeName(this->GetType()); } - this->Properties.SetProperty("SOURCES", ss.str().c_str(), - cmProperty::TARGET); - } - // the type property returns what type the target is - else if (prop == "TYPE") - { - return cmTarget::GetTargetTypeName(this->GetType()); } bool chain = false; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4cfa918a9ae983274a7995ca89fb46fdf570b00c commit 4cfa918a9ae983274a7995ca89fb46fdf570b00c Author: Ben Boeckel AuthorDate: Sat Feb 8 05:27:24 2014 -0500 Commit: Ben Boeckel CommitDate: Wed Jul 16 17:28:32 2014 -0400 cmTarget: Factor out common code diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 641ac41..8be14f3 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2994,6 +2994,22 @@ bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const } //---------------------------------------------------------------------------- +static void MakePropertyList(std::string& output, + std::vector const& values) +{ + output = ""; + std::string sep; + for (std::vector::const_iterator + it = values.begin(), end = values.end(); + it != end; ++it) + { + output += sep; + output += (*it)->ge->GetInput(); + sep = ";"; + } +} + +//---------------------------------------------------------------------------- const char *cmTarget::GetProperty(const std::string& prop) const { return this->GetProperty(prop, this->Makefile); @@ -3077,19 +3093,7 @@ const char *cmTarget::GetProperty(const std::string& prop, } static std::string output; - output = ""; - std::string sep; - typedef cmTargetInternals::TargetPropertyEntry - TargetPropertyEntry; - for (std::vector::const_iterator - it = this->Internal->IncludeDirectoriesEntries.begin(), - end = this->Internal->IncludeDirectoriesEntries.end(); - it != end; ++it) - { - output += sep; - output += (*it)->ge->GetInput(); - sep = ";"; - } + MakePropertyList(output, this->Internal->IncludeDirectoriesEntries); return output.c_str(); } else if(prop == "COMPILE_OPTIONS") @@ -3100,19 +3104,7 @@ const char *cmTarget::GetProperty(const std::string& prop, } static std::string output; - output = ""; - std::string sep; - typedef cmTargetInternals::TargetPropertyEntry - TargetPropertyEntry; - for (std::vector::const_iterator - it = this->Internal->CompileOptionsEntries.begin(), - end = this->Internal->CompileOptionsEntries.end(); - it != end; ++it) - { - output += sep; - output += (*it)->ge->GetInput(); - sep = ";"; - } + MakePropertyList(output, this->Internal->CompileOptionsEntries); return output.c_str(); } else if(prop == "COMPILE_FEATURES") @@ -3123,19 +3115,7 @@ const char *cmTarget::GetProperty(const std::string& prop, } static std::string output; - output = ""; - std::string sep; - typedef cmTargetInternals::TargetPropertyEntry - TargetPropertyEntry; - for (std::vector::const_iterator - it = this->Internal->CompileFeaturesEntries.begin(), - end = this->Internal->CompileFeaturesEntries.end(); - it != end; ++it) - { - output += sep; - output += (*it)->ge->GetInput(); - sep = ";"; - } + MakePropertyList(output, this->Internal->CompileFeaturesEntries); return output.c_str(); } else if(prop == "COMPILE_DEFINITIONS") @@ -3146,19 +3126,7 @@ const char *cmTarget::GetProperty(const std::string& prop, } static std::string output; - output = ""; - std::string sep; - typedef cmTargetInternals::TargetPropertyEntry - TargetPropertyEntry; - for (std::vector::const_iterator - it = this->Internal->CompileDefinitionsEntries.begin(), - end = this->Internal->CompileDefinitionsEntries.end(); - it != end; ++it) - { - output += sep; - output += (*it)->ge->GetInput(); - sep = ";"; - } + MakePropertyList(output, this->Internal->CompileDefinitionsEntries); return output.c_str(); } else if(prop == "LINK_LIBRARIES") http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=85242b7df63a8097c5672c3053873aec371b6af7 commit 85242b7df63a8097c5672c3053873aec371b6af7 Author: Ben Boeckel AuthorDate: Mon Feb 3 16:09:16 2014 -0500 Commit: Ben Boeckel CommitDate: Wed Jul 16 17:28:32 2014 -0400 cmTarget: Use else/if trees rather than an if tree Skips lots of unnecessary string comparisons. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b4688c4..641ac41 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1750,15 +1750,14 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } - - if (prop == "NAME") + else if (prop == "NAME") { cmOStringStream e; e << "NAME property is read-only\n"; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } - if(prop == "INCLUDE_DIRECTORIES") + else if(prop == "INCLUDE_DIRECTORIES") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression ge(&lfbt); @@ -1766,9 +1765,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) cmsys::auto_ptr cge = ge.Parse(value); this->Internal->IncludeDirectoriesEntries.push_back( new cmTargetInternals::TargetPropertyEntry(cge)); - return; } - if(prop == "COMPILE_OPTIONS") + else if(prop == "COMPILE_OPTIONS") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression ge(&lfbt); @@ -1776,9 +1774,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) cmsys::auto_ptr cge = ge.Parse(value); this->Internal->CompileOptionsEntries.push_back( new cmTargetInternals::TargetPropertyEntry(cge)); - return; } - if(prop == "COMPILE_FEATURES") + else if(prop == "COMPILE_FEATURES") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression ge(&lfbt); @@ -1786,9 +1783,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) cmsys::auto_ptr cge = ge.Parse(value); this->Internal->CompileFeaturesEntries.push_back( new cmTargetInternals::TargetPropertyEntry(cge)); - return; } - if(prop == "COMPILE_DEFINITIONS") + else if(prop == "COMPILE_DEFINITIONS") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression ge(&lfbt); @@ -1796,25 +1792,22 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) cmsys::auto_ptr cge = ge.Parse(value); this->Internal->CompileDefinitionsEntries.push_back( new cmTargetInternals::TargetPropertyEntry(cge)); - return; } - if(prop == "EXPORT_NAME" && this->IsImported()) + else if(prop == "EXPORT_NAME" && this->IsImported()) { cmOStringStream e; e << "EXPORT_NAME property can't be set on imported targets (\"" << this->Name << "\")\n"; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); - return; } - if (prop == "LINK_LIBRARIES") + else if (prop == "LINK_LIBRARIES") { this->Internal->LinkImplementationPropertyEntries.clear(); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmValueWithOrigin entry(value, lfbt); this->Internal->LinkImplementationPropertyEntries.push_back(entry); - return; } - if (prop == "SOURCES") + else if (prop == "SOURCES") { if(this->IsImported()) { @@ -1831,10 +1824,12 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) cmsys::auto_ptr cge = ge.Parse(value); this->Internal->SourceEntries.push_back( new cmTargetInternals::TargetPropertyEntry(cge)); - return; } - this->Properties.SetProperty(prop, value, cmProperty::TARGET); - this->MaybeInvalidatePropertyCache(prop); + else + { + this->Properties.SetProperty(prop, value, cmProperty::TARGET); + this->MaybeInvalidatePropertyCache(prop); + } } //---------------------------------------------------------------------------- @@ -1850,61 +1845,55 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } - if (prop == "NAME") + else if (prop == "NAME") { cmOStringStream e; e << "NAME property is read-only\n"; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } - if(prop == "INCLUDE_DIRECTORIES") + else if(prop == "INCLUDE_DIRECTORIES") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression ge(&lfbt); this->Internal->IncludeDirectoriesEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); - return; } - if(prop == "COMPILE_OPTIONS") + else if(prop == "COMPILE_OPTIONS") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression ge(&lfbt); this->Internal->CompileOptionsEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); - return; } - if(prop == "COMPILE_FEATURES") + else if(prop == "COMPILE_FEATURES") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression ge(&lfbt); this->Internal->CompileFeaturesEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); - return; } - if(prop == "COMPILE_DEFINITIONS") + else if(prop == "COMPILE_DEFINITIONS") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression ge(&lfbt); this->Internal->CompileDefinitionsEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); - return; } - if(prop == "EXPORT_NAME" && this->IsImported()) + else if(prop == "EXPORT_NAME" && this->IsImported()) { cmOStringStream e; e << "EXPORT_NAME property can't be set on imported targets (\"" << this->Name << "\")\n"; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); - return; } - if (prop == "LINK_LIBRARIES") + else if (prop == "LINK_LIBRARIES") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmValueWithOrigin entry(value, lfbt); this->Internal->LinkImplementationPropertyEntries.push_back(entry); - return; } - if (prop == "SOURCES") + else if (prop == "SOURCES") { if(this->IsImported()) { @@ -1920,10 +1909,12 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, cmsys::auto_ptr cge = ge.Parse(value); this->Internal->SourceEntries.push_back( new cmTargetInternals::TargetPropertyEntry(cge)); - return; } - this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString); - this->MaybeInvalidatePropertyCache(prop); + else + { + this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString); + this->MaybeInvalidatePropertyCache(prop); + } } //---------------------------------------------------------------------------- @@ -3022,11 +3013,6 @@ const char *cmTarget::GetProperty(const std::string& prop, return 0; } - if (prop == "NAME") - { - return this->GetName().c_str(); - } - // Watch for special "computed" properties that are dependent on // other properties or variables. Always recompute them. if(this->GetType() == cmTarget::EXECUTABLE || @@ -3106,7 +3092,7 @@ const char *cmTarget::GetProperty(const std::string& prop, } return output.c_str(); } - if(prop == "COMPILE_OPTIONS") + else if(prop == "COMPILE_OPTIONS") { if (this->Internal->CompileOptionsEntries.empty()) { @@ -3129,7 +3115,7 @@ const char *cmTarget::GetProperty(const std::string& prop, } return output.c_str(); } - if(prop == "COMPILE_FEATURES") + else if(prop == "COMPILE_FEATURES") { if (this->Internal->CompileFeaturesEntries.empty()) { @@ -3152,7 +3138,7 @@ const char *cmTarget::GetProperty(const std::string& prop, } return output.c_str(); } - if(prop == "COMPILE_DEFINITIONS") + else if(prop == "COMPILE_DEFINITIONS") { if (this->Internal->CompileDefinitionsEntries.empty()) { @@ -3175,7 +3161,7 @@ const char *cmTarget::GetProperty(const std::string& prop, } return output.c_str(); } - if(prop == "LINK_LIBRARIES") + else if(prop == "LINK_LIBRARIES") { if (this->Internal->LinkImplementationPropertyEntries.empty()) { @@ -3196,13 +3182,15 @@ const char *cmTarget::GetProperty(const std::string& prop, } return output.c_str(); } - - if (prop == "IMPORTED") + else if (prop == "IMPORTED") { return this->IsImported()?"TRUE":"FALSE"; } - - if(prop == "SOURCES") + else if (prop == "NAME") + { + return this->GetName().c_str(); + } + else if(prop == "SOURCES") { if (this->Internal->SourceEntries.empty()) { @@ -3299,12 +3287,12 @@ const char *cmTarget::GetProperty(const std::string& prop, this->Properties.SetProperty("SOURCES", ss.str().c_str(), cmProperty::TARGET); } - // the type property returns what type the target is - if (prop == "TYPE") + else if (prop == "TYPE") { return cmTarget::GetTargetTypeName(this->GetType()); } + bool chain = false; const char *retVal = this->Properties.GetPropertyValue(prop, cmProperty::TARGET, chain); ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpressionEvaluator.cxx | 13 +- Source/cmTarget.cxx | 665 ++++++++++---------- Source/cmTarget.h | 7 + .../include_directories/RunCMakeTest.cmake | 6 +- 4 files changed, 359 insertions(+), 332 deletions(-) hooks/post-receive -- CMake From ben.boeckel at kitware.com Wed Jul 16 17:32:56 2014 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Wed, 16 Jul 2014 17:32:56 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4318-g77066b4 Message-ID: <20140716213256.953AA40715@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 77066b46b623d4adca35cdbb196dcec4472c54ab (commit) via dccda39c29010f18b4f4d6f1d1b49552073e767e (commit) from c77871bb8b938d98420f4e7cd833cc38b58fd748 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=77066b46b623d4adca35cdbb196dcec4472c54ab commit 77066b46b623d4adca35cdbb196dcec4472c54ab Merge: c77871b dccda39 Author: Ben Boeckel AuthorDate: Wed Jul 16 17:32:55 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 16 17:32:55 2014 -0400 Merge topic 'dev/target-fastpaths' into next dccda39c fixup! cmTarget: Use static strings for special property names http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dccda39c29010f18b4f4d6f1d1b49552073e767e commit dccda39c29010f18b4f4d6f1d1b49552073e767e Author: Ben Boeckel AuthorDate: Wed Jul 16 17:32:48 2014 -0400 Commit: Ben Boeckel CommitDate: Wed Jul 16 17:32:48 2014 -0400 fixup! cmTarget: Use static strings for special property names diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 47ca8dd..393c447 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6197,7 +6197,6 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( // Compare the link implementation fallback link interface to the // preferred new link interface property and warn if different. std::vector ifaceLibs; - if(const char* newExplicitLibraries = this->GetProperty(newProp)) if(const char* newExplicitLibraries = thisTarget->GetProperty(newProp)) { thisTarget->ExpandLinkItems(newProp, newExplicitLibraries, config, ----------------------------------------------------------------------- Summary of changes: Source/cmTarget.cxx | 1 - 1 file changed, 1 deletion(-) hooks/post-receive -- CMake From ben.boeckel at kitware.com Wed Jul 16 17:35:25 2014 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Wed, 16 Jul 2014 17:35:25 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4320-gf1e74a6 Message-ID: <20140716213525.43BFD40867@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f1e74a6f0351650fd7108f34e8f63bb8f1e4ab6d (commit) via 086201fcca622e97d6925523671a99efadf4c885 (commit) from 77066b46b623d4adca35cdbb196dcec4472c54ab (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f1e74a6f0351650fd7108f34e8f63bb8f1e4ab6d commit f1e74a6f0351650fd7108f34e8f63bb8f1e4ab6d Merge: 77066b4 086201f Author: Ben Boeckel AuthorDate: Wed Jul 16 17:35:24 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 16 17:35:24 2014 -0400 Merge topic 'dev/target-fastpaths' into next 086201fc fixup! cmTarget: Use static strings for special property names http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=086201fcca622e97d6925523671a99efadf4c885 commit 086201fcca622e97d6925523671a99efadf4c885 Author: Ben Boeckel AuthorDate: Wed Jul 16 17:35:17 2014 -0400 Commit: Ben Boeckel CommitDate: Wed Jul 16 17:35:17 2014 -0400 fixup! cmTarget: Use static strings for special property names diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 393c447..a203a7f 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6197,6 +6197,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( // Compare the link implementation fallback link interface to the // preferred new link interface property and warn if different. std::vector ifaceLibs; + static const std::string newProp = "INTERFACE_LINK_LIBRARIES"; if(const char* newExplicitLibraries = thisTarget->GetProperty(newProp)) { thisTarget->ExpandLinkItems(newProp, newExplicitLibraries, config, ----------------------------------------------------------------------- Summary of changes: Source/cmTarget.cxx | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 17 00:02:23 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 17 Jul 2014 00:02:23 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1412-ge411b30 Message-ID: <20140717040223.A6DCE402FB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via e411b3084241109f98b75ae2d7619eae40ca1e3d (commit) from a0dc1354fe5effa1ff484b441595f8bdb6da3533 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e411b3084241109f98b75ae2d7619eae40ca1e3d commit e411b3084241109f98b75ae2d7619eae40ca1e3d Author: Kitware Robot AuthorDate: Thu Jul 17 00:01:11 2014 -0400 Commit: Kitware Robot CommitDate: Thu Jul 17 00:01:11 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e2849ca..eb5dd2e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140716) +set(CMake_VERSION_PATCH 20140717) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 17 08:18:20 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 17 Jul 2014 08:18:20 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4322-g3ac03fb Message-ID: <20140717121820.8FFC04038D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 3ac03fb1e3a9634721101e4b4566b37daa9929b7 (commit) via 727ab63ca8f9b174e11630b11a373b5837da0b75 (commit) from f1e74a6f0351650fd7108f34e8f63bb8f1e4ab6d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3ac03fb1e3a9634721101e4b4566b37daa9929b7 commit 3ac03fb1e3a9634721101e4b4566b37daa9929b7 Merge: f1e74a6 727ab63 Author: Brad King AuthorDate: Thu Jul 17 08:18:19 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 17 08:18:19 2014 -0400 Merge topic 'fix_Xcode_generator_name' into next 727ab63c Revert "Tests: Xcode >= 3 passes SubDirSpaces" http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=727ab63ca8f9b174e11630b11a373b5837da0b75 commit 727ab63ca8f9b174e11630b11a373b5837da0b75 Author: Brad King AuthorDate: Thu Jul 17 08:19:08 2014 -0400 Commit: Brad King CommitDate: Thu Jul 17 08:19:20 2014 -0400 Revert "Tests: Xcode >= 3 passes SubDirSpaces" This reverts commit 2427f523f629ee82847bc934be2cd6c6f1074560. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 90cc9ef..ca7fcdc 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1502,8 +1502,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) endif() - if(MAKE_SUPPORTS_SPACES AND - NOT (CMAKE_GENERATOR STREQUAL "Xcode" AND XCODE_VERSION VERSION_LESS 3)) + if(MAKE_SUPPORTS_SPACES AND NOT CMAKE_GENERATOR STREQUAL "Xcode") add_test(SubDirSpaces ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubDirSpaces" ----------------------------------------------------------------------- Summary of changes: Tests/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 17 08:40:02 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 17 Jul 2014 08:40:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4324-gd913fb3 Message-ID: <20140717124002.8DA551CA37@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d913fb3da353c0e9b2424a1bd358b9f8b2082315 (commit) via e58594a8a94531682b4fbba4f8df3473f77529af (commit) from 3ac03fb1e3a9634721101e4b4566b37daa9929b7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d913fb3da353c0e9b2424a1bd358b9f8b2082315 commit d913fb3da353c0e9b2424a1bd358b9f8b2082315 Merge: 3ac03fb e58594a Author: Brad King AuthorDate: Thu Jul 17 08:40:01 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 17 08:40:01 2014 -0400 Merge topic 'fix-QCC-compile-flags' into next e58594a8 QNX: Split Platform and Compiler information modules http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e58594a8a94531682b4fbba4f8df3473f77529af commit e58594a8a94531682b4fbba4f8df3473f77529af Author: Brad King AuthorDate: Thu Jul 17 08:33:08 2014 -0400 Commit: Brad King CommitDate: Thu Jul 17 08:35:10 2014 -0400 QNX: Split Platform and Compiler information modules Move QCC-specific information into Compiler/QCC modules. diff --git a/Modules/Compiler/QCC-C.cmake b/Modules/Compiler/QCC-C.cmake new file mode 100644 index 0000000..ae4a2f4 --- /dev/null +++ b/Modules/Compiler/QCC-C.cmake @@ -0,0 +1,2 @@ +include(Compiler/QCC) +__compiler_qcc(C) diff --git a/Modules/Compiler/QCC-CXX.cmake b/Modules/Compiler/QCC-CXX.cmake new file mode 100644 index 0000000..a676bbe --- /dev/null +++ b/Modules/Compiler/QCC-CXX.cmake @@ -0,0 +1,12 @@ +include(Compiler/QCC) +__compiler_qcc(CXX) + +# If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the +# default for the driver is not c++. +set(CMAKE_CXX_COMPILE_OBJECT + " -lang-c++ -o -c ") + +set(CMAKE_CXX_LINK_EXECUTABLE + " -lang-c++ -o ") + +set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") diff --git a/Modules/Compiler/QCC.cmake b/Modules/Compiler/QCC.cmake new file mode 100644 index 0000000..76477e4 --- /dev/null +++ b/Modules/Compiler/QCC.cmake @@ -0,0 +1,24 @@ + +#============================================================================= +# Copyright 2002-2014 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) +include(Compiler/GNU) + +macro(__compiler_qcc lang) + __compiler_gnu(${lang}) + + # http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples + set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-V") + + set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,") + set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MMD,,-MT,,-MF,") +endmacro() diff --git a/Modules/Platform/QNX-QCC-C.cmake b/Modules/Platform/QNX-QCC-C.cmake deleted file mode 100644 index e5721a7..0000000 --- a/Modules/Platform/QNX-QCC-C.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -include(Platform/QNX) - -__compiler_qcc(C) diff --git a/Modules/Platform/QNX-QCC-CXX.cmake b/Modules/Platform/QNX-QCC-CXX.cmake deleted file mode 100644 index e490bbe..0000000 --- a/Modules/Platform/QNX-QCC-CXX.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -include(Platform/QNX) - -__compiler_qcc(CXX) diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake index ce7eb8a..ebc4609 100644 --- a/Modules/Platform/QNX.cmake +++ b/Modules/Platform/QNX.cmake @@ -1,5 +1,8 @@ set(QNXNTO 1) +include(Platform/GNU) +unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX) + set(CMAKE_DL_LIBS "") # Shared libraries with no builtin soname may not be linked safely by @@ -14,39 +17,3 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE) set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") endforeach() - -include(Platform/GNU) -unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX) - -macro(__compiler_qcc lang) - # http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples - set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-V") - - set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,") - set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MMD,,-MT,,-MF,") - - set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE") - set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") - - # Initial configuration flags. - set(CMAKE_${lang}_FLAGS_INIT "") - set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g") - set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") - set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") - set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") - set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") - set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") - - if (${lang} STREQUAL CXX) - # If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the - # default for the driver is not c++. - set(CMAKE_CXX_COMPILE_OBJECT - " -lang-c++ -o -c ") - - set(CMAKE_CXX_LINK_EXECUTABLE - " -lang-c++ -o ") - - set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") - endif() - -endmacro() ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/QCC-C.cmake | 2 + Modules/Compiler/QCC-CXX.cmake | 12 ++++++ .../QCC.cmake} | 12 ++++-- Modules/Platform/QNX-QCC-C.cmake | 4 -- Modules/Platform/QNX-QCC-CXX.cmake | 4 -- Modules/Platform/QNX.cmake | 39 ++------------------ 6 files changed, 25 insertions(+), 48 deletions(-) create mode 100644 Modules/Compiler/QCC-C.cmake create mode 100644 Modules/Compiler/QCC-CXX.cmake copy Modules/{CMakeSystemSpecificInitialize.cmake => Compiler/QCC.cmake} (62%) delete mode 100644 Modules/Platform/QNX-QCC-C.cmake delete mode 100644 Modules/Platform/QNX-QCC-CXX.cmake hooks/post-receive -- CMake From ben.boeckel at kitware.com Thu Jul 17 09:27:41 2014 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Thu, 17 Jul 2014 09:27:41 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4327-g90d9a5d Message-ID: <20140717132741.1297E4075D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 90d9a5d367cf433b8431aedbe08604284efb9a9a (commit) via 511213e24af5a639920dc94fd7df1f3d24176a88 (commit) via fe0c29487b890e5f3f7f7196ee1b2cf4d5f27397 (commit) from d913fb3da353c0e9b2424a1bd358b9f8b2082315 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90d9a5d367cf433b8431aedbe08604284efb9a9a commit 90d9a5d367cf433b8431aedbe08604284efb9a9a Merge: d913fb3 511213e Author: Ben Boeckel AuthorDate: Thu Jul 17 09:27:40 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 17 09:27:40 2014 -0400 Merge topic 'dev/target-fastpaths' into next 511213e2 fixup! cmTarget: Use static strings for special property names fe0c2948 fixup! cmTarget: Fast path for regular properties http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=511213e24af5a639920dc94fd7df1f3d24176a88 commit 511213e24af5a639920dc94fd7df1f3d24176a88 Author: Ben Boeckel AuthorDate: Thu Jul 17 09:25:49 2014 -0400 Commit: Ben Boeckel CommitDate: Thu Jul 17 09:25:49 2014 -0400 fixup! cmTarget: Use static strings for special property names diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 7479133..843761f 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -5076,7 +5076,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, CompatibleType t, PropertyType *) { - PropertyType propContent = getTypedProperty(tgt, p.c_str(), + PropertyType propContent = getTypedProperty(tgt, p, 0); const bool explicitlySet = tgt->GetProperties() .find(p) @@ -5130,7 +5130,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, != theTarget->GetProperties().end(); PropertyType ifacePropContent = getTypedProperty(theTarget, - interfaceProperty.c_str(), 0); + interfaceProperty, 0); std::string reportEntry; if (ifaceIsSet) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fe0c29487b890e5f3f7f7196ee1b2cf4d5f27397 commit fe0c29487b890e5f3f7f7196ee1b2cf4d5f27397 Author: Ben Boeckel AuthorDate: Thu Jul 17 09:21:19 2014 -0400 Commit: Ben Boeckel CommitDate: Thu Jul 17 09:21:19 2014 -0400 fixup! cmTarget: Fast path for regular properties diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a203a7f..7479133 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3260,12 +3260,12 @@ const char *cmTarget::GetProperty(const std::string& prop, } if (!noMessage) { - e << "Target \"" << this->Name << "\" contains $ " - "generator expression in its sources list. This content was not " - "previously part of the SOURCES property when that property was " - "read at configure time. Code reading that property needs to be " - "adapted to ignore the generator expression using the " - "string(GENEX_STRIP) command."; + e << "Target \"" << this->Name << "\" contains " + "$ generator expression in its sources list. " + "This content was not previously part of the SOURCES property " + "when that property was read at configure time. Code reading " + "that property needs to be adapted to ignore the generator " + "expression using the string(GENEX_STRIP) command."; context->IssueMessage(messageType, e.str()); } if (addContent) ----------------------------------------------------------------------- Summary of changes: Source/cmTarget.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 17 09:31:07 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 17 Jul 2014 09:31:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4329-g6f9ed3e Message-ID: <20140717133107.CE57E4089B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 6f9ed3e5b7b9b97b58af9464d927bbda55dea6b4 (commit) via 3526478cc093f1fc6c1887e1059f337fb7086cc7 (commit) from 90d9a5d367cf433b8431aedbe08604284efb9a9a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6f9ed3e5b7b9b97b58af9464d927bbda55dea6b4 commit 6f9ed3e5b7b9b97b58af9464d927bbda55dea6b4 Merge: 90d9a5d 3526478 Author: Brad King AuthorDate: Thu Jul 17 09:31:07 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 17 09:31:07 2014 -0400 Merge topic 'fix_Xcode_generator_name' into next 3526478c Tests: Activate tests accidentally excluded from Xcode http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3526478cc093f1fc6c1887e1059f337fb7086cc7 commit 3526478cc093f1fc6c1887e1059f337fb7086cc7 Author: Brad King AuthorDate: Thu Jul 17 09:31:53 2014 -0400 Commit: Brad King CommitDate: Thu Jul 17 09:31:53 2014 -0400 Tests: Activate tests accidentally excluded from Xcode The generator name is "Xcode", not "XCode". Fix this typo. Explicitly exclude the SubDirSpaces test on Xcode because it does not work. Also tell the RunCMake.File_Generate test when Xcode is not multi-config so it can exlcude the OutputConflict case. Inspired-by: Daniele E. Domenichelli diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index dc4f894..ca7fcdc 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -77,7 +77,7 @@ if(BUILD_TESTING) # some old versions of make simply cannot handle spaces in paths if (MAKE_IS_GNU OR CMAKE_MAKE_PROGRAM MATCHES "nmake|gmake|wmake" OR - CMAKE_GENERATOR MATCHES "Visual Studio|XCode|Borland") + CMAKE_GENERATOR MATCHES "Visual Studio|Xcode|Borland") set(MAKE_SUPPORTS_SPACES 1) else() set(MAKE_SUPPORTS_SPACES 0) @@ -1502,7 +1502,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) endif() - if(MAKE_SUPPORTS_SPACES) + if(MAKE_SUPPORTS_SPACES AND NOT CMAKE_GENERATOR STREQUAL "Xcode") add_test(SubDirSpaces ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubDirSpaces" diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 06272ce..ff3b9a0 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -18,6 +18,7 @@ endif() if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 2) set(TargetSources_ARGS -DXCODE_BELOW_2=1) + set(File_Generate_ARGS -DXCODE_BELOW_2=1) endif() add_RunCMake_test(CMP0019) diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index f74d17e..dee0692 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -1,8 +1,8 @@ include(RunCMake) run_cmake(CommandConflict) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio" OR "${RunCMake_GENERATOR}" MATCHES "XCode" ) - run_cmake(OutputConflict) +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode" AND NOT XCODE_BELOW_2) + run_cmake(OutputConflict) endif() run_cmake(EmptyCondition1) run_cmake(EmptyCondition2) ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 17 09:35:54 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 17 Jul 2014 09:35:54 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4331-gc7244c6 Message-ID: <20140717133554.2906240908@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via c7244c6b863d3a670e8aa0a032173cf334556be9 (commit) via 3151024d241c581463d20bf0ce3d1060bdd22de4 (commit) from 6f9ed3e5b7b9b97b58af9464d927bbda55dea6b4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c7244c6b863d3a670e8aa0a032173cf334556be9 commit c7244c6b863d3a670e8aa0a032173cf334556be9 Merge: 6f9ed3e 3151024 Author: Brad King AuthorDate: Thu Jul 17 09:35:53 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 17 09:35:53 2014 -0400 Merge topic 'fix-QCC-compile-flags' into next 3151024d QNX: Add missing flags for configurations and artifact creation. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3151024d241c581463d20bf0ce3d1060bdd22de4 commit 3151024d241c581463d20bf0ce3d1060bdd22de4 Author: Stephen Kelly AuthorDate: Tue Jul 15 11:01:36 2014 +0200 Commit: Brad King CommitDate: Thu Jul 17 09:36:18 2014 -0400 QNX: Add missing flags for configurations and artifact creation. Commit v3.0.0-rc1~111^2 (QNX: Introduce QCC compiler id for that QNX platform compiler., 2014-01-20) split handling of the QNX QCC compiler into a separate compiler-id. That refactoring results in the QCC compiler not using the CMake-compiler-id "GNU", which means that the __compiler_gnu macro is no longer executed for it. Add Compiler/QCC*.cmake modules to define and call the __compiler_qcc macro and teach it to call __compiler_gnu internally. Remove the corresponding pieces from the Platform/QNX*.cmake modules. It is also necessary to change the language conditional to dereference the lang macro parameter, which is another bug introduced by the same commit. The extra -lang-c++ flag is only necessary when the CXX compiler is specified as 'qcc' instead of 'QCC' in the toolchain file, which is why this bug was not noticed before. The flag is also necessary in that case when linking in order to find the appropriate standard libraries. The flag was not previously added when linking executables, so linking failed even with CMake 2.8.12 with the lower-case compiler-id. Co-Author: Brad King diff --git a/Modules/Compiler/QCC-C.cmake b/Modules/Compiler/QCC-C.cmake new file mode 100644 index 0000000..ae4a2f4 --- /dev/null +++ b/Modules/Compiler/QCC-C.cmake @@ -0,0 +1,2 @@ +include(Compiler/QCC) +__compiler_qcc(C) diff --git a/Modules/Compiler/QCC-CXX.cmake b/Modules/Compiler/QCC-CXX.cmake new file mode 100644 index 0000000..a676bbe --- /dev/null +++ b/Modules/Compiler/QCC-CXX.cmake @@ -0,0 +1,12 @@ +include(Compiler/QCC) +__compiler_qcc(CXX) + +# If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the +# default for the driver is not c++. +set(CMAKE_CXX_COMPILE_OBJECT + " -lang-c++ -o -c ") + +set(CMAKE_CXX_LINK_EXECUTABLE + " -lang-c++ -o ") + +set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") diff --git a/Modules/Compiler/QCC.cmake b/Modules/Compiler/QCC.cmake new file mode 100644 index 0000000..76477e4 --- /dev/null +++ b/Modules/Compiler/QCC.cmake @@ -0,0 +1,24 @@ + +#============================================================================= +# Copyright 2002-2014 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) +include(Compiler/GNU) + +macro(__compiler_qcc lang) + __compiler_gnu(${lang}) + + # http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples + set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-V") + + set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,") + set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MMD,,-MT,,-MF,") +endmacro() diff --git a/Modules/Platform/QNX-QCC-C.cmake b/Modules/Platform/QNX-QCC-C.cmake deleted file mode 100644 index e5721a7..0000000 --- a/Modules/Platform/QNX-QCC-C.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -include(Platform/QNX) - -__compiler_qcc(C) diff --git a/Modules/Platform/QNX-QCC-CXX.cmake b/Modules/Platform/QNX-QCC-CXX.cmake deleted file mode 100644 index e490bbe..0000000 --- a/Modules/Platform/QNX-QCC-CXX.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -include(Platform/QNX) - -__compiler_qcc(CXX) diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake index cc551bd..ebc4609 100644 --- a/Modules/Platform/QNX.cmake +++ b/Modules/Platform/QNX.cmake @@ -1,5 +1,8 @@ set(QNXNTO 1) +include(Platform/GNU) +unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX) + set(CMAKE_DL_LIBS "") # Shared libraries with no builtin soname may not be linked safely by @@ -14,22 +17,3 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE) set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") endforeach() - -include(Platform/GNU) -unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX) - -macro(__compiler_qcc lang) - # http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples - set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-V") - - set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,") - set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MMD,,-MT,,-MF,") - - if (lang STREQUAL CXX) - # If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the - # default for the driver is not c++. - set(CMAKE_CXX_COMPILE_OBJECT - " -lang-c++ -o -c ") - endif() - -endmacro() ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 17 09:41:59 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 17 Jul 2014 09:41:59 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4333-g5368f21 Message-ID: <20140717134159.EE3C63F014@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 5368f212a9c27cbd8eaed20d9c580459fb258104 (commit) via fd63722dc86ec30e8a6f543881d56b3c473da34d (commit) from c7244c6b863d3a670e8aa0a032173cf334556be9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5368f212a9c27cbd8eaed20d9c580459fb258104 commit 5368f212a9c27cbd8eaed20d9c580459fb258104 Merge: c7244c6 fd63722 Author: Brad King AuthorDate: Thu Jul 17 09:41:59 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 17 09:41:59 2014 -0400 Merge topic 'compile-with-cray' into next fd63722d cmcurl: Fix a build failure with the Cray compiler on Linux (#15026) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd63722dc86ec30e8a6f543881d56b3c473da34d commit fd63722dc86ec30e8a6f543881d56b3c473da34d Author: Chuck Atkins AuthorDate: Wed Jul 16 09:04:42 2014 -0500 Commit: Brad King CommitDate: Thu Jul 17 09:43:05 2014 -0400 cmcurl: Fix a build failure with the Cray compiler on Linux (#15026) The error is caused by a workaround for UNICOS. The workaround incorrectly uses the _CRAYC macro to determine if building for UNICOS. This macro will always be defined for the Cray C and C++ compiler regardless of the target platform, even when building for Linux. The correct macro should be _CRAY, which as per Cray documentation is only defined for UNICOS targeted builds. diff --git a/Utilities/cmcurl/hostip.c b/Utilities/cmcurl/hostip.c index fd555ef..83f1564 100644 --- a/Utilities/cmcurl/hostip.c +++ b/Utilities/cmcurl/hostip.c @@ -609,7 +609,7 @@ Curl_addrinfo *Curl_ip2addr(in_addr_t num, const char *hostname, int port) h = &buf->hostentry; h->h_addr_list = &buf->h_addr_list[0]; addrentry = &buf->addrentry; -#ifdef _CRAYC +#ifdef _CRAY /* On UNICOS, s_addr is a bit field and for some reason assigning to it * doesn't work. There must be a better fix than this ugly hack. */ ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 17 09:42:58 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 17 Jul 2014 09:42:58 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1414-g96f2a2a Message-ID: <20140717134258.C2C533F5C8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 96f2a2a2eddc4f0591abe6b49f5c7a335515f971 (commit) via fd63722dc86ec30e8a6f543881d56b3c473da34d (commit) from e411b3084241109f98b75ae2d7619eae40ca1e3d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=96f2a2a2eddc4f0591abe6b49f5c7a335515f971 commit 96f2a2a2eddc4f0591abe6b49f5c7a335515f971 Merge: e411b30 fd63722 Author: Brad King AuthorDate: Thu Jul 17 09:42:57 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 17 09:42:57 2014 -0400 Merge topic 'compile-with-cray' fd63722d cmcurl: Fix a build failure with the Cray compiler on Linux (#15026) ----------------------------------------------------------------------- Summary of changes: Utilities/cmcurl/hostip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 17 09:43:01 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 17 Jul 2014 09:43:01 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1418-gbb4c158 Message-ID: <20140717134301.2E8883F4E4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via bb4c1588952523fa8340d6e882c2cb6f3501266b (commit) via 10c5c82c1e255523757d4c4fe81b6ad742e81c8f (commit) via 6e7e881c57e8ff7295a1007d329708143b54baad (commit) via 0400cd5dd1be33ebcc2c2d5dba8233a78b1cee68 (commit) from 96f2a2a2eddc4f0591abe6b49f5c7a335515f971 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bb4c1588952523fa8340d6e882c2cb6f3501266b commit bb4c1588952523fa8340d6e882c2cb6f3501266b Merge: 96f2a2a 10c5c82 Author: Brad King AuthorDate: Thu Jul 17 09:43:00 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 17 09:43:00 2014 -0400 Merge topic 'generalize-LINK_ONLY' 10c5c82c Help: Add notes for topic 'generalize-LINK_ONLY' 6e7e881c Honor $ when checking interface properties 0400cd5d Make $ available to projects (#14751) ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 7 +++++++ Help/release/dev/generalize-LINK_ONLY.rst | 6 ++++++ Source/cmTarget.cxx | 16 ++++------------ Tests/CompatibleInterface/CMakeLists.txt | 11 ++++++++++- .../CMP0026/empty.cpp => CompatibleInterface/bar.cpp} | 2 +- .../CompatibleInterface/foo.cpp | 2 +- Tests/CompatibleInterface/main.cpp | 8 +++++++- Tests/InterfaceLinkLibraries/CMakeLists.txt | 12 ++++++++++++ Tests/InterfaceLinkLibraries/main.cpp | 8 ++++++-- Tests/InterfaceLinkLibraries/zot.cpp | 6 ++++++ Tests/InterfaceLinkLibraries/{bar.h => zot.h} | 4 ++-- Tests/InterfaceLinkLibraries/zot_vs6_1.cpp | 1 + Tests/InterfaceLinkLibraries/zot_vs6_2.cpp | 1 + Tests/InterfaceLinkLibraries/zot_vs6_3.cpp | 1 + Tests/InterfaceLinkLibraries/zot_vs6_4.cpp | 1 + 15 files changed, 66 insertions(+), 20 deletions(-) create mode 100644 Help/release/dev/generalize-LINK_ONLY.rst copy Tests/{RunCMake/CMP0026/empty.cpp => CompatibleInterface/bar.cpp} (83%) copy Modules/DummyCXXFile.cxx => Tests/CompatibleInterface/foo.cpp (59%) create mode 100644 Tests/InterfaceLinkLibraries/zot.cpp copy Tests/InterfaceLinkLibraries/{bar.h => zot.h} (61%) create mode 100644 Tests/InterfaceLinkLibraries/zot_vs6_1.cpp create mode 100644 Tests/InterfaceLinkLibraries/zot_vs6_2.cpp create mode 100644 Tests/InterfaceLinkLibraries/zot_vs6_3.cpp create mode 100644 Tests/InterfaceLinkLibraries/zot_vs6_4.cpp hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 17 09:43:02 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 17 Jul 2014 09:43:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1428-ge451094 Message-ID: <20140717134302.D36583F5D7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via e4510941a3cc5f2990d79242db791bf370bb07d3 (commit) via c45dd669abe746de2e9724044591d70397653d98 (commit) via 89095514a7f6d7075e8d2fda1b88445b87a3bec8 (commit) via 9d72df45057afd955d6bbb7ee2ceb62ab8dc777a (commit) via d5f0743d0f97fb44bcfaafd8680a00631d1c7d40 (commit) via 60bafeb68404dc37434644f56e98000b3b0fff81 (commit) via 8cb9105431bcc4bd206d92b7cd53cebdb1a783bd (commit) via 0a8fbac19a1d12adaa10873cc8fdb3dff164c981 (commit) via fb3518dc81ac1b776503d4369c6d375a706485d1 (commit) via 535fd6ce6d514deebc8c95424df83f73989f55a5 (commit) from bb4c1588952523fa8340d6e882c2cb6f3501266b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e4510941a3cc5f2990d79242db791bf370bb07d3 commit e4510941a3cc5f2990d79242db791bf370bb07d3 Merge: bb4c158 c45dd66 Author: Brad King AuthorDate: Thu Jul 17 09:43:01 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 17 09:43:01 2014 -0400 Merge topic 'refactor-link-internals' c45dd669 cmTarget: Cache compatible interface property sets 89095514 cmTarget: Refactor GetLinkImplementationClosure internals 9d72df45 Genex: Adjust code layout slightly d5f0743d Genex: Refactor empty element strip 60bafeb6 Genex: Avoid repeated search of transitive property whitelist 8cb91054 Genex: Simplify TARGET_PROPERTY transitive lookup 0a8fbac1 cmTarget: Drop GetTransitivePropertyTargets method fb3518dc Refactor system include annotation propagation 535fd6ce cmTarget: Make GetLink*Libraries methods safer to use ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpressionEvaluator.cxx | 161 ++++++++++++----------------- Source/cmGeneratorTarget.cxx | 41 ++------ Source/cmTarget.cxx | 141 +++++++++++-------------- Source/cmTarget.h | 51 +++++---- 4 files changed, 165 insertions(+), 229 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 17 09:46:14 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 17 Jul 2014 09:46:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4338-gae1c1cf Message-ID: <20140717134614.361323F9DD@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ae1c1cf713b58f9fc88fe4853c7fb8de2f8a8dfe (commit) via e4510941a3cc5f2990d79242db791bf370bb07d3 (commit) via bb4c1588952523fa8340d6e882c2cb6f3501266b (commit) via 96f2a2a2eddc4f0591abe6b49f5c7a335515f971 (commit) via e411b3084241109f98b75ae2d7619eae40ca1e3d (commit) from 5368f212a9c27cbd8eaed20d9c580459fb258104 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ae1c1cf713b58f9fc88fe4853c7fb8de2f8a8dfe commit ae1c1cf713b58f9fc88fe4853c7fb8de2f8a8dfe Merge: 5368f21 e451094 Author: Brad King AuthorDate: Thu Jul 17 09:47:27 2014 -0400 Commit: Brad King CommitDate: Thu Jul 17 09:47:27 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From steveire at gmail.com Thu Jul 17 10:06:11 2014 From: steveire at gmail.com (Stephen Kelly) Date: Thu, 17 Jul 2014 10:06:11 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4340-g4d25272 Message-ID: <20140717140611.BA9CE407B9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 4d25272e7e1682b85164434e55fadf06e16e99f8 (commit) via 376ba93588e1dd24cb091c61f9fe635bceaf0a82 (commit) from ae1c1cf713b58f9fc88fe4853c7fb8de2f8a8dfe (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4d25272e7e1682b85164434e55fadf06e16e99f8 commit 4d25272e7e1682b85164434e55fadf06e16e99f8 Merge: ae1c1cf 376ba93 Author: Stephen Kelly AuthorDate: Thu Jul 17 10:06:11 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 17 10:06:11 2014 -0400 Merge topic 'identify-qthelp-artifacts' into next 376ba935 Help: Identify more artifact types in QtHelp documentation. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=376ba93588e1dd24cb091c61f9fe635bceaf0a82 commit 376ba93588e1dd24cb091c61f9fe635bceaf0a82 Author: Stephen Kelly AuthorDate: Wed Jun 18 17:12:53 2014 +0200 Commit: Stephen Kelly CommitDate: Thu Jul 17 16:05:10 2014 +0200 Help: Identify more artifact types in QtHelp documentation. Add identifiers for variables, properties, policies and modules. This will allow QtCreator to show relevant documentation if it learns more about the context of the contents of cmake files. diff --git a/Utilities/Sphinx/create_identifiers.py b/Utilities/Sphinx/create_identifiers.py index 4db7a3f..7715e53 100755 --- a/Utilities/Sphinx/create_identifiers.py +++ b/Utilities/Sphinx/create_identifiers.py @@ -19,13 +19,27 @@ if not lines: newlines = [] for line in lines: - if " This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via bd0274267f112ce43aa3f34779780026770612bd (commit) via f2fbd3c4f548e7afe4f3ab7b3fa3df2268a954ef (commit) from 4d25272e7e1682b85164434e55fadf06e16e99f8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bd0274267f112ce43aa3f34779780026770612bd commit bd0274267f112ce43aa3f34779780026770612bd Merge: 4d25272 f2fbd3c Author: Clinton Stimpson AuthorDate: Thu Jul 17 10:43:25 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 17 10:43:25 2014 -0400 Merge topic 'encoding-ctest-fixes' into next f2fbd3c4 Encoding: Fix build error with Sun 5.9 compiler. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f2fbd3c4f548e7afe4f3ab7b3fa3df2268a954ef commit f2fbd3c4f548e7afe4f3ab7b3fa3df2268a954ef Author: Clinton Stimpson AuthorDate: Thu Jul 17 08:42:28 2014 -0600 Commit: Clinton Stimpson CommitDate: Thu Jul 17 08:42:28 2014 -0600 Encoding: Fix build error with Sun 5.9 compiler. diff --git a/Tests/CTestTestMemcheck/memtester.cxx.in b/Tests/CTestTestMemcheck/memtester.cxx.in index fd8a2a8..43c0ba7 100644 --- a/Tests/CTestTestMemcheck/memtester.cxx.in +++ b/Tests/CTestTestMemcheck/memtester.cxx.in @@ -1,6 +1,7 @@ #include #include #include +#include #define RETVAL @_retval@ ----------------------------------------------------------------------- Summary of changes: Tests/CTestTestMemcheck/memtester.cxx.in | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- CMake From ben.boeckel at kitware.com Thu Jul 17 11:18:21 2014 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Thu, 17 Jul 2014 11:18:21 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4354-g0d1ac35 Message-ID: <20140717151821.EE74540880@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 0d1ac351bc47e6c8d9e697e730d2abbf68e4f697 (commit) via 03e1db881354d16c93ca2bda2ef83a4563782670 (commit) via 93d441b5341b3288f113d7e9c3a488bb23497547 (commit) via a9c9b66c272d1d63918c1a5040c63d6cb169be91 (commit) via bcb6dbc1cb0bfeb0627c0b48ced41beea9d4c51a (commit) via 679f3deeb79a7b19fb47b96bb520817c1c529f36 (commit) via 23d6520daae729e433fc9325eb53acb541979d0f (commit) via cd54f1dbeb5c71b400ccb0db81a0fcea45df46b8 (commit) via b75fc0e1ad343173f5231819cfcdbdee9a8b076a (commit) via 660769151a7f628f92eb28d77bcae854eaae54c2 (commit) via cebefa71fad223f134529a2b859006360e465a80 (commit) via 97ce676e75900dfeeb30ea1c6ba5a139befe9562 (commit) from bd0274267f112ce43aa3f34779780026770612bd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0d1ac351bc47e6c8d9e697e730d2abbf68e4f697 commit 0d1ac351bc47e6c8d9e697e730d2abbf68e4f697 Merge: bd02742 03e1db8 Author: Ben Boeckel AuthorDate: Thu Jul 17 11:18:20 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 17 11:18:20 2014 -0400 Merge topic 'dev/target-fastpaths' into next 03e1db88 Revert "genex: Allow genex caching of config genex on single-config generators" 93d441b5 genex: Allow genex caching of config genex on single-config generators a9c9b66c cmTarget: use a hash_map for cmTargets typedef bcb6dbc1 cmTarget: help the optimizer a bit 679f3dee cmTarget: use hash_set for sets of strings 23d6520d cmTarget: Allow caching of empty genex expansions cd54f1db cmTarget: Only copy GenEx expansions when necessary b75fc0e1 cmTarget: Don't set properties on custom targets 66076915 cmTarget: Use static strings for special property names cebefa71 cmTarget: Sort special property checks 97ce676e cmTarget: Fast path for regular properties http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=03e1db881354d16c93ca2bda2ef83a4563782670 commit 03e1db881354d16c93ca2bda2ef83a4563782670 Author: Ben Boeckel AuthorDate: Thu Jul 17 11:17:59 2014 -0400 Commit: Ben Boeckel CommitDate: Thu Jul 17 11:17:59 2014 -0400 Revert "genex: Allow genex caching of config genex on single-config generators" This reverts commit 93d441b5341b3288f113d7e9c3a488bb23497547. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 2581355..3b83cd3 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -15,7 +15,6 @@ #include "cmGeneratorExpressionParser.h" #include "cmGeneratorExpressionDAGChecker.h" #include "cmGeneratorExpression.h" -#include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmSourceFile.h" @@ -689,11 +688,7 @@ static const struct ConfigurationNode : public cmGeneratorExpressionNode const GeneratorExpressionContent *, cmGeneratorExpressionDAGChecker *) const { - if (context->Makefile->GetLocalGenerator()-> - GetGlobalGenerator()->IsMultiConfig()) - { - context->HadContextSensitiveCondition = true; - } + context->HadContextSensitiveCondition = true; return context->Config; } } configurationNode; @@ -721,11 +716,7 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode "Expression syntax not recognized."); return std::string(); } - if (context->Makefile->GetLocalGenerator()-> - GetGlobalGenerator()->IsMultiConfig()) - { - context->HadContextSensitiveCondition = true; - } + context->HadContextSensitiveCondition = true; if (context->Config.empty()) { return parameters.front().empty() ? "1" : "0"; diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake index 57c52e3..fa76f24 100644 --- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake @@ -9,11 +9,7 @@ run_cmake(RelativePathInInterface) run_cmake(ImportedTarget) run_cmake(RelativePathInGenex) run_cmake(CMP0021) -if (CMAKE_CONFIGURATION_TYPES) - # $ is only context-dependent in multi-config - # generators. - run_cmake(install_config) -endif () +run_cmake(install_config) run_cmake(incomplete-genex) run_cmake(export-NOWARN) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=93d441b5341b3288f113d7e9c3a488bb23497547 commit 93d441b5341b3288f113d7e9c3a488bb23497547 Author: Ben Boeckel AuthorDate: Wed Apr 30 15:41:40 2014 -0400 Commit: Ben Boeckel CommitDate: Thu Jul 17 11:17:52 2014 -0400 genex: Allow genex caching of config genex on single-config generators The single-config generators do not make $ and $ generator expressions context-sensitive. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 3b83cd3..2581355 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -15,6 +15,7 @@ #include "cmGeneratorExpressionParser.h" #include "cmGeneratorExpressionDAGChecker.h" #include "cmGeneratorExpression.h" +#include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmSourceFile.h" @@ -688,7 +689,11 @@ static const struct ConfigurationNode : public cmGeneratorExpressionNode const GeneratorExpressionContent *, cmGeneratorExpressionDAGChecker *) const { - context->HadContextSensitiveCondition = true; + if (context->Makefile->GetLocalGenerator()-> + GetGlobalGenerator()->IsMultiConfig()) + { + context->HadContextSensitiveCondition = true; + } return context->Config; } } configurationNode; @@ -716,7 +721,11 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode "Expression syntax not recognized."); return std::string(); } - context->HadContextSensitiveCondition = true; + if (context->Makefile->GetLocalGenerator()-> + GetGlobalGenerator()->IsMultiConfig()) + { + context->HadContextSensitiveCondition = true; + } if (context->Config.empty()) { return parameters.front().empty() ? "1" : "0"; diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake index fa76f24..57c52e3 100644 --- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake @@ -9,7 +9,11 @@ run_cmake(RelativePathInInterface) run_cmake(ImportedTarget) run_cmake(RelativePathInGenex) run_cmake(CMP0021) -run_cmake(install_config) +if (CMAKE_CONFIGURATION_TYPES) + # $ is only context-dependent in multi-config + # generators. + run_cmake(install_config) +endif () run_cmake(incomplete-genex) run_cmake(export-NOWARN) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a9c9b66c272d1d63918c1a5040c63d6cb169be91 commit a9c9b66c272d1d63918c1a5040c63d6cb169be91 Author: Ben Boeckel AuthorDate: Tue Jun 10 13:07:24 2014 -0400 Commit: Ben Boeckel CommitDate: Thu Jul 17 11:17:52 2014 -0400 cmTarget: use a hash_map for cmTargets typedef diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 4005443..9064eec 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -18,6 +18,9 @@ #include "cmListFileCache.h" #include +#if defined(CMAKE_BUILD_WITH_CMAKE) +#include +#endif #define CM_FOR_EACH_TARGET_POLICY(F) \ F(CMP0003) \ @@ -831,7 +834,11 @@ private: mutable bool LinkImplementationLanguageIsContextDependent; }; +#ifdef CMAKE_BUILD_WITH_CMAKE +typedef cmsys::hash_map cmTargets; +#else typedef std::map cmTargets; +#endif class cmTargetSet: public std::set {}; class cmTargetManifest: public std::map {}; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bcb6dbc1cb0bfeb0627c0b48ced41beea9d4c51a commit bcb6dbc1cb0bfeb0627c0b48ced41beea9d4c51a Author: Ben Boeckel AuthorDate: Tue Jun 10 13:07:12 2014 -0400 Commit: Ben Boeckel CommitDate: Thu Jul 17 11:17:52 2014 -0400 cmTarget: help the optimizer a bit diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 155232d..843761f 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -224,7 +224,7 @@ public: cmLinkImplItem cmTargetInternals::TargetPropertyEntry::NoLinkImplItem; //---------------------------------------------------------------------------- -void deleteAndClear( +static void deleteAndClear( std::vector &entries) { for (std::vector::const_iterator @@ -238,7 +238,7 @@ void deleteAndClear( } //---------------------------------------------------------------------------- -void deleteAndClear( +static void deleteAndClear( std::map > &entries) { @@ -2299,7 +2299,7 @@ static void processCompileOptionsInternal(cmTarget const* tgt, for(std::vector::iterator li = entryOptions->begin(); li != entryOptions->end(); ++li) { - std::string opt = *li; + std::string const& opt = *li; if(uniqueOptions.insert(opt).second) { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=679f3deeb79a7b19fb47b96bb520817c1c529f36 commit 679f3deeb79a7b19fb47b96bb520817c1c529f36 Author: Ben Boeckel AuthorDate: Tue Jun 10 10:29:16 2014 -0400 Commit: Ben Boeckel CommitDate: Thu Jul 17 11:17:50 2014 -0400 cmTarget: use hash_set for sets of strings diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 67b3c11..155232d 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -25,6 +25,12 @@ #include // required for atof #include #include +#if defined(CMAKE_BUILD_WITH_CMAKE) +#include +#define UNORDERED_SET cmsys::hash_set +#else +#define UNORDERED_SET std::set +#endif const char* cmTarget::GetTargetTypeName(TargetType targetType) { @@ -642,7 +648,7 @@ bool cmTarget::IsBundleOnApple() const static bool processSources(cmTarget const* tgt, const std::vector &entries, std::vector &srcs, - std::set &uniqueSrcs, + UNORDERED_SET &uniqueSrcs, cmGeneratorExpressionDAGChecker *dagChecker, std::string const& config, bool debugSources) { @@ -784,7 +790,7 @@ void cmTarget::GetSourceFiles(std::vector &files, cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "SOURCES", 0, 0); - std::set uniqueSrcs; + UNORDERED_SET uniqueSrcs; bool contextDependentDirectSources = processSources(this, this->Internal->SourceEntries, files, @@ -1298,7 +1304,7 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s, = (sig == cmTarget::KeywordTLLSignature ? "keyword" : "plain"); s << "The uses of the " << sigString << " signature are here:\n"; - std::set emitted; + UNORDERED_SET emitted; for(std::vector::iterator it = sigs.begin(); it != sigs.end(); ++it) { @@ -1717,22 +1723,20 @@ static bool whiteListedInterfaceProperty(const std::string& prop) { return true; } - static const char* builtIns[] = { - // ###: This must remain sorted. It is processed with a binary search. - "COMPATIBLE_INTERFACE_BOOL", - "COMPATIBLE_INTERFACE_NUMBER_MAX", - "COMPATIBLE_INTERFACE_NUMBER_MIN", - "COMPATIBLE_INTERFACE_STRING", - "EXPORT_NAME", - "IMPORTED", - "NAME", - "TYPE" - }; + static UNORDERED_SET builtIns; + if (builtIns.empty()) + { + builtIns.insert("COMPATIBLE_INTERFACE_BOOL"); + builtIns.insert("COMPATIBLE_INTERFACE_NUMBER_MAX"); + builtIns.insert("COMPATIBLE_INTERFACE_NUMBER_MIN"); + builtIns.insert("COMPATIBLE_INTERFACE_STRING"); + builtIns.insert("EXPORT_NAME"); + builtIns.insert("IMPORTED"); + builtIns.insert("NAME"); + builtIns.insert("TYPE"); + } - if (std::binary_search(cmArrayBegin(builtIns), - cmArrayEnd(builtIns), - prop.c_str(), - cmStrCmp(prop))) + if (builtIns.count(prop)) { return true; } @@ -2017,7 +2021,7 @@ void cmTarget::InsertCompileDefinition(const cmValueWithOrigin &entry) static void processIncludeDirectories(cmTarget const* tgt, const std::vector &entries, std::vector &includes, - std::set &uniqueIncludes, + UNORDERED_SET &uniqueIncludes, cmGeneratorExpressionDAGChecker *dagChecker, const std::string& config, bool debugIncludes) { @@ -2166,7 +2170,7 @@ std::vector cmTarget::GetIncludeDirectories(const std::string& config) const { std::vector includes; - std::set uniqueIncludes; + UNORDERED_SET uniqueIncludes; cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "INCLUDE_DIRECTORIES", 0, 0); @@ -2258,7 +2262,7 @@ cmTarget::GetIncludeDirectories(const std::string& config) const static void processCompileOptionsInternal(cmTarget const* tgt, const std::vector &entries, std::vector &options, - std::set &uniqueOptions, + UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, const std::string& config, bool debugOptions, const char *logName) { @@ -2321,7 +2325,7 @@ static void processCompileOptionsInternal(cmTarget const* tgt, static void processCompileOptions(cmTarget const* tgt, const std::vector &entries, std::vector &options, - std::set &uniqueOptions, + UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, const std::string& config, bool debugOptions) { @@ -2358,7 +2362,7 @@ void cmTarget::GetAutoUicOptions(std::vector &result, void cmTarget::GetCompileOptions(std::vector &result, const std::string& config) const { - std::set uniqueOptions; + UNORDERED_SET uniqueOptions; cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "COMPILE_OPTIONS", 0, 0); @@ -2419,7 +2423,7 @@ void cmTarget::GetCompileOptions(std::vector &result, static void processCompileDefinitions(cmTarget const* tgt, const std::vector &entries, std::vector &options, - std::set &uniqueOptions, + UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, const std::string& config, bool debugOptions) { @@ -2432,7 +2436,7 @@ static void processCompileDefinitions(cmTarget const* tgt, void cmTarget::GetCompileDefinitions(std::vector &list, const std::string& config) const { - std::set uniqueOptions; + UNORDERED_SET uniqueOptions; cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "COMPILE_DEFINITIONS", 0, 0); @@ -2530,7 +2534,7 @@ void cmTarget::GetCompileDefinitions(std::vector &list, static void processCompileFeatures(cmTarget const* tgt, const std::vector &entries, std::vector &options, - std::set &uniqueOptions, + UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, const std::string& config, bool debugOptions) { @@ -2542,7 +2546,7 @@ static void processCompileFeatures(cmTarget const* tgt, void cmTarget::GetCompileFeatures(std::vector &result, const std::string& config) const { - std::set uniqueFeatures; + UNORDERED_SET uniqueFeatures; cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "COMPILE_FEATURES", @@ -3082,7 +3086,7 @@ const char *cmTarget::GetProperty(const std::string& prop, cmProperty::TARGET); } // Support "_LOCATION". - if(cmHasLiteralSuffix(prop, "_LOCATION")) + else if(cmHasLiteralSuffix(prop, "_LOCATION")) { std::string configName(prop.c_str(), prop.size() - 9); if(configName != "IMPORTED") @@ -3097,7 +3101,7 @@ const char *cmTarget::GetProperty(const std::string& prop, } } } - static std::set specialProps; + static UNORDERED_SET specialProps; #define MAKE_STATIC_PROP(PROP) \ static const std::string prop##PROP = #PROP MAKE_STATIC_PROP(LINK_LIBRARIES); @@ -3323,7 +3327,7 @@ class cmTargetCollectLinkLanguages public: cmTargetCollectLinkLanguages(cmTarget const* target, const std::string& config, - std::set& languages, + UNORDERED_SET& languages, cmTarget const* head): Config(config), Languages(languages), HeadTarget(head), Makefile(target->GetMakefile()), Target(target) @@ -3393,7 +3397,7 @@ public: } private: std::string Config; - std::set& Languages; + UNORDERED_SET& Languages; cmTarget const* HeadTarget; cmMakefile* Makefile; const cmTarget* Target; @@ -3430,7 +3434,7 @@ class cmTargetSelectLinker cmTarget const* Target; cmMakefile* Makefile; cmGlobalGenerator* GG; - std::set Preferred; + UNORDERED_SET Preferred; public: cmTargetSelectLinker(cmTarget const* target): Preference(0), Target(target) { @@ -3462,7 +3466,7 @@ public: e << "Target " << this->Target->GetName() << " contains multiple languages with the highest linker preference" << " (" << this->Preference << "):\n"; - for(std::set::const_iterator + for(UNORDERED_SET::const_iterator li = this->Preferred.begin(); li != this->Preferred.end(); ++li) { e << " " << *li << "\n"; @@ -3481,7 +3485,7 @@ void cmTarget::ComputeLinkClosure(const std::string& config, LinkClosure& lc) const { // Get languages built in this target. - std::set languages; + UNORDERED_SET languages; LinkImplementation const* impl = this->GetLinkImplementation(config); for(std::vector::const_iterator li = impl->Languages.begin(); li != impl->Languages.end(); ++li) @@ -3499,7 +3503,7 @@ void cmTarget::ComputeLinkClosure(const std::string& config, } // Store the transitive closure of languages. - for(std::set::const_iterator li = languages.begin(); + for(UNORDERED_SET::const_iterator li = languages.begin(); li != languages.end(); ++li) { lc.Languages.push_back(*li); @@ -3527,7 +3531,7 @@ void cmTarget::ComputeLinkClosure(const std::string& config, } // Now consider languages that propagate from linked targets. - for(std::set::const_iterator sit = languages.begin(); + for(UNORDERED_SET::const_iterator sit = languages.begin(); sit != languages.end(); ++sit) { std::string propagates = "CMAKE_"+*sit+"_LINKER_PREFERENCE_PROPAGATES"; @@ -6261,7 +6265,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, { // Shared libraries may have runtime implementation dependencies // on other shared libraries that are not in the interface. - std::set emitted; + UNORDERED_SET emitted; for(std::vector::const_iterator li = iface.Libraries.begin(); li != iface.Libraries.end(); ++li) { @@ -6835,6 +6839,7 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, if (!prop.empty()) { + // Use a std::set to keep the error message sorted. std::set props; std::set::const_iterator i = emittedBools.find(prop); if (i != emittedBools.end()) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=23d6520daae729e433fc9325eb53acb541979d0f commit 23d6520daae729e433fc9325eb53acb541979d0f Author: Ben Boeckel AuthorDate: Wed Apr 30 15:41:19 2014 -0400 Commit: Ben Boeckel CommitDate: Thu Jul 17 11:17:50 2014 -0400 cmTarget: Allow caching of empty genex expansions diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 5836d7b..67b3c11 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -176,10 +176,11 @@ public: public: TargetPropertyEntry(cmsys::auto_ptr cge, cmLinkImplItem const& item = NoLinkImplItem) - : ge(cge), LinkImplItem(item) + : ge(cge), Cached(false), LinkImplItem(item) {} const cmsys::auto_ptr ge; std::vector CachedEntries; + bool Cached; cmLinkImplItem const& LinkImplItem; }; std::vector IncludeDirectoriesEntries; @@ -2269,7 +2270,7 @@ static void processCompileOptionsInternal(cmTarget const* tgt, std::vector& entriesRef = (*it)->CachedEntries; std::vector localEntries; std::vector* entryOptions = &entriesRef; - if(entryOptions->empty()) + if(!(*it)->Cached) { cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, config, @@ -2282,6 +2283,7 @@ static void processCompileOptionsInternal(cmTarget const* tgt, { // Cache the result. *entryOptions = localEntries; + (*it)->Cached = true; } else { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cd54f1dbeb5c71b400ccb0db81a0fcea45df46b8 commit cd54f1dbeb5c71b400ccb0db81a0fcea45df46b8 Author: Ben Boeckel AuthorDate: Mon Feb 10 01:24:42 2014 -0500 Commit: Ben Boeckel CommitDate: Thu Jul 17 11:17:50 2014 -0400 cmTarget: Only copy GenEx expansions when necessary diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 41d370c..5836d7b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2266,25 +2266,32 @@ static void processCompileOptionsInternal(cmTarget const* tgt, for (std::vector::const_iterator it = entries.begin(), end = entries.end(); it != end; ++it) { - bool cacheOptions = false; - std::vector entryOptions = (*it)->CachedEntries; - if(entryOptions.empty()) + std::vector& entriesRef = (*it)->CachedEntries; + std::vector localEntries; + std::vector* entryOptions = &entriesRef; + if(entryOptions->empty()) { cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, config, false, tgt, dagChecker), - entryOptions); + localEntries); if (mf->IsGeneratingBuildSystem() && !(*it)->ge->GetHadContextSensitiveCondition()) { - cacheOptions = true; + // Cache the result. + *entryOptions = localEntries; + } + else + { + // Use the context-sensitive results here. + entryOptions = &localEntries; } } std::string usedOptions; for(std::vector::iterator - li = entryOptions.begin(); li != entryOptions.end(); ++li) + li = entryOptions->begin(); li != entryOptions->end(); ++li) { std::string opt = *li; @@ -2297,10 +2304,6 @@ static void processCompileOptionsInternal(cmTarget const* tgt, } } } - if (cacheOptions) - { - (*it)->CachedEntries = entryOptions; - } if (!usedOptions.empty()) { mf->GetCMakeInstance()->IssueMessage(cmake::LOG, http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b75fc0e1ad343173f5231819cfcdbdee9a8b076a commit b75fc0e1ad343173f5231819cfcdbdee9a8b076a Author: Ben Boeckel AuthorDate: Wed Mar 12 14:05:52 2014 -0400 Commit: Ben Boeckel CommitDate: Thu Jul 17 11:17:50 2014 -0400 cmTarget: Don't set properties on custom targets Properties are not required on custom targets. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 2424fe7..41d370c 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -328,7 +328,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->IsApple = this->Makefile->IsOn("APPLE"); // Setup default property values. - if (this->GetType() != INTERFACE_LIBRARY) + if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY) { this->SetPropertyDefault("INSTALL_NAME_DIR", 0); this->SetPropertyDefault("INSTALL_RPATH", ""); @@ -369,41 +369,44 @@ void cmTarget::SetMakefile(cmMakefile* mf) mf->GetConfigurations(configNames); // Setup per-configuration property default values. - const char* configProps[] = { - "ARCHIVE_OUTPUT_DIRECTORY_", - "LIBRARY_OUTPUT_DIRECTORY_", - "RUNTIME_OUTPUT_DIRECTORY_", - "PDB_OUTPUT_DIRECTORY_", - "COMPILE_PDB_OUTPUT_DIRECTORY_", - "MAP_IMPORTED_CONFIG_", - 0}; - for(std::vector::iterator ci = configNames.begin(); - ci != configNames.end(); ++ci) - { - std::string configUpper = cmSystemTools::UpperCase(*ci); - for(const char** p = configProps; *p; ++p) - { - if (this->TargetTypeValue == INTERFACE_LIBRARY - && strcmp(*p, "MAP_IMPORTED_CONFIG_") != 0) + if (this->GetType() != UTILITY) + { + const char* configProps[] = { + "ARCHIVE_OUTPUT_DIRECTORY_", + "LIBRARY_OUTPUT_DIRECTORY_", + "RUNTIME_OUTPUT_DIRECTORY_", + "PDB_OUTPUT_DIRECTORY_", + "COMPILE_PDB_OUTPUT_DIRECTORY_", + "MAP_IMPORTED_CONFIG_", + 0}; + for(std::vector::iterator ci = configNames.begin(); + ci != configNames.end(); ++ci) + { + std::string configUpper = cmSystemTools::UpperCase(*ci); + for(const char** p = configProps; *p; ++p) { - continue; + if (this->TargetTypeValue == INTERFACE_LIBRARY + && strcmp(*p, "MAP_IMPORTED_CONFIG_") != 0) + { + continue; + } + std::string property = *p; + property += configUpper; + this->SetPropertyDefault(property, 0); } - std::string property = *p; - property += configUpper; - this->SetPropertyDefault(property, 0); - } - // Initialize per-configuration name postfix property from the - // variable only for non-executable targets. This preserves - // compatibility with previous CMake versions in which executables - // did not support this variable. Projects may still specify the - // property directly. - if(this->TargetTypeValue != cmTarget::EXECUTABLE - && this->TargetTypeValue != cmTarget::INTERFACE_LIBRARY) - { - std::string property = cmSystemTools::UpperCase(*ci); - property += "_POSTFIX"; - this->SetPropertyDefault(property, 0); + // Initialize per-configuration name postfix property from the + // variable only for non-executable targets. This preserves + // compatibility with previous CMake versions in which executables + // did not support this variable. Projects may still specify the + // property directly. + if(this->TargetTypeValue != cmTarget::EXECUTABLE + && this->TargetTypeValue != cmTarget::INTERFACE_LIBRARY) + { + std::string property = cmSystemTools::UpperCase(*ci); + property += "_POSTFIX"; + this->SetPropertyDefault(property, 0); + } } } @@ -442,7 +445,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) } } - if (this->GetType() != INTERFACE_LIBRARY) + if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY) { this->SetPropertyDefault("C_VISIBILITY_PRESET", 0); this->SetPropertyDefault("CXX_VISIBILITY_PRESET", 0); @@ -454,7 +457,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) { this->SetProperty("POSITION_INDEPENDENT_CODE", "True"); } - if (this->GetType() != INTERFACE_LIBRARY) + if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY) { this->SetPropertyDefault("POSITION_INDEPENDENT_CODE", 0); } @@ -476,8 +479,11 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->PolicyStatusCMP0022 = cmPolicies::NEW; } - this->SetPropertyDefault("JOB_POOL_COMPILE", 0); - this->SetPropertyDefault("JOB_POOL_LINK", 0); + if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY) + { + this->SetPropertyDefault("JOB_POOL_COMPILE", 0); + this->SetPropertyDefault("JOB_POOL_LINK", 0); + } } //---------------------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=660769151a7f628f92eb28d77bcae854eaae54c2 commit 660769151a7f628f92eb28d77bcae854eaae54c2 Author: Ben Boeckel AuthorDate: Sat Feb 8 12:12:27 2014 -0500 Commit: Ben Boeckel CommitDate: Thu Jul 17 11:17:50 2014 -0400 cmTarget: Use static strings for special property names The function is called enough that the std::string/cstr comparisons are expensive from the strlen. Cache the strings for faster comparisons. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 09eb8a4..2424fe7 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3037,7 +3037,8 @@ const char *cmTarget::GetProperty(const std::string& prop, this->GetType() == cmTarget::MODULE_LIBRARY || this->GetType() == cmTarget::UNKNOWN_LIBRARY) { - if(prop == "LOCATION") + static const std::string propLOCATION = "LOCATION"; + if(prop == propLOCATION) { if (!this->HandleLocationPropertyPolicy(context)) { @@ -3053,12 +3054,12 @@ const char *cmTarget::GetProperty(const std::string& prop, // cannot take into account the per-configuration name of the // target because the configuration type may not be known at // CMake time. - this->Properties.SetProperty("LOCATION", this->GetLocationForBuild(), + this->Properties.SetProperty(propLOCATION, this->GetLocationForBuild(), cmProperty::TARGET); } // Support "LOCATION_". - if(cmHasLiteralPrefix(prop, "LOCATION_")) + else if(cmHasLiteralPrefix(prop, "LOCATION_")) { if (!this->HandleLocationPropertyPolicy(context)) { @@ -3086,21 +3087,33 @@ const char *cmTarget::GetProperty(const std::string& prop, } } static std::set specialProps; +#define MAKE_STATIC_PROP(PROP) \ + static const std::string prop##PROP = #PROP + MAKE_STATIC_PROP(LINK_LIBRARIES); + MAKE_STATIC_PROP(TYPE); + MAKE_STATIC_PROP(INCLUDE_DIRECTORIES); + MAKE_STATIC_PROP(COMPILE_FEATURES); + MAKE_STATIC_PROP(COMPILE_OPTIONS); + MAKE_STATIC_PROP(COMPILE_DEFINITIONS); + MAKE_STATIC_PROP(IMPORTED); + MAKE_STATIC_PROP(NAME); + MAKE_STATIC_PROP(SOURCES); +#undef MAKE_STATIC_PROP if(specialProps.empty()) { - specialProps.insert("INCLUDE_DIRECTORIES"); - specialProps.insert("COMPILE_FEATURES"); - specialProps.insert("COMPILE_OPTIONS"); - specialProps.insert("COMPILE_DEFINITIONS"); - specialProps.insert("LINK_LIBRARIES"); - specialProps.insert("IMPORTED"); - specialProps.insert("NAME"); - specialProps.insert("SOURCES"); - specialProps.insert("TYPE"); + specialProps.insert(propLINK_LIBRARIES); + specialProps.insert(propTYPE); + specialProps.insert(propINCLUDE_DIRECTORIES); + specialProps.insert(propCOMPILE_FEATURES); + specialProps.insert(propCOMPILE_OPTIONS); + specialProps.insert(propCOMPILE_DEFINITIONS); + specialProps.insert(propIMPORTED); + specialProps.insert(propNAME); + specialProps.insert(propSOURCES); } if(specialProps.count(prop)) { - if(prop == "LINK_LIBRARIES") + if(prop == propLINK_LIBRARIES) { if (this->Internal->LinkImplementationPropertyEntries.empty()) { @@ -3122,11 +3135,11 @@ const char *cmTarget::GetProperty(const std::string& prop, return output.c_str(); } // the type property returns what type the target is - else if (prop == "TYPE") + else if (prop == propTYPE) { return cmTarget::GetTargetTypeName(this->GetType()); } - else if(prop == "INCLUDE_DIRECTORIES") + else if(prop == propINCLUDE_DIRECTORIES) { if (this->Internal->IncludeDirectoriesEntries.empty()) { @@ -3137,7 +3150,7 @@ const char *cmTarget::GetProperty(const std::string& prop, MakePropertyList(output, this->Internal->IncludeDirectoriesEntries); return output.c_str(); } - else if(prop == "COMPILE_FEATURES") + else if(prop == propCOMPILE_FEATURES) { if (this->Internal->CompileFeaturesEntries.empty()) { @@ -3148,7 +3161,7 @@ const char *cmTarget::GetProperty(const std::string& prop, MakePropertyList(output, this->Internal->CompileFeaturesEntries); return output.c_str(); } - else if(prop == "COMPILE_OPTIONS") + else if(prop == propCOMPILE_OPTIONS) { if (this->Internal->CompileOptionsEntries.empty()) { @@ -3159,7 +3172,7 @@ const char *cmTarget::GetProperty(const std::string& prop, MakePropertyList(output, this->Internal->CompileOptionsEntries); return output.c_str(); } - else if(prop == "COMPILE_DEFINITIONS") + else if(prop == propCOMPILE_DEFINITIONS) { if (this->Internal->CompileDefinitionsEntries.empty()) { @@ -3170,15 +3183,15 @@ const char *cmTarget::GetProperty(const std::string& prop, MakePropertyList(output, this->Internal->CompileDefinitionsEntries); return output.c_str(); } - else if (prop == "IMPORTED") + else if (prop == propIMPORTED) { return this->IsImported()?"TRUE":"FALSE"; } - else if (prop == "NAME") + else if (prop == propNAME) { return this->GetName().c_str(); } - else if(prop == "SOURCES") + else if(prop == propSOURCES) { if (this->Internal->SourceEntries.empty()) { @@ -4795,12 +4808,13 @@ bool cmTarget::IsNullImpliedByLinkLibraries(const std::string &p) const //---------------------------------------------------------------------------- template -PropertyType getTypedProperty(cmTarget const* tgt, const char *prop, +PropertyType getTypedProperty(cmTarget const* tgt, const std::string& prop, PropertyType *); //---------------------------------------------------------------------------- template<> -bool getTypedProperty(cmTarget const* tgt, const char *prop, bool *) +bool getTypedProperty(cmTarget const* tgt, const std::string& prop, + bool *) { return tgt->GetPropertyAsBool(prop); } @@ -4808,7 +4822,7 @@ bool getTypedProperty(cmTarget const* tgt, const char *prop, bool *) //---------------------------------------------------------------------------- template<> const char *getTypedProperty(cmTarget const* tgt, - const char *prop, + const std::string& prop, const char **) { return tgt->GetProperty(prop); @@ -5047,7 +5061,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, CompatibleType t, PropertyType *) { - PropertyType propContent = getTypedProperty(tgt, p.c_str(), + PropertyType propContent = getTypedProperty(tgt, p, 0); const bool explicitlySet = tgt->GetProperties() .find(p) @@ -5083,6 +5097,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, report += "\" property not set.\n"; } + std::string interfaceProperty = "INTERFACE_" + p; for(std::vector::const_iterator li = deps.begin(); li != deps.end(); ++li) @@ -5096,11 +5111,11 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, cmTarget const* theTarget = *li; const bool ifaceIsSet = theTarget->GetProperties() - .find("INTERFACE_" + p) + .find(interfaceProperty) != theTarget->GetProperties().end(); PropertyType ifacePropContent = getTypedProperty(theTarget, - ("INTERFACE_" + p).c_str(), 0); + interfaceProperty, 0); std::string reportEntry; if (ifaceIsSet) @@ -6167,7 +6182,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( // Compare the link implementation fallback link interface to the // preferred new link interface property and warn if different. std::vector ifaceLibs; - std::string newProp = "INTERFACE_LINK_LIBRARIES"; + static const std::string newProp = "INTERFACE_LINK_LIBRARIES"; if(const char* newExplicitLibraries = thisTarget->GetProperty(newProp)) { thisTarget->ExpandLinkItems(newProp, newExplicitLibraries, config, @@ -6752,9 +6767,13 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, const cmComputeLinkInformation::ItemVector &deps = info->GetItems(); std::set emittedBools; + static std::string strBool = "COMPATIBLE_INTERFACE_BOOL"; std::set emittedStrings; + static std::string strString = "COMPATIBLE_INTERFACE_STRING"; std::set emittedMinNumbers; + static std::string strNumMin = "COMPATIBLE_INTERFACE_NUMBER_MIN"; std::set emittedMaxNumbers; + static std::string strNumMax = "COMPATIBLE_INTERFACE_NUMBER_MAX"; for(cmComputeLinkInformation::ItemVector::const_iterator li = deps.begin(); @@ -6766,14 +6785,14 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, } checkPropertyConsistency(this, li->Target, - std::string("COMPATIBLE_INTERFACE_BOOL"), + strBool, emittedBools, config, BoolType, 0); if (cmSystemTools::GetErrorOccuredFlag()) { return; } checkPropertyConsistency(this, li->Target, - std::string("COMPATIBLE_INTERFACE_STRING"), + strString, emittedStrings, config, StringType, 0); if (cmSystemTools::GetErrorOccuredFlag()) @@ -6781,7 +6800,7 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, return; } checkPropertyConsistency(this, li->Target, - std::string("COMPATIBLE_INTERFACE_NUMBER_MIN"), + strNumMin, emittedMinNumbers, config, NumberMinType, 0); if (cmSystemTools::GetErrorOccuredFlag()) @@ -6789,7 +6808,7 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, return; } checkPropertyConsistency(this, li->Target, - std::string("COMPATIBLE_INTERFACE_NUMBER_MAX"), + strNumMax, emittedMaxNumbers, config, NumberMaxType, 0); if (cmSystemTools::GetErrorOccuredFlag()) @@ -6809,22 +6828,22 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, std::set::const_iterator i = emittedBools.find(prop); if (i != emittedBools.end()) { - props.insert("COMPATIBLE_INTERFACE_BOOL"); + props.insert(strBool); } i = emittedStrings.find(prop); if (i != emittedStrings.end()) { - props.insert("COMPATIBLE_INTERFACE_STRING"); + props.insert(strString); } i = emittedMinNumbers.find(prop); if (i != emittedMinNumbers.end()) { - props.insert("COMPATIBLE_INTERFACE_NUMBER_MIN"); + props.insert(strNumMin); } i = emittedMaxNumbers.find(prop); if (i != emittedMaxNumbers.end()) { - props.insert("COMPATIBLE_INTERFACE_NUMBER_MAX"); + props.insert(strNumMax); } std::string propsString = *props.begin(); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cebefa71fad223f134529a2b859006360e465a80 commit cebefa71fad223f134529a2b859006360e465a80 Author: Ben Boeckel AuthorDate: Sat Feb 8 12:11:32 2014 -0500 Commit: Ben Boeckel CommitDate: Thu Jul 17 11:17:49 2014 -0400 cmTarget: Sort special property checks The LINK_LIBRARIES property is by *far* the most popular. Move it to the top. TYPE is second, but with more generator expression usage, that may change in the future. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 62b30fd..09eb8a4 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3100,26 +3100,41 @@ const char *cmTarget::GetProperty(const std::string& prop, } if(specialProps.count(prop)) { - if(prop == "INCLUDE_DIRECTORIES") + if(prop == "LINK_LIBRARIES") { - if (this->Internal->IncludeDirectoriesEntries.empty()) + if (this->Internal->LinkImplementationPropertyEntries.empty()) { return 0; } static std::string output; - MakePropertyList(output, this->Internal->IncludeDirectoriesEntries); + output = ""; + std::string sep; + for (std::vector::const_iterator + it = this->Internal->LinkImplementationPropertyEntries.begin(), + end = this->Internal->LinkImplementationPropertyEntries.end(); + it != end; ++it) + { + output += sep; + output += it->Value; + sep = ";"; + } return output.c_str(); } - else if(prop == "COMPILE_OPTIONS") + // the type property returns what type the target is + else if (prop == "TYPE") { - if (this->Internal->CompileOptionsEntries.empty()) + return cmTarget::GetTargetTypeName(this->GetType()); + } + else if(prop == "INCLUDE_DIRECTORIES") + { + if (this->Internal->IncludeDirectoriesEntries.empty()) { return 0; } static std::string output; - MakePropertyList(output, this->Internal->CompileOptionsEntries); + MakePropertyList(output, this->Internal->IncludeDirectoriesEntries); return output.c_str(); } else if(prop == "COMPILE_FEATURES") @@ -3133,36 +3148,26 @@ const char *cmTarget::GetProperty(const std::string& prop, MakePropertyList(output, this->Internal->CompileFeaturesEntries); return output.c_str(); } - else if(prop == "COMPILE_DEFINITIONS") + else if(prop == "COMPILE_OPTIONS") { - if (this->Internal->CompileDefinitionsEntries.empty()) + if (this->Internal->CompileOptionsEntries.empty()) { return 0; } static std::string output; - MakePropertyList(output, this->Internal->CompileDefinitionsEntries); + MakePropertyList(output, this->Internal->CompileOptionsEntries); return output.c_str(); } - else if(prop == "LINK_LIBRARIES") + else if(prop == "COMPILE_DEFINITIONS") { - if (this->Internal->LinkImplementationPropertyEntries.empty()) + if (this->Internal->CompileDefinitionsEntries.empty()) { return 0; } static std::string output; - output = ""; - std::string sep; - for (std::vector::const_iterator - it = this->Internal->LinkImplementationPropertyEntries.begin(), - end = this->Internal->LinkImplementationPropertyEntries.end(); - it != end; ++it) - { - output += sep; - output += it->Value; - sep = ";"; - } + MakePropertyList(output, this->Internal->CompileDefinitionsEntries); return output.c_str(); } else if (prop == "IMPORTED") @@ -3270,11 +3275,6 @@ const char *cmTarget::GetProperty(const std::string& prop, this->Properties.SetProperty("SOURCES", ss.str().c_str(), cmProperty::TARGET); } - // the type property returns what type the target is - else if (prop == "TYPE") - { - return cmTarget::GetTargetTypeName(this->GetType()); - } } bool chain = false; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=97ce676e75900dfeeb30ea1c6ba5a139befe9562 commit 97ce676e75900dfeeb30ea1c6ba5a139befe9562 Author: Ben Boeckel AuthorDate: Sat Feb 8 05:27:45 2014 -0500 Commit: Ben Boeckel CommitDate: Thu Jul 17 11:17:49 2014 -0400 cmTarget: Fast path for regular properties diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 8be14f3..62b30fd 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3085,180 +3085,196 @@ const char *cmTarget::GetProperty(const std::string& prop, } } } - if(prop == "INCLUDE_DIRECTORIES") + static std::set specialProps; + if(specialProps.empty()) { - if (this->Internal->IncludeDirectoriesEntries.empty()) - { - return 0; - } - - static std::string output; - MakePropertyList(output, this->Internal->IncludeDirectoriesEntries); - return output.c_str(); + specialProps.insert("INCLUDE_DIRECTORIES"); + specialProps.insert("COMPILE_FEATURES"); + specialProps.insert("COMPILE_OPTIONS"); + specialProps.insert("COMPILE_DEFINITIONS"); + specialProps.insert("LINK_LIBRARIES"); + specialProps.insert("IMPORTED"); + specialProps.insert("NAME"); + specialProps.insert("SOURCES"); + specialProps.insert("TYPE"); } - else if(prop == "COMPILE_OPTIONS") + if(specialProps.count(prop)) { - if (this->Internal->CompileOptionsEntries.empty()) + if(prop == "INCLUDE_DIRECTORIES") { - return 0; - } + if (this->Internal->IncludeDirectoriesEntries.empty()) + { + return 0; + } - static std::string output; - MakePropertyList(output, this->Internal->CompileOptionsEntries); - return output.c_str(); - } - else if(prop == "COMPILE_FEATURES") - { - if (this->Internal->CompileFeaturesEntries.empty()) - { - return 0; + static std::string output; + MakePropertyList(output, this->Internal->IncludeDirectoriesEntries); + return output.c_str(); } - - static std::string output; - MakePropertyList(output, this->Internal->CompileFeaturesEntries); - return output.c_str(); - } - else if(prop == "COMPILE_DEFINITIONS") - { - if (this->Internal->CompileDefinitionsEntries.empty()) + else if(prop == "COMPILE_OPTIONS") { - return 0; + if (this->Internal->CompileOptionsEntries.empty()) + { + return 0; + } + + static std::string output; + MakePropertyList(output, this->Internal->CompileOptionsEntries); + return output.c_str(); } + else if(prop == "COMPILE_FEATURES") + { + if (this->Internal->CompileFeaturesEntries.empty()) + { + return 0; + } - static std::string output; - MakePropertyList(output, this->Internal->CompileDefinitionsEntries); - return output.c_str(); - } - else if(prop == "LINK_LIBRARIES") - { - if (this->Internal->LinkImplementationPropertyEntries.empty()) + static std::string output; + MakePropertyList(output, this->Internal->CompileFeaturesEntries); + return output.c_str(); + } + else if(prop == "COMPILE_DEFINITIONS") { - return 0; + if (this->Internal->CompileDefinitionsEntries.empty()) + { + return 0; + } + + static std::string output; + MakePropertyList(output, this->Internal->CompileDefinitionsEntries); + return output.c_str(); } + else if(prop == "LINK_LIBRARIES") + { + if (this->Internal->LinkImplementationPropertyEntries.empty()) + { + return 0; + } - static std::string output; - output = ""; - std::string sep; - for (std::vector::const_iterator - it = this->Internal->LinkImplementationPropertyEntries.begin(), - end = this->Internal->LinkImplementationPropertyEntries.end(); - it != end; ++it) + static std::string output; + output = ""; + std::string sep; + for (std::vector::const_iterator + it = this->Internal->LinkImplementationPropertyEntries.begin(), + end = this->Internal->LinkImplementationPropertyEntries.end(); + it != end; ++it) + { + output += sep; + output += it->Value; + sep = ";"; + } + return output.c_str(); + } + else if (prop == "IMPORTED") { - output += sep; - output += it->Value; - sep = ";"; + return this->IsImported()?"TRUE":"FALSE"; } - return output.c_str(); - } - else if (prop == "IMPORTED") - { - return this->IsImported()?"TRUE":"FALSE"; - } - else if (prop == "NAME") - { - return this->GetName().c_str(); - } - else if(prop == "SOURCES") - { - if (this->Internal->SourceEntries.empty()) + else if (prop == "NAME") { - return 0; + return this->GetName().c_str(); } - - cmOStringStream ss; - const char* sep = ""; - typedef cmTargetInternals::TargetPropertyEntry - TargetPropertyEntry; - for(std::vector::const_iterator - i = this->Internal->SourceEntries.begin(); - i != this->Internal->SourceEntries.end(); ++i) + else if(prop == "SOURCES") { - std::string entry = (*i)->ge->GetInput(); + if (this->Internal->SourceEntries.empty()) + { + return 0; + } - std::vector files; - cmSystemTools::ExpandListArgument(entry, files); - for (std::vector::const_iterator - li = files.begin(); li != files.end(); ++li) + cmOStringStream ss; + const char* sep = ""; + typedef cmTargetInternals::TargetPropertyEntry + TargetPropertyEntry; + for(std::vector::const_iterator + i = this->Internal->SourceEntries.begin(); + i != this->Internal->SourceEntries.end(); ++i) { - if(cmHasLiteralPrefix(*li, "$size() - 1] == '>') - { - std::string objLibName = li->substr(17, li->size()-18); + std::string entry = (*i)->ge->GetInput(); - if (cmGeneratorExpression::Find(objLibName) != std::string::npos) + std::vector files; + cmSystemTools::ExpandListArgument(entry, files); + for (std::vector::const_iterator + li = files.begin(); li != files.end(); ++li) + { + if(cmHasLiteralPrefix(*li, "$size() - 1] == '>') { - ss << sep; - sep = ";"; - ss << *li; - continue; - } + std::string objLibName = li->substr(17, li->size()-18); - bool addContent = false; - bool noMessage = true; - cmOStringStream e; - cmake::MessageType messageType = cmake::AUTHOR_WARNING; - switch(context->GetPolicyStatus(cmPolicies::CMP0051)) - { - case cmPolicies::WARN: - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0051)) << "\n"; - noMessage = false; - case cmPolicies::OLD: - break; - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::NEW: - addContent = true; - } - if (!noMessage) - { - e << "Target \"" << this->Name << "\" contains $ " - "generator expression in its sources list. This content was not " - "previously part of the SOURCES property when that property was " - "read at configure time. Code reading that property needs to be " - "adapted to ignore the generator expression using the " - "string(GENEX_STRIP) command."; - context->IssueMessage(messageType, e.str()); + if (cmGeneratorExpression::Find(objLibName) != std::string::npos) + { + ss << sep; + sep = ";"; + ss << *li; + continue; + } + + bool addContent = false; + bool noMessage = true; + cmOStringStream e; + cmake::MessageType messageType = cmake::AUTHOR_WARNING; + switch(context->GetPolicyStatus(cmPolicies::CMP0051)) + { + case cmPolicies::WARN: + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0051)) << "\n"; + noMessage = false; + case cmPolicies::OLD: + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: + addContent = true; + } + if (!noMessage) + { + e << "Target \"" << this->Name << "\" contains " + "$ generator expression in its sources list. " + "This content was not previously part of the SOURCES property " + "when that property was read at configure time. Code reading " + "that property needs to be adapted to ignore the generator " + "expression using the string(GENEX_STRIP) command."; + context->IssueMessage(messageType, e.str()); + } + if (addContent) + { + ss << sep; + sep = ";"; + ss << *li; + } } - if (addContent) + else if (cmGeneratorExpression::Find(*li) == std::string::npos) { ss << sep; sep = ";"; ss << *li; } - } - else if (cmGeneratorExpression::Find(*li) == std::string::npos) - { - ss << sep; - sep = ";"; - ss << *li; - } - else - { - cmSourceFile *sf = this->Makefile->GetOrCreateSource(*li); - // Construct what is known about this source file location. - cmSourceFileLocation const& location = sf->GetLocation(); - std::string sname = location.GetDirectory(); - if(!sname.empty()) + else { - sname += "/"; - } - sname += location.GetName(); + cmSourceFile *sf = this->Makefile->GetOrCreateSource(*li); + // Construct what is known about this source file location. + cmSourceFileLocation const& location = sf->GetLocation(); + std::string sname = location.GetDirectory(); + if(!sname.empty()) + { + sname += "/"; + } + sname += location.GetName(); - ss << sep; - sep = ";"; - // Append this list entry. - ss << sname; + ss << sep; + sep = ";"; + // Append this list entry. + ss << sname; + } } } + this->Properties.SetProperty("SOURCES", ss.str().c_str(), + cmProperty::TARGET); + } + // the type property returns what type the target is + else if (prop == "TYPE") + { + return cmTarget::GetTargetTypeName(this->GetType()); } - this->Properties.SetProperty("SOURCES", ss.str().c_str(), - cmProperty::TARGET); - } - // the type property returns what type the target is - else if (prop == "TYPE") - { - return cmTarget::GetTargetTypeName(this->GetType()); } bool chain = false; ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From bill.hoffman at kitware.com Thu Jul 17 11:36:20 2014 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Thu, 17 Jul 2014 11:36:20 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4356-g0770ae4 Message-ID: <20140717153620.E38C540DEA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 0770ae418e8744515adad65f0941d3594df239e1 (commit) via a4d462d6c607d9970885d3a3ca7d879bde2dd333 (commit) from 0d1ac351bc47e6c8d9e697e730d2abbf68e4f697 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0770ae418e8744515adad65f0941d3594df239e1 commit 0770ae418e8744515adad65f0941d3594df239e1 Merge: 0d1ac35 a4d462d Author: Bill Hoffman AuthorDate: Thu Jul 17 11:36:20 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 17 11:36:20 2014 -0400 Merge topic 'fix_guard_malloc_forbc' into next a4d462d6 Add checks for malloc guard in the Bounds Checker test. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a4d462d6c607d9970885d3a3ca7d879bde2dd333 commit a4d462d6c607d9970885d3a3ca7d879bde2dd333 Author: Bill Hoffman AuthorDate: Thu Jul 17 11:32:48 2014 -0400 Commit: Bill Hoffman CommitDate: Thu Jul 17 11:32:48 2014 -0400 Add checks for malloc guard in the Bounds Checker test. diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index d16d432..710994c 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -225,7 +225,7 @@ set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*${ctest_and_tool_outputs}$") set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES - PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n") + PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n(.*\n)?${guard_malloc_lines}(\n)*Error parsing XML in stream at line 1: no element found\n") set_tests_properties(CTestTestMemcheckDummyValgrindInvalidSupFile PROPERTIES PASS_REGULAR_EXPRESSION "\nCannot find memory checker suppression file: ${CTEST_ESCAPED_REALPATH_CMAKE_CURRENT_BINARY_DIR}/does-not-exist\n") ----------------------------------------------------------------------- Summary of changes: Tests/CTestTestMemcheck/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 17 13:50:02 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 17 Jul 2014 13:50:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4358-g543d27d Message-ID: <20140717175002.C0D5F413C1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 543d27db2cb4aa56bfe15fa5ee86b952df9a9b83 (commit) via 7a9909db86ec9bf7c40ad6c7a965701017c3849d (commit) from 0770ae418e8744515adad65f0941d3594df239e1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=543d27db2cb4aa56bfe15fa5ee86b952df9a9b83 commit 543d27db2cb4aa56bfe15fa5ee86b952df9a9b83 Merge: 0770ae4 7a9909d Author: Brad King AuthorDate: Thu Jul 17 13:50:02 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 17 13:50:02 2014 -0400 Merge topic 'vs-MSTool-condition' into next 7a9909db VS: Make MS-tool-specific options conditional http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7a9909db86ec9bf7c40ad6c7a965701017c3849d commit 7a9909db86ec9bf7c40ad6c7a965701017c3849d Author: Brad King AuthorDate: Tue Jun 10 10:13:00 2014 -0400 Commit: Brad King CommitDate: Thu Jul 17 13:37:55 2014 -0400 VS: Make MS-tool-specific options conditional Make blocks adding MS-tool-specific options conditional on a new "MSTools" boolean member of cmVisualStudio10TargetGenerator. Hard-code the member to true for now to preserve existing behavior. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 0458bd6..15439f6 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -41,58 +41,74 @@ cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetClFlagTable() const { - cmLocalVisualStudioGenerator::VSVersion - v = this->LocalGenerator->GetVersion(); - if(v >= cmLocalVisualStudioGenerator::VS14) - { return cmVS14CLFlagTable; } - else if(v >= cmLocalVisualStudioGenerator::VS12) - { return cmVS12CLFlagTable; } - else if(v == cmLocalVisualStudioGenerator::VS11) - { return cmVS11CLFlagTable; } - else - { return cmVS10CLFlagTable; } + if(this->MSTools) + { + cmLocalVisualStudioGenerator::VSVersion + v = this->LocalGenerator->GetVersion(); + if(v >= cmLocalVisualStudioGenerator::VS14) + { return cmVS14CLFlagTable; } + else if(v >= cmLocalVisualStudioGenerator::VS12) + { return cmVS12CLFlagTable; } + else if(v == cmLocalVisualStudioGenerator::VS11) + { return cmVS11CLFlagTable; } + else + { return cmVS10CLFlagTable; } + } + return 0; } cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetRcFlagTable() const { - cmLocalVisualStudioGenerator::VSVersion - v = this->LocalGenerator->GetVersion(); - if(v >= cmLocalVisualStudioGenerator::VS14) - { return cmVS14RCFlagTable; } - else if(v >= cmLocalVisualStudioGenerator::VS12) - { return cmVS12RCFlagTable; } - else if(v == cmLocalVisualStudioGenerator::VS11) - { return cmVS11RCFlagTable; } - else - { return cmVS10RCFlagTable; } + if(this->MSTools) + { + cmLocalVisualStudioGenerator::VSVersion + v = this->LocalGenerator->GetVersion(); + if(v >= cmLocalVisualStudioGenerator::VS14) + { return cmVS14RCFlagTable; } + else if(v >= cmLocalVisualStudioGenerator::VS12) + { return cmVS12RCFlagTable; } + else if(v == cmLocalVisualStudioGenerator::VS11) + { return cmVS11RCFlagTable; } + else + { return cmVS10RCFlagTable; } + } + return 0; } cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLibFlagTable() const { - cmLocalVisualStudioGenerator::VSVersion - v = this->LocalGenerator->GetVersion(); - if(v >= cmLocalVisualStudioGenerator::VS14) - { return cmVS14LibFlagTable; } - else if(v >= cmLocalVisualStudioGenerator::VS12) - { return cmVS12LibFlagTable; } - else if(v == cmLocalVisualStudioGenerator::VS11) - { return cmVS11LibFlagTable; } - else - { return cmVS10LibFlagTable; } + if(this->MSTools) + { + cmLocalVisualStudioGenerator::VSVersion + v = this->LocalGenerator->GetVersion(); + if(v >= cmLocalVisualStudioGenerator::VS14) + { return cmVS14LibFlagTable; } + else if(v >= cmLocalVisualStudioGenerator::VS12) + { return cmVS12LibFlagTable; } + else if(v == cmLocalVisualStudioGenerator::VS11) + { return cmVS11LibFlagTable; } + else + { return cmVS10LibFlagTable; } + } + return 0; } cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLinkFlagTable() const { - cmLocalVisualStudioGenerator::VSVersion - v = this->LocalGenerator->GetVersion(); - if(v >= cmLocalVisualStudioGenerator::VS14) - { return cmVS14LinkFlagTable; } - else if(v >= cmLocalVisualStudioGenerator::VS12) - { return cmVS12LinkFlagTable; } - else if(v == cmLocalVisualStudioGenerator::VS11) - { return cmVS11LinkFlagTable; } - else - { return cmVS10LinkFlagTable; } + if(this->MSTools) + { + cmLocalVisualStudioGenerator::VSVersion + v = this->LocalGenerator->GetVersion(); + if(v >= cmLocalVisualStudioGenerator::VS14) + { return cmVS14LinkFlagTable; } + else if(v >= cmLocalVisualStudioGenerator::VS12) + { return cmVS12LinkFlagTable; } + else if(v == cmLocalVisualStudioGenerator::VS11) + { return cmVS11LinkFlagTable; } + else + { return cmVS10LinkFlagTable; } + } + return 0; } static std::string cmVS10EscapeXML(std::string arg) @@ -142,6 +158,7 @@ cmVisualStudio10TargetGenerator(cmTarget* target, this->GlobalGenerator->CreateGUID(this->Name.c_str()); this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str()); this->Platform = gg->GetPlatformName(); + this->MSTools = true; this->BuildFileStream = 0; } @@ -532,7 +549,10 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() configType += "\n"; this->WriteString(configType.c_str(), 2); - this->WriteMSToolConfigurationValues(*i); + if(this->MSTools) + { + this->WriteMSToolConfigurationValues(*i); + } this->WriteString("\n", 1); } @@ -1447,17 +1467,23 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( // Get preprocessor definitions for this directory. std::string defineFlags = this->Target->GetMakefile()->GetDefineFlags(); - clOptions.FixExceptionHandlingDefault(); - clOptions.AddFlag("PrecompiledHeader", "NotUsing"); - std::string asmLocation = configName + "/"; - clOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str()); + if(this->MSTools) + { + clOptions.FixExceptionHandlingDefault(); + clOptions.AddFlag("PrecompiledHeader", "NotUsing"); + std::string asmLocation = configName + "/"; + clOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str()); + } clOptions.Parse(flags.c_str()); clOptions.Parse(defineFlags.c_str()); std::vector targetDefines; this->Target->GetCompileDefinitions(targetDefines, configName.c_str()); clOptions.AddDefines(targetDefines); - clOptions.SetVerboseMakefile( - this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")); + if(this->MSTools) + { + clOptions.SetVerboseMakefile( + this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")); + } // Add a definition for the configuration name. std::string configDefine = "CMAKE_INTDIR=\""; @@ -1486,24 +1512,27 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", "\n", "CXX"); - this->WriteString("$(IntDir)\n", 3); - - // If not in debug mode, write the DebugInformationFormat field - // without value so PDBs don't get generated uselessly. - if(!clOptions.IsDebug()) + if(this->MSTools) { - this->WriteString("" - "\n", 3); - } + this->WriteString("$(IntDir)\n", 3); - // Specify the compiler program database file if configured. - std::string pdb = this->Target->GetCompilePDBPath(configName.c_str()); - if(!pdb.empty()) - { - this->ConvertToWindowsSlash(pdb); - this->WriteString("", 3); - *this->BuildFileStream << cmVS10EscapeXML(pdb) - << "\n"; + // If not in debug mode, write the DebugInformationFormat field + // without value so PDBs don't get generated uselessly. + if(!clOptions.IsDebug()) + { + this->WriteString("" + "\n", 3); + } + + // Specify the compiler program database file if configured. + std::string pdb = this->Target->GetCompilePDBPath(configName.c_str()); + if(!pdb.empty()) + { + this->ConvertToWindowsSlash(pdb); + this->WriteString("", 3); + *this->BuildFileStream << cmVS10EscapeXML(pdb) + << "\n"; + } } this->WriteString("\n", 2); @@ -1567,6 +1596,10 @@ void cmVisualStudio10TargetGenerator:: WriteRCOptions(std::string const& configName, std::vector const & includes) { + if(!this->MSTools) + { + return; + } this->WriteString("\n", 2); // Preprocessor definitions and includes are shared with clOptions. @@ -1754,45 +1787,53 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) config.c_str()); } - linkOptions.AddFlag("Version", ""); - - if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") ) + if(this->MSTools) { - linkOptions.AddFlag("SubSystem", "Windows"); - } - else - { - linkOptions.AddFlag("SubSystem", "Console"); - } + linkOptions.AddFlag("Version", ""); - if(const char* stackVal = - this->Makefile->GetDefinition("CMAKE_"+linkLanguage+"_STACK_SIZE")) - { - linkOptions.AddFlag("StackReserveSize", stackVal); - } + if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") ) + { + linkOptions.AddFlag("SubSystem", "Windows"); + } + else + { + linkOptions.AddFlag("SubSystem", "Console"); + } - if(linkOptions.IsDebug() || flags.find("/debug") != flags.npos) - { - linkOptions.AddFlag("GenerateDebugInformation", "true"); - } - else - { - linkOptions.AddFlag("GenerateDebugInformation", "false"); + if(const char* stackVal = + this->Makefile->GetDefinition("CMAKE_"+linkLanguage+"_STACK_SIZE")) + { + linkOptions.AddFlag("StackReserveSize", stackVal); + } + + if(linkOptions.IsDebug() || flags.find("/debug") != flags.npos) + { + linkOptions.AddFlag("GenerateDebugInformation", "true"); + } + else + { + linkOptions.AddFlag("GenerateDebugInformation", "false"); + } + std::string pdb = this->Target->GetPDBDirectory(config.c_str()); + pdb += "/"; + pdb += targetNamePDB; + std::string imLib = this->Target->GetDirectory(config.c_str(), true); + imLib += "/"; + imLib += targetNameImport; + + linkOptions.AddFlag("ImportLibrary", imLib.c_str()); + linkOptions.AddFlag("ProgramDataBaseFile", pdb.c_str()); } - std::string pdb = this->Target->GetPDBDirectory(config.c_str()); - pdb += "/"; - pdb += targetNamePDB; - std::string imLib = this->Target->GetDirectory(config.c_str(), true); - imLib += "/"; - imLib += targetNameImport; - linkOptions.AddFlag("ImportLibrary", imLib.c_str()); - linkOptions.AddFlag("ProgramDataBaseFile", pdb.c_str()); linkOptions.Parse(flags.c_str()); - std::string def = this->GeneratorTarget->GetModuleDefinitionFile(""); - if(!def.empty()) + + if(this->MSTools) { - linkOptions.AddFlag("ModuleDefinitionFile", def.c_str()); + std::string def = this->GeneratorTarget->GetModuleDefinitionFile(""); + if(!def.empty()) + { + linkOptions.AddFlag("ModuleDefinitionFile", def.c_str()); + } } this->LinkOptions[config] = pOptions.release(); @@ -1857,6 +1898,11 @@ void cmVisualStudio10TargetGenerator:: WriteMidlOptions(std::string const& /*config*/, std::vector const & includes) { + if(!this->MSTools) + { + return; + } + // This processes *any* of the .idl files specified in the project's file // list (and passed as the item metadata %(Filename) expressing the rule // input filename) into output files at the per-config *build* dir diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 6bdb40a..6c92b57 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -120,6 +120,7 @@ private: std::string Platform; std::string GUID; std::string Name; + bool MSTools; cmGlobalVisualStudio10Generator* GlobalGenerator; cmGeneratedFileStream* BuildFileStream; cmLocalVisualStudio7Generator* LocalGenerator; ----------------------------------------------------------------------- Summary of changes: Source/cmVisualStudio10TargetGenerator.cxx | 236 +++++++++++++++++----------- Source/cmVisualStudio10TargetGenerator.h | 1 + 2 files changed, 142 insertions(+), 95 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 17 16:46:38 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 17 Jul 2014 16:46:38 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4364-g961f90f Message-ID: <20140717204638.4F72941C02@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 961f90fa7168c618ec7c98857887b3a22cff0c9d (commit) via e7fdb44b1be63e18d03e86f61611dba677e98978 (commit) via 6e176e6d9efa80fb4d08f1ead6bc33f115f8885d (commit) via d3d9218a52dad04c1cfa87e537d98ee0678db1db (commit) via eeb60102e813c6c69546e4257a332ede4e234171 (commit) via ecb34faaaba841aac6dae722dd2c6256a1472d74 (commit) from 543d27db2cb4aa56bfe15fa5ee86b952df9a9b83 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=961f90fa7168c618ec7c98857887b3a22cff0c9d commit 961f90fa7168c618ec7c98857887b3a22cff0c9d Merge: 543d27d e7fdb44 Author: Brad King AuthorDate: Thu Jul 17 16:46:37 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 17 16:46:37 2014 -0400 Merge topic 'delay-generator-platform' into next e7fdb44b VS: Delay detection of VS 10 Express 64-bit tools 6e176e6d VS: Delay platform definitions until system name is known d3d9218a VS: Remove unused method from VS 9 generator eeb60102 VS: Refactor CMAKE_FORCE_*64 platform definitions ecb34faa Tell generators about CMAKE_SYSTEM_NAME as soon as it is known http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e7fdb44b1be63e18d03e86f61611dba677e98978 commit e7fdb44b1be63e18d03e86f61611dba677e98978 Author: Brad King AuthorDate: Thu Jul 17 16:35:41 2014 -0400 Commit: Brad King CommitDate: Thu Jul 17 16:35:41 2014 -0400 VS: Delay detection of VS 10 Express 64-bit tools Wait until SetSystemName when the CMAKE_SYSTEM_NAME is known. Later the decision to use 64-bit tools may depend on it. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 03b2b2f..043f89d 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -128,6 +128,13 @@ cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts, bool cmGlobalVisualStudio10Generator::SetSystemName(std::string const& s, cmMakefile* mf) { + if(this->PlatformName == "Itanium" || this->PlatformName == "x64") + { + if(this->IsExpressEdition() && !this->Find64BitTools(mf)) + { + return false; + } + } this->AddVSPlatformToolsetDefinition(mf); return this->cmGlobalVisualStudio8Generator::SetSystemName(s, mf); } @@ -203,14 +210,6 @@ void cmGlobalVisualStudio10Generator ::EnableLanguage(std::vectorconst & lang, cmMakefile *mf, bool optional) { - if(this->PlatformName == "Itanium" || this->PlatformName == "x64") - { - if(this->IsExpressEdition() && !this->Find64BitTools(mf)) - { - return; - } - } - for(std::vector::const_iterator it = lang.begin(); it != lang.end(); ++it) { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6e176e6d9efa80fb4d08f1ead6bc33f115f8885d commit 6e176e6d9efa80fb4d08f1ead6bc33f115f8885d Author: Brad King AuthorDate: Thu Jul 17 16:34:21 2014 -0400 Commit: Brad King CommitDate: Thu Jul 17 16:34:21 2014 -0400 VS: Delay platform definitions until system name is known Move the definition of CMAKE_VS_PLATFORM_NAME and other variables that are not needed by CMakeDetermineSystem out of the AddPlatformDefinitions method and into a SetSystemName method. The latter may later use CMAKE_SYSTEM_NAME to decide what platform-specific definitions to add. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 80d08b9..03b2b2f 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -125,10 +125,11 @@ cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts, } //---------------------------------------------------------------------------- -void cmGlobalVisualStudio10Generator::AddPlatformDefinitions(cmMakefile* mf) +bool cmGlobalVisualStudio10Generator::SetSystemName(std::string const& s, + cmMakefile* mf) { - cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf); this->AddVSPlatformToolsetDefinition(mf); + return this->cmGlobalVisualStudio8Generator::SetSystemName(s, mf); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 107b646..cb639dd 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -31,6 +31,7 @@ public: virtual bool MatchesGeneratorName(const std::string& name) const; virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); + virtual bool SetSystemName(std::string const& s, cmMakefile* mf); virtual void GenerateBuildCommand( std::vector& makeCommand, @@ -43,8 +44,6 @@ public: std::vector const& makeOptions = std::vector() ); - virtual void AddPlatformDefinitions(cmMakefile* mf); - ///! create the correct local generator virtual cmLocalGenerator *CreateLocalGenerator(); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 759e81e..602d678 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -80,7 +80,6 @@ void cmGlobalVisualStudio7Generator { mf->AddDefinition("CMAKE_GENERATOR_RC", "rc"); mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); - this->AddPlatformDefinitions(mf); if(!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES")) { mf->AddCacheDefinition( @@ -260,7 +259,8 @@ cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator() } //---------------------------------------------------------------------------- -void cmGlobalVisualStudio7Generator::AddPlatformDefinitions(cmMakefile* mf) +bool cmGlobalVisualStudio7Generator::SetSystemName(std::string const& s, + cmMakefile* mf) { if(this->PlatformName == "x64") { @@ -273,6 +273,7 @@ void cmGlobalVisualStudio7Generator::AddPlatformDefinitions(cmMakefile* mf) mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName().c_str()); mf->AddDefinition("CMAKE_VS_INTEL_Fortran_PROJECT_VERSION", this->GetIntelProjectVersion()); + return this->cmGlobalVisualStudioGenerator::SetSystemName(s, mf); } void cmGlobalVisualStudio7Generator::GenerateConfigurations(cmMakefile* mf) diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 291d297..bd84433 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -44,7 +44,7 @@ public: ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); - virtual void AddPlatformDefinitions(cmMakefile* mf); + virtual bool SetSystemName(std::string const& s, cmMakefile* mf); /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 67583de..1bac322 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -133,10 +133,17 @@ cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator() } //---------------------------------------------------------------------------- -void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf) +void cmGlobalVisualStudio8Generator +::EnableLanguage(std::vectorconst & lang, + cmMakefile *mf, bool optional) { - cmGlobalVisualStudio71Generator::AddPlatformDefinitions(mf); + this->AddPlatformDefinitions(mf); + cmGlobalVisualStudio7Generator::EnableLanguage(lang, mf, optional); +} +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf) +{ if(this->TargetsWindowsCE()) { mf->AddDefinition("CMAKE_VS_WINCE_VERSION", diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 07bccee..aea2f01 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -36,6 +36,8 @@ public: ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); + virtual void EnableLanguage(std::vectorconst& languages, + cmMakefile *, bool optional); virtual void AddPlatformDefinitions(cmMakefile* mf); /** http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d3d9218a52dad04c1cfa87e537d98ee0678db1db commit d3d9218a52dad04c1cfa87e537d98ee0678db1db Author: Brad King AuthorDate: Thu Jul 17 16:19:27 2014 -0400 Commit: Brad King CommitDate: Thu Jul 17 16:19:27 2014 -0400 VS: Remove unused method from VS 9 generator diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 45608e1..00d9179 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -122,14 +122,6 @@ cmLocalGenerator *cmGlobalVisualStudio9Generator::CreateLocalGenerator() } //---------------------------------------------------------------------------- -void cmGlobalVisualStudio9Generator -::EnableLanguage(std::vectorconst & lang, - cmMakefile *mf, bool optional) -{ - cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional); -} - -//---------------------------------------------------------------------------- std::string cmGlobalVisualStudio9Generator::GetUserMacrosDirectory() { std::string base; diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index f1c7091..c24d5fe 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -35,8 +35,6 @@ public: * Try to determine system infomation such as shared library * extension, pthreads, byte order etc. */ - virtual void EnableLanguage(std::vectorconst& languages, - cmMakefile *, bool optional); virtual void WriteSLNHeader(std::ostream& fout); /** http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eeb60102e813c6c69546e4257a332ede4e234171 commit eeb60102e813c6c69546e4257a332ede4e234171 Author: Brad King AuthorDate: Thu Jul 17 16:16:10 2014 -0400 Commit: Brad King CommitDate: Thu Jul 17 16:17:35 2014 -0400 VS: Refactor CMAKE_FORCE_*64 platform definitions Remove the general infrastructure for these additional platform definitions and hard-code the only two special cases that used it. They are only for historical reasons so no new such cases should be added. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index a6d1c31..80d08b9 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -51,19 +51,19 @@ public: if(!*p) { return new cmGlobalVisualStudio10Generator( - genName, "", ""); + genName, ""); } if(*p++ != ' ') { return 0; } if(strcmp(p, "Win64") == 0) { return new cmGlobalVisualStudio10Generator( - genName, "x64", "CMAKE_FORCE_WIN64"); + genName, "x64"); } if(strcmp(p, "IA64") == 0) { return new cmGlobalVisualStudio10Generator( - genName, "Itanium", "CMAKE_FORCE_IA64"); + genName, "Itanium"); } return 0; } @@ -90,10 +90,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory() //---------------------------------------------------------------------------- cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( - const std::string& name, const std::string& platformName, - const std::string& additionalPlatformDefinition) - : cmGlobalVisualStudio8Generator(name, platformName, - additionalPlatformDefinition) + const std::string& name, const std::string& platformName) + : cmGlobalVisualStudio8Generator(name, platformName) { std::string vc10Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index b4dcc7e..107b646 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -25,8 +25,7 @@ class cmGlobalVisualStudio10Generator : { public: cmGlobalVisualStudio10Generator(const std::string& name, - const std::string& platformName, - const std::string& additionalPlatformDefinition); + const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); virtual bool MatchesGeneratorName(const std::string& name) const; diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index fa134fc..0bd51ea 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -46,19 +46,19 @@ public: if(!*p) { return new cmGlobalVisualStudio11Generator( - genName, "", ""); + genName, ""); } if(*p++ != ' ') { return 0; } if(strcmp(p, "Win64") == 0) { return new cmGlobalVisualStudio11Generator( - genName, "x64", "CMAKE_FORCE_WIN64"); + genName, "x64"); } if(strcmp(p, "ARM") == 0) { return new cmGlobalVisualStudio11Generator( - genName, "ARM", ""); + genName, "ARM"); } std::set installedSDKs = @@ -70,7 +70,7 @@ public: } cmGlobalVisualStudio11Generator* ret = - new cmGlobalVisualStudio11Generator(name, p, NULL); + new cmGlobalVisualStudio11Generator(name, p); ret->WindowsCEVersion = "8.00"; return ret; } @@ -105,10 +105,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory() //---------------------------------------------------------------------------- cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( - const std::string& name, const std::string& platformName, - const std::string& additionalPlatformDefinition) - : cmGlobalVisualStudio10Generator(name, platformName, - additionalPlatformDefinition) + const std::string& name, const std::string& platformName) + : cmGlobalVisualStudio10Generator(name, platformName) { std::string vc11Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 48ea489..3d89a94 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -21,8 +21,7 @@ class cmGlobalVisualStudio11Generator: { public: cmGlobalVisualStudio11Generator(const std::string& name, - const std::string& platformName, - const std::string& additionalPlatformDefinition); + const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); virtual bool MatchesGeneratorName(const std::string& name) const; diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 698624d..47c43fa 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -46,19 +46,19 @@ public: if(!*p) { return new cmGlobalVisualStudio12Generator( - genName, "", ""); + genName, ""); } if(*p++ != ' ') { return 0; } if(strcmp(p, "Win64") == 0) { return new cmGlobalVisualStudio12Generator( - genName, "x64", "CMAKE_FORCE_WIN64"); + genName, "x64"); } if(strcmp(p, "ARM") == 0) { return new cmGlobalVisualStudio12Generator( - genName, "ARM", ""); + genName, "ARM"); } return 0; } @@ -85,10 +85,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory() //---------------------------------------------------------------------------- cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator( - const std::string& name, const std::string& platformName, - const std::string& additionalPlatformDefinition) - : cmGlobalVisualStudio11Generator(name, platformName, - additionalPlatformDefinition) + const std::string& name, const std::string& platformName) + : cmGlobalVisualStudio11Generator(name, platformName) { std::string vc12Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index 4557f28..8ac2d1d 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -21,8 +21,7 @@ class cmGlobalVisualStudio12Generator: { public: cmGlobalVisualStudio12Generator(const std::string& name, - const std::string& platformName, - const std::string& additionalPlatformDefinition); + const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); virtual bool MatchesGeneratorName(const std::string& name) const; diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 9bde0ad..076b057 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -31,19 +31,19 @@ public: if(!*p) { return new cmGlobalVisualStudio14Generator( - genName, "", ""); + genName, ""); } if(*p++ != ' ') { return 0; } if(strcmp(p, "Win64") == 0) { return new cmGlobalVisualStudio14Generator( - genName, "x64", "CMAKE_FORCE_WIN64"); + genName, "x64"); } if(strcmp(p, "ARM") == 0) { return new cmGlobalVisualStudio14Generator( - genName, "ARM", ""); + genName, "ARM"); } return 0; } @@ -70,10 +70,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio14Generator::NewFactory() //---------------------------------------------------------------------------- cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator( - const std::string& name, const std::string& platformName, - const std::string& additionalPlatformDefinition) - : cmGlobalVisualStudio12Generator(name, platformName, - additionalPlatformDefinition) + const std::string& name, const std::string& platformName) + : cmGlobalVisualStudio12Generator(name, platformName) { std::string vc14Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index 7074119..3fd60a0 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -21,8 +21,7 @@ class cmGlobalVisualStudio14Generator: { public: cmGlobalVisualStudio14Generator(const std::string& name, - const std::string& platformName, - const std::string& additionalPlatformDefinition); + const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); virtual bool MatchesGeneratorName(const std::string& name) const; diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 7397bbb..455a7a2 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -41,7 +41,6 @@ void cmGlobalVisualStudio6Generator cmMakefile *mf, bool optional) { - cmGlobalVisualStudioGenerator::AddPlatformDefinitions(mf); mf->AddDefinition("CMAKE_GENERATOR_RC", "rc"); mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); this->GenerateConfigurations(mf); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index a918d1d..759e81e 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -262,7 +262,14 @@ cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalVisualStudio7Generator::AddPlatformDefinitions(cmMakefile* mf) { - cmGlobalVisualStudioGenerator::AddPlatformDefinitions(mf); + if(this->PlatformName == "x64") + { + mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); + } + else if(this->PlatformName == "Itanium") + { + mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE"); + } mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName().c_str()); mf->AddDefinition("CMAKE_VS_INTEL_Fortran_PROJECT_VERSION", this->GetIntelProjectVersion()); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index e6672a8..67583de 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -36,7 +36,7 @@ public: if(p[0] == '\0') { return new cmGlobalVisualStudio8Generator( - name, "", ""); + name, ""); } if(p[0] != ' ') @@ -49,7 +49,7 @@ public: if(!strcmp(p, "Win64")) { return new cmGlobalVisualStudio8Generator( - name, "x64", "CMAKE_FORCE_WIN64"); + name, "x64"); } cmVisualStudioWCEPlatformParser parser(p); @@ -60,7 +60,7 @@ public: } cmGlobalVisualStudio8Generator* ret = new cmGlobalVisualStudio8Generator( - name, p, ""); + name, p); ret->WindowsCEVersion = parser.GetOSVersion(); return ret; } @@ -93,17 +93,11 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio8Generator::NewFactory() //---------------------------------------------------------------------------- cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator( - const std::string& name, const std::string& platformName, - const std::string& additionalPlatformDefinition) + const std::string& name, const std::string& platformName) : cmGlobalVisualStudio71Generator(platformName) { this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; this->Name = name; - - if (!additionalPlatformDefinition.empty()) - { - this->AdditionalPlatformDefinition = additionalPlatformDefinition; - } } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 2459c05..07bccee 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -24,8 +24,7 @@ class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator { public: cmGlobalVisualStudio8Generator(const std::string& name, - const std::string& platformName, - const std::string& additionalPlatformDefinition); + const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); ///! Get the name for the generator. diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index c0051c7..45608e1 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -34,7 +34,7 @@ public: if(p[0] == '\0') { return new cmGlobalVisualStudio9Generator( - name, "", ""); + name, ""); } if(p[0] != ' ') @@ -47,13 +47,13 @@ public: if(!strcmp(p, "IA64")) { return new cmGlobalVisualStudio9Generator( - name, "Itanium", "CMAKE_FORCE_IA64"); + name, "Itanium"); } if(!strcmp(p, "Win64")) { return new cmGlobalVisualStudio9Generator( - name, "x64", "CMAKE_FORCE_WIN64"); + name, "x64"); } cmVisualStudioWCEPlatformParser parser(p); @@ -64,7 +64,7 @@ public: } cmGlobalVisualStudio9Generator* ret = new cmGlobalVisualStudio9Generator( - name, p, NULL); + name, p); ret->WindowsCEVersion = parser.GetOSVersion(); return ret; } @@ -98,10 +98,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory() //---------------------------------------------------------------------------- cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator( - const std::string& name, const std::string& platformName, - const std::string& additionalPlatformDefinition) - : cmGlobalVisualStudio8Generator(name, platformName, - additionalPlatformDefinition) + const std::string& name, const std::string& platformName) + : cmGlobalVisualStudio8Generator(name, platformName) { } diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index fb87bbe..f1c7091 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -25,8 +25,7 @@ class cmGlobalVisualStudio9Generator : { public: cmGlobalVisualStudio9Generator(const std::string& name, - const std::string& platformName, - const std::string& additionalPlatformDefinition); + const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); ///! create the correct local generator diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index c5a0e29..2dab23c 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -23,7 +23,6 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator() { - this->AdditionalPlatformDefinition = ""; } //---------------------------------------------------------------------------- @@ -478,15 +477,6 @@ void cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf) } //---------------------------------------------------------------------------- -void cmGlobalVisualStudioGenerator::AddPlatformDefinitions(cmMakefile* mf) -{ - if(!this->AdditionalPlatformDefinition.empty()) - { - mf->AddDefinition(this->AdditionalPlatformDefinition, "TRUE"); - } -} - -//---------------------------------------------------------------------------- std::string cmGlobalVisualStudioGenerator::GetUtilityDepend(cmTarget const* target) { diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 1ab8990..05dbb11 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -97,8 +97,6 @@ protected: virtual const char* GetIDEVersion() = 0; - virtual void AddPlatformDefinitions(cmMakefile* mf); - virtual bool ComputeTargetDepends(); class VSDependSet: public std::set {}; class VSDependMap: public std::map {}; @@ -111,7 +109,6 @@ protected: std::string GetUtilityDepend(cmTarget const* target); typedef std::map UtilityDependsMap; UtilityDependsMap UtilityDepends; - std::string AdditionalPlatformDefinition; private: virtual std::string GetVSMakeProgram() = 0; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ecb34faaaba841aac6dae722dd2c6256a1472d74 commit ecb34faaaba841aac6dae722dd2c6256a1472d74 Author: Brad King AuthorDate: Thu Jul 17 15:05:17 2014 -0400 Commit: Brad King CommitDate: Thu Jul 17 16:01:41 2014 -0400 Tell generators about CMAKE_SYSTEM_NAME as soon as it is known Add a cmGlobalGenerator::SetSystemName virtual method. Call it from cmGlobalGenerator::EnableLanguage as soon as CMAKE_SYSTEM_NAME is known. This will give generators a chance to adapt themselves to the target system. Pass the cmMakefile instance to the method so that the generator can update it accordingly. Return early from EnableLanguage if SetSystemName returns false. diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 36932aa..6d737b1 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -448,6 +448,14 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, mf->ReadListFile(0,fpath.c_str()); } + // Tell the generator about the target system. + std::string system = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME"); + if(!this->SetSystemName(system, mf)) + { + cmSystemTools::SetFatalErrorOccured(); + return; + } + // Tell the generator about the toolset, if any. std::string toolset = mf->GetSafeDefinition("CMAKE_GENERATOR_TOOLSET"); if(!toolset.empty() && diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 5e6c03e..ee3f269 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -61,6 +61,10 @@ public: virtual bool MatchesGeneratorName(const std::string& name) const { return this->GetName() == name; } + /** Tell the generator about the target system. */ + virtual bool SetSystemName(std::string const&, cmMakefile*) + { return true; } + /** Set the generator-specific toolset name. Returns true if toolset is supported and false otherwise. */ virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalGenerator.cxx | 8 +++++++ Source/cmGlobalGenerator.h | 4 ++++ Source/cmGlobalVisualStudio10Generator.cxx | 32 +++++++++++++--------------- Source/cmGlobalVisualStudio10Generator.h | 6 ++---- Source/cmGlobalVisualStudio11Generator.cxx | 14 ++++++------ Source/cmGlobalVisualStudio11Generator.h | 3 +-- Source/cmGlobalVisualStudio12Generator.cxx | 12 +++++------ Source/cmGlobalVisualStudio12Generator.h | 3 +-- Source/cmGlobalVisualStudio14Generator.cxx | 12 +++++------ Source/cmGlobalVisualStudio14Generator.h | 3 +-- Source/cmGlobalVisualStudio6Generator.cxx | 1 - Source/cmGlobalVisualStudio7Generator.cxx | 14 +++++++++--- Source/cmGlobalVisualStudio7Generator.h | 2 +- Source/cmGlobalVisualStudio8Generator.cxx | 25 +++++++++++----------- Source/cmGlobalVisualStudio8Generator.h | 5 +++-- Source/cmGlobalVisualStudio9Generator.cxx | 22 ++++++------------- Source/cmGlobalVisualStudio9Generator.h | 5 +---- Source/cmGlobalVisualStudioGenerator.cxx | 10 --------- Source/cmGlobalVisualStudioGenerator.h | 3 --- 19 files changed, 83 insertions(+), 101 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 17 17:01:05 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 17 Jul 2014 17:01:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4366-gd87fc2d Message-ID: <20140717210105.B796842B19@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d87fc2dad7042b5ccbca6704d0ed75eeee646eec (commit) via 7a526c35f60ced43606bf028a21dedfaac77c2e9 (commit) from 961f90fa7168c618ec7c98857887b3a22cff0c9d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d87fc2dad7042b5ccbca6704d0ed75eeee646eec commit d87fc2dad7042b5ccbca6704d0ed75eeee646eec Merge: 961f90f 7a526c3 Author: Brad King AuthorDate: Thu Jul 17 17:01:05 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 17 17:01:05 2014 -0400 Merge topic 'delay-generator-platform' into next 7a526c35 VS: Delay getting platform name in local generator http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7a526c35f60ced43606bf028a21dedfaac77c2e9 commit 7a526c35f60ced43606bf028a21dedfaac77c2e9 Author: Brad King AuthorDate: Thu Jul 17 16:58:34 2014 -0400 Commit: Brad King CommitDate: Thu Jul 17 16:59:53 2014 -0400 VS: Delay getting platform name in local generator Ask the global generator during generation instead of trying to store it up front. Later the global generator may not know the platform name when it is creating the local generator. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 043f89d..c1b087a 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -168,7 +168,6 @@ cmLocalGenerator *cmGlobalVisualStudio10Generator::CreateLocalGenerator() { cmLocalVisualStudio10Generator* lg = new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS10); - lg->SetPlatformName(this->GetPlatformName()); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 0bd51ea..e5a159b 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -147,7 +147,6 @@ cmLocalGenerator *cmGlobalVisualStudio11Generator::CreateLocalGenerator() { cmLocalVisualStudio10Generator* lg = new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS11); - lg->SetPlatformName(this->GetPlatformName()); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 47c43fa..4235cbc 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -127,7 +127,6 @@ cmLocalGenerator *cmGlobalVisualStudio12Generator::CreateLocalGenerator() { cmLocalVisualStudio10Generator* lg = new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS12); - lg->SetPlatformName(this->GetPlatformName()); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 076b057..d001f93 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -108,7 +108,6 @@ cmLocalGenerator *cmGlobalVisualStudio14Generator::CreateLocalGenerator() { cmLocalVisualStudio10Generator* lg = new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS14); - lg->SetPlatformName(this->GetPlatformName()); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 1bac322..9fd3d5a 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -126,7 +126,6 @@ cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator() { cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8); - lg->SetPlatformName(this->GetPlatformName()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); lg->SetGlobalGenerator(this); return lg; diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 00d9179..1d73b5c 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -115,7 +115,6 @@ cmLocalGenerator *cmGlobalVisualStudio9Generator::CreateLocalGenerator() { cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9); - lg->SetPlatformName(this->GetPlatformName()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); lg->SetGlobalGenerator(this); return lg; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index a6c6e8d..e0fe0fd 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -48,7 +48,6 @@ extern cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[]; cmLocalVisualStudio7Generator::cmLocalVisualStudio7Generator(VSVersion v): cmLocalVisualStudioGenerator(v) { - this->PlatformName = "Win32"; this->ExtraFlagTable = 0; this->Internal = new cmLocalVisualStudio7GeneratorInternals(this); } @@ -647,8 +646,11 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, { mfcFlag = "0"; } + cmGlobalVisualStudio7Generator* gg = + static_cast(this->GlobalGenerator); fout << "\t\tPlatformName << "\"\n" + << "\t\t\tName=\"" << configName + << "|" << gg->GetPlatformName() << "\"\n" << "\t\t\tOutputDirectory=\"" << configName << "\"\n"; // This is an internal type to Visual Studio, it seems that: // 4 == static library @@ -896,11 +898,11 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, } fout << "\"\n"; fout << "\t\t\t\tMkTypLibCompatible=\"false\"\n"; - if( this->PlatformName == "x64" ) + if( gg->GetPlatformName() == "x64" ) { fout << "\t\t\t\tTargetEnvironment=\"3\"\n"; } - else if( this->PlatformName == "ia64" ) + else if( gg->GetPlatformName() == "ia64" ) { fout << "\t\t\t\tTargetEnvironment=\"2\"\n"; } @@ -1640,6 +1642,8 @@ bool cmLocalVisualStudio7Generator std::ostream &fout, const std::string& libName, std::vector *configs) { + cmGlobalVisualStudio7Generator* gg = + static_cast(this->GlobalGenerator); const std::vector &sourceFiles = sg->GetSourceFiles(); std::vector const& children = sg->GetGroupChildren(); @@ -1730,7 +1734,7 @@ bool cmLocalVisualStudio7Generator cmLVS7GFileConfig const& fc = fci->second; fout << "\t\t\t\tfirst - << "|" << this->PlatformName << "\""; + << "|" << gg->GetPlatformName() << "\""; if(fc.ExcludedFromBuild) { fout << " ExcludedFromBuild=\"true\""; @@ -1800,6 +1804,9 @@ WriteCustomRule(std::ostream& fout, const cmCustomCommand& command, FCInfo& fcinfo) { + cmGlobalVisualStudio7Generator* gg = + static_cast(this->GlobalGenerator); + // Write the rule for each configuration. std::vector::iterator i; std::vector *configs = @@ -1820,7 +1827,8 @@ WriteCustomRule(std::ostream& fout, cmCustomCommandGenerator ccg(command, *i, this->Makefile); cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i]; fout << "\t\t\t\tPlatformName << "\">\n"; + fout << "\t\t\t\t\tName=\"" << *i << "|" + << gg->GetPlatformName() << "\">\n"; if(!fc.CompileFlags.empty()) { fout << "\t\t\t\t\t\n" << "\tProjectGUID=\"{" << gg->GetGUID(libName.c_str()) << "}\">\n" << "\t\n" - << "\t\tPlatformName << "\"/>\n" + << "\t\tGetPlatformName() << "\"/>\n" << "\t\n"; } @@ -2085,7 +2093,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, } fout << "\tKeyword=\"" << keyword << "\">\n" << "\t\n" - << "\t\tPlatformName << "\"/>\n" + << "\t\tGetPlatformName() << "\"/>\n" << "\t\n"; } diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 6c04559..c2caa26 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -53,8 +53,6 @@ public: */ void SetBuildType(BuildType,const std::string& name); - void SetPlatformName(const std::string& n) { this->PlatformName = n;} - void SetExtraFlagTable(cmVS7FlagTable const* table) { this->ExtraFlagTable = table; } virtual std::string GetTargetDirectory(cmTarget const&) const; @@ -124,7 +122,6 @@ private: std::string ModuleDefinitionFile; bool FortranProject; bool WindowsCEProject; - std::string PlatformName; // Win32 or x64 cmLocalVisualStudio7GeneratorInternals* Internal; }; ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalVisualStudio10Generator.cxx | 1 - Source/cmGlobalVisualStudio11Generator.cxx | 1 - Source/cmGlobalVisualStudio12Generator.cxx | 1 - Source/cmGlobalVisualStudio14Generator.cxx | 1 - Source/cmGlobalVisualStudio8Generator.cxx | 1 - Source/cmGlobalVisualStudio9Generator.cxx | 1 - Source/cmLocalVisualStudio7Generator.cxx | 24 ++++++++++++++++-------- Source/cmLocalVisualStudio7Generator.h | 3 --- 8 files changed, 16 insertions(+), 17 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jul 18 00:02:28 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 18 Jul 2014 00:02:28 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1429-gbbd930e Message-ID: <20140718040228.2D11544A7F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via bbd930ea3c7fbc376d2f112ae7cd373a27cdf5bc (commit) from e4510941a3cc5f2990d79242db791bf370bb07d3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bbd930ea3c7fbc376d2f112ae7cd373a27cdf5bc commit bbd930ea3c7fbc376d2f112ae7cd373a27cdf5bc Author: Kitware Robot AuthorDate: Fri Jul 18 00:01:11 2014 -0400 Commit: Kitware Robot CommitDate: Fri Jul 18 00:01:11 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index eb5dd2e..b0a7f64 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140717) +set(CMake_VERSION_PATCH 20140718) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Jul 18 10:04:41 2014 From: brad.king at kitware.com (Brad King) Date: Fri, 18 Jul 2014 10:04:41 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4368-gb87f9e1 Message-ID: <20140718140441.CE34A45E80@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via b87f9e1486bbda614e7a7037b46b0ea08cde6392 (commit) via 09b2ac38d15509ae8d5c54adbcef050846b56210 (commit) from d87fc2dad7042b5ccbca6704d0ed75eeee646eec (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b87f9e1486bbda614e7a7037b46b0ea08cde6392 commit b87f9e1486bbda614e7a7037b46b0ea08cde6392 Merge: d87fc2d 09b2ac3 Author: Brad King AuthorDate: Fri Jul 18 10:04:41 2014 -0400 Commit: CMake Topic Stage CommitDate: Fri Jul 18 10:04:41 2014 -0400 Merge topic 'encoding-ctest-fixes' into next 09b2ac38 Encoding: Fix a few encoding problems with ctest. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=09b2ac38d15509ae8d5c54adbcef050846b56210 commit 09b2ac38d15509ae8d5c54adbcef050846b56210 Author: Clinton Stimpson AuthorDate: Tue Jul 15 11:11:18 2014 -0600 Commit: Brad King CommitDate: Fri Jul 18 10:05:01 2014 -0400 Encoding: Fix a few encoding problems with ctest. This also fixes some test failures on Windows when the name of the build directory contains non-ascii characters. diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 7c72cba..109905c 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -225,8 +225,8 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, std::string upload_as = url + "/" + remoteprefix + cmSystemTools::GetFilenameName(*file); - struct stat st; - if ( ::stat(local_file.c_str(), &st) ) + + if ( !cmSystemTools::FileExists(local_file.c_str()) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: " << local_file << std::endl); @@ -234,6 +234,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, ::curl_global_cleanup(); return false; } + unsigned long filelen = cmSystemTools::FileLength(local_file.c_str()); ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb"); *this->LogFile << "\tUpload file: " << local_file << " to " @@ -252,7 +253,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, // and give the size of the upload (optional) ::curl_easy_setopt(curl, CURLOPT_INFILESIZE, - static_cast(st.st_size)); + static_cast(filelen)); // and give curl the buffer for errors ::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer); @@ -466,8 +467,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, upload_as += md5; } - struct stat st; - if ( ::stat(local_file.c_str(), &st) ) + if( !cmSystemTools::FileExists(local_file.c_str()) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: " << local_file << std::endl); @@ -475,11 +475,12 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, ::curl_global_cleanup(); return false; } + unsigned long filelen = cmSystemTools::FileLength(local_file.c_str()); ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb"); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " << local_file << " to " - << upload_as << " Size: " << st.st_size << std::endl); + << upload_as << " Size: " << filelen << std::endl); // specify target ::curl_easy_setopt(curl,CURLOPT_URL, upload_as.c_str()); @@ -489,7 +490,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, // and give the size of the upload (optional) ::curl_easy_setopt(curl, CURLOPT_INFILESIZE, - static_cast(st.st_size)); + static_cast(filelen)); // and give curl the buffer for errors ::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer); diff --git a/Tests/CTestTestMemcheck/memtester.cxx.in b/Tests/CTestTestMemcheck/memtester.cxx.in index 55a34e3..43c0ba7 100644 --- a/Tests/CTestTestMemcheck/memtester.cxx.in +++ b/Tests/CTestTestMemcheck/memtester.cxx.in @@ -1,11 +1,19 @@ #include +#include #include +#include #define RETVAL @_retval@ int -main(int argc, char **argv) +main(int ac, char **av) { + setlocale(LC_CTYPE, ""); + cmsys::Encoding::CommandLineArguments args = + cmsys::Encoding::CommandLineArguments::Main(ac, av); + int argc = args.argc(); + const char* const* argv = args.argv(); + std::string exename = argv[0]; std::string logarg; bool nextarg = false; ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Fri Jul 18 10:20:31 2014 From: brad.king at kitware.com (Brad King) Date: Fri, 18 Jul 2014 10:20:31 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4372-ga757dc1 Message-ID: <20140718142031.62A1F455AA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via a757dc10e16b8f6e7840c9e59fe653d9b47eec2b (commit) via 6f3e094e9f0017b63e138e001c86e467c8f9b7c9 (commit) via d4d1b7f7d1d6592f12a6692dfb8068aa495bd454 (commit) via bbd930ea3c7fbc376d2f112ae7cd373a27cdf5bc (commit) from b87f9e1486bbda614e7a7037b46b0ea08cde6392 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a757dc10e16b8f6e7840c9e59fe653d9b47eec2b commit a757dc10e16b8f6e7840c9e59fe653d9b47eec2b Merge: b87f9e1 6f3e094 Author: Brad King AuthorDate: Fri Jul 18 10:20:30 2014 -0400 Commit: CMake Topic Stage CommitDate: Fri Jul 18 10:20:30 2014 -0400 Merge topic 'update-kwsys' into next 6f3e094e Merge branch 'upstream-kwsys' into update-kwsys d4d1b7f7 KWSys 2014-07-18 (65b36ede) bbd930ea CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6f3e094e9f0017b63e138e001c86e467c8f9b7c9 commit 6f3e094e9f0017b63e138e001c86e467c8f9b7c9 Merge: bbd930e d4d1b7f Author: Brad King AuthorDate: Fri Jul 18 10:15:23 2014 -0400 Commit: Brad King CommitDate: Fri Jul 18 10:15:23 2014 -0400 Merge branch 'upstream-kwsys' into update-kwsys http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d4d1b7f7d1d6592f12a6692dfb8068aa495bd454 commit d4d1b7f7d1d6592f12a6692dfb8068aa495bd454 Author: KWSys Robot AuthorDate: Fri Jul 18 08:32:24 2014 -0400 Commit: Brad King CommitDate: Fri Jul 18 10:15:20 2014 -0400 KWSys 2014-07-18 (65b36ede) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 65b36ede | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' c2a329ce..65b36ede Bob E (1): 697b1401 SystemInformation: No SA_RESTART on QNX Clinton Stimpson (1): 65b36ede Encoding: Fix testProcess to work with unicode paths. Steve Dougherty (1): 5f28a52b Terminal: Fix spelling of 'definitely' in comments Change-Id: I224745dc0ca9603ff915b727e798ef293c462d8f diff --git a/SystemInformation.cxx b/SystemInformation.cxx index 6544098..2521aac 100644 --- a/SystemInformation.cxx +++ b/SystemInformation.cxx @@ -3696,7 +3696,10 @@ void SystemInformationImplementation::SetStackTraceOnError(int enable) // install ours struct sigaction sa; sa.sa_sigaction=(SigAction)StacktraceSignalHandler; - sa.sa_flags=SA_SIGINFO|SA_RESTART|SA_RESETHAND; + sa.sa_flags=SA_SIGINFO|SA_RESETHAND; +# ifdef SA_RESTART + sa.sa_flags|=SA_RESTART; +# endif sigemptyset(&sa.sa_mask); sigaction(SIGABRT,&sa,0); diff --git a/Terminal.c b/Terminal.c index 6d7ec41..e13003f 100644 --- a/Terminal.c +++ b/Terminal.c @@ -104,11 +104,11 @@ void kwsysTerminal_cfprintf(int color, FILE* stream, const char* format, ...) } /*--------------------------------------------------------------------------*/ -/* Detect cases when a stream is definately not interactive. */ +/* Detect cases when a stream is definitely not interactive. */ #if !defined(KWSYS_TERMINAL_ISATTY_WORKS) static int kwsysTerminalStreamIsNotInteractive(FILE* stream) { - /* The given stream is definately not interactive if it is a regular + /* The given stream is definitely not interactive if it is a regular file. */ struct stat stream_stat; if(fstat(fileno(stream), &stream_stat) == 0) @@ -212,7 +212,7 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100, (void)default_tty; return isatty(fileno(stream))? 1:0; #else - /* Check for cases in which the stream is definately not a tty. */ + /* Check for cases in which the stream is definitely not a tty. */ if(kwsysTerminalStreamIsNotInteractive(stream)) { return 0; diff --git a/testProcess.c b/testProcess.c index 6d5eb71..3d62822 100644 --- a/testProcess.c +++ b/testProcess.c @@ -11,11 +11,13 @@ ============================================================================*/ #include "kwsysPrivate.h" #include KWSYS_HEADER(Process.h) +#include KWSYS_HEADER(Encoding.h) /* Work-around CMake dependency scanning limitation. This must duplicate the above list of headers. */ #if 0 # include "Process.h.in" +# include "Encoding.h.in" #endif #include @@ -393,6 +395,19 @@ int runChild(const char* cmd[], int state, int exception, int value, int main(int argc, const char* argv[]) { int n = 0; + +#ifdef _WIN32 + int i; + char new_args[10][_MAX_PATH]; + LPWSTR* w_av = CommandLineToArgvW(GetCommandLineW(), &argc); + for(i=0; i This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 0aa7d9dc109d429861fd86c893821672eb5228b8 (commit) via 09b2ac38d15509ae8d5c54adbcef050846b56210 (commit) from bbd930ea3c7fbc376d2f112ae7cd373a27cdf5bc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0aa7d9dc109d429861fd86c893821672eb5228b8 commit 0aa7d9dc109d429861fd86c893821672eb5228b8 Merge: bbd930e 09b2ac3 Author: Brad King AuthorDate: Fri Jul 18 10:56:53 2014 -0400 Commit: CMake Topic Stage CommitDate: Fri Jul 18 10:56:53 2014 -0400 Merge topic 'encoding-ctest-fixes' 09b2ac38 Encoding: Fix a few encoding problems with ctest. ----------------------------------------------------------------------- Summary of changes: Source/CTest/cmCTestSubmitHandler.cxx | 15 ++++++++------- Tests/CTestTestMemcheck/memtester.cxx.in | 10 +++++++++- 2 files changed, 17 insertions(+), 8 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Jul 18 10:56:56 2014 From: brad.king at kitware.com (Brad King) Date: Fri, 18 Jul 2014 10:56:56 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1433-ga67f0b6 Message-ID: <20140718145656.9DA6745CD6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a67f0b6afda965a30f69c67e9dc0b7aed7584760 (commit) via 376ba93588e1dd24cb091c61f9fe635bceaf0a82 (commit) from 0aa7d9dc109d429861fd86c893821672eb5228b8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a67f0b6afda965a30f69c67e9dc0b7aed7584760 commit a67f0b6afda965a30f69c67e9dc0b7aed7584760 Merge: 0aa7d9d 376ba93 Author: Brad King AuthorDate: Fri Jul 18 10:56:55 2014 -0400 Commit: CMake Topic Stage CommitDate: Fri Jul 18 10:56:55 2014 -0400 Merge topic 'identify-qthelp-artifacts' 376ba935 Help: Identify more artifact types in QtHelp documentation. ----------------------------------------------------------------------- Summary of changes: Utilities/Sphinx/create_identifiers.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Jul 18 10:56:58 2014 From: brad.king at kitware.com (Brad King) Date: Fri, 18 Jul 2014 10:56:58 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1435-g494f9e0 Message-ID: <20140718145658.610AD45CD8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 494f9e0bffe8c9b4da3a0c7953d5b1fb46c04c48 (commit) via 3526478cc093f1fc6c1887e1059f337fb7086cc7 (commit) from a67f0b6afda965a30f69c67e9dc0b7aed7584760 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=494f9e0bffe8c9b4da3a0c7953d5b1fb46c04c48 commit 494f9e0bffe8c9b4da3a0c7953d5b1fb46c04c48 Merge: a67f0b6 3526478 Author: Brad King AuthorDate: Fri Jul 18 10:56:57 2014 -0400 Commit: CMake Topic Stage CommitDate: Fri Jul 18 10:56:57 2014 -0400 Merge topic 'fix_Xcode_generator_name' 3526478c Tests: Activate tests accidentally excluded from Xcode ----------------------------------------------------------------------- Summary of changes: Tests/CMakeLists.txt | 4 ++-- Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/File_Generate/RunCMakeTest.cmake | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Jul 18 10:57:01 2014 From: brad.king at kitware.com (Brad King) Date: Fri, 18 Jul 2014 10:57:01 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1437-g5a128c8 Message-ID: <20140718145701.52E63455B6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 5a128c8ec9090a6785c3674ee9ac402283c4e59a (commit) via 7a9909db86ec9bf7c40ad6c7a965701017c3849d (commit) from 494f9e0bffe8c9b4da3a0c7953d5b1fb46c04c48 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5a128c8ec9090a6785c3674ee9ac402283c4e59a commit 5a128c8ec9090a6785c3674ee9ac402283c4e59a Merge: 494f9e0 7a9909d Author: Brad King AuthorDate: Fri Jul 18 10:56:59 2014 -0400 Commit: CMake Topic Stage CommitDate: Fri Jul 18 10:56:59 2014 -0400 Merge topic 'vs-MSTool-condition' 7a9909db VS: Make MS-tool-specific options conditional ----------------------------------------------------------------------- Summary of changes: Source/cmVisualStudio10TargetGenerator.cxx | 236 +++++++++++++++++----------- Source/cmVisualStudio10TargetGenerator.h | 1 + 2 files changed, 142 insertions(+), 95 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Jul 18 10:57:03 2014 From: brad.king at kitware.com (Brad King) Date: Fri, 18 Jul 2014 10:57:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1444-ge27b2c3 Message-ID: <20140718145703.AC22A45CD0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via e27b2c3fa542a400a14176a7753d0daac36c1ed4 (commit) via 7a526c35f60ced43606bf028a21dedfaac77c2e9 (commit) via e7fdb44b1be63e18d03e86f61611dba677e98978 (commit) via 6e176e6d9efa80fb4d08f1ead6bc33f115f8885d (commit) via d3d9218a52dad04c1cfa87e537d98ee0678db1db (commit) via eeb60102e813c6c69546e4257a332ede4e234171 (commit) via ecb34faaaba841aac6dae722dd2c6256a1472d74 (commit) from 5a128c8ec9090a6785c3674ee9ac402283c4e59a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e27b2c3fa542a400a14176a7753d0daac36c1ed4 commit e27b2c3fa542a400a14176a7753d0daac36c1ed4 Merge: 5a128c8 7a526c3 Author: Brad King AuthorDate: Fri Jul 18 10:57:02 2014 -0400 Commit: CMake Topic Stage CommitDate: Fri Jul 18 10:57:02 2014 -0400 Merge topic 'delay-generator-platform' 7a526c35 VS: Delay getting platform name in local generator e7fdb44b VS: Delay detection of VS 10 Express 64-bit tools 6e176e6d VS: Delay platform definitions until system name is known d3d9218a VS: Remove unused method from VS 9 generator eeb60102 VS: Refactor CMAKE_FORCE_*64 platform definitions ecb34faa Tell generators about CMAKE_SYSTEM_NAME as soon as it is known ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalGenerator.cxx | 8 +++++++ Source/cmGlobalGenerator.h | 4 ++++ Source/cmGlobalVisualStudio10Generator.cxx | 33 +++++++++++++--------------- Source/cmGlobalVisualStudio10Generator.h | 6 ++--- Source/cmGlobalVisualStudio11Generator.cxx | 15 +++++-------- Source/cmGlobalVisualStudio11Generator.h | 3 +-- Source/cmGlobalVisualStudio12Generator.cxx | 13 +++++------ Source/cmGlobalVisualStudio12Generator.h | 3 +-- Source/cmGlobalVisualStudio14Generator.cxx | 13 +++++------ Source/cmGlobalVisualStudio14Generator.h | 3 +-- Source/cmGlobalVisualStudio6Generator.cxx | 1 - Source/cmGlobalVisualStudio7Generator.cxx | 14 +++++++++--- Source/cmGlobalVisualStudio7Generator.h | 2 +- Source/cmGlobalVisualStudio8Generator.cxx | 26 +++++++++++----------- Source/cmGlobalVisualStudio8Generator.h | 5 +++-- Source/cmGlobalVisualStudio9Generator.cxx | 23 +++++-------------- Source/cmGlobalVisualStudio9Generator.h | 5 +---- Source/cmGlobalVisualStudioGenerator.cxx | 10 --------- Source/cmGlobalVisualStudioGenerator.h | 3 --- Source/cmLocalVisualStudio7Generator.cxx | 24 +++++++++++++------- Source/cmLocalVisualStudio7Generator.h | 3 --- 21 files changed, 99 insertions(+), 118 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Jul 18 10:57:55 2014 From: brad.king at kitware.com (Brad King) Date: Fri, 18 Jul 2014 10:57:55 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4378-g8369a32 Message-ID: <20140718145755.3FB0445CE7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 8369a32e9c448b79a2945204e71199c8f87f6856 (commit) via e27b2c3fa542a400a14176a7753d0daac36c1ed4 (commit) via 5a128c8ec9090a6785c3674ee9ac402283c4e59a (commit) via 494f9e0bffe8c9b4da3a0c7953d5b1fb46c04c48 (commit) via a67f0b6afda965a30f69c67e9dc0b7aed7584760 (commit) via 0aa7d9dc109d429861fd86c893821672eb5228b8 (commit) from a757dc10e16b8f6e7840c9e59fe653d9b47eec2b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8369a32e9c448b79a2945204e71199c8f87f6856 commit 8369a32e9c448b79a2945204e71199c8f87f6856 Merge: a757dc1 e27b2c3 Author: Brad King AuthorDate: Fri Jul 18 10:59:05 2014 -0400 Commit: Brad King CommitDate: Fri Jul 18 10:59:05 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Fri Jul 18 11:00:30 2014 From: brad.king at kitware.com (Brad King) Date: Fri, 18 Jul 2014 11:00:30 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1456-g36a8184 Message-ID: <20140718150030.9D13645D80@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 36a8184d40e7055e9af564b5ad86cd84b7934994 (commit) via a9c9b66c272d1d63918c1a5040c63d6cb169be91 (commit) via bcb6dbc1cb0bfeb0627c0b48ced41beea9d4c51a (commit) via 679f3deeb79a7b19fb47b96bb520817c1c529f36 (commit) via 23d6520daae729e433fc9325eb53acb541979d0f (commit) via cd54f1dbeb5c71b400ccb0db81a0fcea45df46b8 (commit) via b75fc0e1ad343173f5231819cfcdbdee9a8b076a (commit) via 660769151a7f628f92eb28d77bcae854eaae54c2 (commit) via cebefa71fad223f134529a2b859006360e465a80 (commit) via 97ce676e75900dfeeb30ea1c6ba5a139befe9562 (commit) via 4cfa918a9ae983274a7995ca89fb46fdf570b00c (commit) via 85242b7df63a8097c5672c3053873aec371b6af7 (commit) from e27b2c3fa542a400a14176a7753d0daac36c1ed4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=36a8184d40e7055e9af564b5ad86cd84b7934994 commit 36a8184d40e7055e9af564b5ad86cd84b7934994 Merge: e27b2c3 a9c9b66 Author: Brad King AuthorDate: Fri Jul 18 11:00:29 2014 -0400 Commit: CMake Topic Stage CommitDate: Fri Jul 18 11:00:29 2014 -0400 Merge topic 'dev/target-fastpaths' a9c9b66c cmTarget: use a hash_map for cmTargets typedef bcb6dbc1 cmTarget: help the optimizer a bit 679f3dee cmTarget: use hash_set for sets of strings 23d6520d cmTarget: Allow caching of empty genex expansions cd54f1db cmTarget: Only copy GenEx expansions when necessary b75fc0e1 cmTarget: Don't set properties on custom targets 66076915 cmTarget: Use static strings for special property names cebefa71 cmTarget: Sort special property checks 97ce676e cmTarget: Fast path for regular properties 4cfa918a cmTarget: Factor out common code 85242b7d cmTarget: Use else/if trees rather than an if tree ----------------------------------------------------------------------- Summary of changes: Source/cmTarget.cxx | 667 ++++++++++++++++++++++++++------------------------- Source/cmTarget.h | 7 + 2 files changed, 344 insertions(+), 330 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Jul 18 11:00:46 2014 From: brad.king at kitware.com (Brad King) Date: Fri, 18 Jul 2014 11:00:46 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4380-g76ed15b Message-ID: <20140718150046.40B6B45D95@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 76ed15be38bc929169d035df9f9da4cdeb9a7a4c (commit) via 36a8184d40e7055e9af564b5ad86cd84b7934994 (commit) from 8369a32e9c448b79a2945204e71199c8f87f6856 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=76ed15be38bc929169d035df9f9da4cdeb9a7a4c commit 76ed15be38bc929169d035df9f9da4cdeb9a7a4c Merge: 8369a32 36a8184 Author: Brad King AuthorDate: Fri Jul 18 11:02:01 2014 -0400 Commit: Brad King CommitDate: Fri Jul 18 11:02:01 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From cmake-commits at cmake.org Fri Jul 18 15:37:16 2014 From: cmake-commits at cmake.org (cmake-commits at cmake.org) Date: Fri, 18 Jul 2014 21:37:16 +0200 Subject: [Cmake-commits] Your account has been limited until we hear from you PP-503-472-206 Message-ID: An HTML attachment was scrubbed... URL: From kwrobot at kitware.com Sat Jul 19 00:02:27 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 19 Jul 2014 00:02:27 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1457-g18a4310 Message-ID: <20140719040227.EFBEA462DA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 18a431068105c14e5b4a6d91dacac36b1f9981ef (commit) from 36a8184d40e7055e9af564b5ad86cd84b7934994 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=18a431068105c14e5b4a6d91dacac36b1f9981ef commit 18a431068105c14e5b4a6d91dacac36b1f9981ef Author: Kitware Robot AuthorDate: Sat Jul 19 00:01:07 2014 -0400 Commit: Kitware Robot CommitDate: Sat Jul 19 00:01:07 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b0a7f64..e25559f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140718) +set(CMake_VERSION_PATCH 20140719) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Jul 20 00:02:35 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 20 Jul 2014 00:02:35 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1458-g6ae98ee Message-ID: <20140720040235.3D79B4582E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 6ae98ee18f6c35b93556a66dc0ce909d84aec18b (commit) from 18a431068105c14e5b4a6d91dacac36b1f9981ef (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6ae98ee18f6c35b93556a66dc0ce909d84aec18b commit 6ae98ee18f6c35b93556a66dc0ce909d84aec18b Author: Kitware Robot AuthorDate: Sun Jul 20 00:01:10 2014 -0400 Commit: Kitware Robot CommitDate: Sun Jul 20 00:01:10 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e25559f..196832f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140719) +set(CMake_VERSION_PATCH 20140720) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 21 00:02:40 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 21 Jul 2014 00:02:40 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1459-g8e018ae Message-ID: <20140721040240.F04B145E63@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 8e018ae44e80425ee77db675fb452b9e0eb9730c (commit) from 6ae98ee18f6c35b93556a66dc0ce909d84aec18b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8e018ae44e80425ee77db675fb452b9e0eb9730c commit 8e018ae44e80425ee77db675fb452b9e0eb9730c Author: Kitware Robot AuthorDate: Mon Jul 21 00:01:11 2014 -0400 Commit: Kitware Robot CommitDate: Mon Jul 21 00:01:11 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 196832f..c034126 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140720) +set(CMake_VERSION_PATCH 20140721) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 21 10:36:01 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 21 Jul 2014 10:36:01 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1462-gb86f0e4 Message-ID: <20140721143601.4915045E5C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via b86f0e445b1d7f9e58c8d2d9f14c7501e734057d (commit) via 6f3e094e9f0017b63e138e001c86e467c8f9b7c9 (commit) via d4d1b7f7d1d6592f12a6692dfb8068aa495bd454 (commit) from 8e018ae44e80425ee77db675fb452b9e0eb9730c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b86f0e445b1d7f9e58c8d2d9f14c7501e734057d commit b86f0e445b1d7f9e58c8d2d9f14c7501e734057d Merge: 8e018ae 6f3e094 Author: Brad King AuthorDate: Mon Jul 21 10:36:00 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 21 10:36:00 2014 -0400 Merge topic 'update-kwsys' 6f3e094e Merge branch 'upstream-kwsys' into update-kwsys d4d1b7f7 KWSys 2014-07-18 (65b36ede) ----------------------------------------------------------------------- Summary of changes: Source/kwsys/SystemInformation.cxx | 5 ++++- Source/kwsys/Terminal.c | 6 +++--- Source/kwsys/testProcess.c | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 21 10:36:08 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 21 Jul 2014 10:36:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1464-gc86b99c Message-ID: <20140721143608.4D6C945E6C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c86b99c351d313f3e45ee895a6166d55e86b245c (commit) via 3151024d241c581463d20bf0ce3d1060bdd22de4 (commit) from b86f0e445b1d7f9e58c8d2d9f14c7501e734057d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c86b99c351d313f3e45ee895a6166d55e86b245c commit c86b99c351d313f3e45ee895a6166d55e86b245c Merge: b86f0e4 3151024 Author: Brad King AuthorDate: Mon Jul 21 10:36:07 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 21 10:36:07 2014 -0400 Merge topic 'fix-QCC-compile-flags' 3151024d QNX: Add missing flags for configurations and artifact creation. ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/QCC-C.cmake | 2 ++ Modules/Compiler/QCC-CXX.cmake | 12 +++++++++++ .../QCC.cmake} | 12 +++++++---- Modules/Platform/QNX-QCC-C.cmake | 4 ---- Modules/Platform/QNX-QCC-CXX.cmake | 4 ---- Modules/Platform/QNX.cmake | 22 +++----------------- 6 files changed, 25 insertions(+), 31 deletions(-) create mode 100644 Modules/Compiler/QCC-C.cmake create mode 100644 Modules/Compiler/QCC-CXX.cmake copy Modules/{CMakeSystemSpecificInitialize.cmake => Compiler/QCC.cmake} (62%) delete mode 100644 Modules/Platform/QNX-QCC-C.cmake delete mode 100644 Modules/Platform/QNX-QCC-CXX.cmake hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 21 10:48:37 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 21 Jul 2014 10:48:37 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4382-g97d24d3 Message-ID: <20140721144837.0519B45465@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 97d24d35216972ee496fa38d855bcdc72a694aaa (commit) via ffd404616de587479048455648d566a80ca427f1 (commit) from 76ed15be38bc929169d035df9f9da4cdeb9a7a4c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=97d24d35216972ee496fa38d855bcdc72a694aaa commit 97d24d35216972ee496fa38d855bcdc72a694aaa Merge: 76ed15b ffd4046 Author: Brad King AuthorDate: Mon Jul 21 10:48:36 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 21 10:48:36 2014 -0400 Merge topic 'fix_guard_malloc_forbc' into next ffd40461 Tests/CTestTestMemcheck: Fix malloc guard location http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ffd404616de587479048455648d566a80ca427f1 commit ffd404616de587479048455648d566a80ca427f1 Author: Brad King AuthorDate: Mon Jul 21 10:48:27 2014 -0400 Commit: Brad King CommitDate: Mon Jul 21 10:48:27 2014 -0400 Tests/CTestTestMemcheck: Fix malloc guard location diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index 710994c..f436706 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -225,7 +225,7 @@ set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*${ctest_and_tool_outputs}$") set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES - PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n(.*\n)?${guard_malloc_lines}(\n)*Error parsing XML in stream at line 1: no element found\n") + PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n${guard_malloc_lines}\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n") set_tests_properties(CTestTestMemcheckDummyValgrindInvalidSupFile PROPERTIES PASS_REGULAR_EXPRESSION "\nCannot find memory checker suppression file: ${CTEST_ESCAPED_REALPATH_CMAKE_CURRENT_BINARY_DIR}/does-not-exist\n") ----------------------------------------------------------------------- Summary of changes: Tests/CTestTestMemcheck/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 21 10:49:01 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 21 Jul 2014 10:49:01 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4388-g154cfe3 Message-ID: <20140721144901.5D096454DD@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 154cfe3c03b0c52bdc5ca15054b78567e1d98152 (commit) via c86b99c351d313f3e45ee895a6166d55e86b245c (commit) via b86f0e445b1d7f9e58c8d2d9f14c7501e734057d (commit) via 8e018ae44e80425ee77db675fb452b9e0eb9730c (commit) via 6ae98ee18f6c35b93556a66dc0ce909d84aec18b (commit) via 18a431068105c14e5b4a6d91dacac36b1f9981ef (commit) from 97d24d35216972ee496fa38d855bcdc72a694aaa (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=154cfe3c03b0c52bdc5ca15054b78567e1d98152 commit 154cfe3c03b0c52bdc5ca15054b78567e1d98152 Merge: 97d24d3 c86b99c Author: Brad King AuthorDate: Mon Jul 21 10:50:15 2014 -0400 Commit: Brad King CommitDate: Mon Jul 21 10:50:15 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 21 10:49:56 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 21 Jul 2014 10:49:56 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4390-g4ceee50 Message-ID: <20140721144956.207374552A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 4ceee50e1d51f8bea1a6f76ec267712457a39b02 (commit) via cc3248f45231d24061bbc88fa6dd66897162cb3a (commit) from 154cfe3c03b0c52bdc5ca15054b78567e1d98152 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4ceee50e1d51f8bea1a6f76ec267712457a39b02 commit 4ceee50e1d51f8bea1a6f76ec267712457a39b02 Merge: 154cfe3 cc3248f Author: Brad King AuthorDate: Mon Jul 21 10:49:55 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 21 10:49:55 2014 -0400 Merge topic 'backport-kwsys-qnx-fix' into next cc3248f4 KWSys SystemInformation: No SA_RESTART on QNX http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cc3248f45231d24061bbc88fa6dd66897162cb3a commit cc3248f45231d24061bbc88fa6dd66897162cb3a Author: Bob E AuthorDate: Thu Jul 17 06:23:00 2014 -0400 Commit: Brad King CommitDate: Thu Jul 17 09:51:48 2014 -0400 KWSys SystemInformation: No SA_RESTART on QNX QNX not support SA_RESTART signal: /* #define SA_RESTART 0x0040 (not supported yet) */ Use it in SystemInformation only if it is defined. diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index ec3a133..a03b39c 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -3696,7 +3696,10 @@ void SystemInformationImplementation::SetStackTraceOnError(int enable) // install ours struct sigaction sa; sa.sa_sigaction=(SigAction)StacktraceSignalHandler; - sa.sa_flags=SA_SIGINFO|SA_RESTART|SA_RESETHAND; + sa.sa_flags=SA_SIGINFO|SA_RESETHAND; +# ifdef SA_RESTART + sa.sa_flags|=SA_RESTART; +# endif sigemptyset(&sa.sa_mask); sigaction(SIGABRT,&sa,0); ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 21 10:50:00 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 21 Jul 2014 10:50:00 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1466-g23ec373 Message-ID: <20140721145000.03F4F4552A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 23ec3738a0bafd23a9d37fc72e7183e8dc84a4ac (commit) via cc3248f45231d24061bbc88fa6dd66897162cb3a (commit) from c86b99c351d313f3e45ee895a6166d55e86b245c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=23ec3738a0bafd23a9d37fc72e7183e8dc84a4ac commit 23ec3738a0bafd23a9d37fc72e7183e8dc84a4ac Merge: c86b99c cc3248f Author: Brad King AuthorDate: Mon Jul 21 10:49:59 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 21 10:49:59 2014 -0400 Merge topic 'backport-kwsys-qnx-fix' cc3248f4 KWSys SystemInformation: No SA_RESTART on QNX ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 21 10:50:21 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 21 Jul 2014 10:50:21 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4392-g8187de1 Message-ID: <20140721145021.5B6A3454ED@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 8187de1946953a26308be5b3054fb0ec5ca59766 (commit) via 23ec3738a0bafd23a9d37fc72e7183e8dc84a4ac (commit) from 4ceee50e1d51f8bea1a6f76ec267712457a39b02 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8187de1946953a26308be5b3054fb0ec5ca59766 commit 8187de1946953a26308be5b3054fb0ec5ca59766 Merge: 4ceee50 23ec373 Author: Brad King AuthorDate: Mon Jul 21 10:51:29 2014 -0400 Commit: Brad King CommitDate: Mon Jul 21 10:51:29 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 21 10:57:19 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 21 Jul 2014 10:57:19 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4396-gfe74f3b Message-ID: <20140721145719.51D694570A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via fe74f3b9dc321a3340b9e96646a193469d0be653 (commit) via c3de083ee5cab903b2925908e9a330a9b27e2ffd (commit) via e5821c20de537662b62d91d276499dd797963d6e (commit) via bbea91c7b37bbe41db19c8cadf554af0fd55e4e9 (commit) from 8187de1946953a26308be5b3054fb0ec5ca59766 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fe74f3b9dc321a3340b9e96646a193469d0be653 commit fe74f3b9dc321a3340b9e96646a193469d0be653 Merge: 8187de1 c3de083 Author: Brad King AuthorDate: Mon Jul 21 10:57:18 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 21 10:57:18 2014 -0400 Merge topic 'target-drop-build-setting-cache' into next c3de083e genex-head-sensitive-conditions e5821c20 cmTarget: Drop internal cache of build properties bbea91c7 cmTarget: Drop internal cache of link interface usage requirements http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c3de083ee5cab903b2925908e9a330a9b27e2ffd commit c3de083ee5cab903b2925908e9a330a9b27e2ffd Author: Brad King AuthorDate: Fri Jul 18 15:36:23 2014 -0400 Commit: Brad King CommitDate: Fri Jul 18 15:36:23 2014 -0400 genex-head-sensitive-conditions diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 2b4d955..7fc1464 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -97,6 +97,7 @@ const char *cmCompiledGeneratorExpression::Evaluate( context.Quiet = quiet; context.HadError = false; context.HadContextSensitiveCondition = false; + context.HadHeadSensitiveCondition = false; context.HeadTarget = headTarget; context.EvaluateForBuildsystem = this->EvaluateForBuildsystem; context.CurrentTarget = currentTarget ? currentTarget : headTarget; @@ -124,6 +125,7 @@ const char *cmCompiledGeneratorExpression::Evaluate( if (!context.HadError) { this->HadContextSensitiveCondition = context.HadContextSensitiveCondition; + this->HadHeadSensitiveCondition = context.HadHeadSensitiveCondition; } this->DependTargets = context.DependTargets; @@ -137,6 +139,7 @@ cmCompiledGeneratorExpression::cmCompiledGeneratorExpression( const std::string& input) : Backtrace(backtrace), Input(input), HadContextSensitiveCondition(false), + HadHeadSensitiveCondition(false), EvaluateForBuildsystem(false) { cmGeneratorExpressionLexer l; diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 324d23c..b952520 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -111,6 +111,10 @@ public: { return this->HadContextSensitiveCondition; } + bool GetHadHeadSensitiveCondition() const + { + return this->HadHeadSensitiveCondition; + } void SetEvaluateForBuildsystem(bool eval) { @@ -141,6 +145,7 @@ private: MaxLanguageStandard; mutable std::string Output; mutable bool HadContextSensitiveCondition; + mutable bool HadHeadSensitiveCondition; bool EvaluateForBuildsystem; }; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 28879f1..3d03ece 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -840,6 +840,10 @@ getLinkedTargetsContent( { context->HadContextSensitiveCondition = true; } + if (cge->GetHadHeadSensitiveCondition()) + { + context->HadHeadSensitiveCondition = true; + } } linkedTargetsContent = cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); @@ -871,6 +875,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode cmTarget const* target = context->HeadTarget; std::string propertyName = *parameters.begin(); + if (parameters.size() == 1) + { + context->HadHeadSensitiveCondition = true; + } if (!target && parameters.size() == 1) { reportError(context, content->GetOriginalExpression(), @@ -1313,6 +1321,7 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode "not be used with add_custom_command or add_custom_target."); return std::string(); } + context->HadHeadSensitiveCondition = true; typedef std::map > LangMap; static LangMap availableFeatures; @@ -1446,6 +1455,7 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode } context->HadContextSensitiveCondition = true; + context->HadHeadSensitiveCondition = true; for (size_t i = 1; i < cmArraySize(targetPolicyWhitelist); ++i) { diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 0ffb860..8a529e8 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -41,6 +41,7 @@ struct cmGeneratorExpressionContext bool Quiet; bool HadError; bool HadContextSensitiveCondition; + bool HadHeadSensitiveCondition; bool EvaluateForBuildsystem; }; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e5821c20de537662b62d91d276499dd797963d6e commit e5821c20de537662b62d91d276499dd797963d6e Author: Brad King AuthorDate: Fri Jul 18 14:04:56 2014 -0400 Commit: Brad King CommitDate: Fri Jul 18 15:12:18 2014 -0400 cmTarget: Drop internal cache of build properties These use a huge amount of memory that accumulates as generation proceeds. On the Unix Makefiles generator, only GetIncludeDirectories and GetCompileDefinitions are even called more than once per target (once for build files, once for dependency scanning preprocessor info). Another approach will be needed to avoid duplicate computation in the cases where it does occur. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a812df7..9d00591 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -196,11 +196,9 @@ public: public: TargetPropertyEntry(cmsys::auto_ptr cge, cmLinkImplItem const& item = NoLinkImplItem) - : ge(cge), Cached(false), LinkImplItem(item) + : ge(cge), LinkImplItem(item) {} const cmsys::auto_ptr ge; - std::vector CachedEntries; - bool Cached; cmLinkImplItem const& LinkImplItem; }; std::vector IncludeDirectoriesEntries; @@ -635,49 +633,37 @@ static bool processSources(cmTarget const* tgt, for (std::vector::const_iterator it = entries.begin(), end = entries.end(); it != end; ++it) { - bool cacheSources = false; - std::vector entrySources = (*it)->CachedEntries; - if(entrySources.empty()) + std::vector entrySources; + cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, + config, + false, + tgt, + tgt, + dagChecker), + entrySources); + + if ((*it)->ge->GetHadContextSensitiveCondition()) { - cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, - config, - false, - tgt, - tgt, - dagChecker), - entrySources); + contextDependent = true; + } - if ((*it)->ge->GetHadContextSensitiveCondition()) - { - contextDependent = true; - } - else if (mf->IsGeneratingBuildSystem()) - { - cacheSources = true; - } + for(std::vector::iterator i = entrySources.begin(); + i != entrySources.end(); ++i) + { + std::string& src = *i; - for(std::vector::iterator i = entrySources.begin(); - i != entrySources.end(); ++i) + cmSourceFile* sf = mf->GetOrCreateSource(src); + std::string e; + src = sf->GetFullPath(&e); + if(src.empty()) { - std::string& src = *i; - - cmSourceFile* sf = mf->GetOrCreateSource(src); - std::string e; - src = sf->GetFullPath(&e); - if(src.empty()) + if(!e.empty()) { - if(!e.empty()) - { - cmake* cm = mf->GetCMakeInstance(); - cm->IssueMessage(cmake::FATAL_ERROR, e, - tgt->GetBacktrace()); - } - return contextDependent; + cmake* cm = mf->GetCMakeInstance(); + cm->IssueMessage(cmake::FATAL_ERROR, e, + tgt->GetBacktrace()); } - } - if (cacheSources) - { - (*it)->CachedEntries = entrySources; + return contextDependent; } } std::string usedSources; @@ -2003,27 +1989,14 @@ static void processIncludeDirectories(cmTarget const* tgt, std::string const& targetName = item; bool const fromImported = item.Target && item.Target->IsImported(); bool const checkCMP0027 = item.FromGenex; - bool testIsOff = true; - bool cacheIncludes = false; - std::vector& entryIncludes = (*it)->CachedEntries; - if(!entryIncludes.empty()) - { - testIsOff = false; - } - else - { - cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, - config, - false, - tgt, - dagChecker), - entryIncludes); - if (mf->IsGeneratingBuildSystem() - && !(*it)->ge->GetHadContextSensitiveCondition()) - { - cacheIncludes = true; - } - } + std::vector entryIncludes; + cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, + config, + false, + tgt, + dagChecker), + entryIncludes); + std::string usedIncludes; for(std::vector::iterator li = entryIncludes.begin(); li != entryIncludes.end(); ++li) @@ -2105,7 +2078,7 @@ static void processIncludeDirectories(cmTarget const* tgt, } } - if (testIsOff && !cmSystemTools::IsOff(li->c_str())) + if (!cmSystemTools::IsOff(li->c_str())) { cmSystemTools::ConvertToUnixSlashes(*li); } @@ -2120,10 +2093,6 @@ static void processIncludeDirectories(cmTarget const* tgt, } } } - if (cacheIncludes) - { - (*it)->CachedEntries = entryIncludes; - } if (!usedIncludes.empty()) { mf->GetCMakeInstance()->IssueMessage(cmake::LOG, @@ -2229,33 +2198,16 @@ static void processCompileOptionsInternal(cmTarget const* tgt, for (std::vector::const_iterator it = entries.begin(), end = entries.end(); it != end; ++it) { - std::vector& entriesRef = (*it)->CachedEntries; - std::vector localEntries; - std::vector* entryOptions = &entriesRef; - if(!(*it)->Cached) - { - cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, - config, - false, - tgt, - dagChecker), - localEntries); - if (mf->IsGeneratingBuildSystem() - && !(*it)->ge->GetHadContextSensitiveCondition()) - { - // Cache the result. - *entryOptions = localEntries; - (*it)->Cached = true; - } - else - { - // Use the context-sensitive results here. - entryOptions = &localEntries; - } - } + std::vector entryOptions; + cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, + config, + false, + tgt, + dagChecker), + entryOptions); std::string usedOptions; for(std::vector::iterator - li = entryOptions->begin(); li != entryOptions->end(); ++li) + li = entryOptions.begin(); li != entryOptions.end(); ++li) { std::string const& opt = *li; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bbea91c7b37bbe41db19c8cadf554af0fd55e4e9 commit bbea91c7b37bbe41db19c8cadf554af0fd55e4e9 Author: Brad King AuthorDate: Fri Jul 18 13:57:57 2014 -0400 Commit: Brad King CommitDate: Fri Jul 18 15:07:07 2014 -0400 cmTarget: Drop internal cache of link interface usage requirements These use a huge amount of memory that accumulates as generation proceeds. On the Unix Makefiles generator, only GetIncludeDirectories and GetCompileDefinitions are even called more than once per target (once for build files, once for dependency scanning preprocessor info). Another approach will be needed to avoid duplicate computation in the cases where it does occur. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 07f08de..a812df7 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -213,23 +213,6 @@ public: void AddInterfaceEntries( cmTarget const* thisTarget, std::string const& config, std::string const& prop, std::vector& entries); - - std::map > - CachedLinkInterfaceIncludeDirectoriesEntries; - std::map > - CachedLinkInterfaceCompileOptionsEntries; - std::map > - CachedLinkInterfaceCompileDefinitionsEntries; - std::map > - CachedLinkInterfaceSourcesEntries; - std::map > - CachedLinkInterfaceCompileFeaturesEntries; - - std::map CacheLinkInterfaceIncludeDirectoriesDone; - std::map CacheLinkInterfaceCompileDefinitionsDone; - std::map CacheLinkInterfaceCompileOptionsDone; - std::map CacheLinkInterfaceSourcesDone; - std::map CacheLinkInterfaceCompileFeaturesDone; }; cmLinkImplItem cmTargetInternals::TargetPropertyEntry::NoLinkImplItem; @@ -249,26 +232,8 @@ static void deleteAndClear( } //---------------------------------------------------------------------------- -static void deleteAndClear( - std::map > &entries) -{ - for (std::map >::iterator - it = entries.begin(), end = entries.end(); it != end; ++it) - { - deleteAndClear(it->second); - } -} - -//---------------------------------------------------------------------------- cmTargetInternals::~cmTargetInternals() { - deleteAndClear(this->CachedLinkInterfaceIncludeDirectoriesEntries); - deleteAndClear(this->CachedLinkInterfaceCompileOptionsEntries); - deleteAndClear(this->CachedLinkInterfaceCompileFeaturesEntries); - deleteAndClear(this->CachedLinkInterfaceCompileDefinitionsEntries); - deleteAndClear(this->CachedLinkInterfaceSourcesEntries); } //---------------------------------------------------------------------------- @@ -810,16 +775,16 @@ void cmTarget::GetSourceFiles(std::vector &files, config, debugSources); - if (!this->Internal->CacheLinkInterfaceSourcesDone[config]) - { - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_SOURCES", - this->Internal->CachedLinkInterfaceSourcesEntries[config]); - } + std::vector + linkInterfaceSourcesEntries; - std::vector::size_type numFilesBefore = files.size(); - bool contextDependentInterfaceSources = processSources(this, - this->Internal->CachedLinkInterfaceSourcesEntries[config], + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_SOURCES", + linkInterfaceSourcesEntries); + + std::vector::size_type numFilesBefore = files.size(); + bool contextDependentInterfaceSources = processSources(this, + linkInterfaceSourcesEntries, files, uniqueSrcs, &dagChecker, @@ -832,14 +797,7 @@ void cmTarget::GetSourceFiles(std::vector &files, this->LinkImplementationLanguageIsContextDependent = false; } - if (!this->Makefile->IsGeneratingBuildSystem()) - { - deleteAndClear(this->Internal->CachedLinkInterfaceSourcesEntries); - } - else - { - this->Internal->CacheLinkInterfaceSourcesDone[config] = true; - } + deleteAndClear(linkInterfaceSourcesEntries); } //---------------------------------------------------------------------------- @@ -2213,58 +2171,47 @@ cmTarget::GetIncludeDirectories(const std::string& config) const config, debugIncludes); - if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[config]) - { - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_INCLUDE_DIRECTORIES", - this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[config]); + std::vector + linkInterfaceIncludeDirectoriesEntries; + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_INCLUDE_DIRECTORIES", + linkInterfaceIncludeDirectoriesEntries); - if(this->Makefile->IsOn("APPLE")) + if(this->Makefile->IsOn("APPLE")) + { + LinkImplementation const* impl = this->GetLinkImplementation(config); + for(std::vector::const_iterator + it = impl->Libraries.begin(); + it != impl->Libraries.end(); ++it) { - LinkImplementation const* impl = this->GetLinkImplementation(config); - for(std::vector::const_iterator - it = impl->Libraries.begin(); - it != impl->Libraries.end(); ++it) - { - std::string libDir = cmSystemTools::CollapseFullPath(it->c_str()); + std::string libDir = cmSystemTools::CollapseFullPath(it->c_str()); - static cmsys::RegularExpression - frameworkCheck("(.*\\.framework)(/Versions/[^/]+)?/[^/]+$"); - if(!frameworkCheck.find(libDir)) - { - continue; - } + static cmsys::RegularExpression + frameworkCheck("(.*\\.framework)(/Versions/[^/]+)?/[^/]+$"); + if(!frameworkCheck.find(libDir)) + { + continue; + } - libDir = frameworkCheck.match(1); + libDir = frameworkCheck.match(1); - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(libDir.c_str()); - this->Internal - ->CachedLinkInterfaceIncludeDirectoriesEntries[config] - .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); - } + cmGeneratorExpression ge; + cmsys::auto_ptr cge = + ge.Parse(libDir.c_str()); + linkInterfaceIncludeDirectoriesEntries + .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); } } processIncludeDirectories(this, - this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[config], + linkInterfaceIncludeDirectoriesEntries, includes, uniqueIncludes, &dagChecker, config, debugIncludes); - if (!this->Makefile->IsGeneratingBuildSystem()) - { - deleteAndClear( - this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries); - } - else - { - this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[config] - = true; - } + deleteAndClear(linkInterfaceIncludeDirectoriesEntries); return includes; } @@ -2405,29 +2352,22 @@ void cmTarget::GetCompileOptions(std::vector &result, config, debugOptions); - if (!this->Internal->CacheLinkInterfaceCompileOptionsDone[config]) - { - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_COMPILE_OPTIONS", - this->Internal->CachedLinkInterfaceCompileOptionsEntries[config]); - } + std::vector + linkInterfaceCompileOptionsEntries; + + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_COMPILE_OPTIONS", + linkInterfaceCompileOptionsEntries); processCompileOptions(this, - this->Internal->CachedLinkInterfaceCompileOptionsEntries[config], + linkInterfaceCompileOptionsEntries, result, uniqueOptions, &dagChecker, config, debugOptions); - if (!this->Makefile->IsGeneratingBuildSystem()) - { - deleteAndClear(this->Internal->CachedLinkInterfaceCompileOptionsEntries); - } - else - { - this->Internal->CacheLinkInterfaceCompileOptionsDone[config] = true; - } + deleteAndClear(linkInterfaceCompileOptionsEntries); } //---------------------------------------------------------------------------- @@ -2479,66 +2419,54 @@ void cmTarget::GetCompileDefinitions(std::vector &list, config, debugDefines); - if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config]) + std::vector + linkInterfaceCompileDefinitionsEntries; + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_COMPILE_DEFINITIONS", + linkInterfaceCompileDefinitionsEntries); + if (!config.empty()) { - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_COMPILE_DEFINITIONS", - this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[config]); - if (!config.empty()) + std::string configPropName = "COMPILE_DEFINITIONS_" + + cmSystemTools::UpperCase(config); + const char *configProp = this->GetProperty(configPropName); + if (configProp) { - std::string configPropName = "COMPILE_DEFINITIONS_" - + cmSystemTools::UpperCase(config); - const char *configProp = this->GetProperty(configPropName); - if (configProp) + switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0043)) { - switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0043)) + case cmPolicies::WARN: { - case cmPolicies::WARN: - { - cmOStringStream e; - e << this->Makefile->GetCMakeInstance()->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0043); - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, - e.str()); - } - case cmPolicies::OLD: - { - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(configProp); - this->Internal - ->CachedLinkInterfaceCompileDefinitionsEntries[config] - .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); - } - break; - case cmPolicies::NEW: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - break; + cmOStringStream e; + e << this->Makefile->GetCMakeInstance()->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0043); + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, + e.str()); } + case cmPolicies::OLD: + { + cmGeneratorExpression ge; + cmsys::auto_ptr cge = + ge.Parse(configProp); + linkInterfaceCompileDefinitionsEntries + .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); + } + break; + case cmPolicies::NEW: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + break; } } - } processCompileDefinitions(this, - this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[config], + linkInterfaceCompileDefinitionsEntries, list, uniqueOptions, &dagChecker, config, debugDefines); - if (!this->Makefile->IsGeneratingBuildSystem()) - { - deleteAndClear(this->Internal - ->CachedLinkInterfaceCompileDefinitionsEntries); - } - else - { - this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config] - = true; - } + deleteAndClear(linkInterfaceCompileDefinitionsEntries); } //---------------------------------------------------------------------------- @@ -2590,29 +2518,21 @@ void cmTarget::GetCompileFeatures(std::vector &result, config, debugFeatures); - if (!this->Internal->CacheLinkInterfaceCompileFeaturesDone[config]) - { - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_COMPILE_FEATURES", - this->Internal->CachedLinkInterfaceCompileFeaturesEntries[config]); - } + std::vector + linkInterfaceCompileFeaturesEntries; + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_COMPILE_FEATURES", + linkInterfaceCompileFeaturesEntries); processCompileFeatures(this, - this->Internal->CachedLinkInterfaceCompileFeaturesEntries[config], + linkInterfaceCompileFeaturesEntries, result, uniqueFeatures, &dagChecker, config, debugFeatures); - if (!this->Makefile->IsGeneratingBuildSystem()) - { - deleteAndClear(this->Internal->CachedLinkInterfaceCompileFeaturesEntries); - } - else - { - this->Internal->CacheLinkInterfaceCompileFeaturesDone[config] = true; - } + deleteAndClear(linkInterfaceCompileFeaturesEntries); } //---------------------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpression.cxx | 3 + Source/cmGeneratorExpression.h | 5 + Source/cmGeneratorExpressionEvaluator.cxx | 10 + Source/cmGeneratorExpressionEvaluator.h | 1 + Source/cmTarget.cxx | 380 ++++++++++------------------- 5 files changed, 145 insertions(+), 254 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 21 10:59:06 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 21 Jul 2014 10:59:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4398-g5032630 Message-ID: <20140721145906.5B99D45777@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 5032630277c8d8097404fe5cef6772d93793f06e (commit) via b154a32dcd10cbf1653c3ba3e803edf86ff5def7 (commit) from fe74f3b9dc321a3340b9e96646a193469d0be653 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5032630277c8d8097404fe5cef6772d93793f06e commit 5032630277c8d8097404fe5cef6772d93793f06e Merge: fe74f3b b154a32 Author: Brad King AuthorDate: Mon Jul 21 10:59:05 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 21 10:59:05 2014 -0400 Merge topic 'target-drop-build-setting-cache' into next b154a32d Revert topic 'target-drop-build-setting-cache' http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b154a32dcd10cbf1653c3ba3e803edf86ff5def7 commit b154a32dcd10cbf1653c3ba3e803edf86ff5def7 Author: Brad King AuthorDate: Mon Jul 21 11:00:09 2014 -0400 Commit: Brad King CommitDate: Mon Jul 21 11:00:09 2014 -0400 Revert topic 'target-drop-build-setting-cache' It contained changes not ready for testing. diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 7fc1464..2b4d955 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -97,7 +97,6 @@ const char *cmCompiledGeneratorExpression::Evaluate( context.Quiet = quiet; context.HadError = false; context.HadContextSensitiveCondition = false; - context.HadHeadSensitiveCondition = false; context.HeadTarget = headTarget; context.EvaluateForBuildsystem = this->EvaluateForBuildsystem; context.CurrentTarget = currentTarget ? currentTarget : headTarget; @@ -125,7 +124,6 @@ const char *cmCompiledGeneratorExpression::Evaluate( if (!context.HadError) { this->HadContextSensitiveCondition = context.HadContextSensitiveCondition; - this->HadHeadSensitiveCondition = context.HadHeadSensitiveCondition; } this->DependTargets = context.DependTargets; @@ -139,7 +137,6 @@ cmCompiledGeneratorExpression::cmCompiledGeneratorExpression( const std::string& input) : Backtrace(backtrace), Input(input), HadContextSensitiveCondition(false), - HadHeadSensitiveCondition(false), EvaluateForBuildsystem(false) { cmGeneratorExpressionLexer l; diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index b952520..324d23c 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -111,10 +111,6 @@ public: { return this->HadContextSensitiveCondition; } - bool GetHadHeadSensitiveCondition() const - { - return this->HadHeadSensitiveCondition; - } void SetEvaluateForBuildsystem(bool eval) { @@ -145,7 +141,6 @@ private: MaxLanguageStandard; mutable std::string Output; mutable bool HadContextSensitiveCondition; - mutable bool HadHeadSensitiveCondition; bool EvaluateForBuildsystem; }; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 3d03ece..28879f1 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -840,10 +840,6 @@ getLinkedTargetsContent( { context->HadContextSensitiveCondition = true; } - if (cge->GetHadHeadSensitiveCondition()) - { - context->HadHeadSensitiveCondition = true; - } } linkedTargetsContent = cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); @@ -875,10 +871,6 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode cmTarget const* target = context->HeadTarget; std::string propertyName = *parameters.begin(); - if (parameters.size() == 1) - { - context->HadHeadSensitiveCondition = true; - } if (!target && parameters.size() == 1) { reportError(context, content->GetOriginalExpression(), @@ -1321,7 +1313,6 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode "not be used with add_custom_command or add_custom_target."); return std::string(); } - context->HadHeadSensitiveCondition = true; typedef std::map > LangMap; static LangMap availableFeatures; @@ -1455,7 +1446,6 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode } context->HadContextSensitiveCondition = true; - context->HadHeadSensitiveCondition = true; for (size_t i = 1; i < cmArraySize(targetPolicyWhitelist); ++i) { diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 8a529e8..0ffb860 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -41,7 +41,6 @@ struct cmGeneratorExpressionContext bool Quiet; bool HadError; bool HadContextSensitiveCondition; - bool HadHeadSensitiveCondition; bool EvaluateForBuildsystem; }; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 9d00591..07f08de 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -196,9 +196,11 @@ public: public: TargetPropertyEntry(cmsys::auto_ptr cge, cmLinkImplItem const& item = NoLinkImplItem) - : ge(cge), LinkImplItem(item) + : ge(cge), Cached(false), LinkImplItem(item) {} const cmsys::auto_ptr ge; + std::vector CachedEntries; + bool Cached; cmLinkImplItem const& LinkImplItem; }; std::vector IncludeDirectoriesEntries; @@ -211,6 +213,23 @@ public: void AddInterfaceEntries( cmTarget const* thisTarget, std::string const& config, std::string const& prop, std::vector& entries); + + std::map > + CachedLinkInterfaceIncludeDirectoriesEntries; + std::map > + CachedLinkInterfaceCompileOptionsEntries; + std::map > + CachedLinkInterfaceCompileDefinitionsEntries; + std::map > + CachedLinkInterfaceSourcesEntries; + std::map > + CachedLinkInterfaceCompileFeaturesEntries; + + std::map CacheLinkInterfaceIncludeDirectoriesDone; + std::map CacheLinkInterfaceCompileDefinitionsDone; + std::map CacheLinkInterfaceCompileOptionsDone; + std::map CacheLinkInterfaceSourcesDone; + std::map CacheLinkInterfaceCompileFeaturesDone; }; cmLinkImplItem cmTargetInternals::TargetPropertyEntry::NoLinkImplItem; @@ -230,8 +249,26 @@ static void deleteAndClear( } //---------------------------------------------------------------------------- +static void deleteAndClear( + std::map > &entries) +{ + for (std::map >::iterator + it = entries.begin(), end = entries.end(); it != end; ++it) + { + deleteAndClear(it->second); + } +} + +//---------------------------------------------------------------------------- cmTargetInternals::~cmTargetInternals() { + deleteAndClear(this->CachedLinkInterfaceIncludeDirectoriesEntries); + deleteAndClear(this->CachedLinkInterfaceCompileOptionsEntries); + deleteAndClear(this->CachedLinkInterfaceCompileFeaturesEntries); + deleteAndClear(this->CachedLinkInterfaceCompileDefinitionsEntries); + deleteAndClear(this->CachedLinkInterfaceSourcesEntries); } //---------------------------------------------------------------------------- @@ -633,37 +670,49 @@ static bool processSources(cmTarget const* tgt, for (std::vector::const_iterator it = entries.begin(), end = entries.end(); it != end; ++it) { - std::vector entrySources; - cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, - config, - false, - tgt, - tgt, - dagChecker), - entrySources); - - if ((*it)->ge->GetHadContextSensitiveCondition()) + bool cacheSources = false; + std::vector entrySources = (*it)->CachedEntries; + if(entrySources.empty()) { - contextDependent = true; - } + cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, + config, + false, + tgt, + tgt, + dagChecker), + entrySources); - for(std::vector::iterator i = entrySources.begin(); - i != entrySources.end(); ++i) - { - std::string& src = *i; + if ((*it)->ge->GetHadContextSensitiveCondition()) + { + contextDependent = true; + } + else if (mf->IsGeneratingBuildSystem()) + { + cacheSources = true; + } - cmSourceFile* sf = mf->GetOrCreateSource(src); - std::string e; - src = sf->GetFullPath(&e); - if(src.empty()) + for(std::vector::iterator i = entrySources.begin(); + i != entrySources.end(); ++i) { - if(!e.empty()) + std::string& src = *i; + + cmSourceFile* sf = mf->GetOrCreateSource(src); + std::string e; + src = sf->GetFullPath(&e); + if(src.empty()) { - cmake* cm = mf->GetCMakeInstance(); - cm->IssueMessage(cmake::FATAL_ERROR, e, - tgt->GetBacktrace()); + if(!e.empty()) + { + cmake* cm = mf->GetCMakeInstance(); + cm->IssueMessage(cmake::FATAL_ERROR, e, + tgt->GetBacktrace()); + } + return contextDependent; } - return contextDependent; + } + if (cacheSources) + { + (*it)->CachedEntries = entrySources; } } std::string usedSources; @@ -761,16 +810,16 @@ void cmTarget::GetSourceFiles(std::vector &files, config, debugSources); - std::vector - linkInterfaceSourcesEntries; - - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_SOURCES", - linkInterfaceSourcesEntries); + if (!this->Internal->CacheLinkInterfaceSourcesDone[config]) + { + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_SOURCES", + this->Internal->CachedLinkInterfaceSourcesEntries[config]); + } - std::vector::size_type numFilesBefore = files.size(); - bool contextDependentInterfaceSources = processSources(this, - linkInterfaceSourcesEntries, + std::vector::size_type numFilesBefore = files.size(); + bool contextDependentInterfaceSources = processSources(this, + this->Internal->CachedLinkInterfaceSourcesEntries[config], files, uniqueSrcs, &dagChecker, @@ -783,7 +832,14 @@ void cmTarget::GetSourceFiles(std::vector &files, this->LinkImplementationLanguageIsContextDependent = false; } - deleteAndClear(linkInterfaceSourcesEntries); + if (!this->Makefile->IsGeneratingBuildSystem()) + { + deleteAndClear(this->Internal->CachedLinkInterfaceSourcesEntries); + } + else + { + this->Internal->CacheLinkInterfaceSourcesDone[config] = true; + } } //---------------------------------------------------------------------------- @@ -1989,14 +2045,27 @@ static void processIncludeDirectories(cmTarget const* tgt, std::string const& targetName = item; bool const fromImported = item.Target && item.Target->IsImported(); bool const checkCMP0027 = item.FromGenex; - std::vector entryIncludes; - cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, - config, - false, - tgt, - dagChecker), - entryIncludes); - + bool testIsOff = true; + bool cacheIncludes = false; + std::vector& entryIncludes = (*it)->CachedEntries; + if(!entryIncludes.empty()) + { + testIsOff = false; + } + else + { + cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, + config, + false, + tgt, + dagChecker), + entryIncludes); + if (mf->IsGeneratingBuildSystem() + && !(*it)->ge->GetHadContextSensitiveCondition()) + { + cacheIncludes = true; + } + } std::string usedIncludes; for(std::vector::iterator li = entryIncludes.begin(); li != entryIncludes.end(); ++li) @@ -2078,7 +2147,7 @@ static void processIncludeDirectories(cmTarget const* tgt, } } - if (!cmSystemTools::IsOff(li->c_str())) + if (testIsOff && !cmSystemTools::IsOff(li->c_str())) { cmSystemTools::ConvertToUnixSlashes(*li); } @@ -2093,6 +2162,10 @@ static void processIncludeDirectories(cmTarget const* tgt, } } } + if (cacheIncludes) + { + (*it)->CachedEntries = entryIncludes; + } if (!usedIncludes.empty()) { mf->GetCMakeInstance()->IssueMessage(cmake::LOG, @@ -2140,47 +2213,58 @@ cmTarget::GetIncludeDirectories(const std::string& config) const config, debugIncludes); - std::vector - linkInterfaceIncludeDirectoriesEntries; - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_INCLUDE_DIRECTORIES", - linkInterfaceIncludeDirectoriesEntries); - - if(this->Makefile->IsOn("APPLE")) + if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[config]) { - LinkImplementation const* impl = this->GetLinkImplementation(config); - for(std::vector::const_iterator - it = impl->Libraries.begin(); - it != impl->Libraries.end(); ++it) - { - std::string libDir = cmSystemTools::CollapseFullPath(it->c_str()); + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_INCLUDE_DIRECTORIES", + this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[config]); - static cmsys::RegularExpression - frameworkCheck("(.*\\.framework)(/Versions/[^/]+)?/[^/]+$"); - if(!frameworkCheck.find(libDir)) + if(this->Makefile->IsOn("APPLE")) + { + LinkImplementation const* impl = this->GetLinkImplementation(config); + for(std::vector::const_iterator + it = impl->Libraries.begin(); + it != impl->Libraries.end(); ++it) { - continue; - } + std::string libDir = cmSystemTools::CollapseFullPath(it->c_str()); + + static cmsys::RegularExpression + frameworkCheck("(.*\\.framework)(/Versions/[^/]+)?/[^/]+$"); + if(!frameworkCheck.find(libDir)) + { + continue; + } - libDir = frameworkCheck.match(1); + libDir = frameworkCheck.match(1); - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(libDir.c_str()); - linkInterfaceIncludeDirectoriesEntries - .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); + cmGeneratorExpression ge; + cmsys::auto_ptr cge = + ge.Parse(libDir.c_str()); + this->Internal + ->CachedLinkInterfaceIncludeDirectoriesEntries[config] + .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); + } } } processIncludeDirectories(this, - linkInterfaceIncludeDirectoriesEntries, + this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[config], includes, uniqueIncludes, &dagChecker, config, debugIncludes); - deleteAndClear(linkInterfaceIncludeDirectoriesEntries); + if (!this->Makefile->IsGeneratingBuildSystem()) + { + deleteAndClear( + this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries); + } + else + { + this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[config] + = true; + } return includes; } @@ -2198,16 +2282,33 @@ static void processCompileOptionsInternal(cmTarget const* tgt, for (std::vector::const_iterator it = entries.begin(), end = entries.end(); it != end; ++it) { - std::vector entryOptions; - cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, - config, - false, - tgt, - dagChecker), - entryOptions); + std::vector& entriesRef = (*it)->CachedEntries; + std::vector localEntries; + std::vector* entryOptions = &entriesRef; + if(!(*it)->Cached) + { + cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, + config, + false, + tgt, + dagChecker), + localEntries); + if (mf->IsGeneratingBuildSystem() + && !(*it)->ge->GetHadContextSensitiveCondition()) + { + // Cache the result. + *entryOptions = localEntries; + (*it)->Cached = true; + } + else + { + // Use the context-sensitive results here. + entryOptions = &localEntries; + } + } std::string usedOptions; for(std::vector::iterator - li = entryOptions.begin(); li != entryOptions.end(); ++li) + li = entryOptions->begin(); li != entryOptions->end(); ++li) { std::string const& opt = *li; @@ -2304,22 +2405,29 @@ void cmTarget::GetCompileOptions(std::vector &result, config, debugOptions); - std::vector - linkInterfaceCompileOptionsEntries; - - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_COMPILE_OPTIONS", - linkInterfaceCompileOptionsEntries); + if (!this->Internal->CacheLinkInterfaceCompileOptionsDone[config]) + { + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_COMPILE_OPTIONS", + this->Internal->CachedLinkInterfaceCompileOptionsEntries[config]); + } processCompileOptions(this, - linkInterfaceCompileOptionsEntries, + this->Internal->CachedLinkInterfaceCompileOptionsEntries[config], result, uniqueOptions, &dagChecker, config, debugOptions); - deleteAndClear(linkInterfaceCompileOptionsEntries); + if (!this->Makefile->IsGeneratingBuildSystem()) + { + deleteAndClear(this->Internal->CachedLinkInterfaceCompileOptionsEntries); + } + else + { + this->Internal->CacheLinkInterfaceCompileOptionsDone[config] = true; + } } //---------------------------------------------------------------------------- @@ -2371,54 +2479,66 @@ void cmTarget::GetCompileDefinitions(std::vector &list, config, debugDefines); - std::vector - linkInterfaceCompileDefinitionsEntries; - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_COMPILE_DEFINITIONS", - linkInterfaceCompileDefinitionsEntries); - if (!config.empty()) + if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config]) { - std::string configPropName = "COMPILE_DEFINITIONS_" - + cmSystemTools::UpperCase(config); - const char *configProp = this->GetProperty(configPropName); - if (configProp) + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_COMPILE_DEFINITIONS", + this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[config]); + if (!config.empty()) { - switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0043)) + std::string configPropName = "COMPILE_DEFINITIONS_" + + cmSystemTools::UpperCase(config); + const char *configProp = this->GetProperty(configPropName); + if (configProp) { - case cmPolicies::WARN: - { - cmOStringStream e; - e << this->Makefile->GetCMakeInstance()->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0043); - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, - e.str()); - } - case cmPolicies::OLD: + switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0043)) { - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(configProp); - linkInterfaceCompileDefinitionsEntries - .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); + case cmPolicies::WARN: + { + cmOStringStream e; + e << this->Makefile->GetCMakeInstance()->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0043); + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, + e.str()); + } + case cmPolicies::OLD: + { + cmGeneratorExpression ge; + cmsys::auto_ptr cge = + ge.Parse(configProp); + this->Internal + ->CachedLinkInterfaceCompileDefinitionsEntries[config] + .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); + } + break; + case cmPolicies::NEW: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + break; } - break; - case cmPolicies::NEW: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - break; } } + } processCompileDefinitions(this, - linkInterfaceCompileDefinitionsEntries, + this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[config], list, uniqueOptions, &dagChecker, config, debugDefines); - deleteAndClear(linkInterfaceCompileDefinitionsEntries); + if (!this->Makefile->IsGeneratingBuildSystem()) + { + deleteAndClear(this->Internal + ->CachedLinkInterfaceCompileDefinitionsEntries); + } + else + { + this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config] + = true; + } } //---------------------------------------------------------------------------- @@ -2470,21 +2590,29 @@ void cmTarget::GetCompileFeatures(std::vector &result, config, debugFeatures); - std::vector - linkInterfaceCompileFeaturesEntries; - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_COMPILE_FEATURES", - linkInterfaceCompileFeaturesEntries); + if (!this->Internal->CacheLinkInterfaceCompileFeaturesDone[config]) + { + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_COMPILE_FEATURES", + this->Internal->CachedLinkInterfaceCompileFeaturesEntries[config]); + } processCompileFeatures(this, - linkInterfaceCompileFeaturesEntries, + this->Internal->CachedLinkInterfaceCompileFeaturesEntries[config], result, uniqueFeatures, &dagChecker, config, debugFeatures); - deleteAndClear(linkInterfaceCompileFeaturesEntries); + if (!this->Makefile->IsGeneratingBuildSystem()) + { + deleteAndClear(this->Internal->CachedLinkInterfaceCompileFeaturesEntries); + } + else + { + this->Internal->CacheLinkInterfaceCompileFeaturesDone[config] = true; + } } //---------------------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpression.cxx | 3 - Source/cmGeneratorExpression.h | 5 - Source/cmGeneratorExpressionEvaluator.cxx | 10 - Source/cmGeneratorExpressionEvaluator.h | 1 - Source/cmTarget.cxx | 380 +++++++++++++++++++---------- 5 files changed, 254 insertions(+), 145 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 21 11:04:05 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 21 Jul 2014 11:04:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4401-g26f4d69 Message-ID: <20140721150405.64C0A45AC1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 26f4d69d567e6ae3b88821a4f25817c5876f6a1c (commit) via 133cd996d161cd349e67d90052ac4e20d9488620 (commit) via a4d58722a47b3712d1f78683371f88a3b6182a59 (commit) from 5032630277c8d8097404fe5cef6772d93793f06e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=26f4d69d567e6ae3b88821a4f25817c5876f6a1c commit 26f4d69d567e6ae3b88821a4f25817c5876f6a1c Merge: 5032630 133cd99 Author: Brad King AuthorDate: Mon Jul 21 11:04:04 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 21 11:04:04 2014 -0400 Merge topic 'target-drop-build-setting-cache' into next 133cd996 cmTarget: Drop internal cache of build properties a4d58722 cmTarget: Drop internal cache of link interface usage requirements http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=133cd996d161cd349e67d90052ac4e20d9488620 commit 133cd996d161cd349e67d90052ac4e20d9488620 Author: Brad King AuthorDate: Fri Jul 18 14:04:56 2014 -0400 Commit: Brad King CommitDate: Mon Jul 21 11:00:34 2014 -0400 cmTarget: Drop internal cache of build properties These use a huge amount of memory that accumulates as generation proceeds. On the Unix Makefiles generator, only GetIncludeDirectories and GetCompileDefinitions are even called more than once per target (once for build files, once for dependency scanning preprocessor info). Another approach will be needed to avoid duplicate computation in the cases where it does occur. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a812df7..9d00591 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -196,11 +196,9 @@ public: public: TargetPropertyEntry(cmsys::auto_ptr cge, cmLinkImplItem const& item = NoLinkImplItem) - : ge(cge), Cached(false), LinkImplItem(item) + : ge(cge), LinkImplItem(item) {} const cmsys::auto_ptr ge; - std::vector CachedEntries; - bool Cached; cmLinkImplItem const& LinkImplItem; }; std::vector IncludeDirectoriesEntries; @@ -635,49 +633,37 @@ static bool processSources(cmTarget const* tgt, for (std::vector::const_iterator it = entries.begin(), end = entries.end(); it != end; ++it) { - bool cacheSources = false; - std::vector entrySources = (*it)->CachedEntries; - if(entrySources.empty()) + std::vector entrySources; + cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, + config, + false, + tgt, + tgt, + dagChecker), + entrySources); + + if ((*it)->ge->GetHadContextSensitiveCondition()) { - cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, - config, - false, - tgt, - tgt, - dagChecker), - entrySources); + contextDependent = true; + } - if ((*it)->ge->GetHadContextSensitiveCondition()) - { - contextDependent = true; - } - else if (mf->IsGeneratingBuildSystem()) - { - cacheSources = true; - } + for(std::vector::iterator i = entrySources.begin(); + i != entrySources.end(); ++i) + { + std::string& src = *i; - for(std::vector::iterator i = entrySources.begin(); - i != entrySources.end(); ++i) + cmSourceFile* sf = mf->GetOrCreateSource(src); + std::string e; + src = sf->GetFullPath(&e); + if(src.empty()) { - std::string& src = *i; - - cmSourceFile* sf = mf->GetOrCreateSource(src); - std::string e; - src = sf->GetFullPath(&e); - if(src.empty()) + if(!e.empty()) { - if(!e.empty()) - { - cmake* cm = mf->GetCMakeInstance(); - cm->IssueMessage(cmake::FATAL_ERROR, e, - tgt->GetBacktrace()); - } - return contextDependent; + cmake* cm = mf->GetCMakeInstance(); + cm->IssueMessage(cmake::FATAL_ERROR, e, + tgt->GetBacktrace()); } - } - if (cacheSources) - { - (*it)->CachedEntries = entrySources; + return contextDependent; } } std::string usedSources; @@ -2003,27 +1989,14 @@ static void processIncludeDirectories(cmTarget const* tgt, std::string const& targetName = item; bool const fromImported = item.Target && item.Target->IsImported(); bool const checkCMP0027 = item.FromGenex; - bool testIsOff = true; - bool cacheIncludes = false; - std::vector& entryIncludes = (*it)->CachedEntries; - if(!entryIncludes.empty()) - { - testIsOff = false; - } - else - { - cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, - config, - false, - tgt, - dagChecker), - entryIncludes); - if (mf->IsGeneratingBuildSystem() - && !(*it)->ge->GetHadContextSensitiveCondition()) - { - cacheIncludes = true; - } - } + std::vector entryIncludes; + cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, + config, + false, + tgt, + dagChecker), + entryIncludes); + std::string usedIncludes; for(std::vector::iterator li = entryIncludes.begin(); li != entryIncludes.end(); ++li) @@ -2105,7 +2078,7 @@ static void processIncludeDirectories(cmTarget const* tgt, } } - if (testIsOff && !cmSystemTools::IsOff(li->c_str())) + if (!cmSystemTools::IsOff(li->c_str())) { cmSystemTools::ConvertToUnixSlashes(*li); } @@ -2120,10 +2093,6 @@ static void processIncludeDirectories(cmTarget const* tgt, } } } - if (cacheIncludes) - { - (*it)->CachedEntries = entryIncludes; - } if (!usedIncludes.empty()) { mf->GetCMakeInstance()->IssueMessage(cmake::LOG, @@ -2229,33 +2198,16 @@ static void processCompileOptionsInternal(cmTarget const* tgt, for (std::vector::const_iterator it = entries.begin(), end = entries.end(); it != end; ++it) { - std::vector& entriesRef = (*it)->CachedEntries; - std::vector localEntries; - std::vector* entryOptions = &entriesRef; - if(!(*it)->Cached) - { - cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, - config, - false, - tgt, - dagChecker), - localEntries); - if (mf->IsGeneratingBuildSystem() - && !(*it)->ge->GetHadContextSensitiveCondition()) - { - // Cache the result. - *entryOptions = localEntries; - (*it)->Cached = true; - } - else - { - // Use the context-sensitive results here. - entryOptions = &localEntries; - } - } + std::vector entryOptions; + cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, + config, + false, + tgt, + dagChecker), + entryOptions); std::string usedOptions; for(std::vector::iterator - li = entryOptions->begin(); li != entryOptions->end(); ++li) + li = entryOptions.begin(); li != entryOptions.end(); ++li) { std::string const& opt = *li; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a4d58722a47b3712d1f78683371f88a3b6182a59 commit a4d58722a47b3712d1f78683371f88a3b6182a59 Author: Brad King AuthorDate: Fri Jul 18 13:57:57 2014 -0400 Commit: Brad King CommitDate: Mon Jul 21 11:00:33 2014 -0400 cmTarget: Drop internal cache of link interface usage requirements These use a huge amount of memory that accumulates as generation proceeds. On the Unix Makefiles generator, only GetIncludeDirectories and GetCompileDefinitions are even called more than once per target (once for build files, once for dependency scanning preprocessor info). Another approach will be needed to avoid duplicate computation in the cases where it does occur. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 07f08de..a812df7 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -213,23 +213,6 @@ public: void AddInterfaceEntries( cmTarget const* thisTarget, std::string const& config, std::string const& prop, std::vector& entries); - - std::map > - CachedLinkInterfaceIncludeDirectoriesEntries; - std::map > - CachedLinkInterfaceCompileOptionsEntries; - std::map > - CachedLinkInterfaceCompileDefinitionsEntries; - std::map > - CachedLinkInterfaceSourcesEntries; - std::map > - CachedLinkInterfaceCompileFeaturesEntries; - - std::map CacheLinkInterfaceIncludeDirectoriesDone; - std::map CacheLinkInterfaceCompileDefinitionsDone; - std::map CacheLinkInterfaceCompileOptionsDone; - std::map CacheLinkInterfaceSourcesDone; - std::map CacheLinkInterfaceCompileFeaturesDone; }; cmLinkImplItem cmTargetInternals::TargetPropertyEntry::NoLinkImplItem; @@ -249,26 +232,8 @@ static void deleteAndClear( } //---------------------------------------------------------------------------- -static void deleteAndClear( - std::map > &entries) -{ - for (std::map >::iterator - it = entries.begin(), end = entries.end(); it != end; ++it) - { - deleteAndClear(it->second); - } -} - -//---------------------------------------------------------------------------- cmTargetInternals::~cmTargetInternals() { - deleteAndClear(this->CachedLinkInterfaceIncludeDirectoriesEntries); - deleteAndClear(this->CachedLinkInterfaceCompileOptionsEntries); - deleteAndClear(this->CachedLinkInterfaceCompileFeaturesEntries); - deleteAndClear(this->CachedLinkInterfaceCompileDefinitionsEntries); - deleteAndClear(this->CachedLinkInterfaceSourcesEntries); } //---------------------------------------------------------------------------- @@ -810,16 +775,16 @@ void cmTarget::GetSourceFiles(std::vector &files, config, debugSources); - if (!this->Internal->CacheLinkInterfaceSourcesDone[config]) - { - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_SOURCES", - this->Internal->CachedLinkInterfaceSourcesEntries[config]); - } + std::vector + linkInterfaceSourcesEntries; - std::vector::size_type numFilesBefore = files.size(); - bool contextDependentInterfaceSources = processSources(this, - this->Internal->CachedLinkInterfaceSourcesEntries[config], + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_SOURCES", + linkInterfaceSourcesEntries); + + std::vector::size_type numFilesBefore = files.size(); + bool contextDependentInterfaceSources = processSources(this, + linkInterfaceSourcesEntries, files, uniqueSrcs, &dagChecker, @@ -832,14 +797,7 @@ void cmTarget::GetSourceFiles(std::vector &files, this->LinkImplementationLanguageIsContextDependent = false; } - if (!this->Makefile->IsGeneratingBuildSystem()) - { - deleteAndClear(this->Internal->CachedLinkInterfaceSourcesEntries); - } - else - { - this->Internal->CacheLinkInterfaceSourcesDone[config] = true; - } + deleteAndClear(linkInterfaceSourcesEntries); } //---------------------------------------------------------------------------- @@ -2213,58 +2171,47 @@ cmTarget::GetIncludeDirectories(const std::string& config) const config, debugIncludes); - if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[config]) - { - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_INCLUDE_DIRECTORIES", - this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[config]); + std::vector + linkInterfaceIncludeDirectoriesEntries; + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_INCLUDE_DIRECTORIES", + linkInterfaceIncludeDirectoriesEntries); - if(this->Makefile->IsOn("APPLE")) + if(this->Makefile->IsOn("APPLE")) + { + LinkImplementation const* impl = this->GetLinkImplementation(config); + for(std::vector::const_iterator + it = impl->Libraries.begin(); + it != impl->Libraries.end(); ++it) { - LinkImplementation const* impl = this->GetLinkImplementation(config); - for(std::vector::const_iterator - it = impl->Libraries.begin(); - it != impl->Libraries.end(); ++it) - { - std::string libDir = cmSystemTools::CollapseFullPath(it->c_str()); + std::string libDir = cmSystemTools::CollapseFullPath(it->c_str()); - static cmsys::RegularExpression - frameworkCheck("(.*\\.framework)(/Versions/[^/]+)?/[^/]+$"); - if(!frameworkCheck.find(libDir)) - { - continue; - } + static cmsys::RegularExpression + frameworkCheck("(.*\\.framework)(/Versions/[^/]+)?/[^/]+$"); + if(!frameworkCheck.find(libDir)) + { + continue; + } - libDir = frameworkCheck.match(1); + libDir = frameworkCheck.match(1); - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(libDir.c_str()); - this->Internal - ->CachedLinkInterfaceIncludeDirectoriesEntries[config] - .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); - } + cmGeneratorExpression ge; + cmsys::auto_ptr cge = + ge.Parse(libDir.c_str()); + linkInterfaceIncludeDirectoriesEntries + .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); } } processIncludeDirectories(this, - this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[config], + linkInterfaceIncludeDirectoriesEntries, includes, uniqueIncludes, &dagChecker, config, debugIncludes); - if (!this->Makefile->IsGeneratingBuildSystem()) - { - deleteAndClear( - this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries); - } - else - { - this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[config] - = true; - } + deleteAndClear(linkInterfaceIncludeDirectoriesEntries); return includes; } @@ -2405,29 +2352,22 @@ void cmTarget::GetCompileOptions(std::vector &result, config, debugOptions); - if (!this->Internal->CacheLinkInterfaceCompileOptionsDone[config]) - { - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_COMPILE_OPTIONS", - this->Internal->CachedLinkInterfaceCompileOptionsEntries[config]); - } + std::vector + linkInterfaceCompileOptionsEntries; + + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_COMPILE_OPTIONS", + linkInterfaceCompileOptionsEntries); processCompileOptions(this, - this->Internal->CachedLinkInterfaceCompileOptionsEntries[config], + linkInterfaceCompileOptionsEntries, result, uniqueOptions, &dagChecker, config, debugOptions); - if (!this->Makefile->IsGeneratingBuildSystem()) - { - deleteAndClear(this->Internal->CachedLinkInterfaceCompileOptionsEntries); - } - else - { - this->Internal->CacheLinkInterfaceCompileOptionsDone[config] = true; - } + deleteAndClear(linkInterfaceCompileOptionsEntries); } //---------------------------------------------------------------------------- @@ -2479,66 +2419,54 @@ void cmTarget::GetCompileDefinitions(std::vector &list, config, debugDefines); - if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config]) + std::vector + linkInterfaceCompileDefinitionsEntries; + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_COMPILE_DEFINITIONS", + linkInterfaceCompileDefinitionsEntries); + if (!config.empty()) { - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_COMPILE_DEFINITIONS", - this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[config]); - if (!config.empty()) + std::string configPropName = "COMPILE_DEFINITIONS_" + + cmSystemTools::UpperCase(config); + const char *configProp = this->GetProperty(configPropName); + if (configProp) { - std::string configPropName = "COMPILE_DEFINITIONS_" - + cmSystemTools::UpperCase(config); - const char *configProp = this->GetProperty(configPropName); - if (configProp) + switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0043)) { - switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0043)) + case cmPolicies::WARN: { - case cmPolicies::WARN: - { - cmOStringStream e; - e << this->Makefile->GetCMakeInstance()->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0043); - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, - e.str()); - } - case cmPolicies::OLD: - { - cmGeneratorExpression ge; - cmsys::auto_ptr cge = - ge.Parse(configProp); - this->Internal - ->CachedLinkInterfaceCompileDefinitionsEntries[config] - .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); - } - break; - case cmPolicies::NEW: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - break; + cmOStringStream e; + e << this->Makefile->GetCMakeInstance()->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0043); + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, + e.str()); } + case cmPolicies::OLD: + { + cmGeneratorExpression ge; + cmsys::auto_ptr cge = + ge.Parse(configProp); + linkInterfaceCompileDefinitionsEntries + .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); + } + break; + case cmPolicies::NEW: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + break; } } - } processCompileDefinitions(this, - this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[config], + linkInterfaceCompileDefinitionsEntries, list, uniqueOptions, &dagChecker, config, debugDefines); - if (!this->Makefile->IsGeneratingBuildSystem()) - { - deleteAndClear(this->Internal - ->CachedLinkInterfaceCompileDefinitionsEntries); - } - else - { - this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config] - = true; - } + deleteAndClear(linkInterfaceCompileDefinitionsEntries); } //---------------------------------------------------------------------------- @@ -2590,29 +2518,21 @@ void cmTarget::GetCompileFeatures(std::vector &result, config, debugFeatures); - if (!this->Internal->CacheLinkInterfaceCompileFeaturesDone[config]) - { - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_COMPILE_FEATURES", - this->Internal->CachedLinkInterfaceCompileFeaturesEntries[config]); - } + std::vector + linkInterfaceCompileFeaturesEntries; + this->Internal->AddInterfaceEntries( + this, config, "INTERFACE_COMPILE_FEATURES", + linkInterfaceCompileFeaturesEntries); processCompileFeatures(this, - this->Internal->CachedLinkInterfaceCompileFeaturesEntries[config], + linkInterfaceCompileFeaturesEntries, result, uniqueFeatures, &dagChecker, config, debugFeatures); - if (!this->Makefile->IsGeneratingBuildSystem()) - { - deleteAndClear(this->Internal->CachedLinkInterfaceCompileFeaturesEntries); - } - else - { - this->Internal->CacheLinkInterfaceCompileFeaturesDone[config] = true; - } + deleteAndClear(linkInterfaceCompileFeaturesEntries); } //---------------------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/cmTarget.cxx | 380 +++++++++++++++++---------------------------------- 1 file changed, 126 insertions(+), 254 deletions(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Mon Jul 21 11:55:30 2014 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Mon, 21 Jul 2014 11:55:30 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4404-gc7be55d Message-ID: <20140721155530.CD63145860@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via c7be55d48bcf49ef83945b9fd530923ca648edc4 (commit) via 846e56db5734f30f77bb078f13eec25917b5e693 (commit) via a4540a64155f08ccbd919c8106c5674d048dcd0e (commit) from 26f4d69d567e6ae3b88821a4f25817c5876f6a1c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c7be55d48bcf49ef83945b9fd530923ca648edc4 commit c7be55d48bcf49ef83945b9fd530923ca648edc4 Merge: 26f4d69 846e56d Author: Nils Gladitz AuthorDate: Mon Jul 21 11:55:30 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 21 11:55:30 2014 -0400 Merge topic 'deprecated-properties' into next 846e56db Help: List POST/PRE_INSTALL_SCRIPT properties as deprecated. a4540a64 Help: Document COMPILE_DEFINITIONS_ properties as deprecated. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=846e56db5734f30f77bb078f13eec25917b5e693 commit 846e56db5734f30f77bb078f13eec25917b5e693 Author: Nils Gladitz AuthorDate: Mon Jul 21 17:53:56 2014 +0200 Commit: Nils Gladitz CommitDate: Mon Jul 21 17:53:56 2014 +0200 Help: List POST/PRE_INSTALL_SCRIPT properties as deprecated. diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 2075d73..f6a650e 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -207,9 +207,7 @@ Properties on Targets /prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG /prop_tgt/PDB_OUTPUT_DIRECTORY /prop_tgt/POSITION_INDEPENDENT_CODE - /prop_tgt/POST_INSTALL_SCRIPT /prop_tgt/PREFIX - /prop_tgt/PRE_INSTALL_SCRIPT /prop_tgt/PRIVATE_HEADER /prop_tgt/PROJECT_LABEL /prop_tgt/PUBLIC_HEADER @@ -342,6 +340,8 @@ Properties on Targets :maxdepth: 1 /prop_tgt/COMPILE_DEFINITIONS_CONFIG + /prop_tgt/POST_INSTALL_SCRIPT + /prop_tgt/PRE_INSTALL_SCRIPT Properties on Source Files http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a4540a64155f08ccbd919c8106c5674d048dcd0e commit a4540a64155f08ccbd919c8106c5674d048dcd0e Author: Nils Gladitz AuthorDate: Mon Jul 21 17:44:46 2014 +0200 Commit: Nils Gladitz CommitDate: Mon Jul 21 17:44:46 2014 +0200 Help: Document COMPILE_DEFINITIONS_ properties as deprecated. diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index e4546c1..2075d73 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -7,8 +7,12 @@ cmake-properties(7) .. contents:: +Normal Properties +================= +These properties may be used freely in CMake projects. + Properties of Global Scope -========================== +^^^^^^^^^^^^^^^^^^^^^^^^^^ .. toctree:: :maxdepth: 1 @@ -42,7 +46,7 @@ Properties of Global Scope /prop_gbl/USE_FOLDERS Properties on Directories -========================= +^^^^^^^^^^^^^^^^^^^^^^^^^ .. toctree:: :maxdepth: 1 @@ -51,7 +55,6 @@ Properties on Directories /prop_dir/CACHE_VARIABLES /prop_dir/CLEAN_NO_CUSTOM /prop_dir/CMAKE_CONFIGURE_DEPENDS - /prop_dir/COMPILE_DEFINITIONS_CONFIG /prop_dir/COMPILE_DEFINITIONS /prop_dir/COMPILE_OPTIONS /prop_dir/DEFINITIONS @@ -74,7 +77,7 @@ Properties on Directories /prop_dir/VS_GLOBAL_SECTION_PRE_section Properties on Targets -===================== +^^^^^^^^^^^^^^^^^^^^^ .. toctree:: :maxdepth: 1 @@ -101,7 +104,6 @@ Properties on Targets /prop_tgt/COMPATIBLE_INTERFACE_NUMBER_MAX /prop_tgt/COMPATIBLE_INTERFACE_NUMBER_MIN /prop_tgt/COMPATIBLE_INTERFACE_STRING - /prop_tgt/COMPILE_DEFINITIONS_CONFIG /prop_tgt/COMPILE_DEFINITIONS /prop_tgt/COMPILE_FEATURES /prop_tgt/COMPILE_FLAGS @@ -245,7 +247,7 @@ Properties on Targets /prop_tgt/XCODE_ATTRIBUTE_an-attribute Properties on Tests -=================== +^^^^^^^^^^^^^^^^^^^ .. toctree:: :maxdepth: 1 @@ -269,7 +271,7 @@ Properties on Tests /prop_test/WORKING_DIRECTORY Properties on Source Files -========================== +^^^^^^^^^^^^^^^^^^^^^^^^^^ .. toctree:: :maxdepth: 1 @@ -277,7 +279,6 @@ Properties on Source Files /prop_sf/ABSTRACT /prop_sf/AUTOUIC_OPTIONS /prop_sf/AUTORCC_OPTIONS - /prop_sf/COMPILE_DEFINITIONS_CONFIG /prop_sf/COMPILE_DEFINITIONS /prop_sf/COMPILE_FLAGS /prop_sf/EXTERNAL_OBJECT @@ -297,7 +298,7 @@ Properties on Source Files /prop_sf/XCODE_LAST_KNOWN_FILE_TYPE Properties on Cache Entries -=========================== +^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. toctree:: :maxdepth: 1 @@ -310,10 +311,43 @@ Properties on Cache Entries /prop_cache/VALUE Properties on Installed Files -============================= +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. toctree:: :maxdepth: 1 /prop_inst/CPACK_NEVER_OVERWRITE.rst /prop_inst/CPACK_PERMANENT.rst + + +Deprecated Properties +===================== + +These properties are available only for compatibility with older +versions of CMake. Do not use them in new code. + +Properties on Directories +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. toctree:: + :maxdepth: 1 + + /prop_dir/COMPILE_DEFINITIONS_CONFIG + + +Properties on Targets +^^^^^^^^^^^^^^^^^^^^^ + +.. toctree:: + :maxdepth: 1 + + /prop_tgt/COMPILE_DEFINITIONS_CONFIG + + +Properties on Source Files +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. toctree:: + :maxdepth: 1 + + /prop_sf/COMPILE_DEFINITIONS_CONFIG diff --git a/Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst b/Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst index c22606b..af18d7b 100644 --- a/Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst +++ b/Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst @@ -1,6 +1,8 @@ COMPILE_DEFINITIONS_ ---------------------------- +Ignored. See CMake Policy :policy:`CMP0043`. + Per-configuration preprocessor definitions in a directory. This is the configuration-specific version of :prop_dir:`COMPILE_DEFINITIONS` diff --git a/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst b/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst index e695f38..4920f58 100644 --- a/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst +++ b/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst @@ -1,6 +1,8 @@ COMPILE_DEFINITIONS_ ---------------------------- +Ignored. See CMake Policy :policy:`CMP0043`. + Per-configuration preprocessor definitions on a source file. This is the configuration-specific version of COMPILE_DEFINITIONS. diff --git a/Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst b/Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst index e359d2c..1dba356 100644 --- a/Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst +++ b/Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst @@ -1,6 +1,8 @@ COMPILE_DEFINITIONS_ ---------------------------- +Ignored. See CMake Policy :policy:`CMP0043`. + Per-configuration preprocessor definitions on a target. This is the configuration-specific version of :prop_tgt:`COMPILE_DEFINITIONS` ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-properties.7.rst | 58 ++++++++++++++++++++------ Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst | 2 + Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst | 2 + Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst | 2 + 4 files changed, 52 insertions(+), 12 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 21 13:05:34 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 21 Jul 2014 13:05:34 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4411-g143931d Message-ID: <20140721170534.2E0BA45E01@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 143931d04181a6b192da26c3e3996d9cba0eb04d (commit) via 7b743a2e761783f930de41db3f7a706b065bbb2e (commit) via 807e4ffeefb0e10ef0546e0eb7383f3d5533809b (commit) via 46099b82ed71394f1dc6e0bbb91704d274edab7d (commit) via 438d9c7c822f42c4fccd77a47b1a32f52a87e617 (commit) via fe665fdda8986b3af061ec91a7ab5fbe8f606e4f (commit) via 9d13e1679f2b52e88748a710edd201ed9fba7447 (commit) from c7be55d48bcf49ef83945b9fd530923ca648edc4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=143931d04181a6b192da26c3e3996d9cba0eb04d commit 143931d04181a6b192da26c3e3996d9cba0eb04d Merge: c7be55d 7b743a2 Author: Brad King AuthorDate: Mon Jul 21 13:05:32 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 21 13:05:32 2014 -0400 Merge topic 'genex-head-sensitive-conditions' into next 7b743a2e cmTarget: Avoid re-computing head-independent link interfaces 807e4ffe Genex: Track whether an expression depends on the 'head' target 46099b82 cmTarget: Move ComputeLinkImplementation* to internals 438d9c7c cmTarget: Re-order link interface map lookup logic fe665fdd cmTarget: Refactor link interface map storage 9d13e167 cmTarget: Remove duplicate link interface map http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7b743a2e761783f930de41db3f7a706b065bbb2e commit 7b743a2e761783f930de41db3f7a706b065bbb2e Author: Brad King AuthorDate: Mon Jul 21 13:04:04 2014 -0400 Commit: Brad King CommitDate: Mon Jul 21 13:04:04 2014 -0400 cmTarget: Avoid re-computing head-independent link interfaces diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 353a3a6..ca24d2d 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -114,10 +114,12 @@ public: { OptionalLinkInterface(): LibrariesDone(false), AllDone(false), - Exists(false), ExplicitLibraries(0) {} + Exists(false), HadHeadSensitiveCondition(false), + ExplicitLibraries(0) {} bool LibrariesDone; bool AllDone; bool Exists; + bool HadHeadSensitiveCondition; const char* ExplicitLibraries; }; void ComputeLinkInterface(cmTarget const* thisTarget, @@ -151,9 +153,11 @@ public: struct OptionalLinkImplementation: public cmTarget::LinkImplementation { OptionalLinkImplementation(): - LibrariesDone(false), LanguagesDone(false) {} + LibrariesDone(false), LanguagesDone(false), + HadHeadSensitiveCondition(false) {} bool LibrariesDone; bool LanguagesDone; + bool HadHeadSensitiveCondition; }; void ComputeLinkImplementationLibraries(cmTarget const* thisTarget, const std::string& config, @@ -3435,7 +3439,8 @@ void cmTarget::ExpandLinkItems(std::string const& prop, std::string const& config, cmTarget const* headTarget, bool usage_requirements_only, - std::vector& items) const + std::vector& items, + bool& hadHeadSensitiveCondition) const { cmGeneratorExpression ge; cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0); @@ -3446,13 +3451,15 @@ void cmTarget::ExpandLinkItems(std::string const& prop, dagChecker.SetTransitivePropertiesOnly(); } std::vector libs; - cmSystemTools::ExpandListArgument(ge.Parse(value)->Evaluate( + cmsys::auto_ptr cge = ge.Parse(value); + cmSystemTools::ExpandListArgument(cge->Evaluate( this->Makefile, config, false, headTarget, this, &dagChecker), libs); this->LookupLinkItems(libs, items); + hadHeadSensitiveCondition = cge->GetHadHeadSensitiveCondition(); } //---------------------------------------------------------------------------- @@ -5757,6 +5764,14 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface( std::string CONFIG = cmSystemTools::UpperCase(config); cmTargetInternals::HeadToLinkInterfaceMap& hm = this->Internal->LinkInterfaceMap[CONFIG]; + + // If the link interface does not depend on the head target + // then return the one we computed first. + if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition) + { + return &hm.begin()->second; + } + cmTargetInternals::OptionalLinkInterface& iface = hm[head]; if(!iface.LibrariesDone) { @@ -5802,6 +5817,14 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config, (usage_requirements_only ? this->Internal->LinkInterfaceUsageRequirementsOnlyMap[CONFIG] : this->Internal->LinkInterfaceMap[CONFIG]); + + // If the link interface does not depend on the head target + // then return the one we computed first. + if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition) + { + return &hm.begin()->second; + } + cmTargetInternals::OptionalLinkInterface& iface = hm[head]; if(!iface.LibrariesDone) { @@ -5830,6 +5853,14 @@ cmTarget::GetImportLinkInterface(const std::string& config, (usage_requirements_only ? this->Internal->LinkInterfaceUsageRequirementsOnlyMap[CONFIG] : this->Internal->LinkInterfaceMap[CONFIG]); + + // If the link interface does not depend on the head target + // then return the one we computed first. + if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition) + { + return &hm.begin()->second; + } + cmTargetInternals::OptionalLinkInterface& iface = hm[headTarget]; if(!iface.AllDone) { @@ -5838,7 +5869,8 @@ cmTarget::GetImportLinkInterface(const std::string& config, cmSystemTools::ExpandListArgument(info->Languages, iface.Languages); this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config, headTarget, usage_requirements_only, - iface.Libraries); + iface.Libraries, + iface.HadHeadSensitiveCondition); std::vector deps; cmSystemTools::ExpandListArgument(info->SharedDeps, deps); this->LookupLinkItems(deps, iface.SharedDeps); @@ -6022,7 +6054,8 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( // The interface libraries have been explicitly set. thisTarget->ExpandLinkItems(linkIfaceProp, explicitLibraries, config, headTarget, usage_requirements_only, - iface.Libraries); + iface.Libraries, + iface.HadHeadSensitiveCondition); } else if (thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN || thisTarget->PolicyStatusCMP0022 == cmPolicies::OLD) @@ -6045,9 +6078,10 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( static const std::string newProp = "INTERFACE_LINK_LIBRARIES"; if(const char* newExplicitLibraries = thisTarget->GetProperty(newProp)) { + bool hadHeadSensitiveConditionDummy = false; thisTarget->ExpandLinkItems(newProp, newExplicitLibraries, config, headTarget, usage_requirements_only, - ifaceLibs); + ifaceLibs, hadHeadSensitiveConditionDummy); } if (ifaceLibs != iface.Libraries) { @@ -6271,6 +6305,14 @@ cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config, std::string CONFIG = cmSystemTools::UpperCase(config); cmTargetInternals::HeadToLinkImplementationMap& hm = this->Internal->LinkImplMap[CONFIG]; + + // If the link implementation does not depend on the head target + // then return the one we computed first. + if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition) + { + return &hm.begin()->second; + } + cmTargetInternals::OptionalLinkImplementation& impl = hm[head]; if(!impl.LibrariesDone) { @@ -6305,6 +6347,10 @@ cmTargetInternals::ComputeLinkImplementationLibraries( std::string const evaluated = cge->Evaluate(thisTarget->Makefile, config, false, head, &dagChecker); cmSystemTools::ExpandListArgument(evaluated, llibs); + if(cge->GetHadHeadSensitiveCondition()) + { + impl.HadHeadSensitiveCondition = true; + } for(std::vector::const_iterator li = llibs.begin(); li != llibs.end(); ++li) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index f8bed4f..333e2ae 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -802,7 +802,8 @@ private: void ExpandLinkItems(std::string const& prop, std::string const& value, std::string const& config, cmTarget const* headTarget, bool usage_requirements_only, - std::vector& items) const; + std::vector& items, + bool& hadHeadSensitiveCondition) const; void LookupLinkItems(std::vector const& names, std::vector& items) const; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=807e4ffeefb0e10ef0546e0eb7383f3d5533809b commit 807e4ffeefb0e10ef0546e0eb7383f3d5533809b Author: Brad King AuthorDate: Mon Jul 21 13:02:22 2014 -0400 Commit: Brad King CommitDate: Mon Jul 21 13:02:22 2014 -0400 Genex: Track whether an expression depends on the 'head' target diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 2b4d955..7fc1464 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -97,6 +97,7 @@ const char *cmCompiledGeneratorExpression::Evaluate( context.Quiet = quiet; context.HadError = false; context.HadContextSensitiveCondition = false; + context.HadHeadSensitiveCondition = false; context.HeadTarget = headTarget; context.EvaluateForBuildsystem = this->EvaluateForBuildsystem; context.CurrentTarget = currentTarget ? currentTarget : headTarget; @@ -124,6 +125,7 @@ const char *cmCompiledGeneratorExpression::Evaluate( if (!context.HadError) { this->HadContextSensitiveCondition = context.HadContextSensitiveCondition; + this->HadHeadSensitiveCondition = context.HadHeadSensitiveCondition; } this->DependTargets = context.DependTargets; @@ -137,6 +139,7 @@ cmCompiledGeneratorExpression::cmCompiledGeneratorExpression( const std::string& input) : Backtrace(backtrace), Input(input), HadContextSensitiveCondition(false), + HadHeadSensitiveCondition(false), EvaluateForBuildsystem(false) { cmGeneratorExpressionLexer l; diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 324d23c..b952520 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -111,6 +111,10 @@ public: { return this->HadContextSensitiveCondition; } + bool GetHadHeadSensitiveCondition() const + { + return this->HadHeadSensitiveCondition; + } void SetEvaluateForBuildsystem(bool eval) { @@ -141,6 +145,7 @@ private: MaxLanguageStandard; mutable std::string Output; mutable bool HadContextSensitiveCondition; + mutable bool HadHeadSensitiveCondition; bool EvaluateForBuildsystem; }; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 28879f1..7a53d65 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -840,6 +840,10 @@ getLinkedTargetsContent( { context->HadContextSensitiveCondition = true; } + if (cge->GetHadHeadSensitiveCondition()) + { + context->HadHeadSensitiveCondition = true; + } } linkedTargetsContent = cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); @@ -871,6 +875,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode cmTarget const* target = context->HeadTarget; std::string propertyName = *parameters.begin(); + if (parameters.size() == 1) + { + context->HadHeadSensitiveCondition = true; + } if (!target && parameters.size() == 1) { reportError(context, content->GetOriginalExpression(), @@ -1190,6 +1198,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode { context->HadContextSensitiveCondition = true; } + if (cge->GetHadHeadSensitiveCondition()) + { + context->HadHeadSensitiveCondition = true; + } if (!linkedTargetsContent.empty()) { result += (result.empty() ? "" : ";") + linkedTargetsContent; @@ -1313,6 +1325,7 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode "not be used with add_custom_command or add_custom_target."); return std::string(); } + context->HadHeadSensitiveCondition = true; typedef std::map > LangMap; static LangMap availableFeatures; @@ -1446,6 +1459,7 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode } context->HadContextSensitiveCondition = true; + context->HadHeadSensitiveCondition = true; for (size_t i = 1; i < cmArraySize(targetPolicyWhitelist); ++i) { diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 0ffb860..8a529e8 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -41,6 +41,7 @@ struct cmGeneratorExpressionContext bool Quiet; bool HadError; bool HadContextSensitiveCondition; + bool HadHeadSensitiveCondition; bool EvaluateForBuildsystem; }; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=46099b82ed71394f1dc6e0bbb91704d274edab7d commit 46099b82ed71394f1dc6e0bbb91704d274edab7d Author: Brad King AuthorDate: Mon Jul 21 11:55:56 2014 -0400 Commit: Brad King CommitDate: Mon Jul 21 11:55:56 2014 -0400 cmTarget: Move ComputeLinkImplementation* to internals There are no external callers, and this will allow the methods to see the full OptionalLinkImplementation internal structure. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index df65a68..353a3a6 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -155,6 +155,15 @@ public: bool LibrariesDone; bool LanguagesDone; }; + void ComputeLinkImplementationLibraries(cmTarget const* thisTarget, + const std::string& config, + OptionalLinkImplementation& impl, + cmTarget const* head) const; + void ComputeLinkImplementationLanguages(cmTarget const* thisTarget, + const std::string& config, + OptionalLinkImplementation& impl + ) const; + struct HeadToLinkImplementationMap: public std::map {}; typedef std::mapComputeLinkImplementationLibraries(config, impl, this); + this->Internal + ->ComputeLinkImplementationLibraries(this, config, impl, this); } if(!impl.LanguagesDone) { impl.LanguagesDone = true; - this->ComputeLinkImplementationLanguages(config, impl); + this->Internal->ComputeLinkImplementationLanguages(this, config, impl); } return &impl; } @@ -6265,51 +6275,54 @@ cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config, if(!impl.LibrariesDone) { impl.LibrariesDone = true; - this->ComputeLinkImplementationLibraries(config, impl, head); + this->Internal + ->ComputeLinkImplementationLibraries(this, config, impl, head); } return &impl; } //---------------------------------------------------------------------------- void -cmTarget::ComputeLinkImplementationLibraries(const std::string& config, - LinkImplementation& impl, - cmTarget const* head) const +cmTargetInternals::ComputeLinkImplementationLibraries( + cmTarget const* thisTarget, + const std::string& config, + OptionalLinkImplementation& impl, + cmTarget const* head) const { // Collect libraries directly linked in this configuration. for (std::vector::const_iterator - le = this->Internal->LinkImplementationPropertyEntries.begin(), - end = this->Internal->LinkImplementationPropertyEntries.end(); + le = this->LinkImplementationPropertyEntries.begin(), + end = this->LinkImplementationPropertyEntries.end(); le != end; ++le) { std::vector llibs; cmGeneratorExpressionDAGChecker dagChecker( - this->GetName(), + thisTarget->GetName(), "LINK_LIBRARIES", 0, 0); cmGeneratorExpression ge(&le->Backtrace); cmsys::auto_ptr const cge = ge.Parse(le->Value); std::string const evaluated = - cge->Evaluate(this->Makefile, config, false, head, &dagChecker); + cge->Evaluate(thisTarget->Makefile, config, false, head, &dagChecker); cmSystemTools::ExpandListArgument(evaluated, llibs); for(std::vector::const_iterator li = llibs.begin(); li != llibs.end(); ++li) { // Skip entries that resolve to the target itself or are empty. - std::string name = this->CheckCMP0004(*li); - if(name == this->GetName() || name.empty()) + std::string name = thisTarget->CheckCMP0004(*li); + if(name == thisTarget->GetName() || name.empty()) { - if(name == this->GetName()) + if(name == thisTarget->GetName()) { bool noMessage = false; cmake::MessageType messageType = cmake::FATAL_ERROR; cmOStringStream e; - switch(this->GetPolicyStatusCMP0038()) + switch(thisTarget->GetPolicyStatusCMP0038()) { case cmPolicies::WARN: { - e << (this->Makefile->GetPolicies() + e << (thisTarget->Makefile->GetPolicies() ->GetPolicyWarning(cmPolicies::CMP0038)) << "\n"; messageType = cmake::AUTHOR_WARNING; } @@ -6325,9 +6338,9 @@ cmTarget::ComputeLinkImplementationLibraries(const std::string& config, if(!noMessage) { - e << "Target \"" << this->GetName() << "\" links to itself."; - this->Makefile->GetCMakeInstance()->IssueMessage( - messageType, e.str(), this->GetBacktrace()); + e << "Target \"" << thisTarget->GetName() << "\" links to itself."; + thisTarget->Makefile->GetCMakeInstance()->IssueMessage( + messageType, e.str(), thisTarget->GetBacktrace()); if (messageType == cmake::FATAL_ERROR) { return; @@ -6339,7 +6352,7 @@ cmTarget::ComputeLinkImplementationLibraries(const std::string& config, // The entry is meant for this configuration. impl.Libraries.push_back( - cmLinkImplItem(name, this->FindTargetToLink(name), + cmLinkImplItem(name, thisTarget->FindTargetToLink(name), le->Backtrace, evaluated != le->Value)); } @@ -6347,42 +6360,45 @@ cmTarget::ComputeLinkImplementationLibraries(const std::string& config, for (std::set::const_iterator it = seenProps.begin(); it != seenProps.end(); ++it) { - if (!this->GetProperty(*it)) + if (!thisTarget->GetProperty(*it)) { - this->LinkImplicitNullProperties.insert(*it); + thisTarget->LinkImplicitNullProperties.insert(*it); } } - cge->GetMaxLanguageStandard(this, this->MaxLanguageStandards); + cge->GetMaxLanguageStandard(thisTarget, thisTarget->MaxLanguageStandards); } - cmTarget::LinkLibraryType linkType = this->ComputeLinkType(config); - LinkLibraryVectorType const& oldllibs = this->GetOriginalLinkLibraries(); + cmTarget::LinkLibraryType linkType = thisTarget->ComputeLinkType(config); + cmTarget::LinkLibraryVectorType const& oldllibs = + thisTarget->GetOriginalLinkLibraries(); for(cmTarget::LinkLibraryVectorType::const_iterator li = oldllibs.begin(); li != oldllibs.end(); ++li) { if(li->second != cmTarget::GENERAL && li->second != linkType) { - std::string name = this->CheckCMP0004(li->first); - if(name == this->GetName() || name.empty()) + std::string name = thisTarget->CheckCMP0004(li->first); + if(name == thisTarget->GetName() || name.empty()) { continue; } // Support OLD behavior for CMP0003. impl.WrongConfigLibraries.push_back( - cmLinkItem(name, this->FindTargetToLink(name))); + cmLinkItem(name, thisTarget->FindTargetToLink(name))); } } } //---------------------------------------------------------------------------- void -cmTarget::ComputeLinkImplementationLanguages(const std::string& config, - LinkImplementation& impl) const +cmTargetInternals::ComputeLinkImplementationLanguages( + cmTarget const* thisTarget, + const std::string& config, + OptionalLinkImplementation& impl) const { // This target needs runtime libraries for its source languages. std::set languages; // Get languages used in our source files. - this->GetLanguages(languages, config); + thisTarget->GetLanguages(languages, config); // Copy the set of langauges to the link implementation. for(std::set::iterator li = languages.begin(); li != languages.end(); ++li) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index b4c8a0f..f8bed4f 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -797,11 +797,6 @@ private: LinkImplementationLibraries const* GetLinkImplementationLibrariesInternal(const std::string& config, cmTarget const* head) const; - void ComputeLinkImplementationLibraries(const std::string& config, - LinkImplementation& impl, - cmTarget const* head) const; - void ComputeLinkImplementationLanguages(const std::string& config, - LinkImplementation& impl) const; void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const; void ExpandLinkItems(std::string const& prop, std::string const& value, http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=438d9c7c822f42c4fccd77a47b1a32f52a87e617 commit 438d9c7c822f42c4fccd77a47b1a32f52a87e617 Author: Brad King AuthorDate: Mon Jul 21 11:36:16 2014 -0400 Commit: Brad King CommitDate: Mon Jul 21 11:43:30 2014 -0400 cmTarget: Re-order link interface map lookup logic In GetLinkInterface, GetLinkInterfaceLibraries, and GetImportLinkInterface, lookup the HeadToLinkInterfaceMap for the current configuration first, and then index it by head target. In GetLinkImplementationLibrariesInternal, lookup the HeadToLinkImplementationMap for the current configuration first, and then index it by head target. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 52b7e68..df65a68 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -5746,9 +5746,9 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface( // Lookup any existing link interface for this configuration. std::string CONFIG = cmSystemTools::UpperCase(config); - - cmTargetInternals::OptionalLinkInterface& - iface = this->Internal->LinkInterfaceMap[CONFIG][head]; + cmTargetInternals::HeadToLinkInterfaceMap& hm = + this->Internal->LinkInterfaceMap[CONFIG]; + cmTargetInternals::OptionalLinkInterface& iface = hm[head]; if(!iface.LibrariesDone) { iface.LibrariesDone = true; @@ -5789,12 +5789,11 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config, // Lookup any existing link interface for this configuration. std::string CONFIG = cmSystemTools::UpperCase(config); - cmTargetInternals::LinkInterfaceMapType& lim = + cmTargetInternals::HeadToLinkInterfaceMap& hm = (usage_requirements_only ? - this->Internal->LinkInterfaceUsageRequirementsOnlyMap : - this->Internal->LinkInterfaceMap); - - cmTargetInternals::OptionalLinkInterface& iface = lim[CONFIG][head]; + this->Internal->LinkInterfaceUsageRequirementsOnlyMap[CONFIG] : + this->Internal->LinkInterfaceMap[CONFIG]); + cmTargetInternals::OptionalLinkInterface& iface = hm[head]; if(!iface.LibrariesDone) { iface.LibrariesDone = true; @@ -5817,13 +5816,12 @@ cmTarget::GetImportLinkInterface(const std::string& config, return 0; } - cmTargetInternals::LinkInterfaceMapType& lim = - (usage_requirements_only ? - this->Internal->LinkInterfaceUsageRequirementsOnlyMap : - this->Internal->LinkInterfaceMap); - std::string CONFIG = cmSystemTools::UpperCase(config); - cmTargetInternals::OptionalLinkInterface& iface = lim[CONFIG][headTarget]; + cmTargetInternals::HeadToLinkInterfaceMap& hm = + (usage_requirements_only ? + this->Internal->LinkInterfaceUsageRequirementsOnlyMap[CONFIG] : + this->Internal->LinkInterfaceMap[CONFIG]); + cmTargetInternals::OptionalLinkInterface& iface = hm[headTarget]; if(!iface.AllDone) { iface.AllDone = true; @@ -6261,8 +6259,9 @@ cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config, // Populate the link implementation libraries for this configuration. std::string CONFIG = cmSystemTools::UpperCase(config); - cmTargetInternals::OptionalLinkImplementation& - impl = this->Internal->LinkImplMap[CONFIG][head]; + cmTargetInternals::HeadToLinkImplementationMap& hm = + this->Internal->LinkImplMap[CONFIG]; + cmTargetInternals::OptionalLinkImplementation& impl = hm[head]; if(!impl.LibrariesDone) { impl.LibrariesDone = true; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fe665fdda8986b3af061ec91a7ab5fbe8f606e4f commit fe665fdda8986b3af061ec91a7ab5fbe8f606e4f Author: Brad King AuthorDate: Mon Jul 21 11:26:10 2014 -0400 Commit: Brad King CommitDate: Mon Jul 21 11:26:10 2014 -0400 cmTarget: Refactor link interface map storage Convert LinkInterfaceMapType and LinkImplMapType to nested maps that index on configuration first and 'head' target second. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index dc8384d..52b7e68 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -88,11 +88,6 @@ struct cmTarget::CompileInfo std::string CompilePdbDir; }; -struct TargetConfigPair : public std::pair { - TargetConfigPair(cmTarget const* tgt, const std::string &config) - : std::pair(tgt, config) {} -}; - //---------------------------------------------------------------------------- class cmTargetInternals { @@ -135,7 +130,9 @@ public: cmTarget const* head, bool usage_requirements_only); - typedef std::map + struct HeadToLinkInterfaceMap: + public std::map {}; + typedef std::map LinkInterfaceMapType; LinkInterfaceMapType LinkInterfaceMap; LinkInterfaceMapType LinkInterfaceUsageRequirementsOnlyMap; @@ -158,8 +155,10 @@ public: bool LibrariesDone; bool LanguagesDone; }; - typedef std::map LinkImplMapType; + struct HeadToLinkImplementationMap: + public std::map {}; + typedef std::map LinkImplMapType; LinkImplMapType LinkImplMap; typedef std::map LinkClosureMapType; @@ -5746,10 +5745,10 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface( } // Lookup any existing link interface for this configuration. - TargetConfigPair key(head, cmSystemTools::UpperCase(config)); + std::string CONFIG = cmSystemTools::UpperCase(config); cmTargetInternals::OptionalLinkInterface& - iface = this->Internal->LinkInterfaceMap[key]; + iface = this->Internal->LinkInterfaceMap[CONFIG][head]; if(!iface.LibrariesDone) { iface.LibrariesDone = true; @@ -5789,13 +5788,13 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config, } // Lookup any existing link interface for this configuration. - TargetConfigPair key(head, cmSystemTools::UpperCase(config)); + std::string CONFIG = cmSystemTools::UpperCase(config); cmTargetInternals::LinkInterfaceMapType& lim = (usage_requirements_only ? this->Internal->LinkInterfaceUsageRequirementsOnlyMap : this->Internal->LinkInterfaceMap); - cmTargetInternals::OptionalLinkInterface& iface = lim[key]; + cmTargetInternals::OptionalLinkInterface& iface = lim[CONFIG][head]; if(!iface.LibrariesDone) { iface.LibrariesDone = true; @@ -5818,13 +5817,13 @@ cmTarget::GetImportLinkInterface(const std::string& config, return 0; } - TargetConfigPair key(headTarget, cmSystemTools::UpperCase(config)); cmTargetInternals::LinkInterfaceMapType& lim = (usage_requirements_only ? this->Internal->LinkInterfaceUsageRequirementsOnlyMap : this->Internal->LinkInterfaceMap); - cmTargetInternals::OptionalLinkInterface& iface = lim[key]; + std::string CONFIG = cmSystemTools::UpperCase(config); + cmTargetInternals::OptionalLinkInterface& iface = lim[CONFIG][headTarget]; if(!iface.AllDone) { iface.AllDone = true; @@ -6226,9 +6225,9 @@ cmTarget::GetLinkImplementation(const std::string& config) const } // Populate the link implementation for this configuration. - TargetConfigPair key(this, cmSystemTools::UpperCase(config)); + std::string CONFIG = cmSystemTools::UpperCase(config); cmTargetInternals::OptionalLinkImplementation& - impl = this->Internal->LinkImplMap[key]; + impl = this->Internal->LinkImplMap[CONFIG][this]; if(!impl.LibrariesDone) { impl.LibrariesDone = true; @@ -6261,9 +6260,9 @@ cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config, } // Populate the link implementation libraries for this configuration. - TargetConfigPair key(head, cmSystemTools::UpperCase(config)); + std::string CONFIG = cmSystemTools::UpperCase(config); cmTargetInternals::OptionalLinkImplementation& - impl = this->Internal->LinkImplMap[key]; + impl = this->Internal->LinkImplMap[CONFIG][head]; if(!impl.LibrariesDone) { impl.LibrariesDone = true; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9d13e1679f2b52e88748a710edd201ed9fba7447 commit 9d13e1679f2b52e88748a710edd201ed9fba7447 Author: Brad King AuthorDate: Mon Jul 21 11:14:26 2014 -0400 Commit: Brad King CommitDate: Mon Jul 21 11:16:45 2014 -0400 cmTarget: Remove duplicate link interface map No target is both imported and not imported so we do not need separate link interface maps for them. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 9d00591..dc8384d 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -141,11 +141,6 @@ public: LinkInterfaceMapType LinkInterfaceUsageRequirementsOnlyMap; bool PolicyWarnedCMP0022; - typedef std::map - ImportLinkInterfaceMapType; - ImportLinkInterfaceMapType ImportLinkInterfaceMap; - ImportLinkInterfaceMapType ImportLinkInterfaceUsageRequirementsOnlyMap; - typedef std::map OutputInfoMapType; OutputInfoMapType OutputInfoMap; @@ -528,8 +523,6 @@ void cmTarget::ClearLinkMaps() this->Internal->LinkImplMap.clear(); this->Internal->LinkInterfaceMap.clear(); this->Internal->LinkInterfaceUsageRequirementsOnlyMap.clear(); - this->Internal->ImportLinkInterfaceMap.clear(); - this->Internal->ImportLinkInterfaceUsageRequirementsOnlyMap.clear(); this->Internal->LinkClosureMap.clear(); for (cmTargetLinkInformationMap::const_iterator it = this->LinkInformation.begin(); @@ -5826,10 +5819,10 @@ cmTarget::GetImportLinkInterface(const std::string& config, } TargetConfigPair key(headTarget, cmSystemTools::UpperCase(config)); - cmTargetInternals::ImportLinkInterfaceMapType& lim = + cmTargetInternals::LinkInterfaceMapType& lim = (usage_requirements_only ? - this->Internal->ImportLinkInterfaceUsageRequirementsOnlyMap : - this->Internal->ImportLinkInterfaceMap); + this->Internal->LinkInterfaceUsageRequirementsOnlyMap : + this->Internal->LinkInterfaceMap); cmTargetInternals::OptionalLinkInterface& iface = lim[key]; if(!iface.AllDone) ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpression.cxx | 3 + Source/cmGeneratorExpression.h | 5 + Source/cmGeneratorExpressionEvaluator.cxx | 14 +++ Source/cmGeneratorExpressionEvaluator.h | 1 + Source/cmTarget.cxx | 193 ++++++++++++++++++----------- Source/cmTarget.h | 8 +- 6 files changed, 148 insertions(+), 76 deletions(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Mon Jul 21 13:44:20 2014 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Mon, 21 Jul 2014 13:44:20 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4414-g64d13c1 Message-ID: <20140721174420.0DD2F403F6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 64d13c146c0470cf46798d10146cadedf9a25445 (commit) via 8d8d4404f66d646d5ee50a7a945e669f3816171d (commit) via 8322676382b9a9443bb892044f7421e88ba7d21c (commit) from 143931d04181a6b192da26c3e3996d9cba0eb04d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=64d13c146c0470cf46798d10146cadedf9a25445 commit 64d13c146c0470cf46798d10146cadedf9a25445 Merge: 143931d 8d8d440 Author: Nils Gladitz AuthorDate: Mon Jul 21 13:44:19 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 21 13:44:19 2014 -0400 Merge topic 'deprecated-properties' into next 8d8d4404 Help: Add missing extra spaces 83226763 Help: Flatten hierarchy in property documentation http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8d8d4404f66d646d5ee50a7a945e669f3816171d commit 8d8d4404f66d646d5ee50a7a945e669f3816171d Author: Nils Gladitz AuthorDate: Mon Jul 21 19:38:22 2014 +0200 Commit: Nils Gladitz CommitDate: Mon Jul 21 19:41:52 2014 +0200 Help: Add missing extra spaces diff --git a/Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst b/Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst index af18d7b..a6af45f 100644 --- a/Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst +++ b/Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst @@ -1,7 +1,7 @@ COMPILE_DEFINITIONS_ ---------------------------- -Ignored. See CMake Policy :policy:`CMP0043`. +Ignored. See CMake Policy :policy:`CMP0043`. Per-configuration preprocessor definitions in a directory. diff --git a/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst b/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst index 4920f58..8487076 100644 --- a/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst +++ b/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst @@ -1,7 +1,7 @@ COMPILE_DEFINITIONS_ ---------------------------- -Ignored. See CMake Policy :policy:`CMP0043`. +Ignored. See CMake Policy :policy:`CMP0043`. Per-configuration preprocessor definitions on a source file. diff --git a/Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst b/Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst index 1dba356..84bd5e4 100644 --- a/Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst +++ b/Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst @@ -1,7 +1,7 @@ COMPILE_DEFINITIONS_ ---------------------------- -Ignored. See CMake Policy :policy:`CMP0043`. +Ignored. See CMake Policy :policy:`CMP0043`. Per-configuration preprocessor definitions on a target. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8322676382b9a9443bb892044f7421e88ba7d21c commit 8322676382b9a9443bb892044f7421e88ba7d21c Author: Nils Gladitz AuthorDate: Mon Jul 21 19:36:18 2014 +0200 Commit: Nils Gladitz CommitDate: Mon Jul 21 19:41:51 2014 +0200 Help: Flatten hierarchy in property documentation diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index f6a650e..17dadc2 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -7,12 +7,8 @@ cmake-properties(7) .. contents:: -Normal Properties -================= -These properties may be used freely in CMake projects. - Properties of Global Scope -^^^^^^^^^^^^^^^^^^^^^^^^^^ +========================== .. toctree:: :maxdepth: 1 @@ -46,7 +42,7 @@ Properties of Global Scope /prop_gbl/USE_FOLDERS Properties on Directories -^^^^^^^^^^^^^^^^^^^^^^^^^ +========================= .. toctree:: :maxdepth: 1 @@ -77,7 +73,7 @@ Properties on Directories /prop_dir/VS_GLOBAL_SECTION_PRE_section Properties on Targets -^^^^^^^^^^^^^^^^^^^^^ +===================== .. toctree:: :maxdepth: 1 @@ -245,7 +241,7 @@ Properties on Targets /prop_tgt/XCODE_ATTRIBUTE_an-attribute Properties on Tests -^^^^^^^^^^^^^^^^^^^ +=================== .. toctree:: :maxdepth: 1 @@ -269,7 +265,7 @@ Properties on Tests /prop_test/WORKING_DIRECTORY Properties on Source Files -^^^^^^^^^^^^^^^^^^^^^^^^^^ +========================== .. toctree:: :maxdepth: 1 @@ -296,7 +292,7 @@ Properties on Source Files /prop_sf/XCODE_LAST_KNOWN_FILE_TYPE Properties on Cache Entries -^^^^^^^^^^^^^^^^^^^^^^^^^^^ +=========================== .. toctree:: :maxdepth: 1 @@ -309,7 +305,7 @@ Properties on Cache Entries /prop_cache/VALUE Properties on Installed Files -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +============================= .. toctree:: :maxdepth: 1 @@ -318,14 +314,8 @@ Properties on Installed Files /prop_inst/CPACK_PERMANENT.rst -Deprecated Properties -===================== - -These properties are available only for compatibility with older -versions of CMake. Do not use them in new code. - -Properties on Directories -^^^^^^^^^^^^^^^^^^^^^^^^^ +Deprecated Properties on Directories +===================================== .. toctree:: :maxdepth: 1 @@ -333,8 +323,8 @@ Properties on Directories /prop_dir/COMPILE_DEFINITIONS_CONFIG -Properties on Targets -^^^^^^^^^^^^^^^^^^^^^ +Deprecated Properties on Targets +================================ .. toctree:: :maxdepth: 1 @@ -344,8 +334,8 @@ Properties on Targets /prop_tgt/PRE_INSTALL_SCRIPT -Properties on Source Files -^^^^^^^^^^^^^^^^^^^^^^^^^^ +Deprecated Properties on Source Files +===================================== .. toctree:: :maxdepth: 1 ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-properties.7.rst | 36 ++++++++++---------------- Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst | 2 +- Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst | 2 +- Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst | 2 +- 4 files changed, 16 insertions(+), 26 deletions(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Mon Jul 21 13:49:19 2014 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Mon, 21 Jul 2014 13:49:19 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4416-g2031072 Message-ID: <20140721174919.9F52D451E2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 2031072957ad0de5f4e447f34075d1f95bd609eb (commit) via 5bbec4e3982d25c3514246d691a5b15cacfd5daa (commit) from 64d13c146c0470cf46798d10146cadedf9a25445 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2031072957ad0de5f4e447f34075d1f95bd609eb commit 2031072957ad0de5f4e447f34075d1f95bd609eb Merge: 64d13c1 5bbec4e Author: Nils Gladitz AuthorDate: Mon Jul 21 13:49:18 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 21 13:49:18 2014 -0400 Merge topic 'deprecated-properties' into next 5bbec4e3 Help: Document deprecated properties. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5bbec4e3982d25c3514246d691a5b15cacfd5daa commit 5bbec4e3982d25c3514246d691a5b15cacfd5daa Author: Nils Gladitz AuthorDate: Mon Jul 21 17:44:46 2014 +0200 Commit: Nils Gladitz CommitDate: Mon Jul 21 19:48:48 2014 +0200 Help: Document deprecated properties. Document the COMPILE_DEFINITIONS_ properties as deprecated. Add new sections for deprecated properties and move POST_INSTALL_SCRIPT and PRE_INSTALL_SCRIPT there as well. diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index e4546c1..17dadc2 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -51,7 +51,6 @@ Properties on Directories /prop_dir/CACHE_VARIABLES /prop_dir/CLEAN_NO_CUSTOM /prop_dir/CMAKE_CONFIGURE_DEPENDS - /prop_dir/COMPILE_DEFINITIONS_CONFIG /prop_dir/COMPILE_DEFINITIONS /prop_dir/COMPILE_OPTIONS /prop_dir/DEFINITIONS @@ -101,7 +100,6 @@ Properties on Targets /prop_tgt/COMPATIBLE_INTERFACE_NUMBER_MAX /prop_tgt/COMPATIBLE_INTERFACE_NUMBER_MIN /prop_tgt/COMPATIBLE_INTERFACE_STRING - /prop_tgt/COMPILE_DEFINITIONS_CONFIG /prop_tgt/COMPILE_DEFINITIONS /prop_tgt/COMPILE_FEATURES /prop_tgt/COMPILE_FLAGS @@ -205,9 +203,7 @@ Properties on Targets /prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG /prop_tgt/PDB_OUTPUT_DIRECTORY /prop_tgt/POSITION_INDEPENDENT_CODE - /prop_tgt/POST_INSTALL_SCRIPT /prop_tgt/PREFIX - /prop_tgt/PRE_INSTALL_SCRIPT /prop_tgt/PRIVATE_HEADER /prop_tgt/PROJECT_LABEL /prop_tgt/PUBLIC_HEADER @@ -277,7 +273,6 @@ Properties on Source Files /prop_sf/ABSTRACT /prop_sf/AUTOUIC_OPTIONS /prop_sf/AUTORCC_OPTIONS - /prop_sf/COMPILE_DEFINITIONS_CONFIG /prop_sf/COMPILE_DEFINITIONS /prop_sf/COMPILE_FLAGS /prop_sf/EXTERNAL_OBJECT @@ -317,3 +312,32 @@ Properties on Installed Files /prop_inst/CPACK_NEVER_OVERWRITE.rst /prop_inst/CPACK_PERMANENT.rst + + +Deprecated Properties on Directories +===================================== + +.. toctree:: + :maxdepth: 1 + + /prop_dir/COMPILE_DEFINITIONS_CONFIG + + +Deprecated Properties on Targets +================================ + +.. toctree:: + :maxdepth: 1 + + /prop_tgt/COMPILE_DEFINITIONS_CONFIG + /prop_tgt/POST_INSTALL_SCRIPT + /prop_tgt/PRE_INSTALL_SCRIPT + + +Deprecated Properties on Source Files +===================================== + +.. toctree:: + :maxdepth: 1 + + /prop_sf/COMPILE_DEFINITIONS_CONFIG diff --git a/Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst b/Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst index c22606b..a6af45f 100644 --- a/Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst +++ b/Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst @@ -1,6 +1,8 @@ COMPILE_DEFINITIONS_ ---------------------------- +Ignored. See CMake Policy :policy:`CMP0043`. + Per-configuration preprocessor definitions in a directory. This is the configuration-specific version of :prop_dir:`COMPILE_DEFINITIONS` diff --git a/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst b/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst index e695f38..8487076 100644 --- a/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst +++ b/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst @@ -1,6 +1,8 @@ COMPILE_DEFINITIONS_ ---------------------------- +Ignored. See CMake Policy :policy:`CMP0043`. + Per-configuration preprocessor definitions on a source file. This is the configuration-specific version of COMPILE_DEFINITIONS. diff --git a/Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst b/Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst index e359d2c..84bd5e4 100644 --- a/Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst +++ b/Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst @@ -1,6 +1,8 @@ COMPILE_DEFINITIONS_ ---------------------------- +Ignored. See CMake Policy :policy:`CMP0043`. + Per-configuration preprocessor definitions on a target. This is the configuration-specific version of :prop_tgt:`COMPILE_DEFINITIONS` ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 22 00:02:41 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 22 Jul 2014 00:02:41 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1467-g08bb09a Message-ID: <20140722040241.DDA8B461D3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 08bb09a944ecccb5d5f25c847be7b30a70ccf7c4 (commit) from 23ec3738a0bafd23a9d37fc72e7183e8dc84a4ac (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=08bb09a944ecccb5d5f25c847be7b30a70ccf7c4 commit 08bb09a944ecccb5d5f25c847be7b30a70ccf7c4 Author: Kitware Robot AuthorDate: Tue Jul 22 00:01:08 2014 -0400 Commit: Kitware Robot CommitDate: Tue Jul 22 00:01:08 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c034126..44737b8 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140721) +set(CMake_VERSION_PATCH 20140722) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From steveire at gmail.com Tue Jul 22 09:45:38 2014 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 22 Jul 2014 09:45:38 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4420-g2432d11 Message-ID: <20140722134538.86D8244D52@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 2432d11a01cdfce3bfbb8d866a5f3a45f200b8dd (commit) via 808f0b9ad2f2a4e6584f0f61bb93f4a20633899b (commit) via be4f3bdbf85e88f1225982efd076342c619a7f77 (commit) via 1d17926b8a009b7026ae644690c8ec43286139bc (commit) from 2031072957ad0de5f4e447f34075d1f95bd609eb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2432d11a01cdfce3bfbb8d866a5f3a45f200b8dd commit 2432d11a01cdfce3bfbb8d866a5f3a45f200b8dd Merge: 2031072 808f0b9 Author: Stephen Kelly AuthorDate: Tue Jul 22 09:45:37 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 22 09:45:37 2014 -0400 Merge topic 'file-GENERATE-fixes' into next 808f0b9a file(GENERATE): Use permissions of input file if present. be4f3bdb file(GENERATE): Re-run cmake if the output file is removed. 1d17926b file(GENERATE): Re-run cmake if the input file changes http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=808f0b9ad2f2a4e6584f0f61bb93f4a20633899b commit 808f0b9ad2f2a4e6584f0f61bb93f4a20633899b Author: Stephen Kelly AuthorDate: Tue Jul 22 15:10:57 2014 +0200 Commit: Stephen Kelly CommitDate: Tue Jul 22 15:39:36 2014 +0200 file(GENERATE): Use permissions of input file if present. diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index f1b19a3..49cdba8 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -36,7 +36,7 @@ cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile( //---------------------------------------------------------------------------- void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, cmCompiledGeneratorExpression* inputExpression, - std::map &outputFiles) + std::map &outputFiles, mode_t perm) { std::string rawCondition = this->Condition->GetInput(); if (!rawCondition.empty()) @@ -84,11 +84,17 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, cmGeneratedFileStream fout(outputFileName.c_str()); fout.SetCopyIfDifferent(true); fout << outputContent; + if (perm) + { + fout.close(); + cmSystemTools::SetPermissions(outputFileName.c_str(), perm); + } } //---------------------------------------------------------------------------- void cmGeneratorExpressionEvaluationFile::Generate() { + mode_t perm = 0; std::string inputContent; if (this->InputIsContent) { @@ -96,6 +102,7 @@ void cmGeneratorExpressionEvaluationFile::Generate() } else { + cmSystemTools::GetPermissions(this->Input.c_str(), perm); this->Makefile->AddCMakeDependFile(this->Input.c_str()); cmsys::ifstream fin(this->Input.c_str()); @@ -134,7 +141,7 @@ void cmGeneratorExpressionEvaluationFile::Generate() for(std::vector::const_iterator li = allConfigs.begin(); li != allConfigs.end(); ++li) { - this->Generate(*li, inputExpression.get(), outputFiles); + this->Generate(*li, inputExpression.get(), outputFiles, perm); if(cmSystemTools::GetFatalErrorOccured()) { return; diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index f939916..4e87a88 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -34,7 +34,7 @@ public: private: void Generate(const std::string& config, cmCompiledGeneratorExpression* inputExpression, - std::map &outputFiles); + std::map &outputFiles, mode_t perm); private: const std::string Input; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=be4f3bdbf85e88f1225982efd076342c619a7f77 commit be4f3bdbf85e88f1225982efd076342c619a7f77 Author: Stephen Kelly AuthorDate: Tue Jul 22 15:37:32 2014 +0200 Commit: Stephen Kelly CommitDate: Tue Jul 22 15:39:36 2014 +0200 file(GENERATE): Re-run cmake if the output file is removed. diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index 203a577..f1b19a3 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -77,6 +77,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, return; } + this->Makefile->AddCMakeOutputFile(outputFileName.c_str()); this->Files.push_back(outputFileName); outputFiles[outputFileName] = outputContent; diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index 10b8f0b..5752459 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -56,3 +56,11 @@ file(READ "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt" out_content) if(NOT out_content STREQUAL "ChangedContent\n") message(SEND_ERROR "File did not change: \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"") endif() + + +file(REMOVE "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt") +execute_process(COMMAND ${CMAKE_COMMAND} --build "${RunCMake_BINARY_DIR}/ReRunCMake-build/") + +if (NOT EXISTS "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt") + message(SEND_ERROR "File did not re-generate: \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"") +endif() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1d17926b8a009b7026ae644690c8ec43286139bc commit 1d17926b8a009b7026ae644690c8ec43286139bc Author: Stephen Kelly AuthorDate: Tue Jul 22 15:07:39 2014 +0200 Commit: Stephen Kelly CommitDate: Tue Jul 22 15:39:34 2014 +0200 file(GENERATE): Re-run cmake if the input file changes diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index f9067cf..203a577 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -95,6 +95,8 @@ void cmGeneratorExpressionEvaluationFile::Generate() } else { + this->Makefile->AddCMakeDependFile(this->Input.c_str()); + cmsys::ifstream fin(this->Input.c_str()); if(!fin) { diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-result.txt b/Tests/RunCMake/File_Generate/ReRunCMake-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/File_Generate/ReRunCMake-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt b/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/File_Generate/ReRunCMake.cmake b/Tests/RunCMake/File_Generate/ReRunCMake.cmake new file mode 100644 index 0000000..109d60e --- /dev/null +++ b/Tests/RunCMake/File_Generate/ReRunCMake.cmake @@ -0,0 +1,5 @@ + +file(GENERATE + OUTPUT output_file.txt + INPUT "${CMAKE_CURRENT_BINARY_DIR}/input_file.txt" +) diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index dee0692..10b8f0b 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -35,3 +35,24 @@ unset(RunCMake_TEST_NO_CLEAN) if (NOT timestamp_after STREQUAL timestamp) message(SEND_ERROR "WriteIfDifferent changed output file.") endif() + +file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/ReRunCMake-build/") +file(WRITE "${RunCMake_BINARY_DIR}/ReRunCMake-build/input_file.txt" "InitialContent\n") + +set(RunCMake_TEST_NO_CLEAN ON) +run_cmake(ReRunCMake) +unset(RunCMake_TEST_NO_CLEAN) +file(TIMESTAMP "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt" timestamp ${timeformat}) +if(NOT timestamp) + message(SEND_ERROR "Could not get timestamp for \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"") +endif() + +execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) + +file(WRITE "${RunCMake_BINARY_DIR}/ReRunCMake-build/input_file.txt" "ChangedContent\n") +execute_process(COMMAND ${CMAKE_COMMAND} --build "${RunCMake_BINARY_DIR}/ReRunCMake-build/") +file(READ "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt" out_content) + +if(NOT out_content STREQUAL "ChangedContent\n") + message(SEND_ERROR "File did not change: \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"") +endif() ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpressionEvaluationFile.cxx | 14 ++++++++-- Source/cmGeneratorExpressionEvaluationFile.h | 2 +- .../ReRunCMake-result.txt} | 0 .../ReRunCMake-stderr.txt} | 0 Tests/RunCMake/File_Generate/ReRunCMake.cmake | 5 ++++ Tests/RunCMake/File_Generate/RunCMakeTest.cmake | 29 ++++++++++++++++++++ 6 files changed, 47 insertions(+), 3 deletions(-) copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => File_Generate/ReRunCMake-result.txt} (100%) copy Tests/RunCMake/{CMP0022/CMP0022-NOWARN-exe-stderr.txt => File_Generate/ReRunCMake-stderr.txt} (100%) create mode 100644 Tests/RunCMake/File_Generate/ReRunCMake.cmake hooks/post-receive -- CMake From bill.hoffman at kitware.com Tue Jul 22 10:54:21 2014 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Tue, 22 Jul 2014 10:54:21 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4423-gcbd554f Message-ID: <20140722145421.268A14569C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via cbd554fbd01117866dd11eaac3b0d014d8f4552d (commit) via f7d62cac79f856c9c7b634ed7f5d2f6030b7ba76 (commit) via 08bb09a944ecccb5d5f25c847be7b30a70ccf7c4 (commit) from 2432d11a01cdfce3bfbb8d866a5f3a45f200b8dd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cbd554fbd01117866dd11eaac3b0d014d8f4552d commit cbd554fbd01117866dd11eaac3b0d014d8f4552d Merge: 2432d11 f7d62ca Author: Bill Hoffman AuthorDate: Tue Jul 22 10:54:20 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 22 10:54:20 2014 -0400 Merge topic 'fix_sanitizer_test_to_work_with_sanitizer' into next f7d62cac Fix leak and address sanitizer tests to be able to run with real tools. 08bb09a9 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f7d62cac79f856c9c7b634ed7f5d2f6030b7ba76 commit f7d62cac79f856c9c7b634ed7f5d2f6030b7ba76 Author: Bill Hoffman AuthorDate: Tue Jul 22 10:51:53 2014 -0400 Commit: Bill Hoffman CommitDate: Tue Jul 22 10:51:53 2014 -0400 Fix leak and address sanitizer tests to be able to run with real tools. When running CMake under Leak or Address Sanitizer tools, the fake reporting would get picked up by the outer CMake and reported as leaks and address failures on the CMake dashboard. This commit makes sure the test only reports simulated errors when asked to. diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index d16d432..0f38431 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -121,7 +121,7 @@ set(CTEST_EXTRA_CODE) # add LeakSanitizer test set(CTEST_EXTRA_CODE -"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"report_bugs=1 history_size=5 exitcode=55\") +"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") ") set(CMAKELISTS_EXTRA_CODE @@ -136,7 +136,7 @@ set_tests_properties(CTestTestMemcheckDummyLeakSanitizer PROPERTIES ".*Memory checking results:.*Direct leak - 2.*Indirect leak - 1.*") # add AddressSanitizer test set(CTEST_EXTRA_CODE -"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"report_bugs=1 history_size=5 exitcode=55\") +"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") ") set(CMAKELISTS_EXTRA_CODE diff --git a/Tests/CTestTestMemcheck/testAddressSanitizer.cmake b/Tests/CTestTestMemcheck/testAddressSanitizer.cmake index a359e28..a073151 100644 --- a/Tests/CTestTestMemcheck/testAddressSanitizer.cmake +++ b/Tests/CTestTestMemcheck/testAddressSanitizer.cmake @@ -5,6 +5,10 @@ message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]") string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") message("LOG_FILE=[${LOG_FILE}]") +# if we are not asked to simulate address sanitizer don't do it +if(NOT "$ENV{ASAN_OPTIONS}]" MATCHES "simulate_sanitizer.1") + return() +endif() # clear the log file file(REMOVE "${LOG_FILE}.2343") diff --git a/Tests/CTestTestMemcheck/testLeakSanitizer.cmake b/Tests/CTestTestMemcheck/testLeakSanitizer.cmake index ca0a264..d0e38ce 100644 --- a/Tests/CTestTestMemcheck/testLeakSanitizer.cmake +++ b/Tests/CTestTestMemcheck/testLeakSanitizer.cmake @@ -4,6 +4,10 @@ message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]") string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") message("LOG_FILE=[${LOG_FILE}]") +# if we are not asked to simulate leak sanitizer don't do it +if(NOT "$ENV{ASAN_OPTIONS}]" MATCHES "simulate_sanitizer.1") + return() +endif() # clear the log file file(REMOVE "${LOG_FILE}.2343") ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- Tests/CTestTestMemcheck/CMakeLists.txt | 4 ++-- Tests/CTestTestMemcheck/testAddressSanitizer.cmake | 4 ++++ Tests/CTestTestMemcheck/testLeakSanitizer.cmake | 4 ++++ 4 files changed, 11 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Tue Jul 22 10:57:15 2014 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 22 Jul 2014 10:57:15 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4425-gd0c6546 Message-ID: <20140722145715.92790457F0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d0c654609abd352e67a7aacb398d2c6b57e88bd3 (commit) via a12e4e782c9c8d290071a3fb8f8abcf5cba24afe (commit) from cbd554fbd01117866dd11eaac3b0d014d8f4552d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d0c654609abd352e67a7aacb398d2c6b57e88bd3 commit d0c654609abd352e67a7aacb398d2c6b57e88bd3 Merge: cbd554f a12e4e7 Author: Stephen Kelly AuthorDate: Tue Jul 22 10:57:14 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 22 10:57:14 2014 -0400 Merge topic 'fix-broken-re-cmake' into next a12e4e78 cmake: Avoid overwriting compiler name if specified repeatedly. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a12e4e782c9c8d290071a3fb8f8abcf5cba24afe commit a12e4e782c9c8d290071a3fb8f8abcf5cba24afe Author: Stephen Kelly AuthorDate: Mon Jul 21 18:05:53 2014 +0200 Commit: Stephen Kelly CommitDate: Tue Jul 22 16:44:12 2014 +0200 cmake: Avoid overwriting compiler name if specified repeatedly. If CMake is invoked repeatedly on the command line with the compiler of a language specified by name, don't replace the cached value with the un-resolved name if the resolved name is the same as the path in the cache. diff --git a/Source/cmake.cxx b/Source/cmake.cxx index a051c87..3e4ae17 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -355,6 +355,36 @@ bool cmake::SetCacheArgs(const std::vector& args) } } + cmsys::RegularExpression compilerRex("^CMAKE_[a-zA-Z]+_COMPILER$"); + if (compilerRex.find(var)) + { + std::string newVal = cmSystemTools::FindProgram(value.c_str()); + const char* existing = + this->CacheManager->GetCacheValue(var.c_str()); + if (existing && existing == newVal) + { + // Repeated invocation of cmake with arguments specifying a + // compiler, such as -DCMAKE_CXX_COMPILER=clang++, should not + // re-populate the cache with the un-resolved name. On the + // first run of cmake, the CMakeDetermineCXXCompiler.cmake logic + // is executed and the result is resolved to a full path and + // cached, On subsequent runs of cmake, we wish to avoid + // re-executing the CMakeDetermineCXXCompiler.cmake logic. + // The cmGlobalGenerator::ResolveLanguageCompiler method is + // responsible for ensuring that the cache is deleted if the + // value in the cache is changed. + // A scripting environment can invoke cmake on the command line + // with arguments specifying the compiler in a way which is + // intended to give reproducible results. Ignore the value + // specified on the command line if it results in the same + // value as is already in the cache. Otherwise, + // cmMakefile::AddCacheDefinition would use CollapseFullPath on + // the entry, incorrectly resolving 'clang++' to + // '/clang++', which is unlikely to exist. + continue; + } + } + this->CacheManager->AddCacheEntry(var, value.c_str(), "No help, variable specified on the command line.", type); ----------------------------------------------------------------------- Summary of changes: Source/cmake.cxx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 22 10:58:10 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 22 Jul 2014 10:58:10 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4427-gf51631c Message-ID: <20140722145810.91CB445895@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f51631ca91082d941764bca09cd6ffd3556738c1 (commit) via db34736205f35428580fde47d6d51da2e2fbf5d1 (commit) from d0c654609abd352e67a7aacb398d2c6b57e88bd3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f51631ca91082d941764bca09cd6ffd3556738c1 commit f51631ca91082d941764bca09cd6ffd3556738c1 Merge: d0c6546 db34736 Author: Brad King AuthorDate: Tue Jul 22 10:58:09 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 22 10:58:09 2014 -0400 Merge topic 'revert-stray-topic' into next db347362 Revert "genex: Allow genex caching of config genex on single-config generators" http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=db34736205f35428580fde47d6d51da2e2fbf5d1 commit db34736205f35428580fde47d6d51da2e2fbf5d1 Author: Brad King AuthorDate: Tue Jul 22 10:59:06 2014 -0400 Commit: Brad King CommitDate: Tue Jul 22 10:59:06 2014 -0400 Revert "genex: Allow genex caching of config genex on single-config generators" This reverts commit 93d441b5341b3288f113d7e9c3a488bb23497547. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 2581355..3b83cd3 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -15,7 +15,6 @@ #include "cmGeneratorExpressionParser.h" #include "cmGeneratorExpressionDAGChecker.h" #include "cmGeneratorExpression.h" -#include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmSourceFile.h" @@ -689,11 +688,7 @@ static const struct ConfigurationNode : public cmGeneratorExpressionNode const GeneratorExpressionContent *, cmGeneratorExpressionDAGChecker *) const { - if (context->Makefile->GetLocalGenerator()-> - GetGlobalGenerator()->IsMultiConfig()) - { - context->HadContextSensitiveCondition = true; - } + context->HadContextSensitiveCondition = true; return context->Config; } } configurationNode; @@ -721,11 +716,7 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode "Expression syntax not recognized."); return std::string(); } - if (context->Makefile->GetLocalGenerator()-> - GetGlobalGenerator()->IsMultiConfig()) - { - context->HadContextSensitiveCondition = true; - } + context->HadContextSensitiveCondition = true; if (context->Config.empty()) { return parameters.front().empty() ? "1" : "0"; diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake index 57c52e3..fa76f24 100644 --- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake @@ -9,11 +9,7 @@ run_cmake(RelativePathInInterface) run_cmake(ImportedTarget) run_cmake(RelativePathInGenex) run_cmake(CMP0021) -if (CMAKE_CONFIGURATION_TYPES) - # $ is only context-dependent in multi-config - # generators. - run_cmake(install_config) -endif () +run_cmake(install_config) run_cmake(incomplete-genex) run_cmake(export-NOWARN) ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpressionEvaluator.cxx | 13 ++----------- Tests/RunCMake/include_directories/RunCMakeTest.cmake | 6 +----- 2 files changed, 3 insertions(+), 16 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 22 10:59:06 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 22 Jul 2014 10:59:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4429-gef8ae0c Message-ID: <20140722145906.030E745916@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ef8ae0c56fc87ddd1b2848f9c54f44f518aca6b9 (commit) via fb95f820e06eb1933a7d3b71bc46eed4d5d25ee6 (commit) from f51631ca91082d941764bca09cd6ffd3556738c1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ef8ae0c56fc87ddd1b2848f9c54f44f518aca6b9 commit ef8ae0c56fc87ddd1b2848f9c54f44f518aca6b9 Merge: f51631c fb95f82 Author: Brad King AuthorDate: Tue Jul 22 10:59:05 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 22 10:59:05 2014 -0400 Merge topic 'fix-complex-test-policies' into next fb95f820 Tests: Set policies in 'complex' tests http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fb95f820e06eb1933a7d3b71bc46eed4d5d25ee6 commit fb95f820e06eb1933a7d3b71bc46eed4d5d25ee6 Author: Brad King AuthorDate: Tue Jul 22 09:31:56 2014 -0400 Commit: Brad King CommitDate: Tue Jul 22 09:36:57 2014 -0400 Tests: Set policies in 'complex' tests These tests cover the OLD behavior of some policies. Set them to OLD to avoid warnings in the test output. Leave a comment that explains why this is done here but not recommended in general. diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index 222250c..5e5eead 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -14,6 +14,21 @@ if(POLICY CMP0003) endif() endif() +# It is not recommended to set a policy to OLD, but this test +# covers the OLD behavior of some policies. +foreach(p + CMP0029 + CMP0032 + CMP0033 + CMP0034 + CMP0043 + CMP0050 + ) + if(POLICY ${p}) + cmake_policy(SET ${p} OLD) + endif() +endforeach() + # Test building without per-rule echo lines in Makefiles. set_property(GLOBAL PROPERTY RULE_MESSAGES OFF) diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index 3f17dcc..3b73e70 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -14,6 +14,21 @@ if(POLICY CMP0003) endif() endif() +# It is not recommended to set a policy to OLD, but this test +# covers the OLD behavior of some policies. +foreach(p + CMP0029 + CMP0032 + CMP0033 + CMP0034 + CMP0043 + CMP0050 + ) + if(POLICY ${p}) + cmake_policy(SET ${p} OLD) + endif() +endforeach() + # Test building without per-rule echo lines in Makefiles. set_property(GLOBAL PROPERTY RULE_MESSAGES OFF) ----------------------------------------------------------------------- Summary of changes: Tests/Complex/CMakeLists.txt | 15 +++++++++++++++ Tests/ComplexOneConfig/CMakeLists.txt | 15 +++++++++++++++ 2 files changed, 30 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 22 11:12:58 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 22 Jul 2014 11:12:58 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4431-gc358acd Message-ID: <20140722151258.572A3401D9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via c358acdf20f5bf8367b7eceec6264c5c0463551d (commit) via 80ee17d8a49489816ea4e10f5fe10d300bd8a292 (commit) from ef8ae0c56fc87ddd1b2848f9c54f44f518aca6b9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c358acdf20f5bf8367b7eceec6264c5c0463551d commit c358acdf20f5bf8367b7eceec6264c5c0463551d Merge: ef8ae0c 80ee17d Author: Brad King AuthorDate: Tue Jul 22 11:12:57 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 22 11:12:57 2014 -0400 Merge topic 'fix_guard_malloc_forbc' into next 80ee17d8 Tests/CTestTestMemcheck: Tolerate malloc guard in BC output http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=80ee17d8a49489816ea4e10f5fe10d300bd8a292 commit 80ee17d8a49489816ea4e10f5fe10d300bd8a292 Author: Bill Hoffman AuthorDate: Thu Jul 17 11:32:48 2014 -0400 Commit: Brad King CommitDate: Tue Jul 22 11:13:29 2014 -0400 Tests/CTestTestMemcheck: Tolerate malloc guard in BC output diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index d16d432..f436706 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -225,7 +225,7 @@ set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*${ctest_and_tool_outputs}$") set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES - PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n") + PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n${guard_malloc_lines}\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n") set_tests_properties(CTestTestMemcheckDummyValgrindInvalidSupFile PROPERTIES PASS_REGULAR_EXPRESSION "\nCannot find memory checker suppression file: ${CTEST_ESCAPED_REALPATH_CMAKE_CURRENT_BINARY_DIR}/does-not-exist\n") ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 22 11:14:44 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 22 Jul 2014 11:14:44 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1469-gdbc43eb Message-ID: <20140722151444.A289A45916@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via dbc43eb0f7a776110aad7cc80fdce8c2b044e354 (commit) via 80ee17d8a49489816ea4e10f5fe10d300bd8a292 (commit) from 08bb09a944ecccb5d5f25c847be7b30a70ccf7c4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dbc43eb0f7a776110aad7cc80fdce8c2b044e354 commit dbc43eb0f7a776110aad7cc80fdce8c2b044e354 Merge: 08bb09a 80ee17d Author: Brad King AuthorDate: Tue Jul 22 11:14:43 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 22 11:14:43 2014 -0400 Merge topic 'fix_guard_malloc_forbc' 80ee17d8 Tests/CTestTestMemcheck: Tolerate malloc guard in BC output ----------------------------------------------------------------------- Summary of changes: Tests/CTestTestMemcheck/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 22 11:14:46 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 22 Jul 2014 11:14:46 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1471-g5c38fc1 Message-ID: <20140722151446.47F3745BB4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 5c38fc1628b66ed405d66848e64f17834079d846 (commit) via 5bbec4e3982d25c3514246d691a5b15cacfd5daa (commit) from dbc43eb0f7a776110aad7cc80fdce8c2b044e354 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5c38fc1628b66ed405d66848e64f17834079d846 commit 5c38fc1628b66ed405d66848e64f17834079d846 Merge: dbc43eb 5bbec4e Author: Brad King AuthorDate: Tue Jul 22 11:14:45 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 22 11:14:45 2014 -0400 Merge topic 'deprecated-properties' 5bbec4e3 Help: Document deprecated properties. ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-properties.7.rst | 34 ++++++++++++++++++++++---- Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst | 2 ++ Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst | 2 ++ Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst | 2 ++ 4 files changed, 35 insertions(+), 5 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 22 11:15:06 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 22 Jul 2014 11:15:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4434-g1b19f21 Message-ID: <20140722151506.C6A2745C4A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 1b19f21ccaa452f7da5919fdd16852a5c9f38b19 (commit) via 5c38fc1628b66ed405d66848e64f17834079d846 (commit) via dbc43eb0f7a776110aad7cc80fdce8c2b044e354 (commit) from c358acdf20f5bf8367b7eceec6264c5c0463551d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1b19f21ccaa452f7da5919fdd16852a5c9f38b19 commit 1b19f21ccaa452f7da5919fdd16852a5c9f38b19 Merge: c358acd 5c38fc1 Author: Brad King AuthorDate: Tue Jul 22 11:16:19 2014 -0400 Commit: Brad King CommitDate: Tue Jul 22 11:16:19 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 22 14:52:45 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 22 Jul 2014 14:52:45 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4436-g6e0dc62 Message-ID: <20140722185245.0D19746603@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 6e0dc626547efdd9092218de263c40bbf9e12515 (commit) via 832e150e9d16be0e76a14460468dcbb7ce2e3b4f (commit) from 1b19f21ccaa452f7da5919fdd16852a5c9f38b19 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6e0dc626547efdd9092218de263c40bbf9e12515 commit 6e0dc626547efdd9092218de263c40bbf9e12515 Merge: 1b19f21 832e150 Author: Brad King AuthorDate: Tue Jul 22 14:52:44 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 22 14:52:44 2014 -0400 Merge topic 'file-GENERATE-fixes' into next 832e150e Revert topic 'file-GENERATE-fixes' http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=832e150e9d16be0e76a14460468dcbb7ce2e3b4f commit 832e150e9d16be0e76a14460468dcbb7ce2e3b4f Author: Brad King AuthorDate: Tue Jul 22 14:53:49 2014 -0400 Commit: Brad King CommitDate: Tue Jul 22 14:53:49 2014 -0400 Revert topic 'file-GENERATE-fixes' It will be revised and restored. diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index 49cdba8..f9067cf 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -36,7 +36,7 @@ cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile( //---------------------------------------------------------------------------- void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, cmCompiledGeneratorExpression* inputExpression, - std::map &outputFiles, mode_t perm) + std::map &outputFiles) { std::string rawCondition = this->Condition->GetInput(); if (!rawCondition.empty()) @@ -77,24 +77,17 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, return; } - this->Makefile->AddCMakeOutputFile(outputFileName.c_str()); this->Files.push_back(outputFileName); outputFiles[outputFileName] = outputContent; cmGeneratedFileStream fout(outputFileName.c_str()); fout.SetCopyIfDifferent(true); fout << outputContent; - if (perm) - { - fout.close(); - cmSystemTools::SetPermissions(outputFileName.c_str(), perm); - } } //---------------------------------------------------------------------------- void cmGeneratorExpressionEvaluationFile::Generate() { - mode_t perm = 0; std::string inputContent; if (this->InputIsContent) { @@ -102,9 +95,6 @@ void cmGeneratorExpressionEvaluationFile::Generate() } else { - cmSystemTools::GetPermissions(this->Input.c_str(), perm); - this->Makefile->AddCMakeDependFile(this->Input.c_str()); - cmsys::ifstream fin(this->Input.c_str()); if(!fin) { @@ -141,7 +131,7 @@ void cmGeneratorExpressionEvaluationFile::Generate() for(std::vector::const_iterator li = allConfigs.begin(); li != allConfigs.end(); ++li) { - this->Generate(*li, inputExpression.get(), outputFiles, perm); + this->Generate(*li, inputExpression.get(), outputFiles); if(cmSystemTools::GetFatalErrorOccured()) { return; diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index 4e87a88..f939916 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -34,7 +34,7 @@ public: private: void Generate(const std::string& config, cmCompiledGeneratorExpression* inputExpression, - std::map &outputFiles, mode_t perm); + std::map &outputFiles); private: const std::string Input; diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-result.txt b/Tests/RunCMake/File_Generate/ReRunCMake-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/ReRunCMake-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt b/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt deleted file mode 100644 index 10f3293..0000000 --- a/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/File_Generate/ReRunCMake.cmake b/Tests/RunCMake/File_Generate/ReRunCMake.cmake deleted file mode 100644 index 109d60e..0000000 --- a/Tests/RunCMake/File_Generate/ReRunCMake.cmake +++ /dev/null @@ -1,5 +0,0 @@ - -file(GENERATE - OUTPUT output_file.txt - INPUT "${CMAKE_CURRENT_BINARY_DIR}/input_file.txt" -) diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index 5752459..dee0692 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -35,32 +35,3 @@ unset(RunCMake_TEST_NO_CLEAN) if (NOT timestamp_after STREQUAL timestamp) message(SEND_ERROR "WriteIfDifferent changed output file.") endif() - -file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/ReRunCMake-build/") -file(WRITE "${RunCMake_BINARY_DIR}/ReRunCMake-build/input_file.txt" "InitialContent\n") - -set(RunCMake_TEST_NO_CLEAN ON) -run_cmake(ReRunCMake) -unset(RunCMake_TEST_NO_CLEAN) -file(TIMESTAMP "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt" timestamp ${timeformat}) -if(NOT timestamp) - message(SEND_ERROR "Could not get timestamp for \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"") -endif() - -execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) - -file(WRITE "${RunCMake_BINARY_DIR}/ReRunCMake-build/input_file.txt" "ChangedContent\n") -execute_process(COMMAND ${CMAKE_COMMAND} --build "${RunCMake_BINARY_DIR}/ReRunCMake-build/") -file(READ "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt" out_content) - -if(NOT out_content STREQUAL "ChangedContent\n") - message(SEND_ERROR "File did not change: \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"") -endif() - - -file(REMOVE "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt") -execute_process(COMMAND ${CMAKE_COMMAND} --build "${RunCMake_BINARY_DIR}/ReRunCMake-build/") - -if (NOT EXISTS "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt") - message(SEND_ERROR "File did not re-generate: \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"") -endif() ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpressionEvaluationFile.cxx | 14 ++-------- Source/cmGeneratorExpressionEvaluationFile.h | 2 +- Tests/RunCMake/File_Generate/ReRunCMake-result.txt | 1 - Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt | 1 - Tests/RunCMake/File_Generate/ReRunCMake.cmake | 5 ---- Tests/RunCMake/File_Generate/RunCMakeTest.cmake | 29 -------------------- 6 files changed, 3 insertions(+), 49 deletions(-) delete mode 100644 Tests/RunCMake/File_Generate/ReRunCMake-result.txt delete mode 100644 Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt delete mode 100644 Tests/RunCMake/File_Generate/ReRunCMake.cmake hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 22 15:12:23 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 22 Jul 2014 15:12:23 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4438-g31f74a7 Message-ID: <20140722191223.DACAC45C8C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 31f74a71b7ddb9de0829ed717a83422a23aaeb76 (commit) via f5c0efdbe4d67a6f262dd670923674b003af1726 (commit) from 6e0dc626547efdd9092218de263c40bbf9e12515 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=31f74a71b7ddb9de0829ed717a83422a23aaeb76 commit 31f74a71b7ddb9de0829ed717a83422a23aaeb76 Merge: 6e0dc62 f5c0efd Author: Brad King AuthorDate: Tue Jul 22 15:12:22 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 22 15:12:22 2014 -0400 Merge topic 'refactor-generator-startup' into next f5c0efdb cmGlobalGenerator: Create a non-virtual 'DoGenerate' method http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f5c0efdbe4d67a6f262dd670923674b003af1726 commit f5c0efdbe4d67a6f262dd670923674b003af1726 Author: Brad King AuthorDate: Tue Jul 22 15:01:05 2014 -0400 Commit: Brad King CommitDate: Tue Jul 22 15:05:36 2014 -0400 cmGlobalGenerator: Create a non-virtual 'DoGenerate' method Make the virtual 'Generate' method protected. Make 'DoGenerate' the main entry point to generation. This gives cmGlobalGenerator a chance to do some early operations before the individual generator-specific implementations take over. diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 6d737b1..ae6861e 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1153,7 +1153,7 @@ bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const return false; } -void cmGlobalGenerator::Generate() +void cmGlobalGenerator::DoGenerate() { // Some generators track files replaced during the Generate. // Start with an empty vector: @@ -1162,6 +1162,11 @@ void cmGlobalGenerator::Generate() // clear targets to issue warning CMP0042 for this->CMP0042WarnTargets.clear(); + this->Generate(); +} + +void cmGlobalGenerator::Generate() +{ // Check whether this generator is allowed to run. if(!this->CheckALLOW_DUPLICATE_CUSTOM_TARGETS()) { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index ee3f269..6b608bb 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -80,7 +80,7 @@ public: * basically creates a series of LocalGenerators for each directory and * requests that they Generate. */ - virtual void Generate(); + void DoGenerate(); /** * Set/Get and Clear the enabled languages. @@ -338,6 +338,8 @@ public: bool GenerateCPackPropertiesFile(); protected: + virtual void Generate(); + typedef std::vector GeneratorVector; // for a project collect all its targets by following depend // information, and also collect all the targets diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index ff110d7..4cbbeea 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -182,9 +182,6 @@ public: /// Overloaded methods. @see cmGlobalGenerator::GetDocumentation() static void GetDocumentation(cmDocumentationEntry& entry); - /// Overloaded methods. @see cmGlobalGenerator::Generate() - virtual void Generate(); - /// Overloaded methods. @see cmGlobalGenerator::EnableLanguage() virtual void EnableLanguage(std::vectorconst& languages, cmMakefile* mf, @@ -302,6 +299,9 @@ public: virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; protected: + /// Overloaded methods. @see cmGlobalGenerator::Generate() + virtual void Generate(); + /// Overloaded methods. /// @see cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const { return true; } diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index cb639dd..9f154e9 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -47,8 +47,6 @@ public: ///! create the correct local generator virtual cmLocalGenerator *CreateLocalGenerator(); - virtual void Generate(); - /** * Try to determine system infomation such as shared library * extension, pthreads, byte order etc. @@ -93,6 +91,8 @@ public: virtual void FindMakeProgram(cmMakefile*); protected: + virtual void Generate(); + virtual const char* GetIDEVersion() { return "10.0"; } std::string const& GetMSBuildCommand(); diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index b2fd28f..57c2660 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -64,13 +64,6 @@ public: ); /** - * Generate the all required files for building this project/tree. This - * basically creates a series of LocalGenerators for each directory and - * requests that they Generate. - */ - virtual void Generate(); - - /** * Generate the DSW workspace file. */ virtual void OutputDSWFile(); @@ -94,6 +87,7 @@ public: virtual bool IsForVS6() const { return true; } protected: + virtual void Generate(); virtual const char* GetIDEVersion() { return "6.0"; } private: virtual std::string GetVSMakeProgram() { return this->GetMSDevCommand(); } diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index bd84433..390b97c 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -72,13 +72,6 @@ public: ); /** - * Generate the all required files for building this project/tree. This - * basically creates a series of LocalGenerators for each directory and - * requests that they Generate. - */ - virtual void Generate(); - - /** * Generate the DSW workspace file. */ virtual void OutputSLNFile(); @@ -113,6 +106,7 @@ public: virtual std::string Encoding(); protected: + virtual void Generate(); virtual const char* GetIDEVersion() { return "7.0"; } std::string const& GetDevEnvCommand(); diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index aea2f01..d7e1f3a 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -45,7 +45,6 @@ public: * target. */ virtual void Configure(); - virtual void Generate(); /** * Where does this version of Visual Studio look for macros for the @@ -69,6 +68,7 @@ public: return !this->WindowsCEVersion.empty(); } protected: + virtual void Generate(); virtual const char* GetIDEVersion() { return "8.0"; } virtual std::string FindDevEnvCommand(); diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 05dbb11..356f4d4 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -27,11 +27,6 @@ public: virtual ~cmGlobalVisualStudioGenerator(); /** - * Basic generate implementation for all VS generators. - */ - virtual void Generate(); - - /** * Configure CMake's Visual Studio macros file into the user's Visual * Studio macros directory. */ @@ -90,6 +85,8 @@ public: void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; protected: + virtual void Generate(); + // Does this VS version link targets to each other if there are // dependencies in the SLN file? This was done for VS versions // below 8. diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index ae23e3b..fcdd349 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -64,13 +64,6 @@ public: std::vector const& makeOptions = std::vector() ); - /** - * Generate the all required files for building this project/tree. This - * basically creates a series of LocalGenerators for each directory and - * requests that they Generate. - */ - virtual void Generate(); - /** Append the subdirectory for the given configuration. */ virtual void AppendDirectoryForConfig(const std::string& prefix, const std::string& config, @@ -91,6 +84,8 @@ public: virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); void AppendFlag(std::string& flags, std::string const& flag); +protected: + virtual void Generate(); private: cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget, cmSourceGroup* sg); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index a051c87..5aa1ab0 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1715,7 +1715,7 @@ int cmake::Generate() { return -1; } - this->GlobalGenerator->Generate(); + this->GlobalGenerator->DoGenerate(); if ( !this->GraphVizFile.empty() ) { std::cout << "Generate graphviz: " << this->GraphVizFile << std::endl; ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalGenerator.cxx | 7 ++++++- Source/cmGlobalGenerator.h | 4 +++- Source/cmGlobalNinjaGenerator.h | 6 +++--- Source/cmGlobalVisualStudio10Generator.h | 4 ++-- Source/cmGlobalVisualStudio6Generator.h | 8 +------- Source/cmGlobalVisualStudio7Generator.h | 8 +------- Source/cmGlobalVisualStudio8Generator.h | 2 +- Source/cmGlobalVisualStudioGenerator.h | 7 ++----- Source/cmGlobalXCodeGenerator.h | 9 ++------- Source/cmake.cxx | 2 +- 10 files changed, 22 insertions(+), 35 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 22 15:36:33 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 22 Jul 2014 15:36:33 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4443-geb4594d Message-ID: <20140722193633.E9EBD470B2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via eb4594dca202769dc583ea12579fef626295a572 (commit) via 848fab9575271f41c9632086011af4c4560702e3 (commit) via 85cea8a7af77cd482f4d3c7ec15f68bc5adeb0ba (commit) via e7ee892b391992e0e8198917b8ef5cce76da2fd1 (commit) via 9f92a78be21a7f126f1776d481cc4bd2acdf4a1b (commit) from 31f74a71b7ddb9de0829ed717a83422a23aaeb76 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eb4594dca202769dc583ea12579fef626295a572 commit eb4594dca202769dc583ea12579fef626295a572 Merge: 31f74a7 848fab9 Author: Brad King AuthorDate: Tue Jul 22 15:36:32 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 22 15:36:32 2014 -0400 Merge topic 'refactor-makerule-path-conversion' into next 848fab95 cmGlobalVisualStudio7Generator: Remove unused variable 85cea8a7 cmDepends: Refactor object file path conversion e7ee892b cmLocalGenerator: Fix AddBuildTargetRule object file path conversion 9f92a78b cmLocalGenerator: Rename 'MAKEFILE' to 'MAKERULE' http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=848fab9575271f41c9632086011af4c4560702e3 commit 848fab9575271f41c9632086011af4c4560702e3 Author: Brad King AuthorDate: Tue Jul 22 13:10:14 2014 -0400 Commit: Brad King CommitDate: Tue Jul 22 15:24:57 2014 -0400 cmGlobalVisualStudio7Generator: Remove unused variable diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 602d678..3d79357 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -773,7 +773,6 @@ void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout, const char* typeGuid, const std::set&) { - std::string d = cmSystemTools::ConvertToOutputPath(location); fout << "Project(" << "\"{" << (typeGuid ? typeGuid : this->ExternalProjectType(location)) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=85cea8a7af77cd482f4d3c7ec15f68bc5adeb0ba commit 85cea8a7af77cd482f4d3c7ec15f68bc5adeb0ba Author: Brad King AuthorDate: Tue Jul 22 12:50:37 2014 -0400 Commit: Brad King CommitDate: Tue Jul 22 15:24:57 2014 -0400 cmDepends: Refactor object file path conversion Delay conversion of the path to object files (on the left-hand side of dependencies) until just before they are written. Also do not convert the format of paths written to the 'depend.internal' file. This is consistent with the way the right-hand side of dependencies are already handled. diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index cdc480c..134f45b 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -58,12 +58,7 @@ bool cmDepends::Write(std::ostream &makeDepends, // Get the source and object file. std::string const& src = *si++; if(si == pairs.end()) { break; } - std::string obj = *si++; - - // Make sure the object file is relative to the top of the build tree. - obj = this->LocalGenerator->Convert(obj, - cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKERULE); + std::string const& obj = *si++; dependencies[obj].insert(src); } for(std::map >::const_iterator diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index dd239c4..a1fc268 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -269,11 +269,17 @@ bool cmDependsC::WriteDependencies(const std::set& sources, // written by the original local generator for this directory // convert the dependencies to paths relative to the home output // directory. We must do the same here. - internalDepends << obj << std::endl; + std::string obj_i = + this->LocalGenerator->Convert(obj, cmLocalGenerator::HOME_OUTPUT); + std::string obj_m = + this->LocalGenerator->ConvertToOutputFormat(obj_i, + cmLocalGenerator::MAKERULE); + internalDepends << obj_i << std::endl; + for(std::set::const_iterator i=dependencies.begin(); i != dependencies.end(); ++i) { - makeDepends << obj << ": " << + makeDepends << obj_m << ": " << this->LocalGenerator->Convert(*i, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE) diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index b1d55f3..8fc8347 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -443,12 +443,17 @@ cmDependsFortran const char* src = info.Source.c_str(); // Write the include dependencies to the output stream. - internalDepends << obj << std::endl; + std::string obj_i = + this->LocalGenerator->Convert(obj, cmLocalGenerator::HOME_OUTPUT); + std::string obj_m = + this->LocalGenerator->ConvertToOutputFormat(obj_i, + cmLocalGenerator::MAKERULE); + internalDepends << obj_i << std::endl; internalDepends << " " << src << std::endl; for(std::set::const_iterator i = info.Includes.begin(); i != info.Includes.end(); ++i) { - makeDepends << obj << ": " << + makeDepends << obj_m << ": " << this->LocalGenerator->Convert(*i, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE) @@ -485,7 +490,7 @@ cmDependsFortran cmLocalGenerator::MAKERULE); // since we require some things add them to our list of requirements - makeDepends << obj << ".requires: " << proxy << std::endl; + makeDepends << obj_m << ".requires: " << proxy << std::endl; } // The object file should depend on timestamped files for the @@ -500,7 +505,7 @@ cmDependsFortran this->LocalGenerator->Convert(required->second, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE); - makeDepends << obj << ": " << stampFile << "\n"; + makeDepends << obj_m << ": " << stampFile << "\n"; } else { @@ -513,7 +518,7 @@ cmDependsFortran this->LocalGenerator->Convert(module, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE); - makeDepends << obj << ": " << module << "\n"; + makeDepends << obj_m << ": " << module << "\n"; } } } @@ -529,7 +534,7 @@ cmDependsFortran proxy = this->LocalGenerator->Convert(proxy, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE); - makeDepends << proxy << ": " << obj << ".provides" << std::endl; + makeDepends << proxy << ": " << obj_m << ".provides" << std::endl; } // If any modules are provided then they must be converted to stamp files. @@ -537,7 +542,7 @@ cmDependsFortran { // Create a target to copy the module after the object file // changes. - makeDepends << obj << ".provides.build:\n"; + makeDepends << obj_m << ".provides.build:\n"; for(std::set::const_iterator i = info.Provides.begin(); i != info.Provides.end(); ++i) { @@ -575,7 +580,7 @@ cmDependsFortran } // After copying the modules update the timestamp file so that // copying will not be done again until the source rebuilds. - makeDepends << "\t$(CMAKE_COMMAND) -E touch " << obj + makeDepends << "\t$(CMAKE_COMMAND) -E touch " << obj_m << ".provides.build\n"; // Make sure the module timestamp rule is evaluated by the time @@ -585,7 +590,7 @@ cmDependsFortran driver = this->LocalGenerator->Convert(driver, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE); - makeDepends << driver << ": " << obj << ".provides.build\n"; + makeDepends << driver << ": " << obj_m << ".provides.build\n"; } return true; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e7ee892b391992e0e8198917b8ef5cce76da2fd1 commit e7ee892b391992e0e8198917b8ef5cce76da2fd1 Author: Brad King AuthorDate: Tue Jul 22 12:38:08 2014 -0400 Commit: Brad King CommitDate: Tue Jul 22 12:38:08 2014 -0400 cmLocalGenerator: Fix AddBuildTargetRule object file path conversion The object file list is constructed for a shell, not a Makefile rule. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index d2652f7..4bd9191 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -681,7 +681,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, objVector.push_back(ofname); this->AddCustomCommandToCreateObject(ofname.c_str(), llang, *(*i), target); - objs += this->Convert(ofname,START_OUTPUT,MAKERULE); + objs += this->Convert(ofname,START_OUTPUT,SHELL); objs += " "; } } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9f92a78be21a7f126f1776d481cc4bd2acdf4a1b commit 9f92a78be21a7f126f1776d481cc4bd2acdf4a1b Author: Brad King AuthorDate: Tue Jul 22 12:27:57 2014 -0400 Commit: Brad King CommitDate: Tue Jul 22 12:27:57 2014 -0400 cmLocalGenerator: Rename 'MAKEFILE' to 'MAKERULE' Rename the internal enumeration value for converting paths destined for use in Makefile rule syntax. diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 50a395e..cdc480c 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -63,7 +63,7 @@ bool cmDepends::Write(std::ostream &makeDepends, // Make sure the object file is relative to the top of the build tree. obj = this->LocalGenerator->Convert(obj, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE); + cmLocalGenerator::MAKERULE); dependencies[obj].insert(src); } for(std::map >::const_iterator diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index d26d3a9..dd239c4 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -276,7 +276,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, makeDepends << obj << ": " << this->LocalGenerator->Convert(*i, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE) + cmLocalGenerator::MAKERULE) << std::endl; internalDepends << " " << *i << std::endl; } diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index f06971d..b1d55f3 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -451,7 +451,7 @@ cmDependsFortran makeDepends << obj << ": " << this->LocalGenerator->Convert(*i, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE) + cmLocalGenerator::MAKERULE) << std::endl; internalDepends << " " << *i << std::endl; } @@ -482,7 +482,7 @@ cmDependsFortran proxy += ".mod.proxy"; proxy = this->LocalGenerator->Convert(proxy, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE); + cmLocalGenerator::MAKERULE); // since we require some things add them to our list of requirements makeDepends << obj << ".requires: " << proxy << std::endl; @@ -499,7 +499,7 @@ cmDependsFortran std::string stampFile = this->LocalGenerator->Convert(required->second, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE); + cmLocalGenerator::MAKERULE); makeDepends << obj << ": " << stampFile << "\n"; } else @@ -512,7 +512,7 @@ cmDependsFortran module = this->LocalGenerator->Convert(module, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE); + cmLocalGenerator::MAKERULE); makeDepends << obj << ": " << module << "\n"; } } @@ -528,7 +528,7 @@ cmDependsFortran proxy += ".mod.proxy"; proxy = this->LocalGenerator->Convert(proxy, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE); + cmLocalGenerator::MAKERULE); makeDepends << proxy << ": " << obj << ".provides" << std::endl; } @@ -584,7 +584,7 @@ cmDependsFortran driver += "/build"; driver = this->LocalGenerator->Convert(driver, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE); + cmLocalGenerator::MAKERULE); makeDepends << driver << ": " << obj << ".provides.build\n"; } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 8dae81b..3478534 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -530,7 +530,7 @@ cmGlobalUnixMakefileGenerator3 // Begin the directory-level rules section. std::string dir = lg->GetMakefile()->GetStartOutputDirectory(); dir = lg->Convert(dir, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE); + cmLocalGenerator::MAKERULE); lg->WriteDivider(ruleFileStream); ruleFileStream << "# Directory level rules for directory " diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 5380d06..d2652f7 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -681,7 +681,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, objVector.push_back(ofname); this->AddCustomCommandToCreateObject(ofname.c_str(), llang, *(*i), target); - objs += this->Convert(ofname,START_OUTPUT,MAKEFILE); + objs += this->Convert(ofname,START_OUTPUT,MAKERULE); objs += " "; } } @@ -2755,7 +2755,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, { std::string result = source; // Convert it to an output path. - if (output == MAKEFILE) + if (output == MAKERULE) { result = cmSystemTools::ConvertToOutputPath(result.c_str()); } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index ad73073..b25b9ab 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -106,7 +106,7 @@ public: * path setting */ enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT }; - enum OutputFormat { UNCHANGED, MAKEFILE, SHELL, WATCOMQUOTE, RESPONSE }; + enum OutputFormat { UNCHANGED, MAKERULE, SHELL, WATCOMQUOTE, RESPONSE }; std::string ConvertToOutputFormat(const std::string& source, OutputFormat output); std::string Convert(const std::string& remote, RelativeRoot local, diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 94e45e5..23513fa 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -630,7 +630,7 @@ cmLocalUnixMakefileGenerator3 // Construct the left hand side of the rule. replace = target; - std::string tgt = this->Convert(replace,HOME_OUTPUT,MAKEFILE); + std::string tgt = this->Convert(replace,HOME_OUTPUT,MAKERULE); const char* space = ""; if(tgt.size() == 1) { @@ -663,7 +663,7 @@ cmLocalUnixMakefileGenerator3 dep != depends.end(); ++dep) { replace = *dep; - replace = this->Convert(replace,HOME_OUTPUT,MAKEFILE); + replace = this->Convert(replace,HOME_OUTPUT,MAKERULE); os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n"; } } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 403f6e6..758c8e4 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -218,7 +218,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() << this->LocalGenerator->IncludeDirective << " " << root << this->Convert(dependFileNameFull, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE) + cmLocalGenerator::MAKERULE) << "\n\n"; if(!this->NoRuleMessages) @@ -229,7 +229,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() << this->LocalGenerator->IncludeDirective << " " << root << this->Convert(this->ProgressFileNameFull, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE) + cmLocalGenerator::MAKERULE) << "\n\n"; } @@ -262,7 +262,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() << this->LocalGenerator->IncludeDirective << " " << root << this->Convert(this->FlagFileNameFull, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE) + cmLocalGenerator::MAKERULE) << "\n\n"; } diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index 6b039bb..617214f 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -54,7 +54,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles() << this->LocalGenerator->IncludeDirective << " " << root << this->Convert(this->ProgressFileNameFull, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE) + cmLocalGenerator::MAKERULE) << "\n\n"; } ----------------------------------------------------------------------- Summary of changes: Source/cmDepends.cxx | 7 +----- Source/cmDependsC.cxx | 12 ++++++--- Source/cmDependsFortran.cxx | 35 +++++++++++++++------------ Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 1 - Source/cmLocalGenerator.cxx | 4 +-- Source/cmLocalGenerator.h | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 4 +-- Source/cmMakefileTargetGenerator.cxx | 6 ++--- Source/cmMakefileUtilityTargetGenerator.cxx | 2 +- 10 files changed, 40 insertions(+), 35 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jul 23 00:01:11 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 23 Jul 2014 00:01:11 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1472-g3e3ab2a Message-ID: <20140723040111.415CD46FF0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 3e3ab2adb4a70352a41b469788a2885b20a86fef (commit) from 5c38fc1628b66ed405d66848e64f17834079d846 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3e3ab2adb4a70352a41b469788a2885b20a86fef commit 3e3ab2adb4a70352a41b469788a2885b20a86fef Author: Kitware Robot AuthorDate: Wed Jul 23 00:01:09 2014 -0400 Commit: Kitware Robot CommitDate: Wed Jul 23 00:01:09 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 44737b8..2d17cbe 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140722) +set(CMake_VERSION_PATCH 20140723) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 23 09:44:31 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 23 Jul 2014 09:44:31 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1474-ga263cab Message-ID: <20140723134431.1F85946D3F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a263cab6c22ecfdd18ed592b9efb2d8a8c505852 (commit) via fb95f820e06eb1933a7d3b71bc46eed4d5d25ee6 (commit) from 3e3ab2adb4a70352a41b469788a2885b20a86fef (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a263cab6c22ecfdd18ed592b9efb2d8a8c505852 commit a263cab6c22ecfdd18ed592b9efb2d8a8c505852 Merge: 3e3ab2a fb95f82 Author: Brad King AuthorDate: Wed Jul 23 09:44:29 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 23 09:44:29 2014 -0400 Merge topic 'fix-complex-test-policies' fb95f820 Tests: Set policies in 'complex' tests ----------------------------------------------------------------------- Summary of changes: Tests/Complex/CMakeLists.txt | 15 +++++++++++++++ Tests/ComplexOneConfig/CMakeLists.txt | 15 +++++++++++++++ 2 files changed, 30 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 23 09:44:33 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 23 Jul 2014 09:44:33 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1476-gea3e544 Message-ID: <20140723134433.2565246D51@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via ea3e544098232edcaddf11c5fee5819256c92936 (commit) via f7d62cac79f856c9c7b634ed7f5d2f6030b7ba76 (commit) from a263cab6c22ecfdd18ed592b9efb2d8a8c505852 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ea3e544098232edcaddf11c5fee5819256c92936 commit ea3e544098232edcaddf11c5fee5819256c92936 Merge: a263cab f7d62ca Author: Brad King AuthorDate: Wed Jul 23 09:44:32 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 23 09:44:32 2014 -0400 Merge topic 'fix_sanitizer_test_to_work_with_sanitizer' f7d62cac Fix leak and address sanitizer tests to be able to run with real tools. ----------------------------------------------------------------------- Summary of changes: Tests/CTestTestMemcheck/CMakeLists.txt | 4 ++-- Tests/CTestTestMemcheck/testAddressSanitizer.cmake | 4 ++++ Tests/CTestTestMemcheck/testLeakSanitizer.cmake | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 23 09:44:35 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 23 Jul 2014 09:44:35 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1478-g91d2151 Message-ID: <20140723134435.1C5DD46D51@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 91d21518ae652089dd94a3c9d09e5e800ab0dd6b (commit) via f5c0efdbe4d67a6f262dd670923674b003af1726 (commit) from ea3e544098232edcaddf11c5fee5819256c92936 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=91d21518ae652089dd94a3c9d09e5e800ab0dd6b commit 91d21518ae652089dd94a3c9d09e5e800ab0dd6b Merge: ea3e544 f5c0efd Author: Brad King AuthorDate: Wed Jul 23 09:44:34 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 23 09:44:34 2014 -0400 Merge topic 'refactor-generator-startup' f5c0efdb cmGlobalGenerator: Create a non-virtual 'DoGenerate' method ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalGenerator.cxx | 7 ++++++- Source/cmGlobalGenerator.h | 4 +++- Source/cmGlobalNinjaGenerator.h | 6 +++--- Source/cmGlobalVisualStudio10Generator.h | 4 ++-- Source/cmGlobalVisualStudio6Generator.h | 8 +------- Source/cmGlobalVisualStudio7Generator.h | 8 +------- Source/cmGlobalVisualStudio8Generator.h | 2 +- Source/cmGlobalVisualStudioGenerator.h | 7 ++----- Source/cmGlobalXCodeGenerator.h | 9 ++------- Source/cmake.cxx | 2 +- 10 files changed, 22 insertions(+), 35 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 23 09:44:37 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 23 Jul 2014 09:44:37 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1483-gfe4e6ed Message-ID: <20140723134437.0D21C46D57@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via fe4e6ed991b936e147536832bbf7190f05887814 (commit) via 848fab9575271f41c9632086011af4c4560702e3 (commit) via 85cea8a7af77cd482f4d3c7ec15f68bc5adeb0ba (commit) via e7ee892b391992e0e8198917b8ef5cce76da2fd1 (commit) via 9f92a78be21a7f126f1776d481cc4bd2acdf4a1b (commit) from 91d21518ae652089dd94a3c9d09e5e800ab0dd6b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fe4e6ed991b936e147536832bbf7190f05887814 commit fe4e6ed991b936e147536832bbf7190f05887814 Merge: 91d2151 848fab9 Author: Brad King AuthorDate: Wed Jul 23 09:44:35 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 23 09:44:35 2014 -0400 Merge topic 'refactor-makerule-path-conversion' 848fab95 cmGlobalVisualStudio7Generator: Remove unused variable 85cea8a7 cmDepends: Refactor object file path conversion e7ee892b cmLocalGenerator: Fix AddBuildTargetRule object file path conversion 9f92a78b cmLocalGenerator: Rename 'MAKEFILE' to 'MAKERULE' ----------------------------------------------------------------------- Summary of changes: Source/cmDepends.cxx | 7 +----- Source/cmDependsC.cxx | 12 ++++++--- Source/cmDependsFortran.cxx | 35 +++++++++++++++------------ Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 1 - Source/cmLocalGenerator.cxx | 4 +-- Source/cmLocalGenerator.h | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 4 +-- Source/cmMakefileTargetGenerator.cxx | 6 ++--- Source/cmMakefileUtilityTargetGenerator.cxx | 2 +- 10 files changed, 40 insertions(+), 35 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 23 09:45:02 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 23 Jul 2014 09:45:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4449-g1b15ba0 Message-ID: <20140723134502.72B8F46D9A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 1b15ba06c301bffb0a1c8ea0bb38618ba7f07f45 (commit) via fe4e6ed991b936e147536832bbf7190f05887814 (commit) via 91d21518ae652089dd94a3c9d09e5e800ab0dd6b (commit) via ea3e544098232edcaddf11c5fee5819256c92936 (commit) via a263cab6c22ecfdd18ed592b9efb2d8a8c505852 (commit) via 3e3ab2adb4a70352a41b469788a2885b20a86fef (commit) from eb4594dca202769dc583ea12579fef626295a572 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1b15ba06c301bffb0a1c8ea0bb38618ba7f07f45 commit 1b15ba06c301bffb0a1c8ea0bb38618ba7f07f45 Merge: eb4594d fe4e6ed Author: Brad King AuthorDate: Wed Jul 23 09:46:15 2014 -0400 Commit: Brad King CommitDate: Wed Jul 23 09:46:15 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 23 10:36:41 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 23 Jul 2014 10:36:41 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4459-gc8bae9b Message-ID: <20140723143641.EBCA647D7D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via c8bae9bacafb95d99f9ebfacf8fdfedbbaf56760 (commit) via 2e45b40f95f43e636f13a464412073a36dfae830 (commit) via 7ee8515727ca208f766d56719e1c921898233756 (commit) via 0430e5dde5dfba13f0ff0e7e41438aeade97df4f (commit) via b2a07ca49c66665f5b51b592f44ecc4f66c7556b (commit) via d44ad1612bfe01891bb16b4289f5fa5a2e29a546 (commit) via a53caea3b6609f94063dfc21cbdf5361e9145040 (commit) via 133d42fe59e2f15610afaed287ef80ec4ff6f888 (commit) via c289e63491982dd8aed7c6b6f54d390df91aaf95 (commit) via 8510533f0e713abeedf53a737c702d683b636ecb (commit) from 1b15ba06c301bffb0a1c8ea0bb38618ba7f07f45 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c8bae9bacafb95d99f9ebfacf8fdfedbbaf56760 commit c8bae9bacafb95d99f9ebfacf8fdfedbbaf56760 Merge: 1b15ba0 2e45b40 Author: Brad King AuthorDate: Wed Jul 23 10:36:32 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 23 10:36:32 2014 -0400 Merge topic 'add-liblzma' into next 2e45b40f CMake: Enable use of liblzma in libarchive (#14504) 7ee85157 liblzma: Port to VS 6 0430e5dd liblzma: Port from C99 to C89/90 b2a07ca4 liblzma: Add CMake build system d44ad161 liblzma: Remove unused Makefile.* files a53caea3 liblzma: Add README-CMake.txt 133d42fe Merge branch 'liblzma-upstream' into add-liblzma c289e634 liblzma 5.0.5-gb69900ed (reduced) 8510533f liblzma: Add .gitattributes to ignore whitespace checks http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2e45b40f95f43e636f13a464412073a36dfae830 commit 2e45b40f95f43e636f13a464412073a36dfae830 Author: Daniel Pfeifer AuthorDate: Sun Jul 13 22:23:22 2014 +0200 Commit: Brad King CommitDate: Wed Jul 23 10:34:56 2014 -0400 CMake: Enable use of liblzma in libarchive (#14504) Build liblzma as part of CMake or find one on the system. Modify our port of libarchive to use the liblzma configured for use with CMake. diff --git a/CMakeLists.txt b/CMakeLists.txt index e210f74..54aad83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,7 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES) # Allow the user to enable/disable all system utility library options by # defining CMAKE_USE_SYSTEM_LIBRARIES or CMAKE_USE_SYSTEM_LIBRARY_${util}. - set(UTILITIES BZIP2 CURL EXPAT LIBARCHIVE ZLIB) + set(UTILITIES BZIP2 CURL EXPAT LIBARCHIVE LIBLZMA ZLIB) foreach(util ${UTILITIES}) if(NOT DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util} AND DEFINED CMAKE_USE_SYSTEM_LIBRARIES) @@ -93,6 +93,8 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES) "${CMAKE_USE_SYSTEM_LIBRARY_ZLIB}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE;NOT CMAKE_USE_SYSTEM_CURL" ON) CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_BZIP2 "Use system-installed bzip2" "${CMAKE_USE_SYSTEM_LIBRARY_BZIP2}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON) + CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_LIBLZMA "Use system-installed liblzma" + "${CMAKE_USE_SYSTEM_LIBRARY_LIBLZMA}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON) # Mention to the user what system libraries are being used. foreach(util ${UTILITIES}) @@ -301,6 +303,23 @@ macro (CMAKE_BUILD_UTILITIES) endif() #--------------------------------------------------------------------- + # Build or use system liblzma for libarchive. + if(CMAKE_USE_SYSTEM_LIBLZMA) + find_package(LibLZMA) + if(NOT LIBLZMA_FOUND) + message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBLZMA is ON but LibLZMA is not found!") + endif() + set(LZMA_INCLUDE_DIR ${LIBLZMA_INCLUDE_DIRS}) + set(LZMA_LIBRARY ${LIBLZMA_LIBRARIES}) + else() + add_subdirectory(Utilities/cmliblzma) + CMAKE_SET_TARGET_FOLDER(cmliblzma "Utilities/3rdParty") + set(LZMA_INCLUDE_DIR + "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmliblzma/liblzma/api") + set(LZMA_LIBRARY cmliblzma) + endif() + + #--------------------------------------------------------------------- # Build or use system libarchive for CMake and CTest. if(CMAKE_USE_SYSTEM_LIBARCHIVE) find_package(LibArchive) @@ -315,7 +334,7 @@ macro (CMAKE_BUILD_UTILITIES) add_definitions(-DLIBARCHIVE_STATIC) set(ENABLE_NETTLE OFF CACHE INTERNAL "Enable use of Nettle") set(ENABLE_OPENSSL ${CMAKE_USE_OPENSSL} CACHE INTERNAL "Enable use of OpenSSL") - set(ENABLE_LZMA OFF CACHE INTERNAL "Enable the use of the system found LZMA library if found") + set(ENABLE_LZMA ON CACHE INTERNAL "Enable the use of the system found LZMA library if found") set(ENABLE_ZLIB ON CACHE INTERNAL "Enable the use of the system found ZLIB library if found") set(ENABLE_BZip2 ON CACHE INTERNAL "Enable the use of the system found BZip2 library if found") set(ENABLE_EXPAT OFF CACHE INTERNAL "Enable the use of the system found EXPAT library if found") diff --git a/Utilities/cmThirdParty.h.in b/Utilities/cmThirdParty.h.in index c824085..b0b5779 100644 --- a/Utilities/cmThirdParty.h.in +++ b/Utilities/cmThirdParty.h.in @@ -18,6 +18,7 @@ #cmakedefine CMAKE_USE_SYSTEM_ZLIB #cmakedefine CMAKE_USE_SYSTEM_BZIP2 #cmakedefine CMAKE_USE_SYSTEM_LIBARCHIVE +#cmakedefine CMAKE_USE_SYSTEM_LIBLZMA #cmakedefine CTEST_USE_XMLRPC #endif diff --git a/Utilities/cmThirdParty.h.in b/Utilities/cm_lzma.h similarity index 57% copy from Utilities/cmThirdParty.h.in copy to Utilities/cm_lzma.h index c824085..c11c916 100644 --- a/Utilities/cmThirdParty.h.in +++ b/Utilities/cm_lzma.h @@ -1,6 +1,6 @@ /*============================================================================ CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + Copyright 2014 Kitware, Inc., Insight Software Consortium Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. @@ -9,15 +9,15 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef __cmThirdParty_h -#define __cmThirdParty_h +#ifndef __cm_lzma_h +#define __cm_lzma_h -/* Whether CMake is using its own utility libraries. */ -#cmakedefine CMAKE_USE_SYSTEM_CURL -#cmakedefine CMAKE_USE_SYSTEM_EXPAT -#cmakedefine CMAKE_USE_SYSTEM_ZLIB -#cmakedefine CMAKE_USE_SYSTEM_BZIP2 -#cmakedefine CMAKE_USE_SYSTEM_LIBARCHIVE -#cmakedefine CTEST_USE_XMLRPC +/* Use the liblzma configured for CMake. */ +#include "cmThirdParty.h" +#ifdef CMAKE_USE_SYSTEM_LIBLZMA +# include +#else +# include +#endif #endif diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt index 9b1533d..87a9c3f 100644 --- a/Utilities/cmlibarchive/CMakeLists.txt +++ b/Utilities/cmlibarchive/CMakeLists.txt @@ -275,7 +275,6 @@ IF(BZIP2_FOUND) ENDIF(BZIP2_FOUND) MARK_AS_ADVANCED(CLEAR BZIP2_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR BZIP2_LIBRARIES) -IF(0) # CMake does not need LZMA or LZO2 support in libarchive # # Find LZMA # @@ -291,15 +290,19 @@ IF(LZMA_FOUND) SET(HAVE_LZMA_H 1) INCLUDE_DIRECTORIES(${LZMA_INCLUDE_DIR}) LIST(APPEND ADDITIONAL_LIBS ${LZMA_LIBRARIES}) - # Test if a macro is needed for the library. - TRY_MACRO_FOR_LIBRARY( - "${LZMA_INCLUDE_DIR}" "${LZMA_LIBRARIES}" - COMPILES - "#include \nint main() {return (int)lzma_version_number(); }" - "WITHOUT_LZMA_API_STATIC;LZMA_API_STATIC") - IF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC) + IF(CMAKE_USE_SYSTEM_LIBLZMA) + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${LZMA_INCLUDE_DIR}" "${LZMA_LIBRARIES}" + COMPILES + "#include \nint main() {return (int)lzma_version_number(); }" + "WITHOUT_LZMA_API_STATIC;LZMA_API_STATIC") + IF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC) + ADD_DEFINITIONS(-DLZMA_API_STATIC) + ENDIF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC) + ELSE() ADD_DEFINITIONS(-DLZMA_API_STATIC) - ENDIF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC) + ENDIF() ELSEIF(LZMADEC_FOUND) SET(HAVE_LIBLZMADEC 1) SET(HAVE_LZMADEC_H 1) @@ -308,6 +311,7 @@ ELSEIF(LZMADEC_FOUND) ELSE(LZMA_FOUND) # LZMA not found and will not be used. ENDIF(LZMA_FOUND) +IF(0) # CMake does not need LZO2 support in libarchive # # Find LZO2 # diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_xz.c b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_xz.c index 7bda263..a3ad67a 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_xz.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_xz.c @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include #endif #if HAVE_LZMA_H -#include +#include #elif HAVE_LZMADEC_H #include #endif diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c index 8cd241b..47e0752 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$"); #include #endif #ifdef HAVE_LZMA_H -#include +#include #endif #ifdef HAVE_ZLIB_H #include diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c index af89ded..68485d1 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include #endif #if HAVE_LZMA_H -#include +#include #elif HAVE_LZMADEC_H #include #endif diff --git a/Utilities/cmlibarchive/libarchive/archive_util.c b/Utilities/cmlibarchive/libarchive/archive_util.c index b53beca..96b88d8 100644 --- a/Utilities/cmlibarchive/libarchive/archive_util.c +++ b/Utilities/cmlibarchive/libarchive/archive_util.c @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_util.c 201098 2009-12-28 02:58:1 #include #endif #ifdef HAVE_LZMA_H -#include +#include #endif #ifdef HAVE_BZLIB_H #include diff --git a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_xz.c b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_xz.c index fa73311..a566732 100644 --- a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_xz.c +++ b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_xz.c @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_compression_xz.c 20110 #endif #include #ifdef HAVE_LZMA_H -#include +#include #endif #include "archive.h" diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c index 4f1bc26..5158854 100644 --- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c +++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c @@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$"); #include #endif #if HAVE_LZMA_H -#include +#include #endif #ifdef HAVE_ZLIB_H #include diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c index a4ce7ee..4cd2b9d 100644 --- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c +++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); #include #endif #if HAVE_LZMA_H -#include +#include #endif #ifdef HAVE_ZLIB_H #include http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7ee8515727ca208f766d56719e1c921898233756 commit 7ee8515727ca208f766d56719e1c921898233756 Author: Daniel Pfeifer AuthorDate: Sun Jul 13 22:21:58 2014 +0200 Commit: Brad King CommitDate: Wed Jul 23 10:34:56 2014 -0400 liblzma: Port to VS 6 diff --git a/Utilities/cmliblzma/common/sysdefs.h b/Utilities/cmliblzma/common/sysdefs.h index 5beda5c..81e10c1 100644 --- a/Utilities/cmliblzma/common/sysdefs.h +++ b/Utilities/cmliblzma/common/sysdefs.h @@ -16,6 +16,10 @@ #ifndef LZMA_SYSDEFS_H #define LZMA_SYSDEFS_H +#if defined(_MSC_VER) +# pragma warning(disable: 4028 4244 4761) +#endif + ////////////// // Includes // ////////////// @@ -46,6 +50,12 @@ # include #endif + +#if defined(_MSC_VER) && (_MSC_VER <= 1200) +# define UINT64_C(n) n ## ui64 +#endif + + // Be more compatible with systems that have non-conforming inttypes.h. // We assume that int is 32-bit and that long is either 32-bit or 64-bit. // Full Autoconf test could be more correct, but this should work well enough. diff --git a/Utilities/cmliblzma/common/tuklib_integer.h b/Utilities/cmliblzma/common/tuklib_integer.h index 1897438..e8cb6bf 100644 --- a/Utilities/cmliblzma/common/tuklib_integer.h +++ b/Utilities/cmliblzma/common/tuklib_integer.h @@ -391,7 +391,7 @@ bsr32(uint32_t n) // MSVC isn't supported by tuklib, but since this code exists, // it doesn't hurt to have it here anyway. uint32_t i; - _BitScanReverse((DWORD *)&i, n); + _BitScanReverse(&i, n); return i; #else @@ -443,7 +443,7 @@ clz32(uint32_t n) #elif defined(_MSC_VER) && _MSC_VER >= 1400 uint32_t i; - _BitScanReverse((DWORD *)&i, n); + _BitScanReverse(&i, n); return i ^ 31U; #else @@ -493,7 +493,7 @@ ctz32(uint32_t n) #elif defined(_MSC_VER) && _MSC_VER >= 1400 uint32_t i; - _BitScanForward((DWORD *)&i, n); + _BitScanForward(&i, n); return i; #else http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0430e5dde5dfba13f0ff0e7e41438aeade97df4f commit 0430e5dde5dfba13f0ff0e7e41438aeade97df4f Author: Daniel Pfeifer AuthorDate: Sun Jul 13 22:21:58 2014 +0200 Commit: Brad King CommitDate: Wed Jul 23 10:34:55 2014 -0400 liblzma: Port from C99 to C89/90 diff --git a/Utilities/cmliblzma/liblzma/check/check.c b/Utilities/cmliblzma/liblzma/check/check.c index 428ddae..979b0a8 100644 --- a/Utilities/cmliblzma/liblzma/check/check.c +++ b/Utilities/cmliblzma/liblzma/check/check.c @@ -16,9 +16,6 @@ extern LZMA_API(lzma_bool) lzma_check_is_supported(lzma_check type) { - if ((unsigned int)(type) > LZMA_CHECK_ID_MAX) - return false; - static const lzma_bool available_checks[LZMA_CHECK_ID_MAX + 1] = { true, // LZMA_CHECK_NONE @@ -56,6 +53,9 @@ lzma_check_is_supported(lzma_check type) false, // Reserved }; + if ((unsigned int)(type) > LZMA_CHECK_ID_MAX) + return false; + return available_checks[(unsigned int)(type)]; } @@ -63,9 +63,6 @@ lzma_check_is_supported(lzma_check type) extern LZMA_API(uint32_t) lzma_check_size(lzma_check type) { - if ((unsigned int)(type) > LZMA_CHECK_ID_MAX) - return UINT32_MAX; - // See file-format.txt section 2.1.1.2. static const uint8_t check_sizes[LZMA_CHECK_ID_MAX + 1] = { 0, @@ -76,6 +73,9 @@ lzma_check_size(lzma_check type) 64, 64, 64 }; + if ((unsigned int)(type) > LZMA_CHECK_ID_MAX) + return UINT32_MAX; + return check_sizes[(unsigned int)(type)]; } diff --git a/Utilities/cmliblzma/liblzma/check/crc32_fast.c b/Utilities/cmliblzma/liblzma/check/crc32_fast.c index 94da855..13f65b4 100644 --- a/Utilities/cmliblzma/liblzma/check/crc32_fast.c +++ b/Utilities/cmliblzma/liblzma/check/crc32_fast.c @@ -33,6 +33,8 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) #endif if (size > 8) { + const uint8_t * limit; + // Fix the alignment, if needed. The if statement above // ensures that this won't read past the end of buf[]. while ((uintptr_t)(buf) & 7) { @@ -41,7 +43,7 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) } // Calculate the position where to stop. - const uint8_t *const limit = buf + (size & ~(size_t)(7)); + limit = buf + (size & ~(size_t)(7)); // Calculate how many bytes must be calculated separately // before returning the result. @@ -49,6 +51,8 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) // Calculate the CRC32 using the slice-by-eight algorithm. while (buf < limit) { + uint32_t tmp; + crc ^= *(const uint32_t *)(buf); buf += 4; @@ -57,7 +61,7 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) ^ lzma_crc32_table[5][C(crc)] ^ lzma_crc32_table[4][D(crc)]; - const uint32_t tmp = *(const uint32_t *)(buf); + tmp = *(const uint32_t *)(buf); buf += 4; // At least with some compilers, it is critical for diff --git a/Utilities/cmliblzma/liblzma/check/crc64_fast.c b/Utilities/cmliblzma/liblzma/check/crc64_fast.c index 52af29e..1436557 100644 --- a/Utilities/cmliblzma/liblzma/check/crc64_fast.c +++ b/Utilities/cmliblzma/liblzma/check/crc64_fast.c @@ -36,12 +36,14 @@ lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc) #endif if (size > 4) { + const uint8_t *limit; + while ((uintptr_t)(buf) & 3) { crc = lzma_crc64_table[0][*buf++ ^ A1(crc)] ^ S8(crc); --size; } - const uint8_t *const limit = buf + (size & ~(size_t)(3)); + limit = buf + (size & ~(size_t)(3)); size &= (size_t)(3); while (buf < limit) { diff --git a/Utilities/cmliblzma/liblzma/check/sha256.c b/Utilities/cmliblzma/liblzma/check/sha256.c index 23bda92..b09ccbf 100644 --- a/Utilities/cmliblzma/liblzma/check/sha256.c +++ b/Utilities/cmliblzma/liblzma/check/sha256.c @@ -80,16 +80,21 @@ static const uint32_t SHA256_K[64] = { static void +#ifndef _MSC_VER transform(uint32_t state[static 8], const uint32_t data[static 16]) +#else +transform(uint32_t state[], const uint32_t data[]) +#endif { uint32_t W[16]; uint32_t T[8]; + unsigned int j; // Copy state[] to working vars. memcpy(T, state, sizeof(T)); // 64 operations, partially loop unrolled - for (unsigned int j = 0; j < 64; j += 16) { + for (j = 0; j < 64; j += 16) { R( 0); R( 1); R( 2); R( 3); R( 4); R( 5); R( 6); R( 7); R( 8); R( 9); R(10); R(11); @@ -116,8 +121,9 @@ process(lzma_check_state *check) #else uint32_t data[16]; + size_t i; - for (size_t i = 0; i < 16; ++i) + for (i = 0; i < 16; ++i) data[i] = bswap32(check->buffer.u32[i]); transform(check->state.sha256.state, data); @@ -172,6 +178,8 @@ lzma_sha256_update(const uint8_t *buf, size_t size, lzma_check_state *check) extern void lzma_sha256_finish(lzma_check_state *check) { + size_t i; + // Add padding as described in RFC 3174 (it describes SHA-1 but // the same padding style is used for SHA-256 too). size_t pos = check->state.sha256.size & 0x3F; @@ -193,7 +201,7 @@ lzma_sha256_finish(lzma_check_state *check) process(check); - for (size_t i = 0; i < 8; ++i) + for (i = 0; i < 8; ++i) check->buffer.u32[i] = conv32be(check->state.sha256.state[i]); return; diff --git a/Utilities/cmliblzma/liblzma/common/alone_decoder.c b/Utilities/cmliblzma/liblzma/common/alone_decoder.c index c25112e..a20cf49 100644 --- a/Utilities/cmliblzma/liblzma/common/alone_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/alone_decoder.c @@ -126,19 +126,17 @@ alone_decode(lzma_coder *coder, // Fall through case SEQ_CODER_INIT: { - if (coder->memusage > coder->memlimit) - return LZMA_MEMLIMIT_ERROR; + lzma_ret ret; lzma_filter_info filters[2] = { - { - .init = &lzma_lzma_decoder_init, - .options = &coder->options, - }, { - .init = NULL, - } + { 0, &lzma_lzma_decoder_init, &coder->options }, + { 0, NULL, NULL } }; - const lzma_ret ret = lzma_next_filter_init(&coder->next, + if (coder->memusage > coder->memlimit) + return LZMA_MEMLIMIT_ERROR; + + ret = lzma_next_filter_init(&coder->next, allocator, filters); if (ret != LZMA_OK) return ret; @@ -229,7 +227,7 @@ lzma_alone_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_alone_decoder(lzma_stream *strm, uint64_t memlimit) { - lzma_next_strm_init(lzma_alone_decoder_init, strm, memlimit, false); + lzma_next_strm_init2(lzma_alone_decoder_init, strm, memlimit, false); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; diff --git a/Utilities/cmliblzma/liblzma/common/alone_encoder.c b/Utilities/cmliblzma/liblzma/common/alone_encoder.c index eb1697e..62df126 100644 --- a/Utilities/cmliblzma/liblzma/common/alone_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/alone_encoder.c @@ -78,6 +78,14 @@ static lzma_ret alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, const lzma_options_lzma *options) { + uint32_t d; + + // Initialize the LZMA encoder. + const lzma_filter_info filters[2] = { + { 0, &lzma_lzma_encoder_init, (void *)(options) }, + { 0, NULL, NULL } + }; + lzma_next_coder_init(&alone_encoder_init, next, allocator); if (next->coder == NULL) { @@ -107,7 +115,7 @@ alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, // one is the next unless it is UINT32_MAX. While the header would // allow any 32-bit integer, we do this to keep the decoder of liblzma // accepting the resulting files. - uint32_t d = options->dict_size - 1; + d = options->dict_size - 1; d |= d >> 2; d |= d >> 3; d |= d >> 4; @@ -121,16 +129,6 @@ alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, // - Uncompressed size (always unknown and using EOPM) memset(next->coder->header + 1 + 4, 0xFF, 8); - // Initialize the LZMA encoder. - const lzma_filter_info filters[2] = { - { - .init = &lzma_lzma_encoder_init, - .options = (void *)(options), - }, { - .init = NULL, - } - }; - return lzma_next_filter_init(&next->coder->next, allocator, filters); } @@ -148,7 +146,7 @@ lzma_alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_alone_encoder(lzma_stream *strm, const lzma_options_lzma *options) { - lzma_next_strm_init(alone_encoder_init, strm, options); + lzma_next_strm_init1(alone_encoder_init, strm, options); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; diff --git a/Utilities/cmliblzma/liblzma/common/auto_decoder.c b/Utilities/cmliblzma/liblzma/common/auto_decoder.c index 35c895f..6f3c862 100644 --- a/Utilities/cmliblzma/liblzma/common/auto_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/auto_decoder.c @@ -177,7 +177,7 @@ auto_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_auto_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags) { - lzma_next_strm_init(auto_decoder_init, strm, memlimit, flags); + lzma_next_strm_init2(auto_decoder_init, strm, memlimit, flags); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; diff --git a/Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c b/Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c index ff27a11..b4bd388 100644 --- a/Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c @@ -18,6 +18,9 @@ lzma_block_buffer_decode(lzma_block *block, lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) { + lzma_next_coder block_decoder; + lzma_ret ret; + if (in_pos == NULL || (in == NULL && *in_pos != in_size) || *in_pos > in_size || out_pos == NULL || (out == NULL && *out_pos != out_size) @@ -25,9 +28,8 @@ lzma_block_buffer_decode(lzma_block *block, lzma_allocator *allocator, return LZMA_PROG_ERROR; // Initialize the Block decoder. - lzma_next_coder block_decoder = LZMA_NEXT_CODER_INIT; - lzma_ret ret = lzma_block_decoder_init( - &block_decoder, allocator, block); + block_decoder = LZMA_NEXT_CODER_INIT; + ret = lzma_block_decoder_init(&block_decoder, allocator, block); if (ret == LZMA_OK) { // Save the positions so that we can restore them in case diff --git a/Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c b/Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c index 519c6a6..136f7f5 100644 --- a/Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c @@ -31,6 +31,8 @@ static lzma_vli lzma2_bound(lzma_vli uncompressed_size) { + lzma_vli overhead; + // Prevent integer overflow in overhead calculation. if (uncompressed_size > COMPRESSED_SIZE_MAX) return 0; @@ -39,7 +41,7 @@ lzma2_bound(lzma_vli uncompressed_size) // uncompressed_size up to the next multiple of LZMA2_CHUNK_MAX, // multiply by the size of per-chunk header, and add one byte for // the end marker. - const lzma_vli overhead = ((uncompressed_size + LZMA2_CHUNK_MAX - 1) + overhead = ((uncompressed_size + LZMA2_CHUNK_MAX - 1) / LZMA2_CHUNK_MAX) * LZMA2_HEADER_UNCOMPRESSED + 1; @@ -82,15 +84,17 @@ static lzma_ret block_encode_uncompressed(lzma_block *block, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) { + size_t in_pos = 0; + uint8_t control = 0x01; // Dictionary reset + lzma_filter *filters_orig; + // TODO: Figure out if the last filter is LZMA2 or Subblock and use // that filter to encode the uncompressed chunks. // Use LZMA2 uncompressed chunks. We wouldn't need a dictionary at // all, but LZMA2 always requires a dictionary, so use the minimum // value to minimize memory usage of the decoder. - lzma_options_lzma lzma2 = { - .dict_size = LZMA_DICT_SIZE_MIN, - }; + lzma_options_lzma lzma2 = { LZMA_DICT_SIZE_MIN }; lzma_filter filters[2]; filters[0].id = LZMA_FILTER_LZMA2; @@ -99,7 +103,7 @@ block_encode_uncompressed(lzma_block *block, const uint8_t *in, size_t in_size, // Set the above filter options to *block temporarily so that we can // encode the Block Header. - lzma_filter *filters_orig = block->filters; + filters_orig = block->filters; block->filters = filters; if (lzma_block_header_size(block) != LZMA_OK) { @@ -128,18 +132,17 @@ block_encode_uncompressed(lzma_block *block, const uint8_t *in, size_t in_size, *out_pos += block->header_size; // Encode the data using LZMA2 uncompressed chunks. - size_t in_pos = 0; - uint8_t control = 0x01; // Dictionary reset while (in_pos < in_size) { + size_t copy_size; + // Control byte: Indicate uncompressed chunk, of which // the first resets the dictionary. out[(*out_pos)++] = control; control = 0x02; // No dictionary reset // Size of the uncompressed chunk - const size_t copy_size - = my_min(in_size - in_pos, LZMA2_CHUNK_MAX); + copy_size = my_min(in_size - in_pos, LZMA2_CHUNK_MAX); out[(*out_pos)++] = (copy_size - 1) >> 8; out[(*out_pos)++] = (copy_size - 1) & 0xFF; @@ -164,6 +167,10 @@ block_encode_normal(lzma_block *block, lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) { + size_t out_start; + lzma_next_coder raw_encoder = LZMA_NEXT_CODER_INIT; + lzma_ret ret; + // Find out the size of the Block Header. block->compressed_size = lzma2_bound(in_size); if (block->compressed_size == 0) @@ -176,7 +183,7 @@ block_encode_normal(lzma_block *block, lzma_allocator *allocator, if (out_size - *out_pos <= block->header_size) return LZMA_BUF_ERROR; - const size_t out_start = *out_pos; + out_start = *out_pos; *out_pos += block->header_size; // Limit out_size so that we stop encoding if the output would grow @@ -186,8 +193,7 @@ block_encode_normal(lzma_block *block, lzma_allocator *allocator, // TODO: In many common cases this could be optimized to use // significantly less memory. - lzma_next_coder raw_encoder = LZMA_NEXT_CODER_INIT; - lzma_ret ret = lzma_raw_encoder_init( + ret = lzma_raw_encoder_init( &raw_encoder, allocator, block->filters); if (ret == LZMA_OK) { @@ -226,6 +232,10 @@ lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) { + size_t check_size; + lzma_ret ret; + size_t i; + // Validate the arguments. if (block == NULL || (in == NULL && in_size != 0) || out == NULL || out_pos == NULL || *out_pos > out_size) @@ -249,7 +259,7 @@ lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator, out_size -= (out_size - *out_pos) & 3; // Get the size of the Check field. - const size_t check_size = lzma_check_size(block->check); + check_size = lzma_check_size(block->check); assert(check_size != UINT32_MAX); // Reserve space for the Check field. @@ -259,7 +269,7 @@ lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator, out_size -= check_size; // Do the actual compression. - const lzma_ret ret = block_encode_normal(block, allocator, + ret = block_encode_normal(block, allocator, in, in_size, out, out_pos, out_size); if (ret != LZMA_OK) { // If the error was something else than output buffer @@ -281,7 +291,7 @@ lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator, // Block Padding. No buffer overflow here, because we already adjusted // out_size so that (out_size - out_start) is a multiple of four. // Thus, if the buffer is full, the loop body can never run. - for (size_t i = (size_t)(block->compressed_size); i & 3; ++i) { + for (i = (size_t)(block->compressed_size); i & 3; ++i) { assert(*out_pos < out_size); out[(*out_pos)++] = 0x00; } diff --git a/Utilities/cmliblzma/liblzma/common/block_decoder.c b/Utilities/cmliblzma/liblzma/common/block_decoder.c index a3ce6f4..3de3851 100644 --- a/Utilities/cmliblzma/liblzma/common/block_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_decoder.c @@ -233,7 +233,7 @@ lzma_block_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_block_decoder(lzma_stream *strm, lzma_block *block) { - lzma_next_strm_init(lzma_block_decoder_init, strm, block); + lzma_next_strm_init1(lzma_block_decoder_init, strm, block); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; diff --git a/Utilities/cmliblzma/liblzma/common/block_encoder.c b/Utilities/cmliblzma/liblzma/common/block_encoder.c index 1eeb502..63e2687 100644 --- a/Utilities/cmliblzma/liblzma/common/block_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_encoder.c @@ -208,7 +208,7 @@ lzma_block_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_block_encoder(lzma_stream *strm, lzma_block *block) { - lzma_next_strm_init(lzma_block_encoder_init, strm, block); + lzma_next_strm_init1(lzma_block_encoder_init, strm, block); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; diff --git a/Utilities/cmliblzma/liblzma/common/block_header_decoder.c b/Utilities/cmliblzma/liblzma/common/block_header_decoder.c index 2c9573e..f6e470e 100644 --- a/Utilities/cmliblzma/liblzma/common/block_header_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_header_decoder.c @@ -17,10 +17,12 @@ static void free_properties(lzma_block *block, lzma_allocator *allocator) { + size_t i; + // Free allocated filter options. The last array member is not // touched after the initialization in the beginning of // lzma_block_header_decode(), so we don't need to touch that here. - for (size_t i = 0; i < LZMA_FILTERS_MAX; ++i) { + for (i = 0; i < LZMA_FILTERS_MAX; ++i) { lzma_free(block->filters[i].options, allocator); block->filters[i].id = LZMA_VLI_UNKNOWN; block->filters[i].options = NULL; @@ -34,6 +36,13 @@ extern LZMA_API(lzma_ret) lzma_block_header_decode(lzma_block *block, lzma_allocator *allocator, const uint8_t *in) { + const size_t filter_count = (in[1] & 3) + 1; + size_t in_size; + size_t i; + + // Start after the Block Header Size and Block Flags fields. + size_t in_pos = 2; + // NOTE: We consider the header to be corrupt not only when the // CRC32 doesn't match, but also when variable-length integers // are invalid or over 63 bits, or if the header is too small @@ -41,7 +50,7 @@ lzma_block_header_decode(lzma_block *block, // Initialize the filter options array. This way the caller can // safely free() the options even if an error occurs in this function. - for (size_t i = 0; i <= LZMA_FILTERS_MAX; ++i) { + for (i = 0; i <= LZMA_FILTERS_MAX; ++i) { block->filters[i].id = LZMA_VLI_UNKNOWN; block->filters[i].options = NULL; } @@ -56,7 +65,7 @@ lzma_block_header_decode(lzma_block *block, return LZMA_PROG_ERROR; // Exclude the CRC32 field. - const size_t in_size = block->header_size - 4; + in_size = block->header_size - 4; // Verify CRC32 if (lzma_crc32(in, in_size, 0) != unaligned_read32le(in + in_size)) @@ -66,9 +75,6 @@ lzma_block_header_decode(lzma_block *block, if (in[1] & 0x3C) return LZMA_OPTIONS_ERROR; - // Start after the Block Header Size and Block Flags fields. - size_t in_pos = 2; - // Compressed Size if (in[1] & 0x40) { return_if_error(lzma_vli_decode(&block->compressed_size, @@ -90,8 +96,7 @@ lzma_block_header_decode(lzma_block *block, block->uncompressed_size = LZMA_VLI_UNKNOWN; // Filter Flags - const size_t filter_count = (in[1] & 3) + 1; - for (size_t i = 0; i < filter_count; ++i) { + for (i = 0; i < filter_count; ++i) { const lzma_ret ret = lzma_filter_flags_decode( &block->filters[i], allocator, in, &in_pos, in_size); diff --git a/Utilities/cmliblzma/liblzma/common/block_header_encoder.c b/Utilities/cmliblzma/liblzma/common/block_header_encoder.c index 707dd0c..650295c 100644 --- a/Utilities/cmliblzma/liblzma/common/block_header_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_header_encoder.c @@ -17,12 +17,14 @@ extern LZMA_API(lzma_ret) lzma_block_header_size(lzma_block *block) { - if (block->version != 0) - return LZMA_OPTIONS_ERROR; + size_t i; // Block Header Size + Block Flags + CRC32. uint32_t size = 1 + 1 + 4; + if (block->version != 0) + return LZMA_OPTIONS_ERROR; + // Compressed Size if (block->compressed_size != LZMA_VLI_UNKNOWN) { const uint32_t add = lzma_vli_size(block->compressed_size); @@ -45,12 +47,13 @@ lzma_block_header_size(lzma_block *block) if (block->filters == NULL || block->filters[0].id == LZMA_VLI_UNKNOWN) return LZMA_PROG_ERROR; - for (size_t i = 0; block->filters[i].id != LZMA_VLI_UNKNOWN; ++i) { + for (i = 0; block->filters[i].id != LZMA_VLI_UNKNOWN; ++i) { + uint32_t add; + // Don't allow too many filters. if (i == LZMA_FILTERS_MAX) return LZMA_PROG_ERROR; - uint32_t add; return_if_error(lzma_filter_flags_size(&add, block->filters + i)); @@ -73,20 +76,23 @@ lzma_block_header_size(lzma_block *block) extern LZMA_API(lzma_ret) lzma_block_header_encode(const lzma_block *block, uint8_t *out) { + size_t out_size; + size_t out_pos = 2; + size_t filter_count = 0; + // Validate everything but filters. if (lzma_block_unpadded_size(block) == 0 || !lzma_vli_is_valid(block->uncompressed_size)) return LZMA_PROG_ERROR; // Indicate the size of the buffer _excluding_ the CRC32 field. - const size_t out_size = block->header_size - 4; + out_size = block->header_size - 4; // Store the Block Header Size. out[0] = out_size / 4; // We write Block Flags in pieces. out[1] = 0x00; - size_t out_pos = 2; // Compressed Size if (block->compressed_size != LZMA_VLI_UNKNOWN) { @@ -108,7 +114,6 @@ lzma_block_header_encode(const lzma_block *block, uint8_t *out) if (block->filters == NULL || block->filters[0].id == LZMA_VLI_UNKNOWN) return LZMA_PROG_ERROR; - size_t filter_count = 0; do { // There can be a maximum of four filters. if (filter_count == LZMA_FILTERS_MAX) diff --git a/Utilities/cmliblzma/liblzma/common/block_util.c b/Utilities/cmliblzma/liblzma/common/block_util.c index 62c9345..4cd34d1 100644 --- a/Utilities/cmliblzma/liblzma/common/block_util.c +++ b/Utilities/cmliblzma/liblzma/common/block_util.c @@ -17,11 +17,14 @@ extern LZMA_API(lzma_ret) lzma_block_compressed_size(lzma_block *block, lzma_vli unpadded_size) { + uint32_t container_size; + lzma_vli compressed_size; + // Validate everything but Uncompressed Size and filters. if (lzma_block_unpadded_size(block) == 0) return LZMA_PROG_ERROR; - const uint32_t container_size = block->header_size + container_size = block->header_size + lzma_check_size(block->check); // Validate that Compressed Size will be greater than zero. @@ -31,7 +34,7 @@ lzma_block_compressed_size(lzma_block *block, lzma_vli unpadded_size) // Calculate what Compressed Size is supposed to be. // If Compressed Size was present in Block Header, // compare that the new value matches it. - const lzma_vli compressed_size = unpadded_size - container_size; + compressed_size = unpadded_size - container_size; if (block->compressed_size != LZMA_VLI_UNKNOWN && block->compressed_size != compressed_size) return LZMA_DATA_ERROR; @@ -45,6 +48,8 @@ lzma_block_compressed_size(lzma_block *block, lzma_vli unpadded_size) extern LZMA_API(lzma_vli) lzma_block_unpadded_size(const lzma_block *block) { + lzma_vli unpadded_size; + // Validate the values that we are interested in i.e. all but // Uncompressed Size and the filters. // @@ -66,7 +71,7 @@ lzma_block_unpadded_size(const lzma_block *block) return LZMA_VLI_UNKNOWN; // Calculate Unpadded Size and validate it. - const lzma_vli unpadded_size = block->compressed_size + unpadded_size = block->compressed_size + block->header_size + lzma_check_size(block->check); diff --git a/Utilities/cmliblzma/liblzma/common/common.c b/Utilities/cmliblzma/liblzma/common/common.c index b9e3860..d0105e1 100644 --- a/Utilities/cmliblzma/liblzma/common/common.c +++ b/Utilities/cmliblzma/liblzma/common/common.c @@ -38,12 +38,12 @@ lzma_version_string(void) extern void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1) lzma_alloc(size_t size, lzma_allocator *allocator) { + void *ptr; + // Some malloc() variants return NULL if called with size == 0. if (size == 0) size = 1; - void *ptr; - if (allocator != NULL && allocator->alloc != NULL) ptr = allocator->alloc(allocator->opaque, 1, size); else @@ -173,6 +173,10 @@ lzma_strm_init(lzma_stream *strm) extern LZMA_API(lzma_ret) lzma_code(lzma_stream *strm, lzma_action action) { + size_t in_pos = 0; + size_t out_pos = 0; + lzma_ret ret; + // Sanity checks if ((strm->next_in == NULL && strm->avail_in != 0) || (strm->next_out == NULL && strm->avail_out != 0) @@ -248,9 +252,7 @@ lzma_code(lzma_stream *strm, lzma_action action) return LZMA_PROG_ERROR; } - size_t in_pos = 0; - size_t out_pos = 0; - lzma_ret ret = strm->internal->next.code( + ret = strm->internal->next.code( strm->internal->next.coder, strm->allocator, strm->next_in, &in_pos, strm->avail_in, strm->next_out, &out_pos, strm->avail_out, action); diff --git a/Utilities/cmliblzma/liblzma/common/common.h b/Utilities/cmliblzma/liblzma/common/common.h index 6d7412f..a1a1591 100644 --- a/Utilities/cmliblzma/liblzma/common/common.h +++ b/Utilities/cmliblzma/liblzma/common/common.h @@ -155,18 +155,18 @@ struct lzma_next_coder_s { }; -/// Macro to initialize lzma_next_coder structure -#define LZMA_NEXT_CODER_INIT \ - (lzma_next_coder){ \ - .coder = NULL, \ - .init = (uintptr_t)(NULL), \ - .id = LZMA_VLI_UNKNOWN, \ - .code = NULL, \ - .end = NULL, \ - .get_check = NULL, \ - .memconfig = NULL, \ - .update = NULL, \ - } +/// Constant to initialize lzma_next_coder structure +static const lzma_next_coder LZMA_NEXT_CODER_INIT = + { + NULL, + LZMA_VLI_UNKNOWN, + (uintptr_t)(NULL), + NULL, + NULL, + NULL, + NULL, + NULL, + }; /// Internal data for lzma_strm_init, lzma_code, and lzma_end. A pointer to @@ -211,7 +211,7 @@ extern void lzma_free(void *ptr, lzma_allocator *allocator); /// Allocates strm->internal if it is NULL, and initializes *strm and -/// strm->internal. This function is only called via lzma_next_strm_init macro. +/// strm->internal. This function is only called via lzma_next_strm_init2 macro. extern lzma_ret lzma_strm_init(lzma_stream *strm); /// Initializes the next filter in the chain, if any. This takes care of @@ -269,15 +269,37 @@ do { \ /// (The function being called will use lzma_next_coder_init()). If /// initialization fails, memory that wasn't freed by func() is freed /// along strm->internal. -#define lzma_next_strm_init(func, strm, ...) \ +#define lzma_next_strm_init1(func, strm, arg1) \ do { \ - return_if_error(lzma_strm_init(strm)); \ - const lzma_ret ret_ = func(&(strm)->internal->next, \ - (strm)->allocator, __VA_ARGS__); \ - if (ret_ != LZMA_OK) { \ - lzma_end(strm); \ - return ret_; \ - } \ + lzma_ret ret_; \ + return_if_error(lzma_strm_init(strm)); \ + ret_ = func(&(strm)->internal->next, (strm)->allocator, arg1); \ + if (ret_ != LZMA_OK) { \ + lzma_end(strm); \ + return ret_; \ + } \ +} while (0) + +#define lzma_next_strm_init2(func, strm, arg1, arg2) \ +do { \ + lzma_ret ret_; \ + return_if_error(lzma_strm_init(strm)); \ + ret_ = func(&(strm)->internal->next, (strm)->allocator, arg1, arg2); \ + if (ret_ != LZMA_OK) { \ + lzma_end(strm); \ + return ret_; \ + } \ +} while (0) + +#define lzma_next_strm_init3(func, strm, arg1, arg2, arg3) \ +do { \ + lzma_ret ret_; \ + return_if_error(lzma_strm_init(strm)); \ + ret_ = func(&(strm)->internal->next, (strm)->allocator, arg1, arg2, arg3); \ + if (ret_ != LZMA_OK) { \ + lzma_end(strm); \ + return ret_; \ + } \ } while (0) #endif diff --git a/Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c b/Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c index 2d35ef8..65665c1 100644 --- a/Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c @@ -18,22 +18,26 @@ lzma_raw_buffer_decode(const lzma_filter *filters, lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) { + lzma_next_coder next = LZMA_NEXT_CODER_INIT; + size_t in_start; + size_t out_start; + lzma_ret ret; + // Validate what isn't validated later in filter_common.c. if (in == NULL || in_pos == NULL || *in_pos > in_size || out == NULL || out_pos == NULL || *out_pos > out_size) return LZMA_PROG_ERROR; // Initialize the decoer. - lzma_next_coder next = LZMA_NEXT_CODER_INIT; return_if_error(lzma_raw_decoder_init(&next, allocator, filters)); // Store the positions so that we can restore them if something // goes wrong. - const size_t in_start = *in_pos; - const size_t out_start = *out_pos; + in_start = *in_pos; + out_start = *out_pos; // Do the actual decoding and free decoder's memory. - lzma_ret ret = next.code(next.coder, allocator, in, in_pos, in_size, + ret = next.code(next.coder, allocator, in, in_pos, in_size, out, out_pos, out_size, LZMA_FINISH); if (ret == LZMA_STREAM_END) { diff --git a/Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c b/Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c index 646e1b3..b23329f 100644 --- a/Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c @@ -18,22 +18,25 @@ lzma_raw_buffer_encode(const lzma_filter *filters, lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) { + lzma_next_coder next = LZMA_NEXT_CODER_INIT; + size_t out_start; + size_t in_pos = 0; + lzma_ret ret; + // Validate what isn't validated later in filter_common.c. if ((in == NULL && in_size != 0) || out == NULL || out_pos == NULL || *out_pos > out_size) return LZMA_PROG_ERROR; // Initialize the encoder - lzma_next_coder next = LZMA_NEXT_CODER_INIT; return_if_error(lzma_raw_encoder_init(&next, allocator, filters)); // Store the output position so that we can restore it if // something goes wrong. - const size_t out_start = *out_pos; + out_start = *out_pos; // Do the actual encoding and free coder's memory. - size_t in_pos = 0; - lzma_ret ret = next.code(next.coder, allocator, in, &in_pos, in_size, + ret = next.code(next.coder, allocator, in, &in_pos, in_size, out, out_pos, out_size, LZMA_FINISH); lzma_next_end(&next, allocator); diff --git a/Utilities/cmliblzma/liblzma/common/filter_common.c b/Utilities/cmliblzma/liblzma/common/filter_common.c index 7c95b05..d2b9e08 100644 --- a/Utilities/cmliblzma/liblzma/common/filter_common.c +++ b/Utilities/cmliblzma/liblzma/common/filter_common.c @@ -36,87 +36,87 @@ static const struct { } features[] = { #if defined (HAVE_ENCODER_LZMA1) || defined(HAVE_DECODER_LZMA1) { - .id = LZMA_FILTER_LZMA1, - .options_size = sizeof(lzma_options_lzma), - .non_last_ok = false, - .last_ok = true, - .changes_size = true, + LZMA_FILTER_LZMA1, + sizeof(lzma_options_lzma), + false, + true, + true, }, #endif #if defined(HAVE_ENCODER_LZMA2) || defined(HAVE_DECODER_LZMA2) { - .id = LZMA_FILTER_LZMA2, - .options_size = sizeof(lzma_options_lzma), - .non_last_ok = false, - .last_ok = true, - .changes_size = true, + LZMA_FILTER_LZMA2, + sizeof(lzma_options_lzma), + false, + true, + true, }, #endif #if defined(HAVE_ENCODER_X86) || defined(HAVE_DECODER_X86) { - .id = LZMA_FILTER_X86, - .options_size = sizeof(lzma_options_bcj), - .non_last_ok = true, - .last_ok = false, - .changes_size = false, + LZMA_FILTER_X86, + sizeof(lzma_options_bcj), + true, + false, + false, }, #endif #if defined(HAVE_ENCODER_POWERPC) || defined(HAVE_DECODER_POWERPC) { - .id = LZMA_FILTER_POWERPC, - .options_size = sizeof(lzma_options_bcj), - .non_last_ok = true, - .last_ok = false, - .changes_size = false, + LZMA_FILTER_POWERPC, + sizeof(lzma_options_bcj), + true, + false, + false, }, #endif #if defined(HAVE_ENCODER_IA64) || defined(HAVE_DECODER_IA64) { - .id = LZMA_FILTER_IA64, - .options_size = sizeof(lzma_options_bcj), - .non_last_ok = true, - .last_ok = false, - .changes_size = false, + LZMA_FILTER_IA64, + sizeof(lzma_options_bcj), + true, + false, + false, }, #endif #if defined(HAVE_ENCODER_ARM) || defined(HAVE_DECODER_ARM) { - .id = LZMA_FILTER_ARM, - .options_size = sizeof(lzma_options_bcj), - .non_last_ok = true, - .last_ok = false, - .changes_size = false, + LZMA_FILTER_ARM, + sizeof(lzma_options_bcj), + true, + false, + false, }, #endif #if defined(HAVE_ENCODER_ARMTHUMB) || defined(HAVE_DECODER_ARMTHUMB) { - .id = LZMA_FILTER_ARMTHUMB, - .options_size = sizeof(lzma_options_bcj), - .non_last_ok = true, - .last_ok = false, - .changes_size = false, + LZMA_FILTER_ARMTHUMB, + sizeof(lzma_options_bcj), + true, + false, + false, }, #endif #if defined(HAVE_ENCODER_SPARC) || defined(HAVE_DECODER_SPARC) { - .id = LZMA_FILTER_SPARC, - .options_size = sizeof(lzma_options_bcj), - .non_last_ok = true, - .last_ok = false, - .changes_size = false, + LZMA_FILTER_SPARC, + sizeof(lzma_options_bcj), + true, + false, + false, }, #endif #if defined(HAVE_ENCODER_DELTA) || defined(HAVE_DECODER_DELTA) { - .id = LZMA_FILTER_DELTA, - .options_size = sizeof(lzma_options_delta), - .non_last_ok = true, - .last_ok = false, - .changes_size = false, + LZMA_FILTER_DELTA, + sizeof(lzma_options_delta), + true, + false, + false, }, #endif { - .id = LZMA_VLI_UNKNOWN + LZMA_VLI_UNKNOWN } }; @@ -125,11 +125,12 @@ extern LZMA_API(lzma_ret) lzma_filters_copy(const lzma_filter *src, lzma_filter *dest, lzma_allocator *allocator) { + size_t i; + lzma_ret ret; + if (src == NULL || dest == NULL) return LZMA_PROG_ERROR; - lzma_ret ret; - size_t i; for (i = 0; src[i].id != LZMA_VLI_UNKNOWN; ++i) { // There must be a maximum of four filters plus // the array terminator. @@ -193,10 +194,6 @@ error: static lzma_ret validate_chain(const lzma_filter *filters, size_t *count) { - // There must be at least one filter. - if (filters == NULL || filters[0].id == LZMA_VLI_UNKNOWN) - return LZMA_PROG_ERROR; - // Number of non-last filters that may change the size of the data // significantly (that is, more than 1-2 % or so). size_t changes_size_count = 0; @@ -210,6 +207,11 @@ validate_chain(const lzma_filter *filters, size_t *count) bool last_ok = false; size_t i = 0; + + // There must be at least one filter. + if (filters == NULL || filters[0].id == LZMA_VLI_UNKNOWN) + return LZMA_PROG_ERROR; + do { size_t j; for (j = 0; filters[i].id != features[j].id; ++j) @@ -243,14 +245,17 @@ lzma_raw_coder_init(lzma_next_coder *next, lzma_allocator *allocator, const lzma_filter *options, lzma_filter_find coder_find, bool is_encoder) { - // Do some basic validation and get the number of filters. + lzma_filter_info filters[LZMA_FILTERS_MAX + 1]; size_t count; + size_t i; + lzma_ret ret; + + // Do some basic validation and get the number of filters. return_if_error(validate_chain(options, &count)); // Set the filter functions and copy the options pointer. - lzma_filter_info filters[LZMA_FILTERS_MAX + 1]; if (is_encoder) { - for (size_t i = 0; i < count; ++i) { + for (i = 0; i < count; ++i) { // The order of the filters is reversed in the // encoder. It allows more efficient handling // of the uncompressed data. @@ -266,7 +271,7 @@ lzma_raw_coder_init(lzma_next_coder *next, lzma_allocator *allocator, filters[j].options = options[i].options; } } else { - for (size_t i = 0; i < count; ++i) { + for (i = 0; i < count; ++i) { const lzma_filter_coder *const fc = coder_find(options[i].id); if (fc == NULL || fc->init == NULL) @@ -283,7 +288,7 @@ lzma_raw_coder_init(lzma_next_coder *next, lzma_allocator *allocator, filters[count].init = NULL; // Initialize the filters. - const lzma_ret ret = lzma_next_filter_init(next, allocator, filters); + ret = lzma_next_filter_init(next, allocator, filters); if (ret != LZMA_OK) lzma_next_end(next, allocator); @@ -295,6 +300,9 @@ extern uint64_t lzma_raw_coder_memusage(lzma_filter_find coder_find, const lzma_filter *filters) { + uint64_t total = 0; + size_t i = 0; + // The chain has to have at least one filter. { size_t tmp; @@ -302,9 +310,6 @@ lzma_raw_coder_memusage(lzma_filter_find coder_find, return UINT64_MAX; } - uint64_t total = 0; - size_t i = 0; - do { const lzma_filter_coder *const fc = coder_find(filters[i].id); diff --git a/Utilities/cmliblzma/liblzma/common/filter_decoder.c b/Utilities/cmliblzma/liblzma/common/filter_decoder.c index 1ebbe2a..cce2b30 100644 --- a/Utilities/cmliblzma/liblzma/common/filter_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_decoder.c @@ -44,74 +44,74 @@ typedef struct { static const lzma_filter_decoder decoders[] = { #ifdef HAVE_DECODER_LZMA1 { - .id = LZMA_FILTER_LZMA1, - .init = &lzma_lzma_decoder_init, - .memusage = &lzma_lzma_decoder_memusage, - .props_decode = &lzma_lzma_props_decode, + LZMA_FILTER_LZMA1, + &lzma_lzma_decoder_init, + &lzma_lzma_decoder_memusage, + &lzma_lzma_props_decode, }, #endif #ifdef HAVE_DECODER_LZMA2 { - .id = LZMA_FILTER_LZMA2, - .init = &lzma_lzma2_decoder_init, - .memusage = &lzma_lzma2_decoder_memusage, - .props_decode = &lzma_lzma2_props_decode, + LZMA_FILTER_LZMA2, + &lzma_lzma2_decoder_init, + &lzma_lzma2_decoder_memusage, + &lzma_lzma2_props_decode, }, #endif #ifdef HAVE_DECODER_X86 { - .id = LZMA_FILTER_X86, - .init = &lzma_simple_x86_decoder_init, - .memusage = NULL, - .props_decode = &lzma_simple_props_decode, + LZMA_FILTER_X86, + &lzma_simple_x86_decoder_init, + NULL, + &lzma_simple_props_decode, }, #endif #ifdef HAVE_DECODER_POWERPC { - .id = LZMA_FILTER_POWERPC, - .init = &lzma_simple_powerpc_decoder_init, - .memusage = NULL, - .props_decode = &lzma_simple_props_decode, + LZMA_FILTER_POWERPC, + &lzma_simple_powerpc_decoder_init, + NULL, + &lzma_simple_props_decode, }, #endif #ifdef HAVE_DECODER_IA64 { - .id = LZMA_FILTER_IA64, - .init = &lzma_simple_ia64_decoder_init, - .memusage = NULL, - .props_decode = &lzma_simple_props_decode, + LZMA_FILTER_IA64, + &lzma_simple_ia64_decoder_init, + NULL, + &lzma_simple_props_decode, }, #endif #ifdef HAVE_DECODER_ARM { - .id = LZMA_FILTER_ARM, - .init = &lzma_simple_arm_decoder_init, - .memusage = NULL, - .props_decode = &lzma_simple_props_decode, + LZMA_FILTER_ARM, + &lzma_simple_arm_decoder_init, + NULL, + &lzma_simple_props_decode, }, #endif #ifdef HAVE_DECODER_ARMTHUMB { - .id = LZMA_FILTER_ARMTHUMB, - .init = &lzma_simple_armthumb_decoder_init, - .memusage = NULL, - .props_decode = &lzma_simple_props_decode, + LZMA_FILTER_ARMTHUMB, + &lzma_simple_armthumb_decoder_init, + NULL, + &lzma_simple_props_decode, }, #endif #ifdef HAVE_DECODER_SPARC { - .id = LZMA_FILTER_SPARC, - .init = &lzma_simple_sparc_decoder_init, - .memusage = NULL, - .props_decode = &lzma_simple_props_decode, + LZMA_FILTER_SPARC, + &lzma_simple_sparc_decoder_init, + NULL, + &lzma_simple_props_decode, }, #endif #ifdef HAVE_DECODER_DELTA { - .id = LZMA_FILTER_DELTA, - .init = &lzma_delta_decoder_init, - .memusage = &lzma_delta_coder_memusage, - .props_decode = &lzma_delta_props_decode, + LZMA_FILTER_DELTA, + &lzma_delta_decoder_init, + &lzma_delta_coder_memusage, + &lzma_delta_props_decode, }, #endif }; @@ -120,7 +120,8 @@ static const lzma_filter_decoder decoders[] = { static const lzma_filter_decoder * decoder_find(lzma_vli id) { - for (size_t i = 0; i < ARRAY_SIZE(decoders); ++i) + size_t i; + for (i = 0; i < ARRAY_SIZE(decoders); ++i) if (decoders[i].id == id) return decoders + i; @@ -147,7 +148,7 @@ lzma_raw_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_raw_decoder(lzma_stream *strm, const lzma_filter *options) { - lzma_next_strm_init(lzma_raw_decoder_init, strm, options); + lzma_next_strm_init1(lzma_raw_decoder_init, strm, options); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; @@ -168,10 +169,11 @@ extern LZMA_API(lzma_ret) lzma_properties_decode(lzma_filter *filter, lzma_allocator *allocator, const uint8_t *props, size_t props_size) { + const lzma_filter_decoder *const fd = decoder_find(filter->id); + // Make it always NULL so that the caller can always safely free() it. filter->options = NULL; - const lzma_filter_decoder *const fd = decoder_find(filter->id); if (fd == NULL) return LZMA_OPTIONS_ERROR; diff --git a/Utilities/cmliblzma/liblzma/common/filter_encoder.c b/Utilities/cmliblzma/liblzma/common/filter_encoder.c index 635d812..9fdb100 100644 --- a/Utilities/cmliblzma/liblzma/common/filter_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_encoder.c @@ -56,95 +56,101 @@ typedef struct { static const lzma_filter_encoder encoders[] = { #ifdef HAVE_ENCODER_LZMA1 { - .id = LZMA_FILTER_LZMA1, - .init = &lzma_lzma_encoder_init, - .memusage = &lzma_lzma_encoder_memusage, - .chunk_size = NULL, // FIXME - .props_size_get = NULL, - .props_size_fixed = 5, - .props_encode = &lzma_lzma_props_encode, + LZMA_FILTER_LZMA1, + &lzma_lzma_encoder_init, + &lzma_lzma_encoder_memusage, + NULL, // FIXME + NULL, + 5, + &lzma_lzma_props_encode, }, #endif #ifdef HAVE_ENCODER_LZMA2 { - .id = LZMA_FILTER_LZMA2, - .init = &lzma_lzma2_encoder_init, - .memusage = &lzma_lzma2_encoder_memusage, - .chunk_size = NULL, // FIXME - .props_size_get = NULL, - .props_size_fixed = 1, - .props_encode = &lzma_lzma2_props_encode, + LZMA_FILTER_LZMA2, + &lzma_lzma2_encoder_init, + &lzma_lzma2_encoder_memusage, + NULL, // FIXME + NULL, + 1, + &lzma_lzma2_props_encode, }, #endif #ifdef HAVE_ENCODER_X86 { - .id = LZMA_FILTER_X86, - .init = &lzma_simple_x86_encoder_init, - .memusage = NULL, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + LZMA_FILTER_X86, + &lzma_simple_x86_encoder_init, + NULL, + NULL, + &lzma_simple_props_size, + 0, + &lzma_simple_props_encode, }, #endif #ifdef HAVE_ENCODER_POWERPC { - .id = LZMA_FILTER_POWERPC, - .init = &lzma_simple_powerpc_encoder_init, - .memusage = NULL, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + LZMA_FILTER_POWERPC, + &lzma_simple_powerpc_encoder_init, + NULL, + NULL, + &lzma_simple_props_size, + 0, + &lzma_simple_props_encode, }, #endif #ifdef HAVE_ENCODER_IA64 { - .id = LZMA_FILTER_IA64, - .init = &lzma_simple_ia64_encoder_init, - .memusage = NULL, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + LZMA_FILTER_IA64, + &lzma_simple_ia64_encoder_init, + NULL, + NULL, + &lzma_simple_props_size, + 0, + &lzma_simple_props_encode, }, #endif #ifdef HAVE_ENCODER_ARM { - .id = LZMA_FILTER_ARM, - .init = &lzma_simple_arm_encoder_init, - .memusage = NULL, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + LZMA_FILTER_ARM, + &lzma_simple_arm_encoder_init, + NULL, + NULL, + &lzma_simple_props_size, + 0, + &lzma_simple_props_encode, }, #endif #ifdef HAVE_ENCODER_ARMTHUMB { - .id = LZMA_FILTER_ARMTHUMB, - .init = &lzma_simple_armthumb_encoder_init, - .memusage = NULL, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + LZMA_FILTER_ARMTHUMB, + &lzma_simple_armthumb_encoder_init, + NULL, + NULL, + &lzma_simple_props_size, + 0, + &lzma_simple_props_encode, }, #endif #ifdef HAVE_ENCODER_SPARC { - .id = LZMA_FILTER_SPARC, - .init = &lzma_simple_sparc_encoder_init, - .memusage = NULL, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + LZMA_FILTER_SPARC, + &lzma_simple_sparc_encoder_init, + NULL, + NULL, + &lzma_simple_props_size, + 0, + &lzma_simple_props_encode, }, #endif #ifdef HAVE_ENCODER_DELTA { - .id = LZMA_FILTER_DELTA, - .init = &lzma_delta_encoder_init, - .memusage = &lzma_delta_coder_memusage, - .chunk_size = NULL, - .props_size_get = NULL, - .props_size_fixed = 1, - .props_encode = &lzma_delta_props_encode, + LZMA_FILTER_DELTA, + &lzma_delta_encoder_init, + &lzma_delta_coder_memusage, + NULL, + NULL, + 1, + &lzma_delta_props_encode, }, #endif }; @@ -153,7 +159,8 @@ static const lzma_filter_encoder encoders[] = { static const lzma_filter_encoder * encoder_find(lzma_vli id) { - for (size_t i = 0; i < ARRAY_SIZE(encoders); ++i) + size_t i; + for (i = 0; i < ARRAY_SIZE(encoders); ++i) if (encoders[i].id == id) return encoders + i; @@ -171,6 +178,10 @@ lzma_filter_encoder_is_supported(lzma_vli id) extern LZMA_API(lzma_ret) lzma_filters_update(lzma_stream *strm, const lzma_filter *filters) { + size_t i; + size_t count = 1; + lzma_filter reversed_filters[LZMA_FILTERS_MAX + 1]; + if (strm->internal->next.update == NULL) return LZMA_PROG_ERROR; @@ -180,12 +191,10 @@ lzma_filters_update(lzma_stream *strm, const lzma_filter *filters) // The actual filter chain in the encoder is reversed. Some things // still want the normal order chain, so we provide both. - size_t count = 1; while (filters[count].id != LZMA_VLI_UNKNOWN) ++count; - lzma_filter reversed_filters[LZMA_FILTERS_MAX + 1]; - for (size_t i = 0; i < count; ++i) + for (i = 0; i < count; ++i) reversed_filters[count - i - 1] = filters[i]; reversed_filters[count].id = LZMA_VLI_UNKNOWN; @@ -207,7 +216,7 @@ lzma_raw_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_raw_encoder(lzma_stream *strm, const lzma_filter *options) { - lzma_next_strm_init(lzma_raw_coder_init, strm, options, + lzma_next_strm_init3(lzma_raw_coder_init, strm, options, (lzma_filter_find)(&encoder_find), true); strm->internal->supported_actions[LZMA_RUN] = true; diff --git a/Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c b/Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c index caae10c..aa2dbd5 100644 --- a/Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c @@ -18,6 +18,9 @@ lzma_filter_flags_decode( lzma_filter *filter, lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size) { + lzma_vli props_size; + lzma_ret ret; + // Set the pointer to NULL so the caller can always safely free it. filter->options = NULL; @@ -29,7 +32,6 @@ lzma_filter_flags_decode( return LZMA_DATA_ERROR; // Size of Properties - lzma_vli props_size; return_if_error(lzma_vli_decode(&props_size, NULL, in, in_pos, in_size)); @@ -37,7 +39,7 @@ lzma_filter_flags_decode( if (in_size - *in_pos < props_size) return LZMA_DATA_ERROR; - const lzma_ret ret = lzma_properties_decode( + ret = lzma_properties_decode( filter, allocator, in + *in_pos, props_size); *in_pos += props_size; diff --git a/Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c b/Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c index d110566..755c407 100644 --- a/Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c @@ -31,6 +31,8 @@ extern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filter, uint8_t *out, size_t *out_pos, size_t out_size) { + uint32_t props_size; + // Filter ID if (filter->id >= LZMA_FILTER_RESERVED_START) return LZMA_PROG_ERROR; @@ -39,7 +41,6 @@ lzma_filter_flags_encode(const lzma_filter *filter, out, out_pos, out_size)); // Size of Properties - uint32_t props_size; return_if_error(lzma_properties_size(&props_size, filter)); return_if_error(lzma_vli_encode(props_size, NULL, out, out_pos, out_size)); diff --git a/Utilities/cmliblzma/liblzma/common/index.c b/Utilities/cmliblzma/liblzma/common/index.c index 9af4bc1..f0f67ca 100644 --- a/Utilities/cmliblzma/liblzma/common/index.c +++ b/Utilities/cmliblzma/liblzma/common/index.c @@ -230,6 +230,7 @@ index_tree_end(index_tree *tree, lzma_allocator *allocator, static void index_tree_append(index_tree *tree, index_tree_node *node) { + uint32_t up; node->parent = tree->rightmost; node->left = NULL; node->right = NULL; @@ -258,8 +259,10 @@ index_tree_append(index_tree *tree, index_tree_node *node) // and thus know the state of the tree just by looking at the node // count. From the node count we can calculate how many steps to go // up in the tree to find the rotation root. - uint32_t up = tree->count ^ (UINT32_C(1) << bsr32(tree->count)); + up = tree->count ^ (UINT32_C(1) << bsr32(tree->count)); if (up != 0) { + index_tree_node *pivot; + // Locate the root node for the rotation. up = ctz32(tree->count) + 2; do { @@ -267,7 +270,7 @@ index_tree_append(index_tree *tree, index_tree_node *node) } while (--up > 0); // Rotate left using node as the rotation root. - index_tree_node *pivot = node->right; + pivot = node->right; if (node->parent == NULL) { tree->root = pivot; @@ -397,11 +400,13 @@ index_init_plain(lzma_allocator *allocator) extern LZMA_API(lzma_index *) lzma_index_init(lzma_allocator *allocator) { + index_stream *s; + lzma_index *i = index_init_plain(allocator); if (i == NULL) return NULL; - index_stream *s = index_stream_init(0, 0, 1, 0, allocator); + s = index_stream_init(0, 0, 1, 0, allocator); if (s == NULL) { lzma_free(i, allocator); return NULL; @@ -600,6 +605,8 @@ lzma_index_padding_size(const lzma_index *i) extern LZMA_API(lzma_ret) lzma_index_stream_flags(lzma_index *i, const lzma_stream_flags *stream_flags) { + index_stream *s; + if (i == NULL || stream_flags == NULL) return LZMA_PROG_ERROR; @@ -607,7 +614,7 @@ lzma_index_stream_flags(lzma_index *i, const lzma_stream_flags *stream_flags) return_if_error(lzma_stream_flags_compare( stream_flags, stream_flags)); - index_stream *s = (index_stream *)(i->streams.rightmost); + s = (index_stream *)(i->streams.rightmost); s->stream_flags = *stream_flags; return LZMA_OK; @@ -617,14 +624,17 @@ lzma_index_stream_flags(lzma_index *i, const lzma_stream_flags *stream_flags) extern LZMA_API(lzma_ret) lzma_index_stream_padding(lzma_index *i, lzma_vli stream_padding) { + index_stream *s; + lzma_vli old_stream_padding; + if (i == NULL || stream_padding > LZMA_VLI_MAX || (stream_padding & 3) != 0) return LZMA_PROG_ERROR; - index_stream *s = (index_stream *)(i->streams.rightmost); + s = (index_stream *)(i->streams.rightmost); // Check that the new value won't make the file grow too big. - const lzma_vli old_stream_padding = s->stream_padding; + old_stream_padding = s->stream_padding; s->stream_padding = 0; if (lzma_index_file_size(i) + stream_padding > LZMA_VLI_MAX) { s->stream_padding = old_stream_padding; @@ -640,20 +650,26 @@ extern LZMA_API(lzma_ret) lzma_index_append(lzma_index *i, lzma_allocator *allocator, lzma_vli unpadded_size, lzma_vli uncompressed_size) { + index_stream *s; + index_group *g; + lzma_vli compressed_base; + lzma_vli uncompressed_base; + uint32_t index_list_size_add; + // Validate. if (i == NULL || unpadded_size < UNPADDED_SIZE_MIN || unpadded_size > UNPADDED_SIZE_MAX || uncompressed_size > LZMA_VLI_MAX) return LZMA_PROG_ERROR; - index_stream *s = (index_stream *)(i->streams.rightmost); - index_group *g = (index_group *)(s->groups.rightmost); + s = (index_stream *)(i->streams.rightmost); + g = (index_group *)(s->groups.rightmost); - const lzma_vli compressed_base = g == NULL ? 0 + compressed_base = g == NULL ? 0 : vli_ceil4(g->records[g->last].unpadded_sum); - const lzma_vli uncompressed_base = g == NULL ? 0 + uncompressed_base = g == NULL ? 0 : g->records[g->last].uncompressed_sum; - const uint32_t index_list_size_add = lzma_vli_size(unpadded_size) + index_list_size_add = lzma_vli_size(unpadded_size) + lzma_vli_size(uncompressed_size); // Check that the file size will stay within limits. @@ -767,6 +783,7 @@ extern LZMA_API(lzma_ret) lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src, lzma_allocator *allocator) { + index_cat_info info; const lzma_vli dest_file_size = lzma_index_file_size(dest); // Check that we don't exceed the file size limits. @@ -796,10 +813,12 @@ lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src, index_stream *s = (index_stream *)(dest->streams.rightmost); index_group *g = (index_group *)(s->groups.rightmost); if (g != NULL && g->last + 1 < g->allocated) { + index_group *newg; + assert(g->node.left == NULL); assert(g->node.right == NULL); - index_group *newg = lzma_alloc(sizeof(index_group) + newg = lzma_alloc(sizeof(index_group) + (g->last + 1) * sizeof(index_record), allocator); @@ -834,13 +853,12 @@ lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src, // Add all the Streams from src to dest. Update the base offsets // of each Stream from src. - const index_cat_info info = { - .uncompressed_size = dest->uncompressed_size, - .file_size = dest_file_size, - .stream_number_add = dest->streams.count, - .block_number_add = dest->record_count, - .streams = &dest->streams, - }; + info.uncompressed_size = dest->uncompressed_size; + info.file_size = dest_file_size; + info.stream_number_add = dest->streams.count; + info.block_number_add = dest->record_count; + info.streams = &dest->streams; + index_cat_helper(&info, (index_stream *)(src->streams.root)); // Update info about all the combined Streams. @@ -861,12 +879,17 @@ lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src, static index_stream * index_dup_stream(const index_stream *src, lzma_allocator *allocator) { + index_stream *dest; + index_group *destg; + index_group *srcg; + size_t i = 0; + // Catch a somewhat theoretical integer overflow. if (src->record_count > PREALLOC_MAX) return NULL; // Allocate and initialize a new Stream. - index_stream *dest = index_stream_init(src->node.compressed_base, + dest = index_stream_init(src->node.compressed_base, src->node.uncompressed_base, src->number, src->block_number_base, allocator); @@ -884,7 +907,7 @@ index_dup_stream(const index_stream *src, lzma_allocator *allocator) // Allocate memory for the Records. We put all the Records into // a single group. It's simplest and also tends to make // lzma_index_locate() a little bit faster with very big Indexes. - index_group *destg = lzma_alloc(sizeof(index_group) + destg = lzma_alloc(sizeof(index_group) + src->record_count * sizeof(index_record), allocator); if (destg == NULL) { @@ -900,8 +923,7 @@ index_dup_stream(const index_stream *src, lzma_allocator *allocator) destg->last = src->record_count - 1; // Go through all the groups in src and copy the Records into destg. - const index_group *srcg = (const index_group *)(src->groups.leftmost); - size_t i = 0; + srcg = (index_group *)(src->groups.leftmost); do { memcpy(destg->records + i, srcg->records, (srcg->last + 1) * sizeof(index_record)); @@ -921,6 +943,9 @@ index_dup_stream(const index_stream *src, lzma_allocator *allocator) extern LZMA_API(lzma_index *) lzma_index_dup(const lzma_index *src, lzma_allocator *allocator) { + index_stream *srcstream; + index_stream *deststream; + // Allocate the base structure (no initial Stream). lzma_index *dest = index_init_plain(allocator); if (dest == NULL) @@ -933,11 +958,9 @@ lzma_index_dup(const lzma_index *src, lzma_allocator *allocator) dest->index_list_size = src->index_list_size; // Copy the Streams and the groups in them. - const index_stream *srcstream - = (const index_stream *)(src->streams.leftmost); + srcstream = (index_stream *)(src->streams.leftmost); do { - index_stream *deststream = index_dup_stream( - srcstream, allocator); + deststream = index_dup_stream(srcstream, allocator); if (deststream == NULL) { lzma_index_end(dest, allocator); return NULL; @@ -1096,14 +1119,19 @@ lzma_index_iter_rewind(lzma_index_iter *iter) extern LZMA_API(lzma_bool) lzma_index_iter_next(lzma_index_iter *iter, lzma_index_iter_mode mode) { + const lzma_index *i; + const index_stream *stream; + const index_group *group; + size_t record; + // Catch unsupported mode values. if ((unsigned int)(mode) > LZMA_INDEX_ITER_NONEMPTY_BLOCK) return true; - const lzma_index *i = iter->internal[ITER_INDEX].p; - const index_stream *stream = iter->internal[ITER_STREAM].p; - const index_group *group = NULL; - size_t record = iter->internal[ITER_RECORD].s; + i = iter->internal[ITER_INDEX].p; + stream = iter->internal[ITER_STREAM].p; + group = NULL; + record = iter->internal[ITER_RECORD].s; // If we are being asked for the next Stream, leave group to NULL // so that the rest of the this function thinks that this Stream @@ -1203,6 +1231,10 @@ again: extern LZMA_API(lzma_bool) lzma_index_iter_locate(lzma_index_iter *iter, lzma_vli target) { + const index_stream *stream; + const index_group *group; + size_t left, right; + const lzma_index *i = iter->internal[ITER_INDEX].p; // If the target is past the end of the file, return immediately. @@ -1210,12 +1242,12 @@ lzma_index_iter_locate(lzma_index_iter *iter, lzma_vli target) return true; // Locate the Stream containing the target offset. - const index_stream *stream = index_tree_locate(&i->streams, target); + stream = index_tree_locate(&i->streams, target); assert(stream != NULL); target -= stream->node.uncompressed_base; // Locate the group containing the target offset. - const index_group *group = index_tree_locate(&stream->groups, target); + group = index_tree_locate(&stream->groups, target); assert(group != NULL); // Use binary search to locate the exact Record. It is the first @@ -1223,8 +1255,8 @@ lzma_index_iter_locate(lzma_index_iter *iter, lzma_vli target) // This is because we want the rightmost Record that fullfills the // search criterion. It is possible that there are empty Blocks; // we don't want to return them. - size_t left = 0; - size_t right = group->last; + left = 0; + right = group->last; while (left < right) { const size_t pos = left + (right - left) / 2; diff --git a/Utilities/cmliblzma/liblzma/common/index_decoder.c b/Utilities/cmliblzma/liblzma/common/index_decoder.c index 83c8a3a..6c91f10 100644 --- a/Utilities/cmliblzma/liblzma/common/index_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/index_decoder.c @@ -289,7 +289,7 @@ index_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit) { - lzma_next_strm_init(index_decoder_init, strm, i, memlimit); + lzma_next_strm_init2(index_decoder_init, strm, i, memlimit); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; @@ -303,21 +303,23 @@ lzma_index_buffer_decode( lzma_index **i, uint64_t *memlimit, lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size) { + lzma_coder coder; + lzma_ret ret; + + // Store the input start position so that we can restore it in case + // of an error. + const size_t in_start = *in_pos; + // Sanity checks if (i == NULL || memlimit == NULL || in == NULL || in_pos == NULL || *in_pos > in_size) return LZMA_PROG_ERROR; // Initialize the decoder. - lzma_coder coder; return_if_error(index_decoder_reset(&coder, allocator, i, *memlimit)); - // Store the input start position so that we can restore it in case - // of an error. - const size_t in_start = *in_pos; - // Do the actual decoding. - lzma_ret ret = index_decode(&coder, allocator, in, in_pos, in_size, + ret = index_decode(&coder, allocator, in, in_pos, in_size, NULL, NULL, 0, LZMA_RUN); if (ret == LZMA_STREAM_END) { diff --git a/Utilities/cmliblzma/liblzma/common/index_encoder.c b/Utilities/cmliblzma/liblzma/common/index_encoder.c index 45919f0..a6f8598 100644 --- a/Utilities/cmliblzma/liblzma/common/index_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/index_encoder.c @@ -207,7 +207,7 @@ lzma_index_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_index_encoder(lzma_stream *strm, const lzma_index *i) { - lzma_next_strm_init(lzma_index_encoder_init, strm, i); + lzma_next_strm_init1(lzma_index_encoder_init, strm, i); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; @@ -220,6 +220,10 @@ extern LZMA_API(lzma_ret) lzma_index_buffer_encode(const lzma_index *i, uint8_t *out, size_t *out_pos, size_t out_size) { + lzma_coder coder; + size_t out_start; + lzma_ret ret; + // Validate the arguments. if (i == NULL || out == NULL || out_pos == NULL || *out_pos > out_size) return LZMA_PROG_ERROR; @@ -230,13 +234,12 @@ lzma_index_buffer_encode(const lzma_index *i, // The Index encoder needs just one small data structure so we can // allocate it on stack. - lzma_coder coder; index_encoder_reset(&coder, i); // Do the actual encoding. This should never fail, but store // the original *out_pos just in case. - const size_t out_start = *out_pos; - lzma_ret ret = index_encode(&coder, NULL, NULL, NULL, 0, + out_start = *out_pos; + ret = index_encode(&coder, NULL, NULL, NULL, 0, out, out_pos, out_size, LZMA_RUN); if (ret == LZMA_STREAM_END) { diff --git a/Utilities/cmliblzma/liblzma/common/index_hash.c b/Utilities/cmliblzma/liblzma/common/index_hash.c index e3e9386..0cf86b3 100644 --- a/Utilities/cmliblzma/liblzma/common/index_hash.c +++ b/Utilities/cmliblzma/liblzma/common/index_hash.c @@ -124,13 +124,14 @@ static lzma_ret hash_append(lzma_index_hash_info *info, lzma_vli unpadded_size, lzma_vli uncompressed_size) { + const lzma_vli sizes[2] = { unpadded_size, uncompressed_size }; + info->blocks_size += vli_ceil4(unpadded_size); info->uncompressed_size += uncompressed_size; info->index_list_size += lzma_vli_size(unpadded_size) + lzma_vli_size(uncompressed_size); ++info->count; - const lzma_vli sizes[2] = { unpadded_size, uncompressed_size }; lzma_check_update(&info->check, LZMA_CHECK_BEST, (const uint8_t *)(sizes), sizeof(sizes)); @@ -173,6 +174,9 @@ extern LZMA_API(lzma_ret) lzma_index_hash_decode(lzma_index_hash *index_hash, const uint8_t *in, size_t *in_pos, size_t in_size) { + size_t in_start; + lzma_ret ret; + // Catch zero input buffer here, because in contrast to Index encoder // and decoder functions, applications call this function directly // instead of via lzma_code(), which does the buffer checking. @@ -182,8 +186,8 @@ lzma_index_hash_decode(lzma_index_hash *index_hash, const uint8_t *in, // NOTE: This function has many similarities to index_encode() and // index_decode() functions found from index_encoder.c and // index_decoder.c. See the comments especially in index_encoder.c. - const size_t in_start = *in_pos; - lzma_ret ret = LZMA_OK; + in_start = *in_pos; + ret = LZMA_OK; while (*in_pos < in_size) switch (index_hash->sequence) { diff --git a/Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c b/Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c index ae75315..9e2e1da 100644 --- a/Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c @@ -19,6 +19,9 @@ lzma_stream_buffer_decode(uint64_t *memlimit, uint32_t flags, const uint8_t *in, size_t *in_pos, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) { + lzma_next_coder stream_decoder = LZMA_NEXT_CODER_INIT; + lzma_ret ret; + // Sanity checks if (in_pos == NULL || (in == NULL && *in_pos != in_size) || *in_pos > in_size || out_pos == NULL @@ -33,8 +36,7 @@ lzma_stream_buffer_decode(uint64_t *memlimit, uint32_t flags, // Initialize the Stream decoder. // TODO: We need something to tell the decoder that it can use the // output buffer as workspace, and thus save significant amount of RAM. - lzma_next_coder stream_decoder = LZMA_NEXT_CODER_INIT; - lzma_ret ret = lzma_stream_decoder_init( + ret = lzma_stream_decoder_init( &stream_decoder, allocator, *memlimit, flags); if (ret == LZMA_OK) { diff --git a/Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c b/Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c index 2450ee2..8bca87f 100644 --- a/Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c @@ -45,6 +45,10 @@ lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check, lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos_ptr, size_t out_size) { + lzma_stream_flags stream_flags = { 0 }; + lzma_block block = { 0 }; + size_t out_pos; + // Sanity checks if (filters == NULL || (unsigned int)(check) > LZMA_CHECK_ID_MAX || (in == NULL && in_size != 0) || out == NULL @@ -61,7 +65,7 @@ lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check, // Use a local copy. We update *out_pos_ptr only if everything // succeeds. - size_t out_pos = *out_pos_ptr; + out_pos = *out_pos_ptr; // Check that there's enough space for both Stream Header and // Stream Footer. @@ -73,10 +77,7 @@ lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check, out_size -= LZMA_STREAM_HEADER_SIZE; // Encode the Stream Header. - lzma_stream_flags stream_flags = { - .version = 0, - .check = check, - }; + stream_flags.check = check; if (lzma_stream_header_encode(&stream_flags, out + out_pos) != LZMA_OK) @@ -85,11 +86,8 @@ lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check, out_pos += LZMA_STREAM_HEADER_SIZE; // Encode a Block but only if there is at least one byte of input. - lzma_block block = { - .version = 0, - .check = check, - .filters = filters, - }; + block.check = check; + block.filters = filters; if (in_size > 0) return_if_error(lzma_block_buffer_encode(&block, allocator, @@ -97,6 +95,8 @@ lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check, // Index { + lzma_ret ret; + // Create an Index. It will have one Record if there was // at least one byte of input to encode. Otherwise the // Index will be empty. @@ -104,7 +104,7 @@ lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check, if (i == NULL) return LZMA_MEM_ERROR; - lzma_ret ret = LZMA_OK; + ret = LZMA_OK; if (in_size > 0) ret = lzma_index_append(i, allocator, diff --git a/Utilities/cmliblzma/liblzma/common/stream_decoder.c b/Utilities/cmliblzma/liblzma/common/stream_decoder.c index 37ea71e..56a009b 100644 --- a/Utilities/cmliblzma/liblzma/common/stream_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_decoder.c @@ -106,6 +106,8 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, while (true) switch (coder->sequence) { case SEQ_STREAM_HEADER: { + lzma_ret ret; + // Copy the Stream Header to the internal buffer. lzma_bufcpy(in, in_pos, in_size, coder->buffer, &coder->pos, LZMA_STREAM_HEADER_SIZE); @@ -117,7 +119,7 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, coder->pos = 0; // Decode the Stream Header. - const lzma_ret ret = lzma_stream_header_decode( + ret = lzma_stream_header_decode( &coder->stream_flags, coder->buffer); if (ret != LZMA_OK) return ret == LZMA_FORMAT_ERROR && !coder->first_stream @@ -154,6 +156,11 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, // Fall through case SEQ_BLOCK_HEADER: { + lzma_filter filters[LZMA_FILTERS_MAX + 1]; + uint64_t memusage; + lzma_ret ret; + size_t i; + if (*in_pos >= in_size) return LZMA_OK; @@ -188,7 +195,6 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, // Set up a buffer to hold the filter chain. Block Header // decoder will initialize all members of this array so // we don't need to do it here. - lzma_filter filters[LZMA_FILTERS_MAX + 1]; coder->block_options.filters = filters; // Decode the Block Header. @@ -196,9 +202,7 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, allocator, coder->buffer)); // Check the memory usage limit. - const uint64_t memusage = lzma_raw_decoder_memusage(filters); - lzma_ret ret; - + memusage = lzma_raw_decoder_memusage(filters); if (memusage == UINT64_MAX) { // One or more unknown Filter IDs. ret = LZMA_OPTIONS_ERROR; @@ -224,7 +228,7 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, // Free the allocated filter options since they are needed // only to initialize the Block decoder. - for (size_t i = 0; i < LZMA_FILTERS_MAX; ++i) + for (i = 0; i < LZMA_FILTERS_MAX; ++i) lzma_free(filters[i].options, allocator); coder->block_options.filters = NULL; @@ -260,6 +264,8 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, } case SEQ_INDEX: { + lzma_ret ret; + // If we don't have any input, don't call // lzma_index_hash_decode() since it would return // LZMA_BUF_ERROR, which we must not do here. @@ -268,7 +274,7 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, // Decode the Index and compare it to the hash calculated // from the sizes of the Blocks (if any). - const lzma_ret ret = lzma_index_hash_decode(coder->index_hash, + ret = lzma_index_hash_decode(coder->index_hash, in, in_pos, in_size); if (ret != LZMA_STREAM_END) return ret; @@ -279,6 +285,9 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, // Fall through case SEQ_STREAM_FOOTER: { + lzma_stream_flags footer_flags; + lzma_ret ret; + // Copy the Stream Footer to the internal buffer. lzma_bufcpy(in, in_pos, in_size, coder->buffer, &coder->pos, LZMA_STREAM_HEADER_SIZE); @@ -292,8 +301,7 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, // Decode the Stream Footer. The decoder gives // LZMA_FORMAT_ERROR if the magic bytes don't match, // so convert that return code to LZMA_DATA_ERROR. - lzma_stream_flags footer_flags; - const lzma_ret ret = lzma_stream_footer_decode( + ret = lzma_stream_footer_decode( &footer_flags, coder->buffer); if (ret != LZMA_OK) return ret == LZMA_FORMAT_ERROR @@ -442,7 +450,7 @@ lzma_stream_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_stream_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags) { - lzma_next_strm_init(lzma_stream_decoder_init, strm, memlimit, flags); + lzma_next_strm_init2(lzma_stream_decoder_init, strm, memlimit, flags); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; diff --git a/Utilities/cmliblzma/liblzma/common/stream_encoder.c b/Utilities/cmliblzma/liblzma/common/stream_encoder.c index 97a7a23..e2f2e10 100644 --- a/Utilities/cmliblzma/liblzma/common/stream_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_encoder.c @@ -147,6 +147,8 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator, } case SEQ_BLOCK_ENCODE: { + lzma_vli unpadded_size; + static const lzma_action convert[4] = { LZMA_RUN, LZMA_SYNC_FLUSH, @@ -162,7 +164,7 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator, return ret; // Add a new Index Record. - const lzma_vli unpadded_size = lzma_block_unpadded_size( + unpadded_size = lzma_block_unpadded_size( &coder->block_options); assert(unpadded_size != 0); return_if_error(lzma_index_append(coder->index, allocator, @@ -174,6 +176,12 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator, } case SEQ_INDEX_ENCODE: { + const lzma_stream_flags stream_flags = { + 0, + lzma_index_size(coder->index), + coder->block_options.check, + }; + // Call the Index encoder. It doesn't take any input, so // those pointers can be NULL. const lzma_ret ret = coder->index_encoder.code( @@ -184,11 +192,6 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator, return ret; // Encode the Stream Footer into coder->buffer. - const lzma_stream_flags stream_flags = { - .version = 0, - .backward_size = lzma_index_size(coder->index), - .check = coder->block_options.check, - }; if (lzma_stream_footer_encode(&stream_flags, coder->buffer) != LZMA_OK) @@ -211,11 +214,13 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator, static void stream_encoder_end(lzma_coder *coder, lzma_allocator *allocator) { + size_t i; + lzma_next_end(&coder->block_encoder, allocator); lzma_next_end(&coder->index_encoder, allocator); lzma_index_end(coder->index, allocator); - for (size_t i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i) + for (i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i) lzma_free(coder->filters[i].options, allocator); lzma_free(coder, allocator); @@ -228,14 +233,18 @@ stream_encoder_update(lzma_coder *coder, lzma_allocator *allocator, const lzma_filter *filters, const lzma_filter *reversed_filters) { + size_t i; + if (coder->sequence <= SEQ_BLOCK_INIT) { + lzma_ret ret; + // There is no incomplete Block waiting to be finished, // thus we can change the whole filter chain. Start by // trying to initialize the Block encoder with the new // chain. This way we detect if the chain is valid. coder->block_encoder_is_initialized = false; coder->block_options.filters = (lzma_filter *)(filters); - const lzma_ret ret = block_encoder_init(coder, allocator); + ret = block_encoder_init(coder, allocator); coder->block_options.filters = coder->filters; if (ret != LZMA_OK) return ret; @@ -255,7 +264,7 @@ stream_encoder_update(lzma_coder *coder, lzma_allocator *allocator, } // Free the copy of the old chain and make a copy of the new chain. - for (size_t i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i) + for (i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i) lzma_free(coder->filters[i].options, allocator); return lzma_filters_copy(filters, coder->filters, allocator); @@ -266,6 +275,8 @@ extern lzma_ret lzma_stream_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, const lzma_filter *filters, lzma_check check) { + lzma_stream_flags stream_flags = { 0, 0, check }; + lzma_next_coder_init(&lzma_stream_encoder_init, next, allocator); if (filters == NULL) @@ -298,10 +309,6 @@ lzma_stream_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, return LZMA_MEM_ERROR; // Encode the Stream Header - lzma_stream_flags stream_flags = { - .version = 0, - .check = check, - }; return_if_error(lzma_stream_header_encode( &stream_flags, next->coder->buffer)); @@ -320,7 +327,7 @@ extern LZMA_API(lzma_ret) lzma_stream_encoder(lzma_stream *strm, const lzma_filter *filters, lzma_check check) { - lzma_next_strm_init(lzma_stream_encoder_init, strm, filters, check); + lzma_next_strm_init2(lzma_stream_encoder_init, strm, filters, check); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true; diff --git a/Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c b/Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c index 1bc2f97..8cf48a4 100644 --- a/Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c @@ -30,13 +30,15 @@ stream_flags_decode(lzma_stream_flags *options, const uint8_t *in) extern LZMA_API(lzma_ret) lzma_stream_header_decode(lzma_stream_flags *options, const uint8_t *in) { + uint32_t crc; + // Magic if (memcmp(in, lzma_header_magic, sizeof(lzma_header_magic)) != 0) return LZMA_FORMAT_ERROR; // Verify the CRC32 so we can distinguish between corrupt // and unsupported files. - const uint32_t crc = lzma_crc32(in + sizeof(lzma_header_magic), + crc = lzma_crc32(in + sizeof(lzma_header_magic), LZMA_STREAM_FLAGS_SIZE, 0); if (crc != unaligned_read32le(in + sizeof(lzma_header_magic) + LZMA_STREAM_FLAGS_SIZE)) @@ -59,13 +61,15 @@ lzma_stream_header_decode(lzma_stream_flags *options, const uint8_t *in) extern LZMA_API(lzma_ret) lzma_stream_footer_decode(lzma_stream_flags *options, const uint8_t *in) { + uint32_t crc; + // Magic if (memcmp(in + sizeof(uint32_t) * 2 + LZMA_STREAM_FLAGS_SIZE, lzma_footer_magic, sizeof(lzma_footer_magic)) != 0) return LZMA_FORMAT_ERROR; // CRC32 - const uint32_t crc = lzma_crc32(in + sizeof(uint32_t), + crc = lzma_crc32(in + sizeof(uint32_t), sizeof(uint32_t) + LZMA_STREAM_FLAGS_SIZE, 0); if (crc != unaligned_read32le(in)) return LZMA_DATA_ERROR; diff --git a/Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c b/Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c index 4e71715..290339e 100644 --- a/Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c @@ -29,6 +29,8 @@ stream_flags_encode(const lzma_stream_flags *options, uint8_t *out) extern LZMA_API(lzma_ret) lzma_stream_header_encode(const lzma_stream_flags *options, uint8_t *out) { + uint32_t crc; + assert(sizeof(lzma_header_magic) + LZMA_STREAM_FLAGS_SIZE + 4 == LZMA_STREAM_HEADER_SIZE); @@ -43,7 +45,7 @@ lzma_stream_header_encode(const lzma_stream_flags *options, uint8_t *out) return LZMA_PROG_ERROR; // CRC32 of the Stream Header - const uint32_t crc = lzma_crc32(out + sizeof(lzma_header_magic), + crc = lzma_crc32(out + sizeof(lzma_header_magic), LZMA_STREAM_FLAGS_SIZE, 0); unaligned_write32le(out + sizeof(lzma_header_magic) @@ -56,6 +58,8 @@ lzma_stream_header_encode(const lzma_stream_flags *options, uint8_t *out) extern LZMA_API(lzma_ret) lzma_stream_footer_encode(const lzma_stream_flags *options, uint8_t *out) { + uint32_t crc; + assert(2 * 4 + LZMA_STREAM_FLAGS_SIZE + sizeof(lzma_footer_magic) == LZMA_STREAM_HEADER_SIZE); @@ -73,7 +77,7 @@ lzma_stream_footer_encode(const lzma_stream_flags *options, uint8_t *out) return LZMA_PROG_ERROR; // CRC32 - const uint32_t crc = lzma_crc32( + crc = lzma_crc32( out + 4, 4 + LZMA_STREAM_FLAGS_SIZE, 0); unaligned_write32le(out, crc); diff --git a/Utilities/cmliblzma/liblzma/common/vli_size.c b/Utilities/cmliblzma/liblzma/common/vli_size.c index ec1b4fa..8b931e4 100644 --- a/Utilities/cmliblzma/liblzma/common/vli_size.c +++ b/Utilities/cmliblzma/liblzma/common/vli_size.c @@ -16,10 +16,11 @@ extern LZMA_API(uint32_t) lzma_vli_size(lzma_vli vli) { + uint32_t i = 0; + if (vli > LZMA_VLI_MAX) return 0; - uint32_t i = 0; do { vli >>= 7; ++i; diff --git a/Utilities/cmliblzma/liblzma/delta/delta_common.c b/Utilities/cmliblzma/liblzma/delta/delta_common.c index 930ad21..803e674 100644 --- a/Utilities/cmliblzma/liblzma/delta/delta_common.c +++ b/Utilities/cmliblzma/liblzma/delta/delta_common.c @@ -27,6 +27,8 @@ extern lzma_ret lzma_delta_coder_init(lzma_next_coder *next, lzma_allocator *allocator, const lzma_filter_info *filters) { + const lzma_options_delta *opt; + // Allocate memory for the decoder if needed. if (next->coder == NULL) { next->coder = lzma_alloc(sizeof(lzma_coder), allocator); @@ -43,7 +45,7 @@ lzma_delta_coder_init(lzma_next_coder *next, lzma_allocator *allocator, return LZMA_OPTIONS_ERROR; // Set the delta distance. - const lzma_options_delta *opt = filters[0].options; + opt = filters[0].options; next->coder->distance = opt->dist; // Initialize the rest of the variables. diff --git a/Utilities/cmliblzma/liblzma/delta/delta_decoder.c b/Utilities/cmliblzma/liblzma/delta/delta_decoder.c index 2cf60d5..582e58e 100644 --- a/Utilities/cmliblzma/liblzma/delta/delta_decoder.c +++ b/Utilities/cmliblzma/liblzma/delta/delta_decoder.c @@ -17,9 +17,10 @@ static void decode_buffer(lzma_coder *coder, uint8_t *buffer, size_t size) { + size_t i; const size_t distance = coder->distance; - for (size_t i = 0; i < size; ++i) { + for (i = 0; i < size; ++i) { buffer[i] += coder->history[(distance + coder->pos) & 0xFF]; coder->history[coder->pos-- & 0xFF] = buffer[i]; } @@ -32,11 +33,12 @@ delta_decode(lzma_coder *coder, lzma_allocator *allocator, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_action action) { - assert(coder->next.code != NULL); - const size_t out_start = *out_pos; + lzma_ret ret; - const lzma_ret ret = coder->next.code(coder->next.coder, allocator, + assert(coder->next.code != NULL); + + ret = coder->next.code(coder->next.coder, allocator, in, in_pos, in_size, out, out_pos, out_size, action); @@ -59,11 +61,12 @@ extern lzma_ret lzma_delta_props_decode(void **options, lzma_allocator *allocator, const uint8_t *props, size_t props_size) { + lzma_options_delta *opt; + if (props_size != 1) return LZMA_OPTIONS_ERROR; - lzma_options_delta *opt - = lzma_alloc(sizeof(lzma_options_delta), allocator); + opt = lzma_alloc(sizeof(lzma_options_delta), allocator); if (opt == NULL) return LZMA_MEM_ERROR; diff --git a/Utilities/cmliblzma/liblzma/delta/delta_encoder.c b/Utilities/cmliblzma/liblzma/delta/delta_encoder.c index 15c7951..8b9e4a8 100644 --- a/Utilities/cmliblzma/liblzma/delta/delta_encoder.c +++ b/Utilities/cmliblzma/liblzma/delta/delta_encoder.c @@ -21,9 +21,10 @@ static void copy_and_encode(lzma_coder *coder, const uint8_t *restrict in, uint8_t *restrict out, size_t size) { + size_t i; const size_t distance = coder->distance; - for (size_t i = 0; i < size; ++i) { + for (i = 0; i < size; ++i) { const uint8_t tmp = coder->history[ (distance + coder->pos) & 0xFF]; coder->history[coder->pos-- & 0xFF] = in[i]; @@ -37,9 +38,10 @@ copy_and_encode(lzma_coder *coder, static void encode_in_place(lzma_coder *coder, uint8_t *buffer, size_t size) { + size_t i; const size_t distance = coder->distance; - for (size_t i = 0; i < size; ++i) { + for (i = 0; i < size; ++i) { const uint8_t tmp = coder->history[ (distance + coder->pos) & 0xFF]; coder->history[coder->pos-- & 0xFF] = buffer[i]; @@ -109,12 +111,13 @@ lzma_delta_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern lzma_ret lzma_delta_props_encode(const void *options, uint8_t *out) { + const lzma_options_delta *opt = options; + // The caller must have already validated the options, so it's // LZMA_PROG_ERROR if they are invalid. if (lzma_delta_coder_memusage(options) == UINT64_MAX) return LZMA_PROG_ERROR; - const lzma_options_delta *opt = options; out[0] = opt->dist - LZMA_DELTA_DIST_MIN; return LZMA_OK; diff --git a/Utilities/cmliblzma/liblzma/lz/lz_decoder.c b/Utilities/cmliblzma/liblzma/lz/lz_decoder.c index d74085c..f45984e 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_decoder.c +++ b/Utilities/cmliblzma/liblzma/lz/lz_decoder.c @@ -69,13 +69,17 @@ decode_buffer(lzma_coder *coder, size_t *restrict out_pos, size_t out_size) { while (true) { + size_t copy_size; + size_t dict_start; + lzma_ret ret; + // Wrap the dictionary if needed. if (coder->dict.pos == coder->dict.size) coder->dict.pos = 0; // Store the current dictionary position. It is needed to know // where to start copying to the out[] buffer. - const size_t dict_start = coder->dict.pos; + dict_start = coder->dict.pos; // Calculate how much we allow coder->lz.code() to decode. // It must not decode past the end of the dictionary @@ -86,13 +90,13 @@ decode_buffer(lzma_coder *coder, coder->dict.size - coder->dict.pos); // Call the coder->lz.code() to do the actual decoding. - const lzma_ret ret = coder->lz.code( + ret = coder->lz.code( coder->lz.coder, &coder->dict, in, in_pos, in_size); // Copy the decoded data from the dictionary to the out[] // buffer. - const size_t copy_size = coder->dict.pos - dict_start; + copy_size = coder->dict.pos - dict_start; assert(copy_size <= out_size - *out_pos); memcpy(out + *out_pos, coder->dict.buf + dict_start, copy_size); @@ -139,13 +143,15 @@ lz_decode(lzma_coder *coder, // We aren't the last coder in the chain, we need to decode // our input to a temporary buffer. while (*out_pos < out_size) { + lzma_ret ret; + // Fill the temporary buffer if it is empty. if (!coder->next_finished && coder->temp.pos == coder->temp.size) { coder->temp.pos = 0; coder->temp.size = 0; - const lzma_ret ret = coder->next.code( + ret = coder->next.code( coder->next.coder, allocator, in, in_pos, in_size, coder->temp.buffer, &coder->temp.size, @@ -167,7 +173,7 @@ lz_decode(lzma_coder *coder, return LZMA_OK; } - const lzma_ret ret = decode_buffer(coder, coder->temp.buffer, + ret = decode_buffer(coder, coder->temp.buffer, &coder->temp.pos, coder->temp.size, out, out_pos, out_size); @@ -206,6 +212,8 @@ lzma_lz_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, lzma_allocator *allocator, const void *options, lzma_lz_options *lz_options)) { + lzma_lz_options lz_options; + // Allocate the base structure if it isn't already allocated. if (next->coder == NULL) { next->coder = lzma_alloc(sizeof(lzma_coder), allocator); @@ -223,7 +231,6 @@ lzma_lz_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, // Allocate and initialize the LZ-based decoder. It will also give // us the dictionary size. - lzma_lz_options lz_options; return_if_error(lz_init(&next->coder->lz, allocator, filters[0].options, &lz_options)); diff --git a/Utilities/cmliblzma/liblzma/lz/lz_decoder.h b/Utilities/cmliblzma/liblzma/lz/lz_decoder.h index 7266e80..2d19cac 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_decoder.h +++ b/Utilities/cmliblzma/liblzma/lz/lz_decoder.h @@ -72,14 +72,14 @@ typedef struct { } lzma_lz_decoder; -#define LZMA_LZ_DECODER_INIT \ - (lzma_lz_decoder){ \ - .coder = NULL, \ - .code = NULL, \ - .reset = NULL, \ - .set_uncompressed = NULL, \ - .end = NULL, \ - } +static const lzma_lz_decoder LZMA_LZ_DECODER_INIT = + { + NULL, + NULL, + NULL, + NULL, + NULL, + }; extern lzma_ret lzma_lz_decoder_init(lzma_next_coder *next, @@ -151,13 +151,15 @@ dict_repeat(lzma_dict *dict, uint32_t distance, uint32_t *len) dict->pos += left; } else { + uint32_t copy_pos; + uint32_t copy_size; + // The bigger the dictionary, the more rare this // case occurs. We need to "wrap" the dict, thus // we might need two memcpy() to copy all the data. assert(dict->full == dict->size); - const uint32_t copy_pos - = dict->pos - distance - 1 + dict->size; - uint32_t copy_size = dict->size - copy_pos; + copy_pos = dict->pos - distance - 1 + dict->size; + copy_size = dict->size - copy_pos; if (copy_size < left) { memmove(dict->buf + dict->pos, dict->buf + copy_pos, diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder.c b/Utilities/cmliblzma/liblzma/lz/lz_encoder.c index e240696..a735c21 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_encoder.c +++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder.c @@ -43,16 +43,18 @@ struct lzma_coder_s { static void move_window(lzma_mf *mf) { + uint32_t move_offset; + size_t move_size; + // Align the move to a multiple of 16 bytes. Some LZ-based encoders // like LZMA use the lowest bits of mf->read_pos to know the // alignment of the uncompressed data. We also get better speed // for memmove() with aligned buffers. assert(mf->read_pos > mf->keep_size_before); - const uint32_t move_offset - = (mf->read_pos - mf->keep_size_before) & ~UINT32_C(15); + move_offset = (mf->read_pos - mf->keep_size_before) & ~UINT32_C(15); assert(mf->write_pos > move_offset); - const size_t move_size = mf->write_pos - move_offset; + move_size = mf->write_pos - move_offset; assert(move_offset + move_size <= mf->size); @@ -79,6 +81,9 @@ static lzma_ret fill_window(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, lzma_action action) { + size_t write_pos; + lzma_ret ret; + assert(coder->mf.read_pos <= coder->mf.write_pos); // Move the sliding window if needed. @@ -88,8 +93,7 @@ fill_window(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in, // Maybe this is ugly, but lzma_mf uses uint32_t for most things // (which I find cleanest), but we need size_t here when filling // the history window. - size_t write_pos = coder->mf.write_pos; - lzma_ret ret; + write_pos = coder->mf.write_pos; if (coder->next.code == NULL) { // Not using a filter, simply memcpy() as much as possible. lzma_bufcpy(in, in_pos, in_size, coder->mf.buffer, @@ -156,6 +160,8 @@ lz_encode(lzma_coder *coder, lzma_allocator *allocator, { while (*out_pos < out_size && (*in_pos < in_size || action != LZMA_RUN)) { + lzma_ret ret; + // Read more data to coder->mf.buffer if needed. if (coder->mf.action == LZMA_RUN && coder->mf.read_pos >= coder->mf.read_limit) @@ -163,7 +169,7 @@ lz_encode(lzma_coder *coder, lzma_allocator *allocator, in, in_pos, in_size, action)); // Encode - const lzma_ret ret = coder->lz.code(coder->lz.coder, + ret = coder->lz.code(coder->lz.coder, &coder->mf, out, out_pos, out_size); if (ret != LZMA_OK) { // Setting this to LZMA_RUN for cases when we are @@ -182,6 +188,14 @@ static bool lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator, const lzma_lz_options *lz_options) { + bool is_bt; + uint32_t new_count; + uint32_t reserve; + uint32_t old_size; + uint32_t hash_bytes; + uint32_t hs; + uint32_t old_count; + // For now, the dictionary size is limited to 1.5 GiB. This may grow // in the future if needed, but it needs a little more work than just // changing this check. @@ -207,14 +221,14 @@ lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator, // to size_t. // - Memory usage calculation needs something too, e.g. use uint64_t // for mf->size. - uint32_t reserve = lz_options->dict_size / 2; + reserve = lz_options->dict_size / 2; if (reserve > (UINT32_C(1) << 30)) reserve /= 2; reserve += (lz_options->before_size + lz_options->match_len_max + lz_options->after_size) / 2 + (UINT32_C(1) << 19); - const uint32_t old_size = mf->size; + old_size = mf->size; mf->size = mf->keep_size_before + reserve + mf->keep_size_after; // Deallocate the old history buffer if it exists but has different @@ -284,12 +298,11 @@ lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator, // Calculate the sizes of mf->hash and mf->son and check that // nice_len is big enough for the selected match finder. - const uint32_t hash_bytes = lz_options->match_finder & 0x0F; + hash_bytes = lz_options->match_finder & 0x0F; if (hash_bytes > mf->nice_len) return true; - const bool is_bt = (lz_options->match_finder & 0x10) != 0; - uint32_t hs; + is_bt = (lz_options->match_finder & 0x10) != 0; if (hash_bytes == 2) { hs = 0xFFFF; @@ -331,13 +344,13 @@ lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator, // hash_size_sum + sons_count cannot overflow. assert(hs < UINT32_MAX / 5); - const uint32_t old_count = mf->hash_size_sum + mf->sons_count; + old_count = mf->hash_size_sum + mf->sons_count; mf->hash_size_sum = hs; mf->sons_count = mf->cyclic_size; if (is_bt) mf->sons_count *= 2; - const uint32_t new_count = mf->hash_size_sum + mf->sons_count; + new_count = mf->hash_size_sum + mf->sons_count; // Deallocate the old hash array if it exists and has different size // than what is needed now. @@ -363,6 +376,8 @@ static bool lz_encoder_init(lzma_mf *mf, lzma_allocator *allocator, const lzma_lz_options *lz_options) { + size_t alloc_count; + // Allocate the history buffer. if (mf->buffer == NULL) { mf->buffer = lzma_alloc(mf->size, allocator); @@ -382,7 +397,7 @@ lz_encoder_init(lzma_mf *mf, lzma_allocator *allocator, mf->pending = 0; // Allocate match finder's hash array. - const size_t alloc_count = mf->hash_size_sum + mf->sons_count; + alloc_count = mf->hash_size_sum + mf->sons_count; #if UINT32_MAX >= SIZE_MAX / 4 // Check for integer overflow. (Huge dictionaries are not @@ -442,12 +457,7 @@ extern uint64_t lzma_lz_encoder_memusage(const lzma_lz_options *lz_options) { // Old buffers must not exist when calling lz_encoder_prepare(). - lzma_mf mf = { - .buffer = NULL, - .hash = NULL, - .hash_size_sum = 0, - .sons_count = 0, - }; + lzma_mf mf = { NULL }; // Setup the size information into mf. if (lz_encoder_prepare(&mf, NULL, lz_options)) @@ -501,6 +511,8 @@ lzma_lz_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, lzma_allocator *allocator, const void *options, lzma_lz_options *lz_options)) { + lzma_lz_options lz_options; + #ifdef HAVE_SMALL // We need that the CRC32 table has been initialized. lzma_crc32_init(); @@ -529,7 +541,6 @@ lzma_lz_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, } // Initialize the LZ-based encoder. - lzma_lz_options lz_options; return_if_error(lz_init(&next->coder->lz, allocator, filters[0].options, &lz_options)); diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder.h b/Utilities/cmliblzma/liblzma/lz/lz_encoder.h index 741c453..647f5e2 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_encoder.h +++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder.h @@ -218,7 +218,7 @@ typedef struct { /// Get pointer to the first byte not ran through the match finder -static inline const uint8_t * +static inline uint8_t * mf_ptr(const lzma_mf *mf) { return mf->buffer + mf->read_pos; diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h b/Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h index 342a333..de17c54 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h +++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h @@ -39,25 +39,22 @@ // Endianness doesn't matter in hash_2_calc() (no effect on the output). #ifdef TUKLIB_FAST_UNALIGNED_ACCESS # define hash_2_calc() \ - const uint32_t hash_value = *(const uint16_t *)(cur) + hash_value = *(const uint16_t *)(cur) #else # define hash_2_calc() \ - const uint32_t hash_value \ - = (uint32_t)(cur[0]) | ((uint32_t)(cur[1]) << 8) + hash_value = (uint32_t)(cur[0]) | ((uint32_t)(cur[1]) << 8) #endif #define hash_3_calc() \ - const uint32_t temp = hash_table[cur[0]] ^ cur[1]; \ - const uint32_t hash_2_value = temp & HASH_2_MASK; \ - const uint32_t hash_value \ - = (temp ^ ((uint32_t)(cur[2]) << 8)) & mf->hash_mask + temp = hash_table[cur[0]] ^ cur[1]; \ + hash_2_value = temp & HASH_2_MASK; \ + hash_value = (temp ^ ((uint32_t)(cur[2]) << 8)) & mf->hash_mask #define hash_4_calc() \ - const uint32_t temp = hash_table[cur[0]] ^ cur[1]; \ - const uint32_t hash_2_value = temp & HASH_2_MASK; \ - const uint32_t hash_3_value \ - = (temp ^ ((uint32_t)(cur[2]) << 8)) & HASH_3_MASK; \ - const uint32_t hash_value = (temp ^ ((uint32_t)(cur[2]) << 8) \ + temp = hash_table[cur[0]] ^ cur[1]; \ + hash_2_value = temp & HASH_2_MASK; \ + hash_3_value = (temp ^ ((uint32_t)(cur[2]) << 8)) & HASH_3_MASK; \ + hash_value = (temp ^ ((uint32_t)(cur[2]) << 8) \ ^ (hash_table[cur[3]] << 5)) & mf->hash_mask diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c b/Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c index f82a1c1..50c3459 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c +++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c @@ -32,8 +32,9 @@ lzma_mf_find(lzma_mf *mf, uint32_t *count_ptr, lzma_match *matches) if (count > 0) { #ifndef NDEBUG + uint32_t i; // Validate the matches. - for (uint32_t i = 0; i < count; ++i) { + for (i = 0; i < count; ++i) { assert(matches[i].len <= mf->nice_len); assert(matches[i].dist < mf->read_pos); assert(memcmp(mf_ptr(mf) - 1, @@ -49,6 +50,9 @@ lzma_mf_find(lzma_mf *mf, uint32_t *count_ptr, lzma_match *matches) // If a match of maximum search length was found, try to // extend the match to maximum possible length. if (len_best == mf->nice_len) { + uint8_t *p1; + uint8_t *p2; + // The limit for the match length is either the // maximum match length supported by the LZ-based // encoder or the number of bytes left in the @@ -59,11 +63,11 @@ lzma_mf_find(lzma_mf *mf, uint32_t *count_ptr, lzma_match *matches) // Pointer to the byte we just ran through // the match finder. - const uint8_t *p1 = mf_ptr(mf) - 1; + p1 = mf_ptr(mf) - 1; // Pointer to the beginning of the match. We need -1 // here because the match distances are zero based. - const uint8_t *p2 = p1 - matches[count - 1].dist - 1; + p2 = p1 - matches[count - 1].dist - 1; while (len_best < limit && p1[len_best] == p2[len_best]) @@ -108,18 +112,22 @@ lzma_mf_find(lzma_mf *mf, uint32_t *count_ptr, lzma_match *matches) static void normalize(lzma_mf *mf) { + uint32_t i; + uint32_t subvalue; + uint32_t count; + uint32_t *hash; + assert(mf->read_pos + mf->offset == MUST_NORMALIZE_POS); // In future we may not want to touch the lowest bits, because there // may be match finders that use larger resolution than one byte. - const uint32_t subvalue - = (MUST_NORMALIZE_POS - mf->cyclic_size); + subvalue = (MUST_NORMALIZE_POS - mf->cyclic_size); // & (~(UINT32_C(1) << 10) - 1); - const uint32_t count = mf->hash_size_sum + mf->sons_count; - uint32_t *hash = mf->hash; + count = mf->hash_size_sum + mf->sons_count; + hash = mf->hash; - for (uint32_t i = 0; i < count; ++i) { + for (i = 0; i < count; ++i) { // If the distance is greater than the dictionary size, // we can simply mark the hash element as empty. // @@ -196,15 +204,14 @@ move_pending(lzma_mf *mf) move_pending(mf); \ ret_op; \ } \ - const uint8_t *cur = mf_ptr(mf); \ - const uint32_t pos = mf->read_pos + mf->offset + cur = mf_ptr(mf); \ + pos = mf->read_pos + mf->offset /// Header for find functions. "return 0" indicates that zero matches /// were found. #define header_find(is_bt, len_min) \ - header(is_bt, len_min, return 0); \ - uint32_t matches_count = 0 + header(is_bt, len_min, return 0) /// Header for a loop in a skip function. "continue" tells to skip the rest @@ -261,10 +268,11 @@ hc_find_func( while (true) { const uint32_t delta = pos - cur_match; + const uint8_t *pb; if (depth-- == 0 || delta >= cyclic_size) return matches; - const uint8_t *const pb = cur - delta; + pb = cur - delta; cur_match = son[cyclic_pos - delta + (delta > cyclic_pos ? cyclic_size : 0)]; @@ -305,18 +313,23 @@ do { \ extern uint32_t lzma_mf_hc3_find(lzma_mf *mf, lzma_match *matches) { + const uint8_t *cur; + uint32_t pos; + uint32_t temp, hash_value, hash_2_value; /* hash_3_calc */ + uint32_t delta2, cur_match; + uint32_t len_best = 2; + uint32_t matches_count = 0; + header_find(false, 3); hash_3_calc(); - const uint32_t delta2 = pos - mf->hash[hash_2_value]; - const uint32_t cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value]; + delta2 = pos - mf->hash[hash_2_value]; + cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value]; mf->hash[hash_2_value] = pos; mf->hash[FIX_3_HASH_SIZE + hash_value] = pos; - uint32_t len_best = 2; - if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) { for ( ; len_best != len_limit; ++len_best) if (*(cur + len_best - delta2) != cur[len_best]) @@ -340,18 +353,22 @@ extern void lzma_mf_hc3_skip(lzma_mf *mf, uint32_t amount) { do { + const uint8_t *cur; + uint32_t pos; + uint32_t temp, hash_value, hash_2_value; /* hash_3_calc */ + uint32_t cur_match; + if (mf_avail(mf) < 3) { move_pending(mf); continue; } - const uint8_t *cur = mf_ptr(mf); - const uint32_t pos = mf->read_pos + mf->offset; + cur = mf_ptr(mf); + pos = mf->read_pos + mf->offset; hash_3_calc(); - const uint32_t cur_match - = mf->hash[FIX_3_HASH_SIZE + hash_value]; + cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value]; mf->hash[hash_2_value] = pos; mf->hash[FIX_3_HASH_SIZE + hash_value] = pos; @@ -367,21 +384,25 @@ lzma_mf_hc3_skip(lzma_mf *mf, uint32_t amount) extern uint32_t lzma_mf_hc4_find(lzma_mf *mf, lzma_match *matches) { + const uint8_t *cur; + uint32_t pos; + uint32_t temp, hash_value, hash_2_value, hash_3_value; /* hash_4_calc */ + uint32_t delta2, delta3, cur_match; + uint32_t len_best = 1; + uint32_t matches_count = 0; + header_find(false, 4); hash_4_calc(); - uint32_t delta2 = pos - mf->hash[hash_2_value]; - const uint32_t delta3 - = pos - mf->hash[FIX_3_HASH_SIZE + hash_3_value]; - const uint32_t cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value]; + delta2 = pos - mf->hash[hash_2_value]; + delta3 = pos - mf->hash[FIX_3_HASH_SIZE + hash_3_value]; + cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value]; mf->hash[hash_2_value ] = pos; mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos; mf->hash[FIX_4_HASH_SIZE + hash_value] = pos; - uint32_t len_best = 1; - if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) { len_best = 2; matches[0].len = 2; @@ -420,18 +441,22 @@ extern void lzma_mf_hc4_skip(lzma_mf *mf, uint32_t amount) { do { + const uint8_t *cur; + uint32_t pos; + uint32_t temp, hash_value, hash_2_value, hash_3_value; /* hash_4_calc */ + uint32_t cur_match; + if (mf_avail(mf) < 4) { move_pending(mf); continue; } - const uint8_t *cur = mf_ptr(mf); - const uint32_t pos = mf->read_pos + mf->offset; + cur = mf_ptr(mf); + pos = mf->read_pos + mf->offset; hash_4_calc(); - const uint32_t cur_match - = mf->hash[FIX_4_HASH_SIZE + hash_value]; + cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value]; mf->hash[hash_2_value] = pos; mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos; @@ -469,6 +494,10 @@ bt_find_func( uint32_t len1 = 0; while (true) { + uint32_t *pair; + const uint8_t *pb; + uint32_t len; + const uint32_t delta = pos - cur_match; if (depth-- == 0 || delta >= cyclic_size) { *ptr0 = EMPTY_HASH_VALUE; @@ -476,12 +505,12 @@ bt_find_func( return matches; } - uint32_t *const pair = son + ((cyclic_pos - delta + pair = son + ((cyclic_pos - delta + (delta > cyclic_pos ? cyclic_size : 0)) << 1); - const uint8_t *const pb = cur - delta; - uint32_t len = my_min(len0, len1); + pb = cur - delta; + len = my_min(len0, len1); if (pb[len] == cur[len]) { while (++len != len_limit) @@ -535,6 +564,10 @@ bt_skip_func( uint32_t len1 = 0; while (true) { + uint32_t *pair; + const uint8_t *pb; + uint32_t len; + const uint32_t delta = pos - cur_match; if (depth-- == 0 || delta >= cyclic_size) { *ptr0 = EMPTY_HASH_VALUE; @@ -542,11 +575,11 @@ bt_skip_func( return; } - uint32_t *pair = son + ((cyclic_pos - delta + pair = son + ((cyclic_pos - delta + (delta > cyclic_pos ? cyclic_size : 0)) << 1); - const uint8_t *pb = cur - delta; - uint32_t len = my_min(len0, len1); + pb = cur - delta; + len = my_min(len0, len1); if (pb[len] == cur[len]) { while (++len != len_limit) @@ -593,11 +626,17 @@ do { \ extern uint32_t lzma_mf_bt2_find(lzma_mf *mf, lzma_match *matches) { + const uint8_t *cur; + uint32_t pos; + uint32_t hash_value; /* hash_2_calc */ + uint32_t cur_match; + uint32_t matches_count = 0; + header_find(true, 2); hash_2_calc(); - const uint32_t cur_match = mf->hash[hash_value]; + cur_match = mf->hash[hash_value]; mf->hash[hash_value] = pos; bt_find(1); @@ -608,11 +647,16 @@ extern void lzma_mf_bt2_skip(lzma_mf *mf, uint32_t amount) { do { + const uint8_t *cur; + uint32_t pos; + uint32_t hash_value; /* hash_2_calc */ + uint32_t cur_match; + header_skip(true, 2); hash_2_calc(); - const uint32_t cur_match = mf->hash[hash_value]; + cur_match = mf->hash[hash_value]; mf->hash[hash_value] = pos; bt_skip(); @@ -626,18 +670,23 @@ lzma_mf_bt2_skip(lzma_mf *mf, uint32_t amount) extern uint32_t lzma_mf_bt3_find(lzma_mf *mf, lzma_match *matches) { + const uint8_t *cur; + uint32_t pos; + uint32_t temp, hash_value, hash_2_value; /* hash_3_calc */ + uint32_t delta2, cur_match; + uint32_t len_best = 2; + uint32_t matches_count = 0; + header_find(true, 3); hash_3_calc(); - const uint32_t delta2 = pos - mf->hash[hash_2_value]; - const uint32_t cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value]; + delta2 = pos - mf->hash[hash_2_value]; + cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value]; mf->hash[hash_2_value] = pos; mf->hash[FIX_3_HASH_SIZE + hash_value] = pos; - uint32_t len_best = 2; - if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) { for ( ; len_best != len_limit; ++len_best) if (*(cur + len_best - delta2) != cur[len_best]) @@ -661,12 +710,16 @@ extern void lzma_mf_bt3_skip(lzma_mf *mf, uint32_t amount) { do { + const uint8_t *cur; + uint32_t pos; + uint32_t temp, hash_value, hash_2_value; /* hash_3_calc */ + uint32_t cur_match; + header_skip(true, 3); hash_3_calc(); - const uint32_t cur_match - = mf->hash[FIX_3_HASH_SIZE + hash_value]; + cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value]; mf->hash[hash_2_value] = pos; mf->hash[FIX_3_HASH_SIZE + hash_value] = pos; @@ -682,21 +735,25 @@ lzma_mf_bt3_skip(lzma_mf *mf, uint32_t amount) extern uint32_t lzma_mf_bt4_find(lzma_mf *mf, lzma_match *matches) { + const uint8_t *cur; + uint32_t pos; + uint32_t temp, hash_value, hash_2_value, hash_3_value; /* hash_4_calc */ + uint32_t delta2, delta3, cur_match; + uint32_t len_best = 1; + uint32_t matches_count = 0; + header_find(true, 4); hash_4_calc(); - uint32_t delta2 = pos - mf->hash[hash_2_value]; - const uint32_t delta3 - = pos - mf->hash[FIX_3_HASH_SIZE + hash_3_value]; - const uint32_t cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value]; + delta2 = pos - mf->hash[hash_2_value]; + delta3 = pos - mf->hash[FIX_3_HASH_SIZE + hash_3_value]; + cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value]; mf->hash[hash_2_value] = pos; mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos; mf->hash[FIX_4_HASH_SIZE + hash_value] = pos; - uint32_t len_best = 1; - if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) { len_best = 2; matches[0].len = 2; @@ -735,12 +792,16 @@ extern void lzma_mf_bt4_skip(lzma_mf *mf, uint32_t amount) { do { + const uint8_t *cur; + uint32_t pos; + uint32_t temp, hash_value, hash_2_value, hash_3_value; /* hash_4_calc */ + uint32_t cur_match; + header_skip(true, 4); hash_4_calc(); - const uint32_t cur_match - = mf->hash[FIX_4_HASH_SIZE + hash_value]; + cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value]; mf->hash[hash_2_value] = pos; mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos; diff --git a/Utilities/cmliblzma/liblzma/lzma/fastpos.h b/Utilities/cmliblzma/liblzma/lzma/fastpos.h index 4aea231..5a834d6 100644 --- a/Utilities/cmliblzma/liblzma/lzma/fastpos.h +++ b/Utilities/cmliblzma/liblzma/lzma/fastpos.h @@ -75,6 +75,8 @@ // on all systems I have tried. The size optimized version is sometimes // slightly faster, but sometimes it is a lot slower. +#include "config.h" + #ifdef HAVE_SMALL # define get_pos_slot(pos) ((pos) <= 4 ? (pos) : get_pos_slot_2(pos)) diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c index 3e42575..ca14c4a 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c @@ -224,6 +224,8 @@ static lzma_ret lzma2_decoder_init(lzma_lz_decoder *lz, lzma_allocator *allocator, const void *opt, lzma_lz_options *lz_options) { + const lzma_options_lzma *options = opt; + if (lz->coder == NULL) { lz->coder = lzma_alloc(sizeof(lzma_coder), allocator); if (lz->coder == NULL) @@ -235,8 +237,6 @@ lzma2_decoder_init(lzma_lz_decoder *lz, lzma_allocator *allocator, lz->coder->lzma = LZMA_LZ_DECODER_INIT; } - const lzma_options_lzma *options = opt; - lz->coder->sequence = SEQ_CONTROL; lz->coder->need_properties = true; lz->coder->need_dictionary_reset = options->preset_dict == NULL @@ -272,6 +272,8 @@ extern lzma_ret lzma_lzma2_props_decode(void **options, lzma_allocator *allocator, const uint8_t *props, size_t props_size) { + lzma_options_lzma *opt; + if (props_size != 1) return LZMA_OPTIONS_ERROR; @@ -283,8 +285,7 @@ lzma_lzma2_props_decode(void **options, lzma_allocator *allocator, if (props[0] > 40) return LZMA_OPTIONS_ERROR; - lzma_options_lzma *opt = lzma_alloc( - sizeof(lzma_options_lzma), allocator); + opt = lzma_alloc(sizeof(lzma_options_lzma), allocator); if (opt == NULL) return LZMA_MEM_ERROR; diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c index 992720c..8784f5d 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c @@ -54,13 +54,14 @@ struct lzma_coder_s { static void lzma2_header_lzma(lzma_coder *coder) { + size_t pos; + size_t size; + assert(coder->uncompressed_size > 0); assert(coder->uncompressed_size <= LZMA2_UNCOMPRESSED_MAX); assert(coder->compressed_size > 0); assert(coder->compressed_size <= LZMA2_CHUNK_MAX); - size_t pos; - if (coder->need_properties) { pos = 0; @@ -81,7 +82,7 @@ lzma2_header_lzma(lzma_coder *coder) coder->buf_pos = pos; // Uncompressed size - size_t size = coder->uncompressed_size - 1; + size = coder->uncompressed_size - 1; coder->buf[pos++] += size >> 16; coder->buf[pos++] = (size >> 8) & 0xFF; coder->buf[pos++] = size & 0xFF; @@ -162,6 +163,9 @@ lzma2_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, // Fall through case SEQ_LZMA_ENCODE: { + uint32_t read_start; + lzma_ret ret; + // Calculate how much more uncompressed data this chunk // could accept. const uint32_t left = LZMA2_UNCOMPRESSED_MAX @@ -182,10 +186,10 @@ lzma2_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, // Save the start position so that we can update // coder->uncompressed_size. - const uint32_t read_start = mf->read_pos - mf->read_ahead; + read_start = mf->read_pos - mf->read_ahead; // Call the LZMA encoder until the chunk is finished. - const lzma_ret ret = lzma_lzma_encode(coder->lzma, mf, + ret = lzma_lzma_encode(coder->lzma, mf, coder->buf + LZMA2_HEADER_MAX, &coder->compressed_size, LZMA2_CHUNK_MAX, limit); @@ -273,6 +277,8 @@ lzma2_encoder_end(lzma_coder *coder, lzma_allocator *allocator) static lzma_ret lzma2_encoder_options_update(lzma_coder *coder, const lzma_filter *filter) { + lzma_options_lzma *opt; + // New options can be set only when there is no incomplete chunk. // This is the case at the beginning of the raw stream and right // after LZMA_SYNC_FLUSH. @@ -281,7 +287,7 @@ lzma2_encoder_options_update(lzma_coder *coder, const lzma_filter *filter) // Look if there are new options. At least for now, // only lc/lp/pb can be changed. - const lzma_options_lzma *opt = filter->options; + opt = filter->options; if (coder->opt_cur.lc != opt->lc || coder->opt_cur.lp != opt->lp || coder->opt_cur.pb != opt->pb) { // Validate the options. diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_common.h b/Utilities/cmliblzma/liblzma/lzma/lzma_common.h index e31e285..36267dc 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_common.h +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_common.h @@ -129,12 +129,15 @@ static inline void literal_init(probability (*probs)[LITERAL_CODER_SIZE], uint32_t lc, uint32_t lp) { + uint32_t coders; + uint32_t i, j; + assert(lc + lp <= LZMA_LCLP_MAX); - const uint32_t coders = 1U << (lc + lp); + coders = 1U << (lc + lp); - for (uint32_t i = 0; i < coders; ++i) - for (uint32_t j = 0; j < LITERAL_CODER_SIZE; ++j) + for (i = 0; i < coders; ++i) + for (j = 0; j < LITERAL_CODER_SIZE; ++j) bit_reset(probs[i][j]); return; diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c index 9979bb4..1bee2a9 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c @@ -114,33 +114,33 @@ do { \ case seq ## _CHOICE: \ rc_if_0(ld.choice, seq ## _CHOICE) { \ rc_update_0(ld.choice); \ - rc_bit_case(ld.low[pos_state][symbol], , , seq ## _LOW0); \ - rc_bit_case(ld.low[pos_state][symbol], , , seq ## _LOW1); \ - rc_bit_case(ld.low[pos_state][symbol], , , seq ## _LOW2); \ + rc_bit_case(ld.low[pos_state][symbol], 0, 0, seq ## _LOW0); \ + rc_bit_case(ld.low[pos_state][symbol], 0, 0, seq ## _LOW1); \ + rc_bit_case(ld.low[pos_state][symbol], 0, 0, seq ## _LOW2); \ target = symbol - LEN_LOW_SYMBOLS + MATCH_LEN_MIN; \ } else { \ rc_update_1(ld.choice); \ case seq ## _CHOICE2: \ rc_if_0(ld.choice2, seq ## _CHOICE2) { \ rc_update_0(ld.choice2); \ - rc_bit_case(ld.mid[pos_state][symbol], , , \ + rc_bit_case(ld.mid[pos_state][symbol], 0, 0, \ seq ## _MID0); \ - rc_bit_case(ld.mid[pos_state][symbol], , , \ + rc_bit_case(ld.mid[pos_state][symbol], 0, 0, \ seq ## _MID1); \ - rc_bit_case(ld.mid[pos_state][symbol], , , \ + rc_bit_case(ld.mid[pos_state][symbol], 0, 0, \ seq ## _MID2); \ target = symbol - LEN_MID_SYMBOLS \ + MATCH_LEN_MIN + LEN_LOW_SYMBOLS; \ } else { \ rc_update_1(ld.choice2); \ - rc_bit_case(ld.high[symbol], , , seq ## _HIGH0); \ - rc_bit_case(ld.high[symbol], , , seq ## _HIGH1); \ - rc_bit_case(ld.high[symbol], , , seq ## _HIGH2); \ - rc_bit_case(ld.high[symbol], , , seq ## _HIGH3); \ - rc_bit_case(ld.high[symbol], , , seq ## _HIGH4); \ - rc_bit_case(ld.high[symbol], , , seq ## _HIGH5); \ - rc_bit_case(ld.high[symbol], , , seq ## _HIGH6); \ - rc_bit_case(ld.high[symbol], , , seq ## _HIGH7); \ + rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH0); \ + rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH1); \ + rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH2); \ + rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH3); \ + rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH4); \ + rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH5); \ + rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH6); \ + rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH7); \ target = symbol - LEN_HIGH_SYMBOLS \ + MATCH_LEN_MIN \ + LEN_LOW_SYMBOLS + LEN_MID_SYMBOLS; \ @@ -285,13 +285,6 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size) { - //////////////////// - // Initialization // - //////////////////// - - if (!rc_read_init(&coder->rc, in, in_pos, in_size)) - return LZMA_OK; - /////////////// // Variables // /////////////// @@ -338,6 +331,16 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, if (no_eopm && coder->uncompressed_size < dict.limit - dict.pos) dict.limit = dict.pos + (size_t)(coder->uncompressed_size); + //////////////////// + // Initialization // + //////////////////// + + if (!rc_read_init(&coder->rc, in, in_pos, in_size)) + return LZMA_OK; + + rc = coder->rc; + rc_in_pos = *in_pos; + // The main decoder loop. The "switch" is used to restart the decoder at // correct location. Once restarted, the "switch" is no longer used. switch (coder->sequence) @@ -353,6 +356,21 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, break; rc_if_0(coder->is_match[state][pos_state], SEQ_IS_MATCH) { + static const lzma_lzma_state next_state[] = { + STATE_LIT_LIT, + STATE_LIT_LIT, + STATE_LIT_LIT, + STATE_LIT_LIT, + STATE_MATCH_LIT_LIT, + STATE_REP_LIT_LIT, + STATE_SHORTREP_LIT_LIT, + STATE_MATCH_LIT, + STATE_REP_LIT, + STATE_SHORTREP_LIT, + STATE_MATCH_LIT, + STATE_REP_LIT + }; + rc_update_0(coder->is_match[state][pos_state]); // It's a literal i.e. a single 8-bit byte. @@ -370,16 +388,21 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, rc_bit(probs[symbol], , , SEQ_LITERAL); } while (symbol < (1 << 8)); #else - rc_bit_case(probs[symbol], , , SEQ_LITERAL0); - rc_bit_case(probs[symbol], , , SEQ_LITERAL1); - rc_bit_case(probs[symbol], , , SEQ_LITERAL2); - rc_bit_case(probs[symbol], , , SEQ_LITERAL3); - rc_bit_case(probs[symbol], , , SEQ_LITERAL4); - rc_bit_case(probs[symbol], , , SEQ_LITERAL5); - rc_bit_case(probs[symbol], , , SEQ_LITERAL6); - rc_bit_case(probs[symbol], , , SEQ_LITERAL7); + rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL0); + rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL1); + rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL2); + rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL3); + rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL4); + rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL5); + rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL6); + rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL7); #endif } else { +#ifndef HAVE_SMALL + uint32_t match_bit; + uint32_t subcoder_index; +#endif + // Decode literal with match byte. // // We store the byte we compare against @@ -418,8 +441,6 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, } while (symbol < (1 << 8)); #else // Unroll the loop. - uint32_t match_bit; - uint32_t subcoder_index; # define d(seq) \ case seq: \ @@ -453,20 +474,6 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, // Use a lookup table to update to literal state, // since compared to other state updates, this would // need two branches. - static const lzma_lzma_state next_state[] = { - STATE_LIT_LIT, - STATE_LIT_LIT, - STATE_LIT_LIT, - STATE_LIT_LIT, - STATE_MATCH_LIT_LIT, - STATE_REP_LIT_LIT, - STATE_SHORTREP_LIT_LIT, - STATE_MATCH_LIT, - STATE_REP_LIT, - STATE_SHORTREP_LIT, - STATE_MATCH_LIT, - STATE_REP_LIT - }; state = next_state[state]; case SEQ_LITERAL_WRITE: @@ -511,12 +518,12 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, rc_bit(probs[symbol], , , SEQ_POS_SLOT); } while (symbol < POS_SLOTS); #else - rc_bit_case(probs[symbol], , , SEQ_POS_SLOT0); - rc_bit_case(probs[symbol], , , SEQ_POS_SLOT1); - rc_bit_case(probs[symbol], , , SEQ_POS_SLOT2); - rc_bit_case(probs[symbol], , , SEQ_POS_SLOT3); - rc_bit_case(probs[symbol], , , SEQ_POS_SLOT4); - rc_bit_case(probs[symbol], , , SEQ_POS_SLOT5); + rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT0); + rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT1); + rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT2); + rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT3); + rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT4); + rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT5); #endif // Get rid of the highest bit that was needed for // indexing of the probability array. @@ -564,25 +571,25 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, switch (limit) { case 5: assert(offset == 0); - rc_bit(probs[symbol], , + rc_bit(probs[symbol], 0, rep0 += 1, SEQ_POS_MODEL); ++offset; --limit; case 4: - rc_bit(probs[symbol], , + rc_bit(probs[symbol], 0, rep0 += 1 << offset, SEQ_POS_MODEL); ++offset; --limit; case 3: - rc_bit(probs[symbol], , + rc_bit(probs[symbol], 0, rep0 += 1 << offset, SEQ_POS_MODEL); ++offset; --limit; case 2: - rc_bit(probs[symbol], , + rc_bit(probs[symbol], 0, rep0 += 1 << offset, SEQ_POS_MODEL); ++offset; @@ -594,7 +601,7 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, // rc_bit_last() here to omit // the unneeded updating of // "symbol". - rc_bit_last(probs[symbol], , + rc_bit_last(probs[symbol], 0, rep0 += 1 << offset, SEQ_POS_MODEL); } @@ -628,19 +635,19 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, } while (++offset < ALIGN_BITS); #else case SEQ_ALIGN0: - rc_bit(coder->pos_align[symbol], , + rc_bit(coder->pos_align[symbol], 0, rep0 += 1, SEQ_ALIGN0); case SEQ_ALIGN1: - rc_bit(coder->pos_align[symbol], , + rc_bit(coder->pos_align[symbol], 0, rep0 += 2, SEQ_ALIGN1); case SEQ_ALIGN2: - rc_bit(coder->pos_align[symbol], , + rc_bit(coder->pos_align[symbol], 0, rep0 += 4, SEQ_ALIGN2); case SEQ_ALIGN3: // Like in SEQ_POS_MODEL, we don't // need "symbol" for anything else // than indexing the probability array. - rc_bit_last(coder->pos_align[symbol], , + rc_bit_last(coder->pos_align[symbol], 0, rep0 += 8, SEQ_ALIGN3); #endif @@ -725,9 +732,11 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, // is stored to rep0 and rep1, rep2 and rep3 // are updated accordingly. rc_if_0(coder->is_rep1[state], SEQ_IS_REP1) { + uint32_t distance; + rc_update_0(coder->is_rep1[state]); - const uint32_t distance = rep1; + distance = rep1; rep1 = rep0; rep0 = distance; @@ -736,19 +745,23 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, case SEQ_IS_REP2: rc_if_0(coder->is_rep2[state], SEQ_IS_REP2) { + uint32_t distance; + rc_update_0(coder->is_rep2[ state]); - const uint32_t distance = rep2; + distance = rep2; rep2 = rep1; rep1 = rep0; rep0 = distance; } else { + uint32_t distance; + rc_update_1(coder->is_rep2[ state]); - const uint32_t distance = rep3; + distance = rep3; rep3 = rep2; rep2 = rep1; rep1 = rep0; @@ -853,6 +866,9 @@ lzma_lzma_decoder_uncompressed(void *coder_ptr, lzma_vli uncompressed_size) static void lzma_decoder_reset(lzma_coder *coder, const void *opt) { + uint32_t i, j, pos_state; + uint32_t num_pos_states; + const lzma_options_lzma *options = opt; // NOTE: We assume that lc/lp/pb are valid since they were @@ -879,8 +895,8 @@ lzma_decoder_reset(lzma_coder *coder, const void *opt) rc_reset(coder->rc); // Bit and bittree decoders - for (uint32_t i = 0; i < STATES; ++i) { - for (uint32_t j = 0; j <= coder->pos_mask; ++j) { + for (i = 0; i < STATES; ++i) { + for (j = 0; j <= coder->pos_mask; ++j) { bit_reset(coder->is_match[i][j]); bit_reset(coder->is_rep0_long[i][j]); } @@ -891,22 +907,22 @@ lzma_decoder_reset(lzma_coder *coder, const void *opt) bit_reset(coder->is_rep2[i]); } - for (uint32_t i = 0; i < LEN_TO_POS_STATES; ++i) + for (i = 0; i < LEN_TO_POS_STATES; ++i) bittree_reset(coder->pos_slot[i], POS_SLOT_BITS); - for (uint32_t i = 0; i < FULL_DISTANCES - END_POS_MODEL_INDEX; ++i) + for (i = 0; i < FULL_DISTANCES - END_POS_MODEL_INDEX; ++i) bit_reset(coder->pos_special[i]); bittree_reset(coder->pos_align, ALIGN_BITS); // Len decoders (also bit/bittree) - const uint32_t num_pos_states = 1U << options->pb; + num_pos_states = 1U << options->pb; bit_reset(coder->match_len_decoder.choice); bit_reset(coder->match_len_decoder.choice2); bit_reset(coder->rep_len_decoder.choice); bit_reset(coder->rep_len_decoder.choice2); - for (uint32_t pos_state = 0; pos_state < num_pos_states; ++pos_state) { + for (pos_state = 0; pos_state < num_pos_states; ++pos_state) { bittree_reset(coder->match_len_decoder.low[pos_state], LEN_LOW_BITS); bittree_reset(coder->match_len_decoder.mid[pos_state], @@ -936,6 +952,8 @@ extern lzma_ret lzma_lzma_decoder_create(lzma_lz_decoder *lz, lzma_allocator *allocator, const void *opt, lzma_lz_options *lz_options) { + const lzma_options_lzma *options = opt; + if (lz->coder == NULL) { lz->coder = lzma_alloc(sizeof(lzma_coder), allocator); if (lz->coder == NULL) @@ -948,7 +966,6 @@ lzma_lzma_decoder_create(lzma_lz_decoder *lz, lzma_allocator *allocator, // All dictionary sizes are OK here. LZ decoder will take care of // the special cases. - const lzma_options_lzma *options = opt; lz_options->dict_size = options->dict_size; lz_options->preset_dict = options->preset_dict; lz_options->preset_dict_size = options->preset_dict_size; @@ -1028,11 +1045,12 @@ extern lzma_ret lzma_lzma_props_decode(void **options, lzma_allocator *allocator, const uint8_t *props, size_t props_size) { + lzma_options_lzma *opt; + if (props_size != 5) return LZMA_OPTIONS_ERROR; - lzma_options_lzma *opt - = lzma_alloc(sizeof(lzma_options_lzma), allocator); + opt = lzma_alloc(sizeof(lzma_options_lzma), allocator); if (opt == NULL) return LZMA_MEM_ERROR; diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c index 0b9ee9e..6186f83 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c @@ -28,11 +28,14 @@ literal_matched(lzma_range_encoder *rc, probability *subcoder, symbol += UINT32_C(1) << 8; do { + uint32_t match_bit; + uint32_t subcoder_index; + uint32_t bit; + match_byte <<= 1; - const uint32_t match_bit = match_byte & offset; - const uint32_t subcoder_index - = offset + match_bit + (symbol >> 8); - const uint32_t bit = (symbol >> 7) & 1; + match_bit = match_byte & offset; + subcoder_index = offset + match_bit + (symbol >> 8); + bit = (symbol >> 7) & 1; rc_bit(rc, &subcoder[subcoder_index], bit); symbol <<= 1; @@ -77,16 +80,19 @@ literal(lzma_coder *coder, lzma_mf *mf, uint32_t position) static void length_update_prices(lzma_length_encoder *lc, const uint32_t pos_state) { + uint32_t a0, a1, b0, b1; + uint32_t *prices; + uint32_t i; + const uint32_t table_size = lc->table_size; lc->counters[pos_state] = table_size; - const uint32_t a0 = rc_bit_0_price(lc->choice); - const uint32_t a1 = rc_bit_1_price(lc->choice); - const uint32_t b0 = a1 + rc_bit_0_price(lc->choice2); - const uint32_t b1 = a1 + rc_bit_1_price(lc->choice2); - uint32_t *const prices = lc->prices[pos_state]; + a0 = rc_bit_0_price(lc->choice); + a1 = rc_bit_1_price(lc->choice); + b0 = a1 + rc_bit_0_price(lc->choice2); + b1 = a1 + rc_bit_1_price(lc->choice2); + prices = lc->prices[pos_state]; - uint32_t i; for (i = 0; i < table_size && i < LEN_LOW_SYMBOLS; ++i) prices[i] = a0 + rc_bittree_price(lc->low[pos_state], LEN_LOW_BITS, i); @@ -143,13 +149,16 @@ static inline void match(lzma_coder *coder, const uint32_t pos_state, const uint32_t distance, const uint32_t len) { + uint32_t pos_slot; + uint32_t len_to_pos_state; + update_match(coder->state); length(&coder->rc, &coder->match_len_encoder, pos_state, len, coder->fast_mode); - const uint32_t pos_slot = get_pos_slot(distance); - const uint32_t len_to_pos_state = get_len_to_pos_state(len); + pos_slot = get_pos_slot(distance); + len_to_pos_state = get_len_to_pos_state(len); rc_bittree(&coder->rc, coder->pos_slot[len_to_pos_state], POS_SLOT_BITS, pos_slot); @@ -313,14 +322,19 @@ lzma_lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, uint32_t limit) { + uint32_t position; + // Initialize the stream if no data has been encoded yet. if (!coder->is_initialized && !encode_init(coder, mf)) return LZMA_OK; // Get the lowest bits of the uncompressed offset from the LZ layer. - uint32_t position = mf_position(mf); + position = mf_position(mf); while (true) { + uint32_t len; + uint32_t back; + // Encode pending bits, if any. Calling this before encoding // the next symbol is needed only with plain LZMA, since // LZMA2 always provides big enough buffer to flush @@ -359,8 +373,6 @@ lzma_lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, // - UINT32_MAX: not a match but a literal // Value ranges for len: // - [MATCH_LEN_MIN, MATCH_LEN_MAX] - uint32_t len; - uint32_t back; if (coder->fast_mode) lzma_lzma_optimum_fast(coder, mf, &back, &len); @@ -453,10 +465,12 @@ static void length_encoder_reset(lzma_length_encoder *lencoder, const uint32_t num_pos_states, const bool fast_mode) { + size_t pos_state; + bit_reset(lencoder->choice); bit_reset(lencoder->choice2); - for (size_t pos_state = 0; pos_state < num_pos_states; ++pos_state) { + for (pos_state = 0; pos_state < num_pos_states; ++pos_state) { bittree_reset(lencoder->low[pos_state], LEN_LOW_BITS); bittree_reset(lencoder->mid[pos_state], LEN_MID_BITS); } @@ -464,7 +478,7 @@ length_encoder_reset(lzma_length_encoder *lencoder, bittree_reset(lencoder->high, LEN_HIGH_BITS); if (!fast_mode) - for (size_t pos_state = 0; pos_state < num_pos_states; + for (pos_state = 0; pos_state < num_pos_states; ++pos_state) length_update_prices(lencoder, pos_state); @@ -475,6 +489,8 @@ length_encoder_reset(lzma_length_encoder *lencoder, extern lzma_ret lzma_lzma_encoder_reset(lzma_coder *coder, const lzma_options_lzma *options) { + size_t i, j; + if (!is_options_valid(options)) return LZMA_OPTIONS_ERROR; @@ -487,14 +503,14 @@ lzma_lzma_encoder_reset(lzma_coder *coder, const lzma_options_lzma *options) // State coder->state = STATE_LIT_LIT; - for (size_t i = 0; i < REP_DISTANCES; ++i) + for (i = 0; i < REP_DISTANCES; ++i) coder->reps[i] = 0; literal_init(coder->literal, options->lc, options->lp); // Bit encoders - for (size_t i = 0; i < STATES; ++i) { - for (size_t j = 0; j <= coder->pos_mask; ++j) { + for (i = 0; i < STATES; ++i) { + for (j = 0; j <= coder->pos_mask; ++j) { bit_reset(coder->is_match[i][j]); bit_reset(coder->is_rep0_long[i][j]); } @@ -505,11 +521,11 @@ lzma_lzma_encoder_reset(lzma_coder *coder, const lzma_options_lzma *options) bit_reset(coder->is_rep2[i]); } - for (size_t i = 0; i < FULL_DISTANCES - END_POS_MODEL_INDEX; ++i) + for (i = 0; i < FULL_DISTANCES - END_POS_MODEL_INDEX; ++i) bit_reset(coder->pos_special[i]); // Bit tree encoders - for (size_t i = 0; i < LEN_TO_POS_STATES; ++i) + for (i = 0; i < LEN_TO_POS_STATES; ++i) bittree_reset(coder->pos_slot[i], POS_SLOT_BITS); bittree_reset(coder->pos_align, ALIGN_BITS); @@ -548,6 +564,9 @@ extern lzma_ret lzma_lzma_encoder_create(lzma_coder **coder_ptr, lzma_allocator *allocator, const lzma_options_lzma *options, lzma_lz_options *lz_options) { + lzma_coder *coder; + uint32_t log_size = 0; + // Allocate lzma_coder if it wasn't already allocated. if (*coder_ptr == NULL) { *coder_ptr = lzma_alloc(sizeof(lzma_coder), allocator); @@ -555,7 +574,7 @@ lzma_lzma_encoder_create(lzma_coder **coder_ptr, lzma_allocator *allocator, return LZMA_MEM_ERROR; } - lzma_coder *coder = *coder_ptr; + coder = *coder_ptr; // Set compression mode. We haven't validates the options yet, // but it's OK here, since nothing bad happens with invalid @@ -571,7 +590,6 @@ lzma_lzma_encoder_create(lzma_coder **coder_ptr, lzma_allocator *allocator, // Set dist_table_size. // Round the dictionary size up to next 2^n. - uint32_t log_size = 0; while ((UINT32_C(1) << log_size) < options->dict_size) ++log_size; @@ -625,13 +643,15 @@ lzma_lzma_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern uint64_t lzma_lzma_encoder_memusage(const void *options) { + lzma_lz_options lz_options; + uint64_t lz_memusage; + if (!is_options_valid(options)) return UINT64_MAX; - lzma_lz_options lz_options; set_lz_options(&lz_options, options); - const uint64_t lz_memusage = lzma_lz_encoder_memusage(&lz_options); + lz_memusage = lzma_lz_encoder_memusage(&lz_options); if (lz_memusage == UINT64_MAX) return UINT64_MAX; diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c index f835f69..52c26e4 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c @@ -20,6 +20,14 @@ extern void lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, uint32_t *restrict back_res, uint32_t *restrict len_res) { + const uint8_t *buf; + uint32_t buf_avail; + uint32_t i; + uint32_t rep_len = 0; + uint32_t rep_index = 0; + uint32_t back_main = 0; + uint32_t limit; + const uint32_t nice_len = mf->nice_len; uint32_t len_main; @@ -32,8 +40,8 @@ lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, matches_count = coder->matches_count; } - const uint8_t *buf = mf_ptr(mf) - 1; - const uint32_t buf_avail = my_min(mf_avail(mf) + 1, MATCH_LEN_MAX); + buf = mf_ptr(mf) - 1; + buf_avail = my_min(mf_avail(mf) + 1, MATCH_LEN_MAX); if (buf_avail < 2) { // There's not enough input left to encode a match. @@ -43,10 +51,9 @@ lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, } // Look for repeated matches; scan the previous four match distances - uint32_t rep_len = 0; - uint32_t rep_index = 0; + for (i = 0; i < REP_DISTANCES; ++i) { + uint32_t len; - for (uint32_t i = 0; i < REP_DISTANCES; ++i) { // Pointer to the beginning of the match candidate const uint8_t *const buf_back = buf - coder->reps[i] - 1; @@ -57,7 +64,6 @@ lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, // The first two bytes matched. // Calculate the length of the match. - uint32_t len; for (len = 2; len < buf_avail && buf[len] == buf_back[len]; ++len) ; @@ -86,7 +92,6 @@ lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, return; } - uint32_t back_main = 0; if (len_main >= 2) { back_main = coder->matches[matches_count - 1].dist; @@ -153,15 +158,16 @@ lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, // the old buf pointer instead of recalculating it with mf_ptr(). ++buf; - const uint32_t limit = len_main - 1; + limit = len_main - 1; + + for (i = 0; i < REP_DISTANCES; ++i) { + uint32_t len; - for (uint32_t i = 0; i < REP_DISTANCES; ++i) { const uint8_t *const buf_back = buf - coder->reps[i] - 1; if (not_equal_16(buf, buf_back)) continue; - uint32_t len; for (len = 2; len < limit && buf[len] == buf_back[len]; ++len) ; diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c index 7e85649..d2829a2 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c @@ -35,12 +35,15 @@ get_literal_price(const lzma_coder *const coder, const uint32_t pos, symbol += UINT32_C(1) << 8; do { + uint32_t match_bit; + uint32_t subcoder_index; + uint32_t bit; + match_byte <<= 1; - const uint32_t match_bit = match_byte & offset; - const uint32_t subcoder_index - = offset + match_bit + (symbol >> 8); - const uint32_t bit = (symbol >> 7) & 1; + match_bit = match_byte & offset; + subcoder_index = offset + match_bit + (symbol >> 8); + bit = (symbol >> 7) & 1; price += rc_bit_price(subcoder[subcoder_index], bit); symbol <<= 1; @@ -131,7 +134,11 @@ get_pos_len_price(const lzma_coder *const coder, const uint32_t pos, static void fill_distances_prices(lzma_coder *coder) { - for (uint32_t len_to_pos_state = 0; + uint32_t len_to_pos_state; + uint32_t pos_slot; + uint32_t i; + + for (len_to_pos_state = 0; len_to_pos_state < LEN_TO_POS_STATES; ++len_to_pos_state) { @@ -139,7 +146,7 @@ fill_distances_prices(lzma_coder *coder) = coder->pos_slot_prices[len_to_pos_state]; // Price to encode the pos_slot. - for (uint32_t pos_slot = 0; + for (pos_slot = 0; pos_slot < coder->dist_table_size; ++pos_slot) pos_slot_prices[pos_slot] = rc_bittree_price( coder->pos_slot[len_to_pos_state], @@ -148,7 +155,7 @@ fill_distances_prices(lzma_coder *coder) // For matches with distance >= FULL_DISTANCES, add the price // of the direct bits part of the match distance. (Align bits // are handled by fill_align_prices()). - for (uint32_t pos_slot = END_POS_MODEL_INDEX; + for (pos_slot = END_POS_MODEL_INDEX; pos_slot < coder->dist_table_size; ++pos_slot) pos_slot_prices[pos_slot] += rc_direct_price( ((pos_slot >> 1) - 1) - ALIGN_BITS); @@ -156,7 +163,7 @@ fill_distances_prices(lzma_coder *coder) // Distances in the range [0, 3] are fully encoded with // pos_slot, so they are used for coder->distances_prices // as is. - for (uint32_t i = 0; i < START_POS_MODEL_INDEX; ++i) + for (i = 0; i < START_POS_MODEL_INDEX; ++i) coder->distances_prices[len_to_pos_state][i] = pos_slot_prices[i]; } @@ -164,7 +171,7 @@ fill_distances_prices(lzma_coder *coder) // Distances in the range [4, 127] depend on pos_slot and pos_special. // We do this in a loop separate from the above loop to avoid // redundant calls to get_pos_slot(). - for (uint32_t i = START_POS_MODEL_INDEX; i < FULL_DISTANCES; ++i) { + for (i = START_POS_MODEL_INDEX; i < FULL_DISTANCES; ++i) { const uint32_t pos_slot = get_pos_slot(i); const uint32_t footer_bits = ((pos_slot >> 1) - 1); const uint32_t base = (2 | (pos_slot & 1)) << footer_bits; @@ -172,7 +179,7 @@ fill_distances_prices(lzma_coder *coder) coder->pos_special + base - pos_slot - 1, footer_bits, i - base); - for (uint32_t len_to_pos_state = 0; + for (len_to_pos_state = 0; len_to_pos_state < LEN_TO_POS_STATES; ++len_to_pos_state) coder->distances_prices[len_to_pos_state][i] @@ -188,7 +195,8 @@ fill_distances_prices(lzma_coder *coder) static void fill_align_prices(lzma_coder *coder) { - for (uint32_t i = 0; i < ALIGN_TABLE_SIZE; ++i) + uint32_t i; + for (i = 0; i < ALIGN_TABLE_SIZE; ++i) coder->align_prices[i] = rc_bittree_reverse_price( coder->pos_align, ALIGN_BITS, i); @@ -225,12 +233,15 @@ static void backward(lzma_coder *restrict coder, uint32_t *restrict len_res, uint32_t *restrict back_res, uint32_t cur) { - coder->opts_end_index = cur; - uint32_t pos_mem = coder->opts[cur].pos_prev; uint32_t back_mem = coder->opts[cur].back_prev; + coder->opts_end_index = cur; + do { + const uint32_t pos_prev = pos_mem; + const uint32_t back_cur = back_mem; + if (coder->opts[cur].prev_1_is_literal) { make_literal(&coder->opts[pos_mem]); coder->opts[pos_mem].pos_prev = pos_mem - 1; @@ -245,9 +256,6 @@ backward(lzma_coder *restrict coder, uint32_t *restrict len_res, } } - const uint32_t pos_prev = pos_mem; - const uint32_t back_cur = back_mem; - back_mem = coder->opts[pos_prev].back_prev; pos_mem = coder->opts[pos_prev].pos_prev; @@ -274,6 +282,23 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, uint32_t *restrict back_res, uint32_t *restrict len_res, uint32_t position) { + uint32_t buf_avail; + const uint8_t *buf; + uint32_t rep_lens[REP_DISTANCES]; + uint32_t rep_max_index = 0; + uint32_t i; + + uint8_t current_byte; + uint8_t match_byte; + + uint32_t pos_state; + uint32_t match_price; + uint32_t rep_match_price; + uint32_t len_end; + uint32_t len; + + uint32_t normal_match_price; + const uint32_t nice_len = mf->nice_len; uint32_t len_main; @@ -287,19 +312,18 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, matches_count = coder->matches_count; } - const uint32_t buf_avail = my_min(mf_avail(mf) + 1, MATCH_LEN_MAX); + buf_avail = my_min(mf_avail(mf) + 1, MATCH_LEN_MAX); if (buf_avail < 2) { *back_res = UINT32_MAX; *len_res = 1; return UINT32_MAX; } - const uint8_t *const buf = mf_ptr(mf) - 1; + buf = mf_ptr(mf) - 1; - uint32_t rep_lens[REP_DISTANCES]; - uint32_t rep_max_index = 0; + for (i = 0; i < REP_DISTANCES; ++i) { + uint32_t len_test; - for (uint32_t i = 0; i < REP_DISTANCES; ++i) { const uint8_t *const buf_back = buf - coder->reps[i] - 1; if (not_equal_16(buf, buf_back)) { @@ -307,7 +331,6 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, continue; } - uint32_t len_test; for (len_test = 2; len_test < buf_avail && buf[len_test] == buf_back[len_test]; ++len_test) ; @@ -333,8 +356,8 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, return UINT32_MAX; } - const uint8_t current_byte = *buf; - const uint8_t match_byte = *(buf - coder->reps[0] - 1); + current_byte = *buf; + match_byte = *(buf - coder->reps[0] - 1); if (len_main < 2 && current_byte != match_byte && rep_lens[rep_max_index] < 2) { @@ -345,7 +368,7 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, coder->opts[0].state = coder->state; - const uint32_t pos_state = position & coder->pos_mask; + pos_state = position & coder->pos_mask; coder->opts[1].price = rc_bit_0_price( coder->is_match[coder->state][pos_state]) @@ -355,9 +378,9 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, make_literal(&coder->opts[1]); - const uint32_t match_price = rc_bit_1_price( + match_price = rc_bit_1_price( coder->is_match[coder->state][pos_state]); - const uint32_t rep_match_price = match_price + rep_match_price = match_price + rc_bit_1_price(coder->is_rep[coder->state]); if (match_byte == current_byte) { @@ -371,7 +394,7 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, } } - const uint32_t len_end = my_max(len_main, rep_lens[rep_max_index]); + len_end = my_max(len_main, rep_lens[rep_max_index]); if (len_end < 2) { *back_res = coder->opts[1].back_prev; @@ -381,21 +404,23 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, coder->opts[1].pos_prev = 0; - for (uint32_t i = 0; i < REP_DISTANCES; ++i) + for (i = 0; i < REP_DISTANCES; ++i) coder->opts[0].backs[i] = coder->reps[i]; - uint32_t len = len_end; + len = len_end; do { coder->opts[len].price = RC_INFINITY_PRICE; } while (--len >= 2); - for (uint32_t i = 0; i < REP_DISTANCES; ++i) { + for (i = 0; i < REP_DISTANCES; ++i) { + uint32_t price; + uint32_t rep_len = rep_lens[i]; if (rep_len < 2) continue; - const uint32_t price = rep_match_price + get_pure_rep_price( + price = rep_match_price + get_pure_rep_price( coder, i, coder->state, pos_state); do { @@ -414,7 +439,7 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, } - const uint32_t normal_match_price = match_price + normal_match_price = match_price + rc_bit_0_price(coder->is_rep[coder->state]); len = rep_lens[0] >= 2 ? rep_lens[0] + 1 : 2; @@ -456,6 +481,19 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, uint32_t new_len = coder->longest_match_length; uint32_t pos_prev = coder->opts[cur].pos_prev; lzma_lzma_state state; + uint32_t buf_avail; + uint32_t rep_index; + uint32_t i; + + uint32_t cur_price; + uint8_t current_byte; + uint8_t match_byte; + uint32_t pos_state; + uint32_t cur_and_1_price; + bool next_is_literal = false; + uint32_t match_price; + uint32_t rep_match_price; + uint32_t start_len = 2; if (coder->opts[cur].prev_1_is_literal) { --pos_prev; @@ -499,9 +537,10 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, } if (pos < REP_DISTANCES) { + uint32_t i; + reps[0] = coder->opts[pos_prev].backs[pos]; - uint32_t i; for (i = 1; i <= pos; ++i) reps[i] = coder->opts[pos_prev].backs[i - 1]; @@ -511,30 +550,28 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, } else { reps[0] = pos - REP_DISTANCES; - for (uint32_t i = 1; i < REP_DISTANCES; ++i) + for (i = 1; i < REP_DISTANCES; ++i) reps[i] = coder->opts[pos_prev].backs[i - 1]; } } coder->opts[cur].state = state; - for (uint32_t i = 0; i < REP_DISTANCES; ++i) + for (i = 0; i < REP_DISTANCES; ++i) coder->opts[cur].backs[i] = reps[i]; - const uint32_t cur_price = coder->opts[cur].price; + cur_price = coder->opts[cur].price; - const uint8_t current_byte = *buf; - const uint8_t match_byte = *(buf - reps[0] - 1); + current_byte = *buf; + match_byte = *(buf - reps[0] - 1); - const uint32_t pos_state = position & coder->pos_mask; + pos_state = position & coder->pos_mask; - const uint32_t cur_and_1_price = cur_price + cur_and_1_price = cur_price + rc_bit_0_price(coder->is_match[state][pos_state]) + get_literal_price(coder, position, buf[-1], !is_literal_state(state), match_byte, current_byte); - bool next_is_literal = false; - if (cur_and_1_price < coder->opts[cur + 1].price) { coder->opts[cur + 1].price = cur_and_1_price; coder->opts[cur + 1].pos_prev = cur; @@ -542,9 +579,9 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, next_is_literal = true; } - const uint32_t match_price = cur_price + match_price = cur_price + rc_bit_1_price(coder->is_match[state][pos_state]); - const uint32_t rep_match_price = match_price + rep_match_price = match_price + rc_bit_1_price(coder->is_rep[state]); if (match_byte == current_byte @@ -565,7 +602,7 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, if (buf_avail_full < 2) return len_end; - const uint32_t buf_avail = my_min(buf_avail_full, nice_len); + buf_avail = my_min(buf_avail_full, nice_len); if (!next_is_literal && match_byte != current_byte) { // speed optimization // try literal + rep0 @@ -579,21 +616,26 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, --len_test; if (len_test >= 2) { + uint32_t pos_state_next; + uint32_t next_rep_match_price; + uint32_t offset; + uint32_t cur_and_len_price; + lzma_lzma_state state_2 = state; update_literal(state_2); - const uint32_t pos_state_next = (position + 1) & coder->pos_mask; - const uint32_t next_rep_match_price = cur_and_1_price + pos_state_next = (position + 1) & coder->pos_mask; + next_rep_match_price = cur_and_1_price + rc_bit_1_price(coder->is_match[state_2][pos_state_next]) + rc_bit_1_price(coder->is_rep[state_2]); //for (; len_test >= 2; --len_test) { - const uint32_t offset = cur + 1 + len_test; + offset = cur + 1 + len_test; while (len_end < offset) coder->opts[++len_end].price = RC_INFINITY_PRICE; - const uint32_t cur_and_len_price = next_rep_match_price + cur_and_len_price = next_rep_match_price + get_rep_price(coder, 0, len_test, state_2, pos_state_next); @@ -609,14 +651,14 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, } - uint32_t start_len = 2; // speed optimization + for (rep_index = 0; rep_index < REP_DISTANCES; ++rep_index) { + uint32_t len_test, len_test_2, len_test_temp; + uint32_t price, limit; - for (uint32_t rep_index = 0; rep_index < REP_DISTANCES; ++rep_index) { const uint8_t *const buf_back = buf - reps[rep_index] - 1; if (not_equal_16(buf, buf_back)) continue; - uint32_t len_test; for (len_test = 2; len_test < buf_avail && buf[len_test] == buf_back[len_test]; ++len_test) ; @@ -624,8 +666,8 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, while (len_end < cur + len_test) coder->opts[++len_end].price = RC_INFINITY_PRICE; - const uint32_t len_test_temp = len_test; - const uint32_t price = rep_match_price + get_pure_rep_price( + len_test_temp = len_test; + price = rep_match_price + get_pure_rep_price( coder, rep_index, state, pos_state); do { @@ -647,8 +689,8 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, start_len = len_test + 1; - uint32_t len_test_2 = len_test + 1; - const uint32_t limit = my_min(buf_avail_full, + len_test_2 = len_test + 1; + limit = my_min(buf_avail_full, len_test_2 + nice_len); for (; len_test_2 < limit && buf[len_test_2] == buf_back[len_test_2]; @@ -657,12 +699,18 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, len_test_2 -= len_test + 1; if (len_test_2 >= 2) { + uint32_t pos_state_next; + uint32_t cur_and_len_literal_price; + uint32_t next_rep_match_price; + uint32_t offset; + uint32_t cur_and_len_price; + lzma_lzma_state state_2 = state; update_long_rep(state_2); - uint32_t pos_state_next = (position + len_test) & coder->pos_mask; + pos_state_next = (position + len_test) & coder->pos_mask; - const uint32_t cur_and_len_literal_price = price + cur_and_len_literal_price = price + get_len_price(&coder->rep_len_encoder, len_test, pos_state) + rc_bit_0_price(coder->is_match[state_2][pos_state_next]) @@ -674,17 +722,17 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, pos_state_next = (position + len_test + 1) & coder->pos_mask; - const uint32_t next_rep_match_price = cur_and_len_literal_price + next_rep_match_price = cur_and_len_literal_price + rc_bit_1_price(coder->is_match[state_2][pos_state_next]) + rc_bit_1_price(coder->is_rep[state_2]); //for(; len_test_2 >= 2; len_test_2--) { - const uint32_t offset = cur + len_test + 1 + len_test_2; + offset = cur + len_test + 1 + len_test_2; while (len_end < offset) coder->opts[++len_end].price = RC_INFINITY_PRICE; - const uint32_t cur_and_len_price = next_rep_match_price + cur_and_len_price = next_rep_match_price + get_rep_price(coder, 0, len_test_2, state_2, pos_state_next); @@ -715,17 +763,19 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, if (new_len >= start_len) { + uint32_t len_test; + uint32_t i = 0; + const uint32_t normal_match_price = match_price + rc_bit_0_price(coder->is_rep[state]); while (len_end < cur + new_len) coder->opts[++len_end].price = RC_INFINITY_PRICE; - uint32_t i = 0; while (start_len > coder->matches[i].len) ++i; - for (uint32_t len_test = start_len; ; ++len_test) { + for (len_test = start_len; ; ++len_test) { const uint32_t cur_back = coder->matches[i].dist; uint32_t cur_and_len_price = normal_match_price + get_pos_len_price(coder, @@ -753,12 +803,16 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, len_test_2 -= len_test + 1; if (len_test_2 >= 2) { + uint32_t pos_state_next; + uint32_t cur_and_len_literal_price; + uint32_t next_rep_match_price; + uint32_t offset; + lzma_lzma_state state_2 = state; update_match(state_2); - uint32_t pos_state_next - = (position + len_test) & coder->pos_mask; + pos_state_next = (position + len_test) & coder->pos_mask; - const uint32_t cur_and_len_literal_price = cur_and_len_price + cur_and_len_literal_price = cur_and_len_price + rc_bit_0_price( coder->is_match[state_2][pos_state_next]) + get_literal_price(coder, @@ -771,14 +825,14 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, update_literal(state_2); pos_state_next = (pos_state_next + 1) & coder->pos_mask; - const uint32_t next_rep_match_price + next_rep_match_price = cur_and_len_literal_price + rc_bit_1_price( coder->is_match[state_2][pos_state_next]) + rc_bit_1_price(coder->is_rep[state_2]); // for(; len_test_2 >= 2; --len_test_2) { - const uint32_t offset = cur + len_test + 1 + len_test_2; + offset = cur + len_test + 1 + len_test_2; while (len_end < offset) coder->opts[++len_end].price = RC_INFINITY_PRICE; @@ -815,6 +869,10 @@ lzma_lzma_optimum_normal(lzma_coder *restrict coder, lzma_mf *restrict mf, uint32_t *restrict back_res, uint32_t *restrict len_res, uint32_t position) { + uint32_t reps[REP_DISTANCES]; + uint32_t len_end; + uint32_t cur; + // If we have symbols pending, return the next pending symbol. if (coder->opts_end_index != coder->opts_current_index) { assert(mf->read_ahead > 0); @@ -841,14 +899,13 @@ lzma_lzma_optimum_normal(lzma_coder *restrict coder, lzma_mf *restrict mf, // the original function into two pieces makes it at least a little // more readable, since those two parts don't share many variables. - uint32_t len_end = helper1(coder, mf, back_res, len_res, position); + len_end = helper1(coder, mf, back_res, len_res, position); if (len_end == UINT32_MAX) return; - uint32_t reps[REP_DISTANCES]; + memcpy(reps, coder->reps, sizeof(reps)); - uint32_t cur; for (cur = 1; cur < len_end; ++cur) { assert(cur < OPTS); diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c index 21e427a..8af9b9f 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c @@ -16,6 +16,9 @@ extern LZMA_API(lzma_bool) lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset) { + static const uint8_t dict_size_values[] = { 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 }; + static const uint8_t depth_values[] = { 4, 8, 24, 48 }; + const uint32_t level = preset & LZMA_PRESET_LEVEL_MASK; const uint32_t flags = preset & ~LZMA_PRESET_LEVEL_MASK; const uint32_t supported_flags = LZMA_PRESET_EXTREME; @@ -30,14 +33,13 @@ lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset) options->lp = LZMA_LP_DEFAULT; options->pb = LZMA_PB_DEFAULT; - options->dict_size = UINT32_C(1) << (uint8_t []){ - 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 }[level]; + options->dict_size = UINT32_C(1) << dict_size_values[level]; if (level <= 3) { options->mode = LZMA_MODE_FAST; options->mf = level == 0 ? LZMA_MF_HC3 : LZMA_MF_HC4; options->nice_len = level <= 1 ? 128 : 273; - options->depth = (uint8_t []){ 4, 8, 24, 48 }[level]; + options->depth = depth_values[level]; } else { options->mode = LZMA_MODE_NORMAL; options->mf = LZMA_MF_BT4; diff --git a/Utilities/cmliblzma/liblzma/rangecoder/range_common.h b/Utilities/cmliblzma/liblzma/rangecoder/range_common.h index 2c74dc1..f15623e 100644 --- a/Utilities/cmliblzma/liblzma/rangecoder/range_common.h +++ b/Utilities/cmliblzma/liblzma/rangecoder/range_common.h @@ -40,8 +40,11 @@ // This does the same for a complete bit tree. // (A tree represented as an array.) #define bittree_reset(probs, bit_levels) \ - for (uint32_t bt_i = 0; bt_i < (1 << (bit_levels)); ++bt_i) \ - bit_reset((probs)[bt_i]) + do { \ + uint32_t bt_i; \ + for (bt_i = 0; bt_i < (1 << (bit_levels)); ++bt_i) \ + bit_reset((probs)[bt_i]); \ + } while (0) ////////////////////// diff --git a/Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h b/Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h index 1e1c369..e9614f2 100644 --- a/Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h +++ b/Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h @@ -115,7 +115,8 @@ rc_direct(lzma_range_encoder *rc, static inline void rc_flush(lzma_range_encoder *rc) { - for (size_t i = 0; i < 5; ++i) + size_t i; + for (i = 0; i < 5; ++i) rc->symbols[rc->count++] = RC_FLUSH; } diff --git a/Utilities/cmliblzma/liblzma/simple/arm.c b/Utilities/cmliblzma/liblzma/simple/arm.c index a84702a..8dcba39 100644 --- a/Utilities/cmliblzma/liblzma/simple/arm.c +++ b/Utilities/cmliblzma/liblzma/simple/arm.c @@ -22,12 +22,12 @@ arm_code(lzma_simple *simple lzma_attribute((__unused__)), size_t i; for (i = 0; i + 4 <= size; i += 4) { if (buffer[i + 3] == 0xEB) { + uint32_t dest; uint32_t src = (buffer[i + 2] << 16) | (buffer[i + 1] << 8) | (buffer[i + 0]); src <<= 2; - uint32_t dest; if (is_encoder) dest = now_pos + (uint32_t)(i) + 8 + src; else diff --git a/Utilities/cmliblzma/liblzma/simple/armthumb.c b/Utilities/cmliblzma/liblzma/simple/armthumb.c index 4b49175..4b890a3 100644 --- a/Utilities/cmliblzma/liblzma/simple/armthumb.c +++ b/Utilities/cmliblzma/liblzma/simple/armthumb.c @@ -23,6 +23,7 @@ armthumb_code(lzma_simple *simple lzma_attribute((__unused__)), for (i = 0; i + 4 <= size; i += 2) { if ((buffer[i + 1] & 0xF8) == 0xF0 && (buffer[i + 3] & 0xF8) == 0xF8) { + uint32_t dest; uint32_t src = ((buffer[i + 1] & 0x7) << 19) | (buffer[i + 0] << 11) | ((buffer[i + 3] & 0x7) << 8) @@ -30,7 +31,6 @@ armthumb_code(lzma_simple *simple lzma_attribute((__unused__)), src <<= 1; - uint32_t dest; if (is_encoder) dest = now_pos + (uint32_t)(i) + 4 + src; else diff --git a/Utilities/cmliblzma/liblzma/simple/ia64.c b/Utilities/cmliblzma/liblzma/simple/ia64.c index ce3692b..c537cac 100644 --- a/Utilities/cmliblzma/liblzma/simple/ia64.c +++ b/Utilities/cmliblzma/liblzma/simple/ia64.c @@ -28,36 +28,42 @@ ia64_code(lzma_simple *simple lzma_attribute((__unused__)), size_t i; for (i = 0; i + 16 <= size; i += 16) { + size_t slot; + const uint32_t instr_template = buffer[i] & 0x1F; const uint32_t mask = BRANCH_TABLE[instr_template]; uint32_t bit_pos = 5; - for (size_t slot = 0; slot < 3; ++slot, bit_pos += 41) { - if (((mask >> slot) & 1) == 0) - continue; - + for (slot = 0; slot < 3; ++slot, bit_pos += 41) { const size_t byte_pos = (bit_pos >> 3); const uint32_t bit_res = bit_pos & 0x7; uint64_t instruction = 0; + uint64_t inst_norm; + size_t j; + + if (((mask >> slot) & 1) == 0) + continue; - for (size_t j = 0; j < 6; ++j) + for (j = 0; j < 6; ++j) instruction += (uint64_t)( buffer[i + j + byte_pos]) << (8 * j); - uint64_t inst_norm = instruction >> bit_res; + inst_norm = instruction >> bit_res; if (((inst_norm >> 37) & 0xF) == 0x5 && ((inst_norm >> 9) & 0x7) == 0 /* && (inst_norm & 0x3F)== 0 */ ) { + uint32_t dest; + size_t j; + uint32_t src = (uint32_t)( (inst_norm >> 13) & 0xFFFFF); src |= ((inst_norm >> 36) & 1) << 20; src <<= 4; - uint32_t dest; if (is_encoder) dest = now_pos + (uint32_t)(i) + src; else @@ -73,7 +79,7 @@ ia64_code(lzma_simple *simple lzma_attribute((__unused__)), instruction &= (1 << bit_res) - 1; instruction |= (inst_norm << bit_res); - for (size_t j = 0; j < 6; j++) + for (j = 0; j < 6; j++) buffer[i + j + byte_pos] = (uint8_t)( instruction >> (8 * j)); diff --git a/Utilities/cmliblzma/liblzma/simple/simple_coder.c b/Utilities/cmliblzma/liblzma/simple/simple_coder.c index a02b039..d147d4b 100644 --- a/Utilities/cmliblzma/liblzma/simple/simple_coder.c +++ b/Utilities/cmliblzma/liblzma/simple/simple_coder.c @@ -71,6 +71,9 @@ simple_code(lzma_coder *coder, lzma_allocator *allocator, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_action action) { + size_t out_avail; + size_t buf_avail; + // TODO: Add partial support for LZMA_SYNC_FLUSH. We can support it // in cases when the filter is able to filter everything. With most // simple filters it can be done at offset that is a multiple of 2, @@ -105,9 +108,13 @@ simple_code(lzma_coder *coder, lzma_allocator *allocator, // more data to out[] hopefully filling it completely. Then filter // the data in out[]. This step is where most of the data gets // filtered if the buffer sizes used by the application are reasonable. - const size_t out_avail = out_size - *out_pos; - const size_t buf_avail = coder->size - coder->pos; + out_avail = out_size - *out_pos; + buf_avail = coder->size - coder->pos; if (out_avail > buf_avail || buf_avail == 0) { + size_t size; + size_t filtered; + size_t unfiltered; + // Store the old position so that we know from which byte // to start filtering. const size_t out_start = *out_pos; @@ -130,11 +137,10 @@ simple_code(lzma_coder *coder, lzma_allocator *allocator, } // Filter out[]. - const size_t size = *out_pos - out_start; - const size_t filtered = call_filter( - coder, out + out_start, size); + size = *out_pos - out_start; + filtered = call_filter(coder, out + out_start, size); - const size_t unfiltered = size - filtered; + unfiltered = size - filtered; assert(unfiltered <= coder->allocated / 2); // Now we can update coder->pos and coder->size, because diff --git a/Utilities/cmliblzma/liblzma/simple/simple_decoder.c b/Utilities/cmliblzma/liblzma/simple/simple_decoder.c index 0beccd3..034e158 100644 --- a/Utilities/cmliblzma/liblzma/simple/simple_decoder.c +++ b/Utilities/cmliblzma/liblzma/simple/simple_decoder.c @@ -17,14 +17,15 @@ extern lzma_ret lzma_simple_props_decode(void **options, lzma_allocator *allocator, const uint8_t *props, size_t props_size) { + lzma_options_bcj *opt; + if (props_size == 0) return LZMA_OK; if (props_size != 4) return LZMA_OPTIONS_ERROR; - lzma_options_bcj *opt = lzma_alloc( - sizeof(lzma_options_bcj), allocator); + opt = lzma_alloc(sizeof(lzma_options_bcj), allocator); if (opt == NULL) return LZMA_MEM_ERROR; diff --git a/Utilities/cmliblzma/liblzma/simple/sparc.c b/Utilities/cmliblzma/liblzma/simple/sparc.c index 8270d6a..0ddd2ac 100644 --- a/Utilities/cmliblzma/liblzma/simple/sparc.c +++ b/Utilities/cmliblzma/liblzma/simple/sparc.c @@ -26,6 +26,8 @@ sparc_code(lzma_simple *simple lzma_attribute((__unused__)), || (buffer[i] == 0x7F && (buffer[i + 1] & 0xC0) == 0xC0)) { + uint32_t dest; + uint32_t src = ((uint32_t)buffer[i + 0] << 24) | ((uint32_t)buffer[i + 1] << 16) | ((uint32_t)buffer[i + 2] << 8) @@ -33,7 +35,6 @@ sparc_code(lzma_simple *simple lzma_attribute((__unused__)), src <<= 2; - uint32_t dest; if (is_encoder) dest = now_pos + (uint32_t)(i) + src; else diff --git a/Utilities/cmliblzma/liblzma/simple/x86.c b/Utilities/cmliblzma/liblzma/simple/x86.c index 5d1509b..101d8ed 100644 --- a/Utilities/cmliblzma/liblzma/simple/x86.c +++ b/Utilities/cmliblzma/liblzma/simple/x86.c @@ -36,30 +36,36 @@ x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder, uint32_t prev_mask = simple->prev_mask; uint32_t prev_pos = simple->prev_pos; + size_t limit; + size_t buffer_pos; + if (size < 5) return 0; if (now_pos - prev_pos > 5) prev_pos = now_pos - 5; - const size_t limit = size - 5; - size_t buffer_pos = 0; + limit = size - 5; + buffer_pos = 0; while (buffer_pos <= limit) { + uint32_t offset; + uint32_t i; + uint8_t b = buffer[buffer_pos]; if (b != 0xE8 && b != 0xE9) { ++buffer_pos; continue; } - const uint32_t offset = now_pos + (uint32_t)(buffer_pos) + offset = now_pos + (uint32_t)(buffer_pos) - prev_pos; prev_pos = now_pos + (uint32_t)(buffer_pos); if (offset > 5) { prev_mask = 0; } else { - for (uint32_t i = 0; i < offset; ++i) { + for (i = 0; i < offset; ++i) { prev_mask &= 0x77; prev_mask <<= 1; } @@ -78,6 +84,8 @@ x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder, uint32_t dest; while (true) { + uint32_t i; + if (is_encoder) dest = src + (now_pos + (uint32_t)( buffer_pos) + 5); @@ -88,8 +96,7 @@ x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder, if (prev_mask == 0) break; - const uint32_t i = MASK_TO_BIT_NUMBER[ - prev_mask >> 1]; + i = MASK_TO_BIT_NUMBER[prev_mask >> 1]; b = (uint8_t)(dest >> (24 - i * 8)); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b2a07ca49c66665f5b51b592f44ecc4f66c7556b commit b2a07ca49c66665f5b51b592f44ecc4f66c7556b Author: Daniel Pfeifer AuthorDate: Sun Jul 13 22:24:29 2014 +0200 Commit: Brad King CommitDate: Wed Jul 23 10:34:55 2014 -0400 liblzma: Add CMake build system Modify sources just enough to build without the full xz common directory. diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt new file mode 100644 index 0000000..85efa8c --- /dev/null +++ b/Utilities/cmliblzma/CMakeLists.txt @@ -0,0 +1,195 @@ +PROJECT(CMLIBLZMA C) + +include(CheckCSourceCompiles) +include(CheckIncludeFile) +include(CheckSymbolExists) +include(CheckTypeSize) +include(TestBigEndian) + +CHECK_C_SOURCE_COMPILES( + "int test (void *restrict x);\nint main (void) {return 0;}" + HAVE_RESTRICT) + +CHECK_C_SOURCE_COMPILES( +"typedef struct abc *d;\nint test (d __restrict x);\nint main (void) {return 0;}" + HAVE___RESTRICT) + +CHECK_C_SOURCE_COMPILES( + "inline int test (void) {return 0;}\nint main (void) {return test();}" + HAVE_INLINE) + +CHECK_C_SOURCE_COMPILES ( + "__inline int test (void) {return 0;}\nint main (void) {return test();}" + HAVE___INLINE) + +CHECK_INCLUDE_FILE(byteswap.h HAVE_BYTESWAP_H) +CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H) +CHECK_INCLUDE_FILE(limits.h HAVE_LIMITS_H) +CHECK_INCLUDE_FILE(memory.h HAVE_MEMORY_H) +CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H) +CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H) +CHECK_INCLUDE_FILE(string.h HAVE_STRING_H) +CHECK_INCLUDE_FILE(sys/sysctl.h HAVE_SYS_SYSCTL_H) + +CHECK_SYMBOL_EXISTS(bswap_16 byteswap.h HAVE_BSWAP_16) +CHECK_SYMBOL_EXISTS(bswap_32 byteswap.h HAVE_BSWAP_32) +CHECK_SYMBOL_EXISTS(bswap_64 byteswap.h HAVE_BSWAP_64) + +TEST_BIG_ENDIAN(WORDS_BIGENDIAN) + +set(HAVE_CHECK_CRC64 1) +set(HAVE_CHECK_SHA256 1) + +set(HAVE_DECODER_ARM 1) +set(HAVE_DECODER_ARMTHUMB 1) +set(HAVE_DECODER_DELTA 1) +set(HAVE_DECODER_IA64 1) +set(HAVE_DECODER_LZMA1 1) +set(HAVE_DECODER_LZMA2 1) +set(HAVE_DECODER_POWERPC 1) +set(HAVE_DECODER_SPARC 1) +set(HAVE_DECODER_X86 1) + +set(HAVE_ENCODER_ARM 1) +set(HAVE_ENCODER_ARMTHUMB 1) +set(HAVE_ENCODER_DELTA 1) +set(HAVE_ENCODER_IA64 1) +set(HAVE_ENCODER_LZMA1 1) +set(HAVE_ENCODER_LZMA2 1) +set(HAVE_ENCODER_POWERPC 1) +set(HAVE_ENCODER_SPARC 1) +set(HAVE_ENCODER_X86 1) + +set(HAVE_MF_BT2 1) +set(HAVE_MF_BT3 1) +set(HAVE_MF_BT4 1) +set(HAVE_MF_HC3 1) +set(HAVE_MF_HC4 1) + +CHECK_TYPE_SIZE(int16_t INT16_T) +CHECK_TYPE_SIZE(int32_t INT32_T) +CHECK_TYPE_SIZE(int64_t INT64_T) +CHECK_TYPE_SIZE(intmax_t INTMAX_T) +CHECK_TYPE_SIZE(uint8_t UINT8_T) +CHECK_TYPE_SIZE(uint16_t UINT16_T) +CHECK_TYPE_SIZE(uint32_t UINT32_T) +CHECK_TYPE_SIZE(uint64_t UINT64_T) +CHECK_TYPE_SIZE(uintmax_t UINTMAX_T) + +CHECK_TYPE_SIZE("short" SIZE_OF_SHORT) +CHECK_TYPE_SIZE("int" SIZE_OF_INT) +CHECK_TYPE_SIZE("long" SIZE_OF_LONG) +CHECK_TYPE_SIZE("long long" SIZE_OF_LONG_LONG) + +CHECK_TYPE_SIZE("unsigned short" SIZE_OF_UNSIGNED_SHORT) +CHECK_TYPE_SIZE("unsigned" SIZE_OF_UNSIGNED) +CHECK_TYPE_SIZE("unsigned long" SIZE_OF_UNSIGNED_LONG) +CHECK_TYPE_SIZE("unsigned long long" SIZE_OF_UNSIGNED_LONG_LONG) + +CHECK_TYPE_SIZE("__int64" __INT64) +CHECK_TYPE_SIZE("unsigned __int64" UNSIGNED___INT64) + +CHECK_TYPE_SIZE(uintptr_t UINTPTR_T) +IF(NOT HAVE_UINTPTR_T) + IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) + SET(uintptr_t "uint64_t") + ELSE() + SET(uintptr_t "uint32_t") + ENDIF() +ENDIF() + + +SET(LZMA_SRCS + common/sysdefs.h + common/tuklib_integer.h + liblzma/check/check.c + liblzma/check/crc32_fast.c + liblzma/check/crc32_table.c + liblzma/check/crc64_fast.c + liblzma/check/crc64_table.c + liblzma/check/sha256.c + liblzma/common/alone_decoder.c + liblzma/common/alone_encoder.c + liblzma/common/auto_decoder.c + liblzma/common/block_buffer_decoder.c + liblzma/common/block_buffer_encoder.c + liblzma/common/block_decoder.c + liblzma/common/block_encoder.c + liblzma/common/block_header_decoder.c + liblzma/common/block_header_encoder.c + liblzma/common/block_util.c + liblzma/common/common.c + liblzma/common/easy_buffer_encoder.c + liblzma/common/easy_decoder_memusage.c + liblzma/common/easy_encoder.c + liblzma/common/easy_encoder_memusage.c + liblzma/common/easy_preset.c + liblzma/common/filter_buffer_decoder.c + liblzma/common/filter_buffer_encoder.c + liblzma/common/filter_common.c + liblzma/common/filter_decoder.c + liblzma/common/filter_encoder.c + liblzma/common/filter_flags_decoder.c + liblzma/common/filter_flags_encoder.c + liblzma/common/index.c + liblzma/common/index_decoder.c + liblzma/common/index_encoder.c + liblzma/common/index_hash.c + liblzma/common/stream_buffer_decoder.c + liblzma/common/stream_buffer_encoder.c + liblzma/common/stream_decoder.c + liblzma/common/stream_encoder.c + liblzma/common/stream_flags_common.c + liblzma/common/stream_flags_decoder.c + liblzma/common/stream_flags_encoder.c + liblzma/common/vli_decoder.c + liblzma/common/vli_encoder.c + liblzma/common/vli_size.c + liblzma/delta/delta_common.c + liblzma/delta/delta_decoder.c + liblzma/delta/delta_encoder.c + liblzma/lz/lz_decoder.c + liblzma/lz/lz_encoder.c + liblzma/lz/lz_encoder_mf.c + liblzma/lzma/fastpos_table.c + liblzma/lzma/lzma2_decoder.c + liblzma/lzma/lzma2_encoder.c + liblzma/lzma/lzma_decoder.c + liblzma/lzma/lzma_encoder.c + liblzma/lzma/lzma_encoder_optimum_fast.c + liblzma/lzma/lzma_encoder_optimum_normal.c + liblzma/lzma/lzma_encoder_presets.c + liblzma/rangecoder/price_table.c + liblzma/simple/arm.c + liblzma/simple/armthumb.c + liblzma/simple/ia64.c + liblzma/simple/powerpc.c + liblzma/simple/simple_coder.c + liblzma/simple/simple_decoder.c + liblzma/simple/simple_encoder.c + liblzma/simple/sparc.c + liblzma/simple/x86.c + ) + +IF(WIN32 AND BUILD_SHARED_LIBS) + SET(LZMA_SRCS ${LZMA_SRCS} liblzma/liblzma_w32res.rc) +ENDIF() + +CONFIGURE_FILE(config.h.in config.h @ONLY) + +INCLUDE_DIRECTORIES( + "${CMLIBLZMA_SOURCE_DIR}/common" + "${CMLIBLZMA_SOURCE_DIR}/liblzma/api" + "${CMLIBLZMA_SOURCE_DIR}/liblzma/check" + "${CMLIBLZMA_SOURCE_DIR}/liblzma/common" + "${CMLIBLZMA_SOURCE_DIR}/liblzma/delta" + "${CMLIBLZMA_SOURCE_DIR}/liblzma/lz" + "${CMLIBLZMA_SOURCE_DIR}/liblzma/lzma" + "${CMLIBLZMA_SOURCE_DIR}/liblzma/rangecoder" + "${CMLIBLZMA_SOURCE_DIR}/liblzma/simple" + "${CMLIBLZMA_BINARY_DIR}" + ) + +ADD_LIBRARY(cmliblzma ${LZMA_SRCS}) + +INSTALL(FILES COPYING DESTINATION ${CMAKE_DOC_DIR}/cmliblzma) diff --git a/Utilities/cmliblzma/common/sysdefs.h b/Utilities/cmliblzma/common/sysdefs.h index 5ea6bda..5beda5c 100644 --- a/Utilities/cmliblzma/common/sysdefs.h +++ b/Utilities/cmliblzma/common/sysdefs.h @@ -20,9 +20,7 @@ // Includes // ////////////// -#ifdef HAVE_CONFIG_H -# include -#endif +#include "config.h" // Get standard-compliant stdio functions under MinGW and MinGW-w64. #ifdef __MINGW32__ diff --git a/Utilities/cmliblzma/common/tuklib_integer.h b/Utilities/cmliblzma/common/tuklib_integer.h index e6daa77..1897438 100644 --- a/Utilities/cmliblzma/common/tuklib_integer.h +++ b/Utilities/cmliblzma/common/tuklib_integer.h @@ -41,7 +41,15 @@ #ifndef TUKLIB_INTEGER_H #define TUKLIB_INTEGER_H -#include "tuklib_common.h" +#include "sysdefs.h" + +#if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define TUKLIB_GNUC_REQ(major, minor) \ + ((__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)) \ + || __GNUC__ > (major)) +#else +# define TUKLIB_GNUC_REQ(major, minor) 0 +#endif //////////////////////////////////////// diff --git a/Utilities/cmliblzma/config.h.in b/Utilities/cmliblzma/config.h.in new file mode 100644 index 0000000..391bb87 --- /dev/null +++ b/Utilities/cmliblzma/config.h.in @@ -0,0 +1,283 @@ + +/* + * Ensure we have C99-style int64_t, etc, all defined. + */ + +/* First, we need to know if the system has already defined them. */ +#cmakedefine HAVE_INT16_T +#cmakedefine HAVE_INT32_T +#cmakedefine HAVE_INT64_T +#cmakedefine HAVE_INTMAX_T + +#cmakedefine HAVE_UINT8_T +#cmakedefine HAVE_UINT16_T +#cmakedefine HAVE_UINT32_T +#cmakedefine HAVE_UINT64_T +#cmakedefine HAVE_UINTMAX_T + +/* We might have the types we want under other spellings. */ +#cmakedefine HAVE___INT64 +#cmakedefine HAVE_U_INT64_T +#cmakedefine HAVE_UNSIGNED___INT64 + +/* The sizes of various standard integer types. */ + at SIZE_OF_SHORT_CODE@ + at SIZE_OF_INT_CODE@ + at SIZE_OF_LONG_CODE@ + at SIZE_OF_LONG_LONG_CODE@ + at SIZE_OF_UNSIGNED_SHORT_CODE@ + at SIZE_OF_UNSIGNED_CODE@ + at SIZE_OF_UNSIGNED_LONG_CODE@ + at SIZE_OF_UNSIGNED_LONG_LONG_CODE@ + +/* + * If we lack int64_t, define it to the first of __int64, int, long, and long long + * that exists and is the right size. + */ +#if !defined(HAVE_INT64_T) && defined(HAVE___INT64) +typedef __int64 int64_t; +#define HAVE_INT64_T +#endif + +#if !defined(HAVE_INT64_T) && SIZE_OF_INT == 8 +typedef int int64_t; +#define HAVE_INT64_T +#endif + +#if !defined(HAVE_INT64_T) && SIZE_OF_LONG == 8 +typedef long int64_t; +#define HAVE_INT64_T +#endif + +#if !defined(HAVE_INT64_T) && SIZE_OF_LONG_LONG == 8 +typedef long long int64_t; +#define HAVE_INT64_T +#endif + +#if !defined(HAVE_INT64_T) +#error No 64-bit integer type was found. +#endif + +/* + * Similarly for int32_t + */ +#if !defined(HAVE_INT32_T) && SIZE_OF_INT == 4 +typedef int int32_t; +#define HAVE_INT32_T +#endif + +#if !defined(HAVE_INT32_T) && SIZE_OF_LONG == 4 +typedef long int32_t; +#define HAVE_INT32_T +#endif + +#if !defined(HAVE_INT32_T) +#error No 32-bit integer type was found. +#endif + +/* + * Similarly for int16_t + */ +#if !defined(HAVE_INT16_T) && SIZE_OF_INT == 2 +typedef int int16_t; +#define HAVE_INT16_T +#endif + +#if !defined(HAVE_INT16_T) && SIZE_OF_SHORT == 2 +typedef short int16_t; +#define HAVE_INT16_T +#endif + +#if !defined(HAVE_INT16_T) +#error No 16-bit integer type was found. +#endif + +/* + * Similarly for uint64_t + */ +#if !defined(HAVE_UINT64_T) && defined(HAVE_UNSIGNED___INT64) +typedef unsigned __int64 uint64_t; +#define HAVE_UINT64_T +#endif + +#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED == 8 +typedef unsigned uint64_t; +#define HAVE_UINT64_T +#endif + +#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED_LONG == 8 +typedef unsigned long uint64_t; +#define HAVE_UINT64_T +#endif + +#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED_LONG_LONG == 8 +typedef unsigned long long uint64_t; +#define HAVE_UINT64_T +#endif + +#if !defined(HAVE_UINT64_T) +#error No 64-bit unsigned integer type was found. +#endif + +/* + * Similarly for uint32_t + */ +#if !defined(HAVE_UINT32_T) && SIZE_OF_UNSIGNED == 4 +typedef unsigned uint32_t; +#define HAVE_UINT32_T +#endif + +#if !defined(HAVE_UINT32_T) && SIZE_OF_UNSIGNED_LONG == 4 +typedef unsigned long uint32_t; +#define HAVE_UINT32_T +#endif + +#if !defined(HAVE_UINT32_T) +#error No 32-bit unsigned integer type was found. +#endif + +/* + * Similarly for uint16_t + */ +#if !defined(HAVE_UINT16_T) && SIZE_OF_UNSIGNED == 2 +typedef unsigned uint16_t; +#define HAVE_UINT16_T +#endif + +#if !defined(HAVE_UINT16_T) && SIZE_OF_UNSIGNED_SHORT == 2 +typedef unsigned short uint16_t; +#define HAVE_UINT16_T +#endif + +#if !defined(HAVE_UINT16_T) +#error No 16-bit unsigned integer type was found. +#endif + +/* + * Similarly for uint8_t + */ +#if !defined(HAVE_UINT8_T) +typedef unsigned char uint8_t; +#define HAVE_UINT8_T +#endif + +#if !defined(HAVE_UINT16_T) +#error No 8-bit unsigned integer type was found. +#endif + +/* Define intmax_t and uintmax_t if they are not already defined. */ +#if !defined(HAVE_INTMAX_T) +typedef int64_t intmax_t; +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#endif + +#if !defined(HAVE_UINTMAX_T) +typedef uint64_t uintmax_t; +#endif + + +#cmakedefine uintptr_t @uintptr_t@ + + +#cmakedefine HAVE_RESTRICT +#cmakedefine HAVE___RESTRICT + +#cmakedefine HAVE_INLINE +#cmakedefine HAVE___INLINE + +#ifndef HAVE_RESTRICT +# ifdef HAVE___RESTRICT +# define restrict __restrict +# else +# define restrict +# endif +#endif /* HAVE_RESTRICT */ + +#ifndef HAVE_INLINE +# ifdef HAVE___INLINE +# define inline __inline +# else +# define inline +# endif +#endif /* HAVE_INLINE */ + + +#cmakedefine WORDS_BIGENDIAN 1 + +#cmakedefine HAVE_BYTESWAP_H 1 +#cmakedefine HAVE_BSWAP_16 1 +#cmakedefine HAVE_BSWAP_32 1 +#cmakedefine HAVE_BSWAP_64 1 + + +#define HAVE_CHECK_CRC32 1 +#define HAVE_CHECK_CRC64 1 +#define HAVE_CHECK_SHA256 1 + +#define HAVE_DECODER_ARM 1 +#define HAVE_DECODER_ARMTHUMB 1 +#define HAVE_DECODER_DELTA 1 +#define HAVE_DECODER_IA64 1 +#define HAVE_DECODER_LZMA1 1 +#define HAVE_DECODER_LZMA2 1 +#define HAVE_DECODER_POWERPC 1 +#define HAVE_DECODER_SPARC 1 +#define HAVE_DECODER_X86 1 + +#define HAVE_ENCODER_ARM 1 +#define HAVE_ENCODER_ARMTHUMB 1 +#define HAVE_ENCODER_DELTA 1 +#define HAVE_ENCODER_IA64 1 +#define HAVE_ENCODER_LZMA1 1 +#define HAVE_ENCODER_LZMA2 1 +#define HAVE_ENCODER_POWERPC 1 +#define HAVE_ENCODER_SPARC 1 +#define HAVE_ENCODER_X86 1 + +#define HAVE_MF_BT2 1 +#define HAVE_MF_BT3 1 +#define HAVE_MF_BT4 1 +#define HAVE_MF_HC3 1 +#define HAVE_MF_HC4 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MEMORY_H 1 + +/* Define to 1 if stdbool.h conforms to C99. */ +#cmakedefine HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_BYTEORDER_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_ENDIAN_H 1 + +/* Define to 1 or 0, depending whether the compiler supports simple visibility + declarations. */ +#cmakedefine HAVE_VISIBILITY 1 + +/* Define to 1 if the system has the type `_Bool'. */ +#cmakedefine HAVE__BOOL 1 + +/* The size of `size_t', as computed by sizeof. */ +#cmakedefine SIZEOF_SIZE_T @SIZEOF_SIZE_T@ + +/* Define to 1 if the system supports fast unaligned access to 16-bit and + 32-bit integers. */ +#define TUKLIB_FAST_UNALIGNED_ACCESS 1 diff --git a/Utilities/cmliblzma/liblzma/common/common.h b/Utilities/cmliblzma/liblzma/common/common.h index 45aba4f..6d7412f 100644 --- a/Utilities/cmliblzma/liblzma/common/common.h +++ b/Utilities/cmliblzma/liblzma/common/common.h @@ -14,7 +14,6 @@ #define LZMA_COMMON_H #include "sysdefs.h" -#include "mythread.h" #include "tuklib_integer.h" #if defined(_WIN32) || defined(__CYGWIN__) diff --git a/Utilities/cmliblzma/liblzma/liblzma_w32res.rc b/Utilities/cmliblzma/liblzma/liblzma_w32res.rc index d4d8159..773caf8 100644 --- a/Utilities/cmliblzma/liblzma/liblzma_w32res.rc +++ b/Utilities/cmliblzma/liblzma/liblzma_w32res.rc @@ -9,4 +9,6 @@ #define MY_NAME "liblzma" #define MY_SUFFIX ".dll" #define MY_DESC "liblzma data compression library" +#define PACKAGE_NAME "XZ Utils" +#define PACKAGE_URL "http://tukaani.org/xz/" #include "common_w32res.rc" diff --git a/Utilities/cmliblzma/liblzma/rangecoder/range_common.h b/Utilities/cmliblzma/liblzma/rangecoder/range_common.h index 0e64241..2c74dc1 100644 --- a/Utilities/cmliblzma/liblzma/rangecoder/range_common.h +++ b/Utilities/cmliblzma/liblzma/rangecoder/range_common.h @@ -14,9 +14,7 @@ #ifndef LZMA_RANGE_COMMON_H #define LZMA_RANGE_COMMON_H -#ifdef HAVE_CONFIG_H -# include "common.h" -#endif +#include "common.h" /////////////// http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d44ad1612bfe01891bb16b4289f5fa5a2e29a546 commit d44ad1612bfe01891bb16b4289f5fa5a2e29a546 Author: Brad King AuthorDate: Mon Jul 21 14:19:09 2014 -0400 Commit: Brad King CommitDate: Wed Jul 23 10:34:55 2014 -0400 liblzma: Remove unused Makefile.* files We will provide our own CMake-based build system. diff --git a/Utilities/cmliblzma/liblzma/Makefile.am b/Utilities/cmliblzma/liblzma/Makefile.am deleted file mode 100644 index 0529ff8..0000000 --- a/Utilities/cmliblzma/liblzma/Makefile.am +++ /dev/null @@ -1,90 +0,0 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## - -SUBDIRS = api - -EXTRA_DIST = -CLEANFILES = -doc_DATA = - -lib_LTLIBRARIES = liblzma.la -liblzma_la_SOURCES = $(top_srcdir)/src/common/tuklib_physmem.c -liblzma_la_CPPFLAGS = \ - -I$(top_srcdir)/src/liblzma/api \ - -I$(top_srcdir)/src/liblzma/common \ - -I$(top_srcdir)/src/liblzma/check \ - -I$(top_srcdir)/src/liblzma/lz \ - -I$(top_srcdir)/src/liblzma/rangecoder \ - -I$(top_srcdir)/src/liblzma/lzma \ - -I$(top_srcdir)/src/liblzma/delta \ - -I$(top_srcdir)/src/liblzma/simple \ - -I$(top_srcdir)/src/common \ - -DTUKLIB_SYMBOL_PREFIX=lzma_ -liblzma_la_LDFLAGS = -no-undefined -version-info 5:5:0 - -include $(srcdir)/common/Makefile.inc -include $(srcdir)/check/Makefile.inc - -if COND_FILTER_LZ -include $(srcdir)/lz/Makefile.inc -endif - -if COND_FILTER_LZMA1 -include $(srcdir)/lzma/Makefile.inc -include $(srcdir)/rangecoder/Makefile.inc -endif - -if COND_FILTER_DELTA -include $(srcdir)/delta/Makefile.inc -endif - -if COND_FILTER_SIMPLE -include $(srcdir)/simple/Makefile.inc -endif - - -## Windows-specific stuff - -# Windows resource compiler support. libtool knows what to do with .rc -# files, but Automake (<= 1.11 at least) doesn't know. -# -# We want the resource file only in shared liblzma. To avoid linking it into -# static liblzma, we overwrite the static object file with an object file -# compiled from empty input. Note that GNU-specific features are OK here, -# because on Windows we are compiled with the GNU toolchain. -.rc.lo: - $(LIBTOOL) --mode=compile $(RC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(liblzma_la_CPPFLAGS) $(CPPFLAGS) $(RCFLAGS) \ - -i $< -o $@ - echo > empty.c - $(COMPILE) -c empty.c -o $(*D)/$(*F).o - -# Remove ordinals from the generated .def file. People must link by name, -# not by ordinal, because no one is going to track the ordinal numbers. -liblzma.def: liblzma.la liblzma.def.in - sed 's/ \+@ *[0-9]\+//' liblzma.def.in > liblzma.def - -# Creating liblzma.def.in is a side effect of linking the library. -liblzma.def.in: liblzma.la - -if COND_W32 -CLEANFILES += liblzma.def liblzma.def.in empty.c -liblzma_la_SOURCES += liblzma_w32res.rc -liblzma_la_LDFLAGS += -Xlinker --output-def -Xlinker liblzma.def.in - -## liblzma.def.in is created only when building shared liblzma, so don't -## try to create liblzma.def when not building shared liblzma. -if COND_SHARED -doc_DATA += liblzma.def -endif -endif - - -## pkg-config -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = liblzma.pc -EXTRA_DIST += liblzma.pc.in diff --git a/Utilities/cmliblzma/liblzma/api/Makefile.am b/Utilities/cmliblzma/liblzma/api/Makefile.am deleted file mode 100644 index e016de5..0000000 --- a/Utilities/cmliblzma/liblzma/api/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## - -nobase_include_HEADERS = \ - lzma.h \ - lzma/base.h \ - lzma/bcj.h \ - lzma/block.h \ - lzma/check.h \ - lzma/container.h \ - lzma/delta.h \ - lzma/filter.h \ - lzma/hardware.h \ - lzma/index.h \ - lzma/index_hash.h \ - lzma/lzma.h \ - lzma/stream_flags.h \ - lzma/version.h \ - lzma/vli.h diff --git a/Utilities/cmliblzma/liblzma/check/Makefile.inc b/Utilities/cmliblzma/liblzma/check/Makefile.inc deleted file mode 100644 index e4067a9..0000000 --- a/Utilities/cmliblzma/liblzma/check/Makefile.inc +++ /dev/null @@ -1,51 +0,0 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## - -EXTRA_DIST += \ - check/crc32_tablegen.c \ - check/crc64_tablegen.c - -liblzma_la_SOURCES += \ - check/check.c \ - check/check.h \ - check/crc_macros.h - -if COND_CHECK_CRC32 -if COND_SMALL -liblzma_la_SOURCES += check/crc32_small.c -else -liblzma_la_SOURCES += \ - check/crc32_table.c \ - check/crc32_table_le.h \ - check/crc32_table_be.h -if COND_ASM_X86 -liblzma_la_SOURCES += check/crc32_x86.S -else -liblzma_la_SOURCES += check/crc32_fast.c -endif -endif -endif - -if COND_CHECK_CRC64 -if COND_SMALL -liblzma_la_SOURCES += check/crc64_small.c -else -liblzma_la_SOURCES += \ - check/crc64_table.c \ - check/crc64_table_le.h \ - check/crc64_table_be.h -if COND_ASM_X86 -liblzma_la_SOURCES += check/crc64_x86.S -else -liblzma_la_SOURCES += check/crc64_fast.c -endif -endif -endif - -if COND_CHECK_SHA256 -liblzma_la_SOURCES += check/sha256.c -endif diff --git a/Utilities/cmliblzma/liblzma/common/Makefile.inc b/Utilities/cmliblzma/liblzma/common/Makefile.inc deleted file mode 100644 index f154f82..0000000 --- a/Utilities/cmliblzma/liblzma/common/Makefile.inc +++ /dev/null @@ -1,67 +0,0 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## - -liblzma_la_SOURCES += \ - common/common.c \ - common/common.h \ - common/block_util.c \ - common/easy_preset.c \ - common/easy_preset.h \ - common/filter_common.c \ - common/filter_common.h \ - common/hardware_physmem.c \ - common/index.c \ - common/index.h \ - common/stream_flags_common.c \ - common/stream_flags_common.h \ - common/vli_size.c - -if COND_MAIN_ENCODER -liblzma_la_SOURCES += \ - common/alone_encoder.c \ - common/block_buffer_encoder.c \ - common/block_encoder.c \ - common/block_encoder.h \ - common/block_header_encoder.c \ - common/easy_buffer_encoder.c \ - common/easy_encoder.c \ - common/easy_encoder_memusage.c \ - common/filter_buffer_encoder.c \ - common/filter_encoder.c \ - common/filter_encoder.h \ - common/filter_flags_encoder.c \ - common/index_encoder.c \ - common/index_encoder.h \ - common/stream_buffer_encoder.c \ - common/stream_encoder.c \ - common/stream_encoder.h \ - common/stream_flags_encoder.c \ - common/vli_encoder.c -endif - -if COND_MAIN_DECODER -liblzma_la_SOURCES += \ - common/alone_decoder.c \ - common/alone_decoder.h \ - common/auto_decoder.c \ - common/block_buffer_decoder.c \ - common/block_decoder.c \ - common/block_decoder.h \ - common/block_header_decoder.c \ - common/easy_decoder_memusage.c \ - common/filter_buffer_decoder.c \ - common/filter_decoder.c \ - common/filter_decoder.h \ - common/filter_flags_decoder.c \ - common/index_decoder.c \ - common/index_hash.c \ - common/stream_buffer_decoder.c \ - common/stream_decoder.c \ - common/stream_decoder.h \ - common/stream_flags_decoder.c \ - common/vli_decoder.c -endif diff --git a/Utilities/cmliblzma/liblzma/delta/Makefile.inc b/Utilities/cmliblzma/liblzma/delta/Makefile.inc deleted file mode 100644 index c7739b4..0000000 --- a/Utilities/cmliblzma/liblzma/delta/Makefile.inc +++ /dev/null @@ -1,23 +0,0 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## - -liblzma_la_SOURCES += \ - delta/delta_common.c \ - delta/delta_common.h \ - delta/delta_private.h - -if COND_ENCODER_DELTA -liblzma_la_SOURCES += \ - delta/delta_encoder.c \ - delta/delta_encoder.h -endif - -if COND_DECODER_DELTA -liblzma_la_SOURCES += \ - delta/delta_decoder.c \ - delta/delta_decoder.h -endif diff --git a/Utilities/cmliblzma/liblzma/lz/Makefile.inc b/Utilities/cmliblzma/liblzma/lz/Makefile.inc deleted file mode 100644 index 75742a8..0000000 --- a/Utilities/cmliblzma/liblzma/lz/Makefile.inc +++ /dev/null @@ -1,22 +0,0 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## - -if COND_ENCODER_LZ -liblzma_la_SOURCES += \ - lz/lz_encoder.c \ - lz/lz_encoder.h \ - lz/lz_encoder_hash.h \ - lz/lz_encoder_hash_table.h \ - lz/lz_encoder_mf.c -endif - - -if COND_DECODER_LZ -liblzma_la_SOURCES += \ - lz/lz_decoder.c \ - lz/lz_decoder.h -endif diff --git a/Utilities/cmliblzma/liblzma/lzma/Makefile.inc b/Utilities/cmliblzma/liblzma/lzma/Makefile.inc deleted file mode 100644 index 7fc4d17..0000000 --- a/Utilities/cmliblzma/liblzma/lzma/Makefile.inc +++ /dev/null @@ -1,43 +0,0 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## - -EXTRA_DIST += lzma/fastpos_tablegen.c - -liblzma_la_SOURCES += lzma/lzma_common.h - -if COND_ENCODER_LZMA1 -liblzma_la_SOURCES += \ - lzma/fastpos.h \ - lzma/lzma_encoder.h \ - lzma/lzma_encoder.c \ - lzma/lzma_encoder_presets.c \ - lzma/lzma_encoder_private.h \ - lzma/lzma_encoder_optimum_fast.c \ - lzma/lzma_encoder_optimum_normal.c - -if !COND_SMALL -liblzma_la_SOURCES += lzma/fastpos_table.c -endif -endif - -if COND_DECODER_LZMA1 -liblzma_la_SOURCES += \ - lzma/lzma_decoder.c \ - lzma/lzma_decoder.h -endif - -if COND_ENCODER_LZMA2 -liblzma_la_SOURCES += \ - lzma/lzma2_encoder.c \ - lzma/lzma2_encoder.h -endif - -if COND_DECODER_LZMA2 -liblzma_la_SOURCES += \ - lzma/lzma2_decoder.c \ - lzma/lzma2_decoder.h -endif diff --git a/Utilities/cmliblzma/liblzma/rangecoder/Makefile.inc b/Utilities/cmliblzma/liblzma/rangecoder/Makefile.inc deleted file mode 100644 index d8a597a..0000000 --- a/Utilities/cmliblzma/liblzma/rangecoder/Makefile.inc +++ /dev/null @@ -1,21 +0,0 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## - -EXTRA_DIST += rangecoder/price_tablegen.c - -liblzma_la_SOURCES += rangecoder/range_common.h - -if COND_ENCODER_LZMA1 -liblzma_la_SOURCES += \ - rangecoder/range_encoder.h \ - rangecoder/price.h \ - rangecoder/price_table.c -endif - -if COND_DECODER_LZMA1 -liblzma_la_SOURCES += rangecoder/range_decoder.h -endif diff --git a/Utilities/cmliblzma/liblzma/simple/Makefile.inc b/Utilities/cmliblzma/liblzma/simple/Makefile.inc deleted file mode 100644 index 8a5e2d7..0000000 --- a/Utilities/cmliblzma/liblzma/simple/Makefile.inc +++ /dev/null @@ -1,47 +0,0 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## - -liblzma_la_SOURCES += \ - simple/simple_coder.c \ - simple/simple_coder.h \ - simple/simple_private.h - -if COND_ENCODER_SIMPLE -liblzma_la_SOURCES += \ - simple/simple_encoder.c \ - simple/simple_encoder.h -endif - -if COND_DECODER_SIMPLE -liblzma_la_SOURCES += \ - simple/simple_decoder.c \ - simple/simple_decoder.h -endif - -if COND_FILTER_X86 -liblzma_la_SOURCES += simple/x86.c -endif - -if COND_FILTER_POWERPC -liblzma_la_SOURCES += simple/powerpc.c -endif - -if COND_FILTER_IA64 -liblzma_la_SOURCES += simple/ia64.c -endif - -if COND_FILTER_ARM -liblzma_la_SOURCES += simple/arm.c -endif - -if COND_FILTER_ARMTHUMB -liblzma_la_SOURCES += simple/armthumb.c -endif - -if COND_FILTER_SPARC -liblzma_la_SOURCES += simple/sparc.c -endif http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a53caea3b6609f94063dfc21cbdf5361e9145040 commit a53caea3b6609f94063dfc21cbdf5361e9145040 Author: Brad King AuthorDate: Mon Jul 21 15:58:07 2014 -0400 Commit: Brad King CommitDate: Wed Jul 23 10:34:55 2014 -0400 liblzma: Add README-CMake.txt Describe how to update liblzma from upstream. diff --git a/Utilities/cmliblzma/README-CMake.txt b/Utilities/cmliblzma/README-CMake.txt new file mode 100644 index 0000000..b512997 --- /dev/null +++ b/Utilities/cmliblzma/README-CMake.txt @@ -0,0 +1,66 @@ +The Utilities/cmliblzma directory contains a reduced distribution +of the liblzma source tree with only the library source code and +CMake build system. It is not a submodule; the actual content is part +of our source tree and changes can be made and committed directly. + +We update from upstream using Git's "subtree" merge strategy. A +special branch contains commits of upstream liblzma snapshots and +nothing else. No Git ref points explicitly to the head of this +branch, but it is merged into our history. + +Update liblzma from upstream as follows. Create a local branch to +explicitly reference the upstream snapshot branch head: + + git branch liblzma-upstream c289e634 + +Use a temporary directory to checkout the branch: + + mkdir liblzma-tmp + cd liblzma-tmp + git init + git pull .. liblzma-upstream + rm -rf * + +Now place the (reduced) liblzma content in this directory. See +instructions shown by + + git log c289e634 + +for help extracting the content from the upstream svn repo. Then run +the following commands to commit the new version. Substitute the +appropriate date and version number: + + git add --all + + GIT_AUTHOR_NAME='liblzma upstream' \ + GIT_AUTHOR_EMAIL='xz-devel at tukaani.org' \ + GIT_AUTHOR_DATE='Sun Jun 30 19:55:49 2013 +0300' \ + git commit -m 'liblzma 5.0.5-gb69900ed (reduced)' && + git commit --amend + +Edit the commit message to describe the procedure used to obtain the +content. Then push the changes back up to the main local repository: + + git push .. HEAD:liblzma-upstream + cd .. + rm -rf liblzma-tmp + +Create a topic in the main repository on which to perform the update: + + git checkout -b update-liblzma master + +Merge the liblzma-upstream branch as a subtree: + + git merge -s recursive -X subtree=Utilities/cmliblzma \ + liblzma-upstream + +If there are conflicts, resolve them and commit. Build and test the +tree. Commit any additional changes needed to succeed. + +Finally, run + + git rev-parse --short=8 liblzma-upstream + +to get the commit from which the liblzma-upstream branch must be started +on the next update. Edit the "git branch liblzma-upstream" line above to +record it, and commit this file. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=133d42fe59e2f15610afaed287ef80ec4ff6f888 commit 133d42fe59e2f15610afaed287ef80ec4ff6f888 Merge: 8510533 c289e63 Author: Brad King AuthorDate: Mon Jul 21 14:31:04 2014 -0400 Commit: Brad King CommitDate: Mon Jul 21 15:54:44 2014 -0400 Merge branch 'liblzma-upstream' into add-liblzma diff --cc Utilities/cmliblzma/COPYING index 0000000,43c90d0..43c90d0 mode 000000,100644..100644 --- a/Utilities/cmliblzma/COPYING +++ b/Utilities/cmliblzma/COPYING diff --cc Utilities/cmliblzma/common/common_w32res.rc index 0000000,fdb88d1..fdb88d1 mode 000000,100644..100644 --- a/Utilities/cmliblzma/common/common_w32res.rc +++ b/Utilities/cmliblzma/common/common_w32res.rc diff --cc Utilities/cmliblzma/common/sysdefs.h index 0000000,5ea6bda..5ea6bda mode 000000,100644..100644 --- a/Utilities/cmliblzma/common/sysdefs.h +++ b/Utilities/cmliblzma/common/sysdefs.h diff --cc Utilities/cmliblzma/common/tuklib_integer.h index 0000000,e6daa77..e6daa77 mode 000000,100644..100644 --- a/Utilities/cmliblzma/common/tuklib_integer.h +++ b/Utilities/cmliblzma/common/tuklib_integer.h diff --cc Utilities/cmliblzma/liblzma/Makefile.am index 0000000,0529ff8..0529ff8 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/Makefile.am +++ b/Utilities/cmliblzma/liblzma/Makefile.am diff --cc Utilities/cmliblzma/liblzma/api/Makefile.am index 0000000,e016de5..e016de5 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/api/Makefile.am +++ b/Utilities/cmliblzma/liblzma/api/Makefile.am diff --cc Utilities/cmliblzma/liblzma/api/lzma.h index 0000000,fb874c3..fb874c3 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/api/lzma.h +++ b/Utilities/cmliblzma/liblzma/api/lzma.h diff --cc Utilities/cmliblzma/liblzma/api/lzma/base.h index 0000000,43dde8d..43dde8d mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/api/lzma/base.h +++ b/Utilities/cmliblzma/liblzma/api/lzma/base.h diff --cc Utilities/cmliblzma/liblzma/api/lzma/bcj.h index 0000000,8e37538..8e37538 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/api/lzma/bcj.h +++ b/Utilities/cmliblzma/liblzma/api/lzma/bcj.h diff --cc Utilities/cmliblzma/liblzma/api/lzma/block.h index 0000000,8a4bf23..8a4bf23 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/api/lzma/block.h +++ b/Utilities/cmliblzma/liblzma/api/lzma/block.h diff --cc Utilities/cmliblzma/liblzma/api/lzma/check.h index 0000000,6a243db..6a243db mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/api/lzma/check.h +++ b/Utilities/cmliblzma/liblzma/api/lzma/check.h diff --cc Utilities/cmliblzma/liblzma/api/lzma/container.h index 0000000,7a9ffc6..7a9ffc6 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/api/lzma/container.h +++ b/Utilities/cmliblzma/liblzma/api/lzma/container.h diff --cc Utilities/cmliblzma/liblzma/api/lzma/delta.h index 0000000,592fc4f..592fc4f mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/api/lzma/delta.h +++ b/Utilities/cmliblzma/liblzma/api/lzma/delta.h diff --cc Utilities/cmliblzma/liblzma/api/lzma/filter.h index 0000000,e0bc163..e0bc163 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/api/lzma/filter.h +++ b/Utilities/cmliblzma/liblzma/api/lzma/filter.h diff --cc Utilities/cmliblzma/liblzma/api/lzma/hardware.h index 0000000,e7dd03c..e7dd03c mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/api/lzma/hardware.h +++ b/Utilities/cmliblzma/liblzma/api/lzma/hardware.h diff --cc Utilities/cmliblzma/liblzma/api/lzma/index.h index 0000000,16bacc2..16bacc2 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/api/lzma/index.h +++ b/Utilities/cmliblzma/liblzma/api/lzma/index.h diff --cc Utilities/cmliblzma/liblzma/api/lzma/index_hash.h index 0000000,fa2e048..fa2e048 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/api/lzma/index_hash.h +++ b/Utilities/cmliblzma/liblzma/api/lzma/index_hash.h diff --cc Utilities/cmliblzma/liblzma/api/lzma/lzma.h index 0000000,3f8e095..3f8e095 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/api/lzma/lzma.h +++ b/Utilities/cmliblzma/liblzma/api/lzma/lzma.h diff --cc Utilities/cmliblzma/liblzma/api/lzma/stream_flags.h index 0000000,bbdd408..bbdd408 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/api/lzma/stream_flags.h +++ b/Utilities/cmliblzma/liblzma/api/lzma/stream_flags.h diff --cc Utilities/cmliblzma/liblzma/api/lzma/version.h index 0000000,66e9396..66e9396 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/api/lzma/version.h +++ b/Utilities/cmliblzma/liblzma/api/lzma/version.h diff --cc Utilities/cmliblzma/liblzma/api/lzma/vli.h index 0000000,9ad13f2..9ad13f2 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/api/lzma/vli.h +++ b/Utilities/cmliblzma/liblzma/api/lzma/vli.h diff --cc Utilities/cmliblzma/liblzma/check/Makefile.inc index 0000000,e4067a9..e4067a9 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/Makefile.inc +++ b/Utilities/cmliblzma/liblzma/check/Makefile.inc diff --cc Utilities/cmliblzma/liblzma/check/check.c index 0000000,428ddae..428ddae mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/check.c +++ b/Utilities/cmliblzma/liblzma/check/check.c diff --cc Utilities/cmliblzma/liblzma/check/check.h index 0000000,e100d2b..e100d2b mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/check.h +++ b/Utilities/cmliblzma/liblzma/check/check.h diff --cc Utilities/cmliblzma/liblzma/check/crc32_fast.c index 0000000,94da855..94da855 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/crc32_fast.c +++ b/Utilities/cmliblzma/liblzma/check/crc32_fast.c diff --cc Utilities/cmliblzma/liblzma/check/crc32_small.c index 0000000,5f8a328..5f8a328 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/crc32_small.c +++ b/Utilities/cmliblzma/liblzma/check/crc32_small.c diff --cc Utilities/cmliblzma/liblzma/check/crc32_table.c index 0000000,368874e..368874e mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/crc32_table.c +++ b/Utilities/cmliblzma/liblzma/check/crc32_table.c diff --cc Utilities/cmliblzma/liblzma/check/crc32_table_be.h index 0000000,c483cb6..c483cb6 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/crc32_table_be.h +++ b/Utilities/cmliblzma/liblzma/check/crc32_table_be.h diff --cc Utilities/cmliblzma/liblzma/check/crc32_table_le.h index 0000000,25f4fc4..25f4fc4 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/crc32_table_le.h +++ b/Utilities/cmliblzma/liblzma/check/crc32_table_le.h diff --cc Utilities/cmliblzma/liblzma/check/crc32_tablegen.c index 0000000,31a4d27..31a4d27 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/crc32_tablegen.c +++ b/Utilities/cmliblzma/liblzma/check/crc32_tablegen.c diff --cc Utilities/cmliblzma/liblzma/check/crc32_x86.S index 0000000,67f68a4..67f68a4 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/crc32_x86.S +++ b/Utilities/cmliblzma/liblzma/check/crc32_x86.S diff --cc Utilities/cmliblzma/liblzma/check/crc64_fast.c index 0000000,52af29e..52af29e mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/crc64_fast.c +++ b/Utilities/cmliblzma/liblzma/check/crc64_fast.c diff --cc Utilities/cmliblzma/liblzma/check/crc64_small.c index 0000000,55d7231..55d7231 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/crc64_small.c +++ b/Utilities/cmliblzma/liblzma/check/crc64_small.c diff --cc Utilities/cmliblzma/liblzma/check/crc64_table.c index 0000000,1fbcd94..1fbcd94 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/crc64_table.c +++ b/Utilities/cmliblzma/liblzma/check/crc64_table.c diff --cc Utilities/cmliblzma/liblzma/check/crc64_table_be.h index 0000000,ea074f3..ea074f3 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/crc64_table_be.h +++ b/Utilities/cmliblzma/liblzma/check/crc64_table_be.h diff --cc Utilities/cmliblzma/liblzma/check/crc64_table_le.h index 0000000,1196b31..1196b31 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/crc64_table_le.h +++ b/Utilities/cmliblzma/liblzma/check/crc64_table_le.h diff --cc Utilities/cmliblzma/liblzma/check/crc64_tablegen.c index 0000000,fddaa7e..fddaa7e mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/crc64_tablegen.c +++ b/Utilities/cmliblzma/liblzma/check/crc64_tablegen.c diff --cc Utilities/cmliblzma/liblzma/check/crc64_x86.S index 0000000,f5bb84b..f5bb84b mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/crc64_x86.S +++ b/Utilities/cmliblzma/liblzma/check/crc64_x86.S diff --cc Utilities/cmliblzma/liblzma/check/crc_macros.h index 0000000,a7c21b7..a7c21b7 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/crc_macros.h +++ b/Utilities/cmliblzma/liblzma/check/crc_macros.h diff --cc Utilities/cmliblzma/liblzma/check/sha256.c index 0000000,23bda92..23bda92 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/check/sha256.c +++ b/Utilities/cmliblzma/liblzma/check/sha256.c diff --cc Utilities/cmliblzma/liblzma/common/Makefile.inc index 0000000,f154f82..f154f82 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/Makefile.inc +++ b/Utilities/cmliblzma/liblzma/common/Makefile.inc diff --cc Utilities/cmliblzma/liblzma/common/alone_decoder.c index 0000000,c25112e..c25112e mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/alone_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/alone_decoder.c diff --cc Utilities/cmliblzma/liblzma/common/alone_decoder.h index 0000000,f666fc3..f666fc3 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/alone_decoder.h +++ b/Utilities/cmliblzma/liblzma/common/alone_decoder.h diff --cc Utilities/cmliblzma/liblzma/common/alone_encoder.c index 0000000,eb1697e..eb1697e mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/alone_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/alone_encoder.c diff --cc Utilities/cmliblzma/liblzma/common/auto_decoder.c index 0000000,35c895f..35c895f mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/auto_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/auto_decoder.c diff --cc Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c index 0000000,ff27a11..ff27a11 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c diff --cc Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c index 0000000,519c6a6..519c6a6 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c diff --cc Utilities/cmliblzma/liblzma/common/block_decoder.c index 0000000,a3ce6f4..a3ce6f4 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/block_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_decoder.c diff --cc Utilities/cmliblzma/liblzma/common/block_decoder.h index 0000000,7da9df6..7da9df6 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/block_decoder.h +++ b/Utilities/cmliblzma/liblzma/common/block_decoder.h diff --cc Utilities/cmliblzma/liblzma/common/block_encoder.c index 0000000,1eeb502..1eeb502 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/block_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_encoder.c diff --cc Utilities/cmliblzma/liblzma/common/block_encoder.h index 0000000,b9eff0b..b9eff0b mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/block_encoder.h +++ b/Utilities/cmliblzma/liblzma/common/block_encoder.h diff --cc Utilities/cmliblzma/liblzma/common/block_header_decoder.c index 0000000,2c9573e..2c9573e mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/block_header_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_header_decoder.c diff --cc Utilities/cmliblzma/liblzma/common/block_header_encoder.c index 0000000,707dd0c..707dd0c mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/block_header_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_header_encoder.c diff --cc Utilities/cmliblzma/liblzma/common/block_util.c index 0000000,62c9345..62c9345 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/block_util.c +++ b/Utilities/cmliblzma/liblzma/common/block_util.c diff --cc Utilities/cmliblzma/liblzma/common/common.c index 0000000,b9e3860..b9e3860 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/common.c +++ b/Utilities/cmliblzma/liblzma/common/common.c diff --cc Utilities/cmliblzma/liblzma/common/common.h index 0000000,45aba4f..45aba4f mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/common.h +++ b/Utilities/cmliblzma/liblzma/common/common.h diff --cc Utilities/cmliblzma/liblzma/common/easy_buffer_encoder.c index 0000000,c4be34c..c4be34c mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/easy_buffer_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/easy_buffer_encoder.c diff --cc Utilities/cmliblzma/liblzma/common/easy_decoder_memusage.c index 0000000,20bcd5b..20bcd5b mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/easy_decoder_memusage.c +++ b/Utilities/cmliblzma/liblzma/common/easy_decoder_memusage.c diff --cc Utilities/cmliblzma/liblzma/common/easy_encoder.c index 0000000,d13ccd7..d13ccd7 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/easy_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/easy_encoder.c diff --cc Utilities/cmliblzma/liblzma/common/easy_encoder_memusage.c index 0000000,e910575..e910575 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/easy_encoder_memusage.c +++ b/Utilities/cmliblzma/liblzma/common/easy_encoder_memusage.c diff --cc Utilities/cmliblzma/liblzma/common/easy_preset.c index 0000000,2f98598..2f98598 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/easy_preset.c +++ b/Utilities/cmliblzma/liblzma/common/easy_preset.c diff --cc Utilities/cmliblzma/liblzma/common/easy_preset.h index 0000000,382ade8..382ade8 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/easy_preset.h +++ b/Utilities/cmliblzma/liblzma/common/easy_preset.h diff --cc Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c index 0000000,2d35ef8..2d35ef8 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c diff --cc Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c index 0000000,646e1b3..646e1b3 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c diff --cc Utilities/cmliblzma/liblzma/common/filter_common.c index 0000000,7c95b05..7c95b05 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/filter_common.c +++ b/Utilities/cmliblzma/liblzma/common/filter_common.c diff --cc Utilities/cmliblzma/liblzma/common/filter_common.h index 0000000,cd61fc0..cd61fc0 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/filter_common.h +++ b/Utilities/cmliblzma/liblzma/common/filter_common.h diff --cc Utilities/cmliblzma/liblzma/common/filter_decoder.c index 0000000,1ebbe2a..1ebbe2a mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/filter_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_decoder.c diff --cc Utilities/cmliblzma/liblzma/common/filter_decoder.h index 0000000,d5c68bd..d5c68bd mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/filter_decoder.h +++ b/Utilities/cmliblzma/liblzma/common/filter_decoder.h diff --cc Utilities/cmliblzma/liblzma/common/filter_encoder.c index 0000000,635d812..635d812 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/filter_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_encoder.c diff --cc Utilities/cmliblzma/liblzma/common/filter_encoder.h index 0000000,5bc137f..5bc137f mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/filter_encoder.h +++ b/Utilities/cmliblzma/liblzma/common/filter_encoder.h diff --cc Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c index 0000000,caae10c..caae10c mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c diff --cc Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c index 0000000,d110566..d110566 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c diff --cc Utilities/cmliblzma/liblzma/common/hardware_physmem.c index 0000000,7405b65..7405b65 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/hardware_physmem.c +++ b/Utilities/cmliblzma/liblzma/common/hardware_physmem.c diff --cc Utilities/cmliblzma/liblzma/common/index.c index 0000000,9af4bc1..9af4bc1 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/index.c +++ b/Utilities/cmliblzma/liblzma/common/index.c diff --cc Utilities/cmliblzma/liblzma/common/index.h index 0000000,64e9724..64e9724 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/index.h +++ b/Utilities/cmliblzma/liblzma/common/index.h diff --cc Utilities/cmliblzma/liblzma/common/index_decoder.c index 0000000,83c8a3a..83c8a3a mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/index_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/index_decoder.c diff --cc Utilities/cmliblzma/liblzma/common/index_encoder.c index 0000000,45919f0..45919f0 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/index_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/index_encoder.c diff --cc Utilities/cmliblzma/liblzma/common/index_encoder.h index 0000000,a13c94d..a13c94d mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/index_encoder.h +++ b/Utilities/cmliblzma/liblzma/common/index_encoder.h diff --cc Utilities/cmliblzma/liblzma/common/index_hash.c index 0000000,e3e9386..e3e9386 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/index_hash.c +++ b/Utilities/cmliblzma/liblzma/common/index_hash.c diff --cc Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c index 0000000,ae75315..ae75315 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c diff --cc Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c index 0000000,2450ee2..2450ee2 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c diff --cc Utilities/cmliblzma/liblzma/common/stream_decoder.c index 0000000,37ea71e..37ea71e mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/stream_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_decoder.c diff --cc Utilities/cmliblzma/liblzma/common/stream_decoder.h index 0000000,e54ac28..e54ac28 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/stream_decoder.h +++ b/Utilities/cmliblzma/liblzma/common/stream_decoder.h diff --cc Utilities/cmliblzma/liblzma/common/stream_encoder.c index 0000000,97a7a23..97a7a23 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/stream_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_encoder.c diff --cc Utilities/cmliblzma/liblzma/common/stream_encoder.h index 0000000,46a7aed..46a7aed mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/stream_encoder.h +++ b/Utilities/cmliblzma/liblzma/common/stream_encoder.h diff --cc Utilities/cmliblzma/liblzma/common/stream_flags_common.c index 0000000,fbe8eb8..fbe8eb8 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/stream_flags_common.c +++ b/Utilities/cmliblzma/liblzma/common/stream_flags_common.c diff --cc Utilities/cmliblzma/liblzma/common/stream_flags_common.h index 0000000,9f3122a..9f3122a mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/stream_flags_common.h +++ b/Utilities/cmliblzma/liblzma/common/stream_flags_common.h diff --cc Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c index 0000000,1bc2f97..1bc2f97 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c diff --cc Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c index 0000000,4e71715..4e71715 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c diff --cc Utilities/cmliblzma/liblzma/common/vli_decoder.c index 0000000,c181828..c181828 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/vli_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/vli_decoder.c diff --cc Utilities/cmliblzma/liblzma/common/vli_encoder.c index 0000000,f864269..f864269 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/vli_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/vli_encoder.c diff --cc Utilities/cmliblzma/liblzma/common/vli_size.c index 0000000,ec1b4fa..ec1b4fa mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/common/vli_size.c +++ b/Utilities/cmliblzma/liblzma/common/vli_size.c diff --cc Utilities/cmliblzma/liblzma/delta/Makefile.inc index 0000000,c7739b4..c7739b4 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/delta/Makefile.inc +++ b/Utilities/cmliblzma/liblzma/delta/Makefile.inc diff --cc Utilities/cmliblzma/liblzma/delta/delta_common.c index 0000000,930ad21..930ad21 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/delta/delta_common.c +++ b/Utilities/cmliblzma/liblzma/delta/delta_common.c diff --cc Utilities/cmliblzma/liblzma/delta/delta_common.h index 0000000,7e7e1ba..7e7e1ba mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/delta/delta_common.h +++ b/Utilities/cmliblzma/liblzma/delta/delta_common.h diff --cc Utilities/cmliblzma/liblzma/delta/delta_decoder.c index 0000000,2cf60d5..2cf60d5 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/delta/delta_decoder.c +++ b/Utilities/cmliblzma/liblzma/delta/delta_decoder.c diff --cc Utilities/cmliblzma/liblzma/delta/delta_decoder.h index 0000000,ae89acc..ae89acc mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/delta/delta_decoder.h +++ b/Utilities/cmliblzma/liblzma/delta/delta_decoder.h diff --cc Utilities/cmliblzma/liblzma/delta/delta_encoder.c index 0000000,15c7951..15c7951 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/delta/delta_encoder.c +++ b/Utilities/cmliblzma/liblzma/delta/delta_encoder.c diff --cc Utilities/cmliblzma/liblzma/delta/delta_encoder.h index 0000000,a447862..a447862 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/delta/delta_encoder.h +++ b/Utilities/cmliblzma/liblzma/delta/delta_encoder.h diff --cc Utilities/cmliblzma/liblzma/delta/delta_private.h index 0000000,62b7fed..62b7fed mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/delta/delta_private.h +++ b/Utilities/cmliblzma/liblzma/delta/delta_private.h diff --cc Utilities/cmliblzma/liblzma/liblzma.pc.in index 0000000,7f11f1a..7f11f1a mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/liblzma.pc.in +++ b/Utilities/cmliblzma/liblzma/liblzma.pc.in diff --cc Utilities/cmliblzma/liblzma/liblzma_w32res.rc index 0000000,d4d8159..d4d8159 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/liblzma_w32res.rc +++ b/Utilities/cmliblzma/liblzma/liblzma_w32res.rc diff --cc Utilities/cmliblzma/liblzma/lz/Makefile.inc index 0000000,75742a8..75742a8 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lz/Makefile.inc +++ b/Utilities/cmliblzma/liblzma/lz/Makefile.inc diff --cc Utilities/cmliblzma/liblzma/lz/lz_decoder.c index 0000000,d74085c..d74085c mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_decoder.c +++ b/Utilities/cmliblzma/liblzma/lz/lz_decoder.c diff --cc Utilities/cmliblzma/liblzma/lz/lz_decoder.h index 0000000,7266e80..7266e80 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_decoder.h +++ b/Utilities/cmliblzma/liblzma/lz/lz_decoder.h diff --cc Utilities/cmliblzma/liblzma/lz/lz_encoder.c index 0000000,e240696..e240696 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_encoder.c +++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder.c diff --cc Utilities/cmliblzma/liblzma/lz/lz_encoder.h index 0000000,741c453..741c453 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_encoder.h +++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder.h diff --cc Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h index 0000000,342a333..342a333 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h +++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h diff --cc Utilities/cmliblzma/liblzma/lz/lz_encoder_hash_table.h index 0000000,8c51717..8c51717 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_encoder_hash_table.h +++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder_hash_table.h diff --cc Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c index 0000000,f82a1c1..f82a1c1 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c +++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c diff --cc Utilities/cmliblzma/liblzma/lzma/Makefile.inc index 0000000,7fc4d17..7fc4d17 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lzma/Makefile.inc +++ b/Utilities/cmliblzma/liblzma/lzma/Makefile.inc diff --cc Utilities/cmliblzma/liblzma/lzma/fastpos.h index 0000000,4aea231..4aea231 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lzma/fastpos.h +++ b/Utilities/cmliblzma/liblzma/lzma/fastpos.h diff --cc Utilities/cmliblzma/liblzma/lzma/fastpos_table.c index 0000000,6a3ceac..6a3ceac mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lzma/fastpos_table.c +++ b/Utilities/cmliblzma/liblzma/lzma/fastpos_table.c diff --cc Utilities/cmliblzma/liblzma/lzma/fastpos_tablegen.c index 0000000,c97e6f4..c97e6f4 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lzma/fastpos_tablegen.c +++ b/Utilities/cmliblzma/liblzma/lzma/fastpos_tablegen.c diff --cc Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c index 0000000,3e42575..3e42575 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c diff --cc Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.h index 0000000,fac4ac4..fac4ac4 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.h +++ b/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.h diff --cc Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c index 0000000,992720c..992720c mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c diff --cc Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.h index 0000000,ca19ef4..ca19ef4 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.h +++ b/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.h diff --cc Utilities/cmliblzma/liblzma/lzma/lzma_common.h index 0000000,e31e285..e31e285 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_common.h +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_common.h diff --cc Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c index 0000000,9979bb4..9979bb4 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c diff --cc Utilities/cmliblzma/liblzma/lzma/lzma_decoder.h index 0000000,a463a76..a463a76 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.h +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.h diff --cc Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c index 0000000,0b9ee9e..0b9ee9e mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c diff --cc Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h index 0000000,835e1f5..835e1f5 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h diff --cc Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c index 0000000,f835f69..f835f69 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c diff --cc Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c index 0000000,7e85649..7e85649 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c diff --cc Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c index 0000000,21e427a..21e427a mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c diff --cc Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h index 0000000,6847452..6847452 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h diff --cc Utilities/cmliblzma/liblzma/rangecoder/Makefile.inc index 0000000,d8a597a..d8a597a mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/rangecoder/Makefile.inc +++ b/Utilities/cmliblzma/liblzma/rangecoder/Makefile.inc diff --cc Utilities/cmliblzma/liblzma/rangecoder/price.h index 0000000,8ae02ca..8ae02ca mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/rangecoder/price.h +++ b/Utilities/cmliblzma/liblzma/rangecoder/price.h diff --cc Utilities/cmliblzma/liblzma/rangecoder/price_table.c index 0000000,ac64bf6..ac64bf6 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/rangecoder/price_table.c +++ b/Utilities/cmliblzma/liblzma/rangecoder/price_table.c diff --cc Utilities/cmliblzma/liblzma/rangecoder/price_tablegen.c index 0000000,bf08ce3..bf08ce3 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/rangecoder/price_tablegen.c +++ b/Utilities/cmliblzma/liblzma/rangecoder/price_tablegen.c diff --cc Utilities/cmliblzma/liblzma/rangecoder/range_common.h index 0000000,0e64241..0e64241 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/rangecoder/range_common.h +++ b/Utilities/cmliblzma/liblzma/rangecoder/range_common.h diff --cc Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h index 0000000,fb96180..fb96180 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h +++ b/Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h diff --cc Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h index 0000000,1e1c369..1e1c369 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h +++ b/Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h diff --cc Utilities/cmliblzma/liblzma/simple/Makefile.inc index 0000000,8a5e2d7..8a5e2d7 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/simple/Makefile.inc +++ b/Utilities/cmliblzma/liblzma/simple/Makefile.inc diff --cc Utilities/cmliblzma/liblzma/simple/arm.c index 0000000,a84702a..a84702a mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/simple/arm.c +++ b/Utilities/cmliblzma/liblzma/simple/arm.c diff --cc Utilities/cmliblzma/liblzma/simple/armthumb.c index 0000000,4b49175..4b49175 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/simple/armthumb.c +++ b/Utilities/cmliblzma/liblzma/simple/armthumb.c diff --cc Utilities/cmliblzma/liblzma/simple/ia64.c index 0000000,ce3692b..ce3692b mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/simple/ia64.c +++ b/Utilities/cmliblzma/liblzma/simple/ia64.c diff --cc Utilities/cmliblzma/liblzma/simple/powerpc.c index 0000000,6f83511..6f83511 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/simple/powerpc.c +++ b/Utilities/cmliblzma/liblzma/simple/powerpc.c diff --cc Utilities/cmliblzma/liblzma/simple/simple_coder.c index 0000000,a02b039..a02b039 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/simple/simple_coder.c +++ b/Utilities/cmliblzma/liblzma/simple/simple_coder.c diff --cc Utilities/cmliblzma/liblzma/simple/simple_coder.h index 0000000,0952fad..0952fad mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/simple/simple_coder.h +++ b/Utilities/cmliblzma/liblzma/simple/simple_coder.h diff --cc Utilities/cmliblzma/liblzma/simple/simple_decoder.c index 0000000,0beccd3..0beccd3 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/simple/simple_decoder.c +++ b/Utilities/cmliblzma/liblzma/simple/simple_decoder.c diff --cc Utilities/cmliblzma/liblzma/simple/simple_decoder.h index 0000000,b8bf590..b8bf590 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/simple/simple_decoder.h +++ b/Utilities/cmliblzma/liblzma/simple/simple_decoder.h diff --cc Utilities/cmliblzma/liblzma/simple/simple_encoder.c index 0000000,8aa463b..8aa463b mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/simple/simple_encoder.c +++ b/Utilities/cmliblzma/liblzma/simple/simple_encoder.c diff --cc Utilities/cmliblzma/liblzma/simple/simple_encoder.h index 0000000,1cee482..1cee482 mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/simple/simple_encoder.h +++ b/Utilities/cmliblzma/liblzma/simple/simple_encoder.h diff --cc Utilities/cmliblzma/liblzma/simple/simple_private.h index 0000000,fcf9f7c..fcf9f7c mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/simple/simple_private.h +++ b/Utilities/cmliblzma/liblzma/simple/simple_private.h diff --cc Utilities/cmliblzma/liblzma/simple/sparc.c index 0000000,8270d6a..8270d6a mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/simple/sparc.c +++ b/Utilities/cmliblzma/liblzma/simple/sparc.c diff --cc Utilities/cmliblzma/liblzma/simple/x86.c index 0000000,5d1509b..5d1509b mode 000000,100644..100644 --- a/Utilities/cmliblzma/liblzma/simple/x86.c +++ b/Utilities/cmliblzma/liblzma/simple/x86.c http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c289e63491982dd8aed7c6b6f54d390df91aaf95 commit c289e63491982dd8aed7c6b6f54d390df91aaf95 Author: liblzma upstream AuthorDate: Sun Jun 30 19:55:49 2013 +0300 Commit: Brad King CommitDate: Mon Jul 21 14:30:16 2014 -0400 liblzma 5.0.5-gb69900ed (reduced) Extract upstream liblzma using the following shell code. url=http://git.tukaani.org/xz.git && v=5.0.5 && r=b69900ed && paths=" COPYING src/common/common_w32res.rc src/common/sysdefs.h src/common/tuklib_integer.h src/liblzma " && mkdir liblzma-$v-g$r-reduced && git clone $url liblzma-git && date=$(cd liblzma-git && git log -n 1 --format='%cd' $r) && (cd liblzma-git && git archive --format=tar $r -- $paths) | (cd liblzma-$v-g$r-reduced && tar xv && mv src/* . && rmdir src) && echo "g$r date: $date" diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..43c90d0 --- /dev/null +++ b/COPYING @@ -0,0 +1,65 @@ + +XZ Utils Licensing +================== + + Different licenses apply to different files in this package. Here + is a rough summary of which licenses apply to which parts of this + package (but check the individual files to be sure!): + + - liblzma is in the public domain. + + - xz, xzdec, and lzmadec command line tools are in the public + domain unless GNU getopt_long had to be compiled and linked + in from the lib directory. The getopt_long code is under + GNU LGPLv2.1+. + + - The scripts to grep, diff, and view compressed files have been + adapted from gzip. These scripts and their documentation are + under GNU GPLv2+. + + - All the documentation in the doc directory and most of the + XZ Utils specific documentation files in other directories + are in the public domain. + + - Translated messages are in the public domain. + + - The build system contains public domain files, and files that + are under GNU GPLv2+ or GNU GPLv3+. None of these files end up + in the binaries being built. + + - Test files and test code in the tests directory, and debugging + utilities in the debug directory are in the public domain. + + - The extra directory may contain public domain files, and files + that are under various free software licenses. + + You can do whatever you want with the files that have been put into + the public domain. If you find public domain legally problematic, + take the previous sentence as a license grant. If you still find + the lack of copyright legally problematic, you have too many + lawyers. + + As usual, this software is provided "as is", without any warranty. + + If you copy significant amounts of public domain code from XZ Utils + into your project, acknowledging this somewhere in your software is + polite (especially if it is proprietary, non-free software), but + naturally it is not legally required. Here is an example of a good + notice to put into "about box" or into documentation: + + This software includes code from XZ Utils . + + The following license texts are included in the following files: + - COPYING.LGPLv2.1: GNU Lesser General Public License version 2.1 + - COPYING.GPLv2: GNU General Public License version 2 + - COPYING.GPLv3: GNU General Public License version 3 + + Note that the toolchain (compiler, linker etc.) may add some code + pieces that are copyrighted. Thus, it is possible that e.g. liblzma + binary wouldn't actually be in the public domain in its entirety + even though it contains no copyrighted code from the XZ Utils source + package. + + If you have questions, don't hesitate to ask the author(s) for more + information. + diff --git a/common/common_w32res.rc b/common/common_w32res.rc new file mode 100644 index 0000000..fdb88d1 --- /dev/null +++ b/common/common_w32res.rc @@ -0,0 +1,50 @@ +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + */ + +#include +#include "config.h" +#define LZMA_H_INTERNAL +#define LZMA_H_INTERNAL_RC +#include "lzma/version.h" + +#ifndef MY_BUILD +# define MY_BUILD 0 +#endif +#define MY_VERSION LZMA_VERSION_MAJOR,LZMA_VERSION_MINOR,LZMA_VERSION_PATCH,MY_BUILD + +#define MY_FILENAME MY_NAME MY_SUFFIX +#define MY_COMPANY "The Tukaani Project " +#define MY_PRODUCT PACKAGE_NAME " <" PACKAGE_URL ">" + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +VS_VERSION_INFO VERSIONINFO + FILEVERSION MY_VERSION + PRODUCTVERSION MY_VERSION + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS 0 + FILEOS VOS_NT_WINDOWS32 + FILETYPE MY_TYPE + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", MY_COMPANY + VALUE "FileDescription", MY_DESC + VALUE "FileVersion", LZMA_VERSION_STRING + VALUE "InternalName", MY_NAME + VALUE "OriginalFilename", MY_FILENAME + VALUE "ProductName", MY_PRODUCT + VALUE "ProductVersion", LZMA_VERSION_STRING + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/common/sysdefs.h b/common/sysdefs.h new file mode 100644 index 0000000..5ea6bda --- /dev/null +++ b/common/sysdefs.h @@ -0,0 +1,192 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file sysdefs.h +/// \brief Common includes, definitions, system-specific things etc. +/// +/// This file is used also by the lzma command line tool, that's why this +/// file is separate from common.h. +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_SYSDEFS_H +#define LZMA_SYSDEFS_H + +////////////// +// Includes // +////////////// + +#ifdef HAVE_CONFIG_H +# include +#endif + +// Get standard-compliant stdio functions under MinGW and MinGW-w64. +#ifdef __MINGW32__ +# define __USE_MINGW_ANSI_STDIO 1 +#endif + +// size_t and NULL +#include + +#ifdef HAVE_INTTYPES_H +# include +#endif + +// C99 says that inttypes.h always includes stdint.h, but some systems +// don't do that, and require including stdint.h separately. +#ifdef HAVE_STDINT_H +# include +#endif + +// Some pre-C99 systems have SIZE_MAX in limits.h instead of stdint.h. The +// limits are also used to figure out some macros missing from pre-C99 systems. +#ifdef HAVE_LIMITS_H +# include +#endif + +// Be more compatible with systems that have non-conforming inttypes.h. +// We assume that int is 32-bit and that long is either 32-bit or 64-bit. +// Full Autoconf test could be more correct, but this should work well enough. +// Note that this duplicates some code from lzma.h, but this is better since +// we can work without inttypes.h thanks to Autoconf tests. +#ifndef UINT32_C +# if UINT_MAX != 4294967295U +# error UINT32_C is not defined and unsigned int is not 32-bit. +# endif +# define UINT32_C(n) n ## U +#endif +#ifndef UINT32_MAX +# define UINT32_MAX UINT32_C(4294967295) +#endif +#ifndef PRIu32 +# define PRIu32 "u" +#endif +#ifndef PRIx32 +# define PRIx32 "x" +#endif +#ifndef PRIX32 +# define PRIX32 "X" +#endif + +#if ULONG_MAX == 4294967295UL +# ifndef UINT64_C +# define UINT64_C(n) n ## ULL +# endif +# ifndef PRIu64 +# define PRIu64 "llu" +# endif +# ifndef PRIx64 +# define PRIx64 "llx" +# endif +# ifndef PRIX64 +# define PRIX64 "llX" +# endif +#else +# ifndef UINT64_C +# define UINT64_C(n) n ## UL +# endif +# ifndef PRIu64 +# define PRIu64 "lu" +# endif +# ifndef PRIx64 +# define PRIx64 "lx" +# endif +# ifndef PRIX64 +# define PRIX64 "lX" +# endif +#endif +#ifndef UINT64_MAX +# define UINT64_MAX UINT64_C(18446744073709551615) +#endif + +// Incorrect(?) SIZE_MAX: +// - Interix headers typedef size_t to unsigned long, +// but a few lines later define SIZE_MAX to INT32_MAX. +// - SCO OpenServer (x86) headers typedef size_t to unsigned int +// but define SIZE_MAX to INT32_MAX. +#if defined(__INTERIX) || defined(_SCO_DS) +# undef SIZE_MAX +#endif + +// The code currently assumes that size_t is either 32-bit or 64-bit. +#ifndef SIZE_MAX +# if SIZEOF_SIZE_T == 4 +# define SIZE_MAX UINT32_MAX +# elif SIZEOF_SIZE_T == 8 +# define SIZE_MAX UINT64_MAX +# else +# error size_t is not 32-bit or 64-bit +# endif +#endif +#if SIZE_MAX != UINT32_MAX && SIZE_MAX != UINT64_MAX +# error size_t is not 32-bit or 64-bit +#endif + +#include +#include + +// Pre-C99 systems lack stdbool.h. All the code in LZMA Utils must be written +// so that it works with fake bool type, for example: +// +// bool foo = (flags & 0x100) != 0; +// bool bar = !!(flags & 0x100); +// +// This works with the real C99 bool but breaks with fake bool: +// +// bool baz = (flags & 0x100); +// +#ifdef HAVE_STDBOOL_H +# include +#else +# if ! HAVE__BOOL +typedef unsigned char _Bool; +# endif +# define bool _Bool +# define false 0 +# define true 1 +# define __bool_true_false_are_defined 1 +#endif + +// string.h should be enough but let's include strings.h and memory.h too if +// they exists, since that shouldn't do any harm, but may improve portability. +#ifdef HAVE_STRING_H +# include +#endif + +#ifdef HAVE_STRINGS_H +# include +#endif + +#ifdef HAVE_MEMORY_H +# include +#endif + + +//////////// +// Macros // +//////////// + +#undef memzero +#define memzero(s, n) memset(s, 0, n) + +// NOTE: Avoid using MIN() and MAX(), because even conditionally defining +// those macros can cause some portability trouble, since on some systems +// the system headers insist defining their own versions. +#define my_min(x, y) ((x) < (y) ? (x) : (y)) +#define my_max(x, y) ((x) > (y) ? (x) : (y)) + +#ifndef ARRAY_SIZE +# define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) +#endif + +#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4 +# define lzma_attr_alloc_size(x) __attribute__((__alloc_size__(x))) +#else +# define lzma_attr_alloc_size(x) +#endif + +#endif diff --git a/common/tuklib_integer.h b/common/tuklib_integer.h new file mode 100644 index 0000000..e6daa77 --- /dev/null +++ b/common/tuklib_integer.h @@ -0,0 +1,523 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file tuklib_integer.h +/// \brief Various integer and bit operations +/// +/// This file provides macros or functions to do some basic integer and bit +/// operations. +/// +/// Endianness related integer operations (XX = 16, 32, or 64; Y = b or l): +/// - Byte swapping: bswapXX(num) +/// - Byte order conversions to/from native: convXXYe(num) +/// - Aligned reads: readXXYe(ptr) +/// - Aligned writes: writeXXYe(ptr, num) +/// - Unaligned reads (16/32-bit only): unaligned_readXXYe(ptr) +/// - Unaligned writes (16/32-bit only): unaligned_writeXXYe(ptr, num) +/// +/// Since they can macros, the arguments should have no side effects since +/// they may be evaluated more than once. +/// +/// \todo PowerPC and possibly some other architectures support +/// byte swapping load and store instructions. This file +/// doesn't take advantage of those instructions. +/// +/// Bit scan operations for non-zero 32-bit integers: +/// - Bit scan reverse (find highest non-zero bit): bsr32(num) +/// - Count leading zeros: clz32(num) +/// - Count trailing zeros: ctz32(num) +/// - Bit scan forward (simply an alias for ctz32()): bsf32(num) +/// +/// The above bit scan operations return 0-31. If num is zero, +/// the result is undefined. +// +// Authors: Lasse Collin +// Joachim Henke +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef TUKLIB_INTEGER_H +#define TUKLIB_INTEGER_H + +#include "tuklib_common.h" + + +//////////////////////////////////////// +// Operating system specific features // +//////////////////////////////////////// + +#if defined(HAVE_BYTESWAP_H) + // glibc, uClibc, dietlibc +# include +# ifdef HAVE_BSWAP_16 +# define bswap16(num) bswap_16(num) +# endif +# ifdef HAVE_BSWAP_32 +# define bswap32(num) bswap_32(num) +# endif +# ifdef HAVE_BSWAP_64 +# define bswap64(num) bswap_64(num) +# endif + +#elif defined(HAVE_SYS_ENDIAN_H) + // *BSDs and Darwin +# include + +#elif defined(HAVE_SYS_BYTEORDER_H) + // Solaris +# include +# ifdef BSWAP_16 +# define bswap16(num) BSWAP_16(num) +# endif +# ifdef BSWAP_32 +# define bswap32(num) BSWAP_32(num) +# endif +# ifdef BSWAP_64 +# define bswap64(num) BSWAP_64(num) +# endif +# ifdef BE_16 +# define conv16be(num) BE_16(num) +# endif +# ifdef BE_32 +# define conv32be(num) BE_32(num) +# endif +# ifdef BE_64 +# define conv64be(num) BE_64(num) +# endif +# ifdef LE_16 +# define conv16le(num) LE_16(num) +# endif +# ifdef LE_32 +# define conv32le(num) LE_32(num) +# endif +# ifdef LE_64 +# define conv64le(num) LE_64(num) +# endif +#endif + + +/////////////////// +// Byte swapping // +/////////////////// + +#ifndef bswap16 +# define bswap16(num) \ + (((uint16_t)(num) << 8) | ((uint16_t)(num) >> 8)) +#endif + +#ifndef bswap32 +# define bswap32(num) \ + ( (((uint32_t)(num) << 24) ) \ + | (((uint32_t)(num) << 8) & UINT32_C(0x00FF0000)) \ + | (((uint32_t)(num) >> 8) & UINT32_C(0x0000FF00)) \ + | (((uint32_t)(num) >> 24) ) ) +#endif + +#ifndef bswap64 +# define bswap64(num) \ + ( (((uint64_t)(num) << 56) ) \ + | (((uint64_t)(num) << 40) & UINT64_C(0x00FF000000000000)) \ + | (((uint64_t)(num) << 24) & UINT64_C(0x0000FF0000000000)) \ + | (((uint64_t)(num) << 8) & UINT64_C(0x000000FF00000000)) \ + | (((uint64_t)(num) >> 8) & UINT64_C(0x00000000FF000000)) \ + | (((uint64_t)(num) >> 24) & UINT64_C(0x0000000000FF0000)) \ + | (((uint64_t)(num) >> 40) & UINT64_C(0x000000000000FF00)) \ + | (((uint64_t)(num) >> 56) ) ) +#endif + +// Define conversion macros using the basic byte swapping macros. +#ifdef WORDS_BIGENDIAN +# ifndef conv16be +# define conv16be(num) ((uint16_t)(num)) +# endif +# ifndef conv32be +# define conv32be(num) ((uint32_t)(num)) +# endif +# ifndef conv64be +# define conv64be(num) ((uint64_t)(num)) +# endif +# ifndef conv16le +# define conv16le(num) bswap16(num) +# endif +# ifndef conv32le +# define conv32le(num) bswap32(num) +# endif +# ifndef conv64le +# define conv64le(num) bswap64(num) +# endif +#else +# ifndef conv16be +# define conv16be(num) bswap16(num) +# endif +# ifndef conv32be +# define conv32be(num) bswap32(num) +# endif +# ifndef conv64be +# define conv64be(num) bswap64(num) +# endif +# ifndef conv16le +# define conv16le(num) ((uint16_t)(num)) +# endif +# ifndef conv32le +# define conv32le(num) ((uint32_t)(num)) +# endif +# ifndef conv64le +# define conv64le(num) ((uint64_t)(num)) +# endif +#endif + + +////////////////////////////// +// Aligned reads and writes // +////////////////////////////// + +static inline uint16_t +read16be(const uint8_t *buf) +{ + uint16_t num = *(const uint16_t *)buf; + return conv16be(num); +} + + +static inline uint16_t +read16le(const uint8_t *buf) +{ + uint16_t num = *(const uint16_t *)buf; + return conv16le(num); +} + + +static inline uint32_t +read32be(const uint8_t *buf) +{ + uint32_t num = *(const uint32_t *)buf; + return conv32be(num); +} + + +static inline uint32_t +read32le(const uint8_t *buf) +{ + uint32_t num = *(const uint32_t *)buf; + return conv32le(num); +} + + +static inline uint64_t +read64be(const uint8_t *buf) +{ + uint64_t num = *(const uint64_t *)buf; + return conv64be(num); +} + + +static inline uint64_t +read64le(const uint8_t *buf) +{ + uint64_t num = *(const uint64_t *)buf; + return conv64le(num); +} + + +// NOTE: Possible byte swapping must be done in a macro to allow GCC +// to optimize byte swapping of constants when using glibc's or *BSD's +// byte swapping macros. The actual write is done in an inline function +// to make type checking of the buf pointer possible similarly to readXXYe() +// functions. + +#define write16be(buf, num) write16ne((buf), conv16be(num)) +#define write16le(buf, num) write16ne((buf), conv16le(num)) +#define write32be(buf, num) write32ne((buf), conv32be(num)) +#define write32le(buf, num) write32ne((buf), conv32le(num)) +#define write64be(buf, num) write64ne((buf), conv64be(num)) +#define write64le(buf, num) write64ne((buf), conv64le(num)) + + +static inline void +write16ne(uint8_t *buf, uint16_t num) +{ + *(uint16_t *)buf = num; + return; +} + + +static inline void +write32ne(uint8_t *buf, uint32_t num) +{ + *(uint32_t *)buf = num; + return; +} + + +static inline void +write64ne(uint8_t *buf, uint64_t num) +{ + *(uint64_t *)buf = num; + return; +} + + +//////////////////////////////// +// Unaligned reads and writes // +//////////////////////////////// + +// NOTE: TUKLIB_FAST_UNALIGNED_ACCESS indicates only support for 16-bit and +// 32-bit unaligned integer loads and stores. It's possible that 64-bit +// unaligned access doesn't work or is slower than byte-by-byte access. +// Since unaligned 64-bit is probably not needed as often as 16-bit or +// 32-bit, we simply don't support 64-bit unaligned access for now. +#ifdef TUKLIB_FAST_UNALIGNED_ACCESS +# define unaligned_read16be read16be +# define unaligned_read16le read16le +# define unaligned_read32be read32be +# define unaligned_read32le read32le +# define unaligned_write16be write16be +# define unaligned_write16le write16le +# define unaligned_write32be write32be +# define unaligned_write32le write32le + +#else + +static inline uint16_t +unaligned_read16be(const uint8_t *buf) +{ + uint16_t num = ((uint16_t)buf[0] << 8) | (uint16_t)buf[1]; + return num; +} + + +static inline uint16_t +unaligned_read16le(const uint8_t *buf) +{ + uint16_t num = ((uint16_t)buf[0]) | ((uint16_t)buf[1] << 8); + return num; +} + + +static inline uint32_t +unaligned_read32be(const uint8_t *buf) +{ + uint32_t num = (uint32_t)buf[0] << 24; + num |= (uint32_t)buf[1] << 16; + num |= (uint32_t)buf[2] << 8; + num |= (uint32_t)buf[3]; + return num; +} + + +static inline uint32_t +unaligned_read32le(const uint8_t *buf) +{ + uint32_t num = (uint32_t)buf[0]; + num |= (uint32_t)buf[1] << 8; + num |= (uint32_t)buf[2] << 16; + num |= (uint32_t)buf[3] << 24; + return num; +} + + +static inline void +unaligned_write16be(uint8_t *buf, uint16_t num) +{ + buf[0] = num >> 8; + buf[1] = num; + return; +} + + +static inline void +unaligned_write16le(uint8_t *buf, uint16_t num) +{ + buf[0] = num; + buf[1] = num >> 8; + return; +} + + +static inline void +unaligned_write32be(uint8_t *buf, uint32_t num) +{ + buf[0] = num >> 24; + buf[1] = num >> 16; + buf[2] = num >> 8; + buf[3] = num; + return; +} + + +static inline void +unaligned_write32le(uint8_t *buf, uint32_t num) +{ + buf[0] = num; + buf[1] = num >> 8; + buf[2] = num >> 16; + buf[3] = num >> 24; + return; +} + +#endif + + +static inline uint32_t +bsr32(uint32_t n) +{ + // Check for ICC first, since it tends to define __GNUC__ too. +#if defined(__INTEL_COMPILER) + return _bit_scan_reverse(n); + +#elif TUKLIB_GNUC_REQ(3, 4) && UINT_MAX == UINT32_MAX + // GCC >= 3.4 has __builtin_clz(), which gives good results on + // multiple architectures. On x86, __builtin_clz() ^ 31U becomes + // either plain BSR (so the XOR gets optimized away) or LZCNT and + // XOR (if -march indicates that SSE4a instructions are supported). + return __builtin_clz(n) ^ 31U; + +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) + uint32_t i; + __asm__("bsrl %1, %0" : "=r" (i) : "rm" (n)); + return i; + +#elif defined(_MSC_VER) && _MSC_VER >= 1400 + // MSVC isn't supported by tuklib, but since this code exists, + // it doesn't hurt to have it here anyway. + uint32_t i; + _BitScanReverse((DWORD *)&i, n); + return i; + +#else + uint32_t i = 31; + + if ((n & UINT32_C(0xFFFF0000)) == 0) { + n <<= 16; + i = 15; + } + + if ((n & UINT32_C(0xFF000000)) == 0) { + n <<= 8; + i -= 8; + } + + if ((n & UINT32_C(0xF0000000)) == 0) { + n <<= 4; + i -= 4; + } + + if ((n & UINT32_C(0xC0000000)) == 0) { + n <<= 2; + i -= 2; + } + + if ((n & UINT32_C(0x80000000)) == 0) + --i; + + return i; +#endif +} + + +static inline uint32_t +clz32(uint32_t n) +{ +#if defined(__INTEL_COMPILER) + return _bit_scan_reverse(n) ^ 31U; + +#elif TUKLIB_GNUC_REQ(3, 4) && UINT_MAX == UINT32_MAX + return __builtin_clz(n); + +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) + uint32_t i; + __asm__("bsrl %1, %0\n\t" + "xorl $31, %0" + : "=r" (i) : "rm" (n)); + return i; + +#elif defined(_MSC_VER) && _MSC_VER >= 1400 + uint32_t i; + _BitScanReverse((DWORD *)&i, n); + return i ^ 31U; + +#else + uint32_t i = 0; + + if ((n & UINT32_C(0xFFFF0000)) == 0) { + n <<= 16; + i = 16; + } + + if ((n & UINT32_C(0xFF000000)) == 0) { + n <<= 8; + i += 8; + } + + if ((n & UINT32_C(0xF0000000)) == 0) { + n <<= 4; + i += 4; + } + + if ((n & UINT32_C(0xC0000000)) == 0) { + n <<= 2; + i += 2; + } + + if ((n & UINT32_C(0x80000000)) == 0) + ++i; + + return i; +#endif +} + + +static inline uint32_t +ctz32(uint32_t n) +{ +#if defined(__INTEL_COMPILER) + return _bit_scan_forward(n); + +#elif TUKLIB_GNUC_REQ(3, 4) && UINT_MAX >= UINT32_MAX + return __builtin_ctz(n); + +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) + uint32_t i; + __asm__("bsfl %1, %0" : "=r" (i) : "rm" (n)); + return i; + +#elif defined(_MSC_VER) && _MSC_VER >= 1400 + uint32_t i; + _BitScanForward((DWORD *)&i, n); + return i; + +#else + uint32_t i = 0; + + if ((n & UINT32_C(0x0000FFFF)) == 0) { + n >>= 16; + i = 16; + } + + if ((n & UINT32_C(0x000000FF)) == 0) { + n >>= 8; + i += 8; + } + + if ((n & UINT32_C(0x0000000F)) == 0) { + n >>= 4; + i += 4; + } + + if ((n & UINT32_C(0x00000003)) == 0) { + n >>= 2; + i += 2; + } + + if ((n & UINT32_C(0x00000001)) == 0) + ++i; + + return i; +#endif +} + +#define bsf32 ctz32 + +#endif diff --git a/liblzma/Makefile.am b/liblzma/Makefile.am new file mode 100644 index 0000000..0529ff8 --- /dev/null +++ b/liblzma/Makefile.am @@ -0,0 +1,90 @@ +## +## Author: Lasse Collin +## +## This file has been put into the public domain. +## You can do whatever you want with this file. +## + +SUBDIRS = api + +EXTRA_DIST = +CLEANFILES = +doc_DATA = + +lib_LTLIBRARIES = liblzma.la +liblzma_la_SOURCES = $(top_srcdir)/src/common/tuklib_physmem.c +liblzma_la_CPPFLAGS = \ + -I$(top_srcdir)/src/liblzma/api \ + -I$(top_srcdir)/src/liblzma/common \ + -I$(top_srcdir)/src/liblzma/check \ + -I$(top_srcdir)/src/liblzma/lz \ + -I$(top_srcdir)/src/liblzma/rangecoder \ + -I$(top_srcdir)/src/liblzma/lzma \ + -I$(top_srcdir)/src/liblzma/delta \ + -I$(top_srcdir)/src/liblzma/simple \ + -I$(top_srcdir)/src/common \ + -DTUKLIB_SYMBOL_PREFIX=lzma_ +liblzma_la_LDFLAGS = -no-undefined -version-info 5:5:0 + +include $(srcdir)/common/Makefile.inc +include $(srcdir)/check/Makefile.inc + +if COND_FILTER_LZ +include $(srcdir)/lz/Makefile.inc +endif + +if COND_FILTER_LZMA1 +include $(srcdir)/lzma/Makefile.inc +include $(srcdir)/rangecoder/Makefile.inc +endif + +if COND_FILTER_DELTA +include $(srcdir)/delta/Makefile.inc +endif + +if COND_FILTER_SIMPLE +include $(srcdir)/simple/Makefile.inc +endif + + +## Windows-specific stuff + +# Windows resource compiler support. libtool knows what to do with .rc +# files, but Automake (<= 1.11 at least) doesn't know. +# +# We want the resource file only in shared liblzma. To avoid linking it into +# static liblzma, we overwrite the static object file with an object file +# compiled from empty input. Note that GNU-specific features are OK here, +# because on Windows we are compiled with the GNU toolchain. +.rc.lo: + $(LIBTOOL) --mode=compile $(RC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(liblzma_la_CPPFLAGS) $(CPPFLAGS) $(RCFLAGS) \ + -i $< -o $@ + echo > empty.c + $(COMPILE) -c empty.c -o $(*D)/$(*F).o + +# Remove ordinals from the generated .def file. People must link by name, +# not by ordinal, because no one is going to track the ordinal numbers. +liblzma.def: liblzma.la liblzma.def.in + sed 's/ \+@ *[0-9]\+//' liblzma.def.in > liblzma.def + +# Creating liblzma.def.in is a side effect of linking the library. +liblzma.def.in: liblzma.la + +if COND_W32 +CLEANFILES += liblzma.def liblzma.def.in empty.c +liblzma_la_SOURCES += liblzma_w32res.rc +liblzma_la_LDFLAGS += -Xlinker --output-def -Xlinker liblzma.def.in + +## liblzma.def.in is created only when building shared liblzma, so don't +## try to create liblzma.def when not building shared liblzma. +if COND_SHARED +doc_DATA += liblzma.def +endif +endif + + +## pkg-config +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = liblzma.pc +EXTRA_DIST += liblzma.pc.in diff --git a/liblzma/api/Makefile.am b/liblzma/api/Makefile.am new file mode 100644 index 0000000..e016de5 --- /dev/null +++ b/liblzma/api/Makefile.am @@ -0,0 +1,23 @@ +## +## Author: Lasse Collin +## +## This file has been put into the public domain. +## You can do whatever you want with this file. +## + +nobase_include_HEADERS = \ + lzma.h \ + lzma/base.h \ + lzma/bcj.h \ + lzma/block.h \ + lzma/check.h \ + lzma/container.h \ + lzma/delta.h \ + lzma/filter.h \ + lzma/hardware.h \ + lzma/index.h \ + lzma/index_hash.h \ + lzma/lzma.h \ + lzma/stream_flags.h \ + lzma/version.h \ + lzma/vli.h diff --git a/liblzma/api/lzma.h b/liblzma/api/lzma.h new file mode 100644 index 0000000..fb874c3 --- /dev/null +++ b/liblzma/api/lzma.h @@ -0,0 +1,313 @@ +/** + * \file api/lzma.h + * \brief The public API of liblzma data compression library + * + * liblzma is a public domain general-purpose data compression library with + * a zlib-like API. The native file format is .xz, but also the old .lzma + * format and raw (no headers) streams are supported. Multiple compression + * algorithms (filters) are supported. Currently LZMA2 is the primary filter. + * + * liblzma is part of XZ Utils . XZ Utils includes + * a gzip-like command line tool named xz and some other tools. XZ Utils + * is developed and maintained by Lasse Collin. + * + * Major parts of liblzma are based on Igor Pavlov's public domain LZMA SDK + * . + * + * The SHA-256 implementation is based on the public domain code found from + * 7-Zip , which has a modified version of the public + * domain SHA-256 code found from Crypto++ . + * The SHA-256 code in Crypto++ was written by Kevin Springle and Wei Dai. + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + */ + +#ifndef LZMA_H +#define LZMA_H + +/***************************** + * Required standard headers * + *****************************/ + +/* + * liblzma API headers need some standard types and macros. To allow + * including lzma.h without requiring the application to include other + * headers first, lzma.h includes the required standard headers unless + * they already seem to be included already or if LZMA_MANUAL_HEADERS + * has been defined. + * + * Here's what types and macros are needed and from which headers: + * - stddef.h: size_t, NULL + * - stdint.h: uint8_t, uint32_t, uint64_t, UINT32_C(n), uint64_C(n), + * UINT32_MAX, UINT64_MAX + * + * However, inttypes.h is a little more portable than stdint.h, although + * inttypes.h declares some unneeded things compared to plain stdint.h. + * + * The hacks below aren't perfect, specifically they assume that inttypes.h + * exists and that it typedefs at least uint8_t, uint32_t, and uint64_t, + * and that, in case of incomplete inttypes.h, unsigned int is 32-bit. + * If the application already takes care of setting up all the types and + * macros properly (for example by using gnulib's stdint.h or inttypes.h), + * we try to detect that the macros are already defined and don't include + * inttypes.h here again. However, you may define LZMA_MANUAL_HEADERS to + * force this file to never include any system headers. + * + * Some could argue that liblzma API should provide all the required types, + * for example lzma_uint64, LZMA_UINT64_C(n), and LZMA_UINT64_MAX. This was + * seen as an unnecessary mess, since most systems already provide all the + * necessary types and macros in the standard headers. + * + * Note that liblzma API still has lzma_bool, because using stdbool.h would + * break C89 and C++ programs on many systems. sizeof(bool) in C99 isn't + * necessarily the same as sizeof(bool) in C++. + */ + +#ifndef LZMA_MANUAL_HEADERS + /* + * I suppose this works portably also in C++. Note that in C++, + * we need to get size_t into the global namespace. + */ +# include + + /* + * Skip inttypes.h if we already have all the required macros. If we + * have the macros, we assume that we have the matching typedefs too. + */ +# if !defined(UINT32_C) || !defined(UINT64_C) \ + || !defined(UINT32_MAX) || !defined(UINT64_MAX) + /* + * MSVC has no C99 support, and thus it cannot be used to + * compile liblzma. The liblzma API has to still be usable + * from MSVC, so we need to define the required standard + * integer types here. + */ +# if defined(_WIN32) && defined(_MSC_VER) + typedef unsigned __int8 uint8_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int64 uint64_t; +# else + /* Use the standard inttypes.h. */ +# ifdef __cplusplus + /* + * C99 sections 7.18.2 and 7.18.4 specify + * that C++ implementations define the limit + * and constant macros only if specifically + * requested. Note that if you want the + * format macros (PRIu64 etc.) too, you need + * to define __STDC_FORMAT_MACROS before + * including lzma.h, since re-including + * inttypes.h with __STDC_FORMAT_MACROS + * defined doesn't necessarily work. + */ +# ifndef __STDC_LIMIT_MACROS +# define __STDC_LIMIT_MACROS 1 +# endif +# ifndef __STDC_CONSTANT_MACROS +# define __STDC_CONSTANT_MACROS 1 +# endif +# endif + +# include +# endif + + /* + * Some old systems have only the typedefs in inttypes.h, and + * lack all the macros. For those systems, we need a few more + * hacks. We assume that unsigned int is 32-bit and unsigned + * long is either 32-bit or 64-bit. If these hacks aren't + * enough, the application has to setup the types manually + * before including lzma.h. + */ +# ifndef UINT32_C +# if defined(_WIN32) && defined(_MSC_VER) +# define UINT32_C(n) n ## UI32 +# else +# define UINT32_C(n) n ## U +# endif +# endif + +# ifndef UINT64_C +# if defined(_WIN32) && defined(_MSC_VER) +# define UINT64_C(n) n ## UI64 +# else + /* Get ULONG_MAX. */ +# include +# if ULONG_MAX == 4294967295UL +# define UINT64_C(n) n ## ULL +# else +# define UINT64_C(n) n ## UL +# endif +# endif +# endif + +# ifndef UINT32_MAX +# define UINT32_MAX (UINT32_C(4294967295)) +# endif + +# ifndef UINT64_MAX +# define UINT64_MAX (UINT64_C(18446744073709551615)) +# endif +# endif +#endif /* ifdef LZMA_MANUAL_HEADERS */ + + +/****************** + * LZMA_API macro * + ******************/ + +/* + * Some systems require that the functions and function pointers are + * declared specially in the headers. LZMA_API_IMPORT is for importing + * symbols and LZMA_API_CALL is to specify the calling convention. + * + * By default it is assumed that the application will link dynamically + * against liblzma. #define LZMA_API_STATIC in your application if you + * want to link against static liblzma. If you don't care about portability + * to operating systems like Windows, or at least don't care about linking + * against static liblzma on them, don't worry about LZMA_API_STATIC. That + * is, most developers will never need to use LZMA_API_STATIC. + * + * The GCC variants are a special case on Windows (Cygwin and MinGW). + * We rely on GCC doing the right thing with its auto-import feature, + * and thus don't use __declspec(dllimport). This way developers don't + * need to worry about LZMA_API_STATIC. Also the calling convention is + * omitted on Cygwin but not on MinGW. + */ +#ifndef LZMA_API_IMPORT +# if !defined(LZMA_API_STATIC) && defined(_WIN32) && !defined(__GNUC__) +# define LZMA_API_IMPORT __declspec(dllimport) +# else +# define LZMA_API_IMPORT +# endif +#endif + +#ifndef LZMA_API_CALL +# if defined(_WIN32) && !defined(__CYGWIN__) +# define LZMA_API_CALL __cdecl +# else +# define LZMA_API_CALL +# endif +#endif + +#ifndef LZMA_API +# define LZMA_API(type) LZMA_API_IMPORT type LZMA_API_CALL +#endif + + +/*********** + * nothrow * + ***********/ + +/* + * None of the functions in liblzma may throw an exception. Even + * the functions that use callback functions won't throw exceptions, + * because liblzma would break if a callback function threw an exception. + */ +#ifndef lzma_nothrow +# if defined(__cplusplus) +# define lzma_nothrow throw() +# elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) +# define lzma_nothrow __attribute__((__nothrow__)) +# else +# define lzma_nothrow +# endif +#endif + + +/******************** + * GNU C extensions * + ********************/ + +/* + * GNU C extensions are used conditionally in the public API. It doesn't + * break anything if these are sometimes enabled and sometimes not, only + * affects warnings and optimizations. + */ +#if __GNUC__ >= 3 +# ifndef lzma_attribute +# define lzma_attribute(attr) __attribute__(attr) +# endif + + /* warn_unused_result was added in GCC 3.4. */ +# ifndef lzma_attr_warn_unused_result +# if __GNUC__ == 3 && __GNUC_MINOR__ < 4 +# define lzma_attr_warn_unused_result +# endif +# endif + +#else +# ifndef lzma_attribute +# define lzma_attribute(attr) +# endif +#endif + + +#ifndef lzma_attr_pure +# define lzma_attr_pure lzma_attribute((__pure__)) +#endif + +#ifndef lzma_attr_const +# define lzma_attr_const lzma_attribute((__const__)) +#endif + +#ifndef lzma_attr_warn_unused_result +# define lzma_attr_warn_unused_result \ + lzma_attribute((__warn_unused_result__)) +#endif + + +/************** + * Subheaders * + **************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Subheaders check that this is defined. It is to prevent including + * them directly from applications. + */ +#define LZMA_H_INTERNAL 1 + +/* Basic features */ +#include "lzma/version.h" +#include "lzma/base.h" +#include "lzma/vli.h" +#include "lzma/check.h" + +/* Filters */ +#include "lzma/filter.h" +#include "lzma/bcj.h" +#include "lzma/delta.h" +#include "lzma/lzma.h" + +/* Container formats */ +#include "lzma/container.h" + +/* Advanced features */ +#include "lzma/stream_flags.h" +#include "lzma/block.h" +#include "lzma/index.h" +#include "lzma/index_hash.h" + +/* Hardware information */ +#include "lzma/hardware.h" + +/* + * All subheaders included. Undefine LZMA_H_INTERNAL to prevent applications + * re-including the subheaders. + */ +#undef LZMA_H_INTERNAL + +#ifdef __cplusplus +} +#endif + +#endif /* ifndef LZMA_H */ diff --git a/liblzma/api/lzma/base.h b/liblzma/api/lzma/base.h new file mode 100644 index 0000000..43dde8d --- /dev/null +++ b/liblzma/api/lzma/base.h @@ -0,0 +1,601 @@ +/** + * \file lzma/base.h + * \brief Data types and functions used in many places in liblzma API + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +# error Never include this file directly. Use instead. +#endif + + +/** + * \brief Boolean + * + * This is here because C89 doesn't have stdbool.h. To set a value for + * variables having type lzma_bool, you can use + * - C99's `true' and `false' from stdbool.h; + * - C++'s internal `true' and `false'; or + * - integers one (true) and zero (false). + */ +typedef unsigned char lzma_bool; + + +/** + * \brief Type of reserved enumeration variable in structures + * + * To avoid breaking library ABI when new features are added, several + * structures contain extra variables that may be used in future. Since + * sizeof(enum) can be different than sizeof(int), and sizeof(enum) may + * even vary depending on the range of enumeration constants, we specify + * a separate type to be used for reserved enumeration variables. All + * enumeration constants in liblzma API will be non-negative and less + * than 128, which should guarantee that the ABI won't break even when + * new constants are added to existing enumerations. + */ +typedef enum { + LZMA_RESERVED_ENUM = 0 +} lzma_reserved_enum; + + +/** + * \brief Return values used by several functions in liblzma + * + * Check the descriptions of specific functions to find out which return + * values they can return. With some functions the return values may have + * more specific meanings than described here; those differences are + * described per-function basis. + */ +typedef enum { + LZMA_OK = 0, + /**< + * \brief Operation completed successfully + */ + + LZMA_STREAM_END = 1, + /**< + * \brief End of stream was reached + * + * In encoder, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, or + * LZMA_FINISH was finished. In decoder, this indicates + * that all the data was successfully decoded. + * + * In all cases, when LZMA_STREAM_END is returned, the last + * output bytes should be picked from strm->next_out. + */ + + LZMA_NO_CHECK = 2, + /**< + * \brief Input stream has no integrity check + * + * This return value can be returned only if the + * LZMA_TELL_NO_CHECK flag was used when initializing + * the decoder. LZMA_NO_CHECK is just a warning, and + * the decoding can be continued normally. + * + * It is possible to call lzma_get_check() immediately after + * lzma_code has returned LZMA_NO_CHECK. The result will + * naturally be LZMA_CHECK_NONE, but the possibility to call + * lzma_get_check() may be convenient in some applications. + */ + + LZMA_UNSUPPORTED_CHECK = 3, + /**< + * \brief Cannot calculate the integrity check + * + * The usage of this return value is different in encoders + * and decoders. + * + * Encoders can return this value only from the initialization + * function. If initialization fails with this value, the + * encoding cannot be done, because there's no way to produce + * output with the correct integrity check. + * + * Decoders can return this value only from lzma_code() and + * only if the LZMA_TELL_UNSUPPORTED_CHECK flag was used when + * initializing the decoder. The decoding can still be + * continued normally even if the check type is unsupported, + * but naturally the check will not be validated, and possible + * errors may go undetected. + * + * With decoder, it is possible to call lzma_get_check() + * immediately after lzma_code() has returned + * LZMA_UNSUPPORTED_CHECK. This way it is possible to find + * out what the unsupported Check ID was. + */ + + LZMA_GET_CHECK = 4, + /**< + * \brief Integrity check type is now available + * + * This value can be returned only by the lzma_code() function + * and only if the decoder was initialized with the + * LZMA_TELL_ANY_CHECK flag. LZMA_GET_CHECK tells the + * application that it may now call lzma_get_check() to find + * out the Check ID. This can be used, for example, to + * implement a decoder that accepts only files that have + * strong enough integrity check. + */ + + LZMA_MEM_ERROR = 5, + /**< + * \brief Cannot allocate memory + * + * Memory allocation failed, or the size of the allocation + * would be greater than SIZE_MAX. + * + * Due to internal implementation reasons, the coding cannot + * be continued even if more memory were made available after + * LZMA_MEM_ERROR. + */ + + LZMA_MEMLIMIT_ERROR = 6, + /** + * \brief Memory usage limit was reached + * + * Decoder would need more memory than allowed by the + * specified memory usage limit. To continue decoding, + * the memory usage limit has to be increased with + * lzma_memlimit_set(). + */ + + LZMA_FORMAT_ERROR = 7, + /**< + * \brief File format not recognized + * + * The decoder did not recognize the input as supported file + * format. This error can occur, for example, when trying to + * decode .lzma format file with lzma_stream_decoder, + * because lzma_stream_decoder accepts only the .xz format. + */ + + LZMA_OPTIONS_ERROR = 8, + /**< + * \brief Invalid or unsupported options + * + * Invalid or unsupported options, for example + * - unsupported filter(s) or filter options; or + * - reserved bits set in headers (decoder only). + * + * Rebuilding liblzma with more features enabled, or + * upgrading to a newer version of liblzma may help. + */ + + LZMA_DATA_ERROR = 9, + /**< + * \brief Data is corrupt + * + * The usage of this return value is different in encoders + * and decoders. In both encoder and decoder, the coding + * cannot continue after this error. + * + * Encoders return this if size limits of the target file + * format would be exceeded. These limits are huge, thus + * getting this error from an encoder is mostly theoretical. + * For example, the maximum compressed and uncompressed + * size of a .xz Stream is roughly 8 EiB (2^63 bytes). + * + * Decoders return this error if the input data is corrupt. + * This can mean, for example, invalid CRC32 in headers + * or invalid check of uncompressed data. + */ + + LZMA_BUF_ERROR = 10, + /**< + * \brief No progress is possible + * + * This error code is returned when the coder cannot consume + * any new input and produce any new output. The most common + * reason for this error is that the input stream being + * decoded is truncated or corrupt. + * + * This error is not fatal. Coding can be continued normally + * by providing more input and/or more output space, if + * possible. + * + * Typically the first call to lzma_code() that can do no + * progress returns LZMA_OK instead of LZMA_BUF_ERROR. Only + * the second consecutive call doing no progress will return + * LZMA_BUF_ERROR. This is intentional. + * + * With zlib, Z_BUF_ERROR may be returned even if the + * application is doing nothing wrong, so apps will need + * to handle Z_BUF_ERROR specially. The above hack + * guarantees that liblzma never returns LZMA_BUF_ERROR + * to properly written applications unless the input file + * is truncated or corrupt. This should simplify the + * applications a little. + */ + + LZMA_PROG_ERROR = 11, + /**< + * \brief Programming error + * + * This indicates that the arguments given to the function are + * invalid or the internal state of the decoder is corrupt. + * - Function arguments are invalid or the structures + * pointed by the argument pointers are invalid + * e.g. if strm->next_out has been set to NULL and + * strm->avail_out > 0 when calling lzma_code(). + * - lzma_* functions have been called in wrong order + * e.g. lzma_code() was called right after lzma_end(). + * - If errors occur randomly, the reason might be flaky + * hardware. + * + * If you think that your code is correct, this error code + * can be a sign of a bug in liblzma. See the documentation + * how to report bugs. + */ +} lzma_ret; + + +/** + * \brief The `action' argument for lzma_code() + * + * After the first use of LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, or LZMA_FINISH, + * the same `action' must is used until lzma_code() returns LZMA_STREAM_END. + * Also, the amount of input (that is, strm->avail_in) must not be modified + * by the application until lzma_code() returns LZMA_STREAM_END. Changing the + * `action' or modifying the amount of input will make lzma_code() return + * LZMA_PROG_ERROR. + */ +typedef enum { + LZMA_RUN = 0, + /**< + * \brief Continue coding + * + * Encoder: Encode as much input as possible. Some internal + * buffering will probably be done (depends on the filter + * chain in use), which causes latency: the input used won't + * usually be decodeable from the output of the same + * lzma_code() call. + * + * Decoder: Decode as much input as possible and produce as + * much output as possible. + */ + + LZMA_SYNC_FLUSH = 1, + /**< + * \brief Make all the input available at output + * + * Normally the encoder introduces some latency. + * LZMA_SYNC_FLUSH forces all the buffered data to be + * available at output without resetting the internal + * state of the encoder. This way it is possible to use + * compressed stream for example for communication over + * network. + * + * Only some filters support LZMA_SYNC_FLUSH. Trying to use + * LZMA_SYNC_FLUSH with filters that don't support it will + * make lzma_code() return LZMA_OPTIONS_ERROR. For example, + * LZMA1 doesn't support LZMA_SYNC_FLUSH but LZMA2 does. + * + * Using LZMA_SYNC_FLUSH very often can dramatically reduce + * the compression ratio. With some filters (for example, + * LZMA2), fine-tuning the compression options may help + * mitigate this problem significantly (for example, + * match finder with LZMA2). + * + * Decoders don't support LZMA_SYNC_FLUSH. + */ + + LZMA_FULL_FLUSH = 2, + /**< + * \brief Finish encoding of the current Block + * + * All the input data going to the current Block must have + * been given to the encoder (the last bytes can still be + * pending in* next_in). Call lzma_code() with LZMA_FULL_FLUSH + * until it returns LZMA_STREAM_END. Then continue normally + * with LZMA_RUN or finish the Stream with LZMA_FINISH. + * + * This action is currently supported only by Stream encoder + * and easy encoder (which uses Stream encoder). If there is + * no unfinished Block, no empty Block is created. + */ + + LZMA_FINISH = 3 + /**< + * \brief Finish the coding operation + * + * All the input data must have been given to the encoder + * (the last bytes can still be pending in next_in). + * Call lzma_code() with LZMA_FINISH until it returns + * LZMA_STREAM_END. Once LZMA_FINISH has been used, + * the amount of input must no longer be changed by + * the application. + * + * When decoding, using LZMA_FINISH is optional unless the + * LZMA_CONCATENATED flag was used when the decoder was + * initialized. When LZMA_CONCATENATED was not used, the only + * effect of LZMA_FINISH is that the amount of input must not + * be changed just like in the encoder. + */ +} lzma_action; + + +/** + * \brief Custom functions for memory handling + * + * A pointer to lzma_allocator may be passed via lzma_stream structure + * to liblzma, and some advanced functions take a pointer to lzma_allocator + * as a separate function argument. The library will use the functions + * specified in lzma_allocator for memory handling instead of the default + * malloc() and free(). C++ users should note that the custom memory + * handling functions must not throw exceptions. + * + * liblzma doesn't make an internal copy of lzma_allocator. Thus, it is + * OK to change these function pointers in the middle of the coding + * process, but obviously it must be done carefully to make sure that the + * replacement `free' can deallocate memory allocated by the earlier + * `alloc' function(s). + */ +typedef struct { + /** + * \brief Pointer to a custom memory allocation function + * + * If you don't want a custom allocator, but still want + * custom free(), set this to NULL and liblzma will use + * the standard malloc(). + * + * \param opaque lzma_allocator.opaque (see below) + * \param nmemb Number of elements like in calloc(). liblzma + * will always set nmemb to 1, so it is safe to + * ignore nmemb in a custom allocator if you like. + * The nmemb argument exists only for + * compatibility with zlib and libbzip2. + * \param size Size of an element in bytes. + * liblzma never sets this to zero. + * + * \return Pointer to the beginning of a memory block of + * `size' bytes, or NULL if allocation fails + * for some reason. When allocation fails, functions + * of liblzma return LZMA_MEM_ERROR. + * + * The allocator should not waste time zeroing the allocated buffers. + * This is not only about speed, but also memory usage, since the + * operating system kernel doesn't necessarily allocate the requested + * memory in physical memory until it is actually used. With small + * input files, liblzma may actually need only a fraction of the + * memory that it requested for allocation. + * + * \note LZMA_MEM_ERROR is also used when the size of the + * allocation would be greater than SIZE_MAX. Thus, + * don't assume that the custom allocator must have + * returned NULL if some function from liblzma + * returns LZMA_MEM_ERROR. + */ + void *(LZMA_API_CALL *alloc)(void *opaque, size_t nmemb, size_t size); + + /** + * \brief Pointer to a custom memory freeing function + * + * If you don't want a custom freeing function, but still + * want a custom allocator, set this to NULL and liblzma + * will use the standard free(). + * + * \param opaque lzma_allocator.opaque (see below) + * \param ptr Pointer returned by lzma_allocator.alloc(), + * or when it is set to NULL, a pointer returned + * by the standard malloc(). + */ + void (LZMA_API_CALL *free)(void *opaque, void *ptr); + + /** + * \brief Pointer passed to .alloc() and .free() + * + * opaque is passed as the first argument to lzma_allocator.alloc() + * and lzma_allocator.free(). This intended to ease implementing + * custom memory allocation functions for use with liblzma. + * + * If you don't need this, you should set this to NULL. + */ + void *opaque; + +} lzma_allocator; + + +/** + * \brief Internal data structure + * + * The contents of this structure is not visible outside the library. + */ +typedef struct lzma_internal_s lzma_internal; + + +/** + * \brief Passing data to and from liblzma + * + * The lzma_stream structure is used for + * - passing pointers to input and output buffers to liblzma; + * - defining custom memory hander functions; and + * - holding a pointer to coder-specific internal data structures. + * + * Typical usage: + * + * - After allocating lzma_stream (on stack or with malloc()), it must be + * initialized to LZMA_STREAM_INIT (see LZMA_STREAM_INIT for details). + * + * - Initialize a coder to the lzma_stream, for example by using + * lzma_easy_encoder() or lzma_auto_decoder(). Some notes: + * - In contrast to zlib, strm->next_in and strm->next_out are + * ignored by all initialization functions, thus it is safe + * to not initialize them yet. + * - The initialization functions always set strm->total_in and + * strm->total_out to zero. + * - If the initialization function fails, no memory is left allocated + * that would require freeing with lzma_end() even if some memory was + * associated with the lzma_stream structure when the initialization + * function was called. + * + * - Use lzma_code() to do the actual work. + * + * - Once the coding has been finished, the existing lzma_stream can be + * reused. It is OK to reuse lzma_stream with different initialization + * function without calling lzma_end() first. Old allocations are + * automatically freed. + * + * - Finally, use lzma_end() to free the allocated memory. lzma_end() never + * frees the lzma_stream structure itself. + * + * Application may modify the values of total_in and total_out as it wants. + * They are updated by liblzma to match the amount of data read and + * written, but aren't used for anything else. + */ +typedef struct { + const uint8_t *next_in; /**< Pointer to the next input byte. */ + size_t avail_in; /**< Number of available input bytes in next_in. */ + uint64_t total_in; /**< Total number of bytes read by liblzma. */ + + uint8_t *next_out; /**< Pointer to the next output position. */ + size_t avail_out; /**< Amount of free space in next_out. */ + uint64_t total_out; /**< Total number of bytes written by liblzma. */ + + /** + * \brief Custom memory allocation functions + * + * In most cases this is NULL which makes liblzma use + * the standard malloc() and free(). + */ + lzma_allocator *allocator; + + /** Internal state is not visible to applications. */ + lzma_internal *internal; + + /* + * Reserved space to allow possible future extensions without + * breaking the ABI. Excluding the initialization of this structure, + * you should not touch these, because the names of these variables + * may change. + */ + void *reserved_ptr1; + void *reserved_ptr2; + void *reserved_ptr3; + void *reserved_ptr4; + uint64_t reserved_int1; + uint64_t reserved_int2; + size_t reserved_int3; + size_t reserved_int4; + lzma_reserved_enum reserved_enum1; + lzma_reserved_enum reserved_enum2; + +} lzma_stream; + + +/** + * \brief Initialization for lzma_stream + * + * When you declare an instance of lzma_stream, you can immediately + * initialize it so that initialization functions know that no memory + * has been allocated yet: + * + * lzma_stream strm = LZMA_STREAM_INIT; + * + * If you need to initialize a dynamically allocated lzma_stream, you can use + * memset(strm_pointer, 0, sizeof(lzma_stream)). Strictly speaking, this + * violates the C standard since NULL may have different internal + * representation than zero, but it should be portable enough in practice. + * Anyway, for maximum portability, you can use something like this: + * + * lzma_stream tmp = LZMA_STREAM_INIT; + * *strm = tmp; + */ +#define LZMA_STREAM_INIT \ + { NULL, 0, 0, NULL, 0, 0, NULL, NULL, \ + NULL, NULL, NULL, NULL, 0, 0, 0, 0, \ + LZMA_RESERVED_ENUM, LZMA_RESERVED_ENUM } + + +/** + * \brief Encode or decode data + * + * Once the lzma_stream has been successfully initialized (e.g. with + * lzma_stream_encoder()), the actual encoding or decoding is done + * using this function. The application has to update strm->next_in, + * strm->avail_in, strm->next_out, and strm->avail_out to pass input + * to and get output from liblzma. + * + * See the description of the coder-specific initialization function to find + * out what `action' values are supported by the coder. + */ +extern LZMA_API(lzma_ret) lzma_code(lzma_stream *strm, lzma_action action) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Free memory allocated for the coder data structures + * + * \param strm Pointer to lzma_stream that is at least initialized + * with LZMA_STREAM_INIT. + * + * After lzma_end(strm), strm->internal is guaranteed to be NULL. No other + * members of the lzma_stream structure are touched. + * + * \note zlib indicates an error if application end()s unfinished + * stream structure. liblzma doesn't do this, and assumes that + * application knows what it is doing. + */ +extern LZMA_API(void) lzma_end(lzma_stream *strm) lzma_nothrow; + + +/** + * \brief Get the memory usage of decoder filter chain + * + * This function is currently supported only when *strm has been initialized + * with a function that takes a memlimit argument. With other functions, you + * should use e.g. lzma_raw_encoder_memusage() or lzma_raw_decoder_memusage() + * to estimate the memory requirements. + * + * This function is useful e.g. after LZMA_MEMLIMIT_ERROR to find out how big + * the memory usage limit should have been to decode the input. Note that + * this may give misleading information if decoding .xz Streams that have + * multiple Blocks, because each Block can have different memory requirements. + * + * \return How much memory is currently allocated for the filter + * decoders. If no filter chain is currently allocated, + * some non-zero value is still returned, which is less than + * or equal to what any filter chain would indicate as its + * memory requirement. + * + * If this function isn't supported by *strm or some other error + * occurs, zero is returned. + */ +extern LZMA_API(uint64_t) lzma_memusage(const lzma_stream *strm) + lzma_nothrow lzma_attr_pure; + + +/** + * \brief Get the current memory usage limit + * + * This function is supported only when *strm has been initialized with + * a function that takes a memlimit argument. + * + * \return On success, the current memory usage limit is returned + * (always non-zero). On error, zero is returned. + */ +extern LZMA_API(uint64_t) lzma_memlimit_get(const lzma_stream *strm) + lzma_nothrow lzma_attr_pure; + + +/** + * \brief Set the memory usage limit + * + * This function is supported only when *strm has been initialized with + * a function that takes a memlimit argument. + * + * \return - LZMA_OK: New memory usage limit successfully set. + * - LZMA_MEMLIMIT_ERROR: The new limit is too small. + * The limit was not changed. + * - LZMA_PROG_ERROR: Invalid arguments, e.g. *strm doesn't + * support memory usage limit or memlimit was zero. + */ +extern LZMA_API(lzma_ret) lzma_memlimit_set( + lzma_stream *strm, uint64_t memlimit) lzma_nothrow; diff --git a/liblzma/api/lzma/bcj.h b/liblzma/api/lzma/bcj.h new file mode 100644 index 0000000..8e37538 --- /dev/null +++ b/liblzma/api/lzma/bcj.h @@ -0,0 +1,90 @@ +/** + * \file lzma/bcj.h + * \brief Branch/Call/Jump conversion filters + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +# error Never include this file directly. Use instead. +#endif + + +/* Filter IDs for lzma_filter.id */ + +#define LZMA_FILTER_X86 LZMA_VLI_C(0x04) + /**< + * Filter for x86 binaries + */ + +#define LZMA_FILTER_POWERPC LZMA_VLI_C(0x05) + /**< + * Filter for Big endian PowerPC binaries + */ + +#define LZMA_FILTER_IA64 LZMA_VLI_C(0x06) + /**< + * Filter for IA-64 (Itanium) binaries. + */ + +#define LZMA_FILTER_ARM LZMA_VLI_C(0x07) + /**< + * Filter for ARM binaries. + */ + +#define LZMA_FILTER_ARMTHUMB LZMA_VLI_C(0x08) + /**< + * Filter for ARM-Thumb binaries. + */ + +#define LZMA_FILTER_SPARC LZMA_VLI_C(0x09) + /**< + * Filter for SPARC binaries. + */ + + +/** + * \brief Options for BCJ filters + * + * The BCJ filters never change the size of the data. Specifying options + * for them is optional: if pointer to options is NULL, default value is + * used. You probably never need to specify options to BCJ filters, so just + * set the options pointer to NULL and be happy. + * + * If options with non-default values have been specified when encoding, + * the same options must also be specified when decoding. + * + * \note At the moment, none of the BCJ filters support + * LZMA_SYNC_FLUSH. If LZMA_SYNC_FLUSH is specified, + * LZMA_OPTIONS_ERROR will be returned. If there is need, + * partial support for LZMA_SYNC_FLUSH can be added in future. + * Partial means that flushing would be possible only at + * offsets that are multiple of 2, 4, or 16 depending on + * the filter, except x86 which cannot be made to support + * LZMA_SYNC_FLUSH predictably. + */ +typedef struct { + /** + * \brief Start offset for conversions + * + * This setting is useful only when the same filter is used + * _separately_ for multiple sections of the same executable file, + * and the sections contain cross-section branch/call/jump + * instructions. In that case it is beneficial to set the start + * offset of the non-first sections so that the relative addresses + * of the cross-section branch/call/jump instructions will use the + * same absolute addresses as in the first section. + * + * When the pointer to options is NULL, the default value (zero) + * is used. + */ + uint32_t start_offset; + +} lzma_options_bcj; diff --git a/liblzma/api/lzma/block.h b/liblzma/api/lzma/block.h new file mode 100644 index 0000000..8a4bf23 --- /dev/null +++ b/liblzma/api/lzma/block.h @@ -0,0 +1,530 @@ +/** + * \file lzma/block.h + * \brief .xz Block handling + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +# error Never include this file directly. Use instead. +#endif + + +/** + * \brief Options for the Block and Block Header encoders and decoders + * + * Different Block handling functions use different parts of this structure. + * Some read some members, other functions write, and some do both. Only the + * members listed for reading need to be initialized when the specified + * functions are called. The members marked for writing will be assigned + * new values at some point either by calling the given function or by + * later calls to lzma_code(). + */ +typedef struct { + /** + * \brief Block format version + * + * To prevent API and ABI breakages if new features are needed in + * the Block field, a version number is used to indicate which + * fields in this structure are in use. For now, version must always + * be zero. With non-zero version, most Block related functions will + * return LZMA_OPTIONS_ERROR. + * + * Read by: + * - All functions that take pointer to lzma_block as argument, + * including lzma_block_header_decode(). + * + * Written by: + * - lzma_block_header_decode() + */ + uint32_t version; + + /** + * \brief Size of the Block Header field + * + * This is always a multiple of four. + * + * Read by: + * - lzma_block_header_encode() + * - lzma_block_header_decode() + * - lzma_block_compressed_size() + * - lzma_block_unpadded_size() + * - lzma_block_total_size() + * - lzma_block_decoder() + * - lzma_block_buffer_decode() + * + * Written by: + * - lzma_block_header_size() + * - lzma_block_buffer_encode() + */ + uint32_t header_size; +# define LZMA_BLOCK_HEADER_SIZE_MIN 8 +# define LZMA_BLOCK_HEADER_SIZE_MAX 1024 + + /** + * \brief Type of integrity Check + * + * The Check ID is not stored into the Block Header, thus its value + * must be provided also when decoding. + * + * Read by: + * - lzma_block_header_encode() + * - lzma_block_header_decode() + * - lzma_block_compressed_size() + * - lzma_block_unpadded_size() + * - lzma_block_total_size() + * - lzma_block_encoder() + * - lzma_block_decoder() + * - lzma_block_buffer_encode() + * - lzma_block_buffer_decode() + */ + lzma_check check; + + /** + * \brief Size of the Compressed Data in bytes + * + * Encoding: If this is not LZMA_VLI_UNKNOWN, Block Header encoder + * will store this value to the Block Header. Block encoder doesn't + * care about this value, but will set it once the encoding has been + * finished. + * + * Decoding: If this is not LZMA_VLI_UNKNOWN, Block decoder will + * verify that the size of the Compressed Data field matches + * compressed_size. + * + * Usually you don't know this value when encoding in streamed mode, + * and thus cannot write this field into the Block Header. + * + * In non-streamed mode you can reserve space for this field before + * encoding the actual Block. After encoding the data, finish the + * Block by encoding the Block Header. Steps in detail: + * + * - Set compressed_size to some big enough value. If you don't know + * better, use LZMA_VLI_MAX, but remember that bigger values take + * more space in Block Header. + * + * - Call lzma_block_header_size() to see how much space you need to + * reserve for the Block Header. + * + * - Encode the Block using lzma_block_encoder() and lzma_code(). + * It sets compressed_size to the correct value. + * + * - Use lzma_block_header_encode() to encode the Block Header. + * Because space was reserved in the first step, you don't need + * to call lzma_block_header_size() anymore, because due to + * reserving, header_size has to be big enough. If it is "too big", + * lzma_block_header_encode() will add enough Header Padding to + * make Block Header to match the size specified by header_size. + * + * Read by: + * - lzma_block_header_size() + * - lzma_block_header_encode() + * - lzma_block_compressed_size() + * - lzma_block_unpadded_size() + * - lzma_block_total_size() + * - lzma_block_decoder() + * - lzma_block_buffer_decode() + * + * Written by: + * - lzma_block_header_decode() + * - lzma_block_compressed_size() + * - lzma_block_encoder() + * - lzma_block_decoder() + * - lzma_block_buffer_encode() + * - lzma_block_buffer_decode() + */ + lzma_vli compressed_size; + + /** + * \brief Uncompressed Size in bytes + * + * This is handled very similarly to compressed_size above. + * + * uncompressed_size is needed by fewer functions than + * compressed_size. This is because uncompressed_size isn't + * needed to validate that Block stays within proper limits. + * + * Read by: + * - lzma_block_header_size() + * - lzma_block_header_encode() + * - lzma_block_decoder() + * - lzma_block_buffer_decode() + * + * Written by: + * - lzma_block_header_decode() + * - lzma_block_encoder() + * - lzma_block_decoder() + * - lzma_block_buffer_encode() + * - lzma_block_buffer_decode() + */ + lzma_vli uncompressed_size; + + /** + * \brief Array of filters + * + * There can be 1-4 filters. The end of the array is marked with + * .id = LZMA_VLI_UNKNOWN. + * + * Read by: + * - lzma_block_header_size() + * - lzma_block_header_encode() + * - lzma_block_encoder() + * - lzma_block_decoder() + * - lzma_block_buffer_encode() + * - lzma_block_buffer_decode() + * + * Written by: + * - lzma_block_header_decode(): Note that this does NOT free() + * the old filter options structures. All unused filters[] will + * have .id == LZMA_VLI_UNKNOWN and .options == NULL. If + * decoding fails, all filters[] are guaranteed to be + * LZMA_VLI_UNKNOWN and NULL. + * + * \note Because of the array is terminated with + * .id = LZMA_VLI_UNKNOWN, the actual array must + * have LZMA_FILTERS_MAX + 1 members or the Block + * Header decoder will overflow the buffer. + */ + lzma_filter *filters; + + /** + * \brief Raw value stored in the Check field + * + * After successful coding, the first lzma_check_size(check) bytes + * of this array contain the raw value stored in the Check field. + * + * Note that CRC32 and CRC64 are stored in little endian byte order. + * Take it into account if you display the Check values to the user. + * + * Written by: + * - lzma_block_encoder() + * - lzma_block_decoder() + * - lzma_block_buffer_encode() + * - lzma_block_buffer_decode() + */ + uint8_t raw_check[LZMA_CHECK_SIZE_MAX]; + + /* + * Reserved space to allow possible future extensions without + * breaking the ABI. You should not touch these, because the names + * of these variables may change. These are and will never be used + * with the currently supported options, so it is safe to leave these + * uninitialized. + */ + void *reserved_ptr1; + void *reserved_ptr2; + void *reserved_ptr3; + uint32_t reserved_int1; + uint32_t reserved_int2; + lzma_vli reserved_int3; + lzma_vli reserved_int4; + lzma_vli reserved_int5; + lzma_vli reserved_int6; + lzma_vli reserved_int7; + lzma_vli reserved_int8; + lzma_reserved_enum reserved_enum1; + lzma_reserved_enum reserved_enum2; + lzma_reserved_enum reserved_enum3; + lzma_reserved_enum reserved_enum4; + lzma_bool reserved_bool1; + lzma_bool reserved_bool2; + lzma_bool reserved_bool3; + lzma_bool reserved_bool4; + lzma_bool reserved_bool5; + lzma_bool reserved_bool6; + lzma_bool reserved_bool7; + lzma_bool reserved_bool8; + +} lzma_block; + + +/** + * \brief Decode the Block Header Size field + * + * To decode Block Header using lzma_block_header_decode(), the size of the + * Block Header has to be known and stored into lzma_block.header_size. + * The size can be calculated from the first byte of a Block using this macro. + * Note that if the first byte is 0x00, it indicates beginning of Index; use + * this macro only when the byte is not 0x00. + * + * There is no encoding macro, because Block Header encoder is enough for that. + */ +#define lzma_block_header_size_decode(b) (((uint32_t)(b) + 1) * 4) + + +/** + * \brief Calculate Block Header Size + * + * Calculate the minimum size needed for the Block Header field using the + * settings specified in the lzma_block structure. Note that it is OK to + * increase the calculated header_size value as long as it is a multiple of + * four and doesn't exceed LZMA_BLOCK_HEADER_SIZE_MAX. Increasing header_size + * just means that lzma_block_header_encode() will add Header Padding. + * + * \return - LZMA_OK: Size calculated successfully and stored to + * block->header_size. + * - LZMA_OPTIONS_ERROR: Unsupported version, filters or + * filter options. + * - LZMA_PROG_ERROR: Invalid values like compressed_size == 0. + * + * \note This doesn't check that all the options are valid i.e. this + * may return LZMA_OK even if lzma_block_header_encode() or + * lzma_block_encoder() would fail. If you want to validate the + * filter chain, consider using lzma_memlimit_encoder() which as + * a side-effect validates the filter chain. + */ +extern LZMA_API(lzma_ret) lzma_block_header_size(lzma_block *block) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Encode Block Header + * + * The caller must have calculated the size of the Block Header already with + * lzma_block_header_size(). If a value larger than the one calculated by + * lzma_block_header_size() is used, the Block Header will be padded to the + * specified size. + * + * \param out Beginning of the output buffer. This must be + * at least block->header_size bytes. + * \param block Block options to be encoded. + * + * \return - LZMA_OK: Encoding was successful. block->header_size + * bytes were written to output buffer. + * - LZMA_OPTIONS_ERROR: Invalid or unsupported options. + * - LZMA_PROG_ERROR: Invalid arguments, for example + * block->header_size is invalid or block->filters is NULL. + */ +extern LZMA_API(lzma_ret) lzma_block_header_encode( + const lzma_block *block, uint8_t *out) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Decode Block Header + * + * block->version should be set to the highest value supported by the + * application; currently the only possible version is zero. This function + * will set version to the lowest value that still supports all the features + * required by the Block Header. + * + * The size of the Block Header must have already been decoded with + * lzma_block_header_size_decode() macro and stored to block->header_size. + * + * block->filters must have been allocated, but they don't need to be + * initialized (possible existing filter options are not freed). + * + * \param block Destination for Block options. + * \param allocator lzma_allocator for custom allocator functions. + * Set to NULL to use malloc() (and also free() + * if an error occurs). + * \param in Beginning of the input buffer. This must be + * at least block->header_size bytes. + * + * \return - LZMA_OK: Decoding was successful. block->header_size + * bytes were read from the input buffer. + * - LZMA_OPTIONS_ERROR: The Block Header specifies some + * unsupported options such as unsupported filters. This can + * happen also if block->version was set to a too low value + * compared to what would be required to properly represent + * the information stored in the Block Header. + * - LZMA_DATA_ERROR: Block Header is corrupt, for example, + * the CRC32 doesn't match. + * - LZMA_PROG_ERROR: Invalid arguments, for example + * block->header_size is invalid or block->filters is NULL. + */ +extern LZMA_API(lzma_ret) lzma_block_header_decode(lzma_block *block, + lzma_allocator *allocator, const uint8_t *in) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Validate and set Compressed Size according to Unpadded Size + * + * Block Header stores Compressed Size, but Index has Unpadded Size. If the + * application has already parsed the Index and is now decoding Blocks, + * it can calculate Compressed Size from Unpadded Size. This function does + * exactly that with error checking: + * + * - Compressed Size calculated from Unpadded Size must be positive integer, + * that is, Unpadded Size must be big enough that after Block Header and + * Check fields there's still at least one byte for Compressed Size. + * + * - If Compressed Size was present in Block Header, the new value + * calculated from Unpadded Size is compared against the value + * from Block Header. + * + * \note This function must be called _after_ decoding the Block Header + * field so that it can properly validate Compressed Size if it + * was present in Block Header. + * + * \return - LZMA_OK: block->compressed_size was set successfully. + * - LZMA_DATA_ERROR: unpadded_size is too small compared to + * block->header_size and lzma_check_size(block->check). + * - LZMA_PROG_ERROR: Some values are invalid. For example, + * block->header_size must be a multiple of four and + * between 8 and 1024 inclusive. + */ +extern LZMA_API(lzma_ret) lzma_block_compressed_size( + lzma_block *block, lzma_vli unpadded_size) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Calculate Unpadded Size + * + * The Index field stores Unpadded Size and Uncompressed Size. The latter + * can be taken directly from the lzma_block structure after coding a Block, + * but Unpadded Size needs to be calculated from Block Header Size, + * Compressed Size, and size of the Check field. This is where this function + * is needed. + * + * \return Unpadded Size on success, or zero on error. + */ +extern LZMA_API(lzma_vli) lzma_block_unpadded_size(const lzma_block *block) + lzma_nothrow lzma_attr_pure; + + +/** + * \brief Calculate the total encoded size of a Block + * + * This is equivalent to lzma_block_unpadded_size() except that the returned + * value includes the size of the Block Padding field. + * + * \return On success, total encoded size of the Block. On error, + * zero is returned. + */ +extern LZMA_API(lzma_vli) lzma_block_total_size(const lzma_block *block) + lzma_nothrow lzma_attr_pure; + + +/** + * \brief Initialize .xz Block encoder + * + * Valid actions for lzma_code() are LZMA_RUN, LZMA_SYNC_FLUSH (only if the + * filter chain supports it), and LZMA_FINISH. + * + * \return - LZMA_OK: All good, continue with lzma_code(). + * - LZMA_MEM_ERROR + * - LZMA_OPTIONS_ERROR + * - LZMA_UNSUPPORTED_CHECK: block->check specifies a Check ID + * that is not supported by this buid of liblzma. Initializing + * the encoder failed. + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_block_encoder( + lzma_stream *strm, lzma_block *block) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Initialize .xz Block decoder + * + * Valid actions for lzma_code() are LZMA_RUN and LZMA_FINISH. Using + * LZMA_FINISH is not required. It is supported only for convenience. + * + * \return - LZMA_OK: All good, continue with lzma_code(). + * - LZMA_UNSUPPORTED_CHECK: Initialization was successful, but + * the given Check ID is not supported, thus Check will be + * ignored. + * - LZMA_PROG_ERROR + * - LZMA_MEM_ERROR + */ +extern LZMA_API(lzma_ret) lzma_block_decoder( + lzma_stream *strm, lzma_block *block) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Calculate maximum output size for single-call Block encoding + * + * This is equivalent to lzma_stream_buffer_bound() but for .xz Blocks. + * See the documentation of lzma_stream_buffer_bound(). + */ +extern LZMA_API(size_t) lzma_block_buffer_bound(size_t uncompressed_size) + lzma_nothrow; + + +/** + * \brief Single-call .xz Block encoder + * + * In contrast to the multi-call encoder initialized with + * lzma_block_encoder(), this function encodes also the Block Header. This + * is required to make it possible to write appropriate Block Header also + * in case the data isn't compressible, and different filter chain has to be + * used to encode the data in uncompressed form using uncompressed chunks + * of the LZMA2 filter. + * + * When the data isn't compressible, header_size, compressed_size, and + * uncompressed_size are set just like when the data was compressible, but + * it is possible that header_size is too small to hold the filter chain + * specified in block->filters, because that isn't necessarily the filter + * chain that was actually used to encode the data. lzma_block_unpadded_size() + * still works normally, because it doesn't read the filters array. + * + * \param block Block options: block->version, block->check, + * and block->filters must have been initialized. + * \param allocator lzma_allocator for custom allocator functions. + * Set to NULL to use malloc() and free(). + * \param in Beginning of the input buffer + * \param in_size Size of the input buffer + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * *out_pos is updated only if encoding succeeds. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + * + * \return - LZMA_OK: Encoding was successful. + * - LZMA_BUF_ERROR: Not enough output buffer space. + * - LZMA_UNSUPPORTED_CHECK + * - LZMA_OPTIONS_ERROR + * - LZMA_MEM_ERROR + * - LZMA_DATA_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_block_buffer_encode( + lzma_block *block, lzma_allocator *allocator, + const uint8_t *in, size_t in_size, + uint8_t *out, size_t *out_pos, size_t out_size) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Single-call .xz Block decoder + * + * This is single-call equivalent of lzma_block_decoder(), and requires that + * the caller has already decoded Block Header and checked its memory usage. + * + * \param block Block options just like with lzma_block_decoder(). + * \param allocator lzma_allocator for custom allocator functions. + * Set to NULL to use malloc() and free(). + * \param in Beginning of the input buffer + * \param in_pos The next byte will be read from in[*in_pos]. + * *in_pos is updated only if decoding succeeds. + * \param in_size Size of the input buffer; the first byte that + * won't be read is in[in_size]. + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * *out_pos is updated only if encoding succeeds. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + * + * \return - LZMA_OK: Decoding was successful. + * - LZMA_OPTIONS_ERROR + * - LZMA_DATA_ERROR + * - LZMA_MEM_ERROR + * - LZMA_BUF_ERROR: Output buffer was too small. + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_block_buffer_decode( + lzma_block *block, lzma_allocator *allocator, + const uint8_t *in, size_t *in_pos, size_t in_size, + uint8_t *out, size_t *out_pos, size_t out_size) + lzma_nothrow; diff --git a/liblzma/api/lzma/check.h b/liblzma/api/lzma/check.h new file mode 100644 index 0000000..6a243db --- /dev/null +++ b/liblzma/api/lzma/check.h @@ -0,0 +1,150 @@ +/** + * \file lzma/check.h + * \brief Integrity checks + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +# error Never include this file directly. Use instead. +#endif + + +/** + * \brief Type of the integrity check (Check ID) + * + * The .xz format supports multiple types of checks that are calculated + * from the uncompressed data. They vary in both speed and ability to + * detect errors. + */ +typedef enum { + LZMA_CHECK_NONE = 0, + /**< + * No Check is calculated. + * + * Size of the Check field: 0 bytes + */ + + LZMA_CHECK_CRC32 = 1, + /**< + * CRC32 using the polynomial from the IEEE 802.3 standard + * + * Size of the Check field: 4 bytes + */ + + LZMA_CHECK_CRC64 = 4, + /**< + * CRC64 using the polynomial from the ECMA-182 standard + * + * Size of the Check field: 8 bytes + */ + + LZMA_CHECK_SHA256 = 10 + /**< + * SHA-256 + * + * Size of the Check field: 32 bytes + */ +} lzma_check; + + +/** + * \brief Maximum valid Check ID + * + * The .xz file format specification specifies 16 Check IDs (0-15). Some + * of them are only reserved, that is, no actual Check algorithm has been + * assigned. When decoding, liblzma still accepts unknown Check IDs for + * future compatibility. If a valid but unsupported Check ID is detected, + * liblzma can indicate a warning; see the flags LZMA_TELL_NO_CHECK, + * LZMA_TELL_UNSUPPORTED_CHECK, and LZMA_TELL_ANY_CHECK in container.h. + */ +#define LZMA_CHECK_ID_MAX 15 + + +/** + * \brief Test if the given Check ID is supported + * + * Return true if the given Check ID is supported by this liblzma build. + * Otherwise false is returned. It is safe to call this with a value that + * is not in the range [0, 15]; in that case the return value is always false. + * + * You can assume that LZMA_CHECK_NONE and LZMA_CHECK_CRC32 are always + * supported (even if liblzma is built with limited features). + */ +extern LZMA_API(lzma_bool) lzma_check_is_supported(lzma_check check) + lzma_nothrow lzma_attr_const; + + +/** + * \brief Get the size of the Check field with the given Check ID + * + * Although not all Check IDs have a check algorithm associated, the size of + * every Check is already frozen. This function returns the size (in bytes) of + * the Check field with the specified Check ID. The values are: + * { 0, 4, 4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64, 64 } + * + * If the argument is not in the range [0, 15], UINT32_MAX is returned. + */ +extern LZMA_API(uint32_t) lzma_check_size(lzma_check check) + lzma_nothrow lzma_attr_const; + + +/** + * \brief Maximum size of a Check field + */ +#define LZMA_CHECK_SIZE_MAX 64 + + +/** + * \brief Calculate CRC32 + * + * Calculate CRC32 using the polynomial from the IEEE 802.3 standard. + * + * \param buf Pointer to the input buffer + * \param size Size of the input buffer + * \param crc Previously returned CRC value. This is used to + * calculate the CRC of a big buffer in smaller chunks. + * Set to zero when starting a new calculation. + * + * \return Updated CRC value, which can be passed to this function + * again to continue CRC calculation. + */ +extern LZMA_API(uint32_t) lzma_crc32( + const uint8_t *buf, size_t size, uint32_t crc) + lzma_nothrow lzma_attr_pure; + + +/** + * \brief Calculate CRC64 + * + * Calculate CRC64 using the polynomial from the ECMA-182 standard. + * + * This function is used similarly to lzma_crc32(). See its documentation. + */ +extern LZMA_API(uint64_t) lzma_crc64( + const uint8_t *buf, size_t size, uint64_t crc) + lzma_nothrow lzma_attr_pure; + + +/* + * SHA-256 functions are currently not exported to public API. + * Contact Lasse Collin if you think it should be. + */ + + +/** + * \brief Get the type of the integrity check + * + * This function can be called only immediately after lzma_code() has + * returned LZMA_NO_CHECK, LZMA_UNSUPPORTED_CHECK, or LZMA_GET_CHECK. + * Calling this function in any other situation has undefined behavior. + */ +extern LZMA_API(lzma_check) lzma_get_check(const lzma_stream *strm) + lzma_nothrow; diff --git a/liblzma/api/lzma/container.h b/liblzma/api/lzma/container.h new file mode 100644 index 0000000..7a9ffc6 --- /dev/null +++ b/liblzma/api/lzma/container.h @@ -0,0 +1,424 @@ +/** + * \file lzma/container.h + * \brief File formats + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +# error Never include this file directly. Use instead. +#endif + + +/************ + * Encoding * + ************/ + +/** + * \brief Default compression preset + * + * It's not straightforward to recommend a default preset, because in some + * cases keeping the resource usage relatively low is more important that + * getting the maximum compression ratio. + */ +#define LZMA_PRESET_DEFAULT UINT32_C(6) + + +/** + * \brief Mask for preset level + * + * This is useful only if you need to extract the level from the preset + * variable. That should be rare. + */ +#define LZMA_PRESET_LEVEL_MASK UINT32_C(0x1F) + + +/* + * Preset flags + * + * Currently only one flag is defined. + */ + +/** + * \brief Extreme compression preset + * + * This flag modifies the preset to make the encoding significantly slower + * while improving the compression ratio only marginally. This is useful + * when you don't mind wasting time to get as small result as possible. + * + * This flag doesn't affect the memory usage requirements of the decoder (at + * least not significantly). The memory usage of the encoder may be increased + * a little but only at the lowest preset levels (0-3). + */ +#define LZMA_PRESET_EXTREME (UINT32_C(1) << 31) + + +/** + * \brief Calculate approximate memory usage of easy encoder + * + * This function is a wrapper for lzma_raw_encoder_memusage(). + * + * \param preset Compression preset (level and possible flags) + * + * \return Number of bytes of memory required for the given + * preset when encoding. If an error occurs, for example + * due to unsupported preset, UINT64_MAX is returned. + */ +extern LZMA_API(uint64_t) lzma_easy_encoder_memusage(uint32_t preset) + lzma_nothrow lzma_attr_pure; + + +/** + * \brief Calculate approximate decoder memory usage of a preset + * + * This function is a wrapper for lzma_raw_decoder_memusage(). + * + * \param preset Compression preset (level and possible flags) + * + * \return Number of bytes of memory required to decompress a file + * that was compressed using the given preset. If an error + * occurs, for example due to unsupported preset, UINT64_MAX + * is returned. + */ +extern LZMA_API(uint64_t) lzma_easy_decoder_memusage(uint32_t preset) + lzma_nothrow lzma_attr_pure; + + +/** + * \brief Initialize .xz Stream encoder using a preset number + * + * This function is intended for those who just want to use the basic features + * if liblzma (that is, most developers out there). + * + * \param strm Pointer to lzma_stream that is at least initialized + * with LZMA_STREAM_INIT. + * \param preset Compression preset to use. A preset consist of level + * number and zero or more flags. Usually flags aren't + * used, so preset is simply a number [0, 9] which match + * the options -0 ... -9 of the xz command line tool. + * Additional flags can be be set using bitwise-or with + * the preset level number, e.g. 6 | LZMA_PRESET_EXTREME. + * \param check Integrity check type to use. See check.h for available + * checks. The xz command line tool defaults to + * LZMA_CHECK_CRC64, which is a good choice if you are + * unsure. LZMA_CHECK_CRC32 is good too as long as the + * uncompressed file is not many gigabytes. + * + * \return - LZMA_OK: Initialization succeeded. Use lzma_code() to + * encode your data. + * - LZMA_MEM_ERROR: Memory allocation failed. + * - LZMA_OPTIONS_ERROR: The given compression preset is not + * supported by this build of liblzma. + * - LZMA_UNSUPPORTED_CHECK: The given check type is not + * supported by this liblzma build. + * - LZMA_PROG_ERROR: One or more of the parameters have values + * that will never be valid. For example, strm == NULL. + * + * If initialization fails (return value is not LZMA_OK), all the memory + * allocated for *strm by liblzma is always freed. Thus, there is no need + * to call lzma_end() after failed initialization. + * + * If initialization succeeds, use lzma_code() to do the actual encoding. + * Valid values for `action' (the second argument of lzma_code()) are + * LZMA_RUN, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, and LZMA_FINISH. In future, + * there may be compression levels or flags that don't support LZMA_SYNC_FLUSH. + */ +extern LZMA_API(lzma_ret) lzma_easy_encoder( + lzma_stream *strm, uint32_t preset, lzma_check check) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Single-call .xz Stream encoding using a preset number + * + * The maximum required output buffer size can be calculated with + * lzma_stream_buffer_bound(). + * + * \param preset Compression preset to use. See the description + * in lzma_easy_encoder(). + * \param check Type of the integrity check to calculate from + * uncompressed data. + * \param allocator lzma_allocator for custom allocator functions. + * Set to NULL to use malloc() and free(). + * \param in Beginning of the input buffer + * \param in_size Size of the input buffer + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * *out_pos is updated only if encoding succeeds. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + * + * \return - LZMA_OK: Encoding was successful. + * - LZMA_BUF_ERROR: Not enough output buffer space. + * - LZMA_UNSUPPORTED_CHECK + * - LZMA_OPTIONS_ERROR + * - LZMA_MEM_ERROR + * - LZMA_DATA_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_easy_buffer_encode( + uint32_t preset, lzma_check check, + lzma_allocator *allocator, const uint8_t *in, size_t in_size, + uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow; + + +/** + * \brief Initialize .xz Stream encoder using a custom filter chain + * + * \param strm Pointer to properly prepared lzma_stream + * \param filters Array of filters. This must be terminated with + * filters[n].id = LZMA_VLI_UNKNOWN. See filter.h for + * more information. + * \param check Type of the integrity check to calculate from + * uncompressed data. + * + * \return - LZMA_OK: Initialization was successful. + * - LZMA_MEM_ERROR + * - LZMA_UNSUPPORTED_CHECK + * - LZMA_OPTIONS_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_stream_encoder(lzma_stream *strm, + const lzma_filter *filters, lzma_check check) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Initialize .lzma encoder (legacy file format) + * + * The .lzma format is sometimes called the LZMA_Alone format, which is the + * reason for the name of this function. The .lzma format supports only the + * LZMA1 filter. There is no support for integrity checks like CRC32. + * + * Use this function if and only if you need to create files readable by + * legacy LZMA tools such as LZMA Utils 4.32.x. Moving to the .xz format + * is strongly recommended. + * + * The valid action values for lzma_code() are LZMA_RUN and LZMA_FINISH. + * No kind of flushing is supported, because the file format doesn't make + * it possible. + * + * \return - LZMA_OK + * - LZMA_MEM_ERROR + * - LZMA_OPTIONS_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_alone_encoder( + lzma_stream *strm, const lzma_options_lzma *options) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Calculate output buffer size for single-call Stream encoder + * + * When trying to compress uncompressible data, the encoded size will be + * slightly bigger than the input data. This function calculates how much + * output buffer space is required to be sure that lzma_stream_buffer_encode() + * doesn't return LZMA_BUF_ERROR. + * + * The calculated value is not exact, but it is guaranteed to be big enough. + * The actual maximum output space required may be slightly smaller (up to + * about 100 bytes). This should not be a problem in practice. + * + * If the calculated maximum size doesn't fit into size_t or would make the + * Stream grow past LZMA_VLI_MAX (which should never happen in practice), + * zero is returned to indicate the error. + * + * \note The limit calculated by this function applies only to + * single-call encoding. Multi-call encoding may (and probably + * will) have larger maximum expansion when encoding + * uncompressible data. Currently there is no function to + * calculate the maximum expansion of multi-call encoding. + */ +extern LZMA_API(size_t) lzma_stream_buffer_bound(size_t uncompressed_size) + lzma_nothrow; + + +/** + * \brief Single-call .xz Stream encoder + * + * \param filters Array of filters. This must be terminated with + * filters[n].id = LZMA_VLI_UNKNOWN. See filter.h + * for more information. + * \param check Type of the integrity check to calculate from + * uncompressed data. + * \param allocator lzma_allocator for custom allocator functions. + * Set to NULL to use malloc() and free(). + * \param in Beginning of the input buffer + * \param in_size Size of the input buffer + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * *out_pos is updated only if encoding succeeds. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + * + * \return - LZMA_OK: Encoding was successful. + * - LZMA_BUF_ERROR: Not enough output buffer space. + * - LZMA_UNSUPPORTED_CHECK + * - LZMA_OPTIONS_ERROR + * - LZMA_MEM_ERROR + * - LZMA_DATA_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_stream_buffer_encode( + lzma_filter *filters, lzma_check check, + lzma_allocator *allocator, const uint8_t *in, size_t in_size, + uint8_t *out, size_t *out_pos, size_t out_size) + lzma_nothrow lzma_attr_warn_unused_result; + + +/************ + * Decoding * + ************/ + +/** + * This flag makes lzma_code() return LZMA_NO_CHECK if the input stream + * being decoded has no integrity check. Note that when used with + * lzma_auto_decoder(), all .lzma files will trigger LZMA_NO_CHECK + * if LZMA_TELL_NO_CHECK is used. + */ +#define LZMA_TELL_NO_CHECK UINT32_C(0x01) + + +/** + * This flag makes lzma_code() return LZMA_UNSUPPORTED_CHECK if the input + * stream has an integrity check, but the type of the integrity check is not + * supported by this liblzma version or build. Such files can still be + * decoded, but the integrity check cannot be verified. + */ +#define LZMA_TELL_UNSUPPORTED_CHECK UINT32_C(0x02) + + +/** + * This flag makes lzma_code() return LZMA_GET_CHECK as soon as the type + * of the integrity check is known. The type can then be got with + * lzma_get_check(). + */ +#define LZMA_TELL_ANY_CHECK UINT32_C(0x04) + + +/** + * This flag enables decoding of concatenated files with file formats that + * allow concatenating compressed files as is. From the formats currently + * supported by liblzma, only the .xz format allows concatenated files. + * Concatenated files are not allowed with the legacy .lzma format. + * + * This flag also affects the usage of the `action' argument for lzma_code(). + * When LZMA_CONCATENATED is used, lzma_code() won't return LZMA_STREAM_END + * unless LZMA_FINISH is used as `action'. Thus, the application has to set + * LZMA_FINISH in the same way as it does when encoding. + * + * If LZMA_CONCATENATED is not used, the decoders still accept LZMA_FINISH + * as `action' for lzma_code(), but the usage of LZMA_FINISH isn't required. + */ +#define LZMA_CONCATENATED UINT32_C(0x08) + + +/** + * \brief Initialize .xz Stream decoder + * + * \param strm Pointer to properly prepared lzma_stream + * \param memlimit Memory usage limit as bytes. Use UINT64_MAX + * to effectively disable the limiter. + * \param flags Bitwise-or of zero or more of the decoder flags: + * LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK, + * LZMA_TELL_ANY_CHECK, LZMA_CONCATENATED + * + * \return - LZMA_OK: Initialization was successful. + * - LZMA_MEM_ERROR: Cannot allocate memory. + * - LZMA_OPTIONS_ERROR: Unsupported flags + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_stream_decoder( + lzma_stream *strm, uint64_t memlimit, uint32_t flags) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Decode .xz Streams and .lzma files with autodetection + * + * This decoder autodetects between the .xz and .lzma file formats, and + * calls lzma_stream_decoder() or lzma_alone_decoder() once the type + * of the input file has been detected. + * + * \param strm Pointer to properly prepared lzma_stream + * \param memlimit Memory usage limit as bytes. Use UINT64_MAX + * to effectively disable the limiter. + * \param flags Bitwise-or of flags, or zero for no flags. + * + * \return - LZMA_OK: Initialization was successful. + * - LZMA_MEM_ERROR: Cannot allocate memory. + * - LZMA_OPTIONS_ERROR: Unsupported flags + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_auto_decoder( + lzma_stream *strm, uint64_t memlimit, uint32_t flags) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Initialize .lzma decoder (legacy file format) + * + * Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH. + * There is no need to use LZMA_FINISH, but allowing it may simplify + * certain types of applications. + * + * \return - LZMA_OK + * - LZMA_MEM_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_alone_decoder( + lzma_stream *strm, uint64_t memlimit) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Single-call .xz Stream decoder + * + * \param memlimit Pointer to how much memory the decoder is allowed + * to allocate. The value pointed by this pointer is + * modified if and only if LZMA_MEMLIMIT_ERROR is + * returned. + * \param flags Bitwise-or of zero or more of the decoder flags: + * LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK, + * LZMA_CONCATENATED. Note that LZMA_TELL_ANY_CHECK + * is not allowed and will return LZMA_PROG_ERROR. + * \param allocator lzma_allocator for custom allocator functions. + * Set to NULL to use malloc() and free(). + * \param in Beginning of the input buffer + * \param in_pos The next byte will be read from in[*in_pos]. + * *in_pos is updated only if decoding succeeds. + * \param in_size Size of the input buffer; the first byte that + * won't be read is in[in_size]. + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * *out_pos is updated only if decoding succeeds. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + * + * \return - LZMA_OK: Decoding was successful. + * - LZMA_FORMAT_ERROR + * - LZMA_OPTIONS_ERROR + * - LZMA_DATA_ERROR + * - LZMA_NO_CHECK: This can be returned only if using + * the LZMA_TELL_NO_CHECK flag. + * - LZMA_UNSUPPORTED_CHECK: This can be returned only if using + * the LZMA_TELL_UNSUPPORTED_CHECK flag. + * - LZMA_MEM_ERROR + * - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached. + * The minimum required memlimit value was stored to *memlimit. + * - LZMA_BUF_ERROR: Output buffer was too small. + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_stream_buffer_decode( + uint64_t *memlimit, uint32_t flags, lzma_allocator *allocator, + const uint8_t *in, size_t *in_pos, size_t in_size, + uint8_t *out, size_t *out_pos, size_t out_size) + lzma_nothrow lzma_attr_warn_unused_result; diff --git a/liblzma/api/lzma/delta.h b/liblzma/api/lzma/delta.h new file mode 100644 index 0000000..592fc4f --- /dev/null +++ b/liblzma/api/lzma/delta.h @@ -0,0 +1,77 @@ +/** + * \file lzma/delta.h + * \brief Delta filter + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +# error Never include this file directly. Use instead. +#endif + + +/** + * \brief Filter ID + * + * Filter ID of the Delta filter. This is used as lzma_filter.id. + */ +#define LZMA_FILTER_DELTA LZMA_VLI_C(0x03) + + +/** + * \brief Type of the delta calculation + * + * Currently only byte-wise delta is supported. Other possible types could + * be, for example, delta of 16/32/64-bit little/big endian integers, but + * these are not currently planned since byte-wise delta is almost as good. + */ +typedef enum { + LZMA_DELTA_TYPE_BYTE +} lzma_delta_type; + + +/** + * \brief Options for the Delta filter + * + * These options are needed by both encoder and decoder. + */ +typedef struct { + /** For now, this must always be LZMA_DELTA_TYPE_BYTE. */ + lzma_delta_type type; + + /** + * \brief Delta distance + * + * With the only currently supported type, LZMA_DELTA_TYPE_BYTE, + * the distance is as bytes. + * + * Examples: + * - 16-bit stereo audio: distance = 4 bytes + * - 24-bit RGB image data: distance = 3 bytes + */ + uint32_t dist; +# define LZMA_DELTA_DIST_MIN 1 +# define LZMA_DELTA_DIST_MAX 256 + + /* + * Reserved space to allow possible future extensions without + * breaking the ABI. You should not touch these, because the names + * of these variables may change. These are and will never be used + * when type is LZMA_DELTA_TYPE_BYTE, so it is safe to leave these + * uninitialized. + */ + uint32_t reserved_int1; + uint32_t reserved_int2; + uint32_t reserved_int3; + uint32_t reserved_int4; + void *reserved_ptr1; + void *reserved_ptr2; + +} lzma_options_delta; diff --git a/liblzma/api/lzma/filter.h b/liblzma/api/lzma/filter.h new file mode 100644 index 0000000..e0bc163 --- /dev/null +++ b/liblzma/api/lzma/filter.h @@ -0,0 +1,424 @@ +/** + * \file lzma/filter.h + * \brief Common filter related types and functions + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +# error Never include this file directly. Use instead. +#endif + + +/** + * \brief Maximum number of filters in a chain + * + * A filter chain can have 1-4 filters, of which three are allowed to change + * the size of the data. Usually only one or two filters are needed. + */ +#define LZMA_FILTERS_MAX 4 + + +/** + * \brief Filter options + * + * This structure is used to pass Filter ID and a pointer filter's + * options to liblzma. A few functions work with a single lzma_filter + * structure, while most functions expect a filter chain. + * + * A filter chain is indicated with an array of lzma_filter structures. + * The array is terminated with .id = LZMA_VLI_UNKNOWN. Thus, the filter + * array must have LZMA_FILTERS_MAX + 1 elements (that is, five) to + * be able to hold any arbitrary filter chain. This is important when + * using lzma_block_header_decode() from block.h, because too small + * array would make liblzma write past the end of the filters array. + */ +typedef struct { + /** + * \brief Filter ID + * + * Use constants whose name begin with `LZMA_FILTER_' to specify + * different filters. In an array of lzma_filter structures, use + * LZMA_VLI_UNKNOWN to indicate end of filters. + * + * \note This is not an enum, because on some systems enums + * cannot be 64-bit. + */ + lzma_vli id; + + /** + * \brief Pointer to filter-specific options structure + * + * If the filter doesn't need options, set this to NULL. If id is + * set to LZMA_VLI_UNKNOWN, options is ignored, and thus + * doesn't need be initialized. + */ + void *options; + +} lzma_filter; + + +/** + * \brief Test if the given Filter ID is supported for encoding + * + * Return true if the give Filter ID is supported for encoding by this + * liblzma build. Otherwise false is returned. + * + * There is no way to list which filters are available in this particular + * liblzma version and build. It would be useless, because the application + * couldn't know what kind of options the filter would need. + */ +extern LZMA_API(lzma_bool) lzma_filter_encoder_is_supported(lzma_vli id) + lzma_nothrow lzma_attr_const; + + +/** + * \brief Test if the given Filter ID is supported for decoding + * + * Return true if the give Filter ID is supported for decoding by this + * liblzma build. Otherwise false is returned. + */ +extern LZMA_API(lzma_bool) lzma_filter_decoder_is_supported(lzma_vli id) + lzma_nothrow lzma_attr_const; + + +/** + * \brief Copy the filters array + * + * Copy the Filter IDs and filter-specific options from src to dest. + * Up to LZMA_FILTERS_MAX filters are copied, plus the terminating + * .id == LZMA_VLI_UNKNOWN. Thus, dest should have at least + * LZMA_FILTERS_MAX + 1 elements space unless the caller knows that + * src is smaller than that. + * + * Unless the filter-specific options is NULL, the Filter ID has to be + * supported by liblzma, because liblzma needs to know the size of every + * filter-specific options structure. The filter-specific options are not + * validated. If options is NULL, any unsupported Filter IDs are copied + * without returning an error. + * + * Old filter-specific options in dest are not freed, so dest doesn't + * need to be initialized by the caller in any way. + * + * If an error occurs, memory possibly already allocated by this function + * is always freed. + * + * \return - LZMA_OK + * - LZMA_MEM_ERROR + * - LZMA_OPTIONS_ERROR: Unsupported Filter ID and its options + * is not NULL. + * - LZMA_PROG_ERROR: src or dest is NULL. + */ +extern LZMA_API(lzma_ret) lzma_filters_copy(const lzma_filter *src, + lzma_filter *dest, lzma_allocator *allocator) lzma_nothrow; + + +/** + * \brief Calculate approximate memory requirements for raw encoder + * + * This function can be used to calculate the memory requirements for + * Block and Stream encoders too because Block and Stream encoders don't + * need significantly more memory than raw encoder. + * + * \param filters Array of filters terminated with + * .id == LZMA_VLI_UNKNOWN. + * + * \return Number of bytes of memory required for the given + * filter chain when encoding. If an error occurs, + * for example due to unsupported filter chain, + * UINT64_MAX is returned. + */ +extern LZMA_API(uint64_t) lzma_raw_encoder_memusage(const lzma_filter *filters) + lzma_nothrow lzma_attr_pure; + + +/** + * \brief Calculate approximate memory requirements for raw decoder + * + * This function can be used to calculate the memory requirements for + * Block and Stream decoders too because Block and Stream decoders don't + * need significantly more memory than raw decoder. + * + * \param filters Array of filters terminated with + * .id == LZMA_VLI_UNKNOWN. + * + * \return Number of bytes of memory required for the given + * filter chain when decoding. If an error occurs, + * for example due to unsupported filter chain, + * UINT64_MAX is returned. + */ +extern LZMA_API(uint64_t) lzma_raw_decoder_memusage(const lzma_filter *filters) + lzma_nothrow lzma_attr_pure; + + +/** + * \brief Initialize raw encoder + * + * This function may be useful when implementing custom file formats. + * + * \param strm Pointer to properly prepared lzma_stream + * \param filters Array of lzma_filter structures. The end of the + * array must be marked with .id = LZMA_VLI_UNKNOWN. + * + * The `action' with lzma_code() can be LZMA_RUN, LZMA_SYNC_FLUSH (if the + * filter chain supports it), or LZMA_FINISH. + * + * \return - LZMA_OK + * - LZMA_MEM_ERROR + * - LZMA_OPTIONS_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_raw_encoder( + lzma_stream *strm, const lzma_filter *filters) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Initialize raw decoder + * + * The initialization of raw decoder goes similarly to raw encoder. + * + * The `action' with lzma_code() can be LZMA_RUN or LZMA_FINISH. Using + * LZMA_FINISH is not required, it is supported just for convenience. + * + * \return - LZMA_OK + * - LZMA_MEM_ERROR + * - LZMA_OPTIONS_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_raw_decoder( + lzma_stream *strm, const lzma_filter *filters) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Update the filter chain in the encoder + * + * This function is for advanced users only. This function has two slightly + * different purposes: + * + * - After LZMA_FULL_FLUSH when using Stream encoder: Set a new filter + * chain, which will be used starting from the next Block. + * + * - After LZMA_SYNC_FLUSH using Raw, Block, or Stream encoder: Change + * the filter-specific options in the middle of encoding. The actual + * filters in the chain (Filter IDs) cannot be changed. In the future, + * it might become possible to change the filter options without + * using LZMA_SYNC_FLUSH. + * + * While rarely useful, this function may be called also when no data has + * been compressed yet. In that case, this function will behave as if + * LZMA_FULL_FLUSH (Stream encoder) or LZMA_SYNC_FLUSH (Raw or Block + * encoder) had been used right before calling this function. + * + * \return - LZMA_OK + * - LZMA_MEM_ERROR + * - LZMA_MEMLIMIT_ERROR + * - LZMA_OPTIONS_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_filters_update( + lzma_stream *strm, const lzma_filter *filters) lzma_nothrow; + + +/** + * \brief Single-call raw encoder + * + * \param filters Array of lzma_filter structures. The end of the + * array must be marked with .id = LZMA_VLI_UNKNOWN. + * \param allocator lzma_allocator for custom allocator functions. + * Set to NULL to use malloc() and free(). + * \param in Beginning of the input buffer + * \param in_size Size of the input buffer + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * *out_pos is updated only if encoding succeeds. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + * + * \return - LZMA_OK: Encoding was successful. + * - LZMA_BUF_ERROR: Not enough output buffer space. + * - LZMA_OPTIONS_ERROR + * - LZMA_MEM_ERROR + * - LZMA_DATA_ERROR + * - LZMA_PROG_ERROR + * + * \note There is no function to calculate how big output buffer + * would surely be big enough. (lzma_stream_buffer_bound() + * works only for lzma_stream_buffer_encode(); raw encoder + * won't necessarily meet that bound.) + */ +extern LZMA_API(lzma_ret) lzma_raw_buffer_encode( + const lzma_filter *filters, lzma_allocator *allocator, + const uint8_t *in, size_t in_size, uint8_t *out, + size_t *out_pos, size_t out_size) lzma_nothrow; + + +/** + * \brief Single-call raw decoder + * + * \param filters Array of lzma_filter structures. The end of the + * array must be marked with .id = LZMA_VLI_UNKNOWN. + * \param allocator lzma_allocator for custom allocator functions. + * Set to NULL to use malloc() and free(). + * \param in Beginning of the input buffer + * \param in_pos The next byte will be read from in[*in_pos]. + * *in_pos is updated only if decoding succeeds. + * \param in_size Size of the input buffer; the first byte that + * won't be read is in[in_size]. + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * *out_pos is updated only if encoding succeeds. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + */ +extern LZMA_API(lzma_ret) lzma_raw_buffer_decode( + const lzma_filter *filters, lzma_allocator *allocator, + const uint8_t *in, size_t *in_pos, size_t in_size, + uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow; + + +/** + * \brief Get the size of the Filter Properties field + * + * This function may be useful when implementing custom file formats + * using the raw encoder and decoder. + * + * \param size Pointer to uint32_t to hold the size of the properties + * \param filter Filter ID and options (the size of the properties may + * vary depending on the options) + * + * \return - LZMA_OK + * - LZMA_OPTIONS_ERROR + * - LZMA_PROG_ERROR + * + * \note This function validates the Filter ID, but does not + * necessarily validate the options. Thus, it is possible + * that this returns LZMA_OK while the following call to + * lzma_properties_encode() returns LZMA_OPTIONS_ERROR. + */ +extern LZMA_API(lzma_ret) lzma_properties_size( + uint32_t *size, const lzma_filter *filter) lzma_nothrow; + + +/** + * \brief Encode the Filter Properties field + * + * \param filter Filter ID and options + * \param props Buffer to hold the encoded options. The size of + * buffer must have been already determined with + * lzma_properties_size(). + * + * \return - LZMA_OK + * - LZMA_OPTIONS_ERROR + * - LZMA_PROG_ERROR + * + * \note Even this function won't validate more options than actually + * necessary. Thus, it is possible that encoding the properties + * succeeds but using the same options to initialize the encoder + * will fail. + * + * \note If lzma_properties_size() indicated that the size + * of the Filter Properties field is zero, calling + * lzma_properties_encode() is not required, but it + * won't do any harm either. + */ +extern LZMA_API(lzma_ret) lzma_properties_encode( + const lzma_filter *filter, uint8_t *props) lzma_nothrow; + + +/** + * \brief Decode the Filter Properties field + * + * \param filter filter->id must have been set to the correct + * Filter ID. filter->options doesn't need to be + * initialized (it's not freed by this function). The + * decoded options will be stored to filter->options. + * filter->options is set to NULL if there are no + * properties or if an error occurs. + * \param allocator Custom memory allocator used to allocate the + * options. Set to NULL to use the default malloc(), + * and in case of an error, also free(). + * \param props Input buffer containing the properties. + * \param props_size Size of the properties. This must be the exact + * size; giving too much or too little input will + * return LZMA_OPTIONS_ERROR. + * + * \return - LZMA_OK + * - LZMA_OPTIONS_ERROR + * - LZMA_MEM_ERROR + */ +extern LZMA_API(lzma_ret) lzma_properties_decode( + lzma_filter *filter, lzma_allocator *allocator, + const uint8_t *props, size_t props_size) lzma_nothrow; + + +/** + * \brief Calculate encoded size of a Filter Flags field + * + * Knowing the size of Filter Flags is useful to know when allocating + * memory to hold the encoded Filter Flags. + * + * \param size Pointer to integer to hold the calculated size + * \param filter Filter ID and associated options whose encoded + * size is to be calculated + * + * \return - LZMA_OK: *size set successfully. Note that this doesn't + * guarantee that filter->options is valid, thus + * lzma_filter_flags_encode() may still fail. + * - LZMA_OPTIONS_ERROR: Unknown Filter ID or unsupported options. + * - LZMA_PROG_ERROR: Invalid options + * + * \note If you need to calculate size of List of Filter Flags, + * you need to loop over every lzma_filter entry. + */ +extern LZMA_API(lzma_ret) lzma_filter_flags_size( + uint32_t *size, const lzma_filter *filter) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Encode Filter Flags into given buffer + * + * In contrast to some functions, this doesn't allocate the needed buffer. + * This is due to how this function is used internally by liblzma. + * + * \param filter Filter ID and options to be encoded + * \param out Beginning of the output buffer + * \param out_pos out[*out_pos] is the next write position. This + * is updated by the encoder. + * \param out_size out[out_size] is the first byte to not write. + * + * \return - LZMA_OK: Encoding was successful. + * - LZMA_OPTIONS_ERROR: Invalid or unsupported options. + * - LZMA_PROG_ERROR: Invalid options or not enough output + * buffer space (you should have checked it with + * lzma_filter_flags_size()). + */ +extern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filter, + uint8_t *out, size_t *out_pos, size_t out_size) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Decode Filter Flags from given buffer + * + * The decoded result is stored into *filter. The old value of + * filter->options is not free()d. + * + * \return - LZMA_OK + * - LZMA_OPTIONS_ERROR + * - LZMA_MEM_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_filter_flags_decode( + lzma_filter *filter, lzma_allocator *allocator, + const uint8_t *in, size_t *in_pos, size_t in_size) + lzma_nothrow lzma_attr_warn_unused_result; diff --git a/liblzma/api/lzma/hardware.h b/liblzma/api/lzma/hardware.h new file mode 100644 index 0000000..e7dd03c --- /dev/null +++ b/liblzma/api/lzma/hardware.h @@ -0,0 +1,50 @@ +/** + * \file lzma/hardware.h + * \brief Hardware information + * + * Since liblzma can consume a lot of system resources, it also provides + * ways to limit the resource usage. Applications linking against liblzma + * need to do the actual decisions how much resources to let liblzma to use. + * To ease making these decisions, liblzma provides functions to find out + * the relevant capabilities of the underlaying hardware. Currently there + * is only a function to find out the amount of RAM, but in the future there + * will be also a function to detect how many concurrent threads the system + * can run. + * + * \note On some operating systems, these function may temporarily + * load a shared library or open file descriptor(s) to find out + * the requested hardware information. Unless the application + * assumes that specific file descriptors are not touched by + * other threads, this should have no effect on thread safety. + * Possible operations involving file descriptors will restart + * the syscalls if they return EINTR. + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +# error Never include this file directly. Use instead. +#endif + + +/** + * \brief Get the total amount of physical memory (RAM) in bytes + * + * This function may be useful when determining a reasonable memory + * usage limit for decompressing or how much memory it is OK to use + * for compressing. + * + * \return On success, the total amount of physical memory in bytes + * is returned. If the amount of RAM cannot be determined, + * zero is returned. This can happen if an error occurs + * or if there is no code in liblzma to detect the amount + * of RAM on the specific operating system. + */ +extern LZMA_API(uint64_t) lzma_physmem(void) lzma_nothrow; diff --git a/liblzma/api/lzma/index.h b/liblzma/api/lzma/index.h new file mode 100644 index 0000000..16bacc2 --- /dev/null +++ b/liblzma/api/lzma/index.h @@ -0,0 +1,682 @@ +/** + * \file lzma/index.h + * \brief Handling of .xz Index and related information + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +# error Never include this file directly. Use instead. +#endif + + +/** + * \brief Opaque data type to hold the Index(es) and other information + * + * lzma_index often holds just one .xz Index and possibly the Stream Flags + * of the same Stream and size of the Stream Padding field. However, + * multiple lzma_indexes can be concatenated with lzma_index_cat() and then + * there may be information about multiple Streams in the same lzma_index. + * + * Notes about thread safety: Only one thread may modify lzma_index at + * a time. All functions that take non-const pointer to lzma_index + * modify it. As long as no thread is modifying the lzma_index, getting + * information from the same lzma_index can be done from multiple threads + * at the same time with functions that take a const pointer to + * lzma_index or use lzma_index_iter. The same iterator must be used + * only by one thread at a time, of course, but there can be as many + * iterators for the same lzma_index as needed. + */ +typedef struct lzma_index_s lzma_index; + + +/** + * \brief Iterator to get information about Blocks and Streams + */ +typedef struct { + struct { + /** + * \brief Pointer to Stream Flags + * + * This is NULL if Stream Flags have not been set for + * this Stream with lzma_index_stream_flags(). + */ + const lzma_stream_flags *flags; + + const void *reserved_ptr1; + const void *reserved_ptr2; + const void *reserved_ptr3; + + /** + * \brief Stream number in the lzma_index + * + * The first Stream is 1. + */ + lzma_vli number; + + /** + * \brief Number of Blocks in the Stream + * + * If this is zero, the block structure below has + * undefined values. + */ + lzma_vli block_count; + + /** + * \brief Compressed start offset of this Stream + * + * The offset is relative to the beginning of the lzma_index + * (i.e. usually the beginning of the .xz file). + */ + lzma_vli compressed_offset; + + /** + * \brief Uncompressed start offset of this Stream + * + * The offset is relative to the beginning of the lzma_index + * (i.e. usually the beginning of the .xz file). + */ + lzma_vli uncompressed_offset; + + /** + * \brief Compressed size of this Stream + * + * This includes all headers except the possible + * Stream Padding after this Stream. + */ + lzma_vli compressed_size; + + /** + * \brief Uncompressed size of this Stream + */ + lzma_vli uncompressed_size; + + /** + * \brief Size of Stream Padding after this Stream + * + * If it hasn't been set with lzma_index_stream_padding(), + * this defaults to zero. Stream Padding is always + * a multiple of four bytes. + */ + lzma_vli padding; + + lzma_vli reserved_vli1; + lzma_vli reserved_vli2; + lzma_vli reserved_vli3; + lzma_vli reserved_vli4; + } stream; + + struct { + /** + * \brief Block number in the file + * + * The first Block is 1. + */ + lzma_vli number_in_file; + + /** + * \brief Compressed start offset of this Block + * + * This offset is relative to the beginning of the + * lzma_index (i.e. usually the beginning of the .xz file). + * Normally this is where you should seek in the .xz file + * to start decompressing this Block. + */ + lzma_vli compressed_file_offset; + + /** + * \brief Uncompressed start offset of this Block + * + * This offset is relative to the beginning of the lzma_index + * (i.e. usually the beginning of the .xz file). + * + * When doing random-access reading, it is possible that + * the target offset is not exactly at Block boundary. One + * will need to compare the target offset against + * uncompressed_file_offset or uncompressed_stream_offset, + * and possibly decode and throw away some amount of data + * before reaching the target offset. + */ + lzma_vli uncompressed_file_offset; + + /** + * \brief Block number in this Stream + * + * The first Block is 1. + */ + lzma_vli number_in_stream; + + /** + * \brief Compressed start offset of this Block + * + * This offset is relative to the beginning of the Stream + * containing this Block. + */ + lzma_vli compressed_stream_offset; + + /** + * \brief Uncompressed start offset of this Block + * + * This offset is relative to the beginning of the Stream + * containing this Block. + */ + lzma_vli uncompressed_stream_offset; + + /** + * \brief Uncompressed size of this Block + * + * You should pass this to the Block decoder if you will + * decode this Block. It will allow the Block decoder to + * validate the uncompressed size. + */ + lzma_vli uncompressed_size; + + /** + * \brief Unpadded size of this Block + * + * You should pass this to the Block decoder if you will + * decode this Block. It will allow the Block decoder to + * validate the unpadded size. + */ + lzma_vli unpadded_size; + + /** + * \brief Total compressed size + * + * This includes all headers and padding in this Block. + * This is useful if you need to know how many bytes + * the Block decoder will actually read. + */ + lzma_vli total_size; + + lzma_vli reserved_vli1; + lzma_vli reserved_vli2; + lzma_vli reserved_vli3; + lzma_vli reserved_vli4; + + const void *reserved_ptr1; + const void *reserved_ptr2; + const void *reserved_ptr3; + const void *reserved_ptr4; + } block; + + /* + * Internal data which is used to store the state of the iterator. + * The exact format may vary between liblzma versions, so don't + * touch these in any way. + */ + union { + const void *p; + size_t s; + lzma_vli v; + } internal[6]; +} lzma_index_iter; + + +/** + * \brief Operation mode for lzma_index_iter_next() + */ +typedef enum { + LZMA_INDEX_ITER_ANY = 0, + /**< + * \brief Get the next Block or Stream + * + * Go to the next Block if the current Stream has at least + * one Block left. Otherwise go to the next Stream even if + * it has no Blocks. If the Stream has no Blocks + * (lzma_index_iter.stream.block_count == 0), + * lzma_index_iter.block will have undefined values. + */ + + LZMA_INDEX_ITER_STREAM = 1, + /**< + * \brief Get the next Stream + * + * Go to the next Stream even if the current Stream has + * unread Blocks left. If the next Stream has at least one + * Block, the iterator will point to the first Block. + * If there are no Blocks, lzma_index_iter.block will have + * undefined values. + */ + + LZMA_INDEX_ITER_BLOCK = 2, + /**< + * \brief Get the next Block + * + * Go to the next Block if the current Stream has at least + * one Block left. If the current Stream has no Blocks left, + * the next Stream with at least one Block is located and + * the iterator will be made to point to the first Block of + * that Stream. + */ + + LZMA_INDEX_ITER_NONEMPTY_BLOCK = 3 + /**< + * \brief Get the next non-empty Block + * + * This is like LZMA_INDEX_ITER_BLOCK except that it will + * skip Blocks whose Uncompressed Size is zero. + */ + +} lzma_index_iter_mode; + + +/** + * \brief Calculate memory usage of lzma_index + * + * On disk, the size of the Index field depends on both the number of Records + * stored and how big values the Records store (due to variable-length integer + * encoding). When the Index is kept in lzma_index structure, the memory usage + * depends only on the number of Records/Blocks stored in the Index(es), and + * in case of concatenated lzma_indexes, the number of Streams. The size in + * RAM is almost always significantly bigger than in the encoded form on disk. + * + * This function calculates an approximate amount of memory needed hold + * the given number of Streams and Blocks in lzma_index structure. This + * value may vary between CPU architectures and also between liblzma versions + * if the internal implementation is modified. + */ +extern LZMA_API(uint64_t) lzma_index_memusage( + lzma_vli streams, lzma_vli blocks) lzma_nothrow; + + +/** + * \brief Calculate the memory usage of an existing lzma_index + * + * This is a shorthand for lzma_index_memusage(lzma_index_stream_count(i), + * lzma_index_block_count(i)). + */ +extern LZMA_API(uint64_t) lzma_index_memused(const lzma_index *i) + lzma_nothrow; + + +/** + * \brief Allocate and initialize a new lzma_index structure + * + * \return On success, a pointer to an empty initialized lzma_index is + * returned. If allocation fails, NULL is returned. + */ +extern LZMA_API(lzma_index *) lzma_index_init(lzma_allocator *allocator) + lzma_nothrow; + + +/** + * \brief Deallocate lzma_index + * + * If i is NULL, this does nothing. + */ +extern LZMA_API(void) lzma_index_end(lzma_index *i, lzma_allocator *allocator) + lzma_nothrow; + + +/** + * \brief Add a new Block to lzma_index + * + * \param i Pointer to a lzma_index structure + * \param allocator Pointer to lzma_allocator, or NULL to + * use malloc() + * \param unpadded_size Unpadded Size of a Block. This can be + * calculated with lzma_block_unpadded_size() + * after encoding or decoding the Block. + * \param uncompressed_size Uncompressed Size of a Block. This can be + * taken directly from lzma_block structure + * after encoding or decoding the Block. + * + * Appending a new Block does not invalidate iterators. For example, + * if an iterator was pointing to the end of the lzma_index, after + * lzma_index_append() it is possible to read the next Block with + * an existing iterator. + * + * \return - LZMA_OK + * - LZMA_MEM_ERROR + * - LZMA_DATA_ERROR: Compressed or uncompressed size of the + * Stream or size of the Index field would grow too big. + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_index_append( + lzma_index *i, lzma_allocator *allocator, + lzma_vli unpadded_size, lzma_vli uncompressed_size) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Set the Stream Flags + * + * Set the Stream Flags of the last (and typically the only) Stream + * in lzma_index. This can be useful when reading information from the + * lzma_index, because to decode Blocks, knowing the integrity check type + * is needed. + * + * The given Stream Flags are copied into internal preallocated structure + * in the lzma_index, thus the caller doesn't need to keep the *stream_flags + * available after calling this function. + * + * \return - LZMA_OK + * - LZMA_OPTIONS_ERROR: Unsupported stream_flags->version. + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_index_stream_flags( + lzma_index *i, const lzma_stream_flags *stream_flags) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Get the types of integrity Checks + * + * If lzma_index_stream_flags() is used to set the Stream Flags for + * every Stream, lzma_index_checks() can be used to get a bitmask to + * indicate which Check types have been used. It can be useful e.g. if + * showing the Check types to the user. + * + * The bitmask is 1 << check_id, e.g. CRC32 is 1 << 1 and SHA-256 is 1 << 10. + */ +extern LZMA_API(uint32_t) lzma_index_checks(const lzma_index *i) + lzma_nothrow lzma_attr_pure; + + +/** + * \brief Set the amount of Stream Padding + * + * Set the amount of Stream Padding of the last (and typically the only) + * Stream in the lzma_index. This is needed when planning to do random-access + * reading within multiple concatenated Streams. + * + * By default, the amount of Stream Padding is assumed to be zero bytes. + * + * \return - LZMA_OK + * - LZMA_DATA_ERROR: The file size would grow too big. + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_index_stream_padding( + lzma_index *i, lzma_vli stream_padding) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Get the number of Streams + */ +extern LZMA_API(lzma_vli) lzma_index_stream_count(const lzma_index *i) + lzma_nothrow lzma_attr_pure; + + +/** + * \brief Get the number of Blocks + * + * This returns the total number of Blocks in lzma_index. To get number + * of Blocks in individual Streams, use lzma_index_iter. + */ +extern LZMA_API(lzma_vli) lzma_index_block_count(const lzma_index *i) + lzma_nothrow lzma_attr_pure; + + +/** + * \brief Get the size of the Index field as bytes + * + * This is needed to verify the Backward Size field in the Stream Footer. + */ +extern LZMA_API(lzma_vli) lzma_index_size(const lzma_index *i) + lzma_nothrow lzma_attr_pure; + + +/** + * \brief Get the total size of the Stream + * + * If multiple lzma_indexes have been combined, this works as if the Blocks + * were in a single Stream. This is useful if you are going to combine + * Blocks from multiple Streams into a single new Stream. + */ +extern LZMA_API(lzma_vli) lzma_index_stream_size(const lzma_index *i) + lzma_nothrow lzma_attr_pure; + + +/** + * \brief Get the total size of the Blocks + * + * This doesn't include the Stream Header, Stream Footer, Stream Padding, + * or Index fields. + */ +extern LZMA_API(lzma_vli) lzma_index_total_size(const lzma_index *i) + lzma_nothrow lzma_attr_pure; + + +/** + * \brief Get the total size of the file + * + * When no lzma_indexes have been combined with lzma_index_cat() and there is + * no Stream Padding, this function is identical to lzma_index_stream_size(). + * If multiple lzma_indexes have been combined, this includes also the headers + * of each separate Stream and the possible Stream Padding fields. + */ +extern LZMA_API(lzma_vli) lzma_index_file_size(const lzma_index *i) + lzma_nothrow lzma_attr_pure; + + +/** + * \brief Get the uncompressed size of the file + */ +extern LZMA_API(lzma_vli) lzma_index_uncompressed_size(const lzma_index *i) + lzma_nothrow lzma_attr_pure; + + +/** + * \brief Initialize an iterator + * + * \param iter Pointer to a lzma_index_iter structure + * \param i lzma_index to which the iterator will be associated + * + * This function associates the iterator with the given lzma_index, and calls + * lzma_index_iter_rewind() on the iterator. + * + * This function doesn't allocate any memory, thus there is no + * lzma_index_iter_end(). The iterator is valid as long as the + * associated lzma_index is valid, that is, until lzma_index_end() or + * using it as source in lzma_index_cat(). Specifically, lzma_index doesn't + * become invalid if new Blocks are added to it with lzma_index_append() or + * if it is used as the destination in lzma_index_cat(). + * + * It is safe to make copies of an initialized lzma_index_iter, for example, + * to easily restart reading at some particular position. + */ +extern LZMA_API(void) lzma_index_iter_init( + lzma_index_iter *iter, const lzma_index *i) lzma_nothrow; + + +/** + * \brief Rewind the iterator + * + * Rewind the iterator so that next call to lzma_index_iter_next() will + * return the first Block or Stream. + */ +extern LZMA_API(void) lzma_index_iter_rewind(lzma_index_iter *iter) + lzma_nothrow; + + +/** + * \brief Get the next Block or Stream + * + * \param iter Iterator initialized with lzma_index_iter_init() + * \param mode Specify what kind of information the caller wants + * to get. See lzma_index_iter_mode for details. + * + * \return If next Block or Stream matching the mode was found, *iter + * is updated and this function returns false. If no Block or + * Stream matching the mode is found, *iter is not modified + * and this function returns true. If mode is set to an unknown + * value, *iter is not modified and this function returns true. + */ +extern LZMA_API(lzma_bool) lzma_index_iter_next( + lzma_index_iter *iter, lzma_index_iter_mode mode) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Locate a Block + * + * If it is possible to seek in the .xz file, it is possible to parse + * the Index field(s) and use lzma_index_iter_locate() to do random-access + * reading with granularity of Block size. + * + * \param iter Iterator that was earlier initialized with + * lzma_index_iter_init(). + * \param target Uncompressed target offset which the caller would + * like to locate from the Stream + * + * If the target is smaller than the uncompressed size of the Stream (can be + * checked with lzma_index_uncompressed_size()): + * - Information about the Stream and Block containing the requested + * uncompressed offset is stored into *iter. + * - Internal state of the iterator is adjusted so that + * lzma_index_iter_next() can be used to read subsequent Blocks or Streams. + * - This function returns false. + * + * If target is greater than the uncompressed size of the Stream, *iter + * is not modified, and this function returns true. + */ +extern LZMA_API(lzma_bool) lzma_index_iter_locate( + lzma_index_iter *iter, lzma_vli target) lzma_nothrow; + + +/** + * \brief Concatenate lzma_indexes + * + * Concatenating lzma_indexes is useful when doing random-access reading in + * multi-Stream .xz file, or when combining multiple Streams into single + * Stream. + * + * \param dest lzma_index after which src is appended + * \param src lzma_index to be appended after dest. If this + * function succeeds, the memory allocated for src + * is freed or moved to be part of dest, and all + * iterators pointing to src will become invalid. + * \param allocator Custom memory allocator; can be NULL to use + * malloc() and free(). + * + * \return - LZMA_OK: lzma_indexes were concatenated successfully. + * src is now a dangling pointer. + * - LZMA_DATA_ERROR: *dest would grow too big. + * - LZMA_MEM_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_index_cat( + lzma_index *dest, lzma_index *src, lzma_allocator *allocator) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Duplicate lzma_index + * + * \return A copy of the lzma_index, or NULL if memory allocation failed. + */ +extern LZMA_API(lzma_index *) lzma_index_dup( + const lzma_index *i, lzma_allocator *allocator) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Initialize .xz Index encoder + * + * \param strm Pointer to properly prepared lzma_stream + * \param i Pointer to lzma_index which should be encoded. + * + * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH. + * It is enough to use only one of them (you can choose freely; use LZMA_RUN + * to support liblzma versions older than 5.0.0). + * + * \return - LZMA_OK: Initialization succeeded, continue with lzma_code(). + * - LZMA_MEM_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_index_encoder( + lzma_stream *strm, const lzma_index *i) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Initialize .xz Index decoder + * + * \param strm Pointer to properly prepared lzma_stream + * \param i The decoded Index will be made available via + * this pointer. Initially this function will + * set *i to NULL (the old value is ignored). If + * decoding succeeds (lzma_code() returns + * LZMA_STREAM_END), *i will be set to point + * to a new lzma_index, which the application + * has to later free with lzma_index_end(). + * \param memlimit How much memory the resulting lzma_index is + * allowed to require. + * + * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH. + * It is enough to use only one of them (you can choose freely; use LZMA_RUN + * to support liblzma versions older than 5.0.0). + * + * \return - LZMA_OK: Initialization succeeded, continue with lzma_code(). + * - LZMA_MEM_ERROR + * - LZMA_MEMLIMIT_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_index_decoder( + lzma_stream *strm, lzma_index **i, uint64_t memlimit) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Single-call .xz Index encoder + * + * \param i lzma_index to be encoded + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * *out_pos is updated only if encoding succeeds. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + * + * \return - LZMA_OK: Encoding was successful. + * - LZMA_BUF_ERROR: Output buffer is too small. Use + * lzma_index_size() to find out how much output + * space is needed. + * - LZMA_PROG_ERROR + * + * \note This function doesn't take allocator argument since all + * the internal data is allocated on stack. + */ +extern LZMA_API(lzma_ret) lzma_index_buffer_encode(const lzma_index *i, + uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow; + + +/** + * \brief Single-call .xz Index decoder + * + * \param i If decoding succeeds, *i will point to a new + * lzma_index, which the application has to + * later free with lzma_index_end(). If an error + * occurs, *i will be NULL. The old value of *i + * is always ignored and thus doesn't need to be + * initialized by the caller. + * \param memlimit Pointer to how much memory the resulting + * lzma_index is allowed to require. The value + * pointed by this pointer is modified if and only + * if LZMA_MEMLIMIT_ERROR is returned. + * \param allocator Pointer to lzma_allocator, or NULL to use malloc() + * \param in Beginning of the input buffer + * \param in_pos The next byte will be read from in[*in_pos]. + * *in_pos is updated only if decoding succeeds. + * \param in_size Size of the input buffer; the first byte that + * won't be read is in[in_size]. + * + * \return - LZMA_OK: Decoding was successful. + * - LZMA_MEM_ERROR + * - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached. + * The minimum required memlimit value was stored to *memlimit. + * - LZMA_DATA_ERROR + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_index_buffer_decode(lzma_index **i, + uint64_t *memlimit, lzma_allocator *allocator, + const uint8_t *in, size_t *in_pos, size_t in_size) + lzma_nothrow; diff --git a/liblzma/api/lzma/index_hash.h b/liblzma/api/lzma/index_hash.h new file mode 100644 index 0000000..fa2e048 --- /dev/null +++ b/liblzma/api/lzma/index_hash.h @@ -0,0 +1,107 @@ +/** + * \file lzma/index_hash.h + * \brief Validate Index by using a hash function + * + * Hashing makes it possible to use constant amount of memory to validate + * Index of arbitrary size. + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +# error Never include this file directly. Use instead. +#endif + +/** + * \brief Opaque data type to hold the Index hash + */ +typedef struct lzma_index_hash_s lzma_index_hash; + + +/** + * \brief Allocate and initialize a new lzma_index_hash structure + * + * If index_hash is NULL, a new lzma_index_hash structure is allocated, + * initialized, and a pointer to it returned. If allocation fails, NULL + * is returned. + * + * If index_hash is non-NULL, it is reinitialized and the same pointer + * returned. In this case, return value cannot be NULL or a different + * pointer than the index_hash that was given as an argument. + */ +extern LZMA_API(lzma_index_hash *) lzma_index_hash_init( + lzma_index_hash *index_hash, lzma_allocator *allocator) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Deallocate lzma_index_hash structure + */ +extern LZMA_API(void) lzma_index_hash_end( + lzma_index_hash *index_hash, lzma_allocator *allocator) + lzma_nothrow; + + +/** + * \brief Add a new Record to an Index hash + * + * \param index Pointer to a lzma_index_hash structure + * \param unpadded_size Unpadded Size of a Block + * \param uncompressed_size Uncompressed Size of a Block + * + * \return - LZMA_OK + * - LZMA_DATA_ERROR: Compressed or uncompressed size of the + * Stream or size of the Index field would grow too big. + * - LZMA_PROG_ERROR: Invalid arguments or this function is being + * used when lzma_index_hash_decode() has already been used. + */ +extern LZMA_API(lzma_ret) lzma_index_hash_append(lzma_index_hash *index_hash, + lzma_vli unpadded_size, lzma_vli uncompressed_size) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Decode and validate the Index field + * + * After telling the sizes of all Blocks with lzma_index_hash_append(), + * the actual Index field is decoded with this function. Specifically, + * once decoding of the Index field has been started, no more Records + * can be added using lzma_index_hash_append(). + * + * This function doesn't use lzma_stream structure to pass the input data. + * Instead, the input buffer is specified using three arguments. This is + * because it matches better the internal APIs of liblzma. + * + * \param index_hash Pointer to a lzma_index_hash structure + * \param in Pointer to the beginning of the input buffer + * \param in_pos in[*in_pos] is the next byte to process + * \param in_size in[in_size] is the first byte not to process + * + * \return - LZMA_OK: So far good, but more input is needed. + * - LZMA_STREAM_END: Index decoded successfully and it matches + * the Records given with lzma_index_hash_append(). + * - LZMA_DATA_ERROR: Index is corrupt or doesn't match the + * information given with lzma_index_hash_append(). + * - LZMA_BUF_ERROR: Cannot progress because *in_pos >= in_size. + * - LZMA_PROG_ERROR + */ +extern LZMA_API(lzma_ret) lzma_index_hash_decode(lzma_index_hash *index_hash, + const uint8_t *in, size_t *in_pos, size_t in_size) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Get the size of the Index field as bytes + * + * This is needed to verify the Backward Size field in the Stream Footer. + */ +extern LZMA_API(lzma_vli) lzma_index_hash_size( + const lzma_index_hash *index_hash) + lzma_nothrow lzma_attr_pure; diff --git a/liblzma/api/lzma/lzma.h b/liblzma/api/lzma/lzma.h new file mode 100644 index 0000000..3f8e095 --- /dev/null +++ b/liblzma/api/lzma/lzma.h @@ -0,0 +1,420 @@ +/** + * \file lzma/lzma.h + * \brief LZMA1 and LZMA2 filters + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +# error Never include this file directly. Use instead. +#endif + + +/** + * \brief LZMA1 Filter ID + * + * LZMA1 is the very same thing as what was called just LZMA in LZMA Utils, + * 7-Zip, and LZMA SDK. It's called LZMA1 here to prevent developers from + * accidentally using LZMA when they actually want LZMA2. + * + * LZMA1 shouldn't be used for new applications unless you _really_ know + * what you are doing. LZMA2 is almost always a better choice. + */ +#define LZMA_FILTER_LZMA1 LZMA_VLI_C(0x4000000000000001) + +/** + * \brief LZMA2 Filter ID + * + * Usually you want this instead of LZMA1. Compared to LZMA1, LZMA2 adds + * support for LZMA_SYNC_FLUSH, uncompressed chunks (smaller expansion + * when trying to compress uncompressible data), possibility to change + * lc/lp/pb in the middle of encoding, and some other internal improvements. + */ +#define LZMA_FILTER_LZMA2 LZMA_VLI_C(0x21) + + +/** + * \brief Match finders + * + * Match finder has major effect on both speed and compression ratio. + * Usually hash chains are faster than binary trees. + * + * If you will use LZMA_SYNC_FLUSH often, the hash chains may be a better + * choice, because binary trees get much higher compression ratio penalty + * with LZMA_SYNC_FLUSH. + * + * The memory usage formulas are only rough estimates, which are closest to + * reality when dict_size is a power of two. The formulas are more complex + * in reality, and can also change a little between liblzma versions. Use + * lzma_raw_encoder_memusage() to get more accurate estimate of memory usage. + */ +typedef enum { + LZMA_MF_HC3 = 0x03, + /**< + * \brief Hash Chain with 2- and 3-byte hashing + * + * Minimum nice_len: 3 + * + * Memory usage: + * - dict_size <= 16 MiB: dict_size * 7.5 + * - dict_size > 16 MiB: dict_size * 5.5 + 64 MiB + */ + + LZMA_MF_HC4 = 0x04, + /**< + * \brief Hash Chain with 2-, 3-, and 4-byte hashing + * + * Minimum nice_len: 4 + * + * Memory usage: + * - dict_size <= 32 MiB: dict_size * 7.5 + * - dict_size > 32 MiB: dict_size * 6.5 + */ + + LZMA_MF_BT2 = 0x12, + /**< + * \brief Binary Tree with 2-byte hashing + * + * Minimum nice_len: 2 + * + * Memory usage: dict_size * 9.5 + */ + + LZMA_MF_BT3 = 0x13, + /**< + * \brief Binary Tree with 2- and 3-byte hashing + * + * Minimum nice_len: 3 + * + * Memory usage: + * - dict_size <= 16 MiB: dict_size * 11.5 + * - dict_size > 16 MiB: dict_size * 9.5 + 64 MiB + */ + + LZMA_MF_BT4 = 0x14 + /**< + * \brief Binary Tree with 2-, 3-, and 4-byte hashing + * + * Minimum nice_len: 4 + * + * Memory usage: + * - dict_size <= 32 MiB: dict_size * 11.5 + * - dict_size > 32 MiB: dict_size * 10.5 + */ +} lzma_match_finder; + + +/** + * \brief Test if given match finder is supported + * + * Return true if the given match finder is supported by this liblzma build. + * Otherwise false is returned. It is safe to call this with a value that + * isn't listed in lzma_match_finder enumeration; the return value will be + * false. + * + * There is no way to list which match finders are available in this + * particular liblzma version and build. It would be useless, because + * a new match finder, which the application developer wasn't aware, + * could require giving additional options to the encoder that the older + * match finders don't need. + */ +extern LZMA_API(lzma_bool) lzma_mf_is_supported(lzma_match_finder match_finder) + lzma_nothrow lzma_attr_const; + + +/** + * \brief Compression modes + * + * This selects the function used to analyze the data produced by the match + * finder. + */ +typedef enum { + LZMA_MODE_FAST = 1, + /**< + * \brief Fast compression + * + * Fast mode is usually at its best when combined with + * a hash chain match finder. + */ + + LZMA_MODE_NORMAL = 2 + /**< + * \brief Normal compression + * + * This is usually notably slower than fast mode. Use this + * together with binary tree match finders to expose the + * full potential of the LZMA1 or LZMA2 encoder. + */ +} lzma_mode; + + +/** + * \brief Test if given compression mode is supported + * + * Return true if the given compression mode is supported by this liblzma + * build. Otherwise false is returned. It is safe to call this with a value + * that isn't listed in lzma_mode enumeration; the return value will be false. + * + * There is no way to list which modes are available in this particular + * liblzma version and build. It would be useless, because a new compression + * mode, which the application developer wasn't aware, could require giving + * additional options to the encoder that the older modes don't need. + */ +extern LZMA_API(lzma_bool) lzma_mode_is_supported(lzma_mode mode) + lzma_nothrow lzma_attr_const; + + +/** + * \brief Options specific to the LZMA1 and LZMA2 filters + * + * Since LZMA1 and LZMA2 share most of the code, it's simplest to share + * the options structure too. For encoding, all but the reserved variables + * need to be initialized unless specifically mentioned otherwise. + * lzma_lzma_preset() can be used to get a good starting point. + * + * For raw decoding, both LZMA1 and LZMA2 need dict_size, preset_dict, and + * preset_dict_size (if preset_dict != NULL). LZMA1 needs also lc, lp, and pb. + */ +typedef struct { + /** + * \brief Dictionary size in bytes + * + * Dictionary size indicates how many bytes of the recently processed + * uncompressed data is kept in memory. One method to reduce size of + * the uncompressed data is to store distance-length pairs, which + * indicate what data to repeat from the dictionary buffer. Thus, + * the bigger the dictionary, the better the compression ratio + * usually is. + * + * Maximum size of the dictionary depends on multiple things: + * - Memory usage limit + * - Available address space (not a problem on 64-bit systems) + * - Selected match finder (encoder only) + * + * Currently the maximum dictionary size for encoding is 1.5 GiB + * (i.e. (UINT32_C(1) << 30) + (UINT32_C(1) << 29)) even on 64-bit + * systems for certain match finder implementation reasons. In the + * future, there may be match finders that support bigger + * dictionaries. + * + * Decoder already supports dictionaries up to 4 GiB - 1 B (i.e. + * UINT32_MAX), so increasing the maximum dictionary size of the + * encoder won't cause problems for old decoders. + * + * Because extremely small dictionaries sizes would have unneeded + * overhead in the decoder, the minimum dictionary size is 4096 bytes. + * + * \note When decoding, too big dictionary does no other harm + * than wasting memory. + */ + uint32_t dict_size; +# define LZMA_DICT_SIZE_MIN UINT32_C(4096) +# define LZMA_DICT_SIZE_DEFAULT (UINT32_C(1) << 23) + + /** + * \brief Pointer to an initial dictionary + * + * It is possible to initialize the LZ77 history window using + * a preset dictionary. It is useful when compressing many + * similar, relatively small chunks of data independently from + * each other. The preset dictionary should contain typical + * strings that occur in the files being compressed. The most + * probable strings should be near the end of the preset dictionary. + * + * This feature should be used only in special situations. For + * now, it works correctly only with raw encoding and decoding. + * Currently none of the container formats supported by + * liblzma allow preset dictionary when decoding, thus if + * you create a .xz or .lzma file with preset dictionary, it + * cannot be decoded with the regular decoder functions. In the + * future, the .xz format will likely get support for preset + * dictionary though. + */ + const uint8_t *preset_dict; + + /** + * \brief Size of the preset dictionary + * + * Specifies the size of the preset dictionary. If the size is + * bigger than dict_size, only the last dict_size bytes are + * processed. + * + * This variable is read only when preset_dict is not NULL. + * If preset_dict is not NULL but preset_dict_size is zero, + * no preset dictionary is used (identical to only setting + * preset_dict to NULL). + */ + uint32_t preset_dict_size; + + /** + * \brief Number of literal context bits + * + * How many of the highest bits of the previous uncompressed + * eight-bit byte (also known as `literal') are taken into + * account when predicting the bits of the next literal. + * + * E.g. in typical English text, an upper-case letter is + * often followed by a lower-case letter, and a lower-case + * letter is usually followed by another lower-case letter. + * In the US-ASCII character set, the highest three bits are 010 + * for upper-case letters and 011 for lower-case letters. + * When lc is at least 3, the literal coding can take advantage of + * this property in the uncompressed data. + * + * There is a limit that applies to literal context bits and literal + * position bits together: lc + lp <= 4. Without this limit the + * decoding could become very slow, which could have security related + * results in some cases like email servers doing virus scanning. + * This limit also simplifies the internal implementation in liblzma. + * + * There may be LZMA1 streams that have lc + lp > 4 (maximum possible + * lc would be 8). It is not possible to decode such streams with + * liblzma. + */ + uint32_t lc; +# define LZMA_LCLP_MIN 0 +# define LZMA_LCLP_MAX 4 +# define LZMA_LC_DEFAULT 3 + + /** + * \brief Number of literal position bits + * + * lp affects what kind of alignment in the uncompressed data is + * assumed when encoding literals. A literal is a single 8-bit byte. + * See pb below for more information about alignment. + */ + uint32_t lp; +# define LZMA_LP_DEFAULT 0 + + /** + * \brief Number of position bits + * + * pb affects what kind of alignment in the uncompressed data is + * assumed in general. The default means four-byte alignment + * (2^ pb =2^2=4), which is often a good choice when there's + * no better guess. + * + * When the aligment is known, setting pb accordingly may reduce + * the file size a little. E.g. with text files having one-byte + * alignment (US-ASCII, ISO-8859-*, UTF-8), setting pb=0 can + * improve compression slightly. For UTF-16 text, pb=1 is a good + * choice. If the alignment is an odd number like 3 bytes, pb=0 + * might be the best choice. + * + * Even though the assumed alignment can be adjusted with pb and + * lp, LZMA1 and LZMA2 still slightly favor 16-byte alignment. + * It might be worth taking into account when designing file formats + * that are likely to be often compressed with LZMA1 or LZMA2. + */ + uint32_t pb; +# define LZMA_PB_MIN 0 +# define LZMA_PB_MAX 4 +# define LZMA_PB_DEFAULT 2 + + /** Compression mode */ + lzma_mode mode; + + /** + * \brief Nice length of a match + * + * This determines how many bytes the encoder compares from the match + * candidates when looking for the best match. Once a match of at + * least nice_len bytes long is found, the encoder stops looking for + * better candidates and encodes the match. (Naturally, if the found + * match is actually longer than nice_len, the actual length is + * encoded; it's not truncated to nice_len.) + * + * Bigger values usually increase the compression ratio and + * compression time. For most files, 32 to 128 is a good value, + * which gives very good compression ratio at good speed. + * + * The exact minimum value depends on the match finder. The maximum + * is 273, which is the maximum length of a match that LZMA1 and + * LZMA2 can encode. + */ + uint32_t nice_len; + + /** Match finder ID */ + lzma_match_finder mf; + + /** + * \brief Maximum search depth in the match finder + * + * For every input byte, match finder searches through the hash chain + * or binary tree in a loop, each iteration going one step deeper in + * the chain or tree. The searching stops if + * - a match of at least nice_len bytes long is found; + * - all match candidates from the hash chain or binary tree have + * been checked; or + * - maximum search depth is reached. + * + * Maximum search depth is needed to prevent the match finder from + * wasting too much time in case there are lots of short match + * candidates. On the other hand, stopping the search before all + * candidates have been checked can reduce compression ratio. + * + * Setting depth to zero tells liblzma to use an automatic default + * value, that depends on the selected match finder and nice_len. + * The default is in the range [4, 200] or so (it may vary between + * liblzma versions). + * + * Using a bigger depth value than the default can increase + * compression ratio in some cases. There is no strict maximum value, + * but high values (thousands or millions) should be used with care: + * the encoder could remain fast enough with typical input, but + * malicious input could cause the match finder to slow down + * dramatically, possibly creating a denial of service attack. + */ + uint32_t depth; + + /* + * Reserved space to allow possible future extensions without + * breaking the ABI. You should not touch these, because the names + * of these variables may change. These are and will never be used + * with the currently supported options, so it is safe to leave these + * uninitialized. + */ + uint32_t reserved_int1; + uint32_t reserved_int2; + uint32_t reserved_int3; + uint32_t reserved_int4; + uint32_t reserved_int5; + uint32_t reserved_int6; + uint32_t reserved_int7; + uint32_t reserved_int8; + lzma_reserved_enum reserved_enum1; + lzma_reserved_enum reserved_enum2; + lzma_reserved_enum reserved_enum3; + lzma_reserved_enum reserved_enum4; + void *reserved_ptr1; + void *reserved_ptr2; + +} lzma_options_lzma; + + +/** + * \brief Set a compression preset to lzma_options_lzma structure + * + * 0 is the fastest and 9 is the slowest. These match the switches -0 .. -9 + * of the xz command line tool. In addition, it is possible to bitwise-or + * flags to the preset. Currently only LZMA_PRESET_EXTREME is supported. + * The flags are defined in container.h, because the flags are used also + * with lzma_easy_encoder(). + * + * The preset values are subject to changes between liblzma versions. + * + * This function is available only if LZMA1 or LZMA2 encoder has been enabled + * when building liblzma. + * + * \return On success, false is returned. If the preset is not + * supported, true is returned. + */ +extern LZMA_API(lzma_bool) lzma_lzma_preset( + lzma_options_lzma *options, uint32_t preset) lzma_nothrow; diff --git a/liblzma/api/lzma/stream_flags.h b/liblzma/api/lzma/stream_flags.h new file mode 100644 index 0000000..bbdd408 --- /dev/null +++ b/liblzma/api/lzma/stream_flags.h @@ -0,0 +1,223 @@ +/** + * \file lzma/stream_flags.h + * \brief .xz Stream Header and Stream Footer encoder and decoder + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +# error Never include this file directly. Use instead. +#endif + + +/** + * \brief Size of Stream Header and Stream Footer + * + * Stream Header and Stream Footer have the same size and they are not + * going to change even if a newer version of the .xz file format is + * developed in future. + */ +#define LZMA_STREAM_HEADER_SIZE 12 + + +/** + * \brief Options for encoding/decoding Stream Header and Stream Footer + */ +typedef struct { + /** + * \brief Stream Flags format version + * + * To prevent API and ABI breakages if new features are needed in + * Stream Header or Stream Footer, a version number is used to + * indicate which fields in this structure are in use. For now, + * version must always be zero. With non-zero version, the + * lzma_stream_header_encode() and lzma_stream_footer_encode() + * will return LZMA_OPTIONS_ERROR. + * + * lzma_stream_header_decode() and lzma_stream_footer_decode() + * will always set this to the lowest value that supports all the + * features indicated by the Stream Flags field. The application + * must check that the version number set by the decoding functions + * is supported by the application. Otherwise it is possible that + * the application will decode the Stream incorrectly. + */ + uint32_t version; + + /** + * \brief Backward Size + * + * Backward Size must be a multiple of four bytes. In this Stream + * format version, Backward Size is the size of the Index field. + * + * Backward Size isn't actually part of the Stream Flags field, but + * it is convenient to include in this structure anyway. Backward + * Size is present only in the Stream Footer. There is no need to + * initialize backward_size when encoding Stream Header. + * + * lzma_stream_header_decode() always sets backward_size to + * LZMA_VLI_UNKNOWN so that it is convenient to use + * lzma_stream_flags_compare() when both Stream Header and Stream + * Footer have been decoded. + */ + lzma_vli backward_size; +# define LZMA_BACKWARD_SIZE_MIN 4 +# define LZMA_BACKWARD_SIZE_MAX (LZMA_VLI_C(1) << 34) + + /** + * \brief Check ID + * + * This indicates the type of the integrity check calculated from + * uncompressed data. + */ + lzma_check check; + + /* + * Reserved space to allow possible future extensions without + * breaking the ABI. You should not touch these, because the + * names of these variables may change. + * + * (We will never be able to use all of these since Stream Flags + * is just two bytes plus Backward Size of four bytes. But it's + * nice to have the proper types when they are needed.) + */ + lzma_reserved_enum reserved_enum1; + lzma_reserved_enum reserved_enum2; + lzma_reserved_enum reserved_enum3; + lzma_reserved_enum reserved_enum4; + lzma_bool reserved_bool1; + lzma_bool reserved_bool2; + lzma_bool reserved_bool3; + lzma_bool reserved_bool4; + lzma_bool reserved_bool5; + lzma_bool reserved_bool6; + lzma_bool reserved_bool7; + lzma_bool reserved_bool8; + uint32_t reserved_int1; + uint32_t reserved_int2; + +} lzma_stream_flags; + + +/** + * \brief Encode Stream Header + * + * \param options Stream Header options to be encoded. + * options->backward_size is ignored and doesn't + * need to be initialized. + * \param out Beginning of the output buffer of + * LZMA_STREAM_HEADER_SIZE bytes. + * + * \return - LZMA_OK: Encoding was successful. + * - LZMA_OPTIONS_ERROR: options->version is not supported by + * this liblzma version. + * - LZMA_PROG_ERROR: Invalid options. + */ +extern LZMA_API(lzma_ret) lzma_stream_header_encode( + const lzma_stream_flags *options, uint8_t *out) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Encode Stream Footer + * + * \param options Stream Footer options to be encoded. + * \param out Beginning of the output buffer of + * LZMA_STREAM_HEADER_SIZE bytes. + * + * \return - LZMA_OK: Encoding was successful. + * - LZMA_OPTIONS_ERROR: options->version is not supported by + * this liblzma version. + * - LZMA_PROG_ERROR: Invalid options. + */ +extern LZMA_API(lzma_ret) lzma_stream_footer_encode( + const lzma_stream_flags *options, uint8_t *out) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Decode Stream Header + * + * \param options Target for the decoded Stream Header options. + * \param in Beginning of the input buffer of + * LZMA_STREAM_HEADER_SIZE bytes. + * + * options->backward_size is always set to LZMA_VLI_UNKNOWN. This is to + * help comparing Stream Flags from Stream Header and Stream Footer with + * lzma_stream_flags_compare(). + * + * \return - LZMA_OK: Decoding was successful. + * - LZMA_FORMAT_ERROR: Magic bytes don't match, thus the given + * buffer cannot be Stream Header. + * - LZMA_DATA_ERROR: CRC32 doesn't match, thus the header + * is corrupt. + * - LZMA_OPTIONS_ERROR: Unsupported options are present + * in the header. + * + * \note When decoding .xz files that contain multiple Streams, it may + * make sense to print "file format not recognized" only if + * decoding of the Stream Header of the _first_ Stream gives + * LZMA_FORMAT_ERROR. If non-first Stream Header gives + * LZMA_FORMAT_ERROR, the message used for LZMA_DATA_ERROR is + * probably more appropriate. + * + * For example, Stream decoder in liblzma uses LZMA_DATA_ERROR if + * LZMA_FORMAT_ERROR is returned by lzma_stream_header_decode() + * when decoding non-first Stream. + */ +extern LZMA_API(lzma_ret) lzma_stream_header_decode( + lzma_stream_flags *options, const uint8_t *in) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Decode Stream Footer + * + * \param options Target for the decoded Stream Header options. + * \param in Beginning of the input buffer of + * LZMA_STREAM_HEADER_SIZE bytes. + * + * \return - LZMA_OK: Decoding was successful. + * - LZMA_FORMAT_ERROR: Magic bytes don't match, thus the given + * buffer cannot be Stream Footer. + * - LZMA_DATA_ERROR: CRC32 doesn't match, thus the Stream Footer + * is corrupt. + * - LZMA_OPTIONS_ERROR: Unsupported options are present + * in Stream Footer. + * + * \note If Stream Header was already decoded successfully, but + * decoding Stream Footer returns LZMA_FORMAT_ERROR, the + * application should probably report some other error message + * than "file format not recognized", since the file more likely + * is corrupt (possibly truncated). Stream decoder in liblzma + * uses LZMA_DATA_ERROR in this situation. + */ +extern LZMA_API(lzma_ret) lzma_stream_footer_decode( + lzma_stream_flags *options, const uint8_t *in) + lzma_nothrow lzma_attr_warn_unused_result; + + +/** + * \brief Compare two lzma_stream_flags structures + * + * backward_size values are compared only if both are not + * LZMA_VLI_UNKNOWN. + * + * \return - LZMA_OK: Both are equal. If either had backward_size set + * to LZMA_VLI_UNKNOWN, backward_size values were not + * compared or validated. + * - LZMA_DATA_ERROR: The structures differ. + * - LZMA_OPTIONS_ERROR: version in either structure is greater + * than the maximum supported version (currently zero). + * - LZMA_PROG_ERROR: Invalid value, e.g. invalid check or + * backward_size. + */ +extern LZMA_API(lzma_ret) lzma_stream_flags_compare( + const lzma_stream_flags *a, const lzma_stream_flags *b) + lzma_nothrow lzma_attr_pure; diff --git a/liblzma/api/lzma/version.h b/liblzma/api/lzma/version.h new file mode 100644 index 0000000..66e9396 --- /dev/null +++ b/liblzma/api/lzma/version.h @@ -0,0 +1,121 @@ +/** + * \file lzma/version.h + * \brief Version number + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +# error Never include this file directly. Use instead. +#endif + + +/* + * Version number split into components + */ +#define LZMA_VERSION_MAJOR 5 +#define LZMA_VERSION_MINOR 0 +#define LZMA_VERSION_PATCH 5 +#define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE + +#ifndef LZMA_VERSION_COMMIT +# define LZMA_VERSION_COMMIT "" +#endif + + +/* + * Map symbolic stability levels to integers. + */ +#define LZMA_VERSION_STABILITY_ALPHA 0 +#define LZMA_VERSION_STABILITY_BETA 1 +#define LZMA_VERSION_STABILITY_STABLE 2 + + +/** + * \brief Compile-time version number + * + * The version number is of format xyyyzzzs where + * - x = major + * - yyy = minor + * - zzz = revision + * - s indicates stability: 0 = alpha, 1 = beta, 2 = stable + * + * The same xyyyzzz triplet is never reused with different stability levels. + * For example, if 5.1.0alpha has been released, there will never be 5.1.0beta + * or 5.1.0 stable. + * + * \note The version number of liblzma has nothing to with + * the version number of Igor Pavlov's LZMA SDK. + */ +#define LZMA_VERSION (LZMA_VERSION_MAJOR * UINT32_C(10000000) \ + + LZMA_VERSION_MINOR * UINT32_C(10000) \ + + LZMA_VERSION_PATCH * UINT32_C(10) \ + + LZMA_VERSION_STABILITY) + + +/* + * Macros to construct the compile-time version string + */ +#if LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_ALPHA +# define LZMA_VERSION_STABILITY_STRING "alpha" +#elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_BETA +# define LZMA_VERSION_STABILITY_STRING "beta" +#elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_STABLE +# define LZMA_VERSION_STABILITY_STRING "" +#else +# error Incorrect LZMA_VERSION_STABILITY +#endif + +#define LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit) \ + #major "." #minor "." #patch stability commit + +#define LZMA_VERSION_STRING_C(major, minor, patch, stability, commit) \ + LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit) + + +/** + * \brief Compile-time version as a string + * + * This can be for example "4.999.5alpha", "4.999.8beta", or "5.0.0" (stable + * versions don't have any "stable" suffix). In future, a snapshot built + * from source code repository may include an additional suffix, for example + * "4.999.8beta-21-g1d92". The commit ID won't be available in numeric form + * in LZMA_VERSION macro. + */ +#define LZMA_VERSION_STRING LZMA_VERSION_STRING_C( \ + LZMA_VERSION_MAJOR, LZMA_VERSION_MINOR, \ + LZMA_VERSION_PATCH, LZMA_VERSION_STABILITY_STRING, \ + LZMA_VERSION_COMMIT) + + +/* #ifndef is needed for use with windres (MinGW or Cygwin). */ +#ifndef LZMA_H_INTERNAL_RC + +/** + * \brief Run-time version number as an integer + * + * Return the value of LZMA_VERSION macro at the compile time of liblzma. + * This allows the application to compare if it was built against the same, + * older, or newer version of liblzma that is currently running. + */ +extern LZMA_API(uint32_t) lzma_version_number(void) + lzma_nothrow lzma_attr_const; + + +/** + * \brief Run-time version as a string + * + * This function may be useful if you want to display which version of + * liblzma your application is currently using. + */ +extern LZMA_API(const char *) lzma_version_string(void) + lzma_nothrow lzma_attr_const; + +#endif diff --git a/liblzma/api/lzma/vli.h b/liblzma/api/lzma/vli.h new file mode 100644 index 0000000..9ad13f2 --- /dev/null +++ b/liblzma/api/lzma/vli.h @@ -0,0 +1,166 @@ +/** + * \file lzma/vli.h + * \brief Variable-length integer handling + * + * In the .xz format, most integers are encoded in a variable-length + * representation, which is sometimes called little endian base-128 encoding. + * This saves space when smaller values are more likely than bigger values. + * + * The encoding scheme encodes seven bits to every byte, using minimum + * number of bytes required to represent the given value. Encodings that use + * non-minimum number of bytes are invalid, thus every integer has exactly + * one encoded representation. The maximum number of bits in a VLI is 63, + * thus the vli argument must be less than or equal to UINT64_MAX / 2. You + * should use LZMA_VLI_MAX for clarity. + */ + +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * See ../lzma.h for information about liblzma as a whole. + */ + +#ifndef LZMA_H_INTERNAL +# error Never include this file directly. Use instead. +#endif + + +/** + * \brief Maximum supported value of a variable-length integer + */ +#define LZMA_VLI_MAX (UINT64_MAX / 2) + +/** + * \brief VLI value to denote that the value is unknown + */ +#define LZMA_VLI_UNKNOWN UINT64_MAX + +/** + * \brief Maximum supported encoded length of variable length integers + */ +#define LZMA_VLI_BYTES_MAX 9 + +/** + * \brief VLI constant suffix + */ +#define LZMA_VLI_C(n) UINT64_C(n) + + +/** + * \brief Variable-length integer type + * + * Valid VLI values are in the range [0, LZMA_VLI_MAX]. Unknown value is + * indicated with LZMA_VLI_UNKNOWN, which is the maximum value of the + * underlaying integer type. + * + * lzma_vli will be uint64_t for the foreseeable future. If a bigger size + * is needed in the future, it is guaranteed that 2 * LZMA_VLI_MAX will + * not overflow lzma_vli. This simplifies integer overflow detection. + */ +typedef uint64_t lzma_vli; + + +/** + * \brief Validate a variable-length integer + * + * This is useful to test that application has given acceptable values + * for example in the uncompressed_size and compressed_size variables. + * + * \return True if the integer is representable as VLI or if it + * indicates unknown value. + */ +#define lzma_vli_is_valid(vli) \ + ((vli) <= LZMA_VLI_MAX || (vli) == LZMA_VLI_UNKNOWN) + + +/** + * \brief Encode a variable-length integer + * + * This function has two modes: single-call and multi-call. Single-call mode + * encodes the whole integer at once; it is an error if the output buffer is + * too small. Multi-call mode saves the position in *vli_pos, and thus it is + * possible to continue encoding if the buffer becomes full before the whole + * integer has been encoded. + * + * \param vli Integer to be encoded + * \param vli_pos How many VLI-encoded bytes have already been written + * out. When starting to encode a new integer in + * multi-call mode, *vli_pos must be set to zero. + * To use single-call encoding, set vli_pos to NULL. + * \param out Beginning of the output buffer + * \param out_pos The next byte will be written to out[*out_pos]. + * \param out_size Size of the out buffer; the first byte into + * which no data is written to is out[out_size]. + * + * \return Slightly different return values are used in multi-call and + * single-call modes. + * + * Single-call (vli_pos == NULL): + * - LZMA_OK: Integer successfully encoded. + * - LZMA_PROG_ERROR: Arguments are not sane. This can be due + * to too little output space; single-call mode doesn't use + * LZMA_BUF_ERROR, since the application should have checked + * the encoded size with lzma_vli_size(). + * + * Multi-call (vli_pos != NULL): + * - LZMA_OK: So far all OK, but the integer is not + * completely written out yet. + * - LZMA_STREAM_END: Integer successfully encoded. + * - LZMA_BUF_ERROR: No output space was provided. + * - LZMA_PROG_ERROR: Arguments are not sane. + */ +extern LZMA_API(lzma_ret) lzma_vli_encode(lzma_vli vli, size_t *vli_pos, + uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow; + + +/** + * \brief Decode a variable-length integer + * + * Like lzma_vli_encode(), this function has single-call and multi-call modes. + * + * \param vli Pointer to decoded integer. The decoder will + * initialize it to zero when *vli_pos == 0, so + * application isn't required to initialize *vli. + * \param vli_pos How many bytes have already been decoded. When + * starting to decode a new integer in multi-call + * mode, *vli_pos must be initialized to zero. To + * use single-call decoding, set vli_pos to NULL. + * \param in Beginning of the input buffer + * \param in_pos The next byte will be read from in[*in_pos]. + * \param in_size Size of the input buffer; the first byte that + * won't be read is in[in_size]. + * + * \return Slightly different return values are used in multi-call and + * single-call modes. + * + * Single-call (vli_pos == NULL): + * - LZMA_OK: Integer successfully decoded. + * - LZMA_DATA_ERROR: Integer is corrupt. This includes hitting + * the end of the input buffer before the whole integer was + * decoded; providing no input at all will use LZMA_DATA_ERROR. + * - LZMA_PROG_ERROR: Arguments are not sane. + * + * Multi-call (vli_pos != NULL): + * - LZMA_OK: So far all OK, but the integer is not + * completely decoded yet. + * - LZMA_STREAM_END: Integer successfully decoded. + * - LZMA_DATA_ERROR: Integer is corrupt. + * - LZMA_BUF_ERROR: No input was provided. + * - LZMA_PROG_ERROR: Arguments are not sane. + */ +extern LZMA_API(lzma_ret) lzma_vli_decode(lzma_vli *vli, size_t *vli_pos, + const uint8_t *in, size_t *in_pos, size_t in_size) + lzma_nothrow; + + +/** + * \brief Get the number of bytes required to encode a VLI + * + * \return Number of bytes on success (1-9). If vli isn't valid, + * zero is returned. + */ +extern LZMA_API(uint32_t) lzma_vli_size(lzma_vli vli) + lzma_nothrow lzma_attr_pure; diff --git a/liblzma/check/Makefile.inc b/liblzma/check/Makefile.inc new file mode 100644 index 0000000..e4067a9 --- /dev/null +++ b/liblzma/check/Makefile.inc @@ -0,0 +1,51 @@ +## +## Author: Lasse Collin +## +## This file has been put into the public domain. +## You can do whatever you want with this file. +## + +EXTRA_DIST += \ + check/crc32_tablegen.c \ + check/crc64_tablegen.c + +liblzma_la_SOURCES += \ + check/check.c \ + check/check.h \ + check/crc_macros.h + +if COND_CHECK_CRC32 +if COND_SMALL +liblzma_la_SOURCES += check/crc32_small.c +else +liblzma_la_SOURCES += \ + check/crc32_table.c \ + check/crc32_table_le.h \ + check/crc32_table_be.h +if COND_ASM_X86 +liblzma_la_SOURCES += check/crc32_x86.S +else +liblzma_la_SOURCES += check/crc32_fast.c +endif +endif +endif + +if COND_CHECK_CRC64 +if COND_SMALL +liblzma_la_SOURCES += check/crc64_small.c +else +liblzma_la_SOURCES += \ + check/crc64_table.c \ + check/crc64_table_le.h \ + check/crc64_table_be.h +if COND_ASM_X86 +liblzma_la_SOURCES += check/crc64_x86.S +else +liblzma_la_SOURCES += check/crc64_fast.c +endif +endif +endif + +if COND_CHECK_SHA256 +liblzma_la_SOURCES += check/sha256.c +endif diff --git a/liblzma/check/check.c b/liblzma/check/check.c new file mode 100644 index 0000000..428ddae --- /dev/null +++ b/liblzma/check/check.c @@ -0,0 +1,174 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file check.c +/// \brief Single API to access different integrity checks +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "check.h" + + +extern LZMA_API(lzma_bool) +lzma_check_is_supported(lzma_check type) +{ + if ((unsigned int)(type) > LZMA_CHECK_ID_MAX) + return false; + + static const lzma_bool available_checks[LZMA_CHECK_ID_MAX + 1] = { + true, // LZMA_CHECK_NONE + +#ifdef HAVE_CHECK_CRC32 + true, +#else + false, +#endif + + false, // Reserved + false, // Reserved + +#ifdef HAVE_CHECK_CRC64 + true, +#else + false, +#endif + + false, // Reserved + false, // Reserved + false, // Reserved + false, // Reserved + false, // Reserved + +#ifdef HAVE_CHECK_SHA256 + true, +#else + false, +#endif + + false, // Reserved + false, // Reserved + false, // Reserved + false, // Reserved + false, // Reserved + }; + + return available_checks[(unsigned int)(type)]; +} + + +extern LZMA_API(uint32_t) +lzma_check_size(lzma_check type) +{ + if ((unsigned int)(type) > LZMA_CHECK_ID_MAX) + return UINT32_MAX; + + // See file-format.txt section 2.1.1.2. + static const uint8_t check_sizes[LZMA_CHECK_ID_MAX + 1] = { + 0, + 4, 4, 4, + 8, 8, 8, + 16, 16, 16, + 32, 32, 32, + 64, 64, 64 + }; + + return check_sizes[(unsigned int)(type)]; +} + + +extern void +lzma_check_init(lzma_check_state *check, lzma_check type) +{ + switch (type) { + case LZMA_CHECK_NONE: + break; + +#ifdef HAVE_CHECK_CRC32 + case LZMA_CHECK_CRC32: + check->state.crc32 = 0; + break; +#endif + +#ifdef HAVE_CHECK_CRC64 + case LZMA_CHECK_CRC64: + check->state.crc64 = 0; + break; +#endif + +#ifdef HAVE_CHECK_SHA256 + case LZMA_CHECK_SHA256: + lzma_sha256_init(check); + break; +#endif + + default: + break; + } + + return; +} + + +extern void +lzma_check_update(lzma_check_state *check, lzma_check type, + const uint8_t *buf, size_t size) +{ + switch (type) { +#ifdef HAVE_CHECK_CRC32 + case LZMA_CHECK_CRC32: + check->state.crc32 = lzma_crc32(buf, size, check->state.crc32); + break; +#endif + +#ifdef HAVE_CHECK_CRC64 + case LZMA_CHECK_CRC64: + check->state.crc64 = lzma_crc64(buf, size, check->state.crc64); + break; +#endif + +#ifdef HAVE_CHECK_SHA256 + case LZMA_CHECK_SHA256: + lzma_sha256_update(buf, size, check); + break; +#endif + + default: + break; + } + + return; +} + + +extern void +lzma_check_finish(lzma_check_state *check, lzma_check type) +{ + switch (type) { +#ifdef HAVE_CHECK_CRC32 + case LZMA_CHECK_CRC32: + check->buffer.u32[0] = conv32le(check->state.crc32); + break; +#endif + +#ifdef HAVE_CHECK_CRC64 + case LZMA_CHECK_CRC64: + check->buffer.u64[0] = conv64le(check->state.crc64); + break; +#endif + +#ifdef HAVE_CHECK_SHA256 + case LZMA_CHECK_SHA256: + lzma_sha256_finish(check); + break; +#endif + + default: + break; + } + + return; +} diff --git a/liblzma/check/check.h b/liblzma/check/check.h new file mode 100644 index 0000000..e100d2b --- /dev/null +++ b/liblzma/check/check.h @@ -0,0 +1,95 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file check.h +/// \brief Internal API to different integrity check functions +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_CHECK_H +#define LZMA_CHECK_H + +#include "common.h" + + +// Index hashing needs the best possible hash function (preferably +// a cryptographic hash) for maximum reliability. +#if defined(HAVE_CHECK_SHA256) +# define LZMA_CHECK_BEST LZMA_CHECK_SHA256 +#elif defined(HAVE_CHECK_CRC64) +# define LZMA_CHECK_BEST LZMA_CHECK_CRC64 +#else +# define LZMA_CHECK_BEST LZMA_CHECK_CRC32 +#endif + + +/// \brief Structure to hold internal state of the check being calculated +/// +/// \note This is not in the public API because this structure may +/// change in future if new integrity check algorithms are added. +typedef struct { + /// Buffer to hold the final result and a temporary buffer for SHA256. + union { + uint8_t u8[64]; + uint32_t u32[16]; + uint64_t u64[8]; + } buffer; + + /// Check-specific data + union { + uint32_t crc32; + uint64_t crc64; + + struct { + /// Internal state + uint32_t state[8]; + + /// Size of the message excluding padding + uint64_t size; + } sha256; + } state; + +} lzma_check_state; + + +/// lzma_crc32_table[0] is needed by LZ encoder so we need to keep +/// the array two-dimensional. +#ifdef HAVE_SMALL +extern uint32_t lzma_crc32_table[1][256]; +extern void lzma_crc32_init(void); +#else +extern const uint32_t lzma_crc32_table[8][256]; +extern const uint64_t lzma_crc64_table[4][256]; +#endif + + +/// \brief Initialize *check depending on type +/// +/// \return LZMA_OK on success. LZMA_UNSUPPORTED_CHECK if the type is not +/// supported by the current version or build of liblzma. +/// LZMA_PROG_ERROR if type > LZMA_CHECK_ID_MAX. +extern void lzma_check_init(lzma_check_state *check, lzma_check type); + +/// Update the check state +extern void lzma_check_update(lzma_check_state *check, lzma_check type, + const uint8_t *buf, size_t size); + +/// Finish the check calculation and store the result to check->buffer.u8. +extern void lzma_check_finish(lzma_check_state *check, lzma_check type); + + +/// Prepare SHA-256 state for new input. +extern void lzma_sha256_init(lzma_check_state *check); + +/// Update the SHA-256 hash state +extern void lzma_sha256_update( + const uint8_t *buf, size_t size, lzma_check_state *check); + +/// Finish the SHA-256 calculation and store the result to check->buffer.u8. +extern void lzma_sha256_finish(lzma_check_state *check); + +#endif diff --git a/liblzma/check/crc32_fast.c b/liblzma/check/crc32_fast.c new file mode 100644 index 0000000..94da855 --- /dev/null +++ b/liblzma/check/crc32_fast.c @@ -0,0 +1,82 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file crc32.c +/// \brief CRC32 calculation +/// +/// Calculate the CRC32 using the slice-by-eight algorithm. +/// It is explained in this document: +/// http://www.intel.com/technology/comms/perfnet/download/CRC_generators.pdf +/// The code in this file is not the same as in Intel's paper, but +/// the basic principle is identical. +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "check.h" +#include "crc_macros.h" + + +// If you make any changes, do some bench marking! Seemingly unrelated +// changes can very easily ruin the performance (and very probably is +// very compiler dependent). +extern LZMA_API(uint32_t) +lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) +{ + crc = ~crc; + +#ifdef WORDS_BIGENDIAN + crc = bswap32(crc); +#endif + + if (size > 8) { + // Fix the alignment, if needed. The if statement above + // ensures that this won't read past the end of buf[]. + while ((uintptr_t)(buf) & 7) { + crc = lzma_crc32_table[0][*buf++ ^ A(crc)] ^ S8(crc); + --size; + } + + // Calculate the position where to stop. + const uint8_t *const limit = buf + (size & ~(size_t)(7)); + + // Calculate how many bytes must be calculated separately + // before returning the result. + size &= (size_t)(7); + + // Calculate the CRC32 using the slice-by-eight algorithm. + while (buf < limit) { + crc ^= *(const uint32_t *)(buf); + buf += 4; + + crc = lzma_crc32_table[7][A(crc)] + ^ lzma_crc32_table[6][B(crc)] + ^ lzma_crc32_table[5][C(crc)] + ^ lzma_crc32_table[4][D(crc)]; + + const uint32_t tmp = *(const uint32_t *)(buf); + buf += 4; + + // At least with some compilers, it is critical for + // performance, that the crc variable is XORed + // between the two table-lookup pairs. + crc = lzma_crc32_table[3][A(tmp)] + ^ lzma_crc32_table[2][B(tmp)] + ^ crc + ^ lzma_crc32_table[1][C(tmp)] + ^ lzma_crc32_table[0][D(tmp)]; + } + } + + while (size-- != 0) + crc = lzma_crc32_table[0][*buf++ ^ A(crc)] ^ S8(crc); + +#ifdef WORDS_BIGENDIAN + crc = bswap32(crc); +#endif + + return ~crc; +} diff --git a/liblzma/check/crc32_small.c b/liblzma/check/crc32_small.c new file mode 100644 index 0000000..5f8a328 --- /dev/null +++ b/liblzma/check/crc32_small.c @@ -0,0 +1,61 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file crc32_small.c +/// \brief CRC32 calculation (size-optimized) +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "check.h" + + +uint32_t lzma_crc32_table[1][256]; + + +static void +crc32_init(void) +{ + static const uint32_t poly32 = UINT32_C(0xEDB88320); + + for (size_t b = 0; b < 256; ++b) { + uint32_t r = b; + for (size_t i = 0; i < 8; ++i) { + if (r & 1) + r = (r >> 1) ^ poly32; + else + r >>= 1; + } + + lzma_crc32_table[0][b] = r; + } + + return; +} + + +extern void +lzma_crc32_init(void) +{ + mythread_once(crc32_init); + return; +} + + +extern LZMA_API(uint32_t) +lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) +{ + lzma_crc32_init(); + + crc = ~crc; + + while (size != 0) { + crc = lzma_crc32_table[0][*buf++ ^ (crc & 0xFF)] ^ (crc >> 8); + --size; + } + + return ~crc; +} diff --git a/liblzma/check/crc32_table.c b/liblzma/check/crc32_table.c new file mode 100644 index 0000000..368874e --- /dev/null +++ b/liblzma/check/crc32_table.c @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file crc32_table.c +/// \brief Precalculated CRC32 table with correct endianness +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "common.h" + +#ifdef WORDS_BIGENDIAN +# include "crc32_table_be.h" +#else +# include "crc32_table_le.h" +#endif diff --git a/liblzma/check/crc32_table_be.h b/liblzma/check/crc32_table_be.h new file mode 100644 index 0000000..c483cb6 --- /dev/null +++ b/liblzma/check/crc32_table_be.h @@ -0,0 +1,525 @@ +/* This file has been automatically generated by crc32_tablegen.c. */ + +const uint32_t lzma_crc32_table[8][256] = { + { + 0x00000000, 0x96300777, 0x2C610EEE, 0xBA510999, + 0x19C46D07, 0x8FF46A70, 0x35A563E9, 0xA395649E, + 0x3288DB0E, 0xA4B8DC79, 0x1EE9D5E0, 0x88D9D297, + 0x2B4CB609, 0xBD7CB17E, 0x072DB8E7, 0x911DBF90, + 0x6410B71D, 0xF220B06A, 0x4871B9F3, 0xDE41BE84, + 0x7DD4DA1A, 0xEBE4DD6D, 0x51B5D4F4, 0xC785D383, + 0x56986C13, 0xC0A86B64, 0x7AF962FD, 0xECC9658A, + 0x4F5C0114, 0xD96C0663, 0x633D0FFA, 0xF50D088D, + 0xC8206E3B, 0x5E10694C, 0xE44160D5, 0x727167A2, + 0xD1E4033C, 0x47D4044B, 0xFD850DD2, 0x6BB50AA5, + 0xFAA8B535, 0x6C98B242, 0xD6C9BBDB, 0x40F9BCAC, + 0xE36CD832, 0x755CDF45, 0xCF0DD6DC, 0x593DD1AB, + 0xAC30D926, 0x3A00DE51, 0x8051D7C8, 0x1661D0BF, + 0xB5F4B421, 0x23C4B356, 0x9995BACF, 0x0FA5BDB8, + 0x9EB80228, 0x0888055F, 0xB2D90CC6, 0x24E90BB1, + 0x877C6F2F, 0x114C6858, 0xAB1D61C1, 0x3D2D66B6, + 0x9041DC76, 0x0671DB01, 0xBC20D298, 0x2A10D5EF, + 0x8985B171, 0x1FB5B606, 0xA5E4BF9F, 0x33D4B8E8, + 0xA2C90778, 0x34F9000F, 0x8EA80996, 0x18980EE1, + 0xBB0D6A7F, 0x2D3D6D08, 0x976C6491, 0x015C63E6, + 0xF4516B6B, 0x62616C1C, 0xD8306585, 0x4E0062F2, + 0xED95066C, 0x7BA5011B, 0xC1F40882, 0x57C40FF5, + 0xC6D9B065, 0x50E9B712, 0xEAB8BE8B, 0x7C88B9FC, + 0xDF1DDD62, 0x492DDA15, 0xF37CD38C, 0x654CD4FB, + 0x5861B24D, 0xCE51B53A, 0x7400BCA3, 0xE230BBD4, + 0x41A5DF4A, 0xD795D83D, 0x6DC4D1A4, 0xFBF4D6D3, + 0x6AE96943, 0xFCD96E34, 0x468867AD, 0xD0B860DA, + 0x732D0444, 0xE51D0333, 0x5F4C0AAA, 0xC97C0DDD, + 0x3C710550, 0xAA410227, 0x10100BBE, 0x86200CC9, + 0x25B56857, 0xB3856F20, 0x09D466B9, 0x9FE461CE, + 0x0EF9DE5E, 0x98C9D929, 0x2298D0B0, 0xB4A8D7C7, + 0x173DB359, 0x810DB42E, 0x3B5CBDB7, 0xAD6CBAC0, + 0x2083B8ED, 0xB6B3BF9A, 0x0CE2B603, 0x9AD2B174, + 0x3947D5EA, 0xAF77D29D, 0x1526DB04, 0x8316DC73, + 0x120B63E3, 0x843B6494, 0x3E6A6D0D, 0xA85A6A7A, + 0x0BCF0EE4, 0x9DFF0993, 0x27AE000A, 0xB19E077D, + 0x44930FF0, 0xD2A30887, 0x68F2011E, 0xFEC20669, + 0x5D5762F7, 0xCB676580, 0x71366C19, 0xE7066B6E, + 0x761BD4FE, 0xE02BD389, 0x5A7ADA10, 0xCC4ADD67, + 0x6FDFB9F9, 0xF9EFBE8E, 0x43BEB717, 0xD58EB060, + 0xE8A3D6D6, 0x7E93D1A1, 0xC4C2D838, 0x52F2DF4F, + 0xF167BBD1, 0x6757BCA6, 0xDD06B53F, 0x4B36B248, + 0xDA2B0DD8, 0x4C1B0AAF, 0xF64A0336, 0x607A0441, + 0xC3EF60DF, 0x55DF67A8, 0xEF8E6E31, 0x79BE6946, + 0x8CB361CB, 0x1A8366BC, 0xA0D26F25, 0x36E26852, + 0x95770CCC, 0x03470BBB, 0xB9160222, 0x2F260555, + 0xBE3BBAC5, 0x280BBDB2, 0x925AB42B, 0x046AB35C, + 0xA7FFD7C2, 0x31CFD0B5, 0x8B9ED92C, 0x1DAEDE5B, + 0xB0C2649B, 0x26F263EC, 0x9CA36A75, 0x0A936D02, + 0xA906099C, 0x3F360EEB, 0x85670772, 0x13570005, + 0x824ABF95, 0x147AB8E2, 0xAE2BB17B, 0x381BB60C, + 0x9B8ED292, 0x0DBED5E5, 0xB7EFDC7C, 0x21DFDB0B, + 0xD4D2D386, 0x42E2D4F1, 0xF8B3DD68, 0x6E83DA1F, + 0xCD16BE81, 0x5B26B9F6, 0xE177B06F, 0x7747B718, + 0xE65A0888, 0x706A0FFF, 0xCA3B0666, 0x5C0B0111, + 0xFF9E658F, 0x69AE62F8, 0xD3FF6B61, 0x45CF6C16, + 0x78E20AA0, 0xEED20DD7, 0x5483044E, 0xC2B30339, + 0x612667A7, 0xF71660D0, 0x4D476949, 0xDB776E3E, + 0x4A6AD1AE, 0xDC5AD6D9, 0x660BDF40, 0xF03BD837, + 0x53AEBCA9, 0xC59EBBDE, 0x7FCFB247, 0xE9FFB530, + 0x1CF2BDBD, 0x8AC2BACA, 0x3093B353, 0xA6A3B424, + 0x0536D0BA, 0x9306D7CD, 0x2957DE54, 0xBF67D923, + 0x2E7A66B3, 0xB84A61C4, 0x021B685D, 0x942B6F2A, + 0x37BE0BB4, 0xA18E0CC3, 0x1BDF055A, 0x8DEF022D + }, { + 0x00000000, 0x41311B19, 0x82623632, 0xC3532D2B, + 0x04C56C64, 0x45F4777D, 0x86A75A56, 0xC796414F, + 0x088AD9C8, 0x49BBC2D1, 0x8AE8EFFA, 0xCBD9F4E3, + 0x0C4FB5AC, 0x4D7EAEB5, 0x8E2D839E, 0xCF1C9887, + 0x5112C24A, 0x1023D953, 0xD370F478, 0x9241EF61, + 0x55D7AE2E, 0x14E6B537, 0xD7B5981C, 0x96848305, + 0x59981B82, 0x18A9009B, 0xDBFA2DB0, 0x9ACB36A9, + 0x5D5D77E6, 0x1C6C6CFF, 0xDF3F41D4, 0x9E0E5ACD, + 0xA2248495, 0xE3159F8C, 0x2046B2A7, 0x6177A9BE, + 0xA6E1E8F1, 0xE7D0F3E8, 0x2483DEC3, 0x65B2C5DA, + 0xAAAE5D5D, 0xEB9F4644, 0x28CC6B6F, 0x69FD7076, + 0xAE6B3139, 0xEF5A2A20, 0x2C09070B, 0x6D381C12, + 0xF33646DF, 0xB2075DC6, 0x715470ED, 0x30656BF4, + 0xF7F32ABB, 0xB6C231A2, 0x75911C89, 0x34A00790, + 0xFBBC9F17, 0xBA8D840E, 0x79DEA925, 0x38EFB23C, + 0xFF79F373, 0xBE48E86A, 0x7D1BC541, 0x3C2ADE58, + 0x054F79F0, 0x447E62E9, 0x872D4FC2, 0xC61C54DB, + 0x018A1594, 0x40BB0E8D, 0x83E823A6, 0xC2D938BF, + 0x0DC5A038, 0x4CF4BB21, 0x8FA7960A, 0xCE968D13, + 0x0900CC5C, 0x4831D745, 0x8B62FA6E, 0xCA53E177, + 0x545DBBBA, 0x156CA0A3, 0xD63F8D88, 0x970E9691, + 0x5098D7DE, 0x11A9CCC7, 0xD2FAE1EC, 0x93CBFAF5, + 0x5CD76272, 0x1DE6796B, 0xDEB55440, 0x9F844F59, + 0x58120E16, 0x1923150F, 0xDA703824, 0x9B41233D, + 0xA76BFD65, 0xE65AE67C, 0x2509CB57, 0x6438D04E, + 0xA3AE9101, 0xE29F8A18, 0x21CCA733, 0x60FDBC2A, + 0xAFE124AD, 0xEED03FB4, 0x2D83129F, 0x6CB20986, + 0xAB2448C9, 0xEA1553D0, 0x29467EFB, 0x687765E2, + 0xF6793F2F, 0xB7482436, 0x741B091D, 0x352A1204, + 0xF2BC534B, 0xB38D4852, 0x70DE6579, 0x31EF7E60, + 0xFEF3E6E7, 0xBFC2FDFE, 0x7C91D0D5, 0x3DA0CBCC, + 0xFA368A83, 0xBB07919A, 0x7854BCB1, 0x3965A7A8, + 0x4B98833B, 0x0AA99822, 0xC9FAB509, 0x88CBAE10, + 0x4F5DEF5F, 0x0E6CF446, 0xCD3FD96D, 0x8C0EC274, + 0x43125AF3, 0x022341EA, 0xC1706CC1, 0x804177D8, + 0x47D73697, 0x06E62D8E, 0xC5B500A5, 0x84841BBC, + 0x1A8A4171, 0x5BBB5A68, 0x98E87743, 0xD9D96C5A, + 0x1E4F2D15, 0x5F7E360C, 0x9C2D1B27, 0xDD1C003E, + 0x120098B9, 0x533183A0, 0x9062AE8B, 0xD153B592, + 0x16C5F4DD, 0x57F4EFC4, 0x94A7C2EF, 0xD596D9F6, + 0xE9BC07AE, 0xA88D1CB7, 0x6BDE319C, 0x2AEF2A85, + 0xED796BCA, 0xAC4870D3, 0x6F1B5DF8, 0x2E2A46E1, + 0xE136DE66, 0xA007C57F, 0x6354E854, 0x2265F34D, + 0xE5F3B202, 0xA4C2A91B, 0x67918430, 0x26A09F29, + 0xB8AEC5E4, 0xF99FDEFD, 0x3ACCF3D6, 0x7BFDE8CF, + 0xBC6BA980, 0xFD5AB299, 0x3E099FB2, 0x7F3884AB, + 0xB0241C2C, 0xF1150735, 0x32462A1E, 0x73773107, + 0xB4E17048, 0xF5D06B51, 0x3683467A, 0x77B25D63, + 0x4ED7FACB, 0x0FE6E1D2, 0xCCB5CCF9, 0x8D84D7E0, + 0x4A1296AF, 0x0B238DB6, 0xC870A09D, 0x8941BB84, + 0x465D2303, 0x076C381A, 0xC43F1531, 0x850E0E28, + 0x42984F67, 0x03A9547E, 0xC0FA7955, 0x81CB624C, + 0x1FC53881, 0x5EF42398, 0x9DA70EB3, 0xDC9615AA, + 0x1B0054E5, 0x5A314FFC, 0x996262D7, 0xD85379CE, + 0x174FE149, 0x567EFA50, 0x952DD77B, 0xD41CCC62, + 0x138A8D2D, 0x52BB9634, 0x91E8BB1F, 0xD0D9A006, + 0xECF37E5E, 0xADC26547, 0x6E91486C, 0x2FA05375, + 0xE836123A, 0xA9070923, 0x6A542408, 0x2B653F11, + 0xE479A796, 0xA548BC8F, 0x661B91A4, 0x272A8ABD, + 0xE0BCCBF2, 0xA18DD0EB, 0x62DEFDC0, 0x23EFE6D9, + 0xBDE1BC14, 0xFCD0A70D, 0x3F838A26, 0x7EB2913F, + 0xB924D070, 0xF815CB69, 0x3B46E642, 0x7A77FD5B, + 0xB56B65DC, 0xF45A7EC5, 0x370953EE, 0x763848F7, + 0xB1AE09B8, 0xF09F12A1, 0x33CC3F8A, 0x72FD2493 + }, { + 0x00000000, 0x376AC201, 0x6ED48403, 0x59BE4602, + 0xDCA80907, 0xEBC2CB06, 0xB27C8D04, 0x85164F05, + 0xB851130E, 0x8F3BD10F, 0xD685970D, 0xE1EF550C, + 0x64F91A09, 0x5393D808, 0x0A2D9E0A, 0x3D475C0B, + 0x70A3261C, 0x47C9E41D, 0x1E77A21F, 0x291D601E, + 0xAC0B2F1B, 0x9B61ED1A, 0xC2DFAB18, 0xF5B56919, + 0xC8F23512, 0xFF98F713, 0xA626B111, 0x914C7310, + 0x145A3C15, 0x2330FE14, 0x7A8EB816, 0x4DE47A17, + 0xE0464D38, 0xD72C8F39, 0x8E92C93B, 0xB9F80B3A, + 0x3CEE443F, 0x0B84863E, 0x523AC03C, 0x6550023D, + 0x58175E36, 0x6F7D9C37, 0x36C3DA35, 0x01A91834, + 0x84BF5731, 0xB3D59530, 0xEA6BD332, 0xDD011133, + 0x90E56B24, 0xA78FA925, 0xFE31EF27, 0xC95B2D26, + 0x4C4D6223, 0x7B27A022, 0x2299E620, 0x15F32421, + 0x28B4782A, 0x1FDEBA2B, 0x4660FC29, 0x710A3E28, + 0xF41C712D, 0xC376B32C, 0x9AC8F52E, 0xADA2372F, + 0xC08D9A70, 0xF7E75871, 0xAE591E73, 0x9933DC72, + 0x1C259377, 0x2B4F5176, 0x72F11774, 0x459BD575, + 0x78DC897E, 0x4FB64B7F, 0x16080D7D, 0x2162CF7C, + 0xA4748079, 0x931E4278, 0xCAA0047A, 0xFDCAC67B, + 0xB02EBC6C, 0x87447E6D, 0xDEFA386F, 0xE990FA6E, + 0x6C86B56B, 0x5BEC776A, 0x02523168, 0x3538F369, + 0x087FAF62, 0x3F156D63, 0x66AB2B61, 0x51C1E960, + 0xD4D7A665, 0xE3BD6464, 0xBA032266, 0x8D69E067, + 0x20CBD748, 0x17A11549, 0x4E1F534B, 0x7975914A, + 0xFC63DE4F, 0xCB091C4E, 0x92B75A4C, 0xA5DD984D, + 0x989AC446, 0xAFF00647, 0xF64E4045, 0xC1248244, + 0x4432CD41, 0x73580F40, 0x2AE64942, 0x1D8C8B43, + 0x5068F154, 0x67023355, 0x3EBC7557, 0x09D6B756, + 0x8CC0F853, 0xBBAA3A52, 0xE2147C50, 0xD57EBE51, + 0xE839E25A, 0xDF53205B, 0x86ED6659, 0xB187A458, + 0x3491EB5D, 0x03FB295C, 0x5A456F5E, 0x6D2FAD5F, + 0x801B35E1, 0xB771F7E0, 0xEECFB1E2, 0xD9A573E3, + 0x5CB33CE6, 0x6BD9FEE7, 0x3267B8E5, 0x050D7AE4, + 0x384A26EF, 0x0F20E4EE, 0x569EA2EC, 0x61F460ED, + 0xE4E22FE8, 0xD388EDE9, 0x8A36ABEB, 0xBD5C69EA, + 0xF0B813FD, 0xC7D2D1FC, 0x9E6C97FE, 0xA90655FF, + 0x2C101AFA, 0x1B7AD8FB, 0x42C49EF9, 0x75AE5CF8, + 0x48E900F3, 0x7F83C2F2, 0x263D84F0, 0x115746F1, + 0x944109F4, 0xA32BCBF5, 0xFA958DF7, 0xCDFF4FF6, + 0x605D78D9, 0x5737BAD8, 0x0E89FCDA, 0x39E33EDB, + 0xBCF571DE, 0x8B9FB3DF, 0xD221F5DD, 0xE54B37DC, + 0xD80C6BD7, 0xEF66A9D6, 0xB6D8EFD4, 0x81B22DD5, + 0x04A462D0, 0x33CEA0D1, 0x6A70E6D3, 0x5D1A24D2, + 0x10FE5EC5, 0x27949CC4, 0x7E2ADAC6, 0x494018C7, + 0xCC5657C2, 0xFB3C95C3, 0xA282D3C1, 0x95E811C0, + 0xA8AF4DCB, 0x9FC58FCA, 0xC67BC9C8, 0xF1110BC9, + 0x740744CC, 0x436D86CD, 0x1AD3C0CF, 0x2DB902CE, + 0x4096AF91, 0x77FC6D90, 0x2E422B92, 0x1928E993, + 0x9C3EA696, 0xAB546497, 0xF2EA2295, 0xC580E094, + 0xF8C7BC9F, 0xCFAD7E9E, 0x9613389C, 0xA179FA9D, + 0x246FB598, 0x13057799, 0x4ABB319B, 0x7DD1F39A, + 0x3035898D, 0x075F4B8C, 0x5EE10D8E, 0x698BCF8F, + 0xEC9D808A, 0xDBF7428B, 0x82490489, 0xB523C688, + 0x88649A83, 0xBF0E5882, 0xE6B01E80, 0xD1DADC81, + 0x54CC9384, 0x63A65185, 0x3A181787, 0x0D72D586, + 0xA0D0E2A9, 0x97BA20A8, 0xCE0466AA, 0xF96EA4AB, + 0x7C78EBAE, 0x4B1229AF, 0x12AC6FAD, 0x25C6ADAC, + 0x1881F1A7, 0x2FEB33A6, 0x765575A4, 0x413FB7A5, + 0xC429F8A0, 0xF3433AA1, 0xAAFD7CA3, 0x9D97BEA2, + 0xD073C4B5, 0xE71906B4, 0xBEA740B6, 0x89CD82B7, + 0x0CDBCDB2, 0x3BB10FB3, 0x620F49B1, 0x55658BB0, + 0x6822D7BB, 0x5F4815BA, 0x06F653B8, 0x319C91B9, + 0xB48ADEBC, 0x83E01CBD, 0xDA5E5ABF, 0xED3498BE + }, { + 0x00000000, 0x6567BCB8, 0x8BC809AA, 0xEEAFB512, + 0x5797628F, 0x32F0DE37, 0xDC5F6B25, 0xB938D79D, + 0xEF28B4C5, 0x8A4F087D, 0x64E0BD6F, 0x018701D7, + 0xB8BFD64A, 0xDDD86AF2, 0x3377DFE0, 0x56106358, + 0x9F571950, 0xFA30A5E8, 0x149F10FA, 0x71F8AC42, + 0xC8C07BDF, 0xADA7C767, 0x43087275, 0x266FCECD, + 0x707FAD95, 0x1518112D, 0xFBB7A43F, 0x9ED01887, + 0x27E8CF1A, 0x428F73A2, 0xAC20C6B0, 0xC9477A08, + 0x3EAF32A0, 0x5BC88E18, 0xB5673B0A, 0xD00087B2, + 0x6938502F, 0x0C5FEC97, 0xE2F05985, 0x8797E53D, + 0xD1878665, 0xB4E03ADD, 0x5A4F8FCF, 0x3F283377, + 0x8610E4EA, 0xE3775852, 0x0DD8ED40, 0x68BF51F8, + 0xA1F82BF0, 0xC49F9748, 0x2A30225A, 0x4F579EE2, + 0xF66F497F, 0x9308F5C7, 0x7DA740D5, 0x18C0FC6D, + 0x4ED09F35, 0x2BB7238D, 0xC518969F, 0xA07F2A27, + 0x1947FDBA, 0x7C204102, 0x928FF410, 0xF7E848A8, + 0x3D58149B, 0x583FA823, 0xB6901D31, 0xD3F7A189, + 0x6ACF7614, 0x0FA8CAAC, 0xE1077FBE, 0x8460C306, + 0xD270A05E, 0xB7171CE6, 0x59B8A9F4, 0x3CDF154C, + 0x85E7C2D1, 0xE0807E69, 0x0E2FCB7B, 0x6B4877C3, + 0xA20F0DCB, 0xC768B173, 0x29C70461, 0x4CA0B8D9, + 0xF5986F44, 0x90FFD3FC, 0x7E5066EE, 0x1B37DA56, + 0x4D27B90E, 0x284005B6, 0xC6EFB0A4, 0xA3880C1C, + 0x1AB0DB81, 0x7FD76739, 0x9178D22B, 0xF41F6E93, + 0x03F7263B, 0x66909A83, 0x883F2F91, 0xED589329, + 0x546044B4, 0x3107F80C, 0xDFA84D1E, 0xBACFF1A6, + 0xECDF92FE, 0x89B82E46, 0x67179B54, 0x027027EC, + 0xBB48F071, 0xDE2F4CC9, 0x3080F9DB, 0x55E74563, + 0x9CA03F6B, 0xF9C783D3, 0x176836C1, 0x720F8A79, + 0xCB375DE4, 0xAE50E15C, 0x40FF544E, 0x2598E8F6, + 0x73888BAE, 0x16EF3716, 0xF8408204, 0x9D273EBC, + 0x241FE921, 0x41785599, 0xAFD7E08B, 0xCAB05C33, + 0x3BB659ED, 0x5ED1E555, 0xB07E5047, 0xD519ECFF, + 0x6C213B62, 0x094687DA, 0xE7E932C8, 0x828E8E70, + 0xD49EED28, 0xB1F95190, 0x5F56E482, 0x3A31583A, + 0x83098FA7, 0xE66E331F, 0x08C1860D, 0x6DA63AB5, + 0xA4E140BD, 0xC186FC05, 0x2F294917, 0x4A4EF5AF, + 0xF3762232, 0x96119E8A, 0x78BE2B98, 0x1DD99720, + 0x4BC9F478, 0x2EAE48C0, 0xC001FDD2, 0xA566416A, + 0x1C5E96F7, 0x79392A4F, 0x97969F5D, 0xF2F123E5, + 0x05196B4D, 0x607ED7F5, 0x8ED162E7, 0xEBB6DE5F, + 0x528E09C2, 0x37E9B57A, 0xD9460068, 0xBC21BCD0, + 0xEA31DF88, 0x8F566330, 0x61F9D622, 0x049E6A9A, + 0xBDA6BD07, 0xD8C101BF, 0x366EB4AD, 0x53090815, + 0x9A4E721D, 0xFF29CEA5, 0x11867BB7, 0x74E1C70F, + 0xCDD91092, 0xA8BEAC2A, 0x46111938, 0x2376A580, + 0x7566C6D8, 0x10017A60, 0xFEAECF72, 0x9BC973CA, + 0x22F1A457, 0x479618EF, 0xA939ADFD, 0xCC5E1145, + 0x06EE4D76, 0x6389F1CE, 0x8D2644DC, 0xE841F864, + 0x51792FF9, 0x341E9341, 0xDAB12653, 0xBFD69AEB, + 0xE9C6F9B3, 0x8CA1450B, 0x620EF019, 0x07694CA1, + 0xBE519B3C, 0xDB362784, 0x35999296, 0x50FE2E2E, + 0x99B95426, 0xFCDEE89E, 0x12715D8C, 0x7716E134, + 0xCE2E36A9, 0xAB498A11, 0x45E63F03, 0x208183BB, + 0x7691E0E3, 0x13F65C5B, 0xFD59E949, 0x983E55F1, + 0x2106826C, 0x44613ED4, 0xAACE8BC6, 0xCFA9377E, + 0x38417FD6, 0x5D26C36E, 0xB389767C, 0xD6EECAC4, + 0x6FD61D59, 0x0AB1A1E1, 0xE41E14F3, 0x8179A84B, + 0xD769CB13, 0xB20E77AB, 0x5CA1C2B9, 0x39C67E01, + 0x80FEA99C, 0xE5991524, 0x0B36A036, 0x6E511C8E, + 0xA7166686, 0xC271DA3E, 0x2CDE6F2C, 0x49B9D394, + 0xF0810409, 0x95E6B8B1, 0x7B490DA3, 0x1E2EB11B, + 0x483ED243, 0x2D596EFB, 0xC3F6DBE9, 0xA6916751, + 0x1FA9B0CC, 0x7ACE0C74, 0x9461B966, 0xF10605DE + }, { + 0x00000000, 0xB029603D, 0x6053C07A, 0xD07AA047, + 0xC0A680F5, 0x708FE0C8, 0xA0F5408F, 0x10DC20B2, + 0xC14B7030, 0x7162100D, 0xA118B04A, 0x1131D077, + 0x01EDF0C5, 0xB1C490F8, 0x61BE30BF, 0xD1975082, + 0x8297E060, 0x32BE805D, 0xE2C4201A, 0x52ED4027, + 0x42316095, 0xF21800A8, 0x2262A0EF, 0x924BC0D2, + 0x43DC9050, 0xF3F5F06D, 0x238F502A, 0x93A63017, + 0x837A10A5, 0x33537098, 0xE329D0DF, 0x5300B0E2, + 0x042FC1C1, 0xB406A1FC, 0x647C01BB, 0xD4556186, + 0xC4894134, 0x74A02109, 0xA4DA814E, 0x14F3E173, + 0xC564B1F1, 0x754DD1CC, 0xA537718B, 0x151E11B6, + 0x05C23104, 0xB5EB5139, 0x6591F17E, 0xD5B89143, + 0x86B821A1, 0x3691419C, 0xE6EBE1DB, 0x56C281E6, + 0x461EA154, 0xF637C169, 0x264D612E, 0x96640113, + 0x47F35191, 0xF7DA31AC, 0x27A091EB, 0x9789F1D6, + 0x8755D164, 0x377CB159, 0xE706111E, 0x572F7123, + 0x4958F358, 0xF9719365, 0x290B3322, 0x9922531F, + 0x89FE73AD, 0x39D71390, 0xE9ADB3D7, 0x5984D3EA, + 0x88138368, 0x383AE355, 0xE8404312, 0x5869232F, + 0x48B5039D, 0xF89C63A0, 0x28E6C3E7, 0x98CFA3DA, + 0xCBCF1338, 0x7BE67305, 0xAB9CD342, 0x1BB5B37F, + 0x0B6993CD, 0xBB40F3F0, 0x6B3A53B7, 0xDB13338A, + 0x0A846308, 0xBAAD0335, 0x6AD7A372, 0xDAFEC34F, + 0xCA22E3FD, 0x7A0B83C0, 0xAA712387, 0x1A5843BA, + 0x4D773299, 0xFD5E52A4, 0x2D24F2E3, 0x9D0D92DE, + 0x8DD1B26C, 0x3DF8D251, 0xED827216, 0x5DAB122B, + 0x8C3C42A9, 0x3C152294, 0xEC6F82D3, 0x5C46E2EE, + 0x4C9AC25C, 0xFCB3A261, 0x2CC90226, 0x9CE0621B, + 0xCFE0D2F9, 0x7FC9B2C4, 0xAFB31283, 0x1F9A72BE, + 0x0F46520C, 0xBF6F3231, 0x6F159276, 0xDF3CF24B, + 0x0EABA2C9, 0xBE82C2F4, 0x6EF862B3, 0xDED1028E, + 0xCE0D223C, 0x7E244201, 0xAE5EE246, 0x1E77827B, + 0x92B0E6B1, 0x2299868C, 0xF2E326CB, 0x42CA46F6, + 0x52166644, 0xE23F0679, 0x3245A63E, 0x826CC603, + 0x53FB9681, 0xE3D2F6BC, 0x33A856FB, 0x838136C6, + 0x935D1674, 0x23747649, 0xF30ED60E, 0x4327B633, + 0x102706D1, 0xA00E66EC, 0x7074C6AB, 0xC05DA696, + 0xD0818624, 0x60A8E619, 0xB0D2465E, 0x00FB2663, + 0xD16C76E1, 0x614516DC, 0xB13FB69B, 0x0116D6A6, + 0x11CAF614, 0xA1E39629, 0x7199366E, 0xC1B05653, + 0x969F2770, 0x26B6474D, 0xF6CCE70A, 0x46E58737, + 0x5639A785, 0xE610C7B8, 0x366A67FF, 0x864307C2, + 0x57D45740, 0xE7FD377D, 0x3787973A, 0x87AEF707, + 0x9772D7B5, 0x275BB788, 0xF72117CF, 0x470877F2, + 0x1408C710, 0xA421A72D, 0x745B076A, 0xC4726757, + 0xD4AE47E5, 0x648727D8, 0xB4FD879F, 0x04D4E7A2, + 0xD543B720, 0x656AD71D, 0xB510775A, 0x05391767, + 0x15E537D5, 0xA5CC57E8, 0x75B6F7AF, 0xC59F9792, + 0xDBE815E9, 0x6BC175D4, 0xBBBBD593, 0x0B92B5AE, + 0x1B4E951C, 0xAB67F521, 0x7B1D5566, 0xCB34355B, + 0x1AA365D9, 0xAA8A05E4, 0x7AF0A5A3, 0xCAD9C59E, + 0xDA05E52C, 0x6A2C8511, 0xBA562556, 0x0A7F456B, + 0x597FF589, 0xE95695B4, 0x392C35F3, 0x890555CE, + 0x99D9757C, 0x29F01541, 0xF98AB506, 0x49A3D53B, + 0x983485B9, 0x281DE584, 0xF86745C3, 0x484E25FE, + 0x5892054C, 0xE8BB6571, 0x38C1C536, 0x88E8A50B, + 0xDFC7D428, 0x6FEEB415, 0xBF941452, 0x0FBD746F, + 0x1F6154DD, 0xAF4834E0, 0x7F3294A7, 0xCF1BF49A, + 0x1E8CA418, 0xAEA5C425, 0x7EDF6462, 0xCEF6045F, + 0xDE2A24ED, 0x6E0344D0, 0xBE79E497, 0x0E5084AA, + 0x5D503448, 0xED795475, 0x3D03F432, 0x8D2A940F, + 0x9DF6B4BD, 0x2DDFD480, 0xFDA574C7, 0x4D8C14FA, + 0x9C1B4478, 0x2C322445, 0xFC488402, 0x4C61E43F, + 0x5CBDC48D, 0xEC94A4B0, 0x3CEE04F7, 0x8CC764CA + }, { + 0x00000000, 0xA5D35CCB, 0x0BA1C84D, 0xAE729486, + 0x1642919B, 0xB391CD50, 0x1DE359D6, 0xB830051D, + 0x6D8253EC, 0xC8510F27, 0x66239BA1, 0xC3F0C76A, + 0x7BC0C277, 0xDE139EBC, 0x70610A3A, 0xD5B256F1, + 0x9B02D603, 0x3ED18AC8, 0x90A31E4E, 0x35704285, + 0x8D404798, 0x28931B53, 0x86E18FD5, 0x2332D31E, + 0xF68085EF, 0x5353D924, 0xFD214DA2, 0x58F21169, + 0xE0C21474, 0x451148BF, 0xEB63DC39, 0x4EB080F2, + 0x3605AC07, 0x93D6F0CC, 0x3DA4644A, 0x98773881, + 0x20473D9C, 0x85946157, 0x2BE6F5D1, 0x8E35A91A, + 0x5B87FFEB, 0xFE54A320, 0x502637A6, 0xF5F56B6D, + 0x4DC56E70, 0xE81632BB, 0x4664A63D, 0xE3B7FAF6, + 0xAD077A04, 0x08D426CF, 0xA6A6B249, 0x0375EE82, + 0xBB45EB9F, 0x1E96B754, 0xB0E423D2, 0x15377F19, + 0xC08529E8, 0x65567523, 0xCB24E1A5, 0x6EF7BD6E, + 0xD6C7B873, 0x7314E4B8, 0xDD66703E, 0x78B52CF5, + 0x6C0A580F, 0xC9D904C4, 0x67AB9042, 0xC278CC89, + 0x7A48C994, 0xDF9B955F, 0x71E901D9, 0xD43A5D12, + 0x01880BE3, 0xA45B5728, 0x0A29C3AE, 0xAFFA9F65, + 0x17CA9A78, 0xB219C6B3, 0x1C6B5235, 0xB9B80EFE, + 0xF7088E0C, 0x52DBD2C7, 0xFCA94641, 0x597A1A8A, + 0xE14A1F97, 0x4499435C, 0xEAEBD7DA, 0x4F388B11, + 0x9A8ADDE0, 0x3F59812B, 0x912B15AD, 0x34F84966, + 0x8CC84C7B, 0x291B10B0, 0x87698436, 0x22BAD8FD, + 0x5A0FF408, 0xFFDCA8C3, 0x51AE3C45, 0xF47D608E, + 0x4C4D6593, 0xE99E3958, 0x47ECADDE, 0xE23FF115, + 0x378DA7E4, 0x925EFB2F, 0x3C2C6FA9, 0x99FF3362, + 0x21CF367F, 0x841C6AB4, 0x2A6EFE32, 0x8FBDA2F9, + 0xC10D220B, 0x64DE7EC0, 0xCAACEA46, 0x6F7FB68D, + 0xD74FB390, 0x729CEF5B, 0xDCEE7BDD, 0x793D2716, + 0xAC8F71E7, 0x095C2D2C, 0xA72EB9AA, 0x02FDE561, + 0xBACDE07C, 0x1F1EBCB7, 0xB16C2831, 0x14BF74FA, + 0xD814B01E, 0x7DC7ECD5, 0xD3B57853, 0x76662498, + 0xCE562185, 0x6B857D4E, 0xC5F7E9C8, 0x6024B503, + 0xB596E3F2, 0x1045BF39, 0xBE372BBF, 0x1BE47774, + 0xA3D47269, 0x06072EA2, 0xA875BA24, 0x0DA6E6EF, + 0x4316661D, 0xE6C53AD6, 0x48B7AE50, 0xED64F29B, + 0x5554F786, 0xF087AB4D, 0x5EF53FCB, 0xFB266300, + 0x2E9435F1, 0x8B47693A, 0x2535FDBC, 0x80E6A177, + 0x38D6A46A, 0x9D05F8A1, 0x33776C27, 0x96A430EC, + 0xEE111C19, 0x4BC240D2, 0xE5B0D454, 0x4063889F, + 0xF8538D82, 0x5D80D149, 0xF3F245CF, 0x56211904, + 0x83934FF5, 0x2640133E, 0x883287B8, 0x2DE1DB73, + 0x95D1DE6E, 0x300282A5, 0x9E701623, 0x3BA34AE8, + 0x7513CA1A, 0xD0C096D1, 0x7EB20257, 0xDB615E9C, + 0x63515B81, 0xC682074A, 0x68F093CC, 0xCD23CF07, + 0x189199F6, 0xBD42C53D, 0x133051BB, 0xB6E30D70, + 0x0ED3086D, 0xAB0054A6, 0x0572C020, 0xA0A19CEB, + 0xB41EE811, 0x11CDB4DA, 0xBFBF205C, 0x1A6C7C97, + 0xA25C798A, 0x078F2541, 0xA9FDB1C7, 0x0C2EED0C, + 0xD99CBBFD, 0x7C4FE736, 0xD23D73B0, 0x77EE2F7B, + 0xCFDE2A66, 0x6A0D76AD, 0xC47FE22B, 0x61ACBEE0, + 0x2F1C3E12, 0x8ACF62D9, 0x24BDF65F, 0x816EAA94, + 0x395EAF89, 0x9C8DF342, 0x32FF67C4, 0x972C3B0F, + 0x429E6DFE, 0xE74D3135, 0x493FA5B3, 0xECECF978, + 0x54DCFC65, 0xF10FA0AE, 0x5F7D3428, 0xFAAE68E3, + 0x821B4416, 0x27C818DD, 0x89BA8C5B, 0x2C69D090, + 0x9459D58D, 0x318A8946, 0x9FF81DC0, 0x3A2B410B, + 0xEF9917FA, 0x4A4A4B31, 0xE438DFB7, 0x41EB837C, + 0xF9DB8661, 0x5C08DAAA, 0xF27A4E2C, 0x57A912E7, + 0x19199215, 0xBCCACEDE, 0x12B85A58, 0xB76B0693, + 0x0F5B038E, 0xAA885F45, 0x04FACBC3, 0xA1299708, + 0x749BC1F9, 0xD1489D32, 0x7F3A09B4, 0xDAE9557F, + 0x62D95062, 0xC70A0CA9, 0x6978982F, 0xCCABC4E4 + }, { + 0x00000000, 0xB40B77A6, 0x29119F97, 0x9D1AE831, + 0x13244FF4, 0xA72F3852, 0x3A35D063, 0x8E3EA7C5, + 0x674EEF33, 0xD3459895, 0x4E5F70A4, 0xFA540702, + 0x746AA0C7, 0xC061D761, 0x5D7B3F50, 0xE97048F6, + 0xCE9CDE67, 0x7A97A9C1, 0xE78D41F0, 0x53863656, + 0xDDB89193, 0x69B3E635, 0xF4A90E04, 0x40A279A2, + 0xA9D23154, 0x1DD946F2, 0x80C3AEC3, 0x34C8D965, + 0xBAF67EA0, 0x0EFD0906, 0x93E7E137, 0x27EC9691, + 0x9C39BDCF, 0x2832CA69, 0xB5282258, 0x012355FE, + 0x8F1DF23B, 0x3B16859D, 0xA60C6DAC, 0x12071A0A, + 0xFB7752FC, 0x4F7C255A, 0xD266CD6B, 0x666DBACD, + 0xE8531D08, 0x5C586AAE, 0xC142829F, 0x7549F539, + 0x52A563A8, 0xE6AE140E, 0x7BB4FC3F, 0xCFBF8B99, + 0x41812C5C, 0xF58A5BFA, 0x6890B3CB, 0xDC9BC46D, + 0x35EB8C9B, 0x81E0FB3D, 0x1CFA130C, 0xA8F164AA, + 0x26CFC36F, 0x92C4B4C9, 0x0FDE5CF8, 0xBBD52B5E, + 0x79750B44, 0xCD7E7CE2, 0x506494D3, 0xE46FE375, + 0x6A5144B0, 0xDE5A3316, 0x4340DB27, 0xF74BAC81, + 0x1E3BE477, 0xAA3093D1, 0x372A7BE0, 0x83210C46, + 0x0D1FAB83, 0xB914DC25, 0x240E3414, 0x900543B2, + 0xB7E9D523, 0x03E2A285, 0x9EF84AB4, 0x2AF33D12, + 0xA4CD9AD7, 0x10C6ED71, 0x8DDC0540, 0x39D772E6, + 0xD0A73A10, 0x64AC4DB6, 0xF9B6A587, 0x4DBDD221, + 0xC38375E4, 0x77880242, 0xEA92EA73, 0x5E999DD5, + 0xE54CB68B, 0x5147C12D, 0xCC5D291C, 0x78565EBA, + 0xF668F97F, 0x42638ED9, 0xDF7966E8, 0x6B72114E, + 0x820259B8, 0x36092E1E, 0xAB13C62F, 0x1F18B189, + 0x9126164C, 0x252D61EA, 0xB83789DB, 0x0C3CFE7D, + 0x2BD068EC, 0x9FDB1F4A, 0x02C1F77B, 0xB6CA80DD, + 0x38F42718, 0x8CFF50BE, 0x11E5B88F, 0xA5EECF29, + 0x4C9E87DF, 0xF895F079, 0x658F1848, 0xD1846FEE, + 0x5FBAC82B, 0xEBB1BF8D, 0x76AB57BC, 0xC2A0201A, + 0xF2EA1688, 0x46E1612E, 0xDBFB891F, 0x6FF0FEB9, + 0xE1CE597C, 0x55C52EDA, 0xC8DFC6EB, 0x7CD4B14D, + 0x95A4F9BB, 0x21AF8E1D, 0xBCB5662C, 0x08BE118A, + 0x8680B64F, 0x328BC1E9, 0xAF9129D8, 0x1B9A5E7E, + 0x3C76C8EF, 0x887DBF49, 0x15675778, 0xA16C20DE, + 0x2F52871B, 0x9B59F0BD, 0x0643188C, 0xB2486F2A, + 0x5B3827DC, 0xEF33507A, 0x7229B84B, 0xC622CFED, + 0x481C6828, 0xFC171F8E, 0x610DF7BF, 0xD5068019, + 0x6ED3AB47, 0xDAD8DCE1, 0x47C234D0, 0xF3C94376, + 0x7DF7E4B3, 0xC9FC9315, 0x54E67B24, 0xE0ED0C82, + 0x099D4474, 0xBD9633D2, 0x208CDBE3, 0x9487AC45, + 0x1AB90B80, 0xAEB27C26, 0x33A89417, 0x87A3E3B1, + 0xA04F7520, 0x14440286, 0x895EEAB7, 0x3D559D11, + 0xB36B3AD4, 0x07604D72, 0x9A7AA543, 0x2E71D2E5, + 0xC7019A13, 0x730AEDB5, 0xEE100584, 0x5A1B7222, + 0xD425D5E7, 0x602EA241, 0xFD344A70, 0x493F3DD6, + 0x8B9F1DCC, 0x3F946A6A, 0xA28E825B, 0x1685F5FD, + 0x98BB5238, 0x2CB0259E, 0xB1AACDAF, 0x05A1BA09, + 0xECD1F2FF, 0x58DA8559, 0xC5C06D68, 0x71CB1ACE, + 0xFFF5BD0B, 0x4BFECAAD, 0xD6E4229C, 0x62EF553A, + 0x4503C3AB, 0xF108B40D, 0x6C125C3C, 0xD8192B9A, + 0x56278C5F, 0xE22CFBF9, 0x7F3613C8, 0xCB3D646E, + 0x224D2C98, 0x96465B3E, 0x0B5CB30F, 0xBF57C4A9, + 0x3169636C, 0x856214CA, 0x1878FCFB, 0xAC738B5D, + 0x17A6A003, 0xA3ADD7A5, 0x3EB73F94, 0x8ABC4832, + 0x0482EFF7, 0xB0899851, 0x2D937060, 0x999807C6, + 0x70E84F30, 0xC4E33896, 0x59F9D0A7, 0xEDF2A701, + 0x63CC00C4, 0xD7C77762, 0x4ADD9F53, 0xFED6E8F5, + 0xD93A7E64, 0x6D3109C2, 0xF02BE1F3, 0x44209655, + 0xCA1E3190, 0x7E154636, 0xE30FAE07, 0x5704D9A1, + 0xBE749157, 0x0A7FE6F1, 0x97650EC0, 0x236E7966, + 0xAD50DEA3, 0x195BA905, 0x84414134, 0x304A3692 + }, { + 0x00000000, 0x9E00AACC, 0x7D072542, 0xE3078F8E, + 0xFA0E4A84, 0x640EE048, 0x87096FC6, 0x1909C50A, + 0xB51BE5D3, 0x2B1B4F1F, 0xC81CC091, 0x561C6A5D, + 0x4F15AF57, 0xD115059B, 0x32128A15, 0xAC1220D9, + 0x2B31BB7C, 0xB53111B0, 0x56369E3E, 0xC83634F2, + 0xD13FF1F8, 0x4F3F5B34, 0xAC38D4BA, 0x32387E76, + 0x9E2A5EAF, 0x002AF463, 0xE32D7BED, 0x7D2DD121, + 0x6424142B, 0xFA24BEE7, 0x19233169, 0x87239BA5, + 0x566276F9, 0xC862DC35, 0x2B6553BB, 0xB565F977, + 0xAC6C3C7D, 0x326C96B1, 0xD16B193F, 0x4F6BB3F3, + 0xE379932A, 0x7D7939E6, 0x9E7EB668, 0x007E1CA4, + 0x1977D9AE, 0x87777362, 0x6470FCEC, 0xFA705620, + 0x7D53CD85, 0xE3536749, 0x0054E8C7, 0x9E54420B, + 0x875D8701, 0x195D2DCD, 0xFA5AA243, 0x645A088F, + 0xC8482856, 0x5648829A, 0xB54F0D14, 0x2B4FA7D8, + 0x324662D2, 0xAC46C81E, 0x4F414790, 0xD141ED5C, + 0xEDC29D29, 0x73C237E5, 0x90C5B86B, 0x0EC512A7, + 0x17CCD7AD, 0x89CC7D61, 0x6ACBF2EF, 0xF4CB5823, + 0x58D978FA, 0xC6D9D236, 0x25DE5DB8, 0xBBDEF774, + 0xA2D7327E, 0x3CD798B2, 0xDFD0173C, 0x41D0BDF0, + 0xC6F32655, 0x58F38C99, 0xBBF40317, 0x25F4A9DB, + 0x3CFD6CD1, 0xA2FDC61D, 0x41FA4993, 0xDFFAE35F, + 0x73E8C386, 0xEDE8694A, 0x0EEFE6C4, 0x90EF4C08, + 0x89E68902, 0x17E623CE, 0xF4E1AC40, 0x6AE1068C, + 0xBBA0EBD0, 0x25A0411C, 0xC6A7CE92, 0x58A7645E, + 0x41AEA154, 0xDFAE0B98, 0x3CA98416, 0xA2A92EDA, + 0x0EBB0E03, 0x90BBA4CF, 0x73BC2B41, 0xEDBC818D, + 0xF4B54487, 0x6AB5EE4B, 0x89B261C5, 0x17B2CB09, + 0x909150AC, 0x0E91FA60, 0xED9675EE, 0x7396DF22, + 0x6A9F1A28, 0xF49FB0E4, 0x17983F6A, 0x899895A6, + 0x258AB57F, 0xBB8A1FB3, 0x588D903D, 0xC68D3AF1, + 0xDF84FFFB, 0x41845537, 0xA283DAB9, 0x3C837075, + 0xDA853B53, 0x4485919F, 0xA7821E11, 0x3982B4DD, + 0x208B71D7, 0xBE8BDB1B, 0x5D8C5495, 0xC38CFE59, + 0x6F9EDE80, 0xF19E744C, 0x1299FBC2, 0x8C99510E, + 0x95909404, 0x0B903EC8, 0xE897B146, 0x76971B8A, + 0xF1B4802F, 0x6FB42AE3, 0x8CB3A56D, 0x12B30FA1, + 0x0BBACAAB, 0x95BA6067, 0x76BDEFE9, 0xE8BD4525, + 0x44AF65FC, 0xDAAFCF30, 0x39A840BE, 0xA7A8EA72, + 0xBEA12F78, 0x20A185B4, 0xC3A60A3A, 0x5DA6A0F6, + 0x8CE74DAA, 0x12E7E766, 0xF1E068E8, 0x6FE0C224, + 0x76E9072E, 0xE8E9ADE2, 0x0BEE226C, 0x95EE88A0, + 0x39FCA879, 0xA7FC02B5, 0x44FB8D3B, 0xDAFB27F7, + 0xC3F2E2FD, 0x5DF24831, 0xBEF5C7BF, 0x20F56D73, + 0xA7D6F6D6, 0x39D65C1A, 0xDAD1D394, 0x44D17958, + 0x5DD8BC52, 0xC3D8169E, 0x20DF9910, 0xBEDF33DC, + 0x12CD1305, 0x8CCDB9C9, 0x6FCA3647, 0xF1CA9C8B, + 0xE8C35981, 0x76C3F34D, 0x95C47CC3, 0x0BC4D60F, + 0x3747A67A, 0xA9470CB6, 0x4A408338, 0xD44029F4, + 0xCD49ECFE, 0x53494632, 0xB04EC9BC, 0x2E4E6370, + 0x825C43A9, 0x1C5CE965, 0xFF5B66EB, 0x615BCC27, + 0x7852092D, 0xE652A3E1, 0x05552C6F, 0x9B5586A3, + 0x1C761D06, 0x8276B7CA, 0x61713844, 0xFF719288, + 0xE6785782, 0x7878FD4E, 0x9B7F72C0, 0x057FD80C, + 0xA96DF8D5, 0x376D5219, 0xD46ADD97, 0x4A6A775B, + 0x5363B251, 0xCD63189D, 0x2E649713, 0xB0643DDF, + 0x6125D083, 0xFF257A4F, 0x1C22F5C1, 0x82225F0D, + 0x9B2B9A07, 0x052B30CB, 0xE62CBF45, 0x782C1589, + 0xD43E3550, 0x4A3E9F9C, 0xA9391012, 0x3739BADE, + 0x2E307FD4, 0xB030D518, 0x53375A96, 0xCD37F05A, + 0x4A146BFF, 0xD414C133, 0x37134EBD, 0xA913E471, + 0xB01A217B, 0x2E1A8BB7, 0xCD1D0439, 0x531DAEF5, + 0xFF0F8E2C, 0x610F24E0, 0x8208AB6E, 0x1C0801A2, + 0x0501C4A8, 0x9B016E64, 0x7806E1EA, 0xE6064B26 + } +}; diff --git a/liblzma/check/crc32_table_le.h b/liblzma/check/crc32_table_le.h new file mode 100644 index 0000000..25f4fc4 --- /dev/null +++ b/liblzma/check/crc32_table_le.h @@ -0,0 +1,525 @@ +/* This file has been automatically generated by crc32_tablegen.c. */ + +const uint32_t lzma_crc32_table[8][256] = { + { + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, + 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, + 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, + 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, + 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, + 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, + 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, + 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, + 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, + 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, + 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, + 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, + 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, + 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, + 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, + 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, + 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, + 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, + 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, + 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, + 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, + 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, + 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D + }, { + 0x00000000, 0x191B3141, 0x32366282, 0x2B2D53C3, + 0x646CC504, 0x7D77F445, 0x565AA786, 0x4F4196C7, + 0xC8D98A08, 0xD1C2BB49, 0xFAEFE88A, 0xE3F4D9CB, + 0xACB54F0C, 0xB5AE7E4D, 0x9E832D8E, 0x87981CCF, + 0x4AC21251, 0x53D92310, 0x78F470D3, 0x61EF4192, + 0x2EAED755, 0x37B5E614, 0x1C98B5D7, 0x05838496, + 0x821B9859, 0x9B00A918, 0xB02DFADB, 0xA936CB9A, + 0xE6775D5D, 0xFF6C6C1C, 0xD4413FDF, 0xCD5A0E9E, + 0x958424A2, 0x8C9F15E3, 0xA7B24620, 0xBEA97761, + 0xF1E8E1A6, 0xE8F3D0E7, 0xC3DE8324, 0xDAC5B265, + 0x5D5DAEAA, 0x44469FEB, 0x6F6BCC28, 0x7670FD69, + 0x39316BAE, 0x202A5AEF, 0x0B07092C, 0x121C386D, + 0xDF4636F3, 0xC65D07B2, 0xED705471, 0xF46B6530, + 0xBB2AF3F7, 0xA231C2B6, 0x891C9175, 0x9007A034, + 0x179FBCFB, 0x0E848DBA, 0x25A9DE79, 0x3CB2EF38, + 0x73F379FF, 0x6AE848BE, 0x41C51B7D, 0x58DE2A3C, + 0xF0794F05, 0xE9627E44, 0xC24F2D87, 0xDB541CC6, + 0x94158A01, 0x8D0EBB40, 0xA623E883, 0xBF38D9C2, + 0x38A0C50D, 0x21BBF44C, 0x0A96A78F, 0x138D96CE, + 0x5CCC0009, 0x45D73148, 0x6EFA628B, 0x77E153CA, + 0xBABB5D54, 0xA3A06C15, 0x888D3FD6, 0x91960E97, + 0xDED79850, 0xC7CCA911, 0xECE1FAD2, 0xF5FACB93, + 0x7262D75C, 0x6B79E61D, 0x4054B5DE, 0x594F849F, + 0x160E1258, 0x0F152319, 0x243870DA, 0x3D23419B, + 0x65FD6BA7, 0x7CE65AE6, 0x57CB0925, 0x4ED03864, + 0x0191AEA3, 0x188A9FE2, 0x33A7CC21, 0x2ABCFD60, + 0xAD24E1AF, 0xB43FD0EE, 0x9F12832D, 0x8609B26C, + 0xC94824AB, 0xD05315EA, 0xFB7E4629, 0xE2657768, + 0x2F3F79F6, 0x362448B7, 0x1D091B74, 0x04122A35, + 0x4B53BCF2, 0x52488DB3, 0x7965DE70, 0x607EEF31, + 0xE7E6F3FE, 0xFEFDC2BF, 0xD5D0917C, 0xCCCBA03D, + 0x838A36FA, 0x9A9107BB, 0xB1BC5478, 0xA8A76539, + 0x3B83984B, 0x2298A90A, 0x09B5FAC9, 0x10AECB88, + 0x5FEF5D4F, 0x46F46C0E, 0x6DD93FCD, 0x74C20E8C, + 0xF35A1243, 0xEA412302, 0xC16C70C1, 0xD8774180, + 0x9736D747, 0x8E2DE606, 0xA500B5C5, 0xBC1B8484, + 0x71418A1A, 0x685ABB5B, 0x4377E898, 0x5A6CD9D9, + 0x152D4F1E, 0x0C367E5F, 0x271B2D9C, 0x3E001CDD, + 0xB9980012, 0xA0833153, 0x8BAE6290, 0x92B553D1, + 0xDDF4C516, 0xC4EFF457, 0xEFC2A794, 0xF6D996D5, + 0xAE07BCE9, 0xB71C8DA8, 0x9C31DE6B, 0x852AEF2A, + 0xCA6B79ED, 0xD37048AC, 0xF85D1B6F, 0xE1462A2E, + 0x66DE36E1, 0x7FC507A0, 0x54E85463, 0x4DF36522, + 0x02B2F3E5, 0x1BA9C2A4, 0x30849167, 0x299FA026, + 0xE4C5AEB8, 0xFDDE9FF9, 0xD6F3CC3A, 0xCFE8FD7B, + 0x80A96BBC, 0x99B25AFD, 0xB29F093E, 0xAB84387F, + 0x2C1C24B0, 0x350715F1, 0x1E2A4632, 0x07317773, + 0x4870E1B4, 0x516BD0F5, 0x7A468336, 0x635DB277, + 0xCBFAD74E, 0xD2E1E60F, 0xF9CCB5CC, 0xE0D7848D, + 0xAF96124A, 0xB68D230B, 0x9DA070C8, 0x84BB4189, + 0x03235D46, 0x1A386C07, 0x31153FC4, 0x280E0E85, + 0x674F9842, 0x7E54A903, 0x5579FAC0, 0x4C62CB81, + 0x8138C51F, 0x9823F45E, 0xB30EA79D, 0xAA1596DC, + 0xE554001B, 0xFC4F315A, 0xD7626299, 0xCE7953D8, + 0x49E14F17, 0x50FA7E56, 0x7BD72D95, 0x62CC1CD4, + 0x2D8D8A13, 0x3496BB52, 0x1FBBE891, 0x06A0D9D0, + 0x5E7EF3EC, 0x4765C2AD, 0x6C48916E, 0x7553A02F, + 0x3A1236E8, 0x230907A9, 0x0824546A, 0x113F652B, + 0x96A779E4, 0x8FBC48A5, 0xA4911B66, 0xBD8A2A27, + 0xF2CBBCE0, 0xEBD08DA1, 0xC0FDDE62, 0xD9E6EF23, + 0x14BCE1BD, 0x0DA7D0FC, 0x268A833F, 0x3F91B27E, + 0x70D024B9, 0x69CB15F8, 0x42E6463B, 0x5BFD777A, + 0xDC656BB5, 0xC57E5AF4, 0xEE530937, 0xF7483876, + 0xB809AEB1, 0xA1129FF0, 0x8A3FCC33, 0x9324FD72 + }, { + 0x00000000, 0x01C26A37, 0x0384D46E, 0x0246BE59, + 0x0709A8DC, 0x06CBC2EB, 0x048D7CB2, 0x054F1685, + 0x0E1351B8, 0x0FD13B8F, 0x0D9785D6, 0x0C55EFE1, + 0x091AF964, 0x08D89353, 0x0A9E2D0A, 0x0B5C473D, + 0x1C26A370, 0x1DE4C947, 0x1FA2771E, 0x1E601D29, + 0x1B2F0BAC, 0x1AED619B, 0x18ABDFC2, 0x1969B5F5, + 0x1235F2C8, 0x13F798FF, 0x11B126A6, 0x10734C91, + 0x153C5A14, 0x14FE3023, 0x16B88E7A, 0x177AE44D, + 0x384D46E0, 0x398F2CD7, 0x3BC9928E, 0x3A0BF8B9, + 0x3F44EE3C, 0x3E86840B, 0x3CC03A52, 0x3D025065, + 0x365E1758, 0x379C7D6F, 0x35DAC336, 0x3418A901, + 0x3157BF84, 0x3095D5B3, 0x32D36BEA, 0x331101DD, + 0x246BE590, 0x25A98FA7, 0x27EF31FE, 0x262D5BC9, + 0x23624D4C, 0x22A0277B, 0x20E69922, 0x2124F315, + 0x2A78B428, 0x2BBADE1F, 0x29FC6046, 0x283E0A71, + 0x2D711CF4, 0x2CB376C3, 0x2EF5C89A, 0x2F37A2AD, + 0x709A8DC0, 0x7158E7F7, 0x731E59AE, 0x72DC3399, + 0x7793251C, 0x76514F2B, 0x7417F172, 0x75D59B45, + 0x7E89DC78, 0x7F4BB64F, 0x7D0D0816, 0x7CCF6221, + 0x798074A4, 0x78421E93, 0x7A04A0CA, 0x7BC6CAFD, + 0x6CBC2EB0, 0x6D7E4487, 0x6F38FADE, 0x6EFA90E9, + 0x6BB5866C, 0x6A77EC5B, 0x68315202, 0x69F33835, + 0x62AF7F08, 0x636D153F, 0x612BAB66, 0x60E9C151, + 0x65A6D7D4, 0x6464BDE3, 0x662203BA, 0x67E0698D, + 0x48D7CB20, 0x4915A117, 0x4B531F4E, 0x4A917579, + 0x4FDE63FC, 0x4E1C09CB, 0x4C5AB792, 0x4D98DDA5, + 0x46C49A98, 0x4706F0AF, 0x45404EF6, 0x448224C1, + 0x41CD3244, 0x400F5873, 0x4249E62A, 0x438B8C1D, + 0x54F16850, 0x55330267, 0x5775BC3E, 0x56B7D609, + 0x53F8C08C, 0x523AAABB, 0x507C14E2, 0x51BE7ED5, + 0x5AE239E8, 0x5B2053DF, 0x5966ED86, 0x58A487B1, + 0x5DEB9134, 0x5C29FB03, 0x5E6F455A, 0x5FAD2F6D, + 0xE1351B80, 0xE0F771B7, 0xE2B1CFEE, 0xE373A5D9, + 0xE63CB35C, 0xE7FED96B, 0xE5B86732, 0xE47A0D05, + 0xEF264A38, 0xEEE4200F, 0xECA29E56, 0xED60F461, + 0xE82FE2E4, 0xE9ED88D3, 0xEBAB368A, 0xEA695CBD, + 0xFD13B8F0, 0xFCD1D2C7, 0xFE976C9E, 0xFF5506A9, + 0xFA1A102C, 0xFBD87A1B, 0xF99EC442, 0xF85CAE75, + 0xF300E948, 0xF2C2837F, 0xF0843D26, 0xF1465711, + 0xF4094194, 0xF5CB2BA3, 0xF78D95FA, 0xF64FFFCD, + 0xD9785D60, 0xD8BA3757, 0xDAFC890E, 0xDB3EE339, + 0xDE71F5BC, 0xDFB39F8B, 0xDDF521D2, 0xDC374BE5, + 0xD76B0CD8, 0xD6A966EF, 0xD4EFD8B6, 0xD52DB281, + 0xD062A404, 0xD1A0CE33, 0xD3E6706A, 0xD2241A5D, + 0xC55EFE10, 0xC49C9427, 0xC6DA2A7E, 0xC7184049, + 0xC25756CC, 0xC3953CFB, 0xC1D382A2, 0xC011E895, + 0xCB4DAFA8, 0xCA8FC59F, 0xC8C97BC6, 0xC90B11F1, + 0xCC440774, 0xCD866D43, 0xCFC0D31A, 0xCE02B92D, + 0x91AF9640, 0x906DFC77, 0x922B422E, 0x93E92819, + 0x96A63E9C, 0x976454AB, 0x9522EAF2, 0x94E080C5, + 0x9FBCC7F8, 0x9E7EADCF, 0x9C381396, 0x9DFA79A1, + 0x98B56F24, 0x99770513, 0x9B31BB4A, 0x9AF3D17D, + 0x8D893530, 0x8C4B5F07, 0x8E0DE15E, 0x8FCF8B69, + 0x8A809DEC, 0x8B42F7DB, 0x89044982, 0x88C623B5, + 0x839A6488, 0x82580EBF, 0x801EB0E6, 0x81DCDAD1, + 0x8493CC54, 0x8551A663, 0x8717183A, 0x86D5720D, + 0xA9E2D0A0, 0xA820BA97, 0xAA6604CE, 0xABA46EF9, + 0xAEEB787C, 0xAF29124B, 0xAD6FAC12, 0xACADC625, + 0xA7F18118, 0xA633EB2F, 0xA4755576, 0xA5B73F41, + 0xA0F829C4, 0xA13A43F3, 0xA37CFDAA, 0xA2BE979D, + 0xB5C473D0, 0xB40619E7, 0xB640A7BE, 0xB782CD89, + 0xB2CDDB0C, 0xB30FB13B, 0xB1490F62, 0xB08B6555, + 0xBBD72268, 0xBA15485F, 0xB853F606, 0xB9919C31, + 0xBCDE8AB4, 0xBD1CE083, 0xBF5A5EDA, 0xBE9834ED + }, { + 0x00000000, 0xB8BC6765, 0xAA09C88B, 0x12B5AFEE, + 0x8F629757, 0x37DEF032, 0x256B5FDC, 0x9DD738B9, + 0xC5B428EF, 0x7D084F8A, 0x6FBDE064, 0xD7018701, + 0x4AD6BFB8, 0xF26AD8DD, 0xE0DF7733, 0x58631056, + 0x5019579F, 0xE8A530FA, 0xFA109F14, 0x42ACF871, + 0xDF7BC0C8, 0x67C7A7AD, 0x75720843, 0xCDCE6F26, + 0x95AD7F70, 0x2D111815, 0x3FA4B7FB, 0x8718D09E, + 0x1ACFE827, 0xA2738F42, 0xB0C620AC, 0x087A47C9, + 0xA032AF3E, 0x188EC85B, 0x0A3B67B5, 0xB28700D0, + 0x2F503869, 0x97EC5F0C, 0x8559F0E2, 0x3DE59787, + 0x658687D1, 0xDD3AE0B4, 0xCF8F4F5A, 0x7733283F, + 0xEAE41086, 0x525877E3, 0x40EDD80D, 0xF851BF68, + 0xF02BF8A1, 0x48979FC4, 0x5A22302A, 0xE29E574F, + 0x7F496FF6, 0xC7F50893, 0xD540A77D, 0x6DFCC018, + 0x359FD04E, 0x8D23B72B, 0x9F9618C5, 0x272A7FA0, + 0xBAFD4719, 0x0241207C, 0x10F48F92, 0xA848E8F7, + 0x9B14583D, 0x23A83F58, 0x311D90B6, 0x89A1F7D3, + 0x1476CF6A, 0xACCAA80F, 0xBE7F07E1, 0x06C36084, + 0x5EA070D2, 0xE61C17B7, 0xF4A9B859, 0x4C15DF3C, + 0xD1C2E785, 0x697E80E0, 0x7BCB2F0E, 0xC377486B, + 0xCB0D0FA2, 0x73B168C7, 0x6104C729, 0xD9B8A04C, + 0x446F98F5, 0xFCD3FF90, 0xEE66507E, 0x56DA371B, + 0x0EB9274D, 0xB6054028, 0xA4B0EFC6, 0x1C0C88A3, + 0x81DBB01A, 0x3967D77F, 0x2BD27891, 0x936E1FF4, + 0x3B26F703, 0x839A9066, 0x912F3F88, 0x299358ED, + 0xB4446054, 0x0CF80731, 0x1E4DA8DF, 0xA6F1CFBA, + 0xFE92DFEC, 0x462EB889, 0x549B1767, 0xEC277002, + 0x71F048BB, 0xC94C2FDE, 0xDBF98030, 0x6345E755, + 0x6B3FA09C, 0xD383C7F9, 0xC1366817, 0x798A0F72, + 0xE45D37CB, 0x5CE150AE, 0x4E54FF40, 0xF6E89825, + 0xAE8B8873, 0x1637EF16, 0x048240F8, 0xBC3E279D, + 0x21E91F24, 0x99557841, 0x8BE0D7AF, 0x335CB0CA, + 0xED59B63B, 0x55E5D15E, 0x47507EB0, 0xFFEC19D5, + 0x623B216C, 0xDA874609, 0xC832E9E7, 0x708E8E82, + 0x28ED9ED4, 0x9051F9B1, 0x82E4565F, 0x3A58313A, + 0xA78F0983, 0x1F336EE6, 0x0D86C108, 0xB53AA66D, + 0xBD40E1A4, 0x05FC86C1, 0x1749292F, 0xAFF54E4A, + 0x322276F3, 0x8A9E1196, 0x982BBE78, 0x2097D91D, + 0x78F4C94B, 0xC048AE2E, 0xD2FD01C0, 0x6A4166A5, + 0xF7965E1C, 0x4F2A3979, 0x5D9F9697, 0xE523F1F2, + 0x4D6B1905, 0xF5D77E60, 0xE762D18E, 0x5FDEB6EB, + 0xC2098E52, 0x7AB5E937, 0x680046D9, 0xD0BC21BC, + 0x88DF31EA, 0x3063568F, 0x22D6F961, 0x9A6A9E04, + 0x07BDA6BD, 0xBF01C1D8, 0xADB46E36, 0x15080953, + 0x1D724E9A, 0xA5CE29FF, 0xB77B8611, 0x0FC7E174, + 0x9210D9CD, 0x2AACBEA8, 0x38191146, 0x80A57623, + 0xD8C66675, 0x607A0110, 0x72CFAEFE, 0xCA73C99B, + 0x57A4F122, 0xEF189647, 0xFDAD39A9, 0x45115ECC, + 0x764DEE06, 0xCEF18963, 0xDC44268D, 0x64F841E8, + 0xF92F7951, 0x41931E34, 0x5326B1DA, 0xEB9AD6BF, + 0xB3F9C6E9, 0x0B45A18C, 0x19F00E62, 0xA14C6907, + 0x3C9B51BE, 0x842736DB, 0x96929935, 0x2E2EFE50, + 0x2654B999, 0x9EE8DEFC, 0x8C5D7112, 0x34E11677, + 0xA9362ECE, 0x118A49AB, 0x033FE645, 0xBB838120, + 0xE3E09176, 0x5B5CF613, 0x49E959FD, 0xF1553E98, + 0x6C820621, 0xD43E6144, 0xC68BCEAA, 0x7E37A9CF, + 0xD67F4138, 0x6EC3265D, 0x7C7689B3, 0xC4CAEED6, + 0x591DD66F, 0xE1A1B10A, 0xF3141EE4, 0x4BA87981, + 0x13CB69D7, 0xAB770EB2, 0xB9C2A15C, 0x017EC639, + 0x9CA9FE80, 0x241599E5, 0x36A0360B, 0x8E1C516E, + 0x866616A7, 0x3EDA71C2, 0x2C6FDE2C, 0x94D3B949, + 0x090481F0, 0xB1B8E695, 0xA30D497B, 0x1BB12E1E, + 0x43D23E48, 0xFB6E592D, 0xE9DBF6C3, 0x516791A6, + 0xCCB0A91F, 0x740CCE7A, 0x66B96194, 0xDE0506F1 + }, { + 0x00000000, 0x3D6029B0, 0x7AC05360, 0x47A07AD0, + 0xF580A6C0, 0xC8E08F70, 0x8F40F5A0, 0xB220DC10, + 0x30704BC1, 0x0D106271, 0x4AB018A1, 0x77D03111, + 0xC5F0ED01, 0xF890C4B1, 0xBF30BE61, 0x825097D1, + 0x60E09782, 0x5D80BE32, 0x1A20C4E2, 0x2740ED52, + 0x95603142, 0xA80018F2, 0xEFA06222, 0xD2C04B92, + 0x5090DC43, 0x6DF0F5F3, 0x2A508F23, 0x1730A693, + 0xA5107A83, 0x98705333, 0xDFD029E3, 0xE2B00053, + 0xC1C12F04, 0xFCA106B4, 0xBB017C64, 0x866155D4, + 0x344189C4, 0x0921A074, 0x4E81DAA4, 0x73E1F314, + 0xF1B164C5, 0xCCD14D75, 0x8B7137A5, 0xB6111E15, + 0x0431C205, 0x3951EBB5, 0x7EF19165, 0x4391B8D5, + 0xA121B886, 0x9C419136, 0xDBE1EBE6, 0xE681C256, + 0x54A11E46, 0x69C137F6, 0x2E614D26, 0x13016496, + 0x9151F347, 0xAC31DAF7, 0xEB91A027, 0xD6F18997, + 0x64D15587, 0x59B17C37, 0x1E1106E7, 0x23712F57, + 0x58F35849, 0x659371F9, 0x22330B29, 0x1F532299, + 0xAD73FE89, 0x9013D739, 0xD7B3ADE9, 0xEAD38459, + 0x68831388, 0x55E33A38, 0x124340E8, 0x2F236958, + 0x9D03B548, 0xA0639CF8, 0xE7C3E628, 0xDAA3CF98, + 0x3813CFCB, 0x0573E67B, 0x42D39CAB, 0x7FB3B51B, + 0xCD93690B, 0xF0F340BB, 0xB7533A6B, 0x8A3313DB, + 0x0863840A, 0x3503ADBA, 0x72A3D76A, 0x4FC3FEDA, + 0xFDE322CA, 0xC0830B7A, 0x872371AA, 0xBA43581A, + 0x9932774D, 0xA4525EFD, 0xE3F2242D, 0xDE920D9D, + 0x6CB2D18D, 0x51D2F83D, 0x167282ED, 0x2B12AB5D, + 0xA9423C8C, 0x9422153C, 0xD3826FEC, 0xEEE2465C, + 0x5CC29A4C, 0x61A2B3FC, 0x2602C92C, 0x1B62E09C, + 0xF9D2E0CF, 0xC4B2C97F, 0x8312B3AF, 0xBE729A1F, + 0x0C52460F, 0x31326FBF, 0x7692156F, 0x4BF23CDF, + 0xC9A2AB0E, 0xF4C282BE, 0xB362F86E, 0x8E02D1DE, + 0x3C220DCE, 0x0142247E, 0x46E25EAE, 0x7B82771E, + 0xB1E6B092, 0x8C869922, 0xCB26E3F2, 0xF646CA42, + 0x44661652, 0x79063FE2, 0x3EA64532, 0x03C66C82, + 0x8196FB53, 0xBCF6D2E3, 0xFB56A833, 0xC6368183, + 0x74165D93, 0x49767423, 0x0ED60EF3, 0x33B62743, + 0xD1062710, 0xEC660EA0, 0xABC67470, 0x96A65DC0, + 0x248681D0, 0x19E6A860, 0x5E46D2B0, 0x6326FB00, + 0xE1766CD1, 0xDC164561, 0x9BB63FB1, 0xA6D61601, + 0x14F6CA11, 0x2996E3A1, 0x6E369971, 0x5356B0C1, + 0x70279F96, 0x4D47B626, 0x0AE7CCF6, 0x3787E546, + 0x85A73956, 0xB8C710E6, 0xFF676A36, 0xC2074386, + 0x4057D457, 0x7D37FDE7, 0x3A978737, 0x07F7AE87, + 0xB5D77297, 0x88B75B27, 0xCF1721F7, 0xF2770847, + 0x10C70814, 0x2DA721A4, 0x6A075B74, 0x576772C4, + 0xE547AED4, 0xD8278764, 0x9F87FDB4, 0xA2E7D404, + 0x20B743D5, 0x1DD76A65, 0x5A7710B5, 0x67173905, + 0xD537E515, 0xE857CCA5, 0xAFF7B675, 0x92979FC5, + 0xE915E8DB, 0xD475C16B, 0x93D5BBBB, 0xAEB5920B, + 0x1C954E1B, 0x21F567AB, 0x66551D7B, 0x5B3534CB, + 0xD965A31A, 0xE4058AAA, 0xA3A5F07A, 0x9EC5D9CA, + 0x2CE505DA, 0x11852C6A, 0x562556BA, 0x6B457F0A, + 0x89F57F59, 0xB49556E9, 0xF3352C39, 0xCE550589, + 0x7C75D999, 0x4115F029, 0x06B58AF9, 0x3BD5A349, + 0xB9853498, 0x84E51D28, 0xC34567F8, 0xFE254E48, + 0x4C059258, 0x7165BBE8, 0x36C5C138, 0x0BA5E888, + 0x28D4C7DF, 0x15B4EE6F, 0x521494BF, 0x6F74BD0F, + 0xDD54611F, 0xE03448AF, 0xA794327F, 0x9AF41BCF, + 0x18A48C1E, 0x25C4A5AE, 0x6264DF7E, 0x5F04F6CE, + 0xED242ADE, 0xD044036E, 0x97E479BE, 0xAA84500E, + 0x4834505D, 0x755479ED, 0x32F4033D, 0x0F942A8D, + 0xBDB4F69D, 0x80D4DF2D, 0xC774A5FD, 0xFA148C4D, + 0x78441B9C, 0x4524322C, 0x028448FC, 0x3FE4614C, + 0x8DC4BD5C, 0xB0A494EC, 0xF704EE3C, 0xCA64C78C + }, { + 0x00000000, 0xCB5CD3A5, 0x4DC8A10B, 0x869472AE, + 0x9B914216, 0x50CD91B3, 0xD659E31D, 0x1D0530B8, + 0xEC53826D, 0x270F51C8, 0xA19B2366, 0x6AC7F0C3, + 0x77C2C07B, 0xBC9E13DE, 0x3A0A6170, 0xF156B2D5, + 0x03D6029B, 0xC88AD13E, 0x4E1EA390, 0x85427035, + 0x9847408D, 0x531B9328, 0xD58FE186, 0x1ED33223, + 0xEF8580F6, 0x24D95353, 0xA24D21FD, 0x6911F258, + 0x7414C2E0, 0xBF481145, 0x39DC63EB, 0xF280B04E, + 0x07AC0536, 0xCCF0D693, 0x4A64A43D, 0x81387798, + 0x9C3D4720, 0x57619485, 0xD1F5E62B, 0x1AA9358E, + 0xEBFF875B, 0x20A354FE, 0xA6372650, 0x6D6BF5F5, + 0x706EC54D, 0xBB3216E8, 0x3DA66446, 0xF6FAB7E3, + 0x047A07AD, 0xCF26D408, 0x49B2A6A6, 0x82EE7503, + 0x9FEB45BB, 0x54B7961E, 0xD223E4B0, 0x197F3715, + 0xE82985C0, 0x23755665, 0xA5E124CB, 0x6EBDF76E, + 0x73B8C7D6, 0xB8E41473, 0x3E7066DD, 0xF52CB578, + 0x0F580A6C, 0xC404D9C9, 0x4290AB67, 0x89CC78C2, + 0x94C9487A, 0x5F959BDF, 0xD901E971, 0x125D3AD4, + 0xE30B8801, 0x28575BA4, 0xAEC3290A, 0x659FFAAF, + 0x789ACA17, 0xB3C619B2, 0x35526B1C, 0xFE0EB8B9, + 0x0C8E08F7, 0xC7D2DB52, 0x4146A9FC, 0x8A1A7A59, + 0x971F4AE1, 0x5C439944, 0xDAD7EBEA, 0x118B384F, + 0xE0DD8A9A, 0x2B81593F, 0xAD152B91, 0x6649F834, + 0x7B4CC88C, 0xB0101B29, 0x36846987, 0xFDD8BA22, + 0x08F40F5A, 0xC3A8DCFF, 0x453CAE51, 0x8E607DF4, + 0x93654D4C, 0x58399EE9, 0xDEADEC47, 0x15F13FE2, + 0xE4A78D37, 0x2FFB5E92, 0xA96F2C3C, 0x6233FF99, + 0x7F36CF21, 0xB46A1C84, 0x32FE6E2A, 0xF9A2BD8F, + 0x0B220DC1, 0xC07EDE64, 0x46EAACCA, 0x8DB67F6F, + 0x90B34FD7, 0x5BEF9C72, 0xDD7BEEDC, 0x16273D79, + 0xE7718FAC, 0x2C2D5C09, 0xAAB92EA7, 0x61E5FD02, + 0x7CE0CDBA, 0xB7BC1E1F, 0x31286CB1, 0xFA74BF14, + 0x1EB014D8, 0xD5ECC77D, 0x5378B5D3, 0x98246676, + 0x852156CE, 0x4E7D856B, 0xC8E9F7C5, 0x03B52460, + 0xF2E396B5, 0x39BF4510, 0xBF2B37BE, 0x7477E41B, + 0x6972D4A3, 0xA22E0706, 0x24BA75A8, 0xEFE6A60D, + 0x1D661643, 0xD63AC5E6, 0x50AEB748, 0x9BF264ED, + 0x86F75455, 0x4DAB87F0, 0xCB3FF55E, 0x006326FB, + 0xF135942E, 0x3A69478B, 0xBCFD3525, 0x77A1E680, + 0x6AA4D638, 0xA1F8059D, 0x276C7733, 0xEC30A496, + 0x191C11EE, 0xD240C24B, 0x54D4B0E5, 0x9F886340, + 0x828D53F8, 0x49D1805D, 0xCF45F2F3, 0x04192156, + 0xF54F9383, 0x3E134026, 0xB8873288, 0x73DBE12D, + 0x6EDED195, 0xA5820230, 0x2316709E, 0xE84AA33B, + 0x1ACA1375, 0xD196C0D0, 0x5702B27E, 0x9C5E61DB, + 0x815B5163, 0x4A0782C6, 0xCC93F068, 0x07CF23CD, + 0xF6999118, 0x3DC542BD, 0xBB513013, 0x700DE3B6, + 0x6D08D30E, 0xA65400AB, 0x20C07205, 0xEB9CA1A0, + 0x11E81EB4, 0xDAB4CD11, 0x5C20BFBF, 0x977C6C1A, + 0x8A795CA2, 0x41258F07, 0xC7B1FDA9, 0x0CED2E0C, + 0xFDBB9CD9, 0x36E74F7C, 0xB0733DD2, 0x7B2FEE77, + 0x662ADECF, 0xAD760D6A, 0x2BE27FC4, 0xE0BEAC61, + 0x123E1C2F, 0xD962CF8A, 0x5FF6BD24, 0x94AA6E81, + 0x89AF5E39, 0x42F38D9C, 0xC467FF32, 0x0F3B2C97, + 0xFE6D9E42, 0x35314DE7, 0xB3A53F49, 0x78F9ECEC, + 0x65FCDC54, 0xAEA00FF1, 0x28347D5F, 0xE368AEFA, + 0x16441B82, 0xDD18C827, 0x5B8CBA89, 0x90D0692C, + 0x8DD55994, 0x46898A31, 0xC01DF89F, 0x0B412B3A, + 0xFA1799EF, 0x314B4A4A, 0xB7DF38E4, 0x7C83EB41, + 0x6186DBF9, 0xAADA085C, 0x2C4E7AF2, 0xE712A957, + 0x15921919, 0xDECECABC, 0x585AB812, 0x93066BB7, + 0x8E035B0F, 0x455F88AA, 0xC3CBFA04, 0x089729A1, + 0xF9C19B74, 0x329D48D1, 0xB4093A7F, 0x7F55E9DA, + 0x6250D962, 0xA90C0AC7, 0x2F987869, 0xE4C4ABCC + }, { + 0x00000000, 0xA6770BB4, 0x979F1129, 0x31E81A9D, + 0xF44F2413, 0x52382FA7, 0x63D0353A, 0xC5A73E8E, + 0x33EF4E67, 0x959845D3, 0xA4705F4E, 0x020754FA, + 0xC7A06A74, 0x61D761C0, 0x503F7B5D, 0xF64870E9, + 0x67DE9CCE, 0xC1A9977A, 0xF0418DE7, 0x56368653, + 0x9391B8DD, 0x35E6B369, 0x040EA9F4, 0xA279A240, + 0x5431D2A9, 0xF246D91D, 0xC3AEC380, 0x65D9C834, + 0xA07EF6BA, 0x0609FD0E, 0x37E1E793, 0x9196EC27, + 0xCFBD399C, 0x69CA3228, 0x582228B5, 0xFE552301, + 0x3BF21D8F, 0x9D85163B, 0xAC6D0CA6, 0x0A1A0712, + 0xFC5277FB, 0x5A257C4F, 0x6BCD66D2, 0xCDBA6D66, + 0x081D53E8, 0xAE6A585C, 0x9F8242C1, 0x39F54975, + 0xA863A552, 0x0E14AEE6, 0x3FFCB47B, 0x998BBFCF, + 0x5C2C8141, 0xFA5B8AF5, 0xCBB39068, 0x6DC49BDC, + 0x9B8CEB35, 0x3DFBE081, 0x0C13FA1C, 0xAA64F1A8, + 0x6FC3CF26, 0xC9B4C492, 0xF85CDE0F, 0x5E2BD5BB, + 0x440B7579, 0xE27C7ECD, 0xD3946450, 0x75E36FE4, + 0xB044516A, 0x16335ADE, 0x27DB4043, 0x81AC4BF7, + 0x77E43B1E, 0xD19330AA, 0xE07B2A37, 0x460C2183, + 0x83AB1F0D, 0x25DC14B9, 0x14340E24, 0xB2430590, + 0x23D5E9B7, 0x85A2E203, 0xB44AF89E, 0x123DF32A, + 0xD79ACDA4, 0x71EDC610, 0x4005DC8D, 0xE672D739, + 0x103AA7D0, 0xB64DAC64, 0x87A5B6F9, 0x21D2BD4D, + 0xE47583C3, 0x42028877, 0x73EA92EA, 0xD59D995E, + 0x8BB64CE5, 0x2DC14751, 0x1C295DCC, 0xBA5E5678, + 0x7FF968F6, 0xD98E6342, 0xE86679DF, 0x4E11726B, + 0xB8590282, 0x1E2E0936, 0x2FC613AB, 0x89B1181F, + 0x4C162691, 0xEA612D25, 0xDB8937B8, 0x7DFE3C0C, + 0xEC68D02B, 0x4A1FDB9F, 0x7BF7C102, 0xDD80CAB6, + 0x1827F438, 0xBE50FF8C, 0x8FB8E511, 0x29CFEEA5, + 0xDF879E4C, 0x79F095F8, 0x48188F65, 0xEE6F84D1, + 0x2BC8BA5F, 0x8DBFB1EB, 0xBC57AB76, 0x1A20A0C2, + 0x8816EAF2, 0x2E61E146, 0x1F89FBDB, 0xB9FEF06F, + 0x7C59CEE1, 0xDA2EC555, 0xEBC6DFC8, 0x4DB1D47C, + 0xBBF9A495, 0x1D8EAF21, 0x2C66B5BC, 0x8A11BE08, + 0x4FB68086, 0xE9C18B32, 0xD82991AF, 0x7E5E9A1B, + 0xEFC8763C, 0x49BF7D88, 0x78576715, 0xDE206CA1, + 0x1B87522F, 0xBDF0599B, 0x8C184306, 0x2A6F48B2, + 0xDC27385B, 0x7A5033EF, 0x4BB82972, 0xEDCF22C6, + 0x28681C48, 0x8E1F17FC, 0xBFF70D61, 0x198006D5, + 0x47ABD36E, 0xE1DCD8DA, 0xD034C247, 0x7643C9F3, + 0xB3E4F77D, 0x1593FCC9, 0x247BE654, 0x820CEDE0, + 0x74449D09, 0xD23396BD, 0xE3DB8C20, 0x45AC8794, + 0x800BB91A, 0x267CB2AE, 0x1794A833, 0xB1E3A387, + 0x20754FA0, 0x86024414, 0xB7EA5E89, 0x119D553D, + 0xD43A6BB3, 0x724D6007, 0x43A57A9A, 0xE5D2712E, + 0x139A01C7, 0xB5ED0A73, 0x840510EE, 0x22721B5A, + 0xE7D525D4, 0x41A22E60, 0x704A34FD, 0xD63D3F49, + 0xCC1D9F8B, 0x6A6A943F, 0x5B828EA2, 0xFDF58516, + 0x3852BB98, 0x9E25B02C, 0xAFCDAAB1, 0x09BAA105, + 0xFFF2D1EC, 0x5985DA58, 0x686DC0C5, 0xCE1ACB71, + 0x0BBDF5FF, 0xADCAFE4B, 0x9C22E4D6, 0x3A55EF62, + 0xABC30345, 0x0DB408F1, 0x3C5C126C, 0x9A2B19D8, + 0x5F8C2756, 0xF9FB2CE2, 0xC813367F, 0x6E643DCB, + 0x982C4D22, 0x3E5B4696, 0x0FB35C0B, 0xA9C457BF, + 0x6C636931, 0xCA146285, 0xFBFC7818, 0x5D8B73AC, + 0x03A0A617, 0xA5D7ADA3, 0x943FB73E, 0x3248BC8A, + 0xF7EF8204, 0x519889B0, 0x6070932D, 0xC6079899, + 0x304FE870, 0x9638E3C4, 0xA7D0F959, 0x01A7F2ED, + 0xC400CC63, 0x6277C7D7, 0x539FDD4A, 0xF5E8D6FE, + 0x647E3AD9, 0xC209316D, 0xF3E12BF0, 0x55962044, + 0x90311ECA, 0x3646157E, 0x07AE0FE3, 0xA1D90457, + 0x579174BE, 0xF1E67F0A, 0xC00E6597, 0x66796E23, + 0xA3DE50AD, 0x05A95B19, 0x34414184, 0x92364A30 + }, { + 0x00000000, 0xCCAA009E, 0x4225077D, 0x8E8F07E3, + 0x844A0EFA, 0x48E00E64, 0xC66F0987, 0x0AC50919, + 0xD3E51BB5, 0x1F4F1B2B, 0x91C01CC8, 0x5D6A1C56, + 0x57AF154F, 0x9B0515D1, 0x158A1232, 0xD92012AC, + 0x7CBB312B, 0xB01131B5, 0x3E9E3656, 0xF23436C8, + 0xF8F13FD1, 0x345B3F4F, 0xBAD438AC, 0x767E3832, + 0xAF5E2A9E, 0x63F42A00, 0xED7B2DE3, 0x21D12D7D, + 0x2B142464, 0xE7BE24FA, 0x69312319, 0xA59B2387, + 0xF9766256, 0x35DC62C8, 0xBB53652B, 0x77F965B5, + 0x7D3C6CAC, 0xB1966C32, 0x3F196BD1, 0xF3B36B4F, + 0x2A9379E3, 0xE639797D, 0x68B67E9E, 0xA41C7E00, + 0xAED97719, 0x62737787, 0xECFC7064, 0x205670FA, + 0x85CD537D, 0x496753E3, 0xC7E85400, 0x0B42549E, + 0x01875D87, 0xCD2D5D19, 0x43A25AFA, 0x8F085A64, + 0x562848C8, 0x9A824856, 0x140D4FB5, 0xD8A74F2B, + 0xD2624632, 0x1EC846AC, 0x9047414F, 0x5CED41D1, + 0x299DC2ED, 0xE537C273, 0x6BB8C590, 0xA712C50E, + 0xADD7CC17, 0x617DCC89, 0xEFF2CB6A, 0x2358CBF4, + 0xFA78D958, 0x36D2D9C6, 0xB85DDE25, 0x74F7DEBB, + 0x7E32D7A2, 0xB298D73C, 0x3C17D0DF, 0xF0BDD041, + 0x5526F3C6, 0x998CF358, 0x1703F4BB, 0xDBA9F425, + 0xD16CFD3C, 0x1DC6FDA2, 0x9349FA41, 0x5FE3FADF, + 0x86C3E873, 0x4A69E8ED, 0xC4E6EF0E, 0x084CEF90, + 0x0289E689, 0xCE23E617, 0x40ACE1F4, 0x8C06E16A, + 0xD0EBA0BB, 0x1C41A025, 0x92CEA7C6, 0x5E64A758, + 0x54A1AE41, 0x980BAEDF, 0x1684A93C, 0xDA2EA9A2, + 0x030EBB0E, 0xCFA4BB90, 0x412BBC73, 0x8D81BCED, + 0x8744B5F4, 0x4BEEB56A, 0xC561B289, 0x09CBB217, + 0xAC509190, 0x60FA910E, 0xEE7596ED, 0x22DF9673, + 0x281A9F6A, 0xE4B09FF4, 0x6A3F9817, 0xA6959889, + 0x7FB58A25, 0xB31F8ABB, 0x3D908D58, 0xF13A8DC6, + 0xFBFF84DF, 0x37558441, 0xB9DA83A2, 0x7570833C, + 0x533B85DA, 0x9F918544, 0x111E82A7, 0xDDB48239, + 0xD7718B20, 0x1BDB8BBE, 0x95548C5D, 0x59FE8CC3, + 0x80DE9E6F, 0x4C749EF1, 0xC2FB9912, 0x0E51998C, + 0x04949095, 0xC83E900B, 0x46B197E8, 0x8A1B9776, + 0x2F80B4F1, 0xE32AB46F, 0x6DA5B38C, 0xA10FB312, + 0xABCABA0B, 0x6760BA95, 0xE9EFBD76, 0x2545BDE8, + 0xFC65AF44, 0x30CFAFDA, 0xBE40A839, 0x72EAA8A7, + 0x782FA1BE, 0xB485A120, 0x3A0AA6C3, 0xF6A0A65D, + 0xAA4DE78C, 0x66E7E712, 0xE868E0F1, 0x24C2E06F, + 0x2E07E976, 0xE2ADE9E8, 0x6C22EE0B, 0xA088EE95, + 0x79A8FC39, 0xB502FCA7, 0x3B8DFB44, 0xF727FBDA, + 0xFDE2F2C3, 0x3148F25D, 0xBFC7F5BE, 0x736DF520, + 0xD6F6D6A7, 0x1A5CD639, 0x94D3D1DA, 0x5879D144, + 0x52BCD85D, 0x9E16D8C3, 0x1099DF20, 0xDC33DFBE, + 0x0513CD12, 0xC9B9CD8C, 0x4736CA6F, 0x8B9CCAF1, + 0x8159C3E8, 0x4DF3C376, 0xC37CC495, 0x0FD6C40B, + 0x7AA64737, 0xB60C47A9, 0x3883404A, 0xF42940D4, + 0xFEEC49CD, 0x32464953, 0xBCC94EB0, 0x70634E2E, + 0xA9435C82, 0x65E95C1C, 0xEB665BFF, 0x27CC5B61, + 0x2D095278, 0xE1A352E6, 0x6F2C5505, 0xA386559B, + 0x061D761C, 0xCAB77682, 0x44387161, 0x889271FF, + 0x825778E6, 0x4EFD7878, 0xC0727F9B, 0x0CD87F05, + 0xD5F86DA9, 0x19526D37, 0x97DD6AD4, 0x5B776A4A, + 0x51B26353, 0x9D1863CD, 0x1397642E, 0xDF3D64B0, + 0x83D02561, 0x4F7A25FF, 0xC1F5221C, 0x0D5F2282, + 0x079A2B9B, 0xCB302B05, 0x45BF2CE6, 0x89152C78, + 0x50353ED4, 0x9C9F3E4A, 0x121039A9, 0xDEBA3937, + 0xD47F302E, 0x18D530B0, 0x965A3753, 0x5AF037CD, + 0xFF6B144A, 0x33C114D4, 0xBD4E1337, 0x71E413A9, + 0x7B211AB0, 0xB78B1A2E, 0x39041DCD, 0xF5AE1D53, + 0x2C8E0FFF, 0xE0240F61, 0x6EAB0882, 0xA201081C, + 0xA8C40105, 0x646E019B, 0xEAE10678, 0x264B06E6 + } +}; diff --git a/liblzma/check/crc32_tablegen.c b/liblzma/check/crc32_tablegen.c new file mode 100644 index 0000000..31a4d27 --- /dev/null +++ b/liblzma/check/crc32_tablegen.c @@ -0,0 +1,117 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file crc32_tablegen.c +/// \brief Generate crc32_table_le.h and crc32_table_be.h +/// +/// Compiling: gcc -std=c99 -o crc32_tablegen crc32_tablegen.c +/// Add -DWORDS_BIGENDIAN to generate big endian table. +/// Add -DLZ_HASH_TABLE to generate lz_encoder_hash_table.h (little endian). +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include +#include "../../common/tuklib_integer.h" + + +static uint32_t crc32_table[8][256]; + + +static void +init_crc32_table(void) +{ + static const uint32_t poly32 = UINT32_C(0xEDB88320); + + for (size_t s = 0; s < 8; ++s) { + for (size_t b = 0; b < 256; ++b) { + uint32_t r = s == 0 ? b : crc32_table[s - 1][b]; + + for (size_t i = 0; i < 8; ++i) { + if (r & 1) + r = (r >> 1) ^ poly32; + else + r >>= 1; + } + + crc32_table[s][b] = r; + } + } + +#ifdef WORDS_BIGENDIAN + for (size_t s = 0; s < 8; ++s) + for (size_t b = 0; b < 256; ++b) + crc32_table[s][b] = bswap32(crc32_table[s][b]); +#endif + + return; +} + + +static void +print_crc32_table(void) +{ + printf("/* This file has been automatically generated by " + "crc32_tablegen.c. */\n\n" + "const uint32_t lzma_crc32_table[8][256] = {\n\t{"); + + for (size_t s = 0; s < 8; ++s) { + for (size_t b = 0; b < 256; ++b) { + if ((b % 4) == 0) + printf("\n\t\t"); + + printf("0x%08" PRIX32, crc32_table[s][b]); + + if (b != 255) + printf(",%s", (b+1) % 4 == 0 ? "" : " "); + } + + if (s == 7) + printf("\n\t}\n};\n"); + else + printf("\n\t}, {"); + } + + return; +} + + +static void +print_lz_table(void) +{ + printf("/* This file has been automatically generated by " + "crc32_tablegen.c. */\n\n" + "const uint32_t lzma_lz_hash_table[256] = {"); + + for (size_t b = 0; b < 256; ++b) { + if ((b % 4) == 0) + printf("\n\t"); + + printf("0x%08" PRIX32, crc32_table[0][b]); + + if (b != 255) + printf(",%s", (b+1) % 4 == 0 ? "" : " "); + } + + printf("\n};\n"); + + return; +} + + +int +main(void) +{ + init_crc32_table(); + +#ifdef LZ_HASH_TABLE + print_lz_table(); +#else + print_crc32_table(); +#endif + + return 0; +} diff --git a/liblzma/check/crc32_x86.S b/liblzma/check/crc32_x86.S new file mode 100644 index 0000000..67f68a4 --- /dev/null +++ b/liblzma/check/crc32_x86.S @@ -0,0 +1,304 @@ +/* + * Speed-optimized CRC32 using slicing-by-eight algorithm + * + * This uses only i386 instructions, but it is optimized for i686 and later + * (including e.g. Pentium II/III/IV, Athlon XP, and Core 2). For i586 + * (e.g. Pentium), slicing-by-four would be better, and even the C version + * of slicing-by-eight built with gcc -march=i586 tends to be a little bit + * better than this. Very few probably run this code on i586 or older x86 + * so this shouldn't be a problem in practice. + * + * Authors: Igor Pavlov (original version) + * Lasse Collin (AT&T syntax, PIC support, better portability) + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * This code needs lzma_crc32_table, which can be created using the + * following C code: + +uint32_t lzma_crc32_table[8][256]; + +void +init_table(void) +{ + // IEEE-802.3 + static const uint32_t poly32 = UINT32_C(0xEDB88320); + + // Castagnoli + // static const uint32_t poly32 = UINT32_C(0x82F63B78); + + // Koopman + // static const uint32_t poly32 = UINT32_C(0xEB31D82E); + + for (size_t s = 0; s < 8; ++s) { + for (size_t b = 0; b < 256; ++b) { + uint32_t r = s == 0 ? b : lzma_crc32_table[s - 1][b]; + + for (size_t i = 0; i < 8; ++i) { + if (r & 1) + r = (r >> 1) ^ poly32; + else + r >>= 1; + } + + lzma_crc32_table[s][b] = r; + } + } +} + + * The prototype of the CRC32 function: + * extern uint32_t lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc); + */ + +/* + * On some systems, the functions need to be prefixed. The prefix is + * usually an underscore. + */ +#ifndef __USER_LABEL_PREFIX__ +# define __USER_LABEL_PREFIX__ +#endif +#define MAKE_SYM_CAT(prefix, sym) prefix ## sym +#define MAKE_SYM(prefix, sym) MAKE_SYM_CAT(prefix, sym) +#define LZMA_CRC32 MAKE_SYM(__USER_LABEL_PREFIX__, lzma_crc32) +#define LZMA_CRC32_TABLE MAKE_SYM(__USER_LABEL_PREFIX__, lzma_crc32_table) + +/* + * Solaris assembler doesn't have .p2align, and Darwin uses .align + * differently than GNU/Linux and Solaris. + */ +#if defined(__APPLE__) || defined(__MSDOS__) +# define ALIGN(pow2, abs) .align pow2 +#else +# define ALIGN(pow2, abs) .align abs +#endif + + .text + .globl LZMA_CRC32 + +#if !defined(__APPLE__) && !defined(_WIN32) && !defined(__CYGWIN__) \ + && !defined(__MSDOS__) + .type LZMA_CRC32, @function +#endif + + ALIGN(4, 16) +LZMA_CRC32: + /* + * Register usage: + * %eax crc + * %esi buf + * %edi size or buf + size + * %ebx lzma_crc32_table + * %ebp Table index + * %ecx Temporary + * %edx Temporary + */ + pushl %ebx + pushl %esi + pushl %edi + pushl %ebp + movl 0x14(%esp), %esi /* buf */ + movl 0x18(%esp), %edi /* size */ + movl 0x1C(%esp), %eax /* crc */ + + /* + * Store the address of lzma_crc32_table to %ebx. This is needed to + * get position-independent code (PIC). + * + * The PIC macro is defined by libtool, while __PIC__ is defined + * by GCC but only on some systems. Testing for both makes it simpler + * to test this code without libtool, and keeps the code working also + * when built with libtool but using something else than GCC. + * + * I understood that libtool may define PIC on Windows even though + * the code in Windows DLLs is not PIC in sense that it is in ELF + * binaries, so we need a separate check to always use the non-PIC + * code on Windows. + */ +#if (!defined(PIC) && !defined(__PIC__)) \ + || (defined(_WIN32) || defined(__CYGWIN__)) + /* Not PIC */ + movl $ LZMA_CRC32_TABLE, %ebx +#elif defined(__APPLE__) + /* Mach-O */ + call .L_get_pc +.L_pic: + leal .L_lzma_crc32_table$non_lazy_ptr-.L_pic(%ebx), %ebx + movl (%ebx), %ebx +#else + /* ELF */ + call .L_get_pc + addl $_GLOBAL_OFFSET_TABLE_, %ebx + movl LZMA_CRC32_TABLE at GOT(%ebx), %ebx +#endif + + /* Complement the initial value. */ + notl %eax + + ALIGN(4, 16) +.L_align: + /* + * Check if there is enough input to use slicing-by-eight. + * We need 16 bytes, because the loop pre-reads eight bytes. + */ + cmpl $16, %edi + jb .L_rest + + /* Check if we have reached alignment of eight bytes. */ + testl $7, %esi + jz .L_slice + + /* Calculate CRC of the next input byte. */ + movzbl (%esi), %ebp + incl %esi + movzbl %al, %ecx + xorl %ecx, %ebp + shrl $8, %eax + xorl (%ebx, %ebp, 4), %eax + decl %edi + jmp .L_align + + ALIGN(2, 4) +.L_slice: + /* + * If we get here, there's at least 16 bytes of aligned input + * available. Make %edi multiple of eight bytes. Store the possible + * remainder over the "size" variable in the argument stack. + */ + movl %edi, 0x18(%esp) + andl $-8, %edi + subl %edi, 0x18(%esp) + + /* + * Let %edi be buf + size - 8 while running the main loop. This way + * we can compare for equality to determine when exit the loop. + */ + addl %esi, %edi + subl $8, %edi + + /* Read in the first eight aligned bytes. */ + xorl (%esi), %eax + movl 4(%esi), %ecx + movzbl %cl, %ebp + +.L_loop: + movl 0x0C00(%ebx, %ebp, 4), %edx + movzbl %ch, %ebp + xorl 0x0800(%ebx, %ebp, 4), %edx + shrl $16, %ecx + xorl 8(%esi), %edx + movzbl %cl, %ebp + xorl 0x0400(%ebx, %ebp, 4), %edx + movzbl %ch, %ebp + xorl (%ebx, %ebp, 4), %edx + movzbl %al, %ebp + + /* + * Read the next four bytes, for which the CRC is calculated + * on the next interation of the loop. + */ + movl 12(%esi), %ecx + + xorl 0x1C00(%ebx, %ebp, 4), %edx + movzbl %ah, %ebp + shrl $16, %eax + xorl 0x1800(%ebx, %ebp, 4), %edx + movzbl %ah, %ebp + movzbl %al, %eax + movl 0x1400(%ebx, %eax, 4), %eax + addl $8, %esi + xorl %edx, %eax + xorl 0x1000(%ebx, %ebp, 4), %eax + + /* Check for end of aligned input. */ + cmpl %edi, %esi + movzbl %cl, %ebp + jne .L_loop + + /* + * Process the remaining eight bytes, which we have already + * copied to %ecx and %edx. + */ + movl 0x0C00(%ebx, %ebp, 4), %edx + movzbl %ch, %ebp + xorl 0x0800(%ebx, %ebp, 4), %edx + shrl $16, %ecx + movzbl %cl, %ebp + xorl 0x0400(%ebx, %ebp, 4), %edx + movzbl %ch, %ebp + xorl (%ebx, %ebp, 4), %edx + movzbl %al, %ebp + + xorl 0x1C00(%ebx, %ebp, 4), %edx + movzbl %ah, %ebp + shrl $16, %eax + xorl 0x1800(%ebx, %ebp, 4), %edx + movzbl %ah, %ebp + movzbl %al, %eax + movl 0x1400(%ebx, %eax, 4), %eax + addl $8, %esi + xorl %edx, %eax + xorl 0x1000(%ebx, %ebp, 4), %eax + + /* Copy the number of remaining bytes to %edi. */ + movl 0x18(%esp), %edi + +.L_rest: + /* Check for end of input. */ + testl %edi, %edi + jz .L_return + + /* Calculate CRC of the next input byte. */ + movzbl (%esi), %ebp + incl %esi + movzbl %al, %ecx + xorl %ecx, %ebp + shrl $8, %eax + xorl (%ebx, %ebp, 4), %eax + decl %edi + jmp .L_rest + +.L_return: + /* Complement the final value. */ + notl %eax + + popl %ebp + popl %edi + popl %esi + popl %ebx + ret + +#if defined(PIC) || defined(__PIC__) + ALIGN(4, 16) +.L_get_pc: + movl (%esp), %ebx + ret +#endif + +#if defined(__APPLE__) && (defined(PIC) || defined(__PIC__)) + /* Mach-O PIC */ + .section __IMPORT,__pointers,non_lazy_symbol_pointers +.L_lzma_crc32_table$non_lazy_ptr: + .indirect_symbol LZMA_CRC32_TABLE + .long 0 + +#elif defined(_WIN32) || defined(__CYGWIN__) +# ifdef DLL_EXPORT + /* This is equivalent of __declspec(dllexport). */ + .section .drectve + .ascii " -export:lzma_crc32" +# endif + +#elif !defined(__MSDOS__) + /* ELF */ + .size LZMA_CRC32, .-LZMA_CRC32 +#endif + +/* + * This is needed to support non-executable stack. It's ugly to + * use __linux__ here, but I don't know a way to detect when + * we are using GNU assembler. + */ +#if defined(__ELF__) && defined(__linux__) + .section .note.GNU-stack,"", at progbits +#endif diff --git a/liblzma/check/crc64_fast.c b/liblzma/check/crc64_fast.c new file mode 100644 index 0000000..52af29e --- /dev/null +++ b/liblzma/check/crc64_fast.c @@ -0,0 +1,72 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file crc64.c +/// \brief CRC64 calculation +/// +/// Calculate the CRC64 using the slice-by-four algorithm. This is the same +/// idea that is used in crc32_fast.c, but for CRC64 we use only four tables +/// instead of eight to avoid increasing CPU cache usage. +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "check.h" +#include "crc_macros.h" + + +#ifdef WORDS_BIGENDIAN +# define A1(x) ((x) >> 56) +#else +# define A1 A +#endif + + +// See the comments in crc32_fast.c. They aren't duplicated here. +extern LZMA_API(uint64_t) +lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc) +{ + crc = ~crc; + +#ifdef WORDS_BIGENDIAN + crc = bswap64(crc); +#endif + + if (size > 4) { + while ((uintptr_t)(buf) & 3) { + crc = lzma_crc64_table[0][*buf++ ^ A1(crc)] ^ S8(crc); + --size; + } + + const uint8_t *const limit = buf + (size & ~(size_t)(3)); + size &= (size_t)(3); + + while (buf < limit) { +#ifdef WORDS_BIGENDIAN + const uint32_t tmp = (crc >> 32) + ^ *(const uint32_t *)(buf); +#else + const uint32_t tmp = crc ^ *(const uint32_t *)(buf); +#endif + buf += 4; + + crc = lzma_crc64_table[3][A(tmp)] + ^ lzma_crc64_table[2][B(tmp)] + ^ S32(crc) + ^ lzma_crc64_table[1][C(tmp)] + ^ lzma_crc64_table[0][D(tmp)]; + } + } + + while (size-- != 0) + crc = lzma_crc64_table[0][*buf++ ^ A1(crc)] ^ S8(crc); + +#ifdef WORDS_BIGENDIAN + crc = bswap64(crc); +#endif + + return ~crc; +} diff --git a/liblzma/check/crc64_small.c b/liblzma/check/crc64_small.c new file mode 100644 index 0000000..55d7231 --- /dev/null +++ b/liblzma/check/crc64_small.c @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file crc64_small.c +/// \brief CRC64 calculation (size-optimized) +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "check.h" + + +static uint64_t crc64_table[256]; + + +static void +crc64_init(void) +{ + static const uint64_t poly64 = UINT64_C(0xC96C5795D7870F42); + + for (size_t b = 0; b < 256; ++b) { + uint64_t r = b; + for (size_t i = 0; i < 8; ++i) { + if (r & 1) + r = (r >> 1) ^ poly64; + else + r >>= 1; + } + + crc64_table[b] = r; + } + + return; +} + + +extern LZMA_API(uint64_t) +lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc) +{ + mythread_once(crc64_init); + + crc = ~crc; + + while (size != 0) { + crc = crc64_table[*buf++ ^ (crc & 0xFF)] ^ (crc >> 8); + --size; + } + + return ~crc; +} diff --git a/liblzma/check/crc64_table.c b/liblzma/check/crc64_table.c new file mode 100644 index 0000000..1fbcd94 --- /dev/null +++ b/liblzma/check/crc64_table.c @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file crc64_table.c +/// \brief Precalculated CRC64 table with correct endianness +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "common.h" + +#ifdef WORDS_BIGENDIAN +# include "crc64_table_be.h" +#else +# include "crc64_table_le.h" +#endif diff --git a/liblzma/check/crc64_table_be.h b/liblzma/check/crc64_table_be.h new file mode 100644 index 0000000..ea074f3 --- /dev/null +++ b/liblzma/check/crc64_table_be.h @@ -0,0 +1,521 @@ +/* This file has been automatically generated by crc64_tablegen.c. */ + +const uint64_t lzma_crc64_table[4][256] = { + { + UINT64_C(0x0000000000000000), UINT64_C(0x6F5FA703BE4C2EB3), + UINT64_C(0x5BA040A8573684F4), UINT64_C(0x34FFE7ABE97AAA47), + UINT64_C(0x335E8FFF84C3D07B), UINT64_C(0x5C0128FC3A8FFEC8), + UINT64_C(0x68FECF57D3F5548F), UINT64_C(0x07A168546DB97A3C), + UINT64_C(0x66BC1EFF0987A1F7), UINT64_C(0x09E3B9FCB7CB8F44), + UINT64_C(0x3D1C5E575EB12503), UINT64_C(0x5243F954E0FD0BB0), + UINT64_C(0x55E291008D44718C), UINT64_C(0x3ABD360333085F3F), + UINT64_C(0x0E42D1A8DA72F578), UINT64_C(0x611D76AB643EDBCB), + UINT64_C(0x4966335138A19B7D), UINT64_C(0x2639945286EDB5CE), + UINT64_C(0x12C673F96F971F89), UINT64_C(0x7D99D4FAD1DB313A), + UINT64_C(0x7A38BCAEBC624B06), UINT64_C(0x15671BAD022E65B5), + UINT64_C(0x2198FC06EB54CFF2), UINT64_C(0x4EC75B055518E141), + UINT64_C(0x2FDA2DAE31263A8A), UINT64_C(0x40858AAD8F6A1439), + UINT64_C(0x747A6D066610BE7E), UINT64_C(0x1B25CA05D85C90CD), + UINT64_C(0x1C84A251B5E5EAF1), UINT64_C(0x73DB05520BA9C442), + UINT64_C(0x4724E2F9E2D36E05), UINT64_C(0x287B45FA5C9F40B6), + UINT64_C(0x92CC66A2704237FB), UINT64_C(0xFD93C1A1CE0E1948), + UINT64_C(0xC96C260A2774B30F), UINT64_C(0xA633810999389DBC), + UINT64_C(0xA192E95DF481E780), UINT64_C(0xCECD4E5E4ACDC933), + UINT64_C(0xFA32A9F5A3B76374), UINT64_C(0x956D0EF61DFB4DC7), + UINT64_C(0xF470785D79C5960C), UINT64_C(0x9B2FDF5EC789B8BF), + UINT64_C(0xAFD038F52EF312F8), UINT64_C(0xC08F9FF690BF3C4B), + UINT64_C(0xC72EF7A2FD064677), UINT64_C(0xA87150A1434A68C4), + UINT64_C(0x9C8EB70AAA30C283), UINT64_C(0xF3D11009147CEC30), + UINT64_C(0xDBAA55F348E3AC86), UINT64_C(0xB4F5F2F0F6AF8235), + UINT64_C(0x800A155B1FD52872), UINT64_C(0xEF55B258A19906C1), + UINT64_C(0xE8F4DA0CCC207CFD), UINT64_C(0x87AB7D0F726C524E), + UINT64_C(0xB3549AA49B16F809), UINT64_C(0xDC0B3DA7255AD6BA), + UINT64_C(0xBD164B0C41640D71), UINT64_C(0xD249EC0FFF2823C2), + UINT64_C(0xE6B60BA416528985), UINT64_C(0x89E9ACA7A81EA736), + UINT64_C(0x8E48C4F3C5A7DD0A), UINT64_C(0xE11763F07BEBF3B9), + UINT64_C(0xD5E8845B929159FE), UINT64_C(0xBAB723582CDD774D), + UINT64_C(0xA187C3EBCA2BB664), UINT64_C(0xCED864E8746798D7), + UINT64_C(0xFA2783439D1D3290), UINT64_C(0x9578244023511C23), + UINT64_C(0x92D94C144EE8661F), UINT64_C(0xFD86EB17F0A448AC), + UINT64_C(0xC9790CBC19DEE2EB), UINT64_C(0xA626ABBFA792CC58), + UINT64_C(0xC73BDD14C3AC1793), UINT64_C(0xA8647A177DE03920), + UINT64_C(0x9C9B9DBC949A9367), UINT64_C(0xF3C43ABF2AD6BDD4), + UINT64_C(0xF46552EB476FC7E8), UINT64_C(0x9B3AF5E8F923E95B), + UINT64_C(0xAFC512431059431C), UINT64_C(0xC09AB540AE156DAF), + UINT64_C(0xE8E1F0BAF28A2D19), UINT64_C(0x87BE57B94CC603AA), + UINT64_C(0xB341B012A5BCA9ED), UINT64_C(0xDC1E17111BF0875E), + UINT64_C(0xDBBF7F457649FD62), UINT64_C(0xB4E0D846C805D3D1), + UINT64_C(0x801F3FED217F7996), UINT64_C(0xEF4098EE9F335725), + UINT64_C(0x8E5DEE45FB0D8CEE), UINT64_C(0xE10249464541A25D), + UINT64_C(0xD5FDAEEDAC3B081A), UINT64_C(0xBAA209EE127726A9), + UINT64_C(0xBD0361BA7FCE5C95), UINT64_C(0xD25CC6B9C1827226), + UINT64_C(0xE6A3211228F8D861), UINT64_C(0x89FC861196B4F6D2), + UINT64_C(0x334BA549BA69819F), UINT64_C(0x5C14024A0425AF2C), + UINT64_C(0x68EBE5E1ED5F056B), UINT64_C(0x07B442E253132BD8), + UINT64_C(0x00152AB63EAA51E4), UINT64_C(0x6F4A8DB580E67F57), + UINT64_C(0x5BB56A1E699CD510), UINT64_C(0x34EACD1DD7D0FBA3), + UINT64_C(0x55F7BBB6B3EE2068), UINT64_C(0x3AA81CB50DA20EDB), + UINT64_C(0x0E57FB1EE4D8A49C), UINT64_C(0x61085C1D5A948A2F), + UINT64_C(0x66A93449372DF013), UINT64_C(0x09F6934A8961DEA0), + UINT64_C(0x3D0974E1601B74E7), UINT64_C(0x5256D3E2DE575A54), + UINT64_C(0x7A2D961882C81AE2), UINT64_C(0x1572311B3C843451), + UINT64_C(0x218DD6B0D5FE9E16), UINT64_C(0x4ED271B36BB2B0A5), + UINT64_C(0x497319E7060BCA99), UINT64_C(0x262CBEE4B847E42A), + UINT64_C(0x12D3594F513D4E6D), UINT64_C(0x7D8CFE4CEF7160DE), + UINT64_C(0x1C9188E78B4FBB15), UINT64_C(0x73CE2FE4350395A6), + UINT64_C(0x4731C84FDC793FE1), UINT64_C(0x286E6F4C62351152), + UINT64_C(0x2FCF07180F8C6B6E), UINT64_C(0x4090A01BB1C045DD), + UINT64_C(0x746F47B058BAEF9A), UINT64_C(0x1B30E0B3E6F6C129), + UINT64_C(0x420F87D795576CC9), UINT64_C(0x2D5020D42B1B427A), + UINT64_C(0x19AFC77FC261E83D), UINT64_C(0x76F0607C7C2DC68E), + UINT64_C(0x715108281194BCB2), UINT64_C(0x1E0EAF2BAFD89201), + UINT64_C(0x2AF1488046A23846), UINT64_C(0x45AEEF83F8EE16F5), + UINT64_C(0x24B399289CD0CD3E), UINT64_C(0x4BEC3E2B229CE38D), + UINT64_C(0x7F13D980CBE649CA), UINT64_C(0x104C7E8375AA6779), + UINT64_C(0x17ED16D718131D45), UINT64_C(0x78B2B1D4A65F33F6), + UINT64_C(0x4C4D567F4F2599B1), UINT64_C(0x2312F17CF169B702), + UINT64_C(0x0B69B486ADF6F7B4), UINT64_C(0x6436138513BAD907), + UINT64_C(0x50C9F42EFAC07340), UINT64_C(0x3F96532D448C5DF3), + UINT64_C(0x38373B79293527CF), UINT64_C(0x57689C7A9779097C), + UINT64_C(0x63977BD17E03A33B), UINT64_C(0x0CC8DCD2C04F8D88), + UINT64_C(0x6DD5AA79A4715643), UINT64_C(0x028A0D7A1A3D78F0), + UINT64_C(0x3675EAD1F347D2B7), UINT64_C(0x592A4DD24D0BFC04), + UINT64_C(0x5E8B258620B28638), UINT64_C(0x31D482859EFEA88B), + UINT64_C(0x052B652E778402CC), UINT64_C(0x6A74C22DC9C82C7F), + UINT64_C(0xD0C3E175E5155B32), UINT64_C(0xBF9C46765B597581), + UINT64_C(0x8B63A1DDB223DFC6), UINT64_C(0xE43C06DE0C6FF175), + UINT64_C(0xE39D6E8A61D68B49), UINT64_C(0x8CC2C989DF9AA5FA), + UINT64_C(0xB83D2E2236E00FBD), UINT64_C(0xD762892188AC210E), + UINT64_C(0xB67FFF8AEC92FAC5), UINT64_C(0xD920588952DED476), + UINT64_C(0xEDDFBF22BBA47E31), UINT64_C(0x8280182105E85082), + UINT64_C(0x8521707568512ABE), UINT64_C(0xEA7ED776D61D040D), + UINT64_C(0xDE8130DD3F67AE4A), UINT64_C(0xB1DE97DE812B80F9), + UINT64_C(0x99A5D224DDB4C04F), UINT64_C(0xF6FA752763F8EEFC), + UINT64_C(0xC205928C8A8244BB), UINT64_C(0xAD5A358F34CE6A08), + UINT64_C(0xAAFB5DDB59771034), UINT64_C(0xC5A4FAD8E73B3E87), + UINT64_C(0xF15B1D730E4194C0), UINT64_C(0x9E04BA70B00DBA73), + UINT64_C(0xFF19CCDBD43361B8), UINT64_C(0x90466BD86A7F4F0B), + UINT64_C(0xA4B98C738305E54C), UINT64_C(0xCBE62B703D49CBFF), + UINT64_C(0xCC47432450F0B1C3), UINT64_C(0xA318E427EEBC9F70), + UINT64_C(0x97E7038C07C63537), UINT64_C(0xF8B8A48FB98A1B84), + UINT64_C(0xE388443C5F7CDAAD), UINT64_C(0x8CD7E33FE130F41E), + UINT64_C(0xB8280494084A5E59), UINT64_C(0xD777A397B60670EA), + UINT64_C(0xD0D6CBC3DBBF0AD6), UINT64_C(0xBF896CC065F32465), + UINT64_C(0x8B768B6B8C898E22), UINT64_C(0xE4292C6832C5A091), + UINT64_C(0x85345AC356FB7B5A), UINT64_C(0xEA6BFDC0E8B755E9), + UINT64_C(0xDE941A6B01CDFFAE), UINT64_C(0xB1CBBD68BF81D11D), + UINT64_C(0xB66AD53CD238AB21), UINT64_C(0xD935723F6C748592), + UINT64_C(0xEDCA9594850E2FD5), UINT64_C(0x829532973B420166), + UINT64_C(0xAAEE776D67DD41D0), UINT64_C(0xC5B1D06ED9916F63), + UINT64_C(0xF14E37C530EBC524), UINT64_C(0x9E1190C68EA7EB97), + UINT64_C(0x99B0F892E31E91AB), UINT64_C(0xF6EF5F915D52BF18), + UINT64_C(0xC210B83AB428155F), UINT64_C(0xAD4F1F390A643BEC), + UINT64_C(0xCC5269926E5AE027), UINT64_C(0xA30DCE91D016CE94), + UINT64_C(0x97F2293A396C64D3), UINT64_C(0xF8AD8E3987204A60), + UINT64_C(0xFF0CE66DEA99305C), UINT64_C(0x9053416E54D51EEF), + UINT64_C(0xA4ACA6C5BDAFB4A8), UINT64_C(0xCBF301C603E39A1B), + UINT64_C(0x7144229E2F3EED56), UINT64_C(0x1E1B859D9172C3E5), + UINT64_C(0x2AE46236780869A2), UINT64_C(0x45BBC535C6444711), + UINT64_C(0x421AAD61ABFD3D2D), UINT64_C(0x2D450A6215B1139E), + UINT64_C(0x19BAEDC9FCCBB9D9), UINT64_C(0x76E54ACA4287976A), + UINT64_C(0x17F83C6126B94CA1), UINT64_C(0x78A79B6298F56212), + UINT64_C(0x4C587CC9718FC855), UINT64_C(0x2307DBCACFC3E6E6), + UINT64_C(0x24A6B39EA27A9CDA), UINT64_C(0x4BF9149D1C36B269), + UINT64_C(0x7F06F336F54C182E), UINT64_C(0x105954354B00369D), + UINT64_C(0x382211CF179F762B), UINT64_C(0x577DB6CCA9D35898), + UINT64_C(0x6382516740A9F2DF), UINT64_C(0x0CDDF664FEE5DC6C), + UINT64_C(0x0B7C9E30935CA650), UINT64_C(0x642339332D1088E3), + UINT64_C(0x50DCDE98C46A22A4), UINT64_C(0x3F83799B7A260C17), + UINT64_C(0x5E9E0F301E18D7DC), UINT64_C(0x31C1A833A054F96F), + UINT64_C(0x053E4F98492E5328), UINT64_C(0x6A61E89BF7627D9B), + UINT64_C(0x6DC080CF9ADB07A7), UINT64_C(0x029F27CC24972914), + UINT64_C(0x3660C067CDED8353), UINT64_C(0x593F676473A1ADE0) + }, { + UINT64_C(0x0000000000000000), UINT64_C(0x0DF1D05C9279E954), + UINT64_C(0x1AE2A1B924F3D2A9), UINT64_C(0x171371E5B68A3BFD), + UINT64_C(0xB1DA4DDC62497DC1), UINT64_C(0xBC2B9D80F0309495), + UINT64_C(0xAB38EC6546BAAF68), UINT64_C(0xA6C93C39D4C3463C), + UINT64_C(0xE7AB9517EE3D2210), UINT64_C(0xEA5A454B7C44CB44), + UINT64_C(0xFD4934AECACEF0B9), UINT64_C(0xF0B8E4F258B719ED), + UINT64_C(0x5671D8CB8C745FD1), UINT64_C(0x5B8008971E0DB685), + UINT64_C(0x4C937972A8878D78), UINT64_C(0x4162A92E3AFE642C), + UINT64_C(0xCE572B2FDC7B4420), UINT64_C(0xC3A6FB734E02AD74), + UINT64_C(0xD4B58A96F8889689), UINT64_C(0xD9445ACA6AF17FDD), + UINT64_C(0x7F8D66F3BE3239E1), UINT64_C(0x727CB6AF2C4BD0B5), + UINT64_C(0x656FC74A9AC1EB48), UINT64_C(0x689E171608B8021C), + UINT64_C(0x29FCBE3832466630), UINT64_C(0x240D6E64A03F8F64), + UINT64_C(0x331E1F8116B5B499), UINT64_C(0x3EEFCFDD84CC5DCD), + UINT64_C(0x9826F3E4500F1BF1), UINT64_C(0x95D723B8C276F2A5), + UINT64_C(0x82C4525D74FCC958), UINT64_C(0x8F358201E685200C), + UINT64_C(0x9CAF565EB8F78840), UINT64_C(0x915E86022A8E6114), + UINT64_C(0x864DF7E79C045AE9), UINT64_C(0x8BBC27BB0E7DB3BD), + UINT64_C(0x2D751B82DABEF581), UINT64_C(0x2084CBDE48C71CD5), + UINT64_C(0x3797BA3BFE4D2728), UINT64_C(0x3A666A676C34CE7C), + UINT64_C(0x7B04C34956CAAA50), UINT64_C(0x76F51315C4B34304), + UINT64_C(0x61E662F0723978F9), UINT64_C(0x6C17B2ACE04091AD), + UINT64_C(0xCADE8E953483D791), UINT64_C(0xC72F5EC9A6FA3EC5), + UINT64_C(0xD03C2F2C10700538), UINT64_C(0xDDCDFF708209EC6C), + UINT64_C(0x52F87D71648CCC60), UINT64_C(0x5F09AD2DF6F52534), + UINT64_C(0x481ADCC8407F1EC9), UINT64_C(0x45EB0C94D206F79D), + UINT64_C(0xE32230AD06C5B1A1), UINT64_C(0xEED3E0F194BC58F5), + UINT64_C(0xF9C0911422366308), UINT64_C(0xF4314148B04F8A5C), + UINT64_C(0xB553E8668AB1EE70), UINT64_C(0xB8A2383A18C80724), + UINT64_C(0xAFB149DFAE423CD9), UINT64_C(0xA24099833C3BD58D), + UINT64_C(0x0489A5BAE8F893B1), UINT64_C(0x097875E67A817AE5), + UINT64_C(0x1E6B0403CC0B4118), UINT64_C(0x139AD45F5E72A84C), + UINT64_C(0x385FADBC70EF1181), UINT64_C(0x35AE7DE0E296F8D5), + UINT64_C(0x22BD0C05541CC328), UINT64_C(0x2F4CDC59C6652A7C), + UINT64_C(0x8985E06012A66C40), UINT64_C(0x8474303C80DF8514), + UINT64_C(0x936741D93655BEE9), UINT64_C(0x9E969185A42C57BD), + UINT64_C(0xDFF438AB9ED23391), UINT64_C(0xD205E8F70CABDAC5), + UINT64_C(0xC5169912BA21E138), UINT64_C(0xC8E7494E2858086C), + UINT64_C(0x6E2E7577FC9B4E50), UINT64_C(0x63DFA52B6EE2A704), + UINT64_C(0x74CCD4CED8689CF9), UINT64_C(0x793D04924A1175AD), + UINT64_C(0xF6088693AC9455A1), UINT64_C(0xFBF956CF3EEDBCF5), + UINT64_C(0xECEA272A88678708), UINT64_C(0xE11BF7761A1E6E5C), + UINT64_C(0x47D2CB4FCEDD2860), UINT64_C(0x4A231B135CA4C134), + UINT64_C(0x5D306AF6EA2EFAC9), UINT64_C(0x50C1BAAA7857139D), + UINT64_C(0x11A3138442A977B1), UINT64_C(0x1C52C3D8D0D09EE5), + UINT64_C(0x0B41B23D665AA518), UINT64_C(0x06B06261F4234C4C), + UINT64_C(0xA0795E5820E00A70), UINT64_C(0xAD888E04B299E324), + UINT64_C(0xBA9BFFE10413D8D9), UINT64_C(0xB76A2FBD966A318D), + UINT64_C(0xA4F0FBE2C81899C1), UINT64_C(0xA9012BBE5A617095), + UINT64_C(0xBE125A5BECEB4B68), UINT64_C(0xB3E38A077E92A23C), + UINT64_C(0x152AB63EAA51E400), UINT64_C(0x18DB666238280D54), + UINT64_C(0x0FC817878EA236A9), UINT64_C(0x0239C7DB1CDBDFFD), + UINT64_C(0x435B6EF52625BBD1), UINT64_C(0x4EAABEA9B45C5285), + UINT64_C(0x59B9CF4C02D66978), UINT64_C(0x54481F1090AF802C), + UINT64_C(0xF2812329446CC610), UINT64_C(0xFF70F375D6152F44), + UINT64_C(0xE8638290609F14B9), UINT64_C(0xE59252CCF2E6FDED), + UINT64_C(0x6AA7D0CD1463DDE1), UINT64_C(0x67560091861A34B5), + UINT64_C(0x7045717430900F48), UINT64_C(0x7DB4A128A2E9E61C), + UINT64_C(0xDB7D9D11762AA020), UINT64_C(0xD68C4D4DE4534974), + UINT64_C(0xC19F3CA852D97289), UINT64_C(0xCC6EECF4C0A09BDD), + UINT64_C(0x8D0C45DAFA5EFFF1), UINT64_C(0x80FD9586682716A5), + UINT64_C(0x97EEE463DEAD2D58), UINT64_C(0x9A1F343F4CD4C40C), + UINT64_C(0x3CD6080698178230), UINT64_C(0x3127D85A0A6E6B64), + UINT64_C(0x2634A9BFBCE45099), UINT64_C(0x2BC579E32E9DB9CD), + UINT64_C(0xF5A054D6CA71FB90), UINT64_C(0xF851848A580812C4), + UINT64_C(0xEF42F56FEE822939), UINT64_C(0xE2B325337CFBC06D), + UINT64_C(0x447A190AA8388651), UINT64_C(0x498BC9563A416F05), + UINT64_C(0x5E98B8B38CCB54F8), UINT64_C(0x536968EF1EB2BDAC), + UINT64_C(0x120BC1C1244CD980), UINT64_C(0x1FFA119DB63530D4), + UINT64_C(0x08E9607800BF0B29), UINT64_C(0x0518B02492C6E27D), + UINT64_C(0xA3D18C1D4605A441), UINT64_C(0xAE205C41D47C4D15), + UINT64_C(0xB9332DA462F676E8), UINT64_C(0xB4C2FDF8F08F9FBC), + UINT64_C(0x3BF77FF9160ABFB0), UINT64_C(0x3606AFA5847356E4), + UINT64_C(0x2115DE4032F96D19), UINT64_C(0x2CE40E1CA080844D), + UINT64_C(0x8A2D32257443C271), UINT64_C(0x87DCE279E63A2B25), + UINT64_C(0x90CF939C50B010D8), UINT64_C(0x9D3E43C0C2C9F98C), + UINT64_C(0xDC5CEAEEF8379DA0), UINT64_C(0xD1AD3AB26A4E74F4), + UINT64_C(0xC6BE4B57DCC44F09), UINT64_C(0xCB4F9B0B4EBDA65D), + UINT64_C(0x6D86A7329A7EE061), UINT64_C(0x6077776E08070935), + UINT64_C(0x7764068BBE8D32C8), UINT64_C(0x7A95D6D72CF4DB9C), + UINT64_C(0x690F0288728673D0), UINT64_C(0x64FED2D4E0FF9A84), + UINT64_C(0x73EDA3315675A179), UINT64_C(0x7E1C736DC40C482D), + UINT64_C(0xD8D54F5410CF0E11), UINT64_C(0xD5249F0882B6E745), + UINT64_C(0xC237EEED343CDCB8), UINT64_C(0xCFC63EB1A64535EC), + UINT64_C(0x8EA4979F9CBB51C0), UINT64_C(0x835547C30EC2B894), + UINT64_C(0x94463626B8488369), UINT64_C(0x99B7E67A2A316A3D), + UINT64_C(0x3F7EDA43FEF22C01), UINT64_C(0x328F0A1F6C8BC555), + UINT64_C(0x259C7BFADA01FEA8), UINT64_C(0x286DABA6487817FC), + UINT64_C(0xA75829A7AEFD37F0), UINT64_C(0xAAA9F9FB3C84DEA4), + UINT64_C(0xBDBA881E8A0EE559), UINT64_C(0xB04B584218770C0D), + UINT64_C(0x1682647BCCB44A31), UINT64_C(0x1B73B4275ECDA365), + UINT64_C(0x0C60C5C2E8479898), UINT64_C(0x0191159E7A3E71CC), + UINT64_C(0x40F3BCB040C015E0), UINT64_C(0x4D026CECD2B9FCB4), + UINT64_C(0x5A111D096433C749), UINT64_C(0x57E0CD55F64A2E1D), + UINT64_C(0xF129F16C22896821), UINT64_C(0xFCD82130B0F08175), + UINT64_C(0xEBCB50D5067ABA88), UINT64_C(0xE63A8089940353DC), + UINT64_C(0xCDFFF96ABA9EEA11), UINT64_C(0xC00E293628E70345), + UINT64_C(0xD71D58D39E6D38B8), UINT64_C(0xDAEC888F0C14D1EC), + UINT64_C(0x7C25B4B6D8D797D0), UINT64_C(0x71D464EA4AAE7E84), + UINT64_C(0x66C7150FFC244579), UINT64_C(0x6B36C5536E5DAC2D), + UINT64_C(0x2A546C7D54A3C801), UINT64_C(0x27A5BC21C6DA2155), + UINT64_C(0x30B6CDC470501AA8), UINT64_C(0x3D471D98E229F3FC), + UINT64_C(0x9B8E21A136EAB5C0), UINT64_C(0x967FF1FDA4935C94), + UINT64_C(0x816C801812196769), UINT64_C(0x8C9D504480608E3D), + UINT64_C(0x03A8D24566E5AE31), UINT64_C(0x0E590219F49C4765), + UINT64_C(0x194A73FC42167C98), UINT64_C(0x14BBA3A0D06F95CC), + UINT64_C(0xB2729F9904ACD3F0), UINT64_C(0xBF834FC596D53AA4), + UINT64_C(0xA8903E20205F0159), UINT64_C(0xA561EE7CB226E80D), + UINT64_C(0xE403475288D88C21), UINT64_C(0xE9F2970E1AA16575), + UINT64_C(0xFEE1E6EBAC2B5E88), UINT64_C(0xF31036B73E52B7DC), + UINT64_C(0x55D90A8EEA91F1E0), UINT64_C(0x5828DAD278E818B4), + UINT64_C(0x4F3BAB37CE622349), UINT64_C(0x42CA7B6B5C1BCA1D), + UINT64_C(0x5150AF3402696251), UINT64_C(0x5CA17F6890108B05), + UINT64_C(0x4BB20E8D269AB0F8), UINT64_C(0x4643DED1B4E359AC), + UINT64_C(0xE08AE2E860201F90), UINT64_C(0xED7B32B4F259F6C4), + UINT64_C(0xFA68435144D3CD39), UINT64_C(0xF799930DD6AA246D), + UINT64_C(0xB6FB3A23EC544041), UINT64_C(0xBB0AEA7F7E2DA915), + UINT64_C(0xAC199B9AC8A792E8), UINT64_C(0xA1E84BC65ADE7BBC), + UINT64_C(0x072177FF8E1D3D80), UINT64_C(0x0AD0A7A31C64D4D4), + UINT64_C(0x1DC3D646AAEEEF29), UINT64_C(0x1032061A3897067D), + UINT64_C(0x9F07841BDE122671), UINT64_C(0x92F654474C6BCF25), + UINT64_C(0x85E525A2FAE1F4D8), UINT64_C(0x8814F5FE68981D8C), + UINT64_C(0x2EDDC9C7BC5B5BB0), UINT64_C(0x232C199B2E22B2E4), + UINT64_C(0x343F687E98A88919), UINT64_C(0x39CEB8220AD1604D), + UINT64_C(0x78AC110C302F0461), UINT64_C(0x755DC150A256ED35), + UINT64_C(0x624EB0B514DCD6C8), UINT64_C(0x6FBF60E986A53F9C), + UINT64_C(0xC9765CD0526679A0), UINT64_C(0xC4878C8CC01F90F4), + UINT64_C(0xD394FD697695AB09), UINT64_C(0xDE652D35E4EC425D) + }, { + UINT64_C(0x0000000000000000), UINT64_C(0xCB6D6A914AE10B3F), + UINT64_C(0x96DBD42295C2177E), UINT64_C(0x5DB6BEB3DF231C41), + UINT64_C(0x2CB7A9452A852FFC), UINT64_C(0xE7DAC3D4606424C3), + UINT64_C(0xBA6C7D67BF473882), UINT64_C(0x710117F6F5A633BD), + UINT64_C(0xDD705D247FA5876A), UINT64_C(0x161D37B535448C55), + UINT64_C(0x4BAB8906EA679014), UINT64_C(0x80C6E397A0869B2B), + UINT64_C(0xF1C7F4615520A896), UINT64_C(0x3AAA9EF01FC1A3A9), + UINT64_C(0x671C2043C0E2BFE8), UINT64_C(0xAC714AD28A03B4D7), + UINT64_C(0xBAE1BA48FE4A0FD5), UINT64_C(0x718CD0D9B4AB04EA), + UINT64_C(0x2C3A6E6A6B8818AB), UINT64_C(0xE75704FB21691394), + UINT64_C(0x9656130DD4CF2029), UINT64_C(0x5D3B799C9E2E2B16), + UINT64_C(0x008DC72F410D3757), UINT64_C(0xCBE0ADBE0BEC3C68), + UINT64_C(0x6791E76C81EF88BF), UINT64_C(0xACFC8DFDCB0E8380), + UINT64_C(0xF14A334E142D9FC1), UINT64_C(0x3A2759DF5ECC94FE), + UINT64_C(0x4B264E29AB6AA743), UINT64_C(0x804B24B8E18BAC7C), + UINT64_C(0xDDFD9A0B3EA8B03D), UINT64_C(0x1690F09A7449BB02), + UINT64_C(0xF1DD7B3ED73AC638), UINT64_C(0x3AB011AF9DDBCD07), + UINT64_C(0x6706AF1C42F8D146), UINT64_C(0xAC6BC58D0819DA79), + UINT64_C(0xDD6AD27BFDBFE9C4), UINT64_C(0x1607B8EAB75EE2FB), + UINT64_C(0x4BB10659687DFEBA), UINT64_C(0x80DC6CC8229CF585), + UINT64_C(0x2CAD261AA89F4152), UINT64_C(0xE7C04C8BE27E4A6D), + UINT64_C(0xBA76F2383D5D562C), UINT64_C(0x711B98A977BC5D13), + UINT64_C(0x001A8F5F821A6EAE), UINT64_C(0xCB77E5CEC8FB6591), + UINT64_C(0x96C15B7D17D879D0), UINT64_C(0x5DAC31EC5D3972EF), + UINT64_C(0x4B3CC1762970C9ED), UINT64_C(0x8051ABE76391C2D2), + UINT64_C(0xDDE71554BCB2DE93), UINT64_C(0x168A7FC5F653D5AC), + UINT64_C(0x678B683303F5E611), UINT64_C(0xACE602A24914ED2E), + UINT64_C(0xF150BC119637F16F), UINT64_C(0x3A3DD680DCD6FA50), + UINT64_C(0x964C9C5256D54E87), UINT64_C(0x5D21F6C31C3445B8), + UINT64_C(0x00974870C31759F9), UINT64_C(0xCBFA22E189F652C6), + UINT64_C(0xBAFB35177C50617B), UINT64_C(0x71965F8636B16A44), + UINT64_C(0x2C20E135E9927605), UINT64_C(0xE74D8BA4A3737D3A), + UINT64_C(0xE2BBF77CAE758C71), UINT64_C(0x29D69DEDE494874E), + UINT64_C(0x7460235E3BB79B0F), UINT64_C(0xBF0D49CF71569030), + UINT64_C(0xCE0C5E3984F0A38D), UINT64_C(0x056134A8CE11A8B2), + UINT64_C(0x58D78A1B1132B4F3), UINT64_C(0x93BAE08A5BD3BFCC), + UINT64_C(0x3FCBAA58D1D00B1B), UINT64_C(0xF4A6C0C99B310024), + UINT64_C(0xA9107E7A44121C65), UINT64_C(0x627D14EB0EF3175A), + UINT64_C(0x137C031DFB5524E7), UINT64_C(0xD811698CB1B42FD8), + UINT64_C(0x85A7D73F6E973399), UINT64_C(0x4ECABDAE247638A6), + UINT64_C(0x585A4D34503F83A4), UINT64_C(0x933727A51ADE889B), + UINT64_C(0xCE819916C5FD94DA), UINT64_C(0x05ECF3878F1C9FE5), + UINT64_C(0x74EDE4717ABAAC58), UINT64_C(0xBF808EE0305BA767), + UINT64_C(0xE2363053EF78BB26), UINT64_C(0x295B5AC2A599B019), + UINT64_C(0x852A10102F9A04CE), UINT64_C(0x4E477A81657B0FF1), + UINT64_C(0x13F1C432BA5813B0), UINT64_C(0xD89CAEA3F0B9188F), + UINT64_C(0xA99DB955051F2B32), UINT64_C(0x62F0D3C44FFE200D), + UINT64_C(0x3F466D7790DD3C4C), UINT64_C(0xF42B07E6DA3C3773), + UINT64_C(0x13668C42794F4A49), UINT64_C(0xD80BE6D333AE4176), + UINT64_C(0x85BD5860EC8D5D37), UINT64_C(0x4ED032F1A66C5608), + UINT64_C(0x3FD1250753CA65B5), UINT64_C(0xF4BC4F96192B6E8A), + UINT64_C(0xA90AF125C60872CB), UINT64_C(0x62679BB48CE979F4), + UINT64_C(0xCE16D16606EACD23), UINT64_C(0x057BBBF74C0BC61C), + UINT64_C(0x58CD05449328DA5D), UINT64_C(0x93A06FD5D9C9D162), + UINT64_C(0xE2A178232C6FE2DF), UINT64_C(0x29CC12B2668EE9E0), + UINT64_C(0x747AAC01B9ADF5A1), UINT64_C(0xBF17C690F34CFE9E), + UINT64_C(0xA987360A8705459C), UINT64_C(0x62EA5C9BCDE44EA3), + UINT64_C(0x3F5CE22812C752E2), UINT64_C(0xF43188B9582659DD), + UINT64_C(0x85309F4FAD806A60), UINT64_C(0x4E5DF5DEE761615F), + UINT64_C(0x13EB4B6D38427D1E), UINT64_C(0xD88621FC72A37621), + UINT64_C(0x74F76B2EF8A0C2F6), UINT64_C(0xBF9A01BFB241C9C9), + UINT64_C(0xE22CBF0C6D62D588), UINT64_C(0x2941D59D2783DEB7), + UINT64_C(0x5840C26BD225ED0A), UINT64_C(0x932DA8FA98C4E635), + UINT64_C(0xCE9B164947E7FA74), UINT64_C(0x05F67CD80D06F14B), + UINT64_C(0xC477EFF95CEB18E3), UINT64_C(0x0F1A8568160A13DC), + UINT64_C(0x52AC3BDBC9290F9D), UINT64_C(0x99C1514A83C804A2), + UINT64_C(0xE8C046BC766E371F), UINT64_C(0x23AD2C2D3C8F3C20), + UINT64_C(0x7E1B929EE3AC2061), UINT64_C(0xB576F80FA94D2B5E), + UINT64_C(0x1907B2DD234E9F89), UINT64_C(0xD26AD84C69AF94B6), + UINT64_C(0x8FDC66FFB68C88F7), UINT64_C(0x44B10C6EFC6D83C8), + UINT64_C(0x35B01B9809CBB075), UINT64_C(0xFEDD7109432ABB4A), + UINT64_C(0xA36BCFBA9C09A70B), UINT64_C(0x6806A52BD6E8AC34), + UINT64_C(0x7E9655B1A2A11736), UINT64_C(0xB5FB3F20E8401C09), + UINT64_C(0xE84D819337630048), UINT64_C(0x2320EB027D820B77), + UINT64_C(0x5221FCF4882438CA), UINT64_C(0x994C9665C2C533F5), + UINT64_C(0xC4FA28D61DE62FB4), UINT64_C(0x0F9742475707248B), + UINT64_C(0xA3E60895DD04905C), UINT64_C(0x688B620497E59B63), + UINT64_C(0x353DDCB748C68722), UINT64_C(0xFE50B62602278C1D), + UINT64_C(0x8F51A1D0F781BFA0), UINT64_C(0x443CCB41BD60B49F), + UINT64_C(0x198A75F26243A8DE), UINT64_C(0xD2E71F6328A2A3E1), + UINT64_C(0x35AA94C78BD1DEDB), UINT64_C(0xFEC7FE56C130D5E4), + UINT64_C(0xA37140E51E13C9A5), UINT64_C(0x681C2A7454F2C29A), + UINT64_C(0x191D3D82A154F127), UINT64_C(0xD2705713EBB5FA18), + UINT64_C(0x8FC6E9A03496E659), UINT64_C(0x44AB83317E77ED66), + UINT64_C(0xE8DAC9E3F47459B1), UINT64_C(0x23B7A372BE95528E), + UINT64_C(0x7E011DC161B64ECF), UINT64_C(0xB56C77502B5745F0), + UINT64_C(0xC46D60A6DEF1764D), UINT64_C(0x0F000A3794107D72), + UINT64_C(0x52B6B4844B336133), UINT64_C(0x99DBDE1501D26A0C), + UINT64_C(0x8F4B2E8F759BD10E), UINT64_C(0x4426441E3F7ADA31), + UINT64_C(0x1990FAADE059C670), UINT64_C(0xD2FD903CAAB8CD4F), + UINT64_C(0xA3FC87CA5F1EFEF2), UINT64_C(0x6891ED5B15FFF5CD), + UINT64_C(0x352753E8CADCE98C), UINT64_C(0xFE4A3979803DE2B3), + UINT64_C(0x523B73AB0A3E5664), UINT64_C(0x9956193A40DF5D5B), + UINT64_C(0xC4E0A7899FFC411A), UINT64_C(0x0F8DCD18D51D4A25), + UINT64_C(0x7E8CDAEE20BB7998), UINT64_C(0xB5E1B07F6A5A72A7), + UINT64_C(0xE8570ECCB5796EE6), UINT64_C(0x233A645DFF9865D9), + UINT64_C(0x26CC1885F29E9492), UINT64_C(0xEDA17214B87F9FAD), + UINT64_C(0xB017CCA7675C83EC), UINT64_C(0x7B7AA6362DBD88D3), + UINT64_C(0x0A7BB1C0D81BBB6E), UINT64_C(0xC116DB5192FAB051), + UINT64_C(0x9CA065E24DD9AC10), UINT64_C(0x57CD0F730738A72F), + UINT64_C(0xFBBC45A18D3B13F8), UINT64_C(0x30D12F30C7DA18C7), + UINT64_C(0x6D67918318F90486), UINT64_C(0xA60AFB1252180FB9), + UINT64_C(0xD70BECE4A7BE3C04), UINT64_C(0x1C668675ED5F373B), + UINT64_C(0x41D038C6327C2B7A), UINT64_C(0x8ABD5257789D2045), + UINT64_C(0x9C2DA2CD0CD49B47), UINT64_C(0x5740C85C46359078), + UINT64_C(0x0AF676EF99168C39), UINT64_C(0xC19B1C7ED3F78706), + UINT64_C(0xB09A0B882651B4BB), UINT64_C(0x7BF761196CB0BF84), + UINT64_C(0x2641DFAAB393A3C5), UINT64_C(0xED2CB53BF972A8FA), + UINT64_C(0x415DFFE973711C2D), UINT64_C(0x8A30957839901712), + UINT64_C(0xD7862BCBE6B30B53), UINT64_C(0x1CEB415AAC52006C), + UINT64_C(0x6DEA56AC59F433D1), UINT64_C(0xA6873C3D131538EE), + UINT64_C(0xFB31828ECC3624AF), UINT64_C(0x305CE81F86D72F90), + UINT64_C(0xD71163BB25A452AA), UINT64_C(0x1C7C092A6F455995), + UINT64_C(0x41CAB799B06645D4), UINT64_C(0x8AA7DD08FA874EEB), + UINT64_C(0xFBA6CAFE0F217D56), UINT64_C(0x30CBA06F45C07669), + UINT64_C(0x6D7D1EDC9AE36A28), UINT64_C(0xA610744DD0026117), + UINT64_C(0x0A613E9F5A01D5C0), UINT64_C(0xC10C540E10E0DEFF), + UINT64_C(0x9CBAEABDCFC3C2BE), UINT64_C(0x57D7802C8522C981), + UINT64_C(0x26D697DA7084FA3C), UINT64_C(0xEDBBFD4B3A65F103), + UINT64_C(0xB00D43F8E546ED42), UINT64_C(0x7B602969AFA7E67D), + UINT64_C(0x6DF0D9F3DBEE5D7F), UINT64_C(0xA69DB362910F5640), + UINT64_C(0xFB2B0DD14E2C4A01), UINT64_C(0x3046674004CD413E), + UINT64_C(0x414770B6F16B7283), UINT64_C(0x8A2A1A27BB8A79BC), + UINT64_C(0xD79CA49464A965FD), UINT64_C(0x1CF1CE052E486EC2), + UINT64_C(0xB08084D7A44BDA15), UINT64_C(0x7BEDEE46EEAAD12A), + UINT64_C(0x265B50F53189CD6B), UINT64_C(0xED363A647B68C654), + UINT64_C(0x9C372D928ECEF5E9), UINT64_C(0x575A4703C42FFED6), + UINT64_C(0x0AECF9B01B0CE297), UINT64_C(0xC181932151EDE9A8) + }, { + UINT64_C(0x0000000000000000), UINT64_C(0xDCA12C225E8AEE1D), + UINT64_C(0xB8435944BC14DD3B), UINT64_C(0x64E27566E29E3326), + UINT64_C(0x7087B2887829BA77), UINT64_C(0xAC269EAA26A3546A), + UINT64_C(0xC8C4EBCCC43D674C), UINT64_C(0x1465C7EE9AB78951), + UINT64_C(0xE00E6511F15274EF), UINT64_C(0x3CAF4933AFD89AF2), + UINT64_C(0x584D3C554D46A9D4), UINT64_C(0x84EC107713CC47C9), + UINT64_C(0x9089D799897BCE98), UINT64_C(0x4C28FBBBD7F12085), + UINT64_C(0x28CA8EDD356F13A3), UINT64_C(0xF46BA2FF6BE5FDBE), + UINT64_C(0x4503C48DC90A304C), UINT64_C(0x99A2E8AF9780DE51), + UINT64_C(0xFD409DC9751EED77), UINT64_C(0x21E1B1EB2B94036A), + UINT64_C(0x35847605B1238A3B), UINT64_C(0xE9255A27EFA96426), + UINT64_C(0x8DC72F410D375700), UINT64_C(0x5166036353BDB91D), + UINT64_C(0xA50DA19C385844A3), UINT64_C(0x79AC8DBE66D2AABE), + UINT64_C(0x1D4EF8D8844C9998), UINT64_C(0xC1EFD4FADAC67785), + UINT64_C(0xD58A13144071FED4), UINT64_C(0x092B3F361EFB10C9), + UINT64_C(0x6DC94A50FC6523EF), UINT64_C(0xB1686672A2EFCDF2), + UINT64_C(0x8A06881B93156098), UINT64_C(0x56A7A439CD9F8E85), + UINT64_C(0x3245D15F2F01BDA3), UINT64_C(0xEEE4FD7D718B53BE), + UINT64_C(0xFA813A93EB3CDAEF), UINT64_C(0x262016B1B5B634F2), + UINT64_C(0x42C263D7572807D4), UINT64_C(0x9E634FF509A2E9C9), + UINT64_C(0x6A08ED0A62471477), UINT64_C(0xB6A9C1283CCDFA6A), + UINT64_C(0xD24BB44EDE53C94C), UINT64_C(0x0EEA986C80D92751), + UINT64_C(0x1A8F5F821A6EAE00), UINT64_C(0xC62E73A044E4401D), + UINT64_C(0xA2CC06C6A67A733B), UINT64_C(0x7E6D2AE4F8F09D26), + UINT64_C(0xCF054C965A1F50D4), UINT64_C(0x13A460B40495BEC9), + UINT64_C(0x774615D2E60B8DEF), UINT64_C(0xABE739F0B88163F2), + UINT64_C(0xBF82FE1E2236EAA3), UINT64_C(0x6323D23C7CBC04BE), + UINT64_C(0x07C1A75A9E223798), UINT64_C(0xDB608B78C0A8D985), + UINT64_C(0x2F0B2987AB4D243B), UINT64_C(0xF3AA05A5F5C7CA26), + UINT64_C(0x974870C31759F900), UINT64_C(0x4BE95CE149D3171D), + UINT64_C(0x5F8C9B0FD3649E4C), UINT64_C(0x832DB72D8DEE7051), + UINT64_C(0xE7CFC24B6F704377), UINT64_C(0x3B6EEE6931FAAD6A), + UINT64_C(0x91131E980D8418A2), UINT64_C(0x4DB232BA530EF6BF), + UINT64_C(0x295047DCB190C599), UINT64_C(0xF5F16BFEEF1A2B84), + UINT64_C(0xE194AC1075ADA2D5), UINT64_C(0x3D3580322B274CC8), + UINT64_C(0x59D7F554C9B97FEE), UINT64_C(0x8576D976973391F3), + UINT64_C(0x711D7B89FCD66C4D), UINT64_C(0xADBC57ABA25C8250), + UINT64_C(0xC95E22CD40C2B176), UINT64_C(0x15FF0EEF1E485F6B), + UINT64_C(0x019AC90184FFD63A), UINT64_C(0xDD3BE523DA753827), + UINT64_C(0xB9D9904538EB0B01), UINT64_C(0x6578BC676661E51C), + UINT64_C(0xD410DA15C48E28EE), UINT64_C(0x08B1F6379A04C6F3), + UINT64_C(0x6C538351789AF5D5), UINT64_C(0xB0F2AF7326101BC8), + UINT64_C(0xA497689DBCA79299), UINT64_C(0x783644BFE22D7C84), + UINT64_C(0x1CD431D900B34FA2), UINT64_C(0xC0751DFB5E39A1BF), + UINT64_C(0x341EBF0435DC5C01), UINT64_C(0xE8BF93266B56B21C), + UINT64_C(0x8C5DE64089C8813A), UINT64_C(0x50FCCA62D7426F27), + UINT64_C(0x44990D8C4DF5E676), UINT64_C(0x983821AE137F086B), + UINT64_C(0xFCDA54C8F1E13B4D), UINT64_C(0x207B78EAAF6BD550), + UINT64_C(0x1B1596839E91783A), UINT64_C(0xC7B4BAA1C01B9627), + UINT64_C(0xA356CFC72285A501), UINT64_C(0x7FF7E3E57C0F4B1C), + UINT64_C(0x6B92240BE6B8C24D), UINT64_C(0xB7330829B8322C50), + UINT64_C(0xD3D17D4F5AAC1F76), UINT64_C(0x0F70516D0426F16B), + UINT64_C(0xFB1BF3926FC30CD5), UINT64_C(0x27BADFB03149E2C8), + UINT64_C(0x4358AAD6D3D7D1EE), UINT64_C(0x9FF986F48D5D3FF3), + UINT64_C(0x8B9C411A17EAB6A2), UINT64_C(0x573D6D38496058BF), + UINT64_C(0x33DF185EABFE6B99), UINT64_C(0xEF7E347CF5748584), + UINT64_C(0x5E16520E579B4876), UINT64_C(0x82B77E2C0911A66B), + UINT64_C(0xE6550B4AEB8F954D), UINT64_C(0x3AF42768B5057B50), + UINT64_C(0x2E91E0862FB2F201), UINT64_C(0xF230CCA471381C1C), + UINT64_C(0x96D2B9C293A62F3A), UINT64_C(0x4A7395E0CD2CC127), + UINT64_C(0xBE18371FA6C93C99), UINT64_C(0x62B91B3DF843D284), + UINT64_C(0x065B6E5B1ADDE1A2), UINT64_C(0xDAFA427944570FBF), + UINT64_C(0xCE9F8597DEE086EE), UINT64_C(0x123EA9B5806A68F3), + UINT64_C(0x76DCDCD362F45BD5), UINT64_C(0xAA7DF0F13C7EB5C8), + UINT64_C(0xA739329F30A7E9D6), UINT64_C(0x7B981EBD6E2D07CB), + UINT64_C(0x1F7A6BDB8CB334ED), UINT64_C(0xC3DB47F9D239DAF0), + UINT64_C(0xD7BE8017488E53A1), UINT64_C(0x0B1FAC351604BDBC), + UINT64_C(0x6FFDD953F49A8E9A), UINT64_C(0xB35CF571AA106087), + UINT64_C(0x4737578EC1F59D39), UINT64_C(0x9B967BAC9F7F7324), + UINT64_C(0xFF740ECA7DE14002), UINT64_C(0x23D522E8236BAE1F), + UINT64_C(0x37B0E506B9DC274E), UINT64_C(0xEB11C924E756C953), + UINT64_C(0x8FF3BC4205C8FA75), UINT64_C(0x535290605B421468), + UINT64_C(0xE23AF612F9ADD99A), UINT64_C(0x3E9BDA30A7273787), + UINT64_C(0x5A79AF5645B904A1), UINT64_C(0x86D883741B33EABC), + UINT64_C(0x92BD449A818463ED), UINT64_C(0x4E1C68B8DF0E8DF0), + UINT64_C(0x2AFE1DDE3D90BED6), UINT64_C(0xF65F31FC631A50CB), + UINT64_C(0x0234930308FFAD75), UINT64_C(0xDE95BF2156754368), + UINT64_C(0xBA77CA47B4EB704E), UINT64_C(0x66D6E665EA619E53), + UINT64_C(0x72B3218B70D61702), UINT64_C(0xAE120DA92E5CF91F), + UINT64_C(0xCAF078CFCCC2CA39), UINT64_C(0x165154ED92482424), + UINT64_C(0x2D3FBA84A3B2894E), UINT64_C(0xF19E96A6FD386753), + UINT64_C(0x957CE3C01FA65475), UINT64_C(0x49DDCFE2412CBA68), + UINT64_C(0x5DB8080CDB9B3339), UINT64_C(0x8119242E8511DD24), + UINT64_C(0xE5FB5148678FEE02), UINT64_C(0x395A7D6A3905001F), + UINT64_C(0xCD31DF9552E0FDA1), UINT64_C(0x1190F3B70C6A13BC), + UINT64_C(0x757286D1EEF4209A), UINT64_C(0xA9D3AAF3B07ECE87), + UINT64_C(0xBDB66D1D2AC947D6), UINT64_C(0x6117413F7443A9CB), + UINT64_C(0x05F5345996DD9AED), UINT64_C(0xD954187BC85774F0), + UINT64_C(0x683C7E096AB8B902), UINT64_C(0xB49D522B3432571F), + UINT64_C(0xD07F274DD6AC6439), UINT64_C(0x0CDE0B6F88268A24), + UINT64_C(0x18BBCC8112910375), UINT64_C(0xC41AE0A34C1BED68), + UINT64_C(0xA0F895C5AE85DE4E), UINT64_C(0x7C59B9E7F00F3053), + UINT64_C(0x88321B189BEACDED), UINT64_C(0x5493373AC56023F0), + UINT64_C(0x3071425C27FE10D6), UINT64_C(0xECD06E7E7974FECB), + UINT64_C(0xF8B5A990E3C3779A), UINT64_C(0x241485B2BD499987), + UINT64_C(0x40F6F0D45FD7AAA1), UINT64_C(0x9C57DCF6015D44BC), + UINT64_C(0x362A2C073D23F174), UINT64_C(0xEA8B002563A91F69), + UINT64_C(0x8E69754381372C4F), UINT64_C(0x52C85961DFBDC252), + UINT64_C(0x46AD9E8F450A4B03), UINT64_C(0x9A0CB2AD1B80A51E), + UINT64_C(0xFEEEC7CBF91E9638), UINT64_C(0x224FEBE9A7947825), + UINT64_C(0xD6244916CC71859B), UINT64_C(0x0A85653492FB6B86), + UINT64_C(0x6E671052706558A0), UINT64_C(0xB2C63C702EEFB6BD), + UINT64_C(0xA6A3FB9EB4583FEC), UINT64_C(0x7A02D7BCEAD2D1F1), + UINT64_C(0x1EE0A2DA084CE2D7), UINT64_C(0xC2418EF856C60CCA), + UINT64_C(0x7329E88AF429C138), UINT64_C(0xAF88C4A8AAA32F25), + UINT64_C(0xCB6AB1CE483D1C03), UINT64_C(0x17CB9DEC16B7F21E), + UINT64_C(0x03AE5A028C007B4F), UINT64_C(0xDF0F7620D28A9552), + UINT64_C(0xBBED03463014A674), UINT64_C(0x674C2F646E9E4869), + UINT64_C(0x93278D9B057BB5D7), UINT64_C(0x4F86A1B95BF15BCA), + UINT64_C(0x2B64D4DFB96F68EC), UINT64_C(0xF7C5F8FDE7E586F1), + UINT64_C(0xE3A03F137D520FA0), UINT64_C(0x3F01133123D8E1BD), + UINT64_C(0x5BE36657C146D29B), UINT64_C(0x87424A759FCC3C86), + UINT64_C(0xBC2CA41CAE3691EC), UINT64_C(0x608D883EF0BC7FF1), + UINT64_C(0x046FFD5812224CD7), UINT64_C(0xD8CED17A4CA8A2CA), + UINT64_C(0xCCAB1694D61F2B9B), UINT64_C(0x100A3AB68895C586), + UINT64_C(0x74E84FD06A0BF6A0), UINT64_C(0xA84963F2348118BD), + UINT64_C(0x5C22C10D5F64E503), UINT64_C(0x8083ED2F01EE0B1E), + UINT64_C(0xE4619849E3703838), UINT64_C(0x38C0B46BBDFAD625), + UINT64_C(0x2CA57385274D5F74), UINT64_C(0xF0045FA779C7B169), + UINT64_C(0x94E62AC19B59824F), UINT64_C(0x484706E3C5D36C52), + UINT64_C(0xF92F6091673CA1A0), UINT64_C(0x258E4CB339B64FBD), + UINT64_C(0x416C39D5DB287C9B), UINT64_C(0x9DCD15F785A29286), + UINT64_C(0x89A8D2191F151BD7), UINT64_C(0x5509FE3B419FF5CA), + UINT64_C(0x31EB8B5DA301C6EC), UINT64_C(0xED4AA77FFD8B28F1), + UINT64_C(0x19210580966ED54F), UINT64_C(0xC58029A2C8E43B52), + UINT64_C(0xA1625CC42A7A0874), UINT64_C(0x7DC370E674F0E669), + UINT64_C(0x69A6B708EE476F38), UINT64_C(0xB5079B2AB0CD8125), + UINT64_C(0xD1E5EE4C5253B203), UINT64_C(0x0D44C26E0CD95C1E) + } +}; diff --git a/liblzma/check/crc64_table_le.h b/liblzma/check/crc64_table_le.h new file mode 100644 index 0000000..1196b31 --- /dev/null +++ b/liblzma/check/crc64_table_le.h @@ -0,0 +1,521 @@ +/* This file has been automatically generated by crc64_tablegen.c. */ + +const uint64_t lzma_crc64_table[4][256] = { + { + UINT64_C(0x0000000000000000), UINT64_C(0xB32E4CBE03A75F6F), + UINT64_C(0xF4843657A840A05B), UINT64_C(0x47AA7AE9ABE7FF34), + UINT64_C(0x7BD0C384FF8F5E33), UINT64_C(0xC8FE8F3AFC28015C), + UINT64_C(0x8F54F5D357CFFE68), UINT64_C(0x3C7AB96D5468A107), + UINT64_C(0xF7A18709FF1EBC66), UINT64_C(0x448FCBB7FCB9E309), + UINT64_C(0x0325B15E575E1C3D), UINT64_C(0xB00BFDE054F94352), + UINT64_C(0x8C71448D0091E255), UINT64_C(0x3F5F08330336BD3A), + UINT64_C(0x78F572DAA8D1420E), UINT64_C(0xCBDB3E64AB761D61), + UINT64_C(0x7D9BA13851336649), UINT64_C(0xCEB5ED8652943926), + UINT64_C(0x891F976FF973C612), UINT64_C(0x3A31DBD1FAD4997D), + UINT64_C(0x064B62BCAEBC387A), UINT64_C(0xB5652E02AD1B6715), + UINT64_C(0xF2CF54EB06FC9821), UINT64_C(0x41E11855055BC74E), + UINT64_C(0x8A3A2631AE2DDA2F), UINT64_C(0x39146A8FAD8A8540), + UINT64_C(0x7EBE1066066D7A74), UINT64_C(0xCD905CD805CA251B), + UINT64_C(0xF1EAE5B551A2841C), UINT64_C(0x42C4A90B5205DB73), + UINT64_C(0x056ED3E2F9E22447), UINT64_C(0xB6409F5CFA457B28), + UINT64_C(0xFB374270A266CC92), UINT64_C(0x48190ECEA1C193FD), + UINT64_C(0x0FB374270A266CC9), UINT64_C(0xBC9D3899098133A6), + UINT64_C(0x80E781F45DE992A1), UINT64_C(0x33C9CD4A5E4ECDCE), + UINT64_C(0x7463B7A3F5A932FA), UINT64_C(0xC74DFB1DF60E6D95), + UINT64_C(0x0C96C5795D7870F4), UINT64_C(0xBFB889C75EDF2F9B), + UINT64_C(0xF812F32EF538D0AF), UINT64_C(0x4B3CBF90F69F8FC0), + UINT64_C(0x774606FDA2F72EC7), UINT64_C(0xC4684A43A15071A8), + UINT64_C(0x83C230AA0AB78E9C), UINT64_C(0x30EC7C140910D1F3), + UINT64_C(0x86ACE348F355AADB), UINT64_C(0x3582AFF6F0F2F5B4), + UINT64_C(0x7228D51F5B150A80), UINT64_C(0xC10699A158B255EF), + UINT64_C(0xFD7C20CC0CDAF4E8), UINT64_C(0x4E526C720F7DAB87), + UINT64_C(0x09F8169BA49A54B3), UINT64_C(0xBAD65A25A73D0BDC), + UINT64_C(0x710D64410C4B16BD), UINT64_C(0xC22328FF0FEC49D2), + UINT64_C(0x85895216A40BB6E6), UINT64_C(0x36A71EA8A7ACE989), + UINT64_C(0x0ADDA7C5F3C4488E), UINT64_C(0xB9F3EB7BF06317E1), + UINT64_C(0xFE5991925B84E8D5), UINT64_C(0x4D77DD2C5823B7BA), + UINT64_C(0x64B62BCAEBC387A1), UINT64_C(0xD7986774E864D8CE), + UINT64_C(0x90321D9D438327FA), UINT64_C(0x231C512340247895), + UINT64_C(0x1F66E84E144CD992), UINT64_C(0xAC48A4F017EB86FD), + UINT64_C(0xEBE2DE19BC0C79C9), UINT64_C(0x58CC92A7BFAB26A6), + UINT64_C(0x9317ACC314DD3BC7), UINT64_C(0x2039E07D177A64A8), + UINT64_C(0x67939A94BC9D9B9C), UINT64_C(0xD4BDD62ABF3AC4F3), + UINT64_C(0xE8C76F47EB5265F4), UINT64_C(0x5BE923F9E8F53A9B), + UINT64_C(0x1C4359104312C5AF), UINT64_C(0xAF6D15AE40B59AC0), + UINT64_C(0x192D8AF2BAF0E1E8), UINT64_C(0xAA03C64CB957BE87), + UINT64_C(0xEDA9BCA512B041B3), UINT64_C(0x5E87F01B11171EDC), + UINT64_C(0x62FD4976457FBFDB), UINT64_C(0xD1D305C846D8E0B4), + UINT64_C(0x96797F21ED3F1F80), UINT64_C(0x2557339FEE9840EF), + UINT64_C(0xEE8C0DFB45EE5D8E), UINT64_C(0x5DA24145464902E1), + UINT64_C(0x1A083BACEDAEFDD5), UINT64_C(0xA9267712EE09A2BA), + UINT64_C(0x955CCE7FBA6103BD), UINT64_C(0x267282C1B9C65CD2), + UINT64_C(0x61D8F8281221A3E6), UINT64_C(0xD2F6B4961186FC89), + UINT64_C(0x9F8169BA49A54B33), UINT64_C(0x2CAF25044A02145C), + UINT64_C(0x6B055FEDE1E5EB68), UINT64_C(0xD82B1353E242B407), + UINT64_C(0xE451AA3EB62A1500), UINT64_C(0x577FE680B58D4A6F), + UINT64_C(0x10D59C691E6AB55B), UINT64_C(0xA3FBD0D71DCDEA34), + UINT64_C(0x6820EEB3B6BBF755), UINT64_C(0xDB0EA20DB51CA83A), + UINT64_C(0x9CA4D8E41EFB570E), UINT64_C(0x2F8A945A1D5C0861), + UINT64_C(0x13F02D374934A966), UINT64_C(0xA0DE61894A93F609), + UINT64_C(0xE7741B60E174093D), UINT64_C(0x545A57DEE2D35652), + UINT64_C(0xE21AC88218962D7A), UINT64_C(0x5134843C1B317215), + UINT64_C(0x169EFED5B0D68D21), UINT64_C(0xA5B0B26BB371D24E), + UINT64_C(0x99CA0B06E7197349), UINT64_C(0x2AE447B8E4BE2C26), + UINT64_C(0x6D4E3D514F59D312), UINT64_C(0xDE6071EF4CFE8C7D), + UINT64_C(0x15BB4F8BE788911C), UINT64_C(0xA6950335E42FCE73), + UINT64_C(0xE13F79DC4FC83147), UINT64_C(0x521135624C6F6E28), + UINT64_C(0x6E6B8C0F1807CF2F), UINT64_C(0xDD45C0B11BA09040), + UINT64_C(0x9AEFBA58B0476F74), UINT64_C(0x29C1F6E6B3E0301B), + UINT64_C(0xC96C5795D7870F42), UINT64_C(0x7A421B2BD420502D), + UINT64_C(0x3DE861C27FC7AF19), UINT64_C(0x8EC62D7C7C60F076), + UINT64_C(0xB2BC941128085171), UINT64_C(0x0192D8AF2BAF0E1E), + UINT64_C(0x4638A2468048F12A), UINT64_C(0xF516EEF883EFAE45), + UINT64_C(0x3ECDD09C2899B324), UINT64_C(0x8DE39C222B3EEC4B), + UINT64_C(0xCA49E6CB80D9137F), UINT64_C(0x7967AA75837E4C10), + UINT64_C(0x451D1318D716ED17), UINT64_C(0xF6335FA6D4B1B278), + UINT64_C(0xB199254F7F564D4C), UINT64_C(0x02B769F17CF11223), + UINT64_C(0xB4F7F6AD86B4690B), UINT64_C(0x07D9BA1385133664), + UINT64_C(0x4073C0FA2EF4C950), UINT64_C(0xF35D8C442D53963F), + UINT64_C(0xCF273529793B3738), UINT64_C(0x7C0979977A9C6857), + UINT64_C(0x3BA3037ED17B9763), UINT64_C(0x888D4FC0D2DCC80C), + UINT64_C(0x435671A479AAD56D), UINT64_C(0xF0783D1A7A0D8A02), + UINT64_C(0xB7D247F3D1EA7536), UINT64_C(0x04FC0B4DD24D2A59), + UINT64_C(0x3886B22086258B5E), UINT64_C(0x8BA8FE9E8582D431), + UINT64_C(0xCC0284772E652B05), UINT64_C(0x7F2CC8C92DC2746A), + UINT64_C(0x325B15E575E1C3D0), UINT64_C(0x8175595B76469CBF), + UINT64_C(0xC6DF23B2DDA1638B), UINT64_C(0x75F16F0CDE063CE4), + UINT64_C(0x498BD6618A6E9DE3), UINT64_C(0xFAA59ADF89C9C28C), + UINT64_C(0xBD0FE036222E3DB8), UINT64_C(0x0E21AC88218962D7), + UINT64_C(0xC5FA92EC8AFF7FB6), UINT64_C(0x76D4DE52895820D9), + UINT64_C(0x317EA4BB22BFDFED), UINT64_C(0x8250E80521188082), + UINT64_C(0xBE2A516875702185), UINT64_C(0x0D041DD676D77EEA), + UINT64_C(0x4AAE673FDD3081DE), UINT64_C(0xF9802B81DE97DEB1), + UINT64_C(0x4FC0B4DD24D2A599), UINT64_C(0xFCEEF8632775FAF6), + UINT64_C(0xBB44828A8C9205C2), UINT64_C(0x086ACE348F355AAD), + UINT64_C(0x34107759DB5DFBAA), UINT64_C(0x873E3BE7D8FAA4C5), + UINT64_C(0xC094410E731D5BF1), UINT64_C(0x73BA0DB070BA049E), + UINT64_C(0xB86133D4DBCC19FF), UINT64_C(0x0B4F7F6AD86B4690), + UINT64_C(0x4CE50583738CB9A4), UINT64_C(0xFFCB493D702BE6CB), + UINT64_C(0xC3B1F050244347CC), UINT64_C(0x709FBCEE27E418A3), + UINT64_C(0x3735C6078C03E797), UINT64_C(0x841B8AB98FA4B8F8), + UINT64_C(0xADDA7C5F3C4488E3), UINT64_C(0x1EF430E13FE3D78C), + UINT64_C(0x595E4A08940428B8), UINT64_C(0xEA7006B697A377D7), + UINT64_C(0xD60ABFDBC3CBD6D0), UINT64_C(0x6524F365C06C89BF), + UINT64_C(0x228E898C6B8B768B), UINT64_C(0x91A0C532682C29E4), + UINT64_C(0x5A7BFB56C35A3485), UINT64_C(0xE955B7E8C0FD6BEA), + UINT64_C(0xAEFFCD016B1A94DE), UINT64_C(0x1DD181BF68BDCBB1), + UINT64_C(0x21AB38D23CD56AB6), UINT64_C(0x9285746C3F7235D9), + UINT64_C(0xD52F0E859495CAED), UINT64_C(0x6601423B97329582), + UINT64_C(0xD041DD676D77EEAA), UINT64_C(0x636F91D96ED0B1C5), + UINT64_C(0x24C5EB30C5374EF1), UINT64_C(0x97EBA78EC690119E), + UINT64_C(0xAB911EE392F8B099), UINT64_C(0x18BF525D915FEFF6), + UINT64_C(0x5F1528B43AB810C2), UINT64_C(0xEC3B640A391F4FAD), + UINT64_C(0x27E05A6E926952CC), UINT64_C(0x94CE16D091CE0DA3), + UINT64_C(0xD3646C393A29F297), UINT64_C(0x604A2087398EADF8), + UINT64_C(0x5C3099EA6DE60CFF), UINT64_C(0xEF1ED5546E415390), + UINT64_C(0xA8B4AFBDC5A6ACA4), UINT64_C(0x1B9AE303C601F3CB), + UINT64_C(0x56ED3E2F9E224471), UINT64_C(0xE5C372919D851B1E), + UINT64_C(0xA26908783662E42A), UINT64_C(0x114744C635C5BB45), + UINT64_C(0x2D3DFDAB61AD1A42), UINT64_C(0x9E13B115620A452D), + UINT64_C(0xD9B9CBFCC9EDBA19), UINT64_C(0x6A978742CA4AE576), + UINT64_C(0xA14CB926613CF817), UINT64_C(0x1262F598629BA778), + UINT64_C(0x55C88F71C97C584C), UINT64_C(0xE6E6C3CFCADB0723), + UINT64_C(0xDA9C7AA29EB3A624), UINT64_C(0x69B2361C9D14F94B), + UINT64_C(0x2E184CF536F3067F), UINT64_C(0x9D36004B35545910), + UINT64_C(0x2B769F17CF112238), UINT64_C(0x9858D3A9CCB67D57), + UINT64_C(0xDFF2A94067518263), UINT64_C(0x6CDCE5FE64F6DD0C), + UINT64_C(0x50A65C93309E7C0B), UINT64_C(0xE388102D33392364), + UINT64_C(0xA4226AC498DEDC50), UINT64_C(0x170C267A9B79833F), + UINT64_C(0xDCD7181E300F9E5E), UINT64_C(0x6FF954A033A8C131), + UINT64_C(0x28532E49984F3E05), UINT64_C(0x9B7D62F79BE8616A), + UINT64_C(0xA707DB9ACF80C06D), UINT64_C(0x14299724CC279F02), + UINT64_C(0x5383EDCD67C06036), UINT64_C(0xE0ADA17364673F59) + }, { + UINT64_C(0x0000000000000000), UINT64_C(0x54E979925CD0F10D), + UINT64_C(0xA9D2F324B9A1E21A), UINT64_C(0xFD3B8AB6E5711317), + UINT64_C(0xC17D4962DC4DDAB1), UINT64_C(0x959430F0809D2BBC), + UINT64_C(0x68AFBA4665EC38AB), UINT64_C(0x3C46C3D4393CC9A6), + UINT64_C(0x10223DEE1795ABE7), UINT64_C(0x44CB447C4B455AEA), + UINT64_C(0xB9F0CECAAE3449FD), UINT64_C(0xED19B758F2E4B8F0), + UINT64_C(0xD15F748CCBD87156), UINT64_C(0x85B60D1E9708805B), + UINT64_C(0x788D87A87279934C), UINT64_C(0x2C64FE3A2EA96241), + UINT64_C(0x20447BDC2F2B57CE), UINT64_C(0x74AD024E73FBA6C3), + UINT64_C(0x899688F8968AB5D4), UINT64_C(0xDD7FF16ACA5A44D9), + UINT64_C(0xE13932BEF3668D7F), UINT64_C(0xB5D04B2CAFB67C72), + UINT64_C(0x48EBC19A4AC76F65), UINT64_C(0x1C02B80816179E68), + UINT64_C(0x3066463238BEFC29), UINT64_C(0x648F3FA0646E0D24), + UINT64_C(0x99B4B516811F1E33), UINT64_C(0xCD5DCC84DDCFEF3E), + UINT64_C(0xF11B0F50E4F32698), UINT64_C(0xA5F276C2B823D795), + UINT64_C(0x58C9FC745D52C482), UINT64_C(0x0C2085E60182358F), + UINT64_C(0x4088F7B85E56AF9C), UINT64_C(0x14618E2A02865E91), + UINT64_C(0xE95A049CE7F74D86), UINT64_C(0xBDB37D0EBB27BC8B), + UINT64_C(0x81F5BEDA821B752D), UINT64_C(0xD51CC748DECB8420), + UINT64_C(0x28274DFE3BBA9737), UINT64_C(0x7CCE346C676A663A), + UINT64_C(0x50AACA5649C3047B), UINT64_C(0x0443B3C41513F576), + UINT64_C(0xF9783972F062E661), UINT64_C(0xAD9140E0ACB2176C), + UINT64_C(0x91D78334958EDECA), UINT64_C(0xC53EFAA6C95E2FC7), + UINT64_C(0x380570102C2F3CD0), UINT64_C(0x6CEC098270FFCDDD), + UINT64_C(0x60CC8C64717DF852), UINT64_C(0x3425F5F62DAD095F), + UINT64_C(0xC91E7F40C8DC1A48), UINT64_C(0x9DF706D2940CEB45), + UINT64_C(0xA1B1C506AD3022E3), UINT64_C(0xF558BC94F1E0D3EE), + UINT64_C(0x086336221491C0F9), UINT64_C(0x5C8A4FB0484131F4), + UINT64_C(0x70EEB18A66E853B5), UINT64_C(0x2407C8183A38A2B8), + UINT64_C(0xD93C42AEDF49B1AF), UINT64_C(0x8DD53B3C839940A2), + UINT64_C(0xB193F8E8BAA58904), UINT64_C(0xE57A817AE6757809), + UINT64_C(0x18410BCC03046B1E), UINT64_C(0x4CA8725E5FD49A13), + UINT64_C(0x8111EF70BCAD5F38), UINT64_C(0xD5F896E2E07DAE35), + UINT64_C(0x28C31C54050CBD22), UINT64_C(0x7C2A65C659DC4C2F), + UINT64_C(0x406CA61260E08589), UINT64_C(0x1485DF803C307484), + UINT64_C(0xE9BE5536D9416793), UINT64_C(0xBD572CA48591969E), + UINT64_C(0x9133D29EAB38F4DF), UINT64_C(0xC5DAAB0CF7E805D2), + UINT64_C(0x38E121BA129916C5), UINT64_C(0x6C0858284E49E7C8), + UINT64_C(0x504E9BFC77752E6E), UINT64_C(0x04A7E26E2BA5DF63), + UINT64_C(0xF99C68D8CED4CC74), UINT64_C(0xAD75114A92043D79), + UINT64_C(0xA15594AC938608F6), UINT64_C(0xF5BCED3ECF56F9FB), + UINT64_C(0x088767882A27EAEC), UINT64_C(0x5C6E1E1A76F71BE1), + UINT64_C(0x6028DDCE4FCBD247), UINT64_C(0x34C1A45C131B234A), + UINT64_C(0xC9FA2EEAF66A305D), UINT64_C(0x9D135778AABAC150), + UINT64_C(0xB177A9428413A311), UINT64_C(0xE59ED0D0D8C3521C), + UINT64_C(0x18A55A663DB2410B), UINT64_C(0x4C4C23F46162B006), + UINT64_C(0x700AE020585E79A0), UINT64_C(0x24E399B2048E88AD), + UINT64_C(0xD9D81304E1FF9BBA), UINT64_C(0x8D316A96BD2F6AB7), + UINT64_C(0xC19918C8E2FBF0A4), UINT64_C(0x9570615ABE2B01A9), + UINT64_C(0x684BEBEC5B5A12BE), UINT64_C(0x3CA2927E078AE3B3), + UINT64_C(0x00E451AA3EB62A15), UINT64_C(0x540D28386266DB18), + UINT64_C(0xA936A28E8717C80F), UINT64_C(0xFDDFDB1CDBC73902), + UINT64_C(0xD1BB2526F56E5B43), UINT64_C(0x85525CB4A9BEAA4E), + UINT64_C(0x7869D6024CCFB959), UINT64_C(0x2C80AF90101F4854), + UINT64_C(0x10C66C44292381F2), UINT64_C(0x442F15D675F370FF), + UINT64_C(0xB9149F60908263E8), UINT64_C(0xEDFDE6F2CC5292E5), + UINT64_C(0xE1DD6314CDD0A76A), UINT64_C(0xB5341A8691005667), + UINT64_C(0x480F903074714570), UINT64_C(0x1CE6E9A228A1B47D), + UINT64_C(0x20A02A76119D7DDB), UINT64_C(0x744953E44D4D8CD6), + UINT64_C(0x8972D952A83C9FC1), UINT64_C(0xDD9BA0C0F4EC6ECC), + UINT64_C(0xF1FF5EFADA450C8D), UINT64_C(0xA51627688695FD80), + UINT64_C(0x582DADDE63E4EE97), UINT64_C(0x0CC4D44C3F341F9A), + UINT64_C(0x308217980608D63C), UINT64_C(0x646B6E0A5AD82731), + UINT64_C(0x9950E4BCBFA93426), UINT64_C(0xCDB99D2EE379C52B), + UINT64_C(0x90FB71CAD654A0F5), UINT64_C(0xC41208588A8451F8), + UINT64_C(0x392982EE6FF542EF), UINT64_C(0x6DC0FB7C3325B3E2), + UINT64_C(0x518638A80A197A44), UINT64_C(0x056F413A56C98B49), + UINT64_C(0xF854CB8CB3B8985E), UINT64_C(0xACBDB21EEF686953), + UINT64_C(0x80D94C24C1C10B12), UINT64_C(0xD43035B69D11FA1F), + UINT64_C(0x290BBF007860E908), UINT64_C(0x7DE2C69224B01805), + UINT64_C(0x41A405461D8CD1A3), UINT64_C(0x154D7CD4415C20AE), + UINT64_C(0xE876F662A42D33B9), UINT64_C(0xBC9F8FF0F8FDC2B4), + UINT64_C(0xB0BF0A16F97FF73B), UINT64_C(0xE4567384A5AF0636), + UINT64_C(0x196DF93240DE1521), UINT64_C(0x4D8480A01C0EE42C), + UINT64_C(0x71C2437425322D8A), UINT64_C(0x252B3AE679E2DC87), + UINT64_C(0xD810B0509C93CF90), UINT64_C(0x8CF9C9C2C0433E9D), + UINT64_C(0xA09D37F8EEEA5CDC), UINT64_C(0xF4744E6AB23AADD1), + UINT64_C(0x094FC4DC574BBEC6), UINT64_C(0x5DA6BD4E0B9B4FCB), + UINT64_C(0x61E07E9A32A7866D), UINT64_C(0x350907086E777760), + UINT64_C(0xC8328DBE8B066477), UINT64_C(0x9CDBF42CD7D6957A), + UINT64_C(0xD073867288020F69), UINT64_C(0x849AFFE0D4D2FE64), + UINT64_C(0x79A1755631A3ED73), UINT64_C(0x2D480CC46D731C7E), + UINT64_C(0x110ECF10544FD5D8), UINT64_C(0x45E7B682089F24D5), + UINT64_C(0xB8DC3C34EDEE37C2), UINT64_C(0xEC3545A6B13EC6CF), + UINT64_C(0xC051BB9C9F97A48E), UINT64_C(0x94B8C20EC3475583), + UINT64_C(0x698348B826364694), UINT64_C(0x3D6A312A7AE6B799), + UINT64_C(0x012CF2FE43DA7E3F), UINT64_C(0x55C58B6C1F0A8F32), + UINT64_C(0xA8FE01DAFA7B9C25), UINT64_C(0xFC177848A6AB6D28), + UINT64_C(0xF037FDAEA72958A7), UINT64_C(0xA4DE843CFBF9A9AA), + UINT64_C(0x59E50E8A1E88BABD), UINT64_C(0x0D0C771842584BB0), + UINT64_C(0x314AB4CC7B648216), UINT64_C(0x65A3CD5E27B4731B), + UINT64_C(0x989847E8C2C5600C), UINT64_C(0xCC713E7A9E159101), + UINT64_C(0xE015C040B0BCF340), UINT64_C(0xB4FCB9D2EC6C024D), + UINT64_C(0x49C73364091D115A), UINT64_C(0x1D2E4AF655CDE057), + UINT64_C(0x216889226CF129F1), UINT64_C(0x7581F0B03021D8FC), + UINT64_C(0x88BA7A06D550CBEB), UINT64_C(0xDC53039489803AE6), + UINT64_C(0x11EA9EBA6AF9FFCD), UINT64_C(0x4503E72836290EC0), + UINT64_C(0xB8386D9ED3581DD7), UINT64_C(0xECD1140C8F88ECDA), + UINT64_C(0xD097D7D8B6B4257C), UINT64_C(0x847EAE4AEA64D471), + UINT64_C(0x794524FC0F15C766), UINT64_C(0x2DAC5D6E53C5366B), + UINT64_C(0x01C8A3547D6C542A), UINT64_C(0x5521DAC621BCA527), + UINT64_C(0xA81A5070C4CDB630), UINT64_C(0xFCF329E2981D473D), + UINT64_C(0xC0B5EA36A1218E9B), UINT64_C(0x945C93A4FDF17F96), + UINT64_C(0x6967191218806C81), UINT64_C(0x3D8E608044509D8C), + UINT64_C(0x31AEE56645D2A803), UINT64_C(0x65479CF41902590E), + UINT64_C(0x987C1642FC734A19), UINT64_C(0xCC956FD0A0A3BB14), + UINT64_C(0xF0D3AC04999F72B2), UINT64_C(0xA43AD596C54F83BF), + UINT64_C(0x59015F20203E90A8), UINT64_C(0x0DE826B27CEE61A5), + UINT64_C(0x218CD888524703E4), UINT64_C(0x7565A11A0E97F2E9), + UINT64_C(0x885E2BACEBE6E1FE), UINT64_C(0xDCB7523EB73610F3), + UINT64_C(0xE0F191EA8E0AD955), UINT64_C(0xB418E878D2DA2858), + UINT64_C(0x492362CE37AB3B4F), UINT64_C(0x1DCA1B5C6B7BCA42), + UINT64_C(0x5162690234AF5051), UINT64_C(0x058B1090687FA15C), + UINT64_C(0xF8B09A268D0EB24B), UINT64_C(0xAC59E3B4D1DE4346), + UINT64_C(0x901F2060E8E28AE0), UINT64_C(0xC4F659F2B4327BED), + UINT64_C(0x39CDD344514368FA), UINT64_C(0x6D24AAD60D9399F7), + UINT64_C(0x414054EC233AFBB6), UINT64_C(0x15A92D7E7FEA0ABB), + UINT64_C(0xE892A7C89A9B19AC), UINT64_C(0xBC7BDE5AC64BE8A1), + UINT64_C(0x803D1D8EFF772107), UINT64_C(0xD4D4641CA3A7D00A), + UINT64_C(0x29EFEEAA46D6C31D), UINT64_C(0x7D0697381A063210), + UINT64_C(0x712612DE1B84079F), UINT64_C(0x25CF6B4C4754F692), + UINT64_C(0xD8F4E1FAA225E585), UINT64_C(0x8C1D9868FEF51488), + UINT64_C(0xB05B5BBCC7C9DD2E), UINT64_C(0xE4B2222E9B192C23), + UINT64_C(0x1989A8987E683F34), UINT64_C(0x4D60D10A22B8CE39), + UINT64_C(0x61042F300C11AC78), UINT64_C(0x35ED56A250C15D75), + UINT64_C(0xC8D6DC14B5B04E62), UINT64_C(0x9C3FA586E960BF6F), + UINT64_C(0xA0796652D05C76C9), UINT64_C(0xF4901FC08C8C87C4), + UINT64_C(0x09AB957669FD94D3), UINT64_C(0x5D42ECE4352D65DE) + }, { + UINT64_C(0x0000000000000000), UINT64_C(0x3F0BE14A916A6DCB), + UINT64_C(0x7E17C29522D4DB96), UINT64_C(0x411C23DFB3BEB65D), + UINT64_C(0xFC2F852A45A9B72C), UINT64_C(0xC3246460D4C3DAE7), + UINT64_C(0x823847BF677D6CBA), UINT64_C(0xBD33A6F5F6170171), + UINT64_C(0x6A87A57F245D70DD), UINT64_C(0x558C4435B5371D16), + UINT64_C(0x149067EA0689AB4B), UINT64_C(0x2B9B86A097E3C680), + UINT64_C(0x96A8205561F4C7F1), UINT64_C(0xA9A3C11FF09EAA3A), + UINT64_C(0xE8BFE2C043201C67), UINT64_C(0xD7B4038AD24A71AC), + UINT64_C(0xD50F4AFE48BAE1BA), UINT64_C(0xEA04ABB4D9D08C71), + UINT64_C(0xAB18886B6A6E3A2C), UINT64_C(0x94136921FB0457E7), + UINT64_C(0x2920CFD40D135696), UINT64_C(0x162B2E9E9C793B5D), + UINT64_C(0x57370D412FC78D00), UINT64_C(0x683CEC0BBEADE0CB), + UINT64_C(0xBF88EF816CE79167), UINT64_C(0x80830ECBFD8DFCAC), + UINT64_C(0xC19F2D144E334AF1), UINT64_C(0xFE94CC5EDF59273A), + UINT64_C(0x43A76AAB294E264B), UINT64_C(0x7CAC8BE1B8244B80), + UINT64_C(0x3DB0A83E0B9AFDDD), UINT64_C(0x02BB49749AF09016), + UINT64_C(0x38C63AD73E7BDDF1), UINT64_C(0x07CDDB9DAF11B03A), + UINT64_C(0x46D1F8421CAF0667), UINT64_C(0x79DA19088DC56BAC), + UINT64_C(0xC4E9BFFD7BD26ADD), UINT64_C(0xFBE25EB7EAB80716), + UINT64_C(0xBAFE7D685906B14B), UINT64_C(0x85F59C22C86CDC80), + UINT64_C(0x52419FA81A26AD2C), UINT64_C(0x6D4A7EE28B4CC0E7), + UINT64_C(0x2C565D3D38F276BA), UINT64_C(0x135DBC77A9981B71), + UINT64_C(0xAE6E1A825F8F1A00), UINT64_C(0x9165FBC8CEE577CB), + UINT64_C(0xD079D8177D5BC196), UINT64_C(0xEF72395DEC31AC5D), + UINT64_C(0xEDC9702976C13C4B), UINT64_C(0xD2C29163E7AB5180), + UINT64_C(0x93DEB2BC5415E7DD), UINT64_C(0xACD553F6C57F8A16), + UINT64_C(0x11E6F50333688B67), UINT64_C(0x2EED1449A202E6AC), + UINT64_C(0x6FF1379611BC50F1), UINT64_C(0x50FAD6DC80D63D3A), + UINT64_C(0x874ED556529C4C96), UINT64_C(0xB845341CC3F6215D), + UINT64_C(0xF95917C370489700), UINT64_C(0xC652F689E122FACB), + UINT64_C(0x7B61507C1735FBBA), UINT64_C(0x446AB136865F9671), + UINT64_C(0x057692E935E1202C), UINT64_C(0x3A7D73A3A48B4DE7), + UINT64_C(0x718C75AE7CF7BBE2), UINT64_C(0x4E8794E4ED9DD629), + UINT64_C(0x0F9BB73B5E236074), UINT64_C(0x30905671CF490DBF), + UINT64_C(0x8DA3F084395E0CCE), UINT64_C(0xB2A811CEA8346105), + UINT64_C(0xF3B432111B8AD758), UINT64_C(0xCCBFD35B8AE0BA93), + UINT64_C(0x1B0BD0D158AACB3F), UINT64_C(0x2400319BC9C0A6F4), + UINT64_C(0x651C12447A7E10A9), UINT64_C(0x5A17F30EEB147D62), + UINT64_C(0xE72455FB1D037C13), UINT64_C(0xD82FB4B18C6911D8), + UINT64_C(0x9933976E3FD7A785), UINT64_C(0xA6387624AEBDCA4E), + UINT64_C(0xA4833F50344D5A58), UINT64_C(0x9B88DE1AA5273793), + UINT64_C(0xDA94FDC5169981CE), UINT64_C(0xE59F1C8F87F3EC05), + UINT64_C(0x58ACBA7A71E4ED74), UINT64_C(0x67A75B30E08E80BF), + UINT64_C(0x26BB78EF533036E2), UINT64_C(0x19B099A5C25A5B29), + UINT64_C(0xCE049A2F10102A85), UINT64_C(0xF10F7B65817A474E), + UINT64_C(0xB01358BA32C4F113), UINT64_C(0x8F18B9F0A3AE9CD8), + UINT64_C(0x322B1F0555B99DA9), UINT64_C(0x0D20FE4FC4D3F062), + UINT64_C(0x4C3CDD90776D463F), UINT64_C(0x73373CDAE6072BF4), + UINT64_C(0x494A4F79428C6613), UINT64_C(0x7641AE33D3E60BD8), + UINT64_C(0x375D8DEC6058BD85), UINT64_C(0x08566CA6F132D04E), + UINT64_C(0xB565CA530725D13F), UINT64_C(0x8A6E2B19964FBCF4), + UINT64_C(0xCB7208C625F10AA9), UINT64_C(0xF479E98CB49B6762), + UINT64_C(0x23CDEA0666D116CE), UINT64_C(0x1CC60B4CF7BB7B05), + UINT64_C(0x5DDA28934405CD58), UINT64_C(0x62D1C9D9D56FA093), + UINT64_C(0xDFE26F2C2378A1E2), UINT64_C(0xE0E98E66B212CC29), + UINT64_C(0xA1F5ADB901AC7A74), UINT64_C(0x9EFE4CF390C617BF), + UINT64_C(0x9C4505870A3687A9), UINT64_C(0xA34EE4CD9B5CEA62), + UINT64_C(0xE252C71228E25C3F), UINT64_C(0xDD592658B98831F4), + UINT64_C(0x606A80AD4F9F3085), UINT64_C(0x5F6161E7DEF55D4E), + UINT64_C(0x1E7D42386D4BEB13), UINT64_C(0x2176A372FC2186D8), + UINT64_C(0xF6C2A0F82E6BF774), UINT64_C(0xC9C941B2BF019ABF), + UINT64_C(0x88D5626D0CBF2CE2), UINT64_C(0xB7DE83279DD54129), + UINT64_C(0x0AED25D26BC24058), UINT64_C(0x35E6C498FAA82D93), + UINT64_C(0x74FAE74749169BCE), UINT64_C(0x4BF1060DD87CF605), + UINT64_C(0xE318EB5CF9EF77C4), UINT64_C(0xDC130A1668851A0F), + UINT64_C(0x9D0F29C9DB3BAC52), UINT64_C(0xA204C8834A51C199), + UINT64_C(0x1F376E76BC46C0E8), UINT64_C(0x203C8F3C2D2CAD23), + UINT64_C(0x6120ACE39E921B7E), UINT64_C(0x5E2B4DA90FF876B5), + UINT64_C(0x899F4E23DDB20719), UINT64_C(0xB694AF694CD86AD2), + UINT64_C(0xF7888CB6FF66DC8F), UINT64_C(0xC8836DFC6E0CB144), + UINT64_C(0x75B0CB09981BB035), UINT64_C(0x4ABB2A430971DDFE), + UINT64_C(0x0BA7099CBACF6BA3), UINT64_C(0x34ACE8D62BA50668), + UINT64_C(0x3617A1A2B155967E), UINT64_C(0x091C40E8203FFBB5), + UINT64_C(0x4800633793814DE8), UINT64_C(0x770B827D02EB2023), + UINT64_C(0xCA382488F4FC2152), UINT64_C(0xF533C5C265964C99), + UINT64_C(0xB42FE61DD628FAC4), UINT64_C(0x8B2407574742970F), + UINT64_C(0x5C9004DD9508E6A3), UINT64_C(0x639BE59704628B68), + UINT64_C(0x2287C648B7DC3D35), UINT64_C(0x1D8C270226B650FE), + UINT64_C(0xA0BF81F7D0A1518F), UINT64_C(0x9FB460BD41CB3C44), + UINT64_C(0xDEA84362F2758A19), UINT64_C(0xE1A3A228631FE7D2), + UINT64_C(0xDBDED18BC794AA35), UINT64_C(0xE4D530C156FEC7FE), + UINT64_C(0xA5C9131EE54071A3), UINT64_C(0x9AC2F254742A1C68), + UINT64_C(0x27F154A1823D1D19), UINT64_C(0x18FAB5EB135770D2), + UINT64_C(0x59E69634A0E9C68F), UINT64_C(0x66ED777E3183AB44), + UINT64_C(0xB15974F4E3C9DAE8), UINT64_C(0x8E5295BE72A3B723), + UINT64_C(0xCF4EB661C11D017E), UINT64_C(0xF045572B50776CB5), + UINT64_C(0x4D76F1DEA6606DC4), UINT64_C(0x727D1094370A000F), + UINT64_C(0x3361334B84B4B652), UINT64_C(0x0C6AD20115DEDB99), + UINT64_C(0x0ED19B758F2E4B8F), UINT64_C(0x31DA7A3F1E442644), + UINT64_C(0x70C659E0ADFA9019), UINT64_C(0x4FCDB8AA3C90FDD2), + UINT64_C(0xF2FE1E5FCA87FCA3), UINT64_C(0xCDF5FF155BED9168), + UINT64_C(0x8CE9DCCAE8532735), UINT64_C(0xB3E23D8079394AFE), + UINT64_C(0x64563E0AAB733B52), UINT64_C(0x5B5DDF403A195699), + UINT64_C(0x1A41FC9F89A7E0C4), UINT64_C(0x254A1DD518CD8D0F), + UINT64_C(0x9879BB20EEDA8C7E), UINT64_C(0xA7725A6A7FB0E1B5), + UINT64_C(0xE66E79B5CC0E57E8), UINT64_C(0xD96598FF5D643A23), + UINT64_C(0x92949EF28518CC26), UINT64_C(0xAD9F7FB81472A1ED), + UINT64_C(0xEC835C67A7CC17B0), UINT64_C(0xD388BD2D36A67A7B), + UINT64_C(0x6EBB1BD8C0B17B0A), UINT64_C(0x51B0FA9251DB16C1), + UINT64_C(0x10ACD94DE265A09C), UINT64_C(0x2FA73807730FCD57), + UINT64_C(0xF8133B8DA145BCFB), UINT64_C(0xC718DAC7302FD130), + UINT64_C(0x8604F9188391676D), UINT64_C(0xB90F185212FB0AA6), + UINT64_C(0x043CBEA7E4EC0BD7), UINT64_C(0x3B375FED7586661C), + UINT64_C(0x7A2B7C32C638D041), UINT64_C(0x45209D785752BD8A), + UINT64_C(0x479BD40CCDA22D9C), UINT64_C(0x789035465CC84057), + UINT64_C(0x398C1699EF76F60A), UINT64_C(0x0687F7D37E1C9BC1), + UINT64_C(0xBBB45126880B9AB0), UINT64_C(0x84BFB06C1961F77B), + UINT64_C(0xC5A393B3AADF4126), UINT64_C(0xFAA872F93BB52CED), + UINT64_C(0x2D1C7173E9FF5D41), UINT64_C(0x121790397895308A), + UINT64_C(0x530BB3E6CB2B86D7), UINT64_C(0x6C0052AC5A41EB1C), + UINT64_C(0xD133F459AC56EA6D), UINT64_C(0xEE3815133D3C87A6), + UINT64_C(0xAF2436CC8E8231FB), UINT64_C(0x902FD7861FE85C30), + UINT64_C(0xAA52A425BB6311D7), UINT64_C(0x9559456F2A097C1C), + UINT64_C(0xD44566B099B7CA41), UINT64_C(0xEB4E87FA08DDA78A), + UINT64_C(0x567D210FFECAA6FB), UINT64_C(0x6976C0456FA0CB30), + UINT64_C(0x286AE39ADC1E7D6D), UINT64_C(0x176102D04D7410A6), + UINT64_C(0xC0D5015A9F3E610A), UINT64_C(0xFFDEE0100E540CC1), + UINT64_C(0xBEC2C3CFBDEABA9C), UINT64_C(0x81C922852C80D757), + UINT64_C(0x3CFA8470DA97D626), UINT64_C(0x03F1653A4BFDBBED), + UINT64_C(0x42ED46E5F8430DB0), UINT64_C(0x7DE6A7AF6929607B), + UINT64_C(0x7F5DEEDBF3D9F06D), UINT64_C(0x40560F9162B39DA6), + UINT64_C(0x014A2C4ED10D2BFB), UINT64_C(0x3E41CD0440674630), + UINT64_C(0x83726BF1B6704741), UINT64_C(0xBC798ABB271A2A8A), + UINT64_C(0xFD65A96494A49CD7), UINT64_C(0xC26E482E05CEF11C), + UINT64_C(0x15DA4BA4D78480B0), UINT64_C(0x2AD1AAEE46EEED7B), + UINT64_C(0x6BCD8931F5505B26), UINT64_C(0x54C6687B643A36ED), + UINT64_C(0xE9F5CE8E922D379C), UINT64_C(0xD6FE2FC403475A57), + UINT64_C(0x97E20C1BB0F9EC0A), UINT64_C(0xA8E9ED51219381C1) + }, { + UINT64_C(0x0000000000000000), UINT64_C(0x1DEE8A5E222CA1DC), + UINT64_C(0x3BDD14BC445943B8), UINT64_C(0x26339EE26675E264), + UINT64_C(0x77BA297888B28770), UINT64_C(0x6A54A326AA9E26AC), + UINT64_C(0x4C673DC4CCEBC4C8), UINT64_C(0x5189B79AEEC76514), + UINT64_C(0xEF7452F111650EE0), UINT64_C(0xF29AD8AF3349AF3C), + UINT64_C(0xD4A9464D553C4D58), UINT64_C(0xC947CC137710EC84), + UINT64_C(0x98CE7B8999D78990), UINT64_C(0x8520F1D7BBFB284C), + UINT64_C(0xA3136F35DD8ECA28), UINT64_C(0xBEFDE56BFFA26BF4), + UINT64_C(0x4C300AC98DC40345), UINT64_C(0x51DE8097AFE8A299), + UINT64_C(0x77ED1E75C99D40FD), UINT64_C(0x6A03942BEBB1E121), + UINT64_C(0x3B8A23B105768435), UINT64_C(0x2664A9EF275A25E9), + UINT64_C(0x0057370D412FC78D), UINT64_C(0x1DB9BD5363036651), + UINT64_C(0xA34458389CA10DA5), UINT64_C(0xBEAAD266BE8DAC79), + UINT64_C(0x98994C84D8F84E1D), UINT64_C(0x8577C6DAFAD4EFC1), + UINT64_C(0xD4FE714014138AD5), UINT64_C(0xC910FB1E363F2B09), + UINT64_C(0xEF2365FC504AC96D), UINT64_C(0xF2CDEFA2726668B1), + UINT64_C(0x986015931B88068A), UINT64_C(0x858E9FCD39A4A756), + UINT64_C(0xA3BD012F5FD14532), UINT64_C(0xBE538B717DFDE4EE), + UINT64_C(0xEFDA3CEB933A81FA), UINT64_C(0xF234B6B5B1162026), + UINT64_C(0xD4072857D763C242), UINT64_C(0xC9E9A209F54F639E), + UINT64_C(0x771447620AED086A), UINT64_C(0x6AFACD3C28C1A9B6), + UINT64_C(0x4CC953DE4EB44BD2), UINT64_C(0x5127D9806C98EA0E), + UINT64_C(0x00AE6E1A825F8F1A), UINT64_C(0x1D40E444A0732EC6), + UINT64_C(0x3B737AA6C606CCA2), UINT64_C(0x269DF0F8E42A6D7E), + UINT64_C(0xD4501F5A964C05CF), UINT64_C(0xC9BE9504B460A413), + UINT64_C(0xEF8D0BE6D2154677), UINT64_C(0xF26381B8F039E7AB), + UINT64_C(0xA3EA36221EFE82BF), UINT64_C(0xBE04BC7C3CD22363), + UINT64_C(0x9837229E5AA7C107), UINT64_C(0x85D9A8C0788B60DB), + UINT64_C(0x3B244DAB87290B2F), UINT64_C(0x26CAC7F5A505AAF3), + UINT64_C(0x00F95917C3704897), UINT64_C(0x1D17D349E15CE94B), + UINT64_C(0x4C9E64D30F9B8C5F), UINT64_C(0x5170EE8D2DB72D83), + UINT64_C(0x7743706F4BC2CFE7), UINT64_C(0x6AADFA3169EE6E3B), + UINT64_C(0xA218840D981E1391), UINT64_C(0xBFF60E53BA32B24D), + UINT64_C(0x99C590B1DC475029), UINT64_C(0x842B1AEFFE6BF1F5), + UINT64_C(0xD5A2AD7510AC94E1), UINT64_C(0xC84C272B3280353D), + UINT64_C(0xEE7FB9C954F5D759), UINT64_C(0xF391339776D97685), + UINT64_C(0x4D6CD6FC897B1D71), UINT64_C(0x50825CA2AB57BCAD), + UINT64_C(0x76B1C240CD225EC9), UINT64_C(0x6B5F481EEF0EFF15), + UINT64_C(0x3AD6FF8401C99A01), UINT64_C(0x273875DA23E53BDD), + UINT64_C(0x010BEB384590D9B9), UINT64_C(0x1CE5616667BC7865), + UINT64_C(0xEE288EC415DA10D4), UINT64_C(0xF3C6049A37F6B108), + UINT64_C(0xD5F59A785183536C), UINT64_C(0xC81B102673AFF2B0), + UINT64_C(0x9992A7BC9D6897A4), UINT64_C(0x847C2DE2BF443678), + UINT64_C(0xA24FB300D931D41C), UINT64_C(0xBFA1395EFB1D75C0), + UINT64_C(0x015CDC3504BF1E34), UINT64_C(0x1CB2566B2693BFE8), + UINT64_C(0x3A81C88940E65D8C), UINT64_C(0x276F42D762CAFC50), + UINT64_C(0x76E6F54D8C0D9944), UINT64_C(0x6B087F13AE213898), + UINT64_C(0x4D3BE1F1C854DAFC), UINT64_C(0x50D56BAFEA787B20), + UINT64_C(0x3A78919E8396151B), UINT64_C(0x27961BC0A1BAB4C7), + UINT64_C(0x01A58522C7CF56A3), UINT64_C(0x1C4B0F7CE5E3F77F), + UINT64_C(0x4DC2B8E60B24926B), UINT64_C(0x502C32B8290833B7), + UINT64_C(0x761FAC5A4F7DD1D3), UINT64_C(0x6BF126046D51700F), + UINT64_C(0xD50CC36F92F31BFB), UINT64_C(0xC8E24931B0DFBA27), + UINT64_C(0xEED1D7D3D6AA5843), UINT64_C(0xF33F5D8DF486F99F), + UINT64_C(0xA2B6EA171A419C8B), UINT64_C(0xBF586049386D3D57), + UINT64_C(0x996BFEAB5E18DF33), UINT64_C(0x848574F57C347EEF), + UINT64_C(0x76489B570E52165E), UINT64_C(0x6BA611092C7EB782), + UINT64_C(0x4D958FEB4A0B55E6), UINT64_C(0x507B05B56827F43A), + UINT64_C(0x01F2B22F86E0912E), UINT64_C(0x1C1C3871A4CC30F2), + UINT64_C(0x3A2FA693C2B9D296), UINT64_C(0x27C12CCDE095734A), + UINT64_C(0x993CC9A61F3718BE), UINT64_C(0x84D243F83D1BB962), + UINT64_C(0xA2E1DD1A5B6E5B06), UINT64_C(0xBF0F57447942FADA), + UINT64_C(0xEE86E0DE97859FCE), UINT64_C(0xF3686A80B5A93E12), + UINT64_C(0xD55BF462D3DCDC76), UINT64_C(0xC8B57E3CF1F07DAA), + UINT64_C(0xD6E9A7309F3239A7), UINT64_C(0xCB072D6EBD1E987B), + UINT64_C(0xED34B38CDB6B7A1F), UINT64_C(0xF0DA39D2F947DBC3), + UINT64_C(0xA1538E481780BED7), UINT64_C(0xBCBD041635AC1F0B), + UINT64_C(0x9A8E9AF453D9FD6F), UINT64_C(0x876010AA71F55CB3), + UINT64_C(0x399DF5C18E573747), UINT64_C(0x24737F9FAC7B969B), + UINT64_C(0x0240E17DCA0E74FF), UINT64_C(0x1FAE6B23E822D523), + UINT64_C(0x4E27DCB906E5B037), UINT64_C(0x53C956E724C911EB), + UINT64_C(0x75FAC80542BCF38F), UINT64_C(0x6814425B60905253), + UINT64_C(0x9AD9ADF912F63AE2), UINT64_C(0x873727A730DA9B3E), + UINT64_C(0xA104B94556AF795A), UINT64_C(0xBCEA331B7483D886), + UINT64_C(0xED6384819A44BD92), UINT64_C(0xF08D0EDFB8681C4E), + UINT64_C(0xD6BE903DDE1DFE2A), UINT64_C(0xCB501A63FC315FF6), + UINT64_C(0x75ADFF0803933402), UINT64_C(0x6843755621BF95DE), + UINT64_C(0x4E70EBB447CA77BA), UINT64_C(0x539E61EA65E6D666), + UINT64_C(0x0217D6708B21B372), UINT64_C(0x1FF95C2EA90D12AE), + UINT64_C(0x39CAC2CCCF78F0CA), UINT64_C(0x24244892ED545116), + UINT64_C(0x4E89B2A384BA3F2D), UINT64_C(0x536738FDA6969EF1), + UINT64_C(0x7554A61FC0E37C95), UINT64_C(0x68BA2C41E2CFDD49), + UINT64_C(0x39339BDB0C08B85D), UINT64_C(0x24DD11852E241981), + UINT64_C(0x02EE8F674851FBE5), UINT64_C(0x1F0005396A7D5A39), + UINT64_C(0xA1FDE05295DF31CD), UINT64_C(0xBC136A0CB7F39011), + UINT64_C(0x9A20F4EED1867275), UINT64_C(0x87CE7EB0F3AAD3A9), + UINT64_C(0xD647C92A1D6DB6BD), UINT64_C(0xCBA943743F411761), + UINT64_C(0xED9ADD965934F505), UINT64_C(0xF07457C87B1854D9), + UINT64_C(0x02B9B86A097E3C68), UINT64_C(0x1F5732342B529DB4), + UINT64_C(0x3964ACD64D277FD0), UINT64_C(0x248A26886F0BDE0C), + UINT64_C(0x7503911281CCBB18), UINT64_C(0x68ED1B4CA3E01AC4), + UINT64_C(0x4EDE85AEC595F8A0), UINT64_C(0x53300FF0E7B9597C), + UINT64_C(0xEDCDEA9B181B3288), UINT64_C(0xF02360C53A379354), + UINT64_C(0xD610FE275C427130), UINT64_C(0xCBFE74797E6ED0EC), + UINT64_C(0x9A77C3E390A9B5F8), UINT64_C(0x879949BDB2851424), + UINT64_C(0xA1AAD75FD4F0F640), UINT64_C(0xBC445D01F6DC579C), + UINT64_C(0x74F1233D072C2A36), UINT64_C(0x691FA96325008BEA), + UINT64_C(0x4F2C37814375698E), UINT64_C(0x52C2BDDF6159C852), + UINT64_C(0x034B0A458F9EAD46), UINT64_C(0x1EA5801BADB20C9A), + UINT64_C(0x38961EF9CBC7EEFE), UINT64_C(0x257894A7E9EB4F22), + UINT64_C(0x9B8571CC164924D6), UINT64_C(0x866BFB923465850A), + UINT64_C(0xA05865705210676E), UINT64_C(0xBDB6EF2E703CC6B2), + UINT64_C(0xEC3F58B49EFBA3A6), UINT64_C(0xF1D1D2EABCD7027A), + UINT64_C(0xD7E24C08DAA2E01E), UINT64_C(0xCA0CC656F88E41C2), + UINT64_C(0x38C129F48AE82973), UINT64_C(0x252FA3AAA8C488AF), + UINT64_C(0x031C3D48CEB16ACB), UINT64_C(0x1EF2B716EC9DCB17), + UINT64_C(0x4F7B008C025AAE03), UINT64_C(0x52958AD220760FDF), + UINT64_C(0x74A614304603EDBB), UINT64_C(0x69489E6E642F4C67), + UINT64_C(0xD7B57B059B8D2793), UINT64_C(0xCA5BF15BB9A1864F), + UINT64_C(0xEC686FB9DFD4642B), UINT64_C(0xF186E5E7FDF8C5F7), + UINT64_C(0xA00F527D133FA0E3), UINT64_C(0xBDE1D8233113013F), + UINT64_C(0x9BD246C15766E35B), UINT64_C(0x863CCC9F754A4287), + UINT64_C(0xEC9136AE1CA42CBC), UINT64_C(0xF17FBCF03E888D60), + UINT64_C(0xD74C221258FD6F04), UINT64_C(0xCAA2A84C7AD1CED8), + UINT64_C(0x9B2B1FD69416ABCC), UINT64_C(0x86C59588B63A0A10), + UINT64_C(0xA0F60B6AD04FE874), UINT64_C(0xBD188134F26349A8), + UINT64_C(0x03E5645F0DC1225C), UINT64_C(0x1E0BEE012FED8380), + UINT64_C(0x383870E3499861E4), UINT64_C(0x25D6FABD6BB4C038), + UINT64_C(0x745F4D278573A52C), UINT64_C(0x69B1C779A75F04F0), + UINT64_C(0x4F82599BC12AE694), UINT64_C(0x526CD3C5E3064748), + UINT64_C(0xA0A13C6791602FF9), UINT64_C(0xBD4FB639B34C8E25), + UINT64_C(0x9B7C28DBD5396C41), UINT64_C(0x8692A285F715CD9D), + UINT64_C(0xD71B151F19D2A889), UINT64_C(0xCAF59F413BFE0955), + UINT64_C(0xECC601A35D8BEB31), UINT64_C(0xF1288BFD7FA74AED), + UINT64_C(0x4FD56E9680052119), UINT64_C(0x523BE4C8A22980C5), + UINT64_C(0x74087A2AC45C62A1), UINT64_C(0x69E6F074E670C37D), + UINT64_C(0x386F47EE08B7A669), UINT64_C(0x2581CDB02A9B07B5), + UINT64_C(0x03B253524CEEE5D1), UINT64_C(0x1E5CD90C6EC2440D) + } +}; diff --git a/liblzma/check/crc64_tablegen.c b/liblzma/check/crc64_tablegen.c new file mode 100644 index 0000000..fddaa7e --- /dev/null +++ b/liblzma/check/crc64_tablegen.c @@ -0,0 +1,88 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file crc64_tablegen.c +/// \brief Generate crc64_table_le.h and crc64_table_be.h +/// +/// Compiling: gcc -std=c99 -o crc64_tablegen crc64_tablegen.c +/// Add -DWORDS_BIGENDIAN to generate big endian table. +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include +#include "../../common/tuklib_integer.h" + + +static uint64_t crc64_table[4][256]; + + +extern void +init_crc64_table(void) +{ + static const uint64_t poly64 = UINT64_C(0xC96C5795D7870F42); + + for (size_t s = 0; s < 4; ++s) { + for (size_t b = 0; b < 256; ++b) { + uint64_t r = s == 0 ? b : crc64_table[s - 1][b]; + + for (size_t i = 0; i < 8; ++i) { + if (r & 1) + r = (r >> 1) ^ poly64; + else + r >>= 1; + } + + crc64_table[s][b] = r; + } + } + +#ifdef WORDS_BIGENDIAN + for (size_t s = 0; s < 4; ++s) + for (size_t b = 0; b < 256; ++b) + crc64_table[s][b] = bswap64(crc64_table[s][b]); +#endif + + return; +} + + +static void +print_crc64_table(void) +{ + printf("/* This file has been automatically generated by " + "crc64_tablegen.c. */\n\n" + "const uint64_t lzma_crc64_table[4][256] = {\n\t{"); + + for (size_t s = 0; s < 4; ++s) { + for (size_t b = 0; b < 256; ++b) { + if ((b % 2) == 0) + printf("\n\t\t"); + + printf("UINT64_C(0x%016" PRIX64 ")", + crc64_table[s][b]); + + if (b != 255) + printf(",%s", (b+1) % 2 == 0 ? "" : " "); + } + + if (s == 3) + printf("\n\t}\n};\n"); + else + printf("\n\t}, {"); + } + + return; +} + + +int +main(void) +{ + init_crc64_table(); + print_crc64_table(); + return 0; +} diff --git a/liblzma/check/crc64_x86.S b/liblzma/check/crc64_x86.S new file mode 100644 index 0000000..f5bb84b --- /dev/null +++ b/liblzma/check/crc64_x86.S @@ -0,0 +1,287 @@ +/* + * Speed-optimized CRC64 using slicing-by-four algorithm + * + * This uses only i386 instructions, but it is optimized for i686 and later + * (including e.g. Pentium II/III/IV, Athlon XP, and Core 2). + * + * Authors: Igor Pavlov (original CRC32 assembly code) + * Lasse Collin (CRC64 adaptation of the modified CRC32 code) + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + * + * This code needs lzma_crc64_table, which can be created using the + * following C code: + +uint64_t lzma_crc64_table[4][256]; + +void +init_table(void) +{ + // ECMA-182 + static const uint64_t poly64 = UINT64_C(0xC96C5795D7870F42); + + for (size_t s = 0; s < 4; ++s) { + for (size_t b = 0; b < 256; ++b) { + uint64_t r = s == 0 ? b : lzma_crc64_table[s - 1][b]; + + for (size_t i = 0; i < 8; ++i) { + if (r & 1) + r = (r >> 1) ^ poly64; + else + r >>= 1; + } + + lzma_crc64_table[s][b] = r; + } + } +} + + * The prototype of the CRC64 function: + * extern uint64_t lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc); + */ + +/* + * On some systems, the functions need to be prefixed. The prefix is + * usually an underscore. + */ +#ifndef __USER_LABEL_PREFIX__ +# define __USER_LABEL_PREFIX__ +#endif +#define MAKE_SYM_CAT(prefix, sym) prefix ## sym +#define MAKE_SYM(prefix, sym) MAKE_SYM_CAT(prefix, sym) +#define LZMA_CRC64 MAKE_SYM(__USER_LABEL_PREFIX__, lzma_crc64) +#define LZMA_CRC64_TABLE MAKE_SYM(__USER_LABEL_PREFIX__, lzma_crc64_table) + +/* + * Solaris assembler doesn't have .p2align, and Darwin uses .align + * differently than GNU/Linux and Solaris. + */ +#if defined(__APPLE__) || defined(__MSDOS__) +# define ALIGN(pow2, abs) .align pow2 +#else +# define ALIGN(pow2, abs) .align abs +#endif + + .text + .globl LZMA_CRC64 + +#if !defined(__APPLE__) && !defined(_WIN32) && !defined(__CYGWIN__) \ + && !defined(__MSDOS__) + .type LZMA_CRC64, @function +#endif + + ALIGN(4, 16) +LZMA_CRC64: + /* + * Register usage: + * %eax crc LSB + * %edx crc MSB + * %esi buf + * %edi size or buf + size + * %ebx lzma_crc64_table + * %ebp Table index + * %ecx Temporary + */ + pushl %ebx + pushl %esi + pushl %edi + pushl %ebp + movl 0x14(%esp), %esi /* buf */ + movl 0x18(%esp), %edi /* size */ + movl 0x1C(%esp), %eax /* crc LSB */ + movl 0x20(%esp), %edx /* crc MSB */ + + /* + * Store the address of lzma_crc64_table to %ebx. This is needed to + * get position-independent code (PIC). + * + * The PIC macro is defined by libtool, while __PIC__ is defined + * by GCC but only on some systems. Testing for both makes it simpler + * to test this code without libtool, and keeps the code working also + * when built with libtool but using something else than GCC. + * + * I understood that libtool may define PIC on Windows even though + * the code in Windows DLLs is not PIC in sense that it is in ELF + * binaries, so we need a separate check to always use the non-PIC + * code on Windows. + */ +#if (!defined(PIC) && !defined(__PIC__)) \ + || (defined(_WIN32) || defined(__CYGWIN__)) + /* Not PIC */ + movl $ LZMA_CRC64_TABLE, %ebx +#elif defined(__APPLE__) + /* Mach-O */ + call .L_get_pc +.L_pic: + leal .L_lzma_crc64_table$non_lazy_ptr-.L_pic(%ebx), %ebx + movl (%ebx), %ebx +#else + /* ELF */ + call .L_get_pc + addl $_GLOBAL_OFFSET_TABLE_, %ebx + movl LZMA_CRC64_TABLE at GOT(%ebx), %ebx +#endif + + /* Complement the initial value. */ + notl %eax + notl %edx + +.L_align: + /* + * Check if there is enough input to use slicing-by-four. + * We need eight bytes, because the loop pre-reads four bytes. + */ + cmpl $8, %edi + jb .L_rest + + /* Check if we have reached alignment of four bytes. */ + testl $3, %esi + jz .L_slice + + /* Calculate CRC of the next input byte. */ + movzbl (%esi), %ebp + incl %esi + movzbl %al, %ecx + xorl %ecx, %ebp + shrdl $8, %edx, %eax + xorl (%ebx, %ebp, 8), %eax + shrl $8, %edx + xorl 4(%ebx, %ebp, 8), %edx + decl %edi + jmp .L_align + +.L_slice: + /* + * If we get here, there's at least eight bytes of aligned input + * available. Make %edi multiple of four bytes. Store the possible + * remainder over the "size" variable in the argument stack. + */ + movl %edi, 0x18(%esp) + andl $-4, %edi + subl %edi, 0x18(%esp) + + /* + * Let %edi be buf + size - 4 while running the main loop. This way + * we can compare for equality to determine when exit the loop. + */ + addl %esi, %edi + subl $4, %edi + + /* Read in the first four aligned bytes. */ + movl (%esi), %ecx + +.L_loop: + xorl %eax, %ecx + movzbl %cl, %ebp + movl 0x1800(%ebx, %ebp, 8), %eax + xorl %edx, %eax + movl 0x1804(%ebx, %ebp, 8), %edx + movzbl %ch, %ebp + xorl 0x1000(%ebx, %ebp, 8), %eax + xorl 0x1004(%ebx, %ebp, 8), %edx + shrl $16, %ecx + movzbl %cl, %ebp + xorl 0x0800(%ebx, %ebp, 8), %eax + xorl 0x0804(%ebx, %ebp, 8), %edx + movzbl %ch, %ebp + addl $4, %esi + xorl (%ebx, %ebp, 8), %eax + xorl 4(%ebx, %ebp, 8), %edx + + /* Check for end of aligned input. */ + cmpl %edi, %esi + + /* + * Copy the next input byte to %ecx. It is slightly faster to + * read it here than at the top of the loop. + */ + movl (%esi), %ecx + jb .L_loop + + /* + * Process the remaining four bytes, which we have already + * copied to %ecx. + */ + xorl %eax, %ecx + movzbl %cl, %ebp + movl 0x1800(%ebx, %ebp, 8), %eax + xorl %edx, %eax + movl 0x1804(%ebx, %ebp, 8), %edx + movzbl %ch, %ebp + xorl 0x1000(%ebx, %ebp, 8), %eax + xorl 0x1004(%ebx, %ebp, 8), %edx + shrl $16, %ecx + movzbl %cl, %ebp + xorl 0x0800(%ebx, %ebp, 8), %eax + xorl 0x0804(%ebx, %ebp, 8), %edx + movzbl %ch, %ebp + addl $4, %esi + xorl (%ebx, %ebp, 8), %eax + xorl 4(%ebx, %ebp, 8), %edx + + /* Copy the number of remaining bytes to %edi. */ + movl 0x18(%esp), %edi + +.L_rest: + /* Check for end of input. */ + testl %edi, %edi + jz .L_return + + /* Calculate CRC of the next input byte. */ + movzbl (%esi), %ebp + incl %esi + movzbl %al, %ecx + xorl %ecx, %ebp + shrdl $8, %edx, %eax + xorl (%ebx, %ebp, 8), %eax + shrl $8, %edx + xorl 4(%ebx, %ebp, 8), %edx + decl %edi + jmp .L_rest + +.L_return: + /* Complement the final value. */ + notl %eax + notl %edx + + popl %ebp + popl %edi + popl %esi + popl %ebx + ret + +#if defined(PIC) || defined(__PIC__) + ALIGN(4, 16) +.L_get_pc: + movl (%esp), %ebx + ret +#endif + +#if defined(__APPLE__) && (defined(PIC) || defined(__PIC__)) + /* Mach-O PIC */ + .section __IMPORT,__pointers,non_lazy_symbol_pointers +.L_lzma_crc64_table$non_lazy_ptr: + .indirect_symbol LZMA_CRC64_TABLE + .long 0 + +#elif defined(_WIN32) || defined(__CYGWIN__) +# ifdef DLL_EXPORT + /* This is equivalent of __declspec(dllexport). */ + .section .drectve + .ascii " -export:lzma_crc64" +# endif + +#elif !defined(__MSDOS__) + /* ELF */ + .size LZMA_CRC64, .-LZMA_CRC64 +#endif + +/* + * This is needed to support non-executable stack. It's ugly to + * use __linux__ here, but I don't know a way to detect when + * we are using GNU assembler. + */ +#if defined(__ELF__) && defined(__linux__) + .section .note.GNU-stack,"", at progbits +#endif diff --git a/liblzma/check/crc_macros.h b/liblzma/check/crc_macros.h new file mode 100644 index 0000000..a7c21b7 --- /dev/null +++ b/liblzma/check/crc_macros.h @@ -0,0 +1,30 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file crc_macros.h +/// \brief Some endian-dependent macros for CRC32 and CRC64 +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifdef WORDS_BIGENDIAN +# define A(x) ((x) >> 24) +# define B(x) (((x) >> 16) & 0xFF) +# define C(x) (((x) >> 8) & 0xFF) +# define D(x) ((x) & 0xFF) + +# define S8(x) ((x) << 8) +# define S32(x) ((x) << 32) + +#else +# define A(x) ((x) & 0xFF) +# define B(x) (((x) >> 8) & 0xFF) +# define C(x) (((x) >> 16) & 0xFF) +# define D(x) ((x) >> 24) + +# define S8(x) ((x) >> 8) +# define S32(x) ((x) >> 32) +#endif diff --git a/liblzma/check/sha256.c b/liblzma/check/sha256.c new file mode 100644 index 0000000..23bda92 --- /dev/null +++ b/liblzma/check/sha256.c @@ -0,0 +1,200 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file sha256.c +/// \brief SHA-256 +/// +/// \todo Crypto++ has x86 ASM optimizations. They use SSE so if they +/// are imported to liblzma, SSE instructions need to be used +/// conditionally to keep the code working on older boxes. +// +// This code is based on the code found from 7-Zip, which has a modified +// version of the SHA-256 found from Crypto++ . +// The code was modified a little to fit into liblzma. +// +// Authors: Kevin Springle +// Wei Dai +// Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +// Avoid bogus warnings in transform(). +#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) || __GNUC__ > 4 +# pragma GCC diagnostic ignored "-Wuninitialized" +#endif + +#include "check.h" + +// At least on x86, GCC is able to optimize this to a rotate instruction. +#define rotr_32(num, amount) ((num) >> (amount) | (num) << (32 - (amount))) + +#define blk0(i) (W[i] = data[i]) +#define blk2(i) (W[i & 15] += s1(W[(i - 2) & 15]) + W[(i - 7) & 15] \ + + s0(W[(i - 15) & 15])) + +#define Ch(x, y, z) (z ^ (x & (y ^ z))) +#define Maj(x, y, z) ((x & y) | (z & (x | y))) + +#define a(i) T[(0 - i) & 7] +#define b(i) T[(1 - i) & 7] +#define c(i) T[(2 - i) & 7] +#define d(i) T[(3 - i) & 7] +#define e(i) T[(4 - i) & 7] +#define f(i) T[(5 - i) & 7] +#define g(i) T[(6 - i) & 7] +#define h(i) T[(7 - i) & 7] + +#define R(i) \ + h(i) += S1(e(i)) + Ch(e(i), f(i), g(i)) + SHA256_K[i + j] \ + + (j ? blk2(i) : blk0(i)); \ + d(i) += h(i); \ + h(i) += S0(a(i)) + Maj(a(i), b(i), c(i)) + +#define S0(x) (rotr_32(x, 2) ^ rotr_32(x, 13) ^ rotr_32(x, 22)) +#define S1(x) (rotr_32(x, 6) ^ rotr_32(x, 11) ^ rotr_32(x, 25)) +#define s0(x) (rotr_32(x, 7) ^ rotr_32(x, 18) ^ (x >> 3)) +#define s1(x) (rotr_32(x, 17) ^ rotr_32(x, 19) ^ (x >> 10)) + + +static const uint32_t SHA256_K[64] = { + 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, + 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, + 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, + 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, + 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, + 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, + 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, + 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, + 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, + 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, + 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, + 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, + 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, + 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, + 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, + 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2, +}; + + +static void +transform(uint32_t state[static 8], const uint32_t data[static 16]) +{ + uint32_t W[16]; + uint32_t T[8]; + + // Copy state[] to working vars. + memcpy(T, state, sizeof(T)); + + // 64 operations, partially loop unrolled + for (unsigned int j = 0; j < 64; j += 16) { + R( 0); R( 1); R( 2); R( 3); + R( 4); R( 5); R( 6); R( 7); + R( 8); R( 9); R(10); R(11); + R(12); R(13); R(14); R(15); + } + + // Add the working vars back into state[]. + state[0] += a(0); + state[1] += b(0); + state[2] += c(0); + state[3] += d(0); + state[4] += e(0); + state[5] += f(0); + state[6] += g(0); + state[7] += h(0); +} + + +static void +process(lzma_check_state *check) +{ +#ifdef WORDS_BIGENDIAN + transform(check->state.sha256.state, check->buffer.u32); + +#else + uint32_t data[16]; + + for (size_t i = 0; i < 16; ++i) + data[i] = bswap32(check->buffer.u32[i]); + + transform(check->state.sha256.state, data); +#endif + + return; +} + + +extern void +lzma_sha256_init(lzma_check_state *check) +{ + static const uint32_t s[8] = { + 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, + 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19, + }; + + memcpy(check->state.sha256.state, s, sizeof(s)); + check->state.sha256.size = 0; + + return; +} + + +extern void +lzma_sha256_update(const uint8_t *buf, size_t size, lzma_check_state *check) +{ + // Copy the input data into a properly aligned temporary buffer. + // This way we can be called with arbitrarily sized buffers + // (no need to be multiple of 64 bytes), and the code works also + // on architectures that don't allow unaligned memory access. + while (size > 0) { + const size_t copy_start = check->state.sha256.size & 0x3F; + size_t copy_size = 64 - copy_start; + if (copy_size > size) + copy_size = size; + + memcpy(check->buffer.u8 + copy_start, buf, copy_size); + + buf += copy_size; + size -= copy_size; + check->state.sha256.size += copy_size; + + if ((check->state.sha256.size & 0x3F) == 0) + process(check); + } + + return; +} + + +extern void +lzma_sha256_finish(lzma_check_state *check) +{ + // Add padding as described in RFC 3174 (it describes SHA-1 but + // the same padding style is used for SHA-256 too). + size_t pos = check->state.sha256.size & 0x3F; + check->buffer.u8[pos++] = 0x80; + + while (pos != 64 - 8) { + if (pos == 64) { + process(check); + pos = 0; + } + + check->buffer.u8[pos++] = 0x00; + } + + // Convert the message size from bytes to bits. + check->state.sha256.size *= 8; + + check->buffer.u64[(64 - 8) / 8] = conv64be(check->state.sha256.size); + + process(check); + + for (size_t i = 0; i < 8; ++i) + check->buffer.u32[i] = conv32be(check->state.sha256.state[i]); + + return; +} diff --git a/liblzma/common/Makefile.inc b/liblzma/common/Makefile.inc new file mode 100644 index 0000000..f154f82 --- /dev/null +++ b/liblzma/common/Makefile.inc @@ -0,0 +1,67 @@ +## +## Author: Lasse Collin +## +## This file has been put into the public domain. +## You can do whatever you want with this file. +## + +liblzma_la_SOURCES += \ + common/common.c \ + common/common.h \ + common/block_util.c \ + common/easy_preset.c \ + common/easy_preset.h \ + common/filter_common.c \ + common/filter_common.h \ + common/hardware_physmem.c \ + common/index.c \ + common/index.h \ + common/stream_flags_common.c \ + common/stream_flags_common.h \ + common/vli_size.c + +if COND_MAIN_ENCODER +liblzma_la_SOURCES += \ + common/alone_encoder.c \ + common/block_buffer_encoder.c \ + common/block_encoder.c \ + common/block_encoder.h \ + common/block_header_encoder.c \ + common/easy_buffer_encoder.c \ + common/easy_encoder.c \ + common/easy_encoder_memusage.c \ + common/filter_buffer_encoder.c \ + common/filter_encoder.c \ + common/filter_encoder.h \ + common/filter_flags_encoder.c \ + common/index_encoder.c \ + common/index_encoder.h \ + common/stream_buffer_encoder.c \ + common/stream_encoder.c \ + common/stream_encoder.h \ + common/stream_flags_encoder.c \ + common/vli_encoder.c +endif + +if COND_MAIN_DECODER +liblzma_la_SOURCES += \ + common/alone_decoder.c \ + common/alone_decoder.h \ + common/auto_decoder.c \ + common/block_buffer_decoder.c \ + common/block_decoder.c \ + common/block_decoder.h \ + common/block_header_decoder.c \ + common/easy_decoder_memusage.c \ + common/filter_buffer_decoder.c \ + common/filter_decoder.c \ + common/filter_decoder.h \ + common/filter_flags_decoder.c \ + common/index_decoder.c \ + common/index_hash.c \ + common/stream_buffer_decoder.c \ + common/stream_decoder.c \ + common/stream_decoder.h \ + common/stream_flags_decoder.c \ + common/vli_decoder.c +endif diff --git a/liblzma/common/alone_decoder.c b/liblzma/common/alone_decoder.c new file mode 100644 index 0000000..c25112e --- /dev/null +++ b/liblzma/common/alone_decoder.c @@ -0,0 +1,238 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file alone_decoder.c +/// \brief Decoder for LZMA_Alone files +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "alone_decoder.h" +#include "lzma_decoder.h" +#include "lz_decoder.h" + + +struct lzma_coder_s { + lzma_next_coder next; + + enum { + SEQ_PROPERTIES, + SEQ_DICTIONARY_SIZE, + SEQ_UNCOMPRESSED_SIZE, + SEQ_CODER_INIT, + SEQ_CODE, + } sequence; + + /// If true, reject files that are unlikely to be .lzma files. + /// If false, more non-.lzma files get accepted and will give + /// LZMA_DATA_ERROR either immediately or after a few output bytes. + bool picky; + + /// Position in the header fields + size_t pos; + + /// Uncompressed size decoded from the header + lzma_vli uncompressed_size; + + /// Memory usage limit + uint64_t memlimit; + + /// Amount of memory actually needed (only an estimate) + uint64_t memusage; + + /// Options decoded from the header needed to initialize + /// the LZMA decoder + lzma_options_lzma options; +}; + + +static lzma_ret +alone_decode(lzma_coder *coder, + lzma_allocator *allocator lzma_attribute((__unused__)), + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size, + lzma_action action) +{ + while (*out_pos < out_size + && (coder->sequence == SEQ_CODE || *in_pos < in_size)) + switch (coder->sequence) { + case SEQ_PROPERTIES: + if (lzma_lzma_lclppb_decode(&coder->options, in[*in_pos])) + return LZMA_FORMAT_ERROR; + + coder->sequence = SEQ_DICTIONARY_SIZE; + ++*in_pos; + break; + + case SEQ_DICTIONARY_SIZE: + coder->options.dict_size + |= (size_t)(in[*in_pos]) << (coder->pos * 8); + + if (++coder->pos == 4) { + if (coder->picky && coder->options.dict_size + != UINT32_MAX) { + // A hack to ditch tons of false positives: + // We allow only dictionary sizes that are + // 2^n or 2^n + 2^(n-1). LZMA_Alone created + // only files with 2^n, but accepts any + // dictionary size. + uint32_t d = coder->options.dict_size - 1; + d |= d >> 2; + d |= d >> 3; + d |= d >> 4; + d |= d >> 8; + d |= d >> 16; + ++d; + + if (d != coder->options.dict_size) + return LZMA_FORMAT_ERROR; + } + + coder->pos = 0; + coder->sequence = SEQ_UNCOMPRESSED_SIZE; + } + + ++*in_pos; + break; + + case SEQ_UNCOMPRESSED_SIZE: + coder->uncompressed_size + |= (lzma_vli)(in[*in_pos]) << (coder->pos * 8); + ++*in_pos; + if (++coder->pos < 8) + break; + + // Another hack to ditch false positives: Assume that + // if the uncompressed size is known, it must be less + // than 256 GiB. + if (coder->picky + && coder->uncompressed_size != LZMA_VLI_UNKNOWN + && coder->uncompressed_size + >= (LZMA_VLI_C(1) << 38)) + return LZMA_FORMAT_ERROR; + + // Calculate the memory usage so that it is ready + // for SEQ_CODER_INIT. + coder->memusage = lzma_lzma_decoder_memusage(&coder->options) + + LZMA_MEMUSAGE_BASE; + + coder->pos = 0; + coder->sequence = SEQ_CODER_INIT; + + // Fall through + + case SEQ_CODER_INIT: { + if (coder->memusage > coder->memlimit) + return LZMA_MEMLIMIT_ERROR; + + lzma_filter_info filters[2] = { + { + .init = &lzma_lzma_decoder_init, + .options = &coder->options, + }, { + .init = NULL, + } + }; + + const lzma_ret ret = lzma_next_filter_init(&coder->next, + allocator, filters); + if (ret != LZMA_OK) + return ret; + + // Use a hack to set the uncompressed size. + lzma_lz_decoder_uncompressed(coder->next.coder, + coder->uncompressed_size); + + coder->sequence = SEQ_CODE; + break; + } + + case SEQ_CODE: { + return coder->next.code(coder->next.coder, + allocator, in, in_pos, in_size, + out, out_pos, out_size, action); + } + + default: + return LZMA_PROG_ERROR; + } + + return LZMA_OK; +} + + +static void +alone_decoder_end(lzma_coder *coder, lzma_allocator *allocator) +{ + lzma_next_end(&coder->next, allocator); + lzma_free(coder, allocator); + return; +} + + +static lzma_ret +alone_decoder_memconfig(lzma_coder *coder, uint64_t *memusage, + uint64_t *old_memlimit, uint64_t new_memlimit) +{ + *memusage = coder->memusage; + *old_memlimit = coder->memlimit; + + if (new_memlimit != 0) { + if (new_memlimit < coder->memusage) + return LZMA_MEMLIMIT_ERROR; + + coder->memlimit = new_memlimit; + } + + return LZMA_OK; +} + + +extern lzma_ret +lzma_alone_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, + uint64_t memlimit, bool picky) +{ + lzma_next_coder_init(&lzma_alone_decoder_init, next, allocator); + + if (memlimit == 0) + return LZMA_PROG_ERROR; + + if (next->coder == NULL) { + next->coder = lzma_alloc(sizeof(lzma_coder), allocator); + if (next->coder == NULL) + return LZMA_MEM_ERROR; + + next->code = &alone_decode; + next->end = &alone_decoder_end; + next->memconfig = &alone_decoder_memconfig; + next->coder->next = LZMA_NEXT_CODER_INIT; + } + + next->coder->sequence = SEQ_PROPERTIES; + next->coder->picky = picky; + next->coder->pos = 0; + next->coder->options.dict_size = 0; + next->coder->options.preset_dict = NULL; + next->coder->options.preset_dict_size = 0; + next->coder->uncompressed_size = 0; + next->coder->memlimit = memlimit; + next->coder->memusage = LZMA_MEMUSAGE_BASE; + + return LZMA_OK; +} + + +extern LZMA_API(lzma_ret) +lzma_alone_decoder(lzma_stream *strm, uint64_t memlimit) +{ + lzma_next_strm_init(lzma_alone_decoder_init, strm, memlimit, false); + + strm->internal->supported_actions[LZMA_RUN] = true; + strm->internal->supported_actions[LZMA_FINISH] = true; + + return LZMA_OK; +} diff --git a/liblzma/common/alone_decoder.h b/liblzma/common/alone_decoder.h new file mode 100644 index 0000000..f666fc3 --- /dev/null +++ b/liblzma/common/alone_decoder.h @@ -0,0 +1,23 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file alone_decoder.h +/// \brief Decoder for LZMA_Alone files +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_ALONE_DECODER_H +#define LZMA_ALONE_DECODER_H + +#include "common.h" + + +extern lzma_ret lzma_alone_decoder_init( + lzma_next_coder *next, lzma_allocator *allocator, + uint64_t memlimit, bool picky); + +#endif diff --git a/liblzma/common/alone_encoder.c b/liblzma/common/alone_encoder.c new file mode 100644 index 0000000..eb1697e --- /dev/null +++ b/liblzma/common/alone_encoder.c @@ -0,0 +1,157 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file alone_decoder.c +/// \brief Decoder for LZMA_Alone files +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "common.h" +#include "lzma_encoder.h" + + +#define ALONE_HEADER_SIZE (1 + 4 + 8) + + +struct lzma_coder_s { + lzma_next_coder next; + + enum { + SEQ_HEADER, + SEQ_CODE, + } sequence; + + size_t header_pos; + uint8_t header[ALONE_HEADER_SIZE]; +}; + + +static lzma_ret +alone_encode(lzma_coder *coder, + lzma_allocator *allocator lzma_attribute((__unused__)), + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size, + lzma_action action) +{ + while (*out_pos < out_size) + switch (coder->sequence) { + case SEQ_HEADER: + lzma_bufcpy(coder->header, &coder->header_pos, + ALONE_HEADER_SIZE, + out, out_pos, out_size); + if (coder->header_pos < ALONE_HEADER_SIZE) + return LZMA_OK; + + coder->sequence = SEQ_CODE; + break; + + case SEQ_CODE: + return coder->next.code(coder->next.coder, + allocator, in, in_pos, in_size, + out, out_pos, out_size, action); + + default: + assert(0); + return LZMA_PROG_ERROR; + } + + return LZMA_OK; +} + + +static void +alone_encoder_end(lzma_coder *coder, lzma_allocator *allocator) +{ + lzma_next_end(&coder->next, allocator); + lzma_free(coder, allocator); + return; +} + + +// At least for now, this is not used by any internal function. +static lzma_ret +alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_options_lzma *options) +{ + lzma_next_coder_init(&alone_encoder_init, next, allocator); + + if (next->coder == NULL) { + next->coder = lzma_alloc(sizeof(lzma_coder), allocator); + if (next->coder == NULL) + return LZMA_MEM_ERROR; + + next->code = &alone_encode; + next->end = &alone_encoder_end; + next->coder->next = LZMA_NEXT_CODER_INIT; + } + + // Basic initializations + next->coder->sequence = SEQ_HEADER; + next->coder->header_pos = 0; + + // Encode the header: + // - Properties (1 byte) + if (lzma_lzma_lclppb_encode(options, next->coder->header)) + return LZMA_OPTIONS_ERROR; + + // - Dictionary size (4 bytes) + if (options->dict_size < LZMA_DICT_SIZE_MIN) + return LZMA_OPTIONS_ERROR; + + // Round up to the next 2^n or 2^n + 2^(n - 1) depending on which + // one is the next unless it is UINT32_MAX. While the header would + // allow any 32-bit integer, we do this to keep the decoder of liblzma + // accepting the resulting files. + uint32_t d = options->dict_size - 1; + d |= d >> 2; + d |= d >> 3; + d |= d >> 4; + d |= d >> 8; + d |= d >> 16; + if (d != UINT32_MAX) + ++d; + + unaligned_write32le(next->coder->header + 1, d); + + // - Uncompressed size (always unknown and using EOPM) + memset(next->coder->header + 1 + 4, 0xFF, 8); + + // Initialize the LZMA encoder. + const lzma_filter_info filters[2] = { + { + .init = &lzma_lzma_encoder_init, + .options = (void *)(options), + }, { + .init = NULL, + } + }; + + return lzma_next_filter_init(&next->coder->next, allocator, filters); +} + + +/* +extern lzma_ret +lzma_alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_options_alone *options) +{ + lzma_next_coder_init(&alone_encoder_init, next, allocator, options); +} +*/ + + +extern LZMA_API(lzma_ret) +lzma_alone_encoder(lzma_stream *strm, const lzma_options_lzma *options) +{ + lzma_next_strm_init(alone_encoder_init, strm, options); + + strm->internal->supported_actions[LZMA_RUN] = true; + strm->internal->supported_actions[LZMA_FINISH] = true; + + return LZMA_OK; +} diff --git a/liblzma/common/auto_decoder.c b/liblzma/common/auto_decoder.c new file mode 100644 index 0000000..35c895f --- /dev/null +++ b/liblzma/common/auto_decoder.c @@ -0,0 +1,186 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file auto_decoder.c +/// \brief Autodetect between .xz Stream and .lzma (LZMA_Alone) formats +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "stream_decoder.h" +#include "alone_decoder.h" + + +struct lzma_coder_s { + /// Stream decoder or LZMA_Alone decoder + lzma_next_coder next; + + uint64_t memlimit; + uint32_t flags; + + enum { + SEQ_INIT, + SEQ_CODE, + SEQ_FINISH, + } sequence; +}; + + +static lzma_ret +auto_decode(lzma_coder *coder, lzma_allocator *allocator, + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size, lzma_action action) +{ + switch (coder->sequence) { + case SEQ_INIT: + if (*in_pos >= in_size) + return LZMA_OK; + + // Update the sequence now, because we want to continue from + // SEQ_CODE even if we return some LZMA_*_CHECK. + coder->sequence = SEQ_CODE; + + // Detect the file format. For now this is simple, since if + // it doesn't start with 0xFD (the first magic byte of the + // new format), it has to be LZMA_Alone, or something that + // we don't support at all. + if (in[*in_pos] == 0xFD) { + return_if_error(lzma_stream_decoder_init( + &coder->next, allocator, + coder->memlimit, coder->flags)); + } else { + return_if_error(lzma_alone_decoder_init(&coder->next, + allocator, coder->memlimit, true)); + + // If the application wants to know about missing + // integrity check or about the check in general, we + // need to handle it here, because LZMA_Alone decoder + // doesn't accept any flags. + if (coder->flags & LZMA_TELL_NO_CHECK) + return LZMA_NO_CHECK; + + if (coder->flags & LZMA_TELL_ANY_CHECK) + return LZMA_GET_CHECK; + } + + // Fall through + + case SEQ_CODE: { + const lzma_ret ret = coder->next.code( + coder->next.coder, allocator, + in, in_pos, in_size, + out, out_pos, out_size, action); + if (ret != LZMA_STREAM_END + || (coder->flags & LZMA_CONCATENATED) == 0) + return ret; + + coder->sequence = SEQ_FINISH; + } + + // Fall through + + case SEQ_FINISH: + // When LZMA_DECODE_CONCATENATED was used and we were decoding + // LZMA_Alone file, we need to check check that there is no + // trailing garbage and wait for LZMA_FINISH. + if (*in_pos < in_size) + return LZMA_DATA_ERROR; + + return action == LZMA_FINISH ? LZMA_STREAM_END : LZMA_OK; + + default: + assert(0); + return LZMA_PROG_ERROR; + } +} + + +static void +auto_decoder_end(lzma_coder *coder, lzma_allocator *allocator) +{ + lzma_next_end(&coder->next, allocator); + lzma_free(coder, allocator); + return; +} + + +static lzma_check +auto_decoder_get_check(const lzma_coder *coder) +{ + // It is LZMA_Alone if get_check is NULL. + return coder->next.get_check == NULL ? LZMA_CHECK_NONE + : coder->next.get_check(coder->next.coder); +} + + +static lzma_ret +auto_decoder_memconfig(lzma_coder *coder, uint64_t *memusage, + uint64_t *old_memlimit, uint64_t new_memlimit) +{ + lzma_ret ret; + + if (coder->next.memconfig != NULL) { + ret = coder->next.memconfig(coder->next.coder, + memusage, old_memlimit, new_memlimit); + assert(*old_memlimit == coder->memlimit); + } else { + // No coder is configured yet. Use the base value as + // the current memory usage. + *memusage = LZMA_MEMUSAGE_BASE; + *old_memlimit = coder->memlimit; + ret = LZMA_OK; + } + + if (ret == LZMA_OK && new_memlimit != 0) + coder->memlimit = new_memlimit; + + return ret; +} + + +static lzma_ret +auto_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, + uint64_t memlimit, uint32_t flags) +{ + lzma_next_coder_init(&auto_decoder_init, next, allocator); + + if (memlimit == 0) + return LZMA_PROG_ERROR; + + if (flags & ~LZMA_SUPPORTED_FLAGS) + return LZMA_OPTIONS_ERROR; + + if (next->coder == NULL) { + next->coder = lzma_alloc(sizeof(lzma_coder), allocator); + if (next->coder == NULL) + return LZMA_MEM_ERROR; + + next->code = &auto_decode; + next->end = &auto_decoder_end; + next->get_check = &auto_decoder_get_check; + next->memconfig = &auto_decoder_memconfig; + next->coder->next = LZMA_NEXT_CODER_INIT; + } + + next->coder->memlimit = memlimit; + next->coder->flags = flags; + next->coder->sequence = SEQ_INIT; + + return LZMA_OK; +} + + +extern LZMA_API(lzma_ret) +lzma_auto_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags) +{ + lzma_next_strm_init(auto_decoder_init, strm, memlimit, flags); + + strm->internal->supported_actions[LZMA_RUN] = true; + strm->internal->supported_actions[LZMA_FINISH] = true; + + return LZMA_OK; +} diff --git a/liblzma/common/block_buffer_decoder.c b/liblzma/common/block_buffer_decoder.c new file mode 100644 index 0000000..ff27a11 --- /dev/null +++ b/liblzma/common/block_buffer_decoder.c @@ -0,0 +1,80 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file block_buffer_decoder.c +/// \brief Single-call .xz Block decoder +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "block_decoder.h" + + +extern LZMA_API(lzma_ret) +lzma_block_buffer_decode(lzma_block *block, lzma_allocator *allocator, + const uint8_t *in, size_t *in_pos, size_t in_size, + uint8_t *out, size_t *out_pos, size_t out_size) +{ + if (in_pos == NULL || (in == NULL && *in_pos != in_size) + || *in_pos > in_size || out_pos == NULL + || (out == NULL && *out_pos != out_size) + || *out_pos > out_size) + return LZMA_PROG_ERROR; + + // Initialize the Block decoder. + lzma_next_coder block_decoder = LZMA_NEXT_CODER_INIT; + lzma_ret ret = lzma_block_decoder_init( + &block_decoder, allocator, block); + + if (ret == LZMA_OK) { + // Save the positions so that we can restore them in case + // an error occurs. + const size_t in_start = *in_pos; + const size_t out_start = *out_pos; + + // Do the actual decoding. + ret = block_decoder.code(block_decoder.coder, allocator, + in, in_pos, in_size, out, out_pos, out_size, + LZMA_FINISH); + + if (ret == LZMA_STREAM_END) { + ret = LZMA_OK; + } else { + if (ret == LZMA_OK) { + // Either the input was truncated or the + // output buffer was too small. + assert(*in_pos == in_size + || *out_pos == out_size); + + // If all the input was consumed, then the + // input is truncated, even if the output + // buffer is also full. This is because + // processing the last byte of the Block + // never produces output. + // + // NOTE: This assumption may break when new + // filters are added, if the end marker of + // the filter doesn't consume at least one + // complete byte. + if (*in_pos == in_size) + ret = LZMA_DATA_ERROR; + else + ret = LZMA_BUF_ERROR; + } + + // Restore the positions. + *in_pos = in_start; + *out_pos = out_start; + } + } + + // Free the decoder memory. This needs to be done even if + // initialization fails, because the internal API doesn't + // require the initialization function to free its memory on error. + lzma_next_end(&block_decoder, allocator); + + return ret; +} diff --git a/liblzma/common/block_buffer_encoder.c b/liblzma/common/block_buffer_encoder.c new file mode 100644 index 0000000..519c6a6 --- /dev/null +++ b/liblzma/common/block_buffer_encoder.c @@ -0,0 +1,305 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file block_buffer_encoder.c +/// \brief Single-call .xz Block encoder +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "block_encoder.h" +#include "filter_encoder.h" +#include "lzma2_encoder.h" +#include "check.h" + + +/// Estimate the maximum size of the Block Header and Check fields for +/// a Block that uses LZMA2 uncompressed chunks. We could use +/// lzma_block_header_size() but this is simpler. +/// +/// Block Header Size + Block Flags + Compressed Size +/// + Uncompressed Size + Filter Flags for LZMA2 + CRC32 + Check +/// and round up to the next multiple of four to take Header Padding +/// into account. +#define HEADERS_BOUND ((1 + 1 + 2 * LZMA_VLI_BYTES_MAX + 3 + 4 \ + + LZMA_CHECK_SIZE_MAX + 3) & ~3) + + +static lzma_vli +lzma2_bound(lzma_vli uncompressed_size) +{ + // Prevent integer overflow in overhead calculation. + if (uncompressed_size > COMPRESSED_SIZE_MAX) + return 0; + + // Calculate the exact overhead of the LZMA2 headers: Round + // uncompressed_size up to the next multiple of LZMA2_CHUNK_MAX, + // multiply by the size of per-chunk header, and add one byte for + // the end marker. + const lzma_vli overhead = ((uncompressed_size + LZMA2_CHUNK_MAX - 1) + / LZMA2_CHUNK_MAX) + * LZMA2_HEADER_UNCOMPRESSED + 1; + + // Catch the possible integer overflow. + if (COMPRESSED_SIZE_MAX - overhead < uncompressed_size) + return 0; + + return uncompressed_size + overhead; +} + + +extern LZMA_API(size_t) +lzma_block_buffer_bound(size_t uncompressed_size) +{ + // For now, if the data doesn't compress, we always use uncompressed + // chunks of LZMA2. In future we may use Subblock filter too, but + // but for simplicity we probably will still use the same bound + // calculation even though Subblock filter would have slightly less + // overhead. + lzma_vli lzma2_size = lzma2_bound(uncompressed_size); + if (lzma2_size == 0) + return 0; + + // Take Block Padding into account. + lzma2_size = (lzma2_size + 3) & ~LZMA_VLI_C(3); + +#if SIZE_MAX < LZMA_VLI_MAX + // Catch the possible integer overflow on 32-bit systems. There's no + // overflow on 64-bit systems, because lzma2_bound() already takes + // into account the size of the headers in the Block. + if (SIZE_MAX - HEADERS_BOUND < lzma2_size) + return 0; +#endif + + return HEADERS_BOUND + lzma2_size; +} + + +static lzma_ret +block_encode_uncompressed(lzma_block *block, const uint8_t *in, size_t in_size, + uint8_t *out, size_t *out_pos, size_t out_size) +{ + // TODO: Figure out if the last filter is LZMA2 or Subblock and use + // that filter to encode the uncompressed chunks. + + // Use LZMA2 uncompressed chunks. We wouldn't need a dictionary at + // all, but LZMA2 always requires a dictionary, so use the minimum + // value to minimize memory usage of the decoder. + lzma_options_lzma lzma2 = { + .dict_size = LZMA_DICT_SIZE_MIN, + }; + + lzma_filter filters[2]; + filters[0].id = LZMA_FILTER_LZMA2; + filters[0].options = &lzma2; + filters[1].id = LZMA_VLI_UNKNOWN; + + // Set the above filter options to *block temporarily so that we can + // encode the Block Header. + lzma_filter *filters_orig = block->filters; + block->filters = filters; + + if (lzma_block_header_size(block) != LZMA_OK) { + block->filters = filters_orig; + return LZMA_PROG_ERROR; + } + + // Check that there's enough output space. The caller has already + // set block->compressed_size to what lzma2_bound() has returned, + // so we can reuse that value. We know that compressed_size is a + // known valid VLI and header_size is a small value so their sum + // will never overflow. + assert(block->compressed_size == lzma2_bound(in_size)); + if (out_size - *out_pos + < block->header_size + block->compressed_size) { + block->filters = filters_orig; + return LZMA_BUF_ERROR; + } + + if (lzma_block_header_encode(block, out + *out_pos) != LZMA_OK) { + block->filters = filters_orig; + return LZMA_PROG_ERROR; + } + + block->filters = filters_orig; + *out_pos += block->header_size; + + // Encode the data using LZMA2 uncompressed chunks. + size_t in_pos = 0; + uint8_t control = 0x01; // Dictionary reset + + while (in_pos < in_size) { + // Control byte: Indicate uncompressed chunk, of which + // the first resets the dictionary. + out[(*out_pos)++] = control; + control = 0x02; // No dictionary reset + + // Size of the uncompressed chunk + const size_t copy_size + = my_min(in_size - in_pos, LZMA2_CHUNK_MAX); + out[(*out_pos)++] = (copy_size - 1) >> 8; + out[(*out_pos)++] = (copy_size - 1) & 0xFF; + + // The actual data + assert(*out_pos + copy_size <= out_size); + memcpy(out + *out_pos, in + in_pos, copy_size); + + in_pos += copy_size; + *out_pos += copy_size; + } + + // End marker + out[(*out_pos)++] = 0x00; + assert(*out_pos <= out_size); + + return LZMA_OK; +} + + +static lzma_ret +block_encode_normal(lzma_block *block, lzma_allocator *allocator, + const uint8_t *in, size_t in_size, + uint8_t *out, size_t *out_pos, size_t out_size) +{ + // Find out the size of the Block Header. + block->compressed_size = lzma2_bound(in_size); + if (block->compressed_size == 0) + return LZMA_DATA_ERROR; + + block->uncompressed_size = in_size; + return_if_error(lzma_block_header_size(block)); + + // Reserve space for the Block Header and skip it for now. + if (out_size - *out_pos <= block->header_size) + return LZMA_BUF_ERROR; + + const size_t out_start = *out_pos; + *out_pos += block->header_size; + + // Limit out_size so that we stop encoding if the output would grow + // bigger than what uncompressed Block would be. + if (out_size - *out_pos > block->compressed_size) + out_size = *out_pos + block->compressed_size; + + // TODO: In many common cases this could be optimized to use + // significantly less memory. + lzma_next_coder raw_encoder = LZMA_NEXT_CODER_INIT; + lzma_ret ret = lzma_raw_encoder_init( + &raw_encoder, allocator, block->filters); + + if (ret == LZMA_OK) { + size_t in_pos = 0; + ret = raw_encoder.code(raw_encoder.coder, allocator, + in, &in_pos, in_size, out, out_pos, out_size, + LZMA_FINISH); + } + + // NOTE: This needs to be run even if lzma_raw_encoder_init() failed. + lzma_next_end(&raw_encoder, allocator); + + if (ret == LZMA_STREAM_END) { + // Compression was successful. Write the Block Header. + block->compressed_size + = *out_pos - (out_start + block->header_size); + ret = lzma_block_header_encode(block, out + out_start); + if (ret != LZMA_OK) + ret = LZMA_PROG_ERROR; + + } else if (ret == LZMA_OK) { + // Output buffer became full. + ret = LZMA_BUF_ERROR; + } + + // Reset *out_pos if something went wrong. + if (ret != LZMA_OK) + *out_pos = out_start; + + return ret; +} + + +extern LZMA_API(lzma_ret) +lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator, + const uint8_t *in, size_t in_size, + uint8_t *out, size_t *out_pos, size_t out_size) +{ + // Validate the arguments. + if (block == NULL || (in == NULL && in_size != 0) || out == NULL + || out_pos == NULL || *out_pos > out_size) + return LZMA_PROG_ERROR; + + // The contents of the structure may depend on the version so + // check the version before validating the contents of *block. + if (block->version != 0) + return LZMA_OPTIONS_ERROR; + + if ((unsigned int)(block->check) > LZMA_CHECK_ID_MAX + || block->filters == NULL) + return LZMA_PROG_ERROR; + + if (!lzma_check_is_supported(block->check)) + return LZMA_UNSUPPORTED_CHECK; + + // Size of a Block has to be a multiple of four, so limit the size + // here already. This way we don't need to check it again when adding + // Block Padding. + out_size -= (out_size - *out_pos) & 3; + + // Get the size of the Check field. + const size_t check_size = lzma_check_size(block->check); + assert(check_size != UINT32_MAX); + + // Reserve space for the Check field. + if (out_size - *out_pos <= check_size) + return LZMA_BUF_ERROR; + + out_size -= check_size; + + // Do the actual compression. + const lzma_ret ret = block_encode_normal(block, allocator, + in, in_size, out, out_pos, out_size); + if (ret != LZMA_OK) { + // If the error was something else than output buffer + // becoming full, return the error now. + if (ret != LZMA_BUF_ERROR) + return ret; + + // The data was uncompressible (at least with the options + // given to us) or the output buffer was too small. Use the + // uncompressed chunks of LZMA2 to wrap the data into a valid + // Block. If we haven't been given enough output space, even + // this may fail. + return_if_error(block_encode_uncompressed(block, in, in_size, + out, out_pos, out_size)); + } + + assert(*out_pos <= out_size); + + // Block Padding. No buffer overflow here, because we already adjusted + // out_size so that (out_size - out_start) is a multiple of four. + // Thus, if the buffer is full, the loop body can never run. + for (size_t i = (size_t)(block->compressed_size); i & 3; ++i) { + assert(*out_pos < out_size); + out[(*out_pos)++] = 0x00; + } + + // If there's no Check field, we are done now. + if (check_size > 0) { + // Calculate the integrity check. We reserved space for + // the Check field earlier so we don't need to check for + // available output space here. + lzma_check_state check; + lzma_check_init(&check, block->check); + lzma_check_update(&check, block->check, in, in_size); + lzma_check_finish(&check, block->check); + + memcpy(block->raw_check, check.buffer.u8, check_size); + memcpy(out + *out_pos, check.buffer.u8, check_size); + *out_pos += check_size; + } + + return LZMA_OK; +} diff --git a/liblzma/common/block_decoder.c b/liblzma/common/block_decoder.c new file mode 100644 index 0000000..a3ce6f4 --- /dev/null +++ b/liblzma/common/block_decoder.c @@ -0,0 +1,242 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file block_decoder.c +/// \brief Decodes .xz Blocks +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "block_decoder.h" +#include "filter_decoder.h" +#include "check.h" + + +struct lzma_coder_s { + enum { + SEQ_CODE, + SEQ_PADDING, + SEQ_CHECK, + } sequence; + + /// The filters in the chain; initialized with lzma_raw_decoder_init(). + lzma_next_coder next; + + /// Decoding options; we also write Compressed Size and Uncompressed + /// Size back to this structure when the decoding has been finished. + lzma_block *block; + + /// Compressed Size calculated while decoding + lzma_vli compressed_size; + + /// Uncompressed Size calculated while decoding + lzma_vli uncompressed_size; + + /// Maximum allowed Compressed Size; this takes into account the + /// size of the Block Header and Check fields when Compressed Size + /// is unknown. + lzma_vli compressed_limit; + + /// Position when reading the Check field + size_t check_pos; + + /// Check of the uncompressed data + lzma_check_state check; +}; + + +static inline bool +update_size(lzma_vli *size, lzma_vli add, lzma_vli limit) +{ + if (limit > LZMA_VLI_MAX) + limit = LZMA_VLI_MAX; + + if (limit < *size || limit - *size < add) + return true; + + *size += add; + + return false; +} + + +static inline bool +is_size_valid(lzma_vli size, lzma_vli reference) +{ + return reference == LZMA_VLI_UNKNOWN || reference == size; +} + + +static lzma_ret +block_decode(lzma_coder *coder, lzma_allocator *allocator, + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size, lzma_action action) +{ + switch (coder->sequence) { + case SEQ_CODE: { + const size_t in_start = *in_pos; + const size_t out_start = *out_pos; + + const lzma_ret ret = coder->next.code(coder->next.coder, + allocator, in, in_pos, in_size, + out, out_pos, out_size, action); + + const size_t in_used = *in_pos - in_start; + const size_t out_used = *out_pos - out_start; + + // NOTE: We compare to compressed_limit here, which prevents + // the total size of the Block growing past LZMA_VLI_MAX. + if (update_size(&coder->compressed_size, in_used, + coder->compressed_limit) + || update_size(&coder->uncompressed_size, + out_used, + coder->block->uncompressed_size)) + return LZMA_DATA_ERROR; + + lzma_check_update(&coder->check, coder->block->check, + out + out_start, out_used); + + if (ret != LZMA_STREAM_END) + return ret; + + // Compressed and Uncompressed Sizes are now at their final + // values. Verify that they match the values given to us. + if (!is_size_valid(coder->compressed_size, + coder->block->compressed_size) + || !is_size_valid(coder->uncompressed_size, + coder->block->uncompressed_size)) + return LZMA_DATA_ERROR; + + // Copy the values into coder->block. The caller + // may use this information to construct Index. + coder->block->compressed_size = coder->compressed_size; + coder->block->uncompressed_size = coder->uncompressed_size; + + coder->sequence = SEQ_PADDING; + } + + // Fall through + + case SEQ_PADDING: + // Compressed Data is padded to a multiple of four bytes. + while (coder->compressed_size & 3) { + if (*in_pos >= in_size) + return LZMA_OK; + + // We use compressed_size here just get the Padding + // right. The actual Compressed Size was stored to + // coder->block already, and won't be modified by + // us anymore. + ++coder->compressed_size; + + if (in[(*in_pos)++] != 0x00) + return LZMA_DATA_ERROR; + } + + if (coder->block->check == LZMA_CHECK_NONE) + return LZMA_STREAM_END; + + lzma_check_finish(&coder->check, coder->block->check); + coder->sequence = SEQ_CHECK; + + // Fall through + + case SEQ_CHECK: { + const size_t check_size = lzma_check_size(coder->block->check); + lzma_bufcpy(in, in_pos, in_size, coder->block->raw_check, + &coder->check_pos, check_size); + if (coder->check_pos < check_size) + return LZMA_OK; + + // Validate the Check only if we support it. + // coder->check.buffer may be uninitialized + // when the Check ID is not supported. + if (lzma_check_is_supported(coder->block->check) + && memcmp(coder->block->raw_check, + coder->check.buffer.u8, + check_size) != 0) + return LZMA_DATA_ERROR; + + return LZMA_STREAM_END; + } + } + + return LZMA_PROG_ERROR; +} + + +static void +block_decoder_end(lzma_coder *coder, lzma_allocator *allocator) +{ + lzma_next_end(&coder->next, allocator); + lzma_free(coder, allocator); + return; +} + + +extern lzma_ret +lzma_block_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, + lzma_block *block) +{ + lzma_next_coder_init(&lzma_block_decoder_init, next, allocator); + + // Validate the options. lzma_block_unpadded_size() does that for us + // except for Uncompressed Size and filters. Filters are validated + // by the raw decoder. + if (lzma_block_unpadded_size(block) == 0 + || !lzma_vli_is_valid(block->uncompressed_size)) + return LZMA_PROG_ERROR; + + // Allocate and initialize *next->coder if needed. + if (next->coder == NULL) { + next->coder = lzma_alloc(sizeof(lzma_coder), allocator); + if (next->coder == NULL) + return LZMA_MEM_ERROR; + + next->code = &block_decode; + next->end = &block_decoder_end; + next->coder->next = LZMA_NEXT_CODER_INIT; + } + + // Basic initializations + next->coder->sequence = SEQ_CODE; + next->coder->block = block; + next->coder->compressed_size = 0; + next->coder->uncompressed_size = 0; + + // If Compressed Size is not known, we calculate the maximum allowed + // value so that encoded size of the Block (including Block Padding) + // is still a valid VLI and a multiple of four. + next->coder->compressed_limit + = block->compressed_size == LZMA_VLI_UNKNOWN + ? (LZMA_VLI_MAX & ~LZMA_VLI_C(3)) + - block->header_size + - lzma_check_size(block->check) + : block->compressed_size; + + // Initialize the check. It's caller's problem if the Check ID is not + // supported, and the Block decoder cannot verify the Check field. + // Caller can test lzma_check_is_supported(block->check). + next->coder->check_pos = 0; + lzma_check_init(&next->coder->check, block->check); + + // Initialize the filter chain. + return lzma_raw_decoder_init(&next->coder->next, allocator, + block->filters); +} + + +extern LZMA_API(lzma_ret) +lzma_block_decoder(lzma_stream *strm, lzma_block *block) +{ + lzma_next_strm_init(lzma_block_decoder_init, strm, block); + + strm->internal->supported_actions[LZMA_RUN] = true; + strm->internal->supported_actions[LZMA_FINISH] = true; + + return LZMA_OK; +} diff --git a/liblzma/common/block_decoder.h b/liblzma/common/block_decoder.h new file mode 100644 index 0000000..7da9df6 --- /dev/null +++ b/liblzma/common/block_decoder.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file block_decoder.h +/// \brief Decodes .xz Blocks +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_BLOCK_DECODER_H +#define LZMA_BLOCK_DECODER_H + +#include "common.h" + + +extern lzma_ret lzma_block_decoder_init(lzma_next_coder *next, + lzma_allocator *allocator, lzma_block *block); + +#endif diff --git a/liblzma/common/block_encoder.c b/liblzma/common/block_encoder.c new file mode 100644 index 0000000..1eeb502 --- /dev/null +++ b/liblzma/common/block_encoder.c @@ -0,0 +1,217 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file block_encoder.c +/// \brief Encodes .xz Blocks +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "block_encoder.h" +#include "filter_encoder.h" +#include "check.h" + + +struct lzma_coder_s { + /// The filters in the chain; initialized with lzma_raw_decoder_init(). + lzma_next_coder next; + + /// Encoding options; we also write Unpadded Size, Compressed Size, + /// and Uncompressed Size back to this structure when the encoding + /// has been finished. + lzma_block *block; + + enum { + SEQ_CODE, + SEQ_PADDING, + SEQ_CHECK, + } sequence; + + /// Compressed Size calculated while encoding + lzma_vli compressed_size; + + /// Uncompressed Size calculated while encoding + lzma_vli uncompressed_size; + + /// Position in the Check field + size_t pos; + + /// Check of the uncompressed data + lzma_check_state check; +}; + + +static lzma_ret +block_encode(lzma_coder *coder, lzma_allocator *allocator, + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size, lzma_action action) +{ + // Check that our amount of input stays in proper limits. + if (LZMA_VLI_MAX - coder->uncompressed_size < in_size - *in_pos) + return LZMA_DATA_ERROR; + + switch (coder->sequence) { + case SEQ_CODE: { + const size_t in_start = *in_pos; + const size_t out_start = *out_pos; + + const lzma_ret ret = coder->next.code(coder->next.coder, + allocator, in, in_pos, in_size, + out, out_pos, out_size, action); + + const size_t in_used = *in_pos - in_start; + const size_t out_used = *out_pos - out_start; + + if (COMPRESSED_SIZE_MAX - coder->compressed_size < out_used) + return LZMA_DATA_ERROR; + + coder->compressed_size += out_used; + + // No need to check for overflow because we have already + // checked it at the beginning of this function. + coder->uncompressed_size += in_used; + + lzma_check_update(&coder->check, coder->block->check, + in + in_start, in_used); + + if (ret != LZMA_STREAM_END || action == LZMA_SYNC_FLUSH) + return ret; + + assert(*in_pos == in_size); + assert(action == LZMA_FINISH); + + // Copy the values into coder->block. The caller + // may use this information to construct Index. + coder->block->compressed_size = coder->compressed_size; + coder->block->uncompressed_size = coder->uncompressed_size; + + coder->sequence = SEQ_PADDING; + } + + // Fall through + + case SEQ_PADDING: + // Pad Compressed Data to a multiple of four bytes. We can + // use coder->compressed_size for this since we don't need + // it for anything else anymore. + while (coder->compressed_size & 3) { + if (*out_pos >= out_size) + return LZMA_OK; + + out[*out_pos] = 0x00; + ++*out_pos; + ++coder->compressed_size; + } + + if (coder->block->check == LZMA_CHECK_NONE) + return LZMA_STREAM_END; + + lzma_check_finish(&coder->check, coder->block->check); + + coder->sequence = SEQ_CHECK; + + // Fall through + + case SEQ_CHECK: { + const size_t check_size = lzma_check_size(coder->block->check); + lzma_bufcpy(coder->check.buffer.u8, &coder->pos, check_size, + out, out_pos, out_size); + if (coder->pos < check_size) + return LZMA_OK; + + memcpy(coder->block->raw_check, coder->check.buffer.u8, + check_size); + return LZMA_STREAM_END; + } + } + + return LZMA_PROG_ERROR; +} + + +static void +block_encoder_end(lzma_coder *coder, lzma_allocator *allocator) +{ + lzma_next_end(&coder->next, allocator); + lzma_free(coder, allocator); + return; +} + + +static lzma_ret +block_encoder_update(lzma_coder *coder, lzma_allocator *allocator, + const lzma_filter *filters lzma_attribute((__unused__)), + const lzma_filter *reversed_filters) +{ + if (coder->sequence != SEQ_CODE) + return LZMA_PROG_ERROR; + + return lzma_next_filter_update( + &coder->next, allocator, reversed_filters); +} + + +extern lzma_ret +lzma_block_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, + lzma_block *block) +{ + lzma_next_coder_init(&lzma_block_encoder_init, next, allocator); + + if (block == NULL) + return LZMA_PROG_ERROR; + + // The contents of the structure may depend on the version so + // check the version first. + if (block->version != 0) + return LZMA_OPTIONS_ERROR; + + // If the Check ID is not supported, we cannot calculate the check and + // thus not create a proper Block. + if ((unsigned int)(block->check) > LZMA_CHECK_ID_MAX) + return LZMA_PROG_ERROR; + + if (!lzma_check_is_supported(block->check)) + return LZMA_UNSUPPORTED_CHECK; + + // Allocate and initialize *next->coder if needed. + if (next->coder == NULL) { + next->coder = lzma_alloc(sizeof(lzma_coder), allocator); + if (next->coder == NULL) + return LZMA_MEM_ERROR; + + next->code = &block_encode; + next->end = &block_encoder_end; + next->update = &block_encoder_update; + next->coder->next = LZMA_NEXT_CODER_INIT; + } + + // Basic initializations + next->coder->sequence = SEQ_CODE; + next->coder->block = block; + next->coder->compressed_size = 0; + next->coder->uncompressed_size = 0; + next->coder->pos = 0; + + // Initialize the check + lzma_check_init(&next->coder->check, block->check); + + // Initialize the requested filters. + return lzma_raw_encoder_init(&next->coder->next, allocator, + block->filters); +} + + +extern LZMA_API(lzma_ret) +lzma_block_encoder(lzma_stream *strm, lzma_block *block) +{ + lzma_next_strm_init(lzma_block_encoder_init, strm, block); + + strm->internal->supported_actions[LZMA_RUN] = true; + strm->internal->supported_actions[LZMA_FINISH] = true; + + return LZMA_OK; +} diff --git a/liblzma/common/block_encoder.h b/liblzma/common/block_encoder.h new file mode 100644 index 0000000..b9eff0b --- /dev/null +++ b/liblzma/common/block_encoder.h @@ -0,0 +1,47 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file block_encoder.h +/// \brief Encodes .xz Blocks +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_BLOCK_ENCODER_H +#define LZMA_BLOCK_ENCODER_H + +#include "common.h" + + +/// \brief Biggest Compressed Size value that the Block encoder supports +/// +/// The maximum size of a single Block is limited by the maximum size of +/// a Stream, which in theory is 2^63 - 3 bytes (i.e. LZMA_VLI_MAX - 3). +/// While the size is really big and no one should hit it in practice, we +/// take it into account in some places anyway to catch some errors e.g. if +/// application passes insanely big value to some function. +/// +/// We could take into account the headers etc. to determine the exact +/// maximum size of the Compressed Data field, but the complexity would give +/// us nothing useful. Instead, limit the size of Compressed Data so that +/// even with biggest possible Block Header and Check fields the total +/// encoded size of the Block stays as a valid VLI. This doesn't guarantee +/// that the size of the Stream doesn't grow too big, but that problem is +/// taken care outside the Block handling code. +/// +/// ~LZMA_VLI_C(3) is to guarantee that if we need padding at the end of +/// the Compressed Data field, it will still stay in the proper limit. +/// +/// This constant is in this file because it is needed in both +/// block_encoder.c and block_buffer_encoder.c. +#define COMPRESSED_SIZE_MAX ((LZMA_VLI_MAX - LZMA_BLOCK_HEADER_SIZE_MAX \ + - LZMA_CHECK_SIZE_MAX) & ~LZMA_VLI_C(3)) + + +extern lzma_ret lzma_block_encoder_init(lzma_next_coder *next, + lzma_allocator *allocator, lzma_block *block); + +#endif diff --git a/liblzma/common/block_header_decoder.c b/liblzma/common/block_header_decoder.c new file mode 100644 index 0000000..2c9573e --- /dev/null +++ b/liblzma/common/block_header_decoder.c @@ -0,0 +1,116 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file block_header_decoder.c +/// \brief Decodes Block Header from .xz files +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "common.h" +#include "check.h" + + +static void +free_properties(lzma_block *block, lzma_allocator *allocator) +{ + // Free allocated filter options. The last array member is not + // touched after the initialization in the beginning of + // lzma_block_header_decode(), so we don't need to touch that here. + for (size_t i = 0; i < LZMA_FILTERS_MAX; ++i) { + lzma_free(block->filters[i].options, allocator); + block->filters[i].id = LZMA_VLI_UNKNOWN; + block->filters[i].options = NULL; + } + + return; +} + + +extern LZMA_API(lzma_ret) +lzma_block_header_decode(lzma_block *block, + lzma_allocator *allocator, const uint8_t *in) +{ + // NOTE: We consider the header to be corrupt not only when the + // CRC32 doesn't match, but also when variable-length integers + // are invalid or over 63 bits, or if the header is too small + // to contain the claimed information. + + // Initialize the filter options array. This way the caller can + // safely free() the options even if an error occurs in this function. + for (size_t i = 0; i <= LZMA_FILTERS_MAX; ++i) { + block->filters[i].id = LZMA_VLI_UNKNOWN; + block->filters[i].options = NULL; + } + + // Always zero for now. + block->version = 0; + + // Validate Block Header Size and Check type. The caller must have + // already set these, so it is a programming error if this test fails. + if (lzma_block_header_size_decode(in[0]) != block->header_size + || (unsigned int)(block->check) > LZMA_CHECK_ID_MAX) + return LZMA_PROG_ERROR; + + // Exclude the CRC32 field. + const size_t in_size = block->header_size - 4; + + // Verify CRC32 + if (lzma_crc32(in, in_size, 0) != unaligned_read32le(in + in_size)) + return LZMA_DATA_ERROR; + + // Check for unsupported flags. + if (in[1] & 0x3C) + return LZMA_OPTIONS_ERROR; + + // Start after the Block Header Size and Block Flags fields. + size_t in_pos = 2; + + // Compressed Size + if (in[1] & 0x40) { + return_if_error(lzma_vli_decode(&block->compressed_size, + NULL, in, &in_pos, in_size)); + + // Validate Compressed Size. This checks that it isn't zero + // and that the total size of the Block is a valid VLI. + if (lzma_block_unpadded_size(block) == 0) + return LZMA_DATA_ERROR; + } else { + block->compressed_size = LZMA_VLI_UNKNOWN; + } + + // Uncompressed Size + if (in[1] & 0x80) + return_if_error(lzma_vli_decode(&block->uncompressed_size, + NULL, in, &in_pos, in_size)); + else + block->uncompressed_size = LZMA_VLI_UNKNOWN; + + // Filter Flags + const size_t filter_count = (in[1] & 3) + 1; + for (size_t i = 0; i < filter_count; ++i) { + const lzma_ret ret = lzma_filter_flags_decode( + &block->filters[i], allocator, + in, &in_pos, in_size); + if (ret != LZMA_OK) { + free_properties(block, allocator); + return ret; + } + } + + // Padding + while (in_pos < in_size) { + if (in[in_pos++] != 0x00) { + free_properties(block, allocator); + + // Possibly some new field present so use + // LZMA_OPTIONS_ERROR instead of LZMA_DATA_ERROR. + return LZMA_OPTIONS_ERROR; + } + } + + return LZMA_OK; +} diff --git a/liblzma/common/block_header_encoder.c b/liblzma/common/block_header_encoder.c new file mode 100644 index 0000000..707dd0c --- /dev/null +++ b/liblzma/common/block_header_encoder.c @@ -0,0 +1,132 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file block_header_encoder.c +/// \brief Encodes Block Header for .xz files +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "common.h" +#include "check.h" + + +extern LZMA_API(lzma_ret) +lzma_block_header_size(lzma_block *block) +{ + if (block->version != 0) + return LZMA_OPTIONS_ERROR; + + // Block Header Size + Block Flags + CRC32. + uint32_t size = 1 + 1 + 4; + + // Compressed Size + if (block->compressed_size != LZMA_VLI_UNKNOWN) { + const uint32_t add = lzma_vli_size(block->compressed_size); + if (add == 0 || block->compressed_size == 0) + return LZMA_PROG_ERROR; + + size += add; + } + + // Uncompressed Size + if (block->uncompressed_size != LZMA_VLI_UNKNOWN) { + const uint32_t add = lzma_vli_size(block->uncompressed_size); + if (add == 0) + return LZMA_PROG_ERROR; + + size += add; + } + + // List of Filter Flags + if (block->filters == NULL || block->filters[0].id == LZMA_VLI_UNKNOWN) + return LZMA_PROG_ERROR; + + for (size_t i = 0; block->filters[i].id != LZMA_VLI_UNKNOWN; ++i) { + // Don't allow too many filters. + if (i == LZMA_FILTERS_MAX) + return LZMA_PROG_ERROR; + + uint32_t add; + return_if_error(lzma_filter_flags_size(&add, + block->filters + i)); + + size += add; + } + + // Pad to a multiple of four bytes. + block->header_size = (size + 3) & ~UINT32_C(3); + + // NOTE: We don't verify that the encoded size of the Block stays + // within limits. This is because it is possible that we are called + // with exaggerated Compressed Size (e.g. LZMA_VLI_MAX) to reserve + // space for Block Header, and later called again with lower, + // real values. + + return LZMA_OK; +} + + +extern LZMA_API(lzma_ret) +lzma_block_header_encode(const lzma_block *block, uint8_t *out) +{ + // Validate everything but filters. + if (lzma_block_unpadded_size(block) == 0 + || !lzma_vli_is_valid(block->uncompressed_size)) + return LZMA_PROG_ERROR; + + // Indicate the size of the buffer _excluding_ the CRC32 field. + const size_t out_size = block->header_size - 4; + + // Store the Block Header Size. + out[0] = out_size / 4; + + // We write Block Flags in pieces. + out[1] = 0x00; + size_t out_pos = 2; + + // Compressed Size + if (block->compressed_size != LZMA_VLI_UNKNOWN) { + return_if_error(lzma_vli_encode(block->compressed_size, NULL, + out, &out_pos, out_size)); + + out[1] |= 0x40; + } + + // Uncompressed Size + if (block->uncompressed_size != LZMA_VLI_UNKNOWN) { + return_if_error(lzma_vli_encode(block->uncompressed_size, NULL, + out, &out_pos, out_size)); + + out[1] |= 0x80; + } + + // Filter Flags + if (block->filters == NULL || block->filters[0].id == LZMA_VLI_UNKNOWN) + return LZMA_PROG_ERROR; + + size_t filter_count = 0; + do { + // There can be a maximum of four filters. + if (filter_count == LZMA_FILTERS_MAX) + return LZMA_PROG_ERROR; + + return_if_error(lzma_filter_flags_encode( + block->filters + filter_count, + out, &out_pos, out_size)); + + } while (block->filters[++filter_count].id != LZMA_VLI_UNKNOWN); + + out[1] |= filter_count - 1; + + // Padding + memzero(out + out_pos, out_size - out_pos); + + // CRC32 + unaligned_write32le(out + out_size, lzma_crc32(out, out_size, 0)); + + return LZMA_OK; +} diff --git a/liblzma/common/block_util.c b/liblzma/common/block_util.c new file mode 100644 index 0000000..62c9345 --- /dev/null +++ b/liblzma/common/block_util.c @@ -0,0 +1,90 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file block_header.c +/// \brief Utility functions to handle lzma_block +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "common.h" +#include "index.h" + + +extern LZMA_API(lzma_ret) +lzma_block_compressed_size(lzma_block *block, lzma_vli unpadded_size) +{ + // Validate everything but Uncompressed Size and filters. + if (lzma_block_unpadded_size(block) == 0) + return LZMA_PROG_ERROR; + + const uint32_t container_size = block->header_size + + lzma_check_size(block->check); + + // Validate that Compressed Size will be greater than zero. + if (unpadded_size <= container_size) + return LZMA_DATA_ERROR; + + // Calculate what Compressed Size is supposed to be. + // If Compressed Size was present in Block Header, + // compare that the new value matches it. + const lzma_vli compressed_size = unpadded_size - container_size; + if (block->compressed_size != LZMA_VLI_UNKNOWN + && block->compressed_size != compressed_size) + return LZMA_DATA_ERROR; + + block->compressed_size = compressed_size; + + return LZMA_OK; +} + + +extern LZMA_API(lzma_vli) +lzma_block_unpadded_size(const lzma_block *block) +{ + // Validate the values that we are interested in i.e. all but + // Uncompressed Size and the filters. + // + // NOTE: This function is used for validation too, so it is + // essential that these checks are always done even if + // Compressed Size is unknown. + if (block == NULL || block->version != 0 + || block->header_size < LZMA_BLOCK_HEADER_SIZE_MIN + || block->header_size > LZMA_BLOCK_HEADER_SIZE_MAX + || (block->header_size & 3) + || !lzma_vli_is_valid(block->compressed_size) + || block->compressed_size == 0 + || (unsigned int)(block->check) > LZMA_CHECK_ID_MAX) + return 0; + + // If Compressed Size is unknown, return that we cannot know + // size of the Block either. + if (block->compressed_size == LZMA_VLI_UNKNOWN) + return LZMA_VLI_UNKNOWN; + + // Calculate Unpadded Size and validate it. + const lzma_vli unpadded_size = block->compressed_size + + block->header_size + + lzma_check_size(block->check); + + assert(unpadded_size >= UNPADDED_SIZE_MIN); + if (unpadded_size > UNPADDED_SIZE_MAX) + return 0; + + return unpadded_size; +} + + +extern LZMA_API(lzma_vli) +lzma_block_total_size(const lzma_block *block) +{ + lzma_vli unpadded_size = lzma_block_unpadded_size(block); + + if (unpadded_size != LZMA_VLI_UNKNOWN) + unpadded_size = vli_ceil4(unpadded_size); + + return unpadded_size; +} diff --git a/liblzma/common/common.c b/liblzma/common/common.c new file mode 100644 index 0000000..b9e3860 --- /dev/null +++ b/liblzma/common/common.c @@ -0,0 +1,388 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file common.h +/// \brief Common functions needed in many places in liblzma +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "common.h" + + +///////////// +// Version // +///////////// + +extern LZMA_API(uint32_t) +lzma_version_number(void) +{ + return LZMA_VERSION; +} + + +extern LZMA_API(const char *) +lzma_version_string(void) +{ + return LZMA_VERSION_STRING; +} + + +/////////////////////// +// Memory allocation // +/////////////////////// + +extern void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1) +lzma_alloc(size_t size, lzma_allocator *allocator) +{ + // Some malloc() variants return NULL if called with size == 0. + if (size == 0) + size = 1; + + void *ptr; + + if (allocator != NULL && allocator->alloc != NULL) + ptr = allocator->alloc(allocator->opaque, 1, size); + else + ptr = malloc(size); + + return ptr; +} + + +extern void +lzma_free(void *ptr, lzma_allocator *allocator) +{ + if (allocator != NULL && allocator->free != NULL) + allocator->free(allocator->opaque, ptr); + else + free(ptr); + + return; +} + + +////////// +// Misc // +////////// + +extern size_t +lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size) +{ + const size_t in_avail = in_size - *in_pos; + const size_t out_avail = out_size - *out_pos; + const size_t copy_size = my_min(in_avail, out_avail); + + memcpy(out + *out_pos, in + *in_pos, copy_size); + + *in_pos += copy_size; + *out_pos += copy_size; + + return copy_size; +} + + +extern lzma_ret +lzma_next_filter_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters) +{ + lzma_next_coder_init(filters[0].init, next, allocator); + next->id = filters[0].id; + return filters[0].init == NULL + ? LZMA_OK : filters[0].init(next, allocator, filters); +} + + +extern lzma_ret +lzma_next_filter_update(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter *reversed_filters) +{ + // Check that the application isn't trying to change the Filter ID. + // End of filters is indicated with LZMA_VLI_UNKNOWN in both + // reversed_filters[0].id and next->id. + if (reversed_filters[0].id != next->id) + return LZMA_PROG_ERROR; + + if (reversed_filters[0].id == LZMA_VLI_UNKNOWN) + return LZMA_OK; + + assert(next->update != NULL); + return next->update(next->coder, allocator, NULL, reversed_filters); +} + + +extern void +lzma_next_end(lzma_next_coder *next, lzma_allocator *allocator) +{ + if (next->init != (uintptr_t)(NULL)) { + // To avoid tiny end functions that simply call + // lzma_free(coder, allocator), we allow leaving next->end + // NULL and call lzma_free() here. + if (next->end != NULL) + next->end(next->coder, allocator); + else + lzma_free(next->coder, allocator); + + // Reset the variables so the we don't accidentally think + // that it is an already initialized coder. + *next = LZMA_NEXT_CODER_INIT; + } + + return; +} + + +////////////////////////////////////// +// External to internal API wrapper // +////////////////////////////////////// + +extern lzma_ret +lzma_strm_init(lzma_stream *strm) +{ + if (strm == NULL) + return LZMA_PROG_ERROR; + + if (strm->internal == NULL) { + strm->internal = lzma_alloc(sizeof(lzma_internal), + strm->allocator); + if (strm->internal == NULL) + return LZMA_MEM_ERROR; + + strm->internal->next = LZMA_NEXT_CODER_INIT; + } + + strm->internal->supported_actions[LZMA_RUN] = false; + strm->internal->supported_actions[LZMA_SYNC_FLUSH] = false; + strm->internal->supported_actions[LZMA_FULL_FLUSH] = false; + strm->internal->supported_actions[LZMA_FINISH] = false; + strm->internal->sequence = ISEQ_RUN; + strm->internal->allow_buf_error = false; + + strm->total_in = 0; + strm->total_out = 0; + + return LZMA_OK; +} + + +extern LZMA_API(lzma_ret) +lzma_code(lzma_stream *strm, lzma_action action) +{ + // Sanity checks + if ((strm->next_in == NULL && strm->avail_in != 0) + || (strm->next_out == NULL && strm->avail_out != 0) + || strm->internal == NULL + || strm->internal->next.code == NULL + || (unsigned int)(action) > LZMA_FINISH + || !strm->internal->supported_actions[action]) + return LZMA_PROG_ERROR; + + // Check if unsupported members have been set to non-zero or non-NULL, + // which would indicate that some new feature is wanted. + if (strm->reserved_ptr1 != NULL + || strm->reserved_ptr2 != NULL + || strm->reserved_ptr3 != NULL + || strm->reserved_ptr4 != NULL + || strm->reserved_int1 != 0 + || strm->reserved_int2 != 0 + || strm->reserved_int3 != 0 + || strm->reserved_int4 != 0 + || strm->reserved_enum1 != LZMA_RESERVED_ENUM + || strm->reserved_enum2 != LZMA_RESERVED_ENUM) + return LZMA_OPTIONS_ERROR; + + switch (strm->internal->sequence) { + case ISEQ_RUN: + switch (action) { + case LZMA_RUN: + break; + + case LZMA_SYNC_FLUSH: + strm->internal->sequence = ISEQ_SYNC_FLUSH; + break; + + case LZMA_FULL_FLUSH: + strm->internal->sequence = ISEQ_FULL_FLUSH; + break; + + case LZMA_FINISH: + strm->internal->sequence = ISEQ_FINISH; + break; + } + + break; + + case ISEQ_SYNC_FLUSH: + // The same action must be used until we return + // LZMA_STREAM_END, and the amount of input must not change. + if (action != LZMA_SYNC_FLUSH + || strm->internal->avail_in != strm->avail_in) + return LZMA_PROG_ERROR; + + break; + + case ISEQ_FULL_FLUSH: + if (action != LZMA_FULL_FLUSH + || strm->internal->avail_in != strm->avail_in) + return LZMA_PROG_ERROR; + + break; + + case ISEQ_FINISH: + if (action != LZMA_FINISH + || strm->internal->avail_in != strm->avail_in) + return LZMA_PROG_ERROR; + + break; + + case ISEQ_END: + return LZMA_STREAM_END; + + case ISEQ_ERROR: + default: + return LZMA_PROG_ERROR; + } + + size_t in_pos = 0; + size_t out_pos = 0; + lzma_ret ret = strm->internal->next.code( + strm->internal->next.coder, strm->allocator, + strm->next_in, &in_pos, strm->avail_in, + strm->next_out, &out_pos, strm->avail_out, action); + + strm->next_in += in_pos; + strm->avail_in -= in_pos; + strm->total_in += in_pos; + + strm->next_out += out_pos; + strm->avail_out -= out_pos; + strm->total_out += out_pos; + + strm->internal->avail_in = strm->avail_in; + + switch (ret) { + case LZMA_OK: + // Don't return LZMA_BUF_ERROR when it happens the first time. + // This is to avoid returning LZMA_BUF_ERROR when avail_out + // was zero but still there was no more data left to written + // to next_out. + if (out_pos == 0 && in_pos == 0) { + if (strm->internal->allow_buf_error) + ret = LZMA_BUF_ERROR; + else + strm->internal->allow_buf_error = true; + } else { + strm->internal->allow_buf_error = false; + } + break; + + case LZMA_STREAM_END: + if (strm->internal->sequence == ISEQ_SYNC_FLUSH + || strm->internal->sequence == ISEQ_FULL_FLUSH) + strm->internal->sequence = ISEQ_RUN; + else + strm->internal->sequence = ISEQ_END; + + // Fall through + + case LZMA_NO_CHECK: + case LZMA_UNSUPPORTED_CHECK: + case LZMA_GET_CHECK: + case LZMA_MEMLIMIT_ERROR: + // Something else than LZMA_OK, but not a fatal error, + // that is, coding may be continued (except if ISEQ_END). + strm->internal->allow_buf_error = false; + break; + + default: + // All the other errors are fatal; coding cannot be continued. + assert(ret != LZMA_BUF_ERROR); + strm->internal->sequence = ISEQ_ERROR; + break; + } + + return ret; +} + + +extern LZMA_API(void) +lzma_end(lzma_stream *strm) +{ + if (strm != NULL && strm->internal != NULL) { + lzma_next_end(&strm->internal->next, strm->allocator); + lzma_free(strm->internal, strm->allocator); + strm->internal = NULL; + } + + return; +} + + +extern LZMA_API(lzma_check) +lzma_get_check(const lzma_stream *strm) +{ + // Return LZMA_CHECK_NONE if we cannot know the check type. + // It's a bug in the application if this happens. + if (strm->internal->next.get_check == NULL) + return LZMA_CHECK_NONE; + + return strm->internal->next.get_check(strm->internal->next.coder); +} + + +extern LZMA_API(uint64_t) +lzma_memusage(const lzma_stream *strm) +{ + uint64_t memusage; + uint64_t old_memlimit; + + if (strm == NULL || strm->internal == NULL + || strm->internal->next.memconfig == NULL + || strm->internal->next.memconfig( + strm->internal->next.coder, + &memusage, &old_memlimit, 0) != LZMA_OK) + return 0; + + return memusage; +} + + +extern LZMA_API(uint64_t) +lzma_memlimit_get(const lzma_stream *strm) +{ + uint64_t old_memlimit; + uint64_t memusage; + + if (strm == NULL || strm->internal == NULL + || strm->internal->next.memconfig == NULL + || strm->internal->next.memconfig( + strm->internal->next.coder, + &memusage, &old_memlimit, 0) != LZMA_OK) + return 0; + + return old_memlimit; +} + + +extern LZMA_API(lzma_ret) +lzma_memlimit_set(lzma_stream *strm, uint64_t new_memlimit) +{ + // Dummy variables to simplify memconfig functions + uint64_t old_memlimit; + uint64_t memusage; + + if (strm == NULL || strm->internal == NULL + || strm->internal->next.memconfig == NULL) + return LZMA_PROG_ERROR; + + if (new_memlimit != 0 && new_memlimit < LZMA_MEMUSAGE_BASE) + return LZMA_MEMLIMIT_ERROR; + + return strm->internal->next.memconfig(strm->internal->next.coder, + &memusage, &old_memlimit, new_memlimit); +} diff --git a/liblzma/common/common.h b/liblzma/common/common.h new file mode 100644 index 0000000..45aba4f --- /dev/null +++ b/liblzma/common/common.h @@ -0,0 +1,284 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file common.h +/// \brief Definitions common to the whole liblzma library +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_COMMON_H +#define LZMA_COMMON_H + +#include "sysdefs.h" +#include "mythread.h" +#include "tuklib_integer.h" + +#if defined(_WIN32) || defined(__CYGWIN__) +# ifdef DLL_EXPORT +# define LZMA_API_EXPORT __declspec(dllexport) +# else +# define LZMA_API_EXPORT +# endif +// Don't use ifdef or defined() below. +#elif HAVE_VISIBILITY +# define LZMA_API_EXPORT __attribute__((__visibility__("default"))) +#else +# define LZMA_API_EXPORT +#endif + +#define LZMA_API(type) LZMA_API_EXPORT type LZMA_API_CALL + +#include "lzma.h" + +// These allow helping the compiler in some often-executed branches, whose +// result is almost always the same. +#ifdef __GNUC__ +# define likely(expr) __builtin_expect(expr, true) +# define unlikely(expr) __builtin_expect(expr, false) +#else +# define likely(expr) (expr) +# define unlikely(expr) (expr) +#endif + + +/// Size of temporary buffers needed in some filters +#define LZMA_BUFFER_SIZE 4096 + + +/// Starting value for memory usage estimates. Instead of calculating size +/// of _every_ structure and taking into account malloc() overhead etc., we +/// add a base size to all memory usage estimates. It's not very accurate +/// but should be easily good enough. +#define LZMA_MEMUSAGE_BASE (UINT64_C(1) << 15) + +/// Start of internal Filter ID space. These IDs must never be used +/// in Streams. +#define LZMA_FILTER_RESERVED_START (LZMA_VLI_C(1) << 62) + + +/// Supported flags that can be passed to lzma_stream_decoder() +/// or lzma_auto_decoder(). +#define LZMA_SUPPORTED_FLAGS \ + ( LZMA_TELL_NO_CHECK \ + | LZMA_TELL_UNSUPPORTED_CHECK \ + | LZMA_TELL_ANY_CHECK \ + | LZMA_CONCATENATED ) + + +/// Type of encoder/decoder specific data; the actual structure is defined +/// differently in different coders. +typedef struct lzma_coder_s lzma_coder; + +typedef struct lzma_next_coder_s lzma_next_coder; + +typedef struct lzma_filter_info_s lzma_filter_info; + + +/// Type of a function used to initialize a filter encoder or decoder +typedef lzma_ret (*lzma_init_function)( + lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters); + +/// Type of a function to do some kind of coding work (filters, Stream, +/// Block encoders/decoders etc.). Some special coders use don't use both +/// input and output buffers, but for simplicity they still use this same +/// function prototype. +typedef lzma_ret (*lzma_code_function)( + lzma_coder *coder, lzma_allocator *allocator, + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size, + lzma_action action); + +/// Type of a function to free the memory allocated for the coder +typedef void (*lzma_end_function)( + lzma_coder *coder, lzma_allocator *allocator); + + +/// Raw coder validates and converts an array of lzma_filter structures to +/// an array of lzma_filter_info structures. This array is used with +/// lzma_next_filter_init to initialize the filter chain. +struct lzma_filter_info_s { + /// Filter ID. This is used only by the encoder + /// with lzma_filters_update(). + lzma_vli id; + + /// Pointer to function used to initialize the filter. + /// This is NULL to indicate end of array. + lzma_init_function init; + + /// Pointer to filter's options structure + void *options; +}; + + +/// Hold data and function pointers of the next filter in the chain. +struct lzma_next_coder_s { + /// Pointer to coder-specific data + lzma_coder *coder; + + /// Filter ID. This is LZMA_VLI_UNKNOWN when this structure doesn't + /// point to a filter coder. + lzma_vli id; + + /// "Pointer" to init function. This is never called here. + /// We need only to detect if we are initializing a coder + /// that was allocated earlier. See lzma_next_coder_init and + /// lzma_next_strm_init macros in this file. + uintptr_t init; + + /// Pointer to function to do the actual coding + lzma_code_function code; + + /// Pointer to function to free lzma_next_coder.coder. This can + /// be NULL; in that case, lzma_free is called to free + /// lzma_next_coder.coder. + lzma_end_function end; + + /// Pointer to function to return the type of the integrity check. + /// Most coders won't support this. + lzma_check (*get_check)(const lzma_coder *coder); + + /// Pointer to function to get and/or change the memory usage limit. + /// If new_memlimit == 0, the limit is not changed. + lzma_ret (*memconfig)(lzma_coder *coder, uint64_t *memusage, + uint64_t *old_memlimit, uint64_t new_memlimit); + + /// Update the filter-specific options or the whole filter chain + /// in the encoder. + lzma_ret (*update)(lzma_coder *coder, lzma_allocator *allocator, + const lzma_filter *filters, + const lzma_filter *reversed_filters); +}; + + +/// Macro to initialize lzma_next_coder structure +#define LZMA_NEXT_CODER_INIT \ + (lzma_next_coder){ \ + .coder = NULL, \ + .init = (uintptr_t)(NULL), \ + .id = LZMA_VLI_UNKNOWN, \ + .code = NULL, \ + .end = NULL, \ + .get_check = NULL, \ + .memconfig = NULL, \ + .update = NULL, \ + } + + +/// Internal data for lzma_strm_init, lzma_code, and lzma_end. A pointer to +/// this is stored in lzma_stream. +struct lzma_internal_s { + /// The actual coder that should do something useful + lzma_next_coder next; + + /// Track the state of the coder. This is used to validate arguments + /// so that the actual coders can rely on e.g. that LZMA_SYNC_FLUSH + /// is used on every call to lzma_code until next.code has returned + /// LZMA_STREAM_END. + enum { + ISEQ_RUN, + ISEQ_SYNC_FLUSH, + ISEQ_FULL_FLUSH, + ISEQ_FINISH, + ISEQ_END, + ISEQ_ERROR, + } sequence; + + /// A copy of lzma_stream avail_in. This is used to verify that the + /// amount of input doesn't change once e.g. LZMA_FINISH has been + /// used. + size_t avail_in; + + /// Indicates which lzma_action values are allowed by next.code. + bool supported_actions[4]; + + /// If true, lzma_code will return LZMA_BUF_ERROR if no progress was + /// made (no input consumed and no output produced by next.code). + bool allow_buf_error; +}; + + +/// Allocates memory +extern void *lzma_alloc(size_t size, lzma_allocator *allocator) + lzma_attribute((__malloc__)) lzma_attr_alloc_size(1); + +/// Frees memory +extern void lzma_free(void *ptr, lzma_allocator *allocator); + + +/// Allocates strm->internal if it is NULL, and initializes *strm and +/// strm->internal. This function is only called via lzma_next_strm_init macro. +extern lzma_ret lzma_strm_init(lzma_stream *strm); + +/// Initializes the next filter in the chain, if any. This takes care of +/// freeing the memory of previously initialized filter if it is different +/// than the filter being initialized now. This way the actual filter +/// initialization functions don't need to use lzma_next_coder_init macro. +extern lzma_ret lzma_next_filter_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + +/// Update the next filter in the chain, if any. This checks that +/// the application is not trying to change the Filter IDs. +extern lzma_ret lzma_next_filter_update( + lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter *reversed_filters); + +/// Frees the memory allocated for next->coder either using next->end or, +/// if next->end is NULL, using lzma_free. +extern void lzma_next_end(lzma_next_coder *next, lzma_allocator *allocator); + + +/// Copy as much data as possible from in[] to out[] and update *in_pos +/// and *out_pos accordingly. Returns the number of bytes copied. +extern size_t lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size); + + +/// \brief Return if expression doesn't evaluate to LZMA_OK +/// +/// There are several situations where we want to return immediately +/// with the value of expr if it isn't LZMA_OK. This macro shortens +/// the code a little. +#define return_if_error(expr) \ +do { \ + const lzma_ret ret_ = (expr); \ + if (ret_ != LZMA_OK) \ + return ret_; \ +} while (0) + + +/// If next isn't already initialized, free the previous coder. Then mark +/// that next is _possibly_ initialized for the coder using this macro. +/// "Possibly" means that if e.g. allocation of next->coder fails, the +/// structure isn't actually initialized for this coder, but leaving +/// next->init to func is still OK. +#define lzma_next_coder_init(func, next, allocator) \ +do { \ + if ((uintptr_t)(func) != (next)->init) \ + lzma_next_end(next, allocator); \ + (next)->init = (uintptr_t)(func); \ +} while (0) + + +/// Initializes lzma_strm and calls func() to initialize strm->internal->next. +/// (The function being called will use lzma_next_coder_init()). If +/// initialization fails, memory that wasn't freed by func() is freed +/// along strm->internal. +#define lzma_next_strm_init(func, strm, ...) \ +do { \ + return_if_error(lzma_strm_init(strm)); \ + const lzma_ret ret_ = func(&(strm)->internal->next, \ + (strm)->allocator, __VA_ARGS__); \ + if (ret_ != LZMA_OK) { \ + lzma_end(strm); \ + return ret_; \ + } \ +} while (0) + +#endif diff --git a/liblzma/common/easy_buffer_encoder.c b/liblzma/common/easy_buffer_encoder.c new file mode 100644 index 0000000..c4be34c --- /dev/null +++ b/liblzma/common/easy_buffer_encoder.c @@ -0,0 +1,27 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file easy_buffer_encoder.c +/// \brief Easy single-call .xz Stream encoder +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "easy_preset.h" + + +extern LZMA_API(lzma_ret) +lzma_easy_buffer_encode(uint32_t preset, lzma_check check, + lzma_allocator *allocator, const uint8_t *in, size_t in_size, + uint8_t *out, size_t *out_pos, size_t out_size) +{ + lzma_options_easy opt_easy; + if (lzma_easy_preset(&opt_easy, preset)) + return LZMA_OPTIONS_ERROR; + + return lzma_stream_buffer_encode(opt_easy.filters, check, + allocator, in, in_size, out, out_pos, out_size); +} diff --git a/liblzma/common/easy_decoder_memusage.c b/liblzma/common/easy_decoder_memusage.c new file mode 100644 index 0000000..20bcd5b --- /dev/null +++ b/liblzma/common/easy_decoder_memusage.c @@ -0,0 +1,24 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file easy_decoder_memusage.c +/// \brief Decoder memory usage calculation to match easy encoder presets +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "easy_preset.h" + + +extern LZMA_API(uint64_t) +lzma_easy_decoder_memusage(uint32_t preset) +{ + lzma_options_easy opt_easy; + if (lzma_easy_preset(&opt_easy, preset)) + return UINT32_MAX; + + return lzma_raw_decoder_memusage(opt_easy.filters); +} diff --git a/liblzma/common/easy_encoder.c b/liblzma/common/easy_encoder.c new file mode 100644 index 0000000..d13ccd7 --- /dev/null +++ b/liblzma/common/easy_encoder.c @@ -0,0 +1,25 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file easy_encoder.c +/// \brief Easy .xz Stream encoder initialization +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "easy_preset.h" +#include "stream_encoder.h" + + +extern LZMA_API(lzma_ret) +lzma_easy_encoder(lzma_stream *strm, uint32_t preset, lzma_check check) +{ + lzma_options_easy opt_easy; + if (lzma_easy_preset(&opt_easy, preset)) + return LZMA_OPTIONS_ERROR; + + return lzma_stream_encoder(strm, opt_easy.filters, check); +} diff --git a/liblzma/common/easy_encoder_memusage.c b/liblzma/common/easy_encoder_memusage.c new file mode 100644 index 0000000..e910575 --- /dev/null +++ b/liblzma/common/easy_encoder_memusage.c @@ -0,0 +1,24 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file easy_encoder_memusage.c +/// \brief Easy .xz Stream encoder memory usage calculation +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "easy_preset.h" + + +extern LZMA_API(uint64_t) +lzma_easy_encoder_memusage(uint32_t preset) +{ + lzma_options_easy opt_easy; + if (lzma_easy_preset(&opt_easy, preset)) + return UINT32_MAX; + + return lzma_raw_encoder_memusage(opt_easy.filters); +} diff --git a/liblzma/common/easy_preset.c b/liblzma/common/easy_preset.c new file mode 100644 index 0000000..2f98598 --- /dev/null +++ b/liblzma/common/easy_preset.c @@ -0,0 +1,27 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file easy_preset.c +/// \brief Preset handling for easy encoder and decoder +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "easy_preset.h" + + +extern bool +lzma_easy_preset(lzma_options_easy *opt_easy, uint32_t preset) +{ + if (lzma_lzma_preset(&opt_easy->opt_lzma, preset)) + return true; + + opt_easy->filters[0].id = LZMA_FILTER_LZMA2; + opt_easy->filters[0].options = &opt_easy->opt_lzma; + opt_easy->filters[1].id = LZMA_VLI_UNKNOWN; + + return false; +} diff --git a/liblzma/common/easy_preset.h b/liblzma/common/easy_preset.h new file mode 100644 index 0000000..382ade8 --- /dev/null +++ b/liblzma/common/easy_preset.h @@ -0,0 +1,32 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file easy_preset.h +/// \brief Preset handling for easy encoder and decoder +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "common.h" + + +typedef struct { + /// We need to keep the filters array available in case + /// LZMA_FULL_FLUSH is used. + lzma_filter filters[LZMA_FILTERS_MAX + 1]; + + /// Options for LZMA2 + lzma_options_lzma opt_lzma; + + // Options for more filters can be added later, so this struct + // is not ready to be put into the public API. + +} lzma_options_easy; + + +/// Set *easy to the settings given by the preset. Returns true on error, +/// false on success. +extern bool lzma_easy_preset(lzma_options_easy *easy, uint32_t preset); diff --git a/liblzma/common/filter_buffer_decoder.c b/liblzma/common/filter_buffer_decoder.c new file mode 100644 index 0000000..2d35ef8 --- /dev/null +++ b/liblzma/common/filter_buffer_decoder.c @@ -0,0 +1,87 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file filter_buffer_decoder.c +/// \brief Single-call raw decoding +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "filter_decoder.h" + + +extern LZMA_API(lzma_ret) +lzma_raw_buffer_decode(const lzma_filter *filters, lzma_allocator *allocator, + const uint8_t *in, size_t *in_pos, size_t in_size, + uint8_t *out, size_t *out_pos, size_t out_size) +{ + // Validate what isn't validated later in filter_common.c. + if (in == NULL || in_pos == NULL || *in_pos > in_size || out == NULL + || out_pos == NULL || *out_pos > out_size) + return LZMA_PROG_ERROR; + + // Initialize the decoer. + lzma_next_coder next = LZMA_NEXT_CODER_INIT; + return_if_error(lzma_raw_decoder_init(&next, allocator, filters)); + + // Store the positions so that we can restore them if something + // goes wrong. + const size_t in_start = *in_pos; + const size_t out_start = *out_pos; + + // Do the actual decoding and free decoder's memory. + lzma_ret ret = next.code(next.coder, allocator, in, in_pos, in_size, + out, out_pos, out_size, LZMA_FINISH); + + if (ret == LZMA_STREAM_END) { + ret = LZMA_OK; + } else { + if (ret == LZMA_OK) { + // Either the input was truncated or the + // output buffer was too small. + assert(*in_pos == in_size || *out_pos == out_size); + + if (*in_pos != in_size) { + // Since input wasn't consumed completely, + // the output buffer became full and is + // too small. + ret = LZMA_BUF_ERROR; + + } else if (*out_pos != out_size) { + // Since output didn't became full, the input + // has to be truncated. + ret = LZMA_DATA_ERROR; + + } else { + // All the input was consumed and output + // buffer is full. Now we don't immediately + // know the reason for the error. Try + // decoding one more byte. If it succeeds, + // then the output buffer was too small. If + // we cannot get a new output byte, the input + // is truncated. + uint8_t tmp[1]; + size_t tmp_pos = 0; + (void)next.code(next.coder, allocator, + in, in_pos, in_size, + tmp, &tmp_pos, 1, LZMA_FINISH); + + if (tmp_pos == 1) + ret = LZMA_BUF_ERROR; + else + ret = LZMA_DATA_ERROR; + } + } + + // Restore the positions. + *in_pos = in_start; + *out_pos = out_start; + } + + lzma_next_end(&next, allocator); + + return ret; +} diff --git a/liblzma/common/filter_buffer_encoder.c b/liblzma/common/filter_buffer_encoder.c new file mode 100644 index 0000000..646e1b3 --- /dev/null +++ b/liblzma/common/filter_buffer_encoder.c @@ -0,0 +1,54 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file filter_buffer_encoder.c +/// \brief Single-call raw encoding +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "filter_encoder.h" + + +extern LZMA_API(lzma_ret) +lzma_raw_buffer_encode(const lzma_filter *filters, lzma_allocator *allocator, + const uint8_t *in, size_t in_size, uint8_t *out, + size_t *out_pos, size_t out_size) +{ + // Validate what isn't validated later in filter_common.c. + if ((in == NULL && in_size != 0) || out == NULL + || out_pos == NULL || *out_pos > out_size) + return LZMA_PROG_ERROR; + + // Initialize the encoder + lzma_next_coder next = LZMA_NEXT_CODER_INIT; + return_if_error(lzma_raw_encoder_init(&next, allocator, filters)); + + // Store the output position so that we can restore it if + // something goes wrong. + const size_t out_start = *out_pos; + + // Do the actual encoding and free coder's memory. + size_t in_pos = 0; + lzma_ret ret = next.code(next.coder, allocator, in, &in_pos, in_size, + out, out_pos, out_size, LZMA_FINISH); + lzma_next_end(&next, allocator); + + if (ret == LZMA_STREAM_END) { + ret = LZMA_OK; + } else { + if (ret == LZMA_OK) { + // Output buffer was too small. + assert(*out_pos == out_size); + ret = LZMA_BUF_ERROR; + } + + // Restore the output position. + *out_pos = out_start; + } + + return ret; +} diff --git a/liblzma/common/filter_common.c b/liblzma/common/filter_common.c new file mode 100644 index 0000000..7c95b05 --- /dev/null +++ b/liblzma/common/filter_common.c @@ -0,0 +1,337 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file filter_common.c +/// \brief Filter-specific stuff common for both encoder and decoder +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "filter_common.h" + + +static const struct { + /// Filter ID + lzma_vli id; + + /// Size of the filter-specific options structure + size_t options_size; + + /// True if it is OK to use this filter as non-last filter in + /// the chain. + bool non_last_ok; + + /// True if it is OK to use this filter as the last filter in + /// the chain. + bool last_ok; + + /// True if the filter may change the size of the data (that is, the + /// amount of encoded output can be different than the amount of + /// uncompressed input). + bool changes_size; + +} features[] = { +#if defined (HAVE_ENCODER_LZMA1) || defined(HAVE_DECODER_LZMA1) + { + .id = LZMA_FILTER_LZMA1, + .options_size = sizeof(lzma_options_lzma), + .non_last_ok = false, + .last_ok = true, + .changes_size = true, + }, +#endif +#if defined(HAVE_ENCODER_LZMA2) || defined(HAVE_DECODER_LZMA2) + { + .id = LZMA_FILTER_LZMA2, + .options_size = sizeof(lzma_options_lzma), + .non_last_ok = false, + .last_ok = true, + .changes_size = true, + }, +#endif +#if defined(HAVE_ENCODER_X86) || defined(HAVE_DECODER_X86) + { + .id = LZMA_FILTER_X86, + .options_size = sizeof(lzma_options_bcj), + .non_last_ok = true, + .last_ok = false, + .changes_size = false, + }, +#endif +#if defined(HAVE_ENCODER_POWERPC) || defined(HAVE_DECODER_POWERPC) + { + .id = LZMA_FILTER_POWERPC, + .options_size = sizeof(lzma_options_bcj), + .non_last_ok = true, + .last_ok = false, + .changes_size = false, + }, +#endif +#if defined(HAVE_ENCODER_IA64) || defined(HAVE_DECODER_IA64) + { + .id = LZMA_FILTER_IA64, + .options_size = sizeof(lzma_options_bcj), + .non_last_ok = true, + .last_ok = false, + .changes_size = false, + }, +#endif +#if defined(HAVE_ENCODER_ARM) || defined(HAVE_DECODER_ARM) + { + .id = LZMA_FILTER_ARM, + .options_size = sizeof(lzma_options_bcj), + .non_last_ok = true, + .last_ok = false, + .changes_size = false, + }, +#endif +#if defined(HAVE_ENCODER_ARMTHUMB) || defined(HAVE_DECODER_ARMTHUMB) + { + .id = LZMA_FILTER_ARMTHUMB, + .options_size = sizeof(lzma_options_bcj), + .non_last_ok = true, + .last_ok = false, + .changes_size = false, + }, +#endif +#if defined(HAVE_ENCODER_SPARC) || defined(HAVE_DECODER_SPARC) + { + .id = LZMA_FILTER_SPARC, + .options_size = sizeof(lzma_options_bcj), + .non_last_ok = true, + .last_ok = false, + .changes_size = false, + }, +#endif +#if defined(HAVE_ENCODER_DELTA) || defined(HAVE_DECODER_DELTA) + { + .id = LZMA_FILTER_DELTA, + .options_size = sizeof(lzma_options_delta), + .non_last_ok = true, + .last_ok = false, + .changes_size = false, + }, +#endif + { + .id = LZMA_VLI_UNKNOWN + } +}; + + +extern LZMA_API(lzma_ret) +lzma_filters_copy(const lzma_filter *src, lzma_filter *dest, + lzma_allocator *allocator) +{ + if (src == NULL || dest == NULL) + return LZMA_PROG_ERROR; + + lzma_ret ret; + size_t i; + for (i = 0; src[i].id != LZMA_VLI_UNKNOWN; ++i) { + // There must be a maximum of four filters plus + // the array terminator. + if (i == LZMA_FILTERS_MAX) { + ret = LZMA_OPTIONS_ERROR; + goto error; + } + + dest[i].id = src[i].id; + + if (src[i].options == NULL) { + dest[i].options = NULL; + } else { + // See if the filter is supported only when the + // options is not NULL. This might be convenient + // sometimes if the app is actually copying only + // a partial filter chain with a place holder ID. + // + // When options is not NULL, the Filter ID must be + // supported by us, because otherwise we don't know + // how big the options are. + size_t j; + for (j = 0; src[i].id != features[j].id; ++j) { + if (features[j].id == LZMA_VLI_UNKNOWN) { + ret = LZMA_OPTIONS_ERROR; + goto error; + } + } + + // Allocate and copy the options. + dest[i].options = lzma_alloc(features[j].options_size, + allocator); + if (dest[i].options == NULL) { + ret = LZMA_MEM_ERROR; + goto error; + } + + memcpy(dest[i].options, src[i].options, + features[j].options_size); + } + } + + // Terminate the filter array. + assert(i <= LZMA_FILTERS_MAX + 1); + dest[i].id = LZMA_VLI_UNKNOWN; + dest[i].options = NULL; + + return LZMA_OK; + +error: + // Free the options which we have already allocated. + while (i-- > 0) { + lzma_free(dest[i].options, allocator); + dest[i].options = NULL; + } + + return ret; +} + + +static lzma_ret +validate_chain(const lzma_filter *filters, size_t *count) +{ + // There must be at least one filter. + if (filters == NULL || filters[0].id == LZMA_VLI_UNKNOWN) + return LZMA_PROG_ERROR; + + // Number of non-last filters that may change the size of the data + // significantly (that is, more than 1-2 % or so). + size_t changes_size_count = 0; + + // True if it is OK to add a new filter after the current filter. + bool non_last_ok = true; + + // True if the last filter in the given chain is actually usable as + // the last filter. Only filters that support embedding End of Payload + // Marker can be used as the last filter in the chain. + bool last_ok = false; + + size_t i = 0; + do { + size_t j; + for (j = 0; filters[i].id != features[j].id; ++j) + if (features[j].id == LZMA_VLI_UNKNOWN) + return LZMA_OPTIONS_ERROR; + + // If the previous filter in the chain cannot be a non-last + // filter, the chain is invalid. + if (!non_last_ok) + return LZMA_OPTIONS_ERROR; + + non_last_ok = features[j].non_last_ok; + last_ok = features[j].last_ok; + changes_size_count += features[j].changes_size; + + } while (filters[++i].id != LZMA_VLI_UNKNOWN); + + // There must be 1-4 filters. The last filter must be usable as + // the last filter in the chain. A maximum of three filters are + // allowed to change the size of the data. + if (i > LZMA_FILTERS_MAX || !last_ok || changes_size_count > 3) + return LZMA_OPTIONS_ERROR; + + *count = i; + return LZMA_OK; +} + + +extern lzma_ret +lzma_raw_coder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter *options, + lzma_filter_find coder_find, bool is_encoder) +{ + // Do some basic validation and get the number of filters. + size_t count; + return_if_error(validate_chain(options, &count)); + + // Set the filter functions and copy the options pointer. + lzma_filter_info filters[LZMA_FILTERS_MAX + 1]; + if (is_encoder) { + for (size_t i = 0; i < count; ++i) { + // The order of the filters is reversed in the + // encoder. It allows more efficient handling + // of the uncompressed data. + const size_t j = count - i - 1; + + const lzma_filter_coder *const fc + = coder_find(options[i].id); + if (fc == NULL || fc->init == NULL) + return LZMA_OPTIONS_ERROR; + + filters[j].id = options[i].id; + filters[j].init = fc->init; + filters[j].options = options[i].options; + } + } else { + for (size_t i = 0; i < count; ++i) { + const lzma_filter_coder *const fc + = coder_find(options[i].id); + if (fc == NULL || fc->init == NULL) + return LZMA_OPTIONS_ERROR; + + filters[i].id = options[i].id; + filters[i].init = fc->init; + filters[i].options = options[i].options; + } + } + + // Terminate the array. + filters[count].id = LZMA_VLI_UNKNOWN; + filters[count].init = NULL; + + // Initialize the filters. + const lzma_ret ret = lzma_next_filter_init(next, allocator, filters); + if (ret != LZMA_OK) + lzma_next_end(next, allocator); + + return ret; +} + + +extern uint64_t +lzma_raw_coder_memusage(lzma_filter_find coder_find, + const lzma_filter *filters) +{ + // The chain has to have at least one filter. + { + size_t tmp; + if (validate_chain(filters, &tmp) != LZMA_OK) + return UINT64_MAX; + } + + uint64_t total = 0; + size_t i = 0; + + do { + const lzma_filter_coder *const fc + = coder_find(filters[i].id); + if (fc == NULL) + return UINT64_MAX; // Unsupported Filter ID + + if (fc->memusage == NULL) { + // This filter doesn't have a function to calculate + // the memory usage and validate the options. Such + // filters need only little memory, so we use 1 KiB + // as a good estimate. They also accept all possible + // options, so there's no need to worry about lack + // of validation. + total += 1024; + } else { + // Call the filter-specific memory usage calculation + // function. + const uint64_t usage + = fc->memusage(filters[i].options); + if (usage == UINT64_MAX) + return UINT64_MAX; // Invalid options + + total += usage; + } + } while (filters[++i].id != LZMA_VLI_UNKNOWN); + + // Add some fixed amount of extra. It's to compensate memory usage + // of Stream, Block etc. coders, malloc() overhead, stack etc. + return total + LZMA_MEMUSAGE_BASE; +} diff --git a/liblzma/common/filter_common.h b/liblzma/common/filter_common.h new file mode 100644 index 0000000..cd61fc0 --- /dev/null +++ b/liblzma/common/filter_common.h @@ -0,0 +1,48 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file filter_common.c +/// \brief Filter-specific stuff common for both encoder and decoder +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_FILTER_COMMON_H +#define LZMA_FILTER_COMMON_H + +#include "common.h" + + +/// Both lzma_filter_encoder and lzma_filter_decoder begin with these members. +typedef struct { + /// Filter ID + lzma_vli id; + + /// Initializes the filter encoder and calls lzma_next_filter_init() + /// for filters + 1. + lzma_init_function init; + + /// Calculates memory usage of the encoder. If the options are + /// invalid, UINT64_MAX is returned. + uint64_t (*memusage)(const void *options); + +} lzma_filter_coder; + + +typedef const lzma_filter_coder *(*lzma_filter_find)(lzma_vli id); + + +extern lzma_ret lzma_raw_coder_init( + lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter *filters, + lzma_filter_find coder_find, bool is_encoder); + + +extern uint64_t lzma_raw_coder_memusage(lzma_filter_find coder_find, + const lzma_filter *filters); + + +#endif diff --git a/liblzma/common/filter_decoder.c b/liblzma/common/filter_decoder.c new file mode 100644 index 0000000..1ebbe2a --- /dev/null +++ b/liblzma/common/filter_decoder.c @@ -0,0 +1,183 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file filter_decoder.c +/// \brief Filter ID mapping to filter-specific functions +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "filter_decoder.h" +#include "filter_common.h" +#include "lzma_decoder.h" +#include "lzma2_decoder.h" +#include "simple_decoder.h" +#include "delta_decoder.h" + + +typedef struct { + /// Filter ID + lzma_vli id; + + /// Initializes the filter encoder and calls lzma_next_filter_init() + /// for filters + 1. + lzma_init_function init; + + /// Calculates memory usage of the encoder. If the options are + /// invalid, UINT64_MAX is returned. + uint64_t (*memusage)(const void *options); + + /// Decodes Filter Properties. + /// + /// \return - LZMA_OK: Properties decoded successfully. + /// - LZMA_OPTIONS_ERROR: Unsupported properties + /// - LZMA_MEM_ERROR: Memory allocation failed. + lzma_ret (*props_decode)(void **options, lzma_allocator *allocator, + const uint8_t *props, size_t props_size); + +} lzma_filter_decoder; + + +static const lzma_filter_decoder decoders[] = { +#ifdef HAVE_DECODER_LZMA1 + { + .id = LZMA_FILTER_LZMA1, + .init = &lzma_lzma_decoder_init, + .memusage = &lzma_lzma_decoder_memusage, + .props_decode = &lzma_lzma_props_decode, + }, +#endif +#ifdef HAVE_DECODER_LZMA2 + { + .id = LZMA_FILTER_LZMA2, + .init = &lzma_lzma2_decoder_init, + .memusage = &lzma_lzma2_decoder_memusage, + .props_decode = &lzma_lzma2_props_decode, + }, +#endif +#ifdef HAVE_DECODER_X86 + { + .id = LZMA_FILTER_X86, + .init = &lzma_simple_x86_decoder_init, + .memusage = NULL, + .props_decode = &lzma_simple_props_decode, + }, +#endif +#ifdef HAVE_DECODER_POWERPC + { + .id = LZMA_FILTER_POWERPC, + .init = &lzma_simple_powerpc_decoder_init, + .memusage = NULL, + .props_decode = &lzma_simple_props_decode, + }, +#endif +#ifdef HAVE_DECODER_IA64 + { + .id = LZMA_FILTER_IA64, + .init = &lzma_simple_ia64_decoder_init, + .memusage = NULL, + .props_decode = &lzma_simple_props_decode, + }, +#endif +#ifdef HAVE_DECODER_ARM + { + .id = LZMA_FILTER_ARM, + .init = &lzma_simple_arm_decoder_init, + .memusage = NULL, + .props_decode = &lzma_simple_props_decode, + }, +#endif +#ifdef HAVE_DECODER_ARMTHUMB + { + .id = LZMA_FILTER_ARMTHUMB, + .init = &lzma_simple_armthumb_decoder_init, + .memusage = NULL, + .props_decode = &lzma_simple_props_decode, + }, +#endif +#ifdef HAVE_DECODER_SPARC + { + .id = LZMA_FILTER_SPARC, + .init = &lzma_simple_sparc_decoder_init, + .memusage = NULL, + .props_decode = &lzma_simple_props_decode, + }, +#endif +#ifdef HAVE_DECODER_DELTA + { + .id = LZMA_FILTER_DELTA, + .init = &lzma_delta_decoder_init, + .memusage = &lzma_delta_coder_memusage, + .props_decode = &lzma_delta_props_decode, + }, +#endif +}; + + +static const lzma_filter_decoder * +decoder_find(lzma_vli id) +{ + for (size_t i = 0; i < ARRAY_SIZE(decoders); ++i) + if (decoders[i].id == id) + return decoders + i; + + return NULL; +} + + +extern LZMA_API(lzma_bool) +lzma_filter_decoder_is_supported(lzma_vli id) +{ + return decoder_find(id) != NULL; +} + + +extern lzma_ret +lzma_raw_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter *options) +{ + return lzma_raw_coder_init(next, allocator, + options, (lzma_filter_find)(&decoder_find), false); +} + + +extern LZMA_API(lzma_ret) +lzma_raw_decoder(lzma_stream *strm, const lzma_filter *options) +{ + lzma_next_strm_init(lzma_raw_decoder_init, strm, options); + + strm->internal->supported_actions[LZMA_RUN] = true; + strm->internal->supported_actions[LZMA_FINISH] = true; + + return LZMA_OK; +} + + +extern LZMA_API(uint64_t) +lzma_raw_decoder_memusage(const lzma_filter *filters) +{ + return lzma_raw_coder_memusage( + (lzma_filter_find)(&decoder_find), filters); +} + + +extern LZMA_API(lzma_ret) +lzma_properties_decode(lzma_filter *filter, lzma_allocator *allocator, + const uint8_t *props, size_t props_size) +{ + // Make it always NULL so that the caller can always safely free() it. + filter->options = NULL; + + const lzma_filter_decoder *const fd = decoder_find(filter->id); + if (fd == NULL) + return LZMA_OPTIONS_ERROR; + + if (fd->props_decode == NULL) + return props_size == 0 ? LZMA_OK : LZMA_OPTIONS_ERROR; + + return fd->props_decode( + &filter->options, allocator, props, props_size); +} diff --git a/liblzma/common/filter_decoder.h b/liblzma/common/filter_decoder.h new file mode 100644 index 0000000..d5c68bd --- /dev/null +++ b/liblzma/common/filter_decoder.h @@ -0,0 +1,23 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file filter_decoder.c +/// \brief Filter ID mapping to filter-specific functions +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_FILTER_DECODER_H +#define LZMA_FILTER_DECODER_H + +#include "common.h" + + +extern lzma_ret lzma_raw_decoder_init( + lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter *options); + +#endif diff --git a/liblzma/common/filter_encoder.c b/liblzma/common/filter_encoder.c new file mode 100644 index 0000000..635d812 --- /dev/null +++ b/liblzma/common/filter_encoder.c @@ -0,0 +1,288 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file filter_decoder.c +/// \brief Filter ID mapping to filter-specific functions +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "filter_encoder.h" +#include "filter_common.h" +#include "lzma_encoder.h" +#include "lzma2_encoder.h" +#include "simple_encoder.h" +#include "delta_encoder.h" + + +typedef struct { + /// Filter ID + lzma_vli id; + + /// Initializes the filter encoder and calls lzma_next_filter_init() + /// for filters + 1. + lzma_init_function init; + + /// Calculates memory usage of the encoder. If the options are + /// invalid, UINT64_MAX is returned. + uint64_t (*memusage)(const void *options); + + /// Calculates the minimum sane size for Blocks (or other types of + /// chunks) to which the input data can be split to make + /// multithreaded encoding possible. If this is NULL, it is assumed + /// that the encoder is fast enough with single thread. + lzma_vli (*chunk_size)(const void *options); + + /// Tells the size of the Filter Properties field. If options are + /// invalid, UINT32_MAX is returned. If this is NULL, props_size_fixed + /// is used. + lzma_ret (*props_size_get)(uint32_t *size, const void *options); + uint32_t props_size_fixed; + + /// Encodes Filter Properties. + /// + /// \return - LZMA_OK: Properties encoded successfully. + /// - LZMA_OPTIONS_ERROR: Unsupported options + /// - LZMA_PROG_ERROR: Invalid options or not enough + /// output space + lzma_ret (*props_encode)(const void *options, uint8_t *out); + +} lzma_filter_encoder; + + +static const lzma_filter_encoder encoders[] = { +#ifdef HAVE_ENCODER_LZMA1 + { + .id = LZMA_FILTER_LZMA1, + .init = &lzma_lzma_encoder_init, + .memusage = &lzma_lzma_encoder_memusage, + .chunk_size = NULL, // FIXME + .props_size_get = NULL, + .props_size_fixed = 5, + .props_encode = &lzma_lzma_props_encode, + }, +#endif +#ifdef HAVE_ENCODER_LZMA2 + { + .id = LZMA_FILTER_LZMA2, + .init = &lzma_lzma2_encoder_init, + .memusage = &lzma_lzma2_encoder_memusage, + .chunk_size = NULL, // FIXME + .props_size_get = NULL, + .props_size_fixed = 1, + .props_encode = &lzma_lzma2_props_encode, + }, +#endif +#ifdef HAVE_ENCODER_X86 + { + .id = LZMA_FILTER_X86, + .init = &lzma_simple_x86_encoder_init, + .memusage = NULL, + .chunk_size = NULL, + .props_size_get = &lzma_simple_props_size, + .props_encode = &lzma_simple_props_encode, + }, +#endif +#ifdef HAVE_ENCODER_POWERPC + { + .id = LZMA_FILTER_POWERPC, + .init = &lzma_simple_powerpc_encoder_init, + .memusage = NULL, + .chunk_size = NULL, + .props_size_get = &lzma_simple_props_size, + .props_encode = &lzma_simple_props_encode, + }, +#endif +#ifdef HAVE_ENCODER_IA64 + { + .id = LZMA_FILTER_IA64, + .init = &lzma_simple_ia64_encoder_init, + .memusage = NULL, + .chunk_size = NULL, + .props_size_get = &lzma_simple_props_size, + .props_encode = &lzma_simple_props_encode, + }, +#endif +#ifdef HAVE_ENCODER_ARM + { + .id = LZMA_FILTER_ARM, + .init = &lzma_simple_arm_encoder_init, + .memusage = NULL, + .chunk_size = NULL, + .props_size_get = &lzma_simple_props_size, + .props_encode = &lzma_simple_props_encode, + }, +#endif +#ifdef HAVE_ENCODER_ARMTHUMB + { + .id = LZMA_FILTER_ARMTHUMB, + .init = &lzma_simple_armthumb_encoder_init, + .memusage = NULL, + .chunk_size = NULL, + .props_size_get = &lzma_simple_props_size, + .props_encode = &lzma_simple_props_encode, + }, +#endif +#ifdef HAVE_ENCODER_SPARC + { + .id = LZMA_FILTER_SPARC, + .init = &lzma_simple_sparc_encoder_init, + .memusage = NULL, + .chunk_size = NULL, + .props_size_get = &lzma_simple_props_size, + .props_encode = &lzma_simple_props_encode, + }, +#endif +#ifdef HAVE_ENCODER_DELTA + { + .id = LZMA_FILTER_DELTA, + .init = &lzma_delta_encoder_init, + .memusage = &lzma_delta_coder_memusage, + .chunk_size = NULL, + .props_size_get = NULL, + .props_size_fixed = 1, + .props_encode = &lzma_delta_props_encode, + }, +#endif +}; + + +static const lzma_filter_encoder * +encoder_find(lzma_vli id) +{ + for (size_t i = 0; i < ARRAY_SIZE(encoders); ++i) + if (encoders[i].id == id) + return encoders + i; + + return NULL; +} + + +extern LZMA_API(lzma_bool) +lzma_filter_encoder_is_supported(lzma_vli id) +{ + return encoder_find(id) != NULL; +} + + +extern LZMA_API(lzma_ret) +lzma_filters_update(lzma_stream *strm, const lzma_filter *filters) +{ + if (strm->internal->next.update == NULL) + return LZMA_PROG_ERROR; + + // Validate the filter chain. + if (lzma_raw_encoder_memusage(filters) == UINT64_MAX) + return LZMA_OPTIONS_ERROR; + + // The actual filter chain in the encoder is reversed. Some things + // still want the normal order chain, so we provide both. + size_t count = 1; + while (filters[count].id != LZMA_VLI_UNKNOWN) + ++count; + + lzma_filter reversed_filters[LZMA_FILTERS_MAX + 1]; + for (size_t i = 0; i < count; ++i) + reversed_filters[count - i - 1] = filters[i]; + + reversed_filters[count].id = LZMA_VLI_UNKNOWN; + + return strm->internal->next.update(strm->internal->next.coder, + strm->allocator, filters, reversed_filters); +} + + +extern lzma_ret +lzma_raw_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter *options) +{ + return lzma_raw_coder_init(next, allocator, + options, (lzma_filter_find)(&encoder_find), true); +} + + +extern LZMA_API(lzma_ret) +lzma_raw_encoder(lzma_stream *strm, const lzma_filter *options) +{ + lzma_next_strm_init(lzma_raw_coder_init, strm, options, + (lzma_filter_find)(&encoder_find), true); + + strm->internal->supported_actions[LZMA_RUN] = true; + strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true; + strm->internal->supported_actions[LZMA_FINISH] = true; + + return LZMA_OK; +} + + +extern LZMA_API(uint64_t) +lzma_raw_encoder_memusage(const lzma_filter *filters) +{ + return lzma_raw_coder_memusage( + (lzma_filter_find)(&encoder_find), filters); +} + + +/* +extern LZMA_API(lzma_vli) +lzma_chunk_size(const lzma_filter *filters) +{ + lzma_vli max = 0; + + for (size_t i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i) { + const lzma_filter_encoder *const fe + = encoder_find(filters[i].id); + if (fe->chunk_size != NULL) { + const lzma_vli size + = fe->chunk_size(filters[i].options); + if (size == LZMA_VLI_UNKNOWN) + return LZMA_VLI_UNKNOWN; + + if (size > max) + max = size; + } + } + + return max; +} +*/ + + +extern LZMA_API(lzma_ret) +lzma_properties_size(uint32_t *size, const lzma_filter *filter) +{ + const lzma_filter_encoder *const fe = encoder_find(filter->id); + if (fe == NULL) { + // Unknown filter - if the Filter ID is a proper VLI, + // return LZMA_OPTIONS_ERROR instead of LZMA_PROG_ERROR, + // because it's possible that we just don't have support + // compiled in for the requested filter. + return filter->id <= LZMA_VLI_MAX + ? LZMA_OPTIONS_ERROR : LZMA_PROG_ERROR; + } + + if (fe->props_size_get == NULL) { + // No props_size_get() function, use props_size_fixed. + *size = fe->props_size_fixed; + return LZMA_OK; + } + + return fe->props_size_get(size, filter->options); +} + + +extern LZMA_API(lzma_ret) +lzma_properties_encode(const lzma_filter *filter, uint8_t *props) +{ + const lzma_filter_encoder *const fe = encoder_find(filter->id); + if (fe == NULL) + return LZMA_PROG_ERROR; + + if (fe->props_encode == NULL) + return LZMA_OK; + + return fe->props_encode(filter->options, props); +} diff --git a/liblzma/common/filter_encoder.h b/liblzma/common/filter_encoder.h new file mode 100644 index 0000000..5bc137f --- /dev/null +++ b/liblzma/common/filter_encoder.h @@ -0,0 +1,27 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file filter_encoder.c +/// \brief Filter ID mapping to filter-specific functions +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_FILTER_ENCODER_H +#define LZMA_FILTER_ENCODER_H + +#include "common.h" + + +// FIXME: Might become a part of the public API once finished. +// extern lzma_vli lzma_chunk_size(const lzma_filter *filters); + + +extern lzma_ret lzma_raw_encoder_init( + lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter *filters); + +#endif diff --git a/liblzma/common/filter_flags_decoder.c b/liblzma/common/filter_flags_decoder.c new file mode 100644 index 0000000..caae10c --- /dev/null +++ b/liblzma/common/filter_flags_decoder.c @@ -0,0 +1,46 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file filter_flags_decoder.c +/// \brief Decodes a Filter Flags field +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "filter_decoder.h" + + +extern LZMA_API(lzma_ret) +lzma_filter_flags_decode( + lzma_filter *filter, lzma_allocator *allocator, + const uint8_t *in, size_t *in_pos, size_t in_size) +{ + // Set the pointer to NULL so the caller can always safely free it. + filter->options = NULL; + + // Filter ID + return_if_error(lzma_vli_decode(&filter->id, NULL, + in, in_pos, in_size)); + + if (filter->id >= LZMA_FILTER_RESERVED_START) + return LZMA_DATA_ERROR; + + // Size of Properties + lzma_vli props_size; + return_if_error(lzma_vli_decode(&props_size, NULL, + in, in_pos, in_size)); + + // Filter Properties + if (in_size - *in_pos < props_size) + return LZMA_DATA_ERROR; + + const lzma_ret ret = lzma_properties_decode( + filter, allocator, in + *in_pos, props_size); + + *in_pos += props_size; + + return ret; +} diff --git a/liblzma/common/filter_flags_encoder.c b/liblzma/common/filter_flags_encoder.c new file mode 100644 index 0000000..d110566 --- /dev/null +++ b/liblzma/common/filter_flags_encoder.c @@ -0,0 +1,56 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file filter_flags_encoder.c +/// \brief Decodes a Filter Flags field +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "filter_encoder.h" + + +extern LZMA_API(lzma_ret) +lzma_filter_flags_size(uint32_t *size, const lzma_filter *filter) +{ + if (filter->id >= LZMA_FILTER_RESERVED_START) + return LZMA_PROG_ERROR; + + return_if_error(lzma_properties_size(size, filter)); + + *size += lzma_vli_size(filter->id) + lzma_vli_size(*size); + + return LZMA_OK; +} + + +extern LZMA_API(lzma_ret) +lzma_filter_flags_encode(const lzma_filter *filter, + uint8_t *out, size_t *out_pos, size_t out_size) +{ + // Filter ID + if (filter->id >= LZMA_FILTER_RESERVED_START) + return LZMA_PROG_ERROR; + + return_if_error(lzma_vli_encode(filter->id, NULL, + out, out_pos, out_size)); + + // Size of Properties + uint32_t props_size; + return_if_error(lzma_properties_size(&props_size, filter)); + return_if_error(lzma_vli_encode(props_size, NULL, + out, out_pos, out_size)); + + // Filter Properties + if (out_size - *out_pos < props_size) + return LZMA_PROG_ERROR; + + return_if_error(lzma_properties_encode(filter, out + *out_pos)); + + *out_pos += props_size; + + return LZMA_OK; +} diff --git a/liblzma/common/hardware_physmem.c b/liblzma/common/hardware_physmem.c new file mode 100644 index 0000000..7405b65 --- /dev/null +++ b/liblzma/common/hardware_physmem.c @@ -0,0 +1,25 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file hardware_physmem.c +/// \brief Get the total amount of physical memory (RAM) +// +// Author: Jonathan Nieder +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "common.h" + +#include "tuklib_physmem.h" + + +extern LZMA_API(uint64_t) +lzma_physmem(void) +{ + // It is simpler to make lzma_physmem() a wrapper for + // tuklib_physmem() than to hack appropriate symbol visiblity + // support for the tuklib modules. + return tuklib_physmem(); +} diff --git a/liblzma/common/index.c b/liblzma/common/index.c new file mode 100644 index 0000000..9af4bc1 --- /dev/null +++ b/liblzma/common/index.c @@ -0,0 +1,1244 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file index.c +/// \brief Handling of .xz Indexes and some other Stream information +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "index.h" +#include "stream_flags_common.h" + + +/// \brief How many Records to allocate at once +/// +/// This should be big enough to avoid making lots of tiny allocations +/// but small enough to avoid too much unused memory at once. +#define INDEX_GROUP_SIZE 512 + + +/// \brief How many Records can be allocated at once at maximum +#define PREALLOC_MAX ((SIZE_MAX - sizeof(index_group)) / sizeof(index_record)) + + +/// \brief Base structure for index_stream and index_group structures +typedef struct index_tree_node_s index_tree_node; +struct index_tree_node_s { + /// Uncompressed start offset of this Stream (relative to the + /// beginning of the file) or Block (relative to the beginning + /// of the Stream) + lzma_vli uncompressed_base; + + /// Compressed start offset of this Stream or Block + lzma_vli compressed_base; + + index_tree_node *parent; + index_tree_node *left; + index_tree_node *right; +}; + + +/// \brief AVL tree to hold index_stream or index_group structures +typedef struct { + /// Root node + index_tree_node *root; + + /// Leftmost node. Since the tree will be filled sequentially, + /// this won't change after the first node has been added to + /// the tree. + index_tree_node *leftmost; + + /// The rightmost node in the tree. Since the tree is filled + /// sequentially, this is always the node where to add the new data. + index_tree_node *rightmost; + + /// Number of nodes in the tree + uint32_t count; + +} index_tree; + + +typedef struct { + lzma_vli uncompressed_sum; + lzma_vli unpadded_sum; +} index_record; + + +typedef struct { + /// Every Record group is part of index_stream.groups tree. + index_tree_node node; + + /// Number of Blocks in this Stream before this group. + lzma_vli number_base; + + /// Number of Records that can be put in records[]. + size_t allocated; + + /// Index of the last Record in use. + size_t last; + + /// The sizes in this array are stored as cumulative sums relative + /// to the beginning of the Stream. This makes it possible to + /// use binary search in lzma_index_locate(). + /// + /// Note that the cumulative summing is done specially for + /// unpadded_sum: The previous value is rounded up to the next + /// multiple of four before adding the Unpadded Size of the new + /// Block. The total encoded size of the Blocks in the Stream + /// is records[last].unpadded_sum in the last Record group of + /// the Stream. + /// + /// For example, if the Unpadded Sizes are 39, 57, and 81, the + /// stored values are 39, 97 (40 + 57), and 181 (100 + 181). + /// The total encoded size of these Blocks is 184. + /// + /// This is a flexible array, because it makes easy to optimize + /// memory usage in case someone concatenates many Streams that + /// have only one or few Blocks. + index_record records[]; + +} index_group; + + +typedef struct { + /// Every index_stream is a node in the tree of Sreams. + index_tree_node node; + + /// Number of this Stream (first one is 1) + uint32_t number; + + /// Total number of Blocks before this Stream + lzma_vli block_number_base; + + /// Record groups of this Stream are stored in a tree. + /// It's a T-tree with AVL-tree balancing. There are + /// INDEX_GROUP_SIZE Records per node by default. + /// This keeps the number of memory allocations reasonable + /// and finding a Record is fast. + index_tree groups; + + /// Number of Records in this Stream + lzma_vli record_count; + + /// Size of the List of Records field in this Stream. This is used + /// together with record_count to calculate the size of the Index + /// field and thus the total size of the Stream. + lzma_vli index_list_size; + + /// Stream Flags of this Stream. This is meaningful only if + /// the Stream Flags have been told us with lzma_index_stream_flags(). + /// Initially stream_flags.version is set to UINT32_MAX to indicate + /// that the Stream Flags are unknown. + lzma_stream_flags stream_flags; + + /// Amount of Stream Padding after this Stream. This defaults to + /// zero and can be set with lzma_index_stream_padding(). + lzma_vli stream_padding; + +} index_stream; + + +struct lzma_index_s { + /// AVL-tree containing the Stream(s). Often there is just one + /// Stream, but using a tree keeps lookups fast even when there + /// are many concatenated Streams. + index_tree streams; + + /// Uncompressed size of all the Blocks in the Stream(s) + lzma_vli uncompressed_size; + + /// Total size of all the Blocks in the Stream(s) + lzma_vli total_size; + + /// Total number of Records in all Streams in this lzma_index + lzma_vli record_count; + + /// Size of the List of Records field if all the Streams in this + /// lzma_index were packed into a single Stream (makes it simpler to + /// take many .xz files and combine them into a single Stream). + /// + /// This value together with record_count is needed to calculate + /// Backward Size that is stored into Stream Footer. + lzma_vli index_list_size; + + /// How many Records to allocate at once in lzma_index_append(). + /// This defaults to INDEX_GROUP_SIZE but can be overriden with + /// lzma_index_prealloc(). + size_t prealloc; + + /// Bitmask indicating what integrity check types have been used + /// as set by lzma_index_stream_flags(). The bit of the last Stream + /// is not included here, since it is possible to change it by + /// calling lzma_index_stream_flags() again. + uint32_t checks; +}; + + +static void +index_tree_init(index_tree *tree) +{ + tree->root = NULL; + tree->leftmost = NULL; + tree->rightmost = NULL; + tree->count = 0; + return; +} + + +/// Helper for index_tree_end() +static void +index_tree_node_end(index_tree_node *node, lzma_allocator *allocator, + void (*free_func)(void *node, lzma_allocator *allocator)) +{ + // The tree won't ever be very huge, so recursion should be fine. + // 20 levels in the tree is likely quite a lot already in practice. + if (node->left != NULL) + index_tree_node_end(node->left, allocator, free_func); + + if (node->right != NULL) + index_tree_node_end(node->right, allocator, free_func); + + if (free_func != NULL) + free_func(node, allocator); + + lzma_free(node, allocator); + return; +} + + +/// Free the meory allocated for a tree. If free_func is not NULL, +/// it is called on each node before freeing the node. This is used +/// to free the Record groups from each index_stream before freeing +/// the index_stream itself. +static void +index_tree_end(index_tree *tree, lzma_allocator *allocator, + void (*free_func)(void *node, lzma_allocator *allocator)) +{ + if (tree->root != NULL) + index_tree_node_end(tree->root, allocator, free_func); + + return; +} + + +/// Add a new node to the tree. node->uncompressed_base and +/// node->compressed_base must have been set by the caller already. +static void +index_tree_append(index_tree *tree, index_tree_node *node) +{ + node->parent = tree->rightmost; + node->left = NULL; + node->right = NULL; + + ++tree->count; + + // Handle the special case of adding the first node. + if (tree->root == NULL) { + tree->root = node; + tree->leftmost = node; + tree->rightmost = node; + return; + } + + // The tree is always filled sequentially. + assert(tree->rightmost->uncompressed_base <= node->uncompressed_base); + assert(tree->rightmost->compressed_base < node->compressed_base); + + // Add the new node after the rightmost node. It's the correct + // place due to the reason above. + tree->rightmost->right = node; + tree->rightmost = node; + + // Balance the AVL-tree if needed. We don't need to keep the balance + // factors in nodes, because we always fill the tree sequentially, + // and thus know the state of the tree just by looking at the node + // count. From the node count we can calculate how many steps to go + // up in the tree to find the rotation root. + uint32_t up = tree->count ^ (UINT32_C(1) << bsr32(tree->count)); + if (up != 0) { + // Locate the root node for the rotation. + up = ctz32(tree->count) + 2; + do { + node = node->parent; + } while (--up > 0); + + // Rotate left using node as the rotation root. + index_tree_node *pivot = node->right; + + if (node->parent == NULL) { + tree->root = pivot; + } else { + assert(node->parent->right == node); + node->parent->right = pivot; + } + + pivot->parent = node->parent; + + node->right = pivot->left; + if (node->right != NULL) + node->right->parent = node; + + pivot->left = node; + node->parent = pivot; + } + + return; +} + + +/// Get the next node in the tree. Return NULL if there are no more nodes. +static void * +index_tree_next(const index_tree_node *node) +{ + if (node->right != NULL) { + node = node->right; + while (node->left != NULL) + node = node->left; + + return (void *)(node); + } + + while (node->parent != NULL && node->parent->right == node) + node = node->parent; + + return (void *)(node->parent); +} + + +/// Locate a node that contains the given uncompressed offset. It is +/// caller's job to check that target is not bigger than the uncompressed +/// size of the tree (the last node would be returned in that case still). +static void * +index_tree_locate(const index_tree *tree, lzma_vli target) +{ + const index_tree_node *result = NULL; + const index_tree_node *node = tree->root; + + assert(tree->leftmost == NULL + || tree->leftmost->uncompressed_base == 0); + + // Consecutive nodes may have the same uncompressed_base. + // We must pick the rightmost one. + while (node != NULL) { + if (node->uncompressed_base > target) { + node = node->left; + } else { + result = node; + node = node->right; + } + } + + return (void *)(result); +} + + +/// Allocate and initialize a new Stream using the given base offsets. +static index_stream * +index_stream_init(lzma_vli compressed_base, lzma_vli uncompressed_base, + lzma_vli stream_number, lzma_vli block_number_base, + lzma_allocator *allocator) +{ + index_stream *s = lzma_alloc(sizeof(index_stream), allocator); + if (s == NULL) + return NULL; + + s->node.uncompressed_base = uncompressed_base; + s->node.compressed_base = compressed_base; + s->node.parent = NULL; + s->node.left = NULL; + s->node.right = NULL; + + s->number = stream_number; + s->block_number_base = block_number_base; + + index_tree_init(&s->groups); + + s->record_count = 0; + s->index_list_size = 0; + s->stream_flags.version = UINT32_MAX; + s->stream_padding = 0; + + return s; +} + + +/// Free the memory allocated for a Stream and its Record groups. +static void +index_stream_end(void *node, lzma_allocator *allocator) +{ + index_stream *s = node; + index_tree_end(&s->groups, allocator, NULL); + return; +} + + +static lzma_index * +index_init_plain(lzma_allocator *allocator) +{ + lzma_index *i = lzma_alloc(sizeof(lzma_index), allocator); + if (i != NULL) { + index_tree_init(&i->streams); + i->uncompressed_size = 0; + i->total_size = 0; + i->record_count = 0; + i->index_list_size = 0; + i->prealloc = INDEX_GROUP_SIZE; + i->checks = 0; + } + + return i; +} + + +extern LZMA_API(lzma_index *) +lzma_index_init(lzma_allocator *allocator) +{ + lzma_index *i = index_init_plain(allocator); + if (i == NULL) + return NULL; + + index_stream *s = index_stream_init(0, 0, 1, 0, allocator); + if (s == NULL) { + lzma_free(i, allocator); + return NULL; + } + + index_tree_append(&i->streams, &s->node); + + return i; +} + + +extern LZMA_API(void) +lzma_index_end(lzma_index *i, lzma_allocator *allocator) +{ + // NOTE: If you modify this function, check also the bottom + // of lzma_index_cat(). + if (i != NULL) { + index_tree_end(&i->streams, allocator, &index_stream_end); + lzma_free(i, allocator); + } + + return; +} + + +extern void +lzma_index_prealloc(lzma_index *i, lzma_vli records) +{ + if (records > PREALLOC_MAX) + records = PREALLOC_MAX; + + i->prealloc = (size_t)(records); + return; +} + + +extern LZMA_API(uint64_t) +lzma_index_memusage(lzma_vli streams, lzma_vli blocks) +{ + // This calculates an upper bound that is only a little bit + // bigger than the exact maximum memory usage with the given + // parameters. + + // Typical malloc() overhead is 2 * sizeof(void *) but we take + // a little bit extra just in case. Using LZMA_MEMUSAGE_BASE + // instead would give too inaccurate estimate. + const size_t alloc_overhead = 4 * sizeof(void *); + + // Amount of memory needed for each Stream base structures. + // We assume that every Stream has at least one Block and + // thus at least one group. + const size_t stream_base = sizeof(index_stream) + + sizeof(index_group) + 2 * alloc_overhead; + + // Amount of memory needed per group. + const size_t group_base = sizeof(index_group) + + INDEX_GROUP_SIZE * sizeof(index_record) + + alloc_overhead; + + // Number of groups. There may actually be more, but that overhead + // has been taken into account in stream_base already. + const lzma_vli groups + = (blocks + INDEX_GROUP_SIZE - 1) / INDEX_GROUP_SIZE; + + // Memory used by index_stream and index_group structures. + const uint64_t streams_mem = streams * stream_base; + const uint64_t groups_mem = groups * group_base; + + // Memory used by the base structure. + const uint64_t index_base = sizeof(lzma_index) + alloc_overhead; + + // Validate the arguments and catch integer overflows. + // Maximum number of Streams is "only" UINT32_MAX, because + // that limit is used by the tree containing the Streams. + const uint64_t limit = UINT64_MAX - index_base; + if (streams == 0 || streams > UINT32_MAX || blocks > LZMA_VLI_MAX + || streams > limit / stream_base + || groups > limit / group_base + || limit - streams_mem < groups_mem) + return UINT64_MAX; + + return index_base + streams_mem + groups_mem; +} + + +extern LZMA_API(uint64_t) +lzma_index_memused(const lzma_index *i) +{ + return lzma_index_memusage(i->streams.count, i->record_count); +} + + +extern LZMA_API(lzma_vli) +lzma_index_block_count(const lzma_index *i) +{ + return i->record_count; +} + + +extern LZMA_API(lzma_vli) +lzma_index_stream_count(const lzma_index *i) +{ + return i->streams.count; +} + + +extern LZMA_API(lzma_vli) +lzma_index_size(const lzma_index *i) +{ + return index_size(i->record_count, i->index_list_size); +} + + +extern LZMA_API(lzma_vli) +lzma_index_total_size(const lzma_index *i) +{ + return i->total_size; +} + + +extern LZMA_API(lzma_vli) +lzma_index_stream_size(const lzma_index *i) +{ + // Stream Header + Blocks + Index + Stream Footer + return LZMA_STREAM_HEADER_SIZE + i->total_size + + index_size(i->record_count, i->index_list_size) + + LZMA_STREAM_HEADER_SIZE; +} + + +static lzma_vli +index_file_size(lzma_vli compressed_base, lzma_vli unpadded_sum, + lzma_vli record_count, lzma_vli index_list_size, + lzma_vli stream_padding) +{ + // Earlier Streams and Stream Paddings + Stream Header + // + Blocks + Index + Stream Footer + Stream Padding + // + // This might go over LZMA_VLI_MAX due to too big unpadded_sum + // when this function is used in lzma_index_append(). + lzma_vli file_size = compressed_base + 2 * LZMA_STREAM_HEADER_SIZE + + stream_padding + vli_ceil4(unpadded_sum); + if (file_size > LZMA_VLI_MAX) + return LZMA_VLI_UNKNOWN; + + // The same applies here. + file_size += index_size(record_count, index_list_size); + if (file_size > LZMA_VLI_MAX) + return LZMA_VLI_UNKNOWN; + + return file_size; +} + + +extern LZMA_API(lzma_vli) +lzma_index_file_size(const lzma_index *i) +{ + const index_stream *s = (const index_stream *)(i->streams.rightmost); + const index_group *g = (const index_group *)(s->groups.rightmost); + return index_file_size(s->node.compressed_base, + g == NULL ? 0 : g->records[g->last].unpadded_sum, + s->record_count, s->index_list_size, + s->stream_padding); +} + + +extern LZMA_API(lzma_vli) +lzma_index_uncompressed_size(const lzma_index *i) +{ + return i->uncompressed_size; +} + + +extern LZMA_API(uint32_t) +lzma_index_checks(const lzma_index *i) +{ + uint32_t checks = i->checks; + + // Get the type of the Check of the last Stream too. + const index_stream *s = (const index_stream *)(i->streams.rightmost); + if (s->stream_flags.version != UINT32_MAX) + checks |= UINT32_C(1) << s->stream_flags.check; + + return checks; +} + + +extern uint32_t +lzma_index_padding_size(const lzma_index *i) +{ + return (LZMA_VLI_C(4) - index_size_unpadded( + i->record_count, i->index_list_size)) & 3; +} + + +extern LZMA_API(lzma_ret) +lzma_index_stream_flags(lzma_index *i, const lzma_stream_flags *stream_flags) +{ + if (i == NULL || stream_flags == NULL) + return LZMA_PROG_ERROR; + + // Validate the Stream Flags. + return_if_error(lzma_stream_flags_compare( + stream_flags, stream_flags)); + + index_stream *s = (index_stream *)(i->streams.rightmost); + s->stream_flags = *stream_flags; + + return LZMA_OK; +} + + +extern LZMA_API(lzma_ret) +lzma_index_stream_padding(lzma_index *i, lzma_vli stream_padding) +{ + if (i == NULL || stream_padding > LZMA_VLI_MAX + || (stream_padding & 3) != 0) + return LZMA_PROG_ERROR; + + index_stream *s = (index_stream *)(i->streams.rightmost); + + // Check that the new value won't make the file grow too big. + const lzma_vli old_stream_padding = s->stream_padding; + s->stream_padding = 0; + if (lzma_index_file_size(i) + stream_padding > LZMA_VLI_MAX) { + s->stream_padding = old_stream_padding; + return LZMA_DATA_ERROR; + } + + s->stream_padding = stream_padding; + return LZMA_OK; +} + + +extern LZMA_API(lzma_ret) +lzma_index_append(lzma_index *i, lzma_allocator *allocator, + lzma_vli unpadded_size, lzma_vli uncompressed_size) +{ + // Validate. + if (i == NULL || unpadded_size < UNPADDED_SIZE_MIN + || unpadded_size > UNPADDED_SIZE_MAX + || uncompressed_size > LZMA_VLI_MAX) + return LZMA_PROG_ERROR; + + index_stream *s = (index_stream *)(i->streams.rightmost); + index_group *g = (index_group *)(s->groups.rightmost); + + const lzma_vli compressed_base = g == NULL ? 0 + : vli_ceil4(g->records[g->last].unpadded_sum); + const lzma_vli uncompressed_base = g == NULL ? 0 + : g->records[g->last].uncompressed_sum; + const uint32_t index_list_size_add = lzma_vli_size(unpadded_size) + + lzma_vli_size(uncompressed_size); + + // Check that the file size will stay within limits. + if (index_file_size(s->node.compressed_base, + compressed_base + unpadded_size, s->record_count + 1, + s->index_list_size + index_list_size_add, + s->stream_padding) == LZMA_VLI_UNKNOWN) + return LZMA_DATA_ERROR; + + // The size of the Index field must not exceed the maximum value + // that can be stored in the Backward Size field. + if (index_size(i->record_count + 1, + i->index_list_size + index_list_size_add) + > LZMA_BACKWARD_SIZE_MAX) + return LZMA_DATA_ERROR; + + if (g != NULL && g->last + 1 < g->allocated) { + // There is space in the last group at least for one Record. + ++g->last; + } else { + // We need to allocate a new group. + g = lzma_alloc(sizeof(index_group) + + i->prealloc * sizeof(index_record), + allocator); + if (g == NULL) + return LZMA_MEM_ERROR; + + g->last = 0; + g->allocated = i->prealloc; + + // Reset prealloc so that if the application happens to + // add new Records, the allocation size will be sane. + i->prealloc = INDEX_GROUP_SIZE; + + // Set the start offsets of this group. + g->node.uncompressed_base = uncompressed_base; + g->node.compressed_base = compressed_base; + g->number_base = s->record_count + 1; + + // Add the new group to the Stream. + index_tree_append(&s->groups, &g->node); + } + + // Add the new Record to the group. + g->records[g->last].uncompressed_sum + = uncompressed_base + uncompressed_size; + g->records[g->last].unpadded_sum + = compressed_base + unpadded_size; + + // Update the totals. + ++s->record_count; + s->index_list_size += index_list_size_add; + + i->total_size += vli_ceil4(unpadded_size); + i->uncompressed_size += uncompressed_size; + ++i->record_count; + i->index_list_size += index_list_size_add; + + return LZMA_OK; +} + + +/// Structure to pass info to index_cat_helper() +typedef struct { + /// Uncompressed size of the destination + lzma_vli uncompressed_size; + + /// Compressed file size of the destination + lzma_vli file_size; + + /// Same as above but for Block numbers + lzma_vli block_number_add; + + /// Number of Streams that were in the destination index before we + /// started appending new Streams from the source index. This is + /// used to fix the Stream numbering. + uint32_t stream_number_add; + + /// Destination index' Stream tree + index_tree *streams; + +} index_cat_info; + + +/// Add the Stream nodes from the source index to dest using recursion. +/// Simplest iterative traversal of the source tree wouldn't work, because +/// we update the pointers in nodes when moving them to the destination tree. +static void +index_cat_helper(const index_cat_info *info, index_stream *this) +{ + index_stream *left = (index_stream *)(this->node.left); + index_stream *right = (index_stream *)(this->node.right); + + if (left != NULL) + index_cat_helper(info, left); + + this->node.uncompressed_base += info->uncompressed_size; + this->node.compressed_base += info->file_size; + this->number += info->stream_number_add; + this->block_number_base += info->block_number_add; + index_tree_append(info->streams, &this->node); + + if (right != NULL) + index_cat_helper(info, right); + + return; +} + + +extern LZMA_API(lzma_ret) +lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src, + lzma_allocator *allocator) +{ + const lzma_vli dest_file_size = lzma_index_file_size(dest); + + // Check that we don't exceed the file size limits. + if (dest_file_size + lzma_index_file_size(src) > LZMA_VLI_MAX + || dest->uncompressed_size + src->uncompressed_size + > LZMA_VLI_MAX) + return LZMA_DATA_ERROR; + + // Check that the encoded size of the combined lzma_indexes stays + // within limits. In theory, this should be done only if we know + // that the user plans to actually combine the Streams and thus + // construct a single Index (probably rare). However, exceeding + // this limit is quite theoretical, so we do this check always + // to simplify things elsewhere. + { + const lzma_vli dest_size = index_size_unpadded( + dest->record_count, dest->index_list_size); + const lzma_vli src_size = index_size_unpadded( + src->record_count, src->index_list_size); + if (vli_ceil4(dest_size + src_size) > LZMA_BACKWARD_SIZE_MAX) + return LZMA_DATA_ERROR; + } + + // Optimize the last group to minimize memory usage. Allocation has + // to be done before modifying dest or src. + { + index_stream *s = (index_stream *)(dest->streams.rightmost); + index_group *g = (index_group *)(s->groups.rightmost); + if (g != NULL && g->last + 1 < g->allocated) { + assert(g->node.left == NULL); + assert(g->node.right == NULL); + + index_group *newg = lzma_alloc(sizeof(index_group) + + (g->last + 1) + * sizeof(index_record), + allocator); + if (newg == NULL) + return LZMA_MEM_ERROR; + + newg->node = g->node; + newg->allocated = g->last + 1; + newg->last = g->last; + newg->number_base = g->number_base; + + memcpy(newg->records, g->records, newg->allocated + * sizeof(index_record)); + + if (g->node.parent != NULL) { + assert(g->node.parent->right == &g->node); + g->node.parent->right = &newg->node; + } + + if (s->groups.leftmost == &g->node) { + assert(s->groups.root == &g->node); + s->groups.leftmost = &newg->node; + s->groups.root = &newg->node; + } + + if (s->groups.rightmost == &g->node) + s->groups.rightmost = &newg->node; + + lzma_free(g, allocator); + } + } + + // Add all the Streams from src to dest. Update the base offsets + // of each Stream from src. + const index_cat_info info = { + .uncompressed_size = dest->uncompressed_size, + .file_size = dest_file_size, + .stream_number_add = dest->streams.count, + .block_number_add = dest->record_count, + .streams = &dest->streams, + }; + index_cat_helper(&info, (index_stream *)(src->streams.root)); + + // Update info about all the combined Streams. + dest->uncompressed_size += src->uncompressed_size; + dest->total_size += src->total_size; + dest->record_count += src->record_count; + dest->index_list_size += src->index_list_size; + dest->checks = lzma_index_checks(dest) | src->checks; + + // There's nothing else left in src than the base structure. + lzma_free(src, allocator); + + return LZMA_OK; +} + + +/// Duplicate an index_stream. +static index_stream * +index_dup_stream(const index_stream *src, lzma_allocator *allocator) +{ + // Catch a somewhat theoretical integer overflow. + if (src->record_count > PREALLOC_MAX) + return NULL; + + // Allocate and initialize a new Stream. + index_stream *dest = index_stream_init(src->node.compressed_base, + src->node.uncompressed_base, src->number, + src->block_number_base, allocator); + + // Return immediately if allocation failed or if there are + // no groups to duplicate. + if (dest == NULL || src->groups.leftmost == NULL) + return dest; + + // Copy the overall information. + dest->record_count = src->record_count; + dest->index_list_size = src->index_list_size; + dest->stream_flags = src->stream_flags; + dest->stream_padding = src->stream_padding; + + // Allocate memory for the Records. We put all the Records into + // a single group. It's simplest and also tends to make + // lzma_index_locate() a little bit faster with very big Indexes. + index_group *destg = lzma_alloc(sizeof(index_group) + + src->record_count * sizeof(index_record), + allocator); + if (destg == NULL) { + index_stream_end(dest, allocator); + return NULL; + } + + // Initialize destg. + destg->node.uncompressed_base = 0; + destg->node.compressed_base = 0; + destg->number_base = 1; + destg->allocated = src->record_count; + destg->last = src->record_count - 1; + + // Go through all the groups in src and copy the Records into destg. + const index_group *srcg = (const index_group *)(src->groups.leftmost); + size_t i = 0; + do { + memcpy(destg->records + i, srcg->records, + (srcg->last + 1) * sizeof(index_record)); + i += srcg->last + 1; + srcg = index_tree_next(&srcg->node); + } while (srcg != NULL); + + assert(i == destg->allocated); + + // Add the group to the new Stream. + index_tree_append(&dest->groups, &destg->node); + + return dest; +} + + +extern LZMA_API(lzma_index *) +lzma_index_dup(const lzma_index *src, lzma_allocator *allocator) +{ + // Allocate the base structure (no initial Stream). + lzma_index *dest = index_init_plain(allocator); + if (dest == NULL) + return NULL; + + // Copy the totals. + dest->uncompressed_size = src->uncompressed_size; + dest->total_size = src->total_size; + dest->record_count = src->record_count; + dest->index_list_size = src->index_list_size; + + // Copy the Streams and the groups in them. + const index_stream *srcstream + = (const index_stream *)(src->streams.leftmost); + do { + index_stream *deststream = index_dup_stream( + srcstream, allocator); + if (deststream == NULL) { + lzma_index_end(dest, allocator); + return NULL; + } + + index_tree_append(&dest->streams, &deststream->node); + + srcstream = index_tree_next(&srcstream->node); + } while (srcstream != NULL); + + return dest; +} + + +/// Indexing for lzma_index_iter.internal[] +enum { + ITER_INDEX, + ITER_STREAM, + ITER_GROUP, + ITER_RECORD, + ITER_METHOD, +}; + + +/// Values for lzma_index_iter.internal[ITER_METHOD].s +enum { + ITER_METHOD_NORMAL, + ITER_METHOD_NEXT, + ITER_METHOD_LEFTMOST, +}; + + +static void +iter_set_info(lzma_index_iter *iter) +{ + const lzma_index *i = iter->internal[ITER_INDEX].p; + const index_stream *stream = iter->internal[ITER_STREAM].p; + const index_group *group = iter->internal[ITER_GROUP].p; + const size_t record = iter->internal[ITER_RECORD].s; + + // lzma_index_iter.internal must not contain a pointer to the last + // group in the index, because that may be reallocated by + // lzma_index_cat(). + if (group == NULL) { + // There are no groups. + assert(stream->groups.root == NULL); + iter->internal[ITER_METHOD].s = ITER_METHOD_LEFTMOST; + + } else if (i->streams.rightmost != &stream->node + || stream->groups.rightmost != &group->node) { + // The group is not not the last group in the index. + iter->internal[ITER_METHOD].s = ITER_METHOD_NORMAL; + + } else if (stream->groups.leftmost != &group->node) { + // The group isn't the only group in the Stream, thus we + // know that it must have a parent group i.e. it's not + // the root node. + assert(stream->groups.root != &group->node); + assert(group->node.parent->right == &group->node); + iter->internal[ITER_METHOD].s = ITER_METHOD_NEXT; + iter->internal[ITER_GROUP].p = group->node.parent; + + } else { + // The Stream has only one group. + assert(stream->groups.root == &group->node); + assert(group->node.parent == NULL); + iter->internal[ITER_METHOD].s = ITER_METHOD_LEFTMOST; + iter->internal[ITER_GROUP].p = NULL; + } + + iter->stream.number = stream->number; + iter->stream.block_count = stream->record_count; + iter->stream.compressed_offset = stream->node.compressed_base; + iter->stream.uncompressed_offset = stream->node.uncompressed_base; + + // iter->stream.flags will be NULL if the Stream Flags haven't been + // set with lzma_index_stream_flags(). + iter->stream.flags = stream->stream_flags.version == UINT32_MAX + ? NULL : &stream->stream_flags; + iter->stream.padding = stream->stream_padding; + + if (stream->groups.rightmost == NULL) { + // Stream has no Blocks. + iter->stream.compressed_size = index_size(0, 0) + + 2 * LZMA_STREAM_HEADER_SIZE; + iter->stream.uncompressed_size = 0; + } else { + const index_group *g = (const index_group *)( + stream->groups.rightmost); + + // Stream Header + Stream Footer + Index + Blocks + iter->stream.compressed_size = 2 * LZMA_STREAM_HEADER_SIZE + + index_size(stream->record_count, + stream->index_list_size) + + vli_ceil4(g->records[g->last].unpadded_sum); + iter->stream.uncompressed_size + = g->records[g->last].uncompressed_sum; + } + + if (group != NULL) { + iter->block.number_in_stream = group->number_base + record; + iter->block.number_in_file = iter->block.number_in_stream + + stream->block_number_base; + + iter->block.compressed_stream_offset + = record == 0 ? group->node.compressed_base + : vli_ceil4(group->records[ + record - 1].unpadded_sum); + iter->block.uncompressed_stream_offset + = record == 0 ? group->node.uncompressed_base + : group->records[record - 1].uncompressed_sum; + + iter->block.uncompressed_size + = group->records[record].uncompressed_sum + - iter->block.uncompressed_stream_offset; + iter->block.unpadded_size + = group->records[record].unpadded_sum + - iter->block.compressed_stream_offset; + iter->block.total_size = vli_ceil4(iter->block.unpadded_size); + + iter->block.compressed_stream_offset + += LZMA_STREAM_HEADER_SIZE; + + iter->block.compressed_file_offset + = iter->block.compressed_stream_offset + + iter->stream.compressed_offset; + iter->block.uncompressed_file_offset + = iter->block.uncompressed_stream_offset + + iter->stream.uncompressed_offset; + } + + return; +} + + +extern LZMA_API(void) +lzma_index_iter_init(lzma_index_iter *iter, const lzma_index *i) +{ + iter->internal[ITER_INDEX].p = i; + lzma_index_iter_rewind(iter); + return; +} + + +extern LZMA_API(void) +lzma_index_iter_rewind(lzma_index_iter *iter) +{ + iter->internal[ITER_STREAM].p = NULL; + iter->internal[ITER_GROUP].p = NULL; + iter->internal[ITER_RECORD].s = 0; + iter->internal[ITER_METHOD].s = ITER_METHOD_NORMAL; + return; +} + + +extern LZMA_API(lzma_bool) +lzma_index_iter_next(lzma_index_iter *iter, lzma_index_iter_mode mode) +{ + // Catch unsupported mode values. + if ((unsigned int)(mode) > LZMA_INDEX_ITER_NONEMPTY_BLOCK) + return true; + + const lzma_index *i = iter->internal[ITER_INDEX].p; + const index_stream *stream = iter->internal[ITER_STREAM].p; + const index_group *group = NULL; + size_t record = iter->internal[ITER_RECORD].s; + + // If we are being asked for the next Stream, leave group to NULL + // so that the rest of the this function thinks that this Stream + // has no groups and will thus go to the next Stream. + if (mode != LZMA_INDEX_ITER_STREAM) { + // Get the pointer to the current group. See iter_set_inf() + // for explanation. + switch (iter->internal[ITER_METHOD].s) { + case ITER_METHOD_NORMAL: + group = iter->internal[ITER_GROUP].p; + break; + + case ITER_METHOD_NEXT: + group = index_tree_next(iter->internal[ITER_GROUP].p); + break; + + case ITER_METHOD_LEFTMOST: + group = (const index_group *)( + stream->groups.leftmost); + break; + } + } + +again: + if (stream == NULL) { + // We at the beginning of the lzma_index. + // Locate the first Stream. + stream = (const index_stream *)(i->streams.leftmost); + if (mode >= LZMA_INDEX_ITER_BLOCK) { + // Since we are being asked to return information + // about the first a Block, skip Streams that have + // no Blocks. + while (stream->groups.leftmost == NULL) { + stream = index_tree_next(&stream->node); + if (stream == NULL) + return true; + } + } + + // Start from the first Record in the Stream. + group = (const index_group *)(stream->groups.leftmost); + record = 0; + + } else if (group != NULL && record < group->last) { + // The next Record is in the same group. + ++record; + + } else { + // This group has no more Records or this Stream has + // no Blocks at all. + record = 0; + + // If group is not NULL, this Stream has at least one Block + // and thus at least one group. Find the next group. + if (group != NULL) + group = index_tree_next(&group->node); + + if (group == NULL) { + // This Stream has no more Records. Find the next + // Stream. If we are being asked to return information + // about a Block, we skip empty Streams. + do { + stream = index_tree_next(&stream->node); + if (stream == NULL) + return true; + } while (mode >= LZMA_INDEX_ITER_BLOCK + && stream->groups.leftmost == NULL); + + group = (const index_group *)( + stream->groups.leftmost); + } + } + + if (mode == LZMA_INDEX_ITER_NONEMPTY_BLOCK) { + // We need to look for the next Block again if this Block + // is empty. + if (record == 0) { + if (group->node.uncompressed_base + == group->records[0].uncompressed_sum) + goto again; + } else if (group->records[record - 1].uncompressed_sum + == group->records[record].uncompressed_sum) { + goto again; + } + } + + iter->internal[ITER_STREAM].p = stream; + iter->internal[ITER_GROUP].p = group; + iter->internal[ITER_RECORD].s = record; + + iter_set_info(iter); + + return false; +} + + +extern LZMA_API(lzma_bool) +lzma_index_iter_locate(lzma_index_iter *iter, lzma_vli target) +{ + const lzma_index *i = iter->internal[ITER_INDEX].p; + + // If the target is past the end of the file, return immediately. + if (i->uncompressed_size <= target) + return true; + + // Locate the Stream containing the target offset. + const index_stream *stream = index_tree_locate(&i->streams, target); + assert(stream != NULL); + target -= stream->node.uncompressed_base; + + // Locate the group containing the target offset. + const index_group *group = index_tree_locate(&stream->groups, target); + assert(group != NULL); + + // Use binary search to locate the exact Record. It is the first + // Record whose uncompressed_sum is greater than target. + // This is because we want the rightmost Record that fullfills the + // search criterion. It is possible that there are empty Blocks; + // we don't want to return them. + size_t left = 0; + size_t right = group->last; + + while (left < right) { + const size_t pos = left + (right - left) / 2; + if (group->records[pos].uncompressed_sum <= target) + left = pos + 1; + else + right = pos; + } + + iter->internal[ITER_STREAM].p = stream; + iter->internal[ITER_GROUP].p = group; + iter->internal[ITER_RECORD].s = left; + + iter_set_info(iter); + + return false; +} diff --git a/liblzma/common/index.h b/liblzma/common/index.h new file mode 100644 index 0000000..64e9724 --- /dev/null +++ b/liblzma/common/index.h @@ -0,0 +1,73 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file index.h +/// \brief Handling of Index +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_INDEX_H +#define LZMA_INDEX_H + +#include "common.h" + + +/// Minimum Unpadded Size +#define UNPADDED_SIZE_MIN LZMA_VLI_C(5) + +/// Maximum Unpadded Size +#define UNPADDED_SIZE_MAX (LZMA_VLI_MAX & ~LZMA_VLI_C(3)) + + +/// Get the size of the Index Padding field. This is needed by Index encoder +/// and decoder, but applications should have no use for this. +extern uint32_t lzma_index_padding_size(const lzma_index *i); + + +/// Set for how many Records to allocate memory the next time +/// lzma_index_append() needs to allocate space for a new Record. +/// This is used only by the Index decoder. +extern void lzma_index_prealloc(lzma_index *i, lzma_vli records); + + +/// Round the variable-length integer to the next multiple of four. +static inline lzma_vli +vli_ceil4(lzma_vli vli) +{ + assert(vli <= LZMA_VLI_MAX); + return (vli + 3) & ~LZMA_VLI_C(3); +} + + +/// Calculate the size of the Index field excluding Index Padding +static inline lzma_vli +index_size_unpadded(lzma_vli count, lzma_vli index_list_size) +{ + // Index Indicator + Number of Records + List of Records + CRC32 + return 1 + lzma_vli_size(count) + index_list_size + 4; +} + + +/// Calculate the size of the Index field including Index Padding +static inline lzma_vli +index_size(lzma_vli count, lzma_vli index_list_size) +{ + return vli_ceil4(index_size_unpadded(count, index_list_size)); +} + + +/// Calculate the total size of the Stream +static inline lzma_vli +index_stream_size(lzma_vli blocks_size, + lzma_vli count, lzma_vli index_list_size) +{ + return LZMA_STREAM_HEADER_SIZE + blocks_size + + index_size(count, index_list_size) + + LZMA_STREAM_HEADER_SIZE; +} + +#endif diff --git a/liblzma/common/index_decoder.c b/liblzma/common/index_decoder.c new file mode 100644 index 0000000..83c8a3a --- /dev/null +++ b/liblzma/common/index_decoder.c @@ -0,0 +1,345 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file index_decoder.c +/// \brief Decodes the Index field +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "index.h" +#include "check.h" + + +struct lzma_coder_s { + enum { + SEQ_INDICATOR, + SEQ_COUNT, + SEQ_MEMUSAGE, + SEQ_UNPADDED, + SEQ_UNCOMPRESSED, + SEQ_PADDING_INIT, + SEQ_PADDING, + SEQ_CRC32, + } sequence; + + /// Memory usage limit + uint64_t memlimit; + + /// Target Index + lzma_index *index; + + /// Pointer give by the application, which is set after + /// successful decoding. + lzma_index **index_ptr; + + /// Number of Records left to decode. + lzma_vli count; + + /// The most recent Unpadded Size field + lzma_vli unpadded_size; + + /// The most recent Uncompressed Size field + lzma_vli uncompressed_size; + + /// Position in integers + size_t pos; + + /// CRC32 of the List of Records field + uint32_t crc32; +}; + + +static lzma_ret +index_decode(lzma_coder *coder, lzma_allocator *allocator, + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, + uint8_t *restrict out lzma_attribute((__unused__)), + size_t *restrict out_pos lzma_attribute((__unused__)), + size_t out_size lzma_attribute((__unused__)), + lzma_action action lzma_attribute((__unused__))) +{ + // Similar optimization as in index_encoder.c + const size_t in_start = *in_pos; + lzma_ret ret = LZMA_OK; + + while (*in_pos < in_size) + switch (coder->sequence) { + case SEQ_INDICATOR: + // Return LZMA_DATA_ERROR instead of e.g. LZMA_PROG_ERROR or + // LZMA_FORMAT_ERROR, because a typical usage case for Index + // decoder is when parsing the Stream backwards. If seeking + // backward from the Stream Footer gives us something that + // doesn't begin with Index Indicator, the file is considered + // corrupt, not "programming error" or "unrecognized file + // format". One could argue that the application should + // verify the Index Indicator before trying to decode the + // Index, but well, I suppose it is simpler this way. + if (in[(*in_pos)++] != 0x00) + return LZMA_DATA_ERROR; + + coder->sequence = SEQ_COUNT; + break; + + case SEQ_COUNT: + ret = lzma_vli_decode(&coder->count, &coder->pos, + in, in_pos, in_size); + if (ret != LZMA_STREAM_END) + goto out; + + coder->pos = 0; + coder->sequence = SEQ_MEMUSAGE; + + // Fall through + + case SEQ_MEMUSAGE: + if (lzma_index_memusage(1, coder->count) > coder->memlimit) { + ret = LZMA_MEMLIMIT_ERROR; + goto out; + } + + // Tell the Index handling code how many Records this + // Index has to allow it to allocate memory more efficiently. + lzma_index_prealloc(coder->index, coder->count); + + ret = LZMA_OK; + coder->sequence = coder->count == 0 + ? SEQ_PADDING_INIT : SEQ_UNPADDED; + break; + + case SEQ_UNPADDED: + case SEQ_UNCOMPRESSED: { + lzma_vli *size = coder->sequence == SEQ_UNPADDED + ? &coder->unpadded_size + : &coder->uncompressed_size; + + ret = lzma_vli_decode(size, &coder->pos, + in, in_pos, in_size); + if (ret != LZMA_STREAM_END) + goto out; + + ret = LZMA_OK; + coder->pos = 0; + + if (coder->sequence == SEQ_UNPADDED) { + // Validate that encoded Unpadded Size isn't too small + // or too big. + if (coder->unpadded_size < UNPADDED_SIZE_MIN + || coder->unpadded_size + > UNPADDED_SIZE_MAX) + return LZMA_DATA_ERROR; + + coder->sequence = SEQ_UNCOMPRESSED; + } else { + // Add the decoded Record to the Index. + return_if_error(lzma_index_append( + coder->index, allocator, + coder->unpadded_size, + coder->uncompressed_size)); + + // Check if this was the last Record. + coder->sequence = --coder->count == 0 + ? SEQ_PADDING_INIT + : SEQ_UNPADDED; + } + + break; + } + + case SEQ_PADDING_INIT: + coder->pos = lzma_index_padding_size(coder->index); + coder->sequence = SEQ_PADDING; + + // Fall through + + case SEQ_PADDING: + if (coder->pos > 0) { + --coder->pos; + if (in[(*in_pos)++] != 0x00) + return LZMA_DATA_ERROR; + + break; + } + + // Finish the CRC32 calculation. + coder->crc32 = lzma_crc32(in + in_start, + *in_pos - in_start, coder->crc32); + + coder->sequence = SEQ_CRC32; + + // Fall through + + case SEQ_CRC32: + do { + if (*in_pos == in_size) + return LZMA_OK; + + if (((coder->crc32 >> (coder->pos * 8)) & 0xFF) + != in[(*in_pos)++]) + return LZMA_DATA_ERROR; + + } while (++coder->pos < 4); + + // Decoding was successful, now we can let the application + // see the decoded Index. + *coder->index_ptr = coder->index; + + // Make index NULL so we don't free it unintentionally. + coder->index = NULL; + + return LZMA_STREAM_END; + + default: + assert(0); + return LZMA_PROG_ERROR; + } + +out: + // Update the CRC32, + coder->crc32 = lzma_crc32(in + in_start, + *in_pos - in_start, coder->crc32); + + return ret; +} + + +static void +index_decoder_end(lzma_coder *coder, lzma_allocator *allocator) +{ + lzma_index_end(coder->index, allocator); + lzma_free(coder, allocator); + return; +} + + +static lzma_ret +index_decoder_memconfig(lzma_coder *coder, uint64_t *memusage, + uint64_t *old_memlimit, uint64_t new_memlimit) +{ + *memusage = lzma_index_memusage(1, coder->count); + *old_memlimit = coder->memlimit; + + if (new_memlimit != 0) { + if (new_memlimit < *memusage) + return LZMA_MEMLIMIT_ERROR; + + coder->memlimit = new_memlimit; + } + + return LZMA_OK; +} + + +static lzma_ret +index_decoder_reset(lzma_coder *coder, lzma_allocator *allocator, + lzma_index **i, uint64_t memlimit) +{ + // Remember the pointer given by the application. We will set it + // to point to the decoded Index only if decoding is successful. + // Before that, keep it NULL so that applications can always safely + // pass it to lzma_index_end() no matter did decoding succeed or not. + coder->index_ptr = i; + *i = NULL; + + // We always allocate a new lzma_index. + coder->index = lzma_index_init(allocator); + if (coder->index == NULL) + return LZMA_MEM_ERROR; + + // Initialize the rest. + coder->sequence = SEQ_INDICATOR; + coder->memlimit = memlimit; + coder->count = 0; // Needs to be initialized due to _memconfig(). + coder->pos = 0; + coder->crc32 = 0; + + return LZMA_OK; +} + + +static lzma_ret +index_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, + lzma_index **i, uint64_t memlimit) +{ + lzma_next_coder_init(&index_decoder_init, next, allocator); + + if (i == NULL || memlimit == 0) + return LZMA_PROG_ERROR; + + if (next->coder == NULL) { + next->coder = lzma_alloc(sizeof(lzma_coder), allocator); + if (next->coder == NULL) + return LZMA_MEM_ERROR; + + next->code = &index_decode; + next->end = &index_decoder_end; + next->memconfig = &index_decoder_memconfig; + next->coder->index = NULL; + } else { + lzma_index_end(next->coder->index, allocator); + } + + return index_decoder_reset(next->coder, allocator, i, memlimit); +} + + +extern LZMA_API(lzma_ret) +lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit) +{ + lzma_next_strm_init(index_decoder_init, strm, i, memlimit); + + strm->internal->supported_actions[LZMA_RUN] = true; + strm->internal->supported_actions[LZMA_FINISH] = true; + + return LZMA_OK; +} + + +extern LZMA_API(lzma_ret) +lzma_index_buffer_decode( + lzma_index **i, uint64_t *memlimit, lzma_allocator *allocator, + const uint8_t *in, size_t *in_pos, size_t in_size) +{ + // Sanity checks + if (i == NULL || memlimit == NULL + || in == NULL || in_pos == NULL || *in_pos > in_size) + return LZMA_PROG_ERROR; + + // Initialize the decoder. + lzma_coder coder; + return_if_error(index_decoder_reset(&coder, allocator, i, *memlimit)); + + // Store the input start position so that we can restore it in case + // of an error. + const size_t in_start = *in_pos; + + // Do the actual decoding. + lzma_ret ret = index_decode(&coder, allocator, in, in_pos, in_size, + NULL, NULL, 0, LZMA_RUN); + + if (ret == LZMA_STREAM_END) { + ret = LZMA_OK; + } else { + // Something went wrong, free the Index structure and restore + // the input position. + lzma_index_end(coder.index, allocator); + *in_pos = in_start; + + if (ret == LZMA_OK) { + // The input is truncated or otherwise corrupt. + // Use LZMA_DATA_ERROR instead of LZMA_BUF_ERROR + // like lzma_vli_decode() does in single-call mode. + ret = LZMA_DATA_ERROR; + + } else if (ret == LZMA_MEMLIMIT_ERROR) { + // Tell the caller how much memory would have + // been needed. + *memlimit = lzma_index_memusage(1, coder.count); + } + } + + return ret; +} diff --git a/liblzma/common/index_encoder.c b/liblzma/common/index_encoder.c new file mode 100644 index 0000000..45919f0 --- /dev/null +++ b/liblzma/common/index_encoder.c @@ -0,0 +1,254 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file index_encoder.c +/// \brief Encodes the Index field +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "index_encoder.h" +#include "index.h" +#include "check.h" + + +struct lzma_coder_s { + enum { + SEQ_INDICATOR, + SEQ_COUNT, + SEQ_UNPADDED, + SEQ_UNCOMPRESSED, + SEQ_NEXT, + SEQ_PADDING, + SEQ_CRC32, + } sequence; + + /// Index being encoded + const lzma_index *index; + + /// Iterator for the Index being encoded + lzma_index_iter iter; + + /// Position in integers + size_t pos; + + /// CRC32 of the List of Records field + uint32_t crc32; +}; + + +static lzma_ret +index_encode(lzma_coder *coder, + lzma_allocator *allocator lzma_attribute((__unused__)), + const uint8_t *restrict in lzma_attribute((__unused__)), + size_t *restrict in_pos lzma_attribute((__unused__)), + size_t in_size lzma_attribute((__unused__)), + uint8_t *restrict out, size_t *restrict out_pos, + size_t out_size, + lzma_action action lzma_attribute((__unused__))) +{ + // Position where to start calculating CRC32. The idea is that we + // need to call lzma_crc32() only once per call to index_encode(). + const size_t out_start = *out_pos; + + // Return value to use if we return at the end of this function. + // We use "goto out" to jump out of the while-switch construct + // instead of returning directly, because that way we don't need + // to copypaste the lzma_crc32() call to many places. + lzma_ret ret = LZMA_OK; + + while (*out_pos < out_size) + switch (coder->sequence) { + case SEQ_INDICATOR: + out[*out_pos] = 0x00; + ++*out_pos; + coder->sequence = SEQ_COUNT; + break; + + case SEQ_COUNT: { + const lzma_vli count = lzma_index_block_count(coder->index); + ret = lzma_vli_encode(count, &coder->pos, + out, out_pos, out_size); + if (ret != LZMA_STREAM_END) + goto out; + + ret = LZMA_OK; + coder->pos = 0; + coder->sequence = SEQ_NEXT; + break; + } + + case SEQ_NEXT: + if (lzma_index_iter_next( + &coder->iter, LZMA_INDEX_ITER_BLOCK)) { + // Get the size of the Index Padding field. + coder->pos = lzma_index_padding_size(coder->index); + assert(coder->pos <= 3); + coder->sequence = SEQ_PADDING; + break; + } + + coder->sequence = SEQ_UNPADDED; + + // Fall through + + case SEQ_UNPADDED: + case SEQ_UNCOMPRESSED: { + const lzma_vli size = coder->sequence == SEQ_UNPADDED + ? coder->iter.block.unpadded_size + : coder->iter.block.uncompressed_size; + + ret = lzma_vli_encode(size, &coder->pos, + out, out_pos, out_size); + if (ret != LZMA_STREAM_END) + goto out; + + ret = LZMA_OK; + coder->pos = 0; + + // Advance to SEQ_UNCOMPRESSED or SEQ_NEXT. + ++coder->sequence; + break; + } + + case SEQ_PADDING: + if (coder->pos > 0) { + --coder->pos; + out[(*out_pos)++] = 0x00; + break; + } + + // Finish the CRC32 calculation. + coder->crc32 = lzma_crc32(out + out_start, + *out_pos - out_start, coder->crc32); + + coder->sequence = SEQ_CRC32; + + // Fall through + + case SEQ_CRC32: + // We don't use the main loop, because we don't want + // coder->crc32 to be touched anymore. + do { + if (*out_pos == out_size) + return LZMA_OK; + + out[*out_pos] = (coder->crc32 >> (coder->pos * 8)) + & 0xFF; + ++*out_pos; + + } while (++coder->pos < 4); + + return LZMA_STREAM_END; + + default: + assert(0); + return LZMA_PROG_ERROR; + } + +out: + // Update the CRC32. + coder->crc32 = lzma_crc32(out + out_start, + *out_pos - out_start, coder->crc32); + + return ret; +} + + +static void +index_encoder_end(lzma_coder *coder, lzma_allocator *allocator) +{ + lzma_free(coder, allocator); + return; +} + + +static void +index_encoder_reset(lzma_coder *coder, const lzma_index *i) +{ + lzma_index_iter_init(&coder->iter, i); + + coder->sequence = SEQ_INDICATOR; + coder->index = i; + coder->pos = 0; + coder->crc32 = 0; + + return; +} + + +extern lzma_ret +lzma_index_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_index *i) +{ + lzma_next_coder_init(&lzma_index_encoder_init, next, allocator); + + if (i == NULL) + return LZMA_PROG_ERROR; + + if (next->coder == NULL) { + next->coder = lzma_alloc(sizeof(lzma_coder), allocator); + if (next->coder == NULL) + return LZMA_MEM_ERROR; + + next->code = &index_encode; + next->end = &index_encoder_end; + } + + index_encoder_reset(next->coder, i); + + return LZMA_OK; +} + + +extern LZMA_API(lzma_ret) +lzma_index_encoder(lzma_stream *strm, const lzma_index *i) +{ + lzma_next_strm_init(lzma_index_encoder_init, strm, i); + + strm->internal->supported_actions[LZMA_RUN] = true; + strm->internal->supported_actions[LZMA_FINISH] = true; + + return LZMA_OK; +} + + +extern LZMA_API(lzma_ret) +lzma_index_buffer_encode(const lzma_index *i, + uint8_t *out, size_t *out_pos, size_t out_size) +{ + // Validate the arguments. + if (i == NULL || out == NULL || out_pos == NULL || *out_pos > out_size) + return LZMA_PROG_ERROR; + + // Don't try to encode if there's not enough output space. + if (out_size - *out_pos < lzma_index_size(i)) + return LZMA_BUF_ERROR; + + // The Index encoder needs just one small data structure so we can + // allocate it on stack. + lzma_coder coder; + index_encoder_reset(&coder, i); + + // Do the actual encoding. This should never fail, but store + // the original *out_pos just in case. + const size_t out_start = *out_pos; + lzma_ret ret = index_encode(&coder, NULL, NULL, NULL, 0, + out, out_pos, out_size, LZMA_RUN); + + if (ret == LZMA_STREAM_END) { + ret = LZMA_OK; + } else { + // We should never get here, but just in case, restore the + // output position and set the error accordingly if something + // goes wrong and debugging isn't enabled. + assert(0); + *out_pos = out_start; + ret = LZMA_PROG_ERROR; + } + + return ret; +} diff --git a/liblzma/common/index_encoder.h b/liblzma/common/index_encoder.h new file mode 100644 index 0000000..a13c94d --- /dev/null +++ b/liblzma/common/index_encoder.h @@ -0,0 +1,23 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file index_encoder.h +/// \brief Encodes the Index field +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_INDEX_ENCODER_H +#define LZMA_INDEX_ENCODER_H + +#include "common.h" + + +extern lzma_ret lzma_index_encoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_index *i); + + +#endif diff --git a/liblzma/common/index_hash.c b/liblzma/common/index_hash.c new file mode 100644 index 0000000..e3e9386 --- /dev/null +++ b/liblzma/common/index_hash.c @@ -0,0 +1,332 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file index_hash.c +/// \brief Validates Index by using a hash function +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "common.h" +#include "index.h" +#include "check.h" + + +typedef struct { + /// Sum of the Block sizes (including Block Padding) + lzma_vli blocks_size; + + /// Sum of the Uncompressed Size fields + lzma_vli uncompressed_size; + + /// Number of Records + lzma_vli count; + + /// Size of the List of Index Records as bytes + lzma_vli index_list_size; + + /// Check calculated from Unpadded Sizes and Uncompressed Sizes. + lzma_check_state check; + +} lzma_index_hash_info; + + +struct lzma_index_hash_s { + enum { + SEQ_BLOCK, + SEQ_COUNT, + SEQ_UNPADDED, + SEQ_UNCOMPRESSED, + SEQ_PADDING_INIT, + SEQ_PADDING, + SEQ_CRC32, + } sequence; + + /// Information collected while decoding the actual Blocks. + lzma_index_hash_info blocks; + + /// Information collected from the Index field. + lzma_index_hash_info records; + + /// Number of Records not fully decoded + lzma_vli remaining; + + /// Unpadded Size currently being read from an Index Record. + lzma_vli unpadded_size; + + /// Uncompressed Size currently being read from an Index Record. + lzma_vli uncompressed_size; + + /// Position in variable-length integers when decoding them from + /// the List of Records. + size_t pos; + + /// CRC32 of the Index + uint32_t crc32; +}; + + +extern LZMA_API(lzma_index_hash *) +lzma_index_hash_init(lzma_index_hash *index_hash, lzma_allocator *allocator) +{ + if (index_hash == NULL) { + index_hash = lzma_alloc(sizeof(lzma_index_hash), allocator); + if (index_hash == NULL) + return NULL; + } + + index_hash->sequence = SEQ_BLOCK; + index_hash->blocks.blocks_size = 0; + index_hash->blocks.uncompressed_size = 0; + index_hash->blocks.count = 0; + index_hash->blocks.index_list_size = 0; + index_hash->records.blocks_size = 0; + index_hash->records.uncompressed_size = 0; + index_hash->records.count = 0; + index_hash->records.index_list_size = 0; + index_hash->unpadded_size = 0; + index_hash->uncompressed_size = 0; + index_hash->pos = 0; + index_hash->crc32 = 0; + + // These cannot fail because LZMA_CHECK_BEST is known to be supported. + (void)lzma_check_init(&index_hash->blocks.check, LZMA_CHECK_BEST); + (void)lzma_check_init(&index_hash->records.check, LZMA_CHECK_BEST); + + return index_hash; +} + + +extern LZMA_API(void) +lzma_index_hash_end(lzma_index_hash *index_hash, lzma_allocator *allocator) +{ + lzma_free(index_hash, allocator); + return; +} + + +extern LZMA_API(lzma_vli) +lzma_index_hash_size(const lzma_index_hash *index_hash) +{ + // Get the size of the Index from ->blocks instead of ->records for + // cases where application wants to know the Index Size before + // decoding the Index. + return index_size(index_hash->blocks.count, + index_hash->blocks.index_list_size); +} + + +/// Updates the sizes and the hash without any validation. +static lzma_ret +hash_append(lzma_index_hash_info *info, lzma_vli unpadded_size, + lzma_vli uncompressed_size) +{ + info->blocks_size += vli_ceil4(unpadded_size); + info->uncompressed_size += uncompressed_size; + info->index_list_size += lzma_vli_size(unpadded_size) + + lzma_vli_size(uncompressed_size); + ++info->count; + + const lzma_vli sizes[2] = { unpadded_size, uncompressed_size }; + lzma_check_update(&info->check, LZMA_CHECK_BEST, + (const uint8_t *)(sizes), sizeof(sizes)); + + return LZMA_OK; +} + + +extern LZMA_API(lzma_ret) +lzma_index_hash_append(lzma_index_hash *index_hash, lzma_vli unpadded_size, + lzma_vli uncompressed_size) +{ + // Validate the arguments. + if (index_hash->sequence != SEQ_BLOCK + || unpadded_size < UNPADDED_SIZE_MIN + || unpadded_size > UNPADDED_SIZE_MAX + || uncompressed_size > LZMA_VLI_MAX) + return LZMA_PROG_ERROR; + + // Update the hash. + return_if_error(hash_append(&index_hash->blocks, + unpadded_size, uncompressed_size)); + + // Validate the properties of *info are still in allowed limits. + if (index_hash->blocks.blocks_size > LZMA_VLI_MAX + || index_hash->blocks.uncompressed_size > LZMA_VLI_MAX + || index_size(index_hash->blocks.count, + index_hash->blocks.index_list_size) + > LZMA_BACKWARD_SIZE_MAX + || index_stream_size(index_hash->blocks.blocks_size, + index_hash->blocks.count, + index_hash->blocks.index_list_size) + > LZMA_VLI_MAX) + return LZMA_DATA_ERROR; + + return LZMA_OK; +} + + +extern LZMA_API(lzma_ret) +lzma_index_hash_decode(lzma_index_hash *index_hash, const uint8_t *in, + size_t *in_pos, size_t in_size) +{ + // Catch zero input buffer here, because in contrast to Index encoder + // and decoder functions, applications call this function directly + // instead of via lzma_code(), which does the buffer checking. + if (*in_pos >= in_size) + return LZMA_BUF_ERROR; + + // NOTE: This function has many similarities to index_encode() and + // index_decode() functions found from index_encoder.c and + // index_decoder.c. See the comments especially in index_encoder.c. + const size_t in_start = *in_pos; + lzma_ret ret = LZMA_OK; + + while (*in_pos < in_size) + switch (index_hash->sequence) { + case SEQ_BLOCK: + // Check the Index Indicator is present. + if (in[(*in_pos)++] != 0x00) + return LZMA_DATA_ERROR; + + index_hash->sequence = SEQ_COUNT; + break; + + case SEQ_COUNT: { + ret = lzma_vli_decode(&index_hash->remaining, + &index_hash->pos, in, in_pos, in_size); + if (ret != LZMA_STREAM_END) + goto out; + + // The count must match the count of the Blocks decoded. + if (index_hash->remaining != index_hash->blocks.count) + return LZMA_DATA_ERROR; + + ret = LZMA_OK; + index_hash->pos = 0; + + // Handle the special case when there are no Blocks. + index_hash->sequence = index_hash->remaining == 0 + ? SEQ_PADDING_INIT : SEQ_UNPADDED; + break; + } + + case SEQ_UNPADDED: + case SEQ_UNCOMPRESSED: { + lzma_vli *size = index_hash->sequence == SEQ_UNPADDED + ? &index_hash->unpadded_size + : &index_hash->uncompressed_size; + + ret = lzma_vli_decode(size, &index_hash->pos, + in, in_pos, in_size); + if (ret != LZMA_STREAM_END) + goto out; + + ret = LZMA_OK; + index_hash->pos = 0; + + if (index_hash->sequence == SEQ_UNPADDED) { + if (index_hash->unpadded_size < UNPADDED_SIZE_MIN + || index_hash->unpadded_size + > UNPADDED_SIZE_MAX) + return LZMA_DATA_ERROR; + + index_hash->sequence = SEQ_UNCOMPRESSED; + } else { + // Update the hash. + return_if_error(hash_append(&index_hash->records, + index_hash->unpadded_size, + index_hash->uncompressed_size)); + + // Verify that we don't go over the known sizes. Note + // that this validation is simpler than the one used + // in lzma_index_hash_append(), because here we know + // that values in index_hash->blocks are already + // validated and we are fine as long as we don't + // exceed them in index_hash->records. + if (index_hash->blocks.blocks_size + < index_hash->records.blocks_size + || index_hash->blocks.uncompressed_size + < index_hash->records.uncompressed_size + || index_hash->blocks.index_list_size + < index_hash->records.index_list_size) + return LZMA_DATA_ERROR; + + // Check if this was the last Record. + index_hash->sequence = --index_hash->remaining == 0 + ? SEQ_PADDING_INIT : SEQ_UNPADDED; + } + + break; + } + + case SEQ_PADDING_INIT: + index_hash->pos = (LZMA_VLI_C(4) - index_size_unpadded( + index_hash->records.count, + index_hash->records.index_list_size)) & 3; + index_hash->sequence = SEQ_PADDING; + + // Fall through + + case SEQ_PADDING: + if (index_hash->pos > 0) { + --index_hash->pos; + if (in[(*in_pos)++] != 0x00) + return LZMA_DATA_ERROR; + + break; + } + + // Compare the sizes. + if (index_hash->blocks.blocks_size + != index_hash->records.blocks_size + || index_hash->blocks.uncompressed_size + != index_hash->records.uncompressed_size + || index_hash->blocks.index_list_size + != index_hash->records.index_list_size) + return LZMA_DATA_ERROR; + + // Finish the hashes and compare them. + lzma_check_finish(&index_hash->blocks.check, LZMA_CHECK_BEST); + lzma_check_finish(&index_hash->records.check, LZMA_CHECK_BEST); + if (memcmp(index_hash->blocks.check.buffer.u8, + index_hash->records.check.buffer.u8, + lzma_check_size(LZMA_CHECK_BEST)) != 0) + return LZMA_DATA_ERROR; + + // Finish the CRC32 calculation. + index_hash->crc32 = lzma_crc32(in + in_start, + *in_pos - in_start, index_hash->crc32); + + index_hash->sequence = SEQ_CRC32; + + // Fall through + + case SEQ_CRC32: + do { + if (*in_pos == in_size) + return LZMA_OK; + + if (((index_hash->crc32 >> (index_hash->pos * 8)) + & 0xFF) != in[(*in_pos)++]) + return LZMA_DATA_ERROR; + + } while (++index_hash->pos < 4); + + return LZMA_STREAM_END; + + default: + assert(0); + return LZMA_PROG_ERROR; + } + +out: + // Update the CRC32, + index_hash->crc32 = lzma_crc32(in + in_start, + *in_pos - in_start, index_hash->crc32); + + return ret; +} diff --git a/liblzma/common/stream_buffer_decoder.c b/liblzma/common/stream_buffer_decoder.c new file mode 100644 index 0000000..ae75315 --- /dev/null +++ b/liblzma/common/stream_buffer_decoder.c @@ -0,0 +1,91 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file stream_buffer_decoder.c +/// \brief Single-call .xz Stream decoder +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "stream_decoder.h" + + +extern LZMA_API(lzma_ret) +lzma_stream_buffer_decode(uint64_t *memlimit, uint32_t flags, + lzma_allocator *allocator, + const uint8_t *in, size_t *in_pos, size_t in_size, + uint8_t *out, size_t *out_pos, size_t out_size) +{ + // Sanity checks + if (in_pos == NULL || (in == NULL && *in_pos != in_size) + || *in_pos > in_size || out_pos == NULL + || (out == NULL && *out_pos != out_size) + || *out_pos > out_size) + return LZMA_PROG_ERROR; + + // Catch flags that are not allowed in buffer-to-buffer decoding. + if (flags & LZMA_TELL_ANY_CHECK) + return LZMA_PROG_ERROR; + + // Initialize the Stream decoder. + // TODO: We need something to tell the decoder that it can use the + // output buffer as workspace, and thus save significant amount of RAM. + lzma_next_coder stream_decoder = LZMA_NEXT_CODER_INIT; + lzma_ret ret = lzma_stream_decoder_init( + &stream_decoder, allocator, *memlimit, flags); + + if (ret == LZMA_OK) { + // Save the positions so that we can restore them in case + // an error occurs. + const size_t in_start = *in_pos; + const size_t out_start = *out_pos; + + // Do the actual decoding. + ret = stream_decoder.code(stream_decoder.coder, allocator, + in, in_pos, in_size, out, out_pos, out_size, + LZMA_FINISH); + + if (ret == LZMA_STREAM_END) { + ret = LZMA_OK; + } else { + // Something went wrong, restore the positions. + *in_pos = in_start; + *out_pos = out_start; + + if (ret == LZMA_OK) { + // Either the input was truncated or the + // output buffer was too small. + assert(*in_pos == in_size + || *out_pos == out_size); + + // If all the input was consumed, then the + // input is truncated, even if the output + // buffer is also full. This is because + // processing the last byte of the Stream + // never produces output. + if (*in_pos == in_size) + ret = LZMA_DATA_ERROR; + else + ret = LZMA_BUF_ERROR; + + } else if (ret == LZMA_MEMLIMIT_ERROR) { + // Let the caller know how much memory would + // have been needed. + uint64_t memusage; + (void)stream_decoder.memconfig( + stream_decoder.coder, + memlimit, &memusage, 0); + } + } + } + + // Free the decoder memory. This needs to be done even if + // initialization fails, because the internal API doesn't + // require the initialization function to free its memory on error. + lzma_next_end(&stream_decoder, allocator); + + return ret; +} diff --git a/liblzma/common/stream_buffer_encoder.c b/liblzma/common/stream_buffer_encoder.c new file mode 100644 index 0000000..2450ee2 --- /dev/null +++ b/liblzma/common/stream_buffer_encoder.c @@ -0,0 +1,140 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file stream_buffer_encoder.c +/// \brief Single-call .xz Stream encoder +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "index.h" + + +/// Maximum size of Index that has exactly one Record. +/// Index Indicator + Number of Records + Record + CRC32 rounded up to +/// the next multiple of four. +#define INDEX_BOUND ((1 + 1 + 2 * LZMA_VLI_BYTES_MAX + 4 + 3) & ~3) + +/// Stream Header, Stream Footer, and Index +#define HEADERS_BOUND (2 * LZMA_STREAM_HEADER_SIZE + INDEX_BOUND) + + +extern LZMA_API(size_t) +lzma_stream_buffer_bound(size_t uncompressed_size) +{ + // Get the maximum possible size of a Block. + const size_t block_bound = lzma_block_buffer_bound(uncompressed_size); + if (block_bound == 0) + return 0; + + // Catch the possible integer overflow and also prevent the size of + // the Stream exceeding LZMA_VLI_MAX (theoretically possible on + // 64-bit systems). + if (my_min(SIZE_MAX, LZMA_VLI_MAX) - block_bound < HEADERS_BOUND) + return 0; + + return block_bound + HEADERS_BOUND; +} + + +extern LZMA_API(lzma_ret) +lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check, + lzma_allocator *allocator, const uint8_t *in, size_t in_size, + uint8_t *out, size_t *out_pos_ptr, size_t out_size) +{ + // Sanity checks + if (filters == NULL || (unsigned int)(check) > LZMA_CHECK_ID_MAX + || (in == NULL && in_size != 0) || out == NULL + || out_pos_ptr == NULL || *out_pos_ptr > out_size) + return LZMA_PROG_ERROR; + + if (!lzma_check_is_supported(check)) + return LZMA_UNSUPPORTED_CHECK; + + // Note for the paranoids: Index encoder prevents the Stream from + // getting too big and still being accepted with LZMA_OK, and Block + // encoder catches if the input is too big. So we don't need to + // separately check if the buffers are too big. + + // Use a local copy. We update *out_pos_ptr only if everything + // succeeds. + size_t out_pos = *out_pos_ptr; + + // Check that there's enough space for both Stream Header and + // Stream Footer. + if (out_size - out_pos <= 2 * LZMA_STREAM_HEADER_SIZE) + return LZMA_BUF_ERROR; + + // Reserve space for Stream Footer so we don't need to check for + // available space again before encoding Stream Footer. + out_size -= LZMA_STREAM_HEADER_SIZE; + + // Encode the Stream Header. + lzma_stream_flags stream_flags = { + .version = 0, + .check = check, + }; + + if (lzma_stream_header_encode(&stream_flags, out + out_pos) + != LZMA_OK) + return LZMA_PROG_ERROR; + + out_pos += LZMA_STREAM_HEADER_SIZE; + + // Encode a Block but only if there is at least one byte of input. + lzma_block block = { + .version = 0, + .check = check, + .filters = filters, + }; + + if (in_size > 0) + return_if_error(lzma_block_buffer_encode(&block, allocator, + in, in_size, out, &out_pos, out_size)); + + // Index + { + // Create an Index. It will have one Record if there was + // at least one byte of input to encode. Otherwise the + // Index will be empty. + lzma_index *i = lzma_index_init(allocator); + if (i == NULL) + return LZMA_MEM_ERROR; + + lzma_ret ret = LZMA_OK; + + if (in_size > 0) + ret = lzma_index_append(i, allocator, + lzma_block_unpadded_size(&block), + block.uncompressed_size); + + // If adding the Record was successful, encode the Index + // and get its size which will be stored into Stream Footer. + if (ret == LZMA_OK) { + ret = lzma_index_buffer_encode( + i, out, &out_pos, out_size); + + stream_flags.backward_size = lzma_index_size(i); + } + + lzma_index_end(i, allocator); + + if (ret != LZMA_OK) + return ret; + } + + // Stream Footer. We have already reserved space for this. + if (lzma_stream_footer_encode(&stream_flags, out + out_pos) + != LZMA_OK) + return LZMA_PROG_ERROR; + + out_pos += LZMA_STREAM_HEADER_SIZE; + + // Everything went fine, make the new output position available + // to the application. + *out_pos_ptr = out_pos; + return LZMA_OK; +} diff --git a/liblzma/common/stream_decoder.c b/liblzma/common/stream_decoder.c new file mode 100644 index 0000000..37ea71e --- /dev/null +++ b/liblzma/common/stream_decoder.c @@ -0,0 +1,451 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file stream_decoder.c +/// \brief Decodes .xz Streams +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "stream_decoder.h" +#include "block_decoder.h" + + +struct lzma_coder_s { + enum { + SEQ_STREAM_HEADER, + SEQ_BLOCK_HEADER, + SEQ_BLOCK, + SEQ_INDEX, + SEQ_STREAM_FOOTER, + SEQ_STREAM_PADDING, + } sequence; + + /// Block or Metadata decoder. This takes little memory and the same + /// data structure can be used to decode every Block Header, so it's + /// a good idea to have a separate lzma_next_coder structure for it. + lzma_next_coder block_decoder; + + /// Block options decoded by the Block Header decoder and used by + /// the Block decoder. + lzma_block block_options; + + /// Stream Flags from Stream Header + lzma_stream_flags stream_flags; + + /// Index is hashed so that it can be compared to the sizes of Blocks + /// with O(1) memory usage. + lzma_index_hash *index_hash; + + /// Memory usage limit + uint64_t memlimit; + + /// Amount of memory actually needed (only an estimate) + uint64_t memusage; + + /// If true, LZMA_NO_CHECK is returned if the Stream has + /// no integrity check. + bool tell_no_check; + + /// If true, LZMA_UNSUPPORTED_CHECK is returned if the Stream has + /// an integrity check that isn't supported by this liblzma build. + bool tell_unsupported_check; + + /// If true, LZMA_GET_CHECK is returned after decoding Stream Header. + bool tell_any_check; + + /// If true, we will decode concatenated Streams that possibly have + /// Stream Padding between or after them. LZMA_STREAM_END is returned + /// once the application isn't giving us any new input, and we aren't + /// in the middle of a Stream, and possible Stream Padding is a + /// multiple of four bytes. + bool concatenated; + + /// When decoding concatenated Streams, this is true as long as we + /// are decoding the first Stream. This is needed to avoid misleading + /// LZMA_FORMAT_ERROR in case the later Streams don't have valid magic + /// bytes. + bool first_stream; + + /// Write position in buffer[] and position in Stream Padding + size_t pos; + + /// Buffer to hold Stream Header, Block Header, and Stream Footer. + /// Block Header has biggest maximum size. + uint8_t buffer[LZMA_BLOCK_HEADER_SIZE_MAX]; +}; + + +static lzma_ret +stream_decoder_reset(lzma_coder *coder, lzma_allocator *allocator) +{ + // Initialize the Index hash used to verify the Index. + coder->index_hash = lzma_index_hash_init(coder->index_hash, allocator); + if (coder->index_hash == NULL) + return LZMA_MEM_ERROR; + + // Reset the rest of the variables. + coder->sequence = SEQ_STREAM_HEADER; + coder->pos = 0; + + return LZMA_OK; +} + + +static lzma_ret +stream_decode(lzma_coder *coder, lzma_allocator *allocator, + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size, lzma_action action) +{ + // When decoding the actual Block, it may be able to produce more + // output even if we don't give it any new input. + while (true) + switch (coder->sequence) { + case SEQ_STREAM_HEADER: { + // Copy the Stream Header to the internal buffer. + lzma_bufcpy(in, in_pos, in_size, coder->buffer, &coder->pos, + LZMA_STREAM_HEADER_SIZE); + + // Return if we didn't get the whole Stream Header yet. + if (coder->pos < LZMA_STREAM_HEADER_SIZE) + return LZMA_OK; + + coder->pos = 0; + + // Decode the Stream Header. + const lzma_ret ret = lzma_stream_header_decode( + &coder->stream_flags, coder->buffer); + if (ret != LZMA_OK) + return ret == LZMA_FORMAT_ERROR && !coder->first_stream + ? LZMA_DATA_ERROR : ret; + + // If we are decoding concatenated Streams, and the later + // Streams have invalid Header Magic Bytes, we give + // LZMA_DATA_ERROR instead of LZMA_FORMAT_ERROR. + coder->first_stream = false; + + // Copy the type of the Check so that Block Header and Block + // decoders see it. + coder->block_options.check = coder->stream_flags.check; + + // Even if we return LZMA_*_CHECK below, we want + // to continue from Block Header decoding. + coder->sequence = SEQ_BLOCK_HEADER; + + // Detect if there's no integrity check or if it is + // unsupported if those were requested by the application. + if (coder->tell_no_check && coder->stream_flags.check + == LZMA_CHECK_NONE) + return LZMA_NO_CHECK; + + if (coder->tell_unsupported_check + && !lzma_check_is_supported( + coder->stream_flags.check)) + return LZMA_UNSUPPORTED_CHECK; + + if (coder->tell_any_check) + return LZMA_GET_CHECK; + } + + // Fall through + + case SEQ_BLOCK_HEADER: { + if (*in_pos >= in_size) + return LZMA_OK; + + if (coder->pos == 0) { + // Detect if it's Index. + if (in[*in_pos] == 0x00) { + coder->sequence = SEQ_INDEX; + break; + } + + // Calculate the size of the Block Header. Note that + // Block Header decoder wants to see this byte too + // so don't advance *in_pos. + coder->block_options.header_size + = lzma_block_header_size_decode( + in[*in_pos]); + } + + // Copy the Block Header to the internal buffer. + lzma_bufcpy(in, in_pos, in_size, coder->buffer, &coder->pos, + coder->block_options.header_size); + + // Return if we didn't get the whole Block Header yet. + if (coder->pos < coder->block_options.header_size) + return LZMA_OK; + + coder->pos = 0; + + // Version 0 is currently the only possible version. + coder->block_options.version = 0; + + // Set up a buffer to hold the filter chain. Block Header + // decoder will initialize all members of this array so + // we don't need to do it here. + lzma_filter filters[LZMA_FILTERS_MAX + 1]; + coder->block_options.filters = filters; + + // Decode the Block Header. + return_if_error(lzma_block_header_decode(&coder->block_options, + allocator, coder->buffer)); + + // Check the memory usage limit. + const uint64_t memusage = lzma_raw_decoder_memusage(filters); + lzma_ret ret; + + if (memusage == UINT64_MAX) { + // One or more unknown Filter IDs. + ret = LZMA_OPTIONS_ERROR; + } else { + // Now we can set coder->memusage since we know that + // the filter chain is valid. We don't want + // lzma_memusage() to return UINT64_MAX in case of + // invalid filter chain. + coder->memusage = memusage; + + if (memusage > coder->memlimit) { + // The chain would need too much memory. + ret = LZMA_MEMLIMIT_ERROR; + } else { + // Memory usage is OK. + // Initialize the Block decoder. + ret = lzma_block_decoder_init( + &coder->block_decoder, + allocator, + &coder->block_options); + } + } + + // Free the allocated filter options since they are needed + // only to initialize the Block decoder. + for (size_t i = 0; i < LZMA_FILTERS_MAX; ++i) + lzma_free(filters[i].options, allocator); + + coder->block_options.filters = NULL; + + // Check if memory usage calculation and Block enocoder + // initialization succeeded. + if (ret != LZMA_OK) + return ret; + + coder->sequence = SEQ_BLOCK; + } + + // Fall through + + case SEQ_BLOCK: { + const lzma_ret ret = coder->block_decoder.code( + coder->block_decoder.coder, allocator, + in, in_pos, in_size, out, out_pos, out_size, + action); + + if (ret != LZMA_STREAM_END) + return ret; + + // Block decoded successfully. Add the new size pair to + // the Index hash. + return_if_error(lzma_index_hash_append(coder->index_hash, + lzma_block_unpadded_size( + &coder->block_options), + coder->block_options.uncompressed_size)); + + coder->sequence = SEQ_BLOCK_HEADER; + break; + } + + case SEQ_INDEX: { + // If we don't have any input, don't call + // lzma_index_hash_decode() since it would return + // LZMA_BUF_ERROR, which we must not do here. + if (*in_pos >= in_size) + return LZMA_OK; + + // Decode the Index and compare it to the hash calculated + // from the sizes of the Blocks (if any). + const lzma_ret ret = lzma_index_hash_decode(coder->index_hash, + in, in_pos, in_size); + if (ret != LZMA_STREAM_END) + return ret; + + coder->sequence = SEQ_STREAM_FOOTER; + } + + // Fall through + + case SEQ_STREAM_FOOTER: { + // Copy the Stream Footer to the internal buffer. + lzma_bufcpy(in, in_pos, in_size, coder->buffer, &coder->pos, + LZMA_STREAM_HEADER_SIZE); + + // Return if we didn't get the whole Stream Footer yet. + if (coder->pos < LZMA_STREAM_HEADER_SIZE) + return LZMA_OK; + + coder->pos = 0; + + // Decode the Stream Footer. The decoder gives + // LZMA_FORMAT_ERROR if the magic bytes don't match, + // so convert that return code to LZMA_DATA_ERROR. + lzma_stream_flags footer_flags; + const lzma_ret ret = lzma_stream_footer_decode( + &footer_flags, coder->buffer); + if (ret != LZMA_OK) + return ret == LZMA_FORMAT_ERROR + ? LZMA_DATA_ERROR : ret; + + // Check that Index Size stored in the Stream Footer matches + // the real size of the Index field. + if (lzma_index_hash_size(coder->index_hash) + != footer_flags.backward_size) + return LZMA_DATA_ERROR; + + // Compare that the Stream Flags fields are identical in + // both Stream Header and Stream Footer. + return_if_error(lzma_stream_flags_compare( + &coder->stream_flags, &footer_flags)); + + if (!coder->concatenated) + return LZMA_STREAM_END; + + coder->sequence = SEQ_STREAM_PADDING; + } + + // Fall through + + case SEQ_STREAM_PADDING: + assert(coder->concatenated); + + // Skip over possible Stream Padding. + while (true) { + if (*in_pos >= in_size) { + // Unless LZMA_FINISH was used, we cannot + // know if there's more input coming later. + if (action != LZMA_FINISH) + return LZMA_OK; + + // Stream Padding must be a multiple of + // four bytes. + return coder->pos == 0 + ? LZMA_STREAM_END + : LZMA_DATA_ERROR; + } + + // If the byte is not zero, it probably indicates + // beginning of a new Stream (or the file is corrupt). + if (in[*in_pos] != 0x00) + break; + + ++*in_pos; + coder->pos = (coder->pos + 1) & 3; + } + + // Stream Padding must be a multiple of four bytes (empty + // Stream Padding is OK). + if (coder->pos != 0) { + ++*in_pos; + return LZMA_DATA_ERROR; + } + + // Prepare to decode the next Stream. + return_if_error(stream_decoder_reset(coder, allocator)); + break; + + default: + assert(0); + return LZMA_PROG_ERROR; + } + + // Never reached +} + + +static void +stream_decoder_end(lzma_coder *coder, lzma_allocator *allocator) +{ + lzma_next_end(&coder->block_decoder, allocator); + lzma_index_hash_end(coder->index_hash, allocator); + lzma_free(coder, allocator); + return; +} + + +static lzma_check +stream_decoder_get_check(const lzma_coder *coder) +{ + return coder->stream_flags.check; +} + + +static lzma_ret +stream_decoder_memconfig(lzma_coder *coder, uint64_t *memusage, + uint64_t *old_memlimit, uint64_t new_memlimit) +{ + *memusage = coder->memusage; + *old_memlimit = coder->memlimit; + + if (new_memlimit != 0) { + if (new_memlimit < coder->memusage) + return LZMA_MEMLIMIT_ERROR; + + coder->memlimit = new_memlimit; + } + + return LZMA_OK; +} + + +extern lzma_ret +lzma_stream_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, + uint64_t memlimit, uint32_t flags) +{ + lzma_next_coder_init(&lzma_stream_decoder_init, next, allocator); + + if (memlimit == 0) + return LZMA_PROG_ERROR; + + if (flags & ~LZMA_SUPPORTED_FLAGS) + return LZMA_OPTIONS_ERROR; + + if (next->coder == NULL) { + next->coder = lzma_alloc(sizeof(lzma_coder), allocator); + if (next->coder == NULL) + return LZMA_MEM_ERROR; + + next->code = &stream_decode; + next->end = &stream_decoder_end; + next->get_check = &stream_decoder_get_check; + next->memconfig = &stream_decoder_memconfig; + + next->coder->block_decoder = LZMA_NEXT_CODER_INIT; + next->coder->index_hash = NULL; + } + + next->coder->memlimit = memlimit; + next->coder->memusage = LZMA_MEMUSAGE_BASE; + next->coder->tell_no_check = (flags & LZMA_TELL_NO_CHECK) != 0; + next->coder->tell_unsupported_check + = (flags & LZMA_TELL_UNSUPPORTED_CHECK) != 0; + next->coder->tell_any_check = (flags & LZMA_TELL_ANY_CHECK) != 0; + next->coder->concatenated = (flags & LZMA_CONCATENATED) != 0; + next->coder->first_stream = true; + + return stream_decoder_reset(next->coder, allocator); +} + + +extern LZMA_API(lzma_ret) +lzma_stream_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags) +{ + lzma_next_strm_init(lzma_stream_decoder_init, strm, memlimit, flags); + + strm->internal->supported_actions[LZMA_RUN] = true; + strm->internal->supported_actions[LZMA_FINISH] = true; + + return LZMA_OK; +} diff --git a/liblzma/common/stream_decoder.h b/liblzma/common/stream_decoder.h new file mode 100644 index 0000000..e54ac28 --- /dev/null +++ b/liblzma/common/stream_decoder.h @@ -0,0 +1,21 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file stream_decoder.h +/// \brief Decodes .xz Streams +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_STREAM_DECODER_H +#define LZMA_STREAM_DECODER_H + +#include "common.h" + +extern lzma_ret lzma_stream_decoder_init(lzma_next_coder *next, + lzma_allocator *allocator, uint64_t memlimit, uint32_t flags); + +#endif diff --git a/liblzma/common/stream_encoder.c b/liblzma/common/stream_encoder.c new file mode 100644 index 0000000..97a7a23 --- /dev/null +++ b/liblzma/common/stream_encoder.c @@ -0,0 +1,331 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file stream_encoder.c +/// \brief Encodes .xz Streams +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "stream_encoder.h" +#include "block_encoder.h" +#include "index_encoder.h" + + +struct lzma_coder_s { + enum { + SEQ_STREAM_HEADER, + SEQ_BLOCK_INIT, + SEQ_BLOCK_HEADER, + SEQ_BLOCK_ENCODE, + SEQ_INDEX_ENCODE, + SEQ_STREAM_FOOTER, + } sequence; + + /// True if Block encoder has been initialized by + /// lzma_stream_encoder_init() or stream_encoder_update() + /// and thus doesn't need to be initialized in stream_encode(). + bool block_encoder_is_initialized; + + /// Block + lzma_next_coder block_encoder; + + /// Options for the Block encoder + lzma_block block_options; + + /// The filter chain currently in use + lzma_filter filters[LZMA_FILTERS_MAX + 1]; + + /// Index encoder. This is separate from Block encoder, because this + /// doesn't take much memory, and when encoding multiple Streams + /// with the same encoding options we avoid reallocating memory. + lzma_next_coder index_encoder; + + /// Index to hold sizes of the Blocks + lzma_index *index; + + /// Read position in buffer[] + size_t buffer_pos; + + /// Total number of bytes in buffer[] + size_t buffer_size; + + /// Buffer to hold Stream Header, Block Header, and Stream Footer. + /// Block Header has biggest maximum size. + uint8_t buffer[LZMA_BLOCK_HEADER_SIZE_MAX]; +}; + + +static lzma_ret +block_encoder_init(lzma_coder *coder, lzma_allocator *allocator) +{ + // Prepare the Block options. Even though Block encoder doesn't need + // compressed_size, uncompressed_size, and header_size to be + // initialized, it is a good idea to do it here, because this way + // we catch if someone gave us Filter ID that cannot be used in + // Blocks/Streams. + coder->block_options.compressed_size = LZMA_VLI_UNKNOWN; + coder->block_options.uncompressed_size = LZMA_VLI_UNKNOWN; + + return_if_error(lzma_block_header_size(&coder->block_options)); + + // Initialize the actual Block encoder. + return lzma_block_encoder_init(&coder->block_encoder, allocator, + &coder->block_options); +} + + +static lzma_ret +stream_encode(lzma_coder *coder, lzma_allocator *allocator, + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size, lzma_action action) +{ + // Main loop + while (*out_pos < out_size) + switch (coder->sequence) { + case SEQ_STREAM_HEADER: + case SEQ_BLOCK_HEADER: + case SEQ_STREAM_FOOTER: + lzma_bufcpy(coder->buffer, &coder->buffer_pos, + coder->buffer_size, out, out_pos, out_size); + if (coder->buffer_pos < coder->buffer_size) + return LZMA_OK; + + if (coder->sequence == SEQ_STREAM_FOOTER) + return LZMA_STREAM_END; + + coder->buffer_pos = 0; + ++coder->sequence; + break; + + case SEQ_BLOCK_INIT: { + if (*in_pos == in_size) { + // If we are requested to flush or finish the current + // Block, return LZMA_STREAM_END immediately since + // there's nothing to do. + if (action != LZMA_FINISH) + return action == LZMA_RUN + ? LZMA_OK : LZMA_STREAM_END; + + // The application had used LZMA_FULL_FLUSH to finish + // the previous Block, but now wants to finish without + // encoding new data, or it is simply creating an + // empty Stream with no Blocks. + // + // Initialize the Index encoder, and continue to + // actually encoding the Index. + return_if_error(lzma_index_encoder_init( + &coder->index_encoder, allocator, + coder->index)); + coder->sequence = SEQ_INDEX_ENCODE; + break; + } + + // Initialize the Block encoder unless it was already + // initialized by lzma_stream_encoder_init() or + // stream_encoder_update(). + if (!coder->block_encoder_is_initialized) + return_if_error(block_encoder_init(coder, allocator)); + + // Make it false so that we don't skip the initialization + // with the next Block. + coder->block_encoder_is_initialized = false; + + // Encode the Block Header. This shouldn't fail since we have + // already initialized the Block encoder. + if (lzma_block_header_encode(&coder->block_options, + coder->buffer) != LZMA_OK) + return LZMA_PROG_ERROR; + + coder->buffer_size = coder->block_options.header_size; + coder->sequence = SEQ_BLOCK_HEADER; + break; + } + + case SEQ_BLOCK_ENCODE: { + static const lzma_action convert[4] = { + LZMA_RUN, + LZMA_SYNC_FLUSH, + LZMA_FINISH, + LZMA_FINISH, + }; + + const lzma_ret ret = coder->block_encoder.code( + coder->block_encoder.coder, allocator, + in, in_pos, in_size, + out, out_pos, out_size, convert[action]); + if (ret != LZMA_STREAM_END || action == LZMA_SYNC_FLUSH) + return ret; + + // Add a new Index Record. + const lzma_vli unpadded_size = lzma_block_unpadded_size( + &coder->block_options); + assert(unpadded_size != 0); + return_if_error(lzma_index_append(coder->index, allocator, + unpadded_size, + coder->block_options.uncompressed_size)); + + coder->sequence = SEQ_BLOCK_INIT; + break; + } + + case SEQ_INDEX_ENCODE: { + // Call the Index encoder. It doesn't take any input, so + // those pointers can be NULL. + const lzma_ret ret = coder->index_encoder.code( + coder->index_encoder.coder, allocator, + NULL, NULL, 0, + out, out_pos, out_size, LZMA_RUN); + if (ret != LZMA_STREAM_END) + return ret; + + // Encode the Stream Footer into coder->buffer. + const lzma_stream_flags stream_flags = { + .version = 0, + .backward_size = lzma_index_size(coder->index), + .check = coder->block_options.check, + }; + + if (lzma_stream_footer_encode(&stream_flags, coder->buffer) + != LZMA_OK) + return LZMA_PROG_ERROR; + + coder->buffer_size = LZMA_STREAM_HEADER_SIZE; + coder->sequence = SEQ_STREAM_FOOTER; + break; + } + + default: + assert(0); + return LZMA_PROG_ERROR; + } + + return LZMA_OK; +} + + +static void +stream_encoder_end(lzma_coder *coder, lzma_allocator *allocator) +{ + lzma_next_end(&coder->block_encoder, allocator); + lzma_next_end(&coder->index_encoder, allocator); + lzma_index_end(coder->index, allocator); + + for (size_t i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i) + lzma_free(coder->filters[i].options, allocator); + + lzma_free(coder, allocator); + return; +} + + +static lzma_ret +stream_encoder_update(lzma_coder *coder, lzma_allocator *allocator, + const lzma_filter *filters, + const lzma_filter *reversed_filters) +{ + if (coder->sequence <= SEQ_BLOCK_INIT) { + // There is no incomplete Block waiting to be finished, + // thus we can change the whole filter chain. Start by + // trying to initialize the Block encoder with the new + // chain. This way we detect if the chain is valid. + coder->block_encoder_is_initialized = false; + coder->block_options.filters = (lzma_filter *)(filters); + const lzma_ret ret = block_encoder_init(coder, allocator); + coder->block_options.filters = coder->filters; + if (ret != LZMA_OK) + return ret; + + coder->block_encoder_is_initialized = true; + + } else if (coder->sequence <= SEQ_BLOCK_ENCODE) { + // We are in the middle of a Block. Try to update only + // the filter-specific options. + return_if_error(coder->block_encoder.update( + coder->block_encoder.coder, allocator, + filters, reversed_filters)); + } else { + // Trying to update the filter chain when we are already + // encoding Index or Stream Footer. + return LZMA_PROG_ERROR; + } + + // Free the copy of the old chain and make a copy of the new chain. + for (size_t i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i) + lzma_free(coder->filters[i].options, allocator); + + return lzma_filters_copy(filters, coder->filters, allocator); +} + + +extern lzma_ret +lzma_stream_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter *filters, lzma_check check) +{ + lzma_next_coder_init(&lzma_stream_encoder_init, next, allocator); + + if (filters == NULL) + return LZMA_PROG_ERROR; + + if (next->coder == NULL) { + next->coder = lzma_alloc(sizeof(lzma_coder), allocator); + if (next->coder == NULL) + return LZMA_MEM_ERROR; + + next->code = &stream_encode; + next->end = &stream_encoder_end; + next->update = &stream_encoder_update; + + next->coder->filters[0].id = LZMA_VLI_UNKNOWN; + next->coder->block_encoder = LZMA_NEXT_CODER_INIT; + next->coder->index_encoder = LZMA_NEXT_CODER_INIT; + next->coder->index = NULL; + } + + // Basic initializations + next->coder->sequence = SEQ_STREAM_HEADER; + next->coder->block_options.version = 0; + next->coder->block_options.check = check; + + // Initialize the Index + lzma_index_end(next->coder->index, allocator); + next->coder->index = lzma_index_init(allocator); + if (next->coder->index == NULL) + return LZMA_MEM_ERROR; + + // Encode the Stream Header + lzma_stream_flags stream_flags = { + .version = 0, + .check = check, + }; + return_if_error(lzma_stream_header_encode( + &stream_flags, next->coder->buffer)); + + next->coder->buffer_pos = 0; + next->coder->buffer_size = LZMA_STREAM_HEADER_SIZE; + + // Initialize the Block encoder. This way we detect unsupported + // filter chains when initializing the Stream encoder instead of + // giving an error after Stream Header has already written out. + return stream_encoder_update( + next->coder, allocator, filters, NULL); +} + + +extern LZMA_API(lzma_ret) +lzma_stream_encoder(lzma_stream *strm, + const lzma_filter *filters, lzma_check check) +{ + lzma_next_strm_init(lzma_stream_encoder_init, strm, filters, check); + + strm->internal->supported_actions[LZMA_RUN] = true; + strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true; + strm->internal->supported_actions[LZMA_FULL_FLUSH] = true; + strm->internal->supported_actions[LZMA_FINISH] = true; + + return LZMA_OK; +} diff --git a/liblzma/common/stream_encoder.h b/liblzma/common/stream_encoder.h new file mode 100644 index 0000000..46a7aed --- /dev/null +++ b/liblzma/common/stream_encoder.h @@ -0,0 +1,23 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file stream_encoder.h +/// \brief Encodes .xz Streams +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_STREAM_ENCODER_H +#define LZMA_STREAM_ENCODER_H + +#include "common.h" + + +extern lzma_ret lzma_stream_encoder_init( + lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter *filters, lzma_check check); + +#endif diff --git a/liblzma/common/stream_flags_common.c b/liblzma/common/stream_flags_common.c new file mode 100644 index 0000000..fbe8eb8 --- /dev/null +++ b/liblzma/common/stream_flags_common.c @@ -0,0 +1,47 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file stream_flags_common.c +/// \brief Common stuff for Stream flags coders +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "stream_flags_common.h" + + +const uint8_t lzma_header_magic[6] = { 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00 }; +const uint8_t lzma_footer_magic[2] = { 0x59, 0x5A }; + + +extern LZMA_API(lzma_ret) +lzma_stream_flags_compare( + const lzma_stream_flags *a, const lzma_stream_flags *b) +{ + // We can compare only version 0 structures. + if (a->version != 0 || b->version != 0) + return LZMA_OPTIONS_ERROR; + + // Check type + if ((unsigned int)(a->check) > LZMA_CHECK_ID_MAX + || (unsigned int)(b->check) > LZMA_CHECK_ID_MAX) + return LZMA_PROG_ERROR; + + if (a->check != b->check) + return LZMA_DATA_ERROR; + + // Backward Sizes are compared only if they are known in both. + if (a->backward_size != LZMA_VLI_UNKNOWN + && b->backward_size != LZMA_VLI_UNKNOWN) { + if (!is_backward_size_valid(a) || !is_backward_size_valid(b)) + return LZMA_PROG_ERROR; + + if (a->backward_size != b->backward_size) + return LZMA_DATA_ERROR; + } + + return LZMA_OK; +} diff --git a/liblzma/common/stream_flags_common.h b/liblzma/common/stream_flags_common.h new file mode 100644 index 0000000..9f3122a --- /dev/null +++ b/liblzma/common/stream_flags_common.h @@ -0,0 +1,33 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file stream_flags_common.h +/// \brief Common stuff for Stream flags coders +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_STREAM_FLAGS_COMMON_H +#define LZMA_STREAM_FLAGS_COMMON_H + +#include "common.h" + +/// Size of the Stream Flags field +#define LZMA_STREAM_FLAGS_SIZE 2 + +extern const uint8_t lzma_header_magic[6]; +extern const uint8_t lzma_footer_magic[2]; + + +static inline bool +is_backward_size_valid(const lzma_stream_flags *options) +{ + return options->backward_size >= LZMA_BACKWARD_SIZE_MIN + && options->backward_size <= LZMA_BACKWARD_SIZE_MAX + && (options->backward_size & 3) == 0; +} + +#endif diff --git a/liblzma/common/stream_flags_decoder.c b/liblzma/common/stream_flags_decoder.c new file mode 100644 index 0000000..1bc2f97 --- /dev/null +++ b/liblzma/common/stream_flags_decoder.c @@ -0,0 +1,82 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file stream_flags_decoder.c +/// \brief Decodes Stream Header and Stream Footer from .xz files +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "stream_flags_common.h" + + +static bool +stream_flags_decode(lzma_stream_flags *options, const uint8_t *in) +{ + // Reserved bits must be unset. + if (in[0] != 0x00 || (in[1] & 0xF0)) + return true; + + options->version = 0; + options->check = in[1] & 0x0F; + + return false; +} + + +extern LZMA_API(lzma_ret) +lzma_stream_header_decode(lzma_stream_flags *options, const uint8_t *in) +{ + // Magic + if (memcmp(in, lzma_header_magic, sizeof(lzma_header_magic)) != 0) + return LZMA_FORMAT_ERROR; + + // Verify the CRC32 so we can distinguish between corrupt + // and unsupported files. + const uint32_t crc = lzma_crc32(in + sizeof(lzma_header_magic), + LZMA_STREAM_FLAGS_SIZE, 0); + if (crc != unaligned_read32le(in + sizeof(lzma_header_magic) + + LZMA_STREAM_FLAGS_SIZE)) + return LZMA_DATA_ERROR; + + // Stream Flags + if (stream_flags_decode(options, in + sizeof(lzma_header_magic))) + return LZMA_OPTIONS_ERROR; + + // Set Backward Size to indicate unknown value. That way + // lzma_stream_flags_compare() can be used to compare Stream Header + // and Stream Footer while keeping it useful also for comparing + // two Stream Footers. + options->backward_size = LZMA_VLI_UNKNOWN; + + return LZMA_OK; +} + + +extern LZMA_API(lzma_ret) +lzma_stream_footer_decode(lzma_stream_flags *options, const uint8_t *in) +{ + // Magic + if (memcmp(in + sizeof(uint32_t) * 2 + LZMA_STREAM_FLAGS_SIZE, + lzma_footer_magic, sizeof(lzma_footer_magic)) != 0) + return LZMA_FORMAT_ERROR; + + // CRC32 + const uint32_t crc = lzma_crc32(in + sizeof(uint32_t), + sizeof(uint32_t) + LZMA_STREAM_FLAGS_SIZE, 0); + if (crc != unaligned_read32le(in)) + return LZMA_DATA_ERROR; + + // Stream Flags + if (stream_flags_decode(options, in + sizeof(uint32_t) * 2)) + return LZMA_OPTIONS_ERROR; + + // Backward Size + options->backward_size = unaligned_read32le(in + sizeof(uint32_t)); + options->backward_size = (options->backward_size + 1) * 4; + + return LZMA_OK; +} diff --git a/liblzma/common/stream_flags_encoder.c b/liblzma/common/stream_flags_encoder.c new file mode 100644 index 0000000..4e71715 --- /dev/null +++ b/liblzma/common/stream_flags_encoder.c @@ -0,0 +1,86 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file stream_flags_encoder.c +/// \brief Encodes Stream Header and Stream Footer for .xz files +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "stream_flags_common.h" + + +static bool +stream_flags_encode(const lzma_stream_flags *options, uint8_t *out) +{ + if ((unsigned int)(options->check) > LZMA_CHECK_ID_MAX) + return true; + + out[0] = 0x00; + out[1] = options->check; + + return false; +} + + +extern LZMA_API(lzma_ret) +lzma_stream_header_encode(const lzma_stream_flags *options, uint8_t *out) +{ + assert(sizeof(lzma_header_magic) + LZMA_STREAM_FLAGS_SIZE + + 4 == LZMA_STREAM_HEADER_SIZE); + + if (options->version != 0) + return LZMA_OPTIONS_ERROR; + + // Magic + memcpy(out, lzma_header_magic, sizeof(lzma_header_magic)); + + // Stream Flags + if (stream_flags_encode(options, out + sizeof(lzma_header_magic))) + return LZMA_PROG_ERROR; + + // CRC32 of the Stream Header + const uint32_t crc = lzma_crc32(out + sizeof(lzma_header_magic), + LZMA_STREAM_FLAGS_SIZE, 0); + + unaligned_write32le(out + sizeof(lzma_header_magic) + + LZMA_STREAM_FLAGS_SIZE, crc); + + return LZMA_OK; +} + + +extern LZMA_API(lzma_ret) +lzma_stream_footer_encode(const lzma_stream_flags *options, uint8_t *out) +{ + assert(2 * 4 + LZMA_STREAM_FLAGS_SIZE + sizeof(lzma_footer_magic) + == LZMA_STREAM_HEADER_SIZE); + + if (options->version != 0) + return LZMA_OPTIONS_ERROR; + + // Backward Size + if (!is_backward_size_valid(options)) + return LZMA_PROG_ERROR; + + unaligned_write32le(out + 4, options->backward_size / 4 - 1); + + // Stream Flags + if (stream_flags_encode(options, out + 2 * 4)) + return LZMA_PROG_ERROR; + + // CRC32 + const uint32_t crc = lzma_crc32( + out + 4, 4 + LZMA_STREAM_FLAGS_SIZE, 0); + + unaligned_write32le(out, crc); + + // Magic + memcpy(out + 2 * 4 + LZMA_STREAM_FLAGS_SIZE, + lzma_footer_magic, sizeof(lzma_footer_magic)); + + return LZMA_OK; +} diff --git a/liblzma/common/vli_decoder.c b/liblzma/common/vli_decoder.c new file mode 100644 index 0000000..c181828 --- /dev/null +++ b/liblzma/common/vli_decoder.c @@ -0,0 +1,86 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file vli_decoder.c +/// \brief Decodes variable-length integers +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "common.h" + + +extern LZMA_API(lzma_ret) +lzma_vli_decode(lzma_vli *restrict vli, size_t *vli_pos, + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size) +{ + // If we haven't been given vli_pos, work in single-call mode. + size_t vli_pos_internal = 0; + if (vli_pos == NULL) { + vli_pos = &vli_pos_internal; + *vli = 0; + + // If there's no input, use LZMA_DATA_ERROR. This way it is + // easy to decode VLIs from buffers that have known size, + // and get the correct error code in case the buffer is + // too short. + if (*in_pos >= in_size) + return LZMA_DATA_ERROR; + + } else { + // Initialize *vli when starting to decode a new integer. + if (*vli_pos == 0) + *vli = 0; + + // Validate the arguments. + if (*vli_pos >= LZMA_VLI_BYTES_MAX + || (*vli >> (*vli_pos * 7)) != 0) + return LZMA_PROG_ERROR;; + + if (*in_pos >= in_size) + return LZMA_BUF_ERROR; + } + + do { + // Read the next byte. Use a temporary variable so that we + // can update *in_pos immediately. + const uint8_t byte = in[*in_pos]; + ++*in_pos; + + // Add the newly read byte to *vli. + *vli += (lzma_vli)(byte & 0x7F) << (*vli_pos * 7); + ++*vli_pos; + + // Check if this is the last byte of a multibyte integer. + if ((byte & 0x80) == 0) { + // We don't allow using variable-length integers as + // padding i.e. the encoding must use the most the + // compact form. + if (byte == 0x00 && *vli_pos > 1) + return LZMA_DATA_ERROR; + + return vli_pos == &vli_pos_internal + ? LZMA_OK : LZMA_STREAM_END; + } + + // There is at least one more byte coming. If we have already + // read maximum number of bytes, the integer is considered + // corrupt. + // + // If we need bigger integers in future, old versions liblzma + // will confusingly indicate the file being corrupt istead of + // unsupported. I suppose it's still better this way, because + // in the foreseeable future (writing this in 2008) the only + // reason why files would appear having over 63-bit integers + // is that the files are simply corrupt. + if (*vli_pos == LZMA_VLI_BYTES_MAX) + return LZMA_DATA_ERROR; + + } while (*in_pos < in_size); + + return vli_pos == &vli_pos_internal ? LZMA_DATA_ERROR : LZMA_OK; +} diff --git a/liblzma/common/vli_encoder.c b/liblzma/common/vli_encoder.c new file mode 100644 index 0000000..f864269 --- /dev/null +++ b/liblzma/common/vli_encoder.c @@ -0,0 +1,69 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file vli_encoder.c +/// \brief Encodes variable-length integers +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "common.h" + + +extern LZMA_API(lzma_ret) +lzma_vli_encode(lzma_vli vli, size_t *vli_pos, + uint8_t *restrict out, size_t *restrict out_pos, + size_t out_size) +{ + // If we haven't been given vli_pos, work in single-call mode. + size_t vli_pos_internal = 0; + if (vli_pos == NULL) { + vli_pos = &vli_pos_internal; + + // In single-call mode, we expect that the caller has + // reserved enough output space. + if (*out_pos >= out_size) + return LZMA_PROG_ERROR; + } else { + // This never happens when we are called by liblzma, but + // may happen if called directly from an application. + if (*out_pos >= out_size) + return LZMA_BUF_ERROR; + } + + // Validate the arguments. + if (*vli_pos >= LZMA_VLI_BYTES_MAX || vli > LZMA_VLI_MAX) + return LZMA_PROG_ERROR; + + // Shift vli so that the next bits to encode are the lowest. In + // single-call mode this never changes vli since *vli_pos is zero. + vli >>= *vli_pos * 7; + + // Write the non-last bytes in a loop. + while (vli >= 0x80) { + // We don't need *vli_pos during this function call anymore, + // but update it here so that it is ready if we need to + // return before the whole integer has been decoded. + ++*vli_pos; + assert(*vli_pos < LZMA_VLI_BYTES_MAX); + + // Write the next byte. + out[*out_pos] = (uint8_t)(vli) | 0x80; + vli >>= 7; + + if (++*out_pos == out_size) + return vli_pos == &vli_pos_internal + ? LZMA_PROG_ERROR : LZMA_OK; + } + + // Write the last byte. + out[*out_pos] = (uint8_t)(vli); + ++*out_pos; + ++*vli_pos; + + return vli_pos == &vli_pos_internal ? LZMA_OK : LZMA_STREAM_END; + +} diff --git a/liblzma/common/vli_size.c b/liblzma/common/vli_size.c new file mode 100644 index 0000000..ec1b4fa --- /dev/null +++ b/liblzma/common/vli_size.c @@ -0,0 +1,30 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file vli_size.c +/// \brief Calculates the encoded size of a variable-length integer +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "common.h" + + +extern LZMA_API(uint32_t) +lzma_vli_size(lzma_vli vli) +{ + if (vli > LZMA_VLI_MAX) + return 0; + + uint32_t i = 0; + do { + vli >>= 7; + ++i; + } while (vli != 0); + + assert(i <= LZMA_VLI_BYTES_MAX); + return i; +} diff --git a/liblzma/delta/Makefile.inc b/liblzma/delta/Makefile.inc new file mode 100644 index 0000000..c7739b4 --- /dev/null +++ b/liblzma/delta/Makefile.inc @@ -0,0 +1,23 @@ +## +## Author: Lasse Collin +## +## This file has been put into the public domain. +## You can do whatever you want with this file. +## + +liblzma_la_SOURCES += \ + delta/delta_common.c \ + delta/delta_common.h \ + delta/delta_private.h + +if COND_ENCODER_DELTA +liblzma_la_SOURCES += \ + delta/delta_encoder.c \ + delta/delta_encoder.h +endif + +if COND_DECODER_DELTA +liblzma_la_SOURCES += \ + delta/delta_decoder.c \ + delta/delta_decoder.h +endif diff --git a/liblzma/delta/delta_common.c b/liblzma/delta/delta_common.c new file mode 100644 index 0000000..930ad21 --- /dev/null +++ b/liblzma/delta/delta_common.c @@ -0,0 +1,70 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file delta_common.c +/// \brief Common stuff for Delta encoder and decoder +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "delta_common.h" +#include "delta_private.h" + + +static void +delta_coder_end(lzma_coder *coder, lzma_allocator *allocator) +{ + lzma_next_end(&coder->next, allocator); + lzma_free(coder, allocator); + return; +} + + +extern lzma_ret +lzma_delta_coder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters) +{ + // Allocate memory for the decoder if needed. + if (next->coder == NULL) { + next->coder = lzma_alloc(sizeof(lzma_coder), allocator); + if (next->coder == NULL) + return LZMA_MEM_ERROR; + + // End function is the same for encoder and decoder. + next->end = &delta_coder_end; + next->coder->next = LZMA_NEXT_CODER_INIT; + } + + // Validate the options. + if (lzma_delta_coder_memusage(filters[0].options) == UINT64_MAX) + return LZMA_OPTIONS_ERROR; + + // Set the delta distance. + const lzma_options_delta *opt = filters[0].options; + next->coder->distance = opt->dist; + + // Initialize the rest of the variables. + next->coder->pos = 0; + memzero(next->coder->history, LZMA_DELTA_DIST_MAX); + + // Initialize the next decoder in the chain, if any. + return lzma_next_filter_init(&next->coder->next, + allocator, filters + 1); +} + + +extern uint64_t +lzma_delta_coder_memusage(const void *options) +{ + const lzma_options_delta *opt = options; + + if (opt == NULL || opt->type != LZMA_DELTA_TYPE_BYTE + || opt->dist < LZMA_DELTA_DIST_MIN + || opt->dist > LZMA_DELTA_DIST_MAX) + return UINT64_MAX; + + return sizeof(lzma_coder); +} diff --git a/liblzma/delta/delta_common.h b/liblzma/delta/delta_common.h new file mode 100644 index 0000000..7e7e1ba --- /dev/null +++ b/liblzma/delta/delta_common.h @@ -0,0 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file delta_common.h +/// \brief Common stuff for Delta encoder and decoder +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_DELTA_COMMON_H +#define LZMA_DELTA_COMMON_H + +#include "common.h" + +extern uint64_t lzma_delta_coder_memusage(const void *options); + +#endif diff --git a/liblzma/delta/delta_decoder.c b/liblzma/delta/delta_decoder.c new file mode 100644 index 0000000..2cf60d5 --- /dev/null +++ b/liblzma/delta/delta_decoder.c @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file delta_decoder.c +/// \brief Delta filter decoder +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "delta_decoder.h" +#include "delta_private.h" + + +static void +decode_buffer(lzma_coder *coder, uint8_t *buffer, size_t size) +{ + const size_t distance = coder->distance; + + for (size_t i = 0; i < size; ++i) { + buffer[i] += coder->history[(distance + coder->pos) & 0xFF]; + coder->history[coder->pos-- & 0xFF] = buffer[i]; + } +} + + +static lzma_ret +delta_decode(lzma_coder *coder, lzma_allocator *allocator, + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size, lzma_action action) +{ + assert(coder->next.code != NULL); + + const size_t out_start = *out_pos; + + const lzma_ret ret = coder->next.code(coder->next.coder, allocator, + in, in_pos, in_size, out, out_pos, out_size, + action); + + decode_buffer(coder, out + out_start, *out_pos - out_start); + + return ret; +} + + +extern lzma_ret +lzma_delta_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters) +{ + next->code = &delta_decode; + return lzma_delta_coder_init(next, allocator, filters); +} + + +extern lzma_ret +lzma_delta_props_decode(void **options, lzma_allocator *allocator, + const uint8_t *props, size_t props_size) +{ + if (props_size != 1) + return LZMA_OPTIONS_ERROR; + + lzma_options_delta *opt + = lzma_alloc(sizeof(lzma_options_delta), allocator); + if (opt == NULL) + return LZMA_MEM_ERROR; + + opt->type = LZMA_DELTA_TYPE_BYTE; + opt->dist = props[0] + 1; + + *options = opt; + + return LZMA_OK; +} diff --git a/liblzma/delta/delta_decoder.h b/liblzma/delta/delta_decoder.h new file mode 100644 index 0000000..ae89acc --- /dev/null +++ b/liblzma/delta/delta_decoder.h @@ -0,0 +1,25 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file delta_decoder.h +/// \brief Delta filter decoder +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_DELTA_DECODER_H +#define LZMA_DELTA_DECODER_H + +#include "delta_common.h" + +extern lzma_ret lzma_delta_decoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + +extern lzma_ret lzma_delta_props_decode( + void **options, lzma_allocator *allocator, + const uint8_t *props, size_t props_size); + +#endif diff --git a/liblzma/delta/delta_encoder.c b/liblzma/delta/delta_encoder.c new file mode 100644 index 0000000..15c7951 --- /dev/null +++ b/liblzma/delta/delta_encoder.c @@ -0,0 +1,121 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file delta_encoder.c +/// \brief Delta filter encoder +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "delta_encoder.h" +#include "delta_private.h" + + +/// Copies and encodes the data at the same time. This is used when Delta +/// is the first filter in the chain (and thus the last filter in the +/// encoder's filter stack). +static void +copy_and_encode(lzma_coder *coder, + const uint8_t *restrict in, uint8_t *restrict out, size_t size) +{ + const size_t distance = coder->distance; + + for (size_t i = 0; i < size; ++i) { + const uint8_t tmp = coder->history[ + (distance + coder->pos) & 0xFF]; + coder->history[coder->pos-- & 0xFF] = in[i]; + out[i] = in[i] - tmp; + } +} + + +/// Encodes the data in place. This is used when we are the last filter +/// in the chain (and thus non-last filter in the encoder's filter stack). +static void +encode_in_place(lzma_coder *coder, uint8_t *buffer, size_t size) +{ + const size_t distance = coder->distance; + + for (size_t i = 0; i < size; ++i) { + const uint8_t tmp = coder->history[ + (distance + coder->pos) & 0xFF]; + coder->history[coder->pos-- & 0xFF] = buffer[i]; + buffer[i] -= tmp; + } +} + + +static lzma_ret +delta_encode(lzma_coder *coder, lzma_allocator *allocator, + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size, lzma_action action) +{ + lzma_ret ret; + + if (coder->next.code == NULL) { + const size_t in_avail = in_size - *in_pos; + const size_t out_avail = out_size - *out_pos; + const size_t size = my_min(in_avail, out_avail); + + copy_and_encode(coder, in + *in_pos, out + *out_pos, size); + + *in_pos += size; + *out_pos += size; + + ret = action != LZMA_RUN && *in_pos == in_size + ? LZMA_STREAM_END : LZMA_OK; + + } else { + const size_t out_start = *out_pos; + + ret = coder->next.code(coder->next.coder, allocator, + in, in_pos, in_size, out, out_pos, out_size, + action); + + encode_in_place(coder, out + out_start, *out_pos - out_start); + } + + return ret; +} + + +static lzma_ret +delta_encoder_update(lzma_coder *coder, lzma_allocator *allocator, + const lzma_filter *filters_null lzma_attribute((__unused__)), + const lzma_filter *reversed_filters) +{ + // Delta doesn't and will never support changing the options in + // the middle of encoding. If the app tries to change them, we + // simply ignore them. + return lzma_next_filter_update( + &coder->next, allocator, reversed_filters + 1); +} + + +extern lzma_ret +lzma_delta_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters) +{ + next->code = &delta_encode; + next->update = &delta_encoder_update; + return lzma_delta_coder_init(next, allocator, filters); +} + + +extern lzma_ret +lzma_delta_props_encode(const void *options, uint8_t *out) +{ + // The caller must have already validated the options, so it's + // LZMA_PROG_ERROR if they are invalid. + if (lzma_delta_coder_memusage(options) == UINT64_MAX) + return LZMA_PROG_ERROR; + + const lzma_options_delta *opt = options; + out[0] = opt->dist - LZMA_DELTA_DIST_MIN; + + return LZMA_OK; +} diff --git a/liblzma/delta/delta_encoder.h b/liblzma/delta/delta_encoder.h new file mode 100644 index 0000000..a447862 --- /dev/null +++ b/liblzma/delta/delta_encoder.h @@ -0,0 +1,23 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file delta_encoder.h +/// \brief Delta filter encoder +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_DELTA_ENCODER_H +#define LZMA_DELTA_ENCODER_H + +#include "delta_common.h" + +extern lzma_ret lzma_delta_encoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + +extern lzma_ret lzma_delta_props_encode(const void *options, uint8_t *out); + +#endif diff --git a/liblzma/delta/delta_private.h b/liblzma/delta/delta_private.h new file mode 100644 index 0000000..62b7fed --- /dev/null +++ b/liblzma/delta/delta_private.h @@ -0,0 +1,37 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file delta_private.h +/// \brief Private common stuff for Delta encoder and decoder +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_DELTA_PRIVATE_H +#define LZMA_DELTA_PRIVATE_H + +#include "delta_common.h" + +struct lzma_coder_s { + /// Next coder in the chain + lzma_next_coder next; + + /// Delta distance + size_t distance; + + /// Position in history[] + uint8_t pos; + + /// Buffer to hold history of the original data + uint8_t history[LZMA_DELTA_DIST_MAX]; +}; + + +extern lzma_ret lzma_delta_coder_init( + lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters); + +#endif diff --git a/liblzma/liblzma.pc.in b/liblzma/liblzma.pc.in new file mode 100644 index 0000000..7f11f1a --- /dev/null +++ b/liblzma/liblzma.pc.in @@ -0,0 +1,19 @@ +# +# Author: Lasse Collin +# +# This file has been put into the public domain. +# You can do whatever you want with this file. +# + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: liblzma +Description: General purpose data compression library +URL: @PACKAGE_URL@ +Version: @PACKAGE_VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -llzma +Libs.private: @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ diff --git a/liblzma/liblzma_w32res.rc b/liblzma/liblzma_w32res.rc new file mode 100644 index 0000000..d4d8159 --- /dev/null +++ b/liblzma/liblzma_w32res.rc @@ -0,0 +1,12 @@ +/* + * Author: Lasse Collin + * + * This file has been put into the public domain. + * You can do whatever you want with this file. + */ + +#define MY_TYPE VFT_DLL +#define MY_NAME "liblzma" +#define MY_SUFFIX ".dll" +#define MY_DESC "liblzma data compression library" +#include "common_w32res.rc" diff --git a/liblzma/lz/Makefile.inc b/liblzma/lz/Makefile.inc new file mode 100644 index 0000000..75742a8 --- /dev/null +++ b/liblzma/lz/Makefile.inc @@ -0,0 +1,22 @@ +## +## Author: Lasse Collin +## +## This file has been put into the public domain. +## You can do whatever you want with this file. +## + +if COND_ENCODER_LZ +liblzma_la_SOURCES += \ + lz/lz_encoder.c \ + lz/lz_encoder.h \ + lz/lz_encoder_hash.h \ + lz/lz_encoder_hash_table.h \ + lz/lz_encoder_mf.c +endif + + +if COND_DECODER_LZ +liblzma_la_SOURCES += \ + lz/lz_decoder.c \ + lz/lz_decoder.h +endif diff --git a/liblzma/lz/lz_decoder.c b/liblzma/lz/lz_decoder.c new file mode 100644 index 0000000..d74085c --- /dev/null +++ b/liblzma/lz/lz_decoder.c @@ -0,0 +1,300 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lz_decoder.c +/// \brief LZ out window +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +// liblzma supports multiple LZ77-based filters. The LZ part is shared +// between these filters. The LZ code takes care of dictionary handling +// and passing the data between filters in the chain. The filter-specific +// part decodes from the input buffer to the dictionary. + + +#include "lz_decoder.h" + + +struct lzma_coder_s { + /// Dictionary (history buffer) + lzma_dict dict; + + /// The actual LZ-based decoder e.g. LZMA + lzma_lz_decoder lz; + + /// Next filter in the chain, if any. Note that LZMA and LZMA2 are + /// only allowed as the last filter, but the long-range filter in + /// future can be in the middle of the chain. + lzma_next_coder next; + + /// True if the next filter in the chain has returned LZMA_STREAM_END. + bool next_finished; + + /// True if the LZ decoder (e.g. LZMA) has detected end of payload + /// marker. This may become true before next_finished becomes true. + bool this_finished; + + /// Temporary buffer needed when the LZ-based filter is not the last + /// filter in the chain. The output of the next filter is first + /// decoded into buffer[], which is then used as input for the actual + /// LZ-based decoder. + struct { + size_t pos; + size_t size; + uint8_t buffer[LZMA_BUFFER_SIZE]; + } temp; +}; + + +static void +lz_decoder_reset(lzma_coder *coder) +{ + coder->dict.pos = 0; + coder->dict.full = 0; + coder->dict.buf[coder->dict.size - 1] = '\0'; + coder->dict.need_reset = false; + return; +} + + +static lzma_ret +decode_buffer(lzma_coder *coder, + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size) +{ + while (true) { + // Wrap the dictionary if needed. + if (coder->dict.pos == coder->dict.size) + coder->dict.pos = 0; + + // Store the current dictionary position. It is needed to know + // where to start copying to the out[] buffer. + const size_t dict_start = coder->dict.pos; + + // Calculate how much we allow coder->lz.code() to decode. + // It must not decode past the end of the dictionary + // buffer, and we don't want it to decode more than is + // actually needed to fill the out[] buffer. + coder->dict.limit = coder->dict.pos + + my_min(out_size - *out_pos, + coder->dict.size - coder->dict.pos); + + // Call the coder->lz.code() to do the actual decoding. + const lzma_ret ret = coder->lz.code( + coder->lz.coder, &coder->dict, + in, in_pos, in_size); + + // Copy the decoded data from the dictionary to the out[] + // buffer. + const size_t copy_size = coder->dict.pos - dict_start; + assert(copy_size <= out_size - *out_pos); + memcpy(out + *out_pos, coder->dict.buf + dict_start, + copy_size); + *out_pos += copy_size; + + // Reset the dictionary if so requested by coder->lz.code(). + if (coder->dict.need_reset) { + lz_decoder_reset(coder); + + // Since we reset dictionary, we don't check if + // dictionary became full. + if (ret != LZMA_OK || *out_pos == out_size) + return ret; + } else { + // Return if everything got decoded or an error + // occurred, or if there's no more data to decode. + // + // Note that detecting if there's something to decode + // is done by looking if dictionary become full + // instead of looking if *in_pos == in_size. This + // is because it is possible that all the input was + // consumed already but some data is pending to be + // written to the dictionary. + if (ret != LZMA_OK || *out_pos == out_size + || coder->dict.pos < coder->dict.size) + return ret; + } + } +} + + +static lzma_ret +lz_decode(lzma_coder *coder, + lzma_allocator *allocator lzma_attribute((__unused__)), + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size, + lzma_action action) +{ + if (coder->next.code == NULL) + return decode_buffer(coder, in, in_pos, in_size, + out, out_pos, out_size); + + // We aren't the last coder in the chain, we need to decode + // our input to a temporary buffer. + while (*out_pos < out_size) { + // Fill the temporary buffer if it is empty. + if (!coder->next_finished + && coder->temp.pos == coder->temp.size) { + coder->temp.pos = 0; + coder->temp.size = 0; + + const lzma_ret ret = coder->next.code( + coder->next.coder, + allocator, in, in_pos, in_size, + coder->temp.buffer, &coder->temp.size, + LZMA_BUFFER_SIZE, action); + + if (ret == LZMA_STREAM_END) + coder->next_finished = true; + else if (ret != LZMA_OK || coder->temp.size == 0) + return ret; + } + + if (coder->this_finished) { + if (coder->temp.size != 0) + return LZMA_DATA_ERROR; + + if (coder->next_finished) + return LZMA_STREAM_END; + + return LZMA_OK; + } + + const lzma_ret ret = decode_buffer(coder, coder->temp.buffer, + &coder->temp.pos, coder->temp.size, + out, out_pos, out_size); + + if (ret == LZMA_STREAM_END) + coder->this_finished = true; + else if (ret != LZMA_OK) + return ret; + else if (coder->next_finished && *out_pos < out_size) + return LZMA_DATA_ERROR; + } + + return LZMA_OK; +} + + +static void +lz_decoder_end(lzma_coder *coder, lzma_allocator *allocator) +{ + lzma_next_end(&coder->next, allocator); + lzma_free(coder->dict.buf, allocator); + + if (coder->lz.end != NULL) + coder->lz.end(coder->lz.coder, allocator); + else + lzma_free(coder->lz.coder, allocator); + + lzma_free(coder, allocator); + return; +} + + +extern lzma_ret +lzma_lz_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters, + lzma_ret (*lz_init)(lzma_lz_decoder *lz, + lzma_allocator *allocator, const void *options, + lzma_lz_options *lz_options)) +{ + // Allocate the base structure if it isn't already allocated. + if (next->coder == NULL) { + next->coder = lzma_alloc(sizeof(lzma_coder), allocator); + if (next->coder == NULL) + return LZMA_MEM_ERROR; + + next->code = &lz_decode; + next->end = &lz_decoder_end; + + next->coder->dict.buf = NULL; + next->coder->dict.size = 0; + next->coder->lz = LZMA_LZ_DECODER_INIT; + next->coder->next = LZMA_NEXT_CODER_INIT; + } + + // Allocate and initialize the LZ-based decoder. It will also give + // us the dictionary size. + lzma_lz_options lz_options; + return_if_error(lz_init(&next->coder->lz, allocator, + filters[0].options, &lz_options)); + + // If the dictionary size is very small, increase it to 4096 bytes. + // This is to prevent constant wrapping of the dictionary, which + // would slow things down. The downside is that since we don't check + // separately for the real dictionary size, we may happily accept + // corrupt files. + if (lz_options.dict_size < 4096) + lz_options.dict_size = 4096; + + // Make dictionary size a multipe of 16. Some LZ-based decoders like + // LZMA use the lowest bits lzma_dict.pos to know the alignment of the + // data. Aligned buffer is also good when memcpying from the + // dictionary to the output buffer, since applications are + // recommended to give aligned buffers to liblzma. + // + // Avoid integer overflow. + if (lz_options.dict_size > SIZE_MAX - 15) + return LZMA_MEM_ERROR; + + lz_options.dict_size = (lz_options.dict_size + 15) & ~((size_t)(15)); + + // Allocate and initialize the dictionary. + if (next->coder->dict.size != lz_options.dict_size) { + lzma_free(next->coder->dict.buf, allocator); + next->coder->dict.buf + = lzma_alloc(lz_options.dict_size, allocator); + if (next->coder->dict.buf == NULL) + return LZMA_MEM_ERROR; + + next->coder->dict.size = lz_options.dict_size; + } + + lz_decoder_reset(next->coder); + + // Use the preset dictionary if it was given to us. + if (lz_options.preset_dict != NULL + && lz_options.preset_dict_size > 0) { + // If the preset dictionary is bigger than the actual + // dictionary, copy only the tail. + const size_t copy_size = my_min(lz_options.preset_dict_size, + lz_options.dict_size); + const size_t offset = lz_options.preset_dict_size - copy_size; + memcpy(next->coder->dict.buf, lz_options.preset_dict + offset, + copy_size); + next->coder->dict.pos = copy_size; + next->coder->dict.full = copy_size; + } + + // Miscellaneous initializations + next->coder->next_finished = false; + next->coder->this_finished = false; + next->coder->temp.pos = 0; + next->coder->temp.size = 0; + + // Initialize the next filter in the chain, if any. + return lzma_next_filter_init(&next->coder->next, allocator, + filters + 1); +} + + +extern uint64_t +lzma_lz_decoder_memusage(size_t dictionary_size) +{ + return sizeof(lzma_coder) + (uint64_t)(dictionary_size); +} + + +extern void +lzma_lz_decoder_uncompressed(lzma_coder *coder, lzma_vli uncompressed_size) +{ + coder->lz.set_uncompressed(coder->lz.coder, uncompressed_size); +} diff --git a/liblzma/lz/lz_decoder.h b/liblzma/lz/lz_decoder.h new file mode 100644 index 0000000..7266e80 --- /dev/null +++ b/liblzma/lz/lz_decoder.h @@ -0,0 +1,234 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lz_decoder.h +/// \brief LZ out window +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_LZ_DECODER_H +#define LZMA_LZ_DECODER_H + +#include "common.h" + + +typedef struct { + /// Pointer to the dictionary buffer. It can be an allocated buffer + /// internal to liblzma, or it can a be a buffer given by the + /// application when in single-call mode (not implemented yet). + uint8_t *buf; + + /// Write position in dictionary. The next byte will be written to + /// buf[pos]. + size_t pos; + + /// Indicates how full the dictionary is. This is used by + /// dict_is_distance_valid() to detect corrupt files that would + /// read beyond the beginning of the dictionary. + size_t full; + + /// Write limit + size_t limit; + + /// Size of the dictionary + size_t size; + + /// True when dictionary should be reset before decoding more data. + bool need_reset; + +} lzma_dict; + + +typedef struct { + size_t dict_size; + const uint8_t *preset_dict; + size_t preset_dict_size; +} lzma_lz_options; + + +typedef struct { + /// Data specific to the LZ-based decoder + lzma_coder *coder; + + /// Function to decode from in[] to *dict + lzma_ret (*code)(lzma_coder *restrict coder, + lzma_dict *restrict dict, const uint8_t *restrict in, + size_t *restrict in_pos, size_t in_size); + + void (*reset)(lzma_coder *coder, const void *options); + + /// Set the uncompressed size + void (*set_uncompressed)(lzma_coder *coder, + lzma_vli uncompressed_size); + + /// Free allocated resources + void (*end)(lzma_coder *coder, lzma_allocator *allocator); + +} lzma_lz_decoder; + + +#define LZMA_LZ_DECODER_INIT \ + (lzma_lz_decoder){ \ + .coder = NULL, \ + .code = NULL, \ + .reset = NULL, \ + .set_uncompressed = NULL, \ + .end = NULL, \ + } + + +extern lzma_ret lzma_lz_decoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters, + lzma_ret (*lz_init)(lzma_lz_decoder *lz, + lzma_allocator *allocator, const void *options, + lzma_lz_options *lz_options)); + +extern uint64_t lzma_lz_decoder_memusage(size_t dictionary_size); + +extern void lzma_lz_decoder_uncompressed( + lzma_coder *coder, lzma_vli uncompressed_size); + + +////////////////////// +// Inline functions // +////////////////////// + +/// Get a byte from the history buffer. +static inline uint8_t +dict_get(const lzma_dict *const dict, const uint32_t distance) +{ + return dict->buf[dict->pos - distance - 1 + + (distance < dict->pos ? 0 : dict->size)]; +} + + +/// Test if dictionary is empty. +static inline bool +dict_is_empty(const lzma_dict *const dict) +{ + return dict->full == 0; +} + + +/// Validate the match distance +static inline bool +dict_is_distance_valid(const lzma_dict *const dict, const size_t distance) +{ + return dict->full > distance; +} + + +/// Repeat *len bytes at distance. +static inline bool +dict_repeat(lzma_dict *dict, uint32_t distance, uint32_t *len) +{ + // Don't write past the end of the dictionary. + const size_t dict_avail = dict->limit - dict->pos; + uint32_t left = my_min(dict_avail, *len); + *len -= left; + + // Repeat a block of data from the history. Because memcpy() is faster + // than copying byte by byte in a loop, the copying process gets split + // into three cases. + if (distance < left) { + // Source and target areas overlap, thus we can't use + // memcpy() nor even memmove() safely. + do { + dict->buf[dict->pos] = dict_get(dict, distance); + ++dict->pos; + } while (--left > 0); + + } else if (distance < dict->pos) { + // The easiest and fastest case + memcpy(dict->buf + dict->pos, + dict->buf + dict->pos - distance - 1, + left); + dict->pos += left; + + } else { + // The bigger the dictionary, the more rare this + // case occurs. We need to "wrap" the dict, thus + // we might need two memcpy() to copy all the data. + assert(dict->full == dict->size); + const uint32_t copy_pos + = dict->pos - distance - 1 + dict->size; + uint32_t copy_size = dict->size - copy_pos; + + if (copy_size < left) { + memmove(dict->buf + dict->pos, dict->buf + copy_pos, + copy_size); + dict->pos += copy_size; + copy_size = left - copy_size; + memcpy(dict->buf + dict->pos, dict->buf, copy_size); + dict->pos += copy_size; + } else { + memmove(dict->buf + dict->pos, dict->buf + copy_pos, + left); + dict->pos += left; + } + } + + // Update how full the dictionary is. + if (dict->full < dict->pos) + dict->full = dict->pos; + + return unlikely(*len != 0); +} + + +/// Puts one byte into the dictionary. Returns true if the dictionary was +/// already full and the byte couldn't be added. +static inline bool +dict_put(lzma_dict *dict, uint8_t byte) +{ + if (unlikely(dict->pos == dict->limit)) + return true; + + dict->buf[dict->pos++] = byte; + + if (dict->pos > dict->full) + dict->full = dict->pos; + + return false; +} + + +/// Copies arbitrary amount of data into the dictionary. +static inline void +dict_write(lzma_dict *restrict dict, const uint8_t *restrict in, + size_t *restrict in_pos, size_t in_size, + size_t *restrict left) +{ + // NOTE: If we are being given more data than the size of the + // dictionary, it could be possible to optimize the LZ decoder + // so that not everything needs to go through the dictionary. + // This shouldn't be very common thing in practice though, and + // the slowdown of one extra memcpy() isn't bad compared to how + // much time it would have taken if the data were compressed. + + if (in_size - *in_pos > *left) + in_size = *in_pos + *left; + + *left -= lzma_bufcpy(in, in_pos, in_size, + dict->buf, &dict->pos, dict->limit); + + if (dict->pos > dict->full) + dict->full = dict->pos; + + return; +} + + +static inline void +dict_reset(lzma_dict *dict) +{ + dict->need_reset = true; + return; +} + +#endif diff --git a/liblzma/lz/lz_encoder.c b/liblzma/lz/lz_encoder.c new file mode 100644 index 0000000..e240696 --- /dev/null +++ b/liblzma/lz/lz_encoder.c @@ -0,0 +1,583 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lz_encoder.c +/// \brief LZ in window +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "lz_encoder.h" +#include "lz_encoder_hash.h" + +// See lz_encoder_hash.h. This is a bit hackish but avoids making +// endianness a conditional in makefiles. +#if defined(WORDS_BIGENDIAN) && !defined(HAVE_SMALL) +# include "lz_encoder_hash_table.h" +#endif + + +struct lzma_coder_s { + /// LZ-based encoder e.g. LZMA + lzma_lz_encoder lz; + + /// History buffer and match finder + lzma_mf mf; + + /// Next coder in the chain + lzma_next_coder next; +}; + + +/// \brief Moves the data in the input window to free space for new data +/// +/// mf->buffer is a sliding input window, which keeps mf->keep_size_before +/// bytes of input history available all the time. Now and then we need to +/// "slide" the buffer to make space for the new data to the end of the +/// buffer. At the same time, data older than keep_size_before is dropped. +/// +static void +move_window(lzma_mf *mf) +{ + // Align the move to a multiple of 16 bytes. Some LZ-based encoders + // like LZMA use the lowest bits of mf->read_pos to know the + // alignment of the uncompressed data. We also get better speed + // for memmove() with aligned buffers. + assert(mf->read_pos > mf->keep_size_before); + const uint32_t move_offset + = (mf->read_pos - mf->keep_size_before) & ~UINT32_C(15); + + assert(mf->write_pos > move_offset); + const size_t move_size = mf->write_pos - move_offset; + + assert(move_offset + move_size <= mf->size); + + memmove(mf->buffer, mf->buffer + move_offset, move_size); + + mf->offset += move_offset; + mf->read_pos -= move_offset; + mf->read_limit -= move_offset; + mf->write_pos -= move_offset; + + return; +} + + +/// \brief Tries to fill the input window (mf->buffer) +/// +/// If we are the last encoder in the chain, our input data is in in[]. +/// Otherwise we call the next filter in the chain to process in[] and +/// write its output to mf->buffer. +/// +/// This function must not be called once it has returned LZMA_STREAM_END. +/// +static lzma_ret +fill_window(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in, + size_t *in_pos, size_t in_size, lzma_action action) +{ + assert(coder->mf.read_pos <= coder->mf.write_pos); + + // Move the sliding window if needed. + if (coder->mf.read_pos >= coder->mf.size - coder->mf.keep_size_after) + move_window(&coder->mf); + + // Maybe this is ugly, but lzma_mf uses uint32_t for most things + // (which I find cleanest), but we need size_t here when filling + // the history window. + size_t write_pos = coder->mf.write_pos; + lzma_ret ret; + if (coder->next.code == NULL) { + // Not using a filter, simply memcpy() as much as possible. + lzma_bufcpy(in, in_pos, in_size, coder->mf.buffer, + &write_pos, coder->mf.size); + + ret = action != LZMA_RUN && *in_pos == in_size + ? LZMA_STREAM_END : LZMA_OK; + + } else { + ret = coder->next.code(coder->next.coder, allocator, + in, in_pos, in_size, + coder->mf.buffer, &write_pos, + coder->mf.size, action); + } + + coder->mf.write_pos = write_pos; + + // If end of stream has been reached or flushing completed, we allow + // the encoder to process all the input (that is, read_pos is allowed + // to reach write_pos). Otherwise we keep keep_size_after bytes + // available as prebuffer. + if (ret == LZMA_STREAM_END) { + assert(*in_pos == in_size); + ret = LZMA_OK; + coder->mf.action = action; + coder->mf.read_limit = coder->mf.write_pos; + + } else if (coder->mf.write_pos > coder->mf.keep_size_after) { + // This needs to be done conditionally, because if we got + // only little new input, there may be too little input + // to do any encoding yet. + coder->mf.read_limit = coder->mf.write_pos + - coder->mf.keep_size_after; + } + + // Restart the match finder after finished LZMA_SYNC_FLUSH. + if (coder->mf.pending > 0 + && coder->mf.read_pos < coder->mf.read_limit) { + // Match finder may update coder->pending and expects it to + // start from zero, so use a temporary variable. + const size_t pending = coder->mf.pending; + coder->mf.pending = 0; + + // Rewind read_pos so that the match finder can hash + // the pending bytes. + assert(coder->mf.read_pos >= pending); + coder->mf.read_pos -= pending; + + // Call the skip function directly instead of using + // mf_skip(), since we don't want to touch mf->read_ahead. + coder->mf.skip(&coder->mf, pending); + } + + return ret; +} + + +static lzma_ret +lz_encode(lzma_coder *coder, lzma_allocator *allocator, + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, + uint8_t *restrict out, size_t *restrict out_pos, + size_t out_size, lzma_action action) +{ + while (*out_pos < out_size + && (*in_pos < in_size || action != LZMA_RUN)) { + // Read more data to coder->mf.buffer if needed. + if (coder->mf.action == LZMA_RUN && coder->mf.read_pos + >= coder->mf.read_limit) + return_if_error(fill_window(coder, allocator, + in, in_pos, in_size, action)); + + // Encode + const lzma_ret ret = coder->lz.code(coder->lz.coder, + &coder->mf, out, out_pos, out_size); + if (ret != LZMA_OK) { + // Setting this to LZMA_RUN for cases when we are + // flushing. It doesn't matter when finishing or if + // an error occurred. + coder->mf.action = LZMA_RUN; + return ret; + } + } + + return LZMA_OK; +} + + +static bool +lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator, + const lzma_lz_options *lz_options) +{ + // For now, the dictionary size is limited to 1.5 GiB. This may grow + // in the future if needed, but it needs a little more work than just + // changing this check. + if (lz_options->dict_size < LZMA_DICT_SIZE_MIN + || lz_options->dict_size + > (UINT32_C(1) << 30) + (UINT32_C(1) << 29) + || lz_options->nice_len > lz_options->match_len_max) + return true; + + mf->keep_size_before = lz_options->before_size + lz_options->dict_size; + + mf->keep_size_after = lz_options->after_size + + lz_options->match_len_max; + + // To avoid constant memmove()s, allocate some extra space. Since + // memmove()s become more expensive when the size of the buffer + // increases, we reserve more space when a large dictionary is + // used to make the memmove() calls rarer. + // + // This works with dictionaries up to about 3 GiB. If bigger + // dictionary is wanted, some extra work is needed: + // - Several variables in lzma_mf have to be changed from uint32_t + // to size_t. + // - Memory usage calculation needs something too, e.g. use uint64_t + // for mf->size. + uint32_t reserve = lz_options->dict_size / 2; + if (reserve > (UINT32_C(1) << 30)) + reserve /= 2; + + reserve += (lz_options->before_size + lz_options->match_len_max + + lz_options->after_size) / 2 + (UINT32_C(1) << 19); + + const uint32_t old_size = mf->size; + mf->size = mf->keep_size_before + reserve + mf->keep_size_after; + + // Deallocate the old history buffer if it exists but has different + // size than what is needed now. + if (mf->buffer != NULL && old_size != mf->size) { + lzma_free(mf->buffer, allocator); + mf->buffer = NULL; + } + + // Match finder options + mf->match_len_max = lz_options->match_len_max; + mf->nice_len = lz_options->nice_len; + + // cyclic_size has to stay smaller than 2 Gi. Note that this doesn't + // mean limiting dictionary size to less than 2 GiB. With a match + // finder that uses multibyte resolution (hashes start at e.g. every + // fourth byte), cyclic_size would stay below 2 Gi even when + // dictionary size is greater than 2 GiB. + // + // It would be possible to allow cyclic_size >= 2 Gi, but then we + // would need to be careful to use 64-bit types in various places + // (size_t could do since we would need bigger than 32-bit address + // space anyway). It would also require either zeroing a multigigabyte + // buffer at initialization (waste of time and RAM) or allow + // normalization in lz_encoder_mf.c to access uninitialized + // memory to keep the code simpler. The current way is simple and + // still allows pretty big dictionaries, so I don't expect these + // limits to change. + mf->cyclic_size = lz_options->dict_size + 1; + + // Validate the match finder ID and setup the function pointers. + switch (lz_options->match_finder) { +#ifdef HAVE_MF_HC3 + case LZMA_MF_HC3: + mf->find = &lzma_mf_hc3_find; + mf->skip = &lzma_mf_hc3_skip; + break; +#endif +#ifdef HAVE_MF_HC4 + case LZMA_MF_HC4: + mf->find = &lzma_mf_hc4_find; + mf->skip = &lzma_mf_hc4_skip; + break; +#endif +#ifdef HAVE_MF_BT2 + case LZMA_MF_BT2: + mf->find = &lzma_mf_bt2_find; + mf->skip = &lzma_mf_bt2_skip; + break; +#endif +#ifdef HAVE_MF_BT3 + case LZMA_MF_BT3: + mf->find = &lzma_mf_bt3_find; + mf->skip = &lzma_mf_bt3_skip; + break; +#endif +#ifdef HAVE_MF_BT4 + case LZMA_MF_BT4: + mf->find = &lzma_mf_bt4_find; + mf->skip = &lzma_mf_bt4_skip; + break; +#endif + + default: + return true; + } + + // Calculate the sizes of mf->hash and mf->son and check that + // nice_len is big enough for the selected match finder. + const uint32_t hash_bytes = lz_options->match_finder & 0x0F; + if (hash_bytes > mf->nice_len) + return true; + + const bool is_bt = (lz_options->match_finder & 0x10) != 0; + uint32_t hs; + + if (hash_bytes == 2) { + hs = 0xFFFF; + } else { + // Round dictionary size up to the next 2^n - 1 so it can + // be used as a hash mask. + hs = lz_options->dict_size - 1; + hs |= hs >> 1; + hs |= hs >> 2; + hs |= hs >> 4; + hs |= hs >> 8; + hs >>= 1; + hs |= 0xFFFF; + + if (hs > (UINT32_C(1) << 24)) { + if (hash_bytes == 3) + hs = (UINT32_C(1) << 24) - 1; + else + hs >>= 1; + } + } + + mf->hash_mask = hs; + + ++hs; + if (hash_bytes > 2) + hs += HASH_2_SIZE; + if (hash_bytes > 3) + hs += HASH_3_SIZE; +/* + No match finder uses this at the moment. + if (mf->hash_bytes > 4) + hs += HASH_4_SIZE; +*/ + + // If the above code calculating hs is modified, make sure that + // this assertion stays valid (UINT32_MAX / 5 is not strictly the + // exact limit). If it doesn't, you need to calculate that + // hash_size_sum + sons_count cannot overflow. + assert(hs < UINT32_MAX / 5); + + const uint32_t old_count = mf->hash_size_sum + mf->sons_count; + mf->hash_size_sum = hs; + mf->sons_count = mf->cyclic_size; + if (is_bt) + mf->sons_count *= 2; + + const uint32_t new_count = mf->hash_size_sum + mf->sons_count; + + // Deallocate the old hash array if it exists and has different size + // than what is needed now. + if (old_count != new_count) { + lzma_free(mf->hash, allocator); + mf->hash = NULL; + } + + // Maximum number of match finder cycles + mf->depth = lz_options->depth; + if (mf->depth == 0) { + if (is_bt) + mf->depth = 16 + mf->nice_len / 2; + else + mf->depth = 4 + mf->nice_len / 4; + } + + return false; +} + + +static bool +lz_encoder_init(lzma_mf *mf, lzma_allocator *allocator, + const lzma_lz_options *lz_options) +{ + // Allocate the history buffer. + if (mf->buffer == NULL) { + mf->buffer = lzma_alloc(mf->size, allocator); + if (mf->buffer == NULL) + return true; + } + + // Use cyclic_size as initial mf->offset. This allows + // avoiding a few branches in the match finders. The downside is + // that match finder needs to be normalized more often, which may + // hurt performance with huge dictionaries. + mf->offset = mf->cyclic_size; + mf->read_pos = 0; + mf->read_ahead = 0; + mf->read_limit = 0; + mf->write_pos = 0; + mf->pending = 0; + + // Allocate match finder's hash array. + const size_t alloc_count = mf->hash_size_sum + mf->sons_count; + +#if UINT32_MAX >= SIZE_MAX / 4 + // Check for integer overflow. (Huge dictionaries are not + // possible on 32-bit CPU.) + if (alloc_count > SIZE_MAX / sizeof(uint32_t)) + return true; +#endif + + if (mf->hash == NULL) { + mf->hash = lzma_alloc(alloc_count * sizeof(uint32_t), + allocator); + if (mf->hash == NULL) + return true; + } + + mf->son = mf->hash + mf->hash_size_sum; + mf->cyclic_pos = 0; + + // Initialize the hash table. Since EMPTY_HASH_VALUE is zero, we + // can use memset(). +/* + for (uint32_t i = 0; i < hash_size_sum; ++i) + mf->hash[i] = EMPTY_HASH_VALUE; +*/ + memzero(mf->hash, (size_t)(mf->hash_size_sum) * sizeof(uint32_t)); + + // We don't need to initialize mf->son, but not doing that will + // make Valgrind complain in normalization (see normalize() in + // lz_encoder_mf.c). + // + // Skipping this initialization is *very* good when big dictionary is + // used but only small amount of data gets actually compressed: most + // of the mf->hash won't get actually allocated by the kernel, so + // we avoid wasting RAM and improve initialization speed a lot. + //memzero(mf->son, (size_t)(mf->sons_count) * sizeof(uint32_t)); + + // Handle preset dictionary. + if (lz_options->preset_dict != NULL + && lz_options->preset_dict_size > 0) { + // If the preset dictionary is bigger than the actual + // dictionary, use only the tail. + mf->write_pos = my_min(lz_options->preset_dict_size, mf->size); + memcpy(mf->buffer, lz_options->preset_dict + + lz_options->preset_dict_size - mf->write_pos, + mf->write_pos); + mf->action = LZMA_SYNC_FLUSH; + mf->skip(mf, mf->write_pos); + } + + mf->action = LZMA_RUN; + + return false; +} + + +extern uint64_t +lzma_lz_encoder_memusage(const lzma_lz_options *lz_options) +{ + // Old buffers must not exist when calling lz_encoder_prepare(). + lzma_mf mf = { + .buffer = NULL, + .hash = NULL, + .hash_size_sum = 0, + .sons_count = 0, + }; + + // Setup the size information into mf. + if (lz_encoder_prepare(&mf, NULL, lz_options)) + return UINT64_MAX; + + // Calculate the memory usage. + return (uint64_t)(mf.hash_size_sum + mf.sons_count) + * sizeof(uint32_t) + + (uint64_t)(mf.size) + sizeof(lzma_coder); +} + + +static void +lz_encoder_end(lzma_coder *coder, lzma_allocator *allocator) +{ + lzma_next_end(&coder->next, allocator); + + lzma_free(coder->mf.hash, allocator); + lzma_free(coder->mf.buffer, allocator); + + if (coder->lz.end != NULL) + coder->lz.end(coder->lz.coder, allocator); + else + lzma_free(coder->lz.coder, allocator); + + lzma_free(coder, allocator); + return; +} + + +static lzma_ret +lz_encoder_update(lzma_coder *coder, lzma_allocator *allocator, + const lzma_filter *filters_null lzma_attribute((__unused__)), + const lzma_filter *reversed_filters) +{ + if (coder->lz.options_update == NULL) + return LZMA_PROG_ERROR; + + return_if_error(coder->lz.options_update( + coder->lz.coder, reversed_filters)); + + return lzma_next_filter_update( + &coder->next, allocator, reversed_filters + 1); +} + + +extern lzma_ret +lzma_lz_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters, + lzma_ret (*lz_init)(lzma_lz_encoder *lz, + lzma_allocator *allocator, const void *options, + lzma_lz_options *lz_options)) +{ +#ifdef HAVE_SMALL + // We need that the CRC32 table has been initialized. + lzma_crc32_init(); +#endif + + // Allocate and initialize the base data structure. + if (next->coder == NULL) { + next->coder = lzma_alloc(sizeof(lzma_coder), allocator); + if (next->coder == NULL) + return LZMA_MEM_ERROR; + + next->code = &lz_encode; + next->end = &lz_encoder_end; + next->update = &lz_encoder_update; + + next->coder->lz.coder = NULL; + next->coder->lz.code = NULL; + next->coder->lz.end = NULL; + + next->coder->mf.buffer = NULL; + next->coder->mf.hash = NULL; + next->coder->mf.hash_size_sum = 0; + next->coder->mf.sons_count = 0; + + next->coder->next = LZMA_NEXT_CODER_INIT; + } + + // Initialize the LZ-based encoder. + lzma_lz_options lz_options; + return_if_error(lz_init(&next->coder->lz, allocator, + filters[0].options, &lz_options)); + + // Setup the size information into next->coder->mf and deallocate + // old buffers if they have wrong size. + if (lz_encoder_prepare(&next->coder->mf, allocator, &lz_options)) + return LZMA_OPTIONS_ERROR; + + // Allocate new buffers if needed, and do the rest of + // the initialization. + if (lz_encoder_init(&next->coder->mf, allocator, &lz_options)) + return LZMA_MEM_ERROR; + + // Initialize the next filter in the chain, if any. + return lzma_next_filter_init(&next->coder->next, allocator, + filters + 1); +} + + +extern LZMA_API(lzma_bool) +lzma_mf_is_supported(lzma_match_finder mf) +{ + bool ret = false; + +#ifdef HAVE_MF_HC3 + if (mf == LZMA_MF_HC3) + ret = true; +#endif + +#ifdef HAVE_MF_HC4 + if (mf == LZMA_MF_HC4) + ret = true; +#endif + +#ifdef HAVE_MF_BT2 + if (mf == LZMA_MF_BT2) + ret = true; +#endif + +#ifdef HAVE_MF_BT3 + if (mf == LZMA_MF_BT3) + ret = true; +#endif + +#ifdef HAVE_MF_BT4 + if (mf == LZMA_MF_BT4) + ret = true; +#endif + + return ret; +} diff --git a/liblzma/lz/lz_encoder.h b/liblzma/lz/lz_encoder.h new file mode 100644 index 0000000..741c453 --- /dev/null +++ b/liblzma/lz/lz_encoder.h @@ -0,0 +1,328 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lz_encoder.h +/// \brief LZ in window and match finder API +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_LZ_ENCODER_H +#define LZMA_LZ_ENCODER_H + +#include "common.h" + + +/// A table of these is used by the LZ-based encoder to hold +/// the length-distance pairs found by the match finder. +typedef struct { + uint32_t len; + uint32_t dist; +} lzma_match; + + +typedef struct lzma_mf_s lzma_mf; +struct lzma_mf_s { + /////////////// + // In Window // + /////////////// + + /// Pointer to buffer with data to be compressed + uint8_t *buffer; + + /// Total size of the allocated buffer (that is, including all + /// the extra space) + uint32_t size; + + /// Number of bytes that must be kept available in our input history. + /// That is, once keep_size_before bytes have been processed, + /// buffer[read_pos - keep_size_before] is the oldest byte that + /// must be available for reading. + uint32_t keep_size_before; + + /// Number of bytes that must be kept in buffer after read_pos. + /// That is, read_pos <= write_pos - keep_size_after as long as + /// action is LZMA_RUN; when action != LZMA_RUN, read_pos is allowed + /// to reach write_pos so that the last bytes get encoded too. + uint32_t keep_size_after; + + /// Match finders store locations of matches using 32-bit integers. + /// To avoid adjusting several megabytes of integers every time the + /// input window is moved with move_window, we only adjust the + /// offset of the buffer. Thus, buffer[value_in_hash_table - offset] + /// is the byte pointed by value_in_hash_table. + uint32_t offset; + + /// buffer[read_pos] is the next byte to run through the match + /// finder. This is incremented in the match finder once the byte + /// has been processed. + uint32_t read_pos; + + /// Number of bytes that have been ran through the match finder, but + /// which haven't been encoded by the LZ-based encoder yet. + uint32_t read_ahead; + + /// As long as read_pos is less than read_limit, there is enough + /// input available in buffer for at least one encoding loop. + /// + /// Because of the stateful API, read_limit may and will get greater + /// than read_pos quite often. This is taken into account when + /// calculating the value for keep_size_after. + uint32_t read_limit; + + /// buffer[write_pos] is the first byte that doesn't contain valid + /// uncompressed data; that is, the next input byte will be copied + /// to buffer[write_pos]. + uint32_t write_pos; + + /// Number of bytes not hashed before read_pos. This is needed to + /// restart the match finder after LZMA_SYNC_FLUSH. + uint32_t pending; + + ////////////////// + // Match Finder // + ////////////////// + + /// Find matches. Returns the number of distance-length pairs written + /// to the matches array. This is called only via lzma_mf_find(). + uint32_t (*find)(lzma_mf *mf, lzma_match *matches); + + /// Skips num bytes. This is like find() but doesn't make the + /// distance-length pairs available, thus being a little faster. + /// This is called only via mf_skip(). + void (*skip)(lzma_mf *mf, uint32_t num); + + uint32_t *hash; + uint32_t *son; + uint32_t cyclic_pos; + uint32_t cyclic_size; // Must be dictionary size + 1. + uint32_t hash_mask; + + /// Maximum number of loops in the match finder + uint32_t depth; + + /// Maximum length of a match that the match finder will try to find. + uint32_t nice_len; + + /// Maximum length of a match supported by the LZ-based encoder. + /// If the longest match found by the match finder is nice_len, + /// mf_find() tries to expand it up to match_len_max bytes. + uint32_t match_len_max; + + /// When running out of input, binary tree match finders need to know + /// if it is due to flushing or finishing. The action is used also + /// by the LZ-based encoders themselves. + lzma_action action; + + /// Number of elements in hash[] + uint32_t hash_size_sum; + + /// Number of elements in son[] + uint32_t sons_count; +}; + + +typedef struct { + /// Extra amount of data to keep available before the "actual" + /// dictionary. + size_t before_size; + + /// Size of the history buffer + size_t dict_size; + + /// Extra amount of data to keep available after the "actual" + /// dictionary. + size_t after_size; + + /// Maximum length of a match that the LZ-based encoder can accept. + /// This is used to extend matches of length nice_len to the + /// maximum possible length. + size_t match_len_max; + + /// Match finder will search matches up to this length. + /// This must be less than or equal to match_len_max. + size_t nice_len; + + /// Type of the match finder to use + lzma_match_finder match_finder; + + /// Maximum search depth + uint32_t depth; + + /// TODO: Comment + const uint8_t *preset_dict; + + uint32_t preset_dict_size; + +} lzma_lz_options; + + +// The total usable buffer space at any moment outside the match finder: +// before_size + dict_size + after_size + match_len_max +// +// In reality, there's some extra space allocated to prevent the number of +// memmove() calls reasonable. The bigger the dict_size is, the bigger +// this extra buffer will be since with bigger dictionaries memmove() would +// also take longer. +// +// A single encoder loop in the LZ-based encoder may call the match finder +// (mf_find() or mf_skip()) at most after_size times. In other words, +// a single encoder loop may increment lzma_mf.read_pos at most after_size +// times. Since matches are looked up to +// lzma_mf.buffer[lzma_mf.read_pos + match_len_max - 1], the total +// amount of extra buffer needed after dict_size becomes +// after_size + match_len_max. +// +// before_size has two uses. The first one is to keep literals available +// in cases when the LZ-based encoder has made some read ahead. +// TODO: Maybe this could be changed by making the LZ-based encoders to +// store the actual literals as they do with length-distance pairs. +// +// Algorithms such as LZMA2 first try to compress a chunk, and then check +// if the encoded result is smaller than the uncompressed one. If the chunk +// was uncompressible, it is better to store it in uncompressed form in +// the output stream. To do this, the whole uncompressed chunk has to be +// still available in the history buffer. before_size achieves that. + + +typedef struct { + /// Data specific to the LZ-based encoder + lzma_coder *coder; + + /// Function to encode from *dict to out[] + lzma_ret (*code)(lzma_coder *restrict coder, + lzma_mf *restrict mf, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size); + + /// Free allocated resources + void (*end)(lzma_coder *coder, lzma_allocator *allocator); + + /// Update the options in the middle of the encoding. + lzma_ret (*options_update)(lzma_coder *coder, + const lzma_filter *filter); + +} lzma_lz_encoder; + + +// Basic steps: +// 1. Input gets copied into the dictionary. +// 2. Data in dictionary gets run through the match finder byte by byte. +// 3. The literals and matches are encoded using e.g. LZMA. +// +// The bytes that have been ran through the match finder, but not encoded yet, +// are called `read ahead'. + + +/// Get pointer to the first byte not ran through the match finder +static inline const uint8_t * +mf_ptr(const lzma_mf *mf) +{ + return mf->buffer + mf->read_pos; +} + + +/// Get the number of bytes that haven't been ran through the match finder yet. +static inline uint32_t +mf_avail(const lzma_mf *mf) +{ + return mf->write_pos - mf->read_pos; +} + + +/// Get the number of bytes that haven't been encoded yet (some of these +/// bytes may have been ran through the match finder though). +static inline uint32_t +mf_unencoded(const lzma_mf *mf) +{ + return mf->write_pos - mf->read_pos + mf->read_ahead; +} + + +/// Calculate the absolute offset from the beginning of the most recent +/// dictionary reset. Only the lowest four bits are important, so there's no +/// problem that we don't know the 64-bit size of the data encoded so far. +/// +/// NOTE: When moving the input window, we need to do it so that the lowest +/// bits of dict->read_pos are not modified to keep this macro working +/// as intended. +static inline uint32_t +mf_position(const lzma_mf *mf) +{ + return mf->read_pos - mf->read_ahead; +} + + +/// Since everything else begins with mf_, use it also for lzma_mf_find(). +#define mf_find lzma_mf_find + + +/// Skip the given number of bytes. This is used when a good match was found. +/// For example, if mf_find() finds a match of 200 bytes long, the first byte +/// of that match was already consumed by mf_find(), and the rest 199 bytes +/// have to be skipped with mf_skip(mf, 199). +static inline void +mf_skip(lzma_mf *mf, uint32_t amount) +{ + if (amount != 0) { + mf->skip(mf, amount); + mf->read_ahead += amount; + } +} + + +/// Copies at most *left number of bytes from the history buffer +/// to out[]. This is needed by LZMA2 to encode uncompressed chunks. +static inline void +mf_read(lzma_mf *mf, uint8_t *out, size_t *out_pos, size_t out_size, + size_t *left) +{ + const size_t out_avail = out_size - *out_pos; + const size_t copy_size = my_min(out_avail, *left); + + assert(mf->read_ahead == 0); + assert(mf->read_pos >= *left); + + memcpy(out + *out_pos, mf->buffer + mf->read_pos - *left, + copy_size); + + *out_pos += copy_size; + *left -= copy_size; + return; +} + + +extern lzma_ret lzma_lz_encoder_init( + lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters, + lzma_ret (*lz_init)(lzma_lz_encoder *lz, + lzma_allocator *allocator, const void *options, + lzma_lz_options *lz_options)); + + +extern uint64_t lzma_lz_encoder_memusage(const lzma_lz_options *lz_options); + + +// These are only for LZ encoder's internal use. +extern uint32_t lzma_mf_find( + lzma_mf *mf, uint32_t *count, lzma_match *matches); + +extern uint32_t lzma_mf_hc3_find(lzma_mf *dict, lzma_match *matches); +extern void lzma_mf_hc3_skip(lzma_mf *dict, uint32_t amount); + +extern uint32_t lzma_mf_hc4_find(lzma_mf *dict, lzma_match *matches); +extern void lzma_mf_hc4_skip(lzma_mf *dict, uint32_t amount); + +extern uint32_t lzma_mf_bt2_find(lzma_mf *dict, lzma_match *matches); +extern void lzma_mf_bt2_skip(lzma_mf *dict, uint32_t amount); + +extern uint32_t lzma_mf_bt3_find(lzma_mf *dict, lzma_match *matches); +extern void lzma_mf_bt3_skip(lzma_mf *dict, uint32_t amount); + +extern uint32_t lzma_mf_bt4_find(lzma_mf *dict, lzma_match *matches); +extern void lzma_mf_bt4_skip(lzma_mf *dict, uint32_t amount); + +#endif diff --git a/liblzma/lz/lz_encoder_hash.h b/liblzma/lz/lz_encoder_hash.h new file mode 100644 index 0000000..342a333 --- /dev/null +++ b/liblzma/lz/lz_encoder_hash.h @@ -0,0 +1,108 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lz_encoder_hash.h +/// \brief Hash macros for match finders +// +// Author: Igor Pavlov +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_LZ_ENCODER_HASH_H +#define LZMA_LZ_ENCODER_HASH_H + +#if defined(WORDS_BIGENDIAN) && !defined(HAVE_SMALL) + // This is to make liblzma produce the same output on big endian + // systems that it does on little endian systems. lz_encoder.c + // takes care of including the actual table. + extern const uint32_t lzma_lz_hash_table[256]; +# define hash_table lzma_lz_hash_table +#else +# include "check.h" +# define hash_table lzma_crc32_table[0] +#endif + +#define HASH_2_SIZE (UINT32_C(1) << 10) +#define HASH_3_SIZE (UINT32_C(1) << 16) +#define HASH_4_SIZE (UINT32_C(1) << 20) + +#define HASH_2_MASK (HASH_2_SIZE - 1) +#define HASH_3_MASK (HASH_3_SIZE - 1) +#define HASH_4_MASK (HASH_4_SIZE - 1) + +#define FIX_3_HASH_SIZE (HASH_2_SIZE) +#define FIX_4_HASH_SIZE (HASH_2_SIZE + HASH_3_SIZE) +#define FIX_5_HASH_SIZE (HASH_2_SIZE + HASH_3_SIZE + HASH_4_SIZE) + +// Endianness doesn't matter in hash_2_calc() (no effect on the output). +#ifdef TUKLIB_FAST_UNALIGNED_ACCESS +# define hash_2_calc() \ + const uint32_t hash_value = *(const uint16_t *)(cur) +#else +# define hash_2_calc() \ + const uint32_t hash_value \ + = (uint32_t)(cur[0]) | ((uint32_t)(cur[1]) << 8) +#endif + +#define hash_3_calc() \ + const uint32_t temp = hash_table[cur[0]] ^ cur[1]; \ + const uint32_t hash_2_value = temp & HASH_2_MASK; \ + const uint32_t hash_value \ + = (temp ^ ((uint32_t)(cur[2]) << 8)) & mf->hash_mask + +#define hash_4_calc() \ + const uint32_t temp = hash_table[cur[0]] ^ cur[1]; \ + const uint32_t hash_2_value = temp & HASH_2_MASK; \ + const uint32_t hash_3_value \ + = (temp ^ ((uint32_t)(cur[2]) << 8)) & HASH_3_MASK; \ + const uint32_t hash_value = (temp ^ ((uint32_t)(cur[2]) << 8) \ + ^ (hash_table[cur[3]] << 5)) & mf->hash_mask + + +// The following are not currently used. + +#define hash_5_calc() \ + const uint32_t temp = hash_table[cur[0]] ^ cur[1]; \ + const uint32_t hash_2_value = temp & HASH_2_MASK; \ + const uint32_t hash_3_value \ + = (temp ^ ((uint32_t)(cur[2]) << 8)) & HASH_3_MASK; \ + uint32_t hash_4_value = (temp ^ ((uint32_t)(cur[2]) << 8) ^ \ + ^ hash_table[cur[3]] << 5); \ + const uint32_t hash_value \ + = (hash_4_value ^ (hash_table[cur[4]] << 3)) \ + & mf->hash_mask; \ + hash_4_value &= HASH_4_MASK + +/* +#define hash_zip_calc() \ + const uint32_t hash_value \ + = (((uint32_t)(cur[0]) | ((uint32_t)(cur[1]) << 8)) \ + ^ hash_table[cur[2]]) & 0xFFFF +*/ + +#define hash_zip_calc() \ + const uint32_t hash_value \ + = (((uint32_t)(cur[2]) | ((uint32_t)(cur[0]) << 8)) \ + ^ hash_table[cur[1]]) & 0xFFFF + +#define mt_hash_2_calc() \ + const uint32_t hash_2_value \ + = (hash_table[cur[0]] ^ cur[1]) & HASH_2_MASK + +#define mt_hash_3_calc() \ + const uint32_t temp = hash_table[cur[0]] ^ cur[1]; \ + const uint32_t hash_2_value = temp & HASH_2_MASK; \ + const uint32_t hash_3_value \ + = (temp ^ ((uint32_t)(cur[2]) << 8)) & HASH_3_MASK + +#define mt_hash_4_calc() \ + const uint32_t temp = hash_table[cur[0]] ^ cur[1]; \ + const uint32_t hash_2_value = temp & HASH_2_MASK; \ + const uint32_t hash_3_value \ + = (temp ^ ((uint32_t)(cur[2]) << 8)) & HASH_3_MASK; \ + const uint32_t hash_4_value = (temp ^ ((uint32_t)(cur[2]) << 8) ^ \ + (hash_table[cur[3]] << 5)) & HASH_4_MASK + +#endif diff --git a/liblzma/lz/lz_encoder_hash_table.h b/liblzma/lz/lz_encoder_hash_table.h new file mode 100644 index 0000000..8c51717 --- /dev/null +++ b/liblzma/lz/lz_encoder_hash_table.h @@ -0,0 +1,68 @@ +/* This file has been automatically generated by crc32_tablegen.c. */ + +const uint32_t lzma_lz_hash_table[256] = { + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, + 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, + 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, + 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, + 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, + 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, + 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, + 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, + 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, + 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, + 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, + 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, + 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, + 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, + 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, + 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, + 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, + 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, + 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, + 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, + 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, + 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, + 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D +}; diff --git a/liblzma/lz/lz_encoder_mf.c b/liblzma/lz/lz_encoder_mf.c new file mode 100644 index 0000000..f82a1c1 --- /dev/null +++ b/liblzma/lz/lz_encoder_mf.c @@ -0,0 +1,753 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lz_encoder_mf.c +/// \brief Match finders +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "lz_encoder.h" +#include "lz_encoder_hash.h" + + +/// \brief Find matches starting from the current byte +/// +/// \return The length of the longest match found +extern uint32_t +lzma_mf_find(lzma_mf *mf, uint32_t *count_ptr, lzma_match *matches) +{ + // Call the match finder. It returns the number of length-distance + // pairs found. + // FIXME: Minimum count is zero, what _exactly_ is the maximum? + const uint32_t count = mf->find(mf, matches); + + // Length of the longest match; assume that no matches were found + // and thus the maximum length is zero. + uint32_t len_best = 0; + + if (count > 0) { +#ifndef NDEBUG + // Validate the matches. + for (uint32_t i = 0; i < count; ++i) { + assert(matches[i].len <= mf->nice_len); + assert(matches[i].dist < mf->read_pos); + assert(memcmp(mf_ptr(mf) - 1, + mf_ptr(mf) - matches[i].dist - 2, + matches[i].len) == 0); + } +#endif + + // The last used element in the array contains + // the longest match. + len_best = matches[count - 1].len; + + // If a match of maximum search length was found, try to + // extend the match to maximum possible length. + if (len_best == mf->nice_len) { + // The limit for the match length is either the + // maximum match length supported by the LZ-based + // encoder or the number of bytes left in the + // dictionary, whichever is smaller. + uint32_t limit = mf_avail(mf) + 1; + if (limit > mf->match_len_max) + limit = mf->match_len_max; + + // Pointer to the byte we just ran through + // the match finder. + const uint8_t *p1 = mf_ptr(mf) - 1; + + // Pointer to the beginning of the match. We need -1 + // here because the match distances are zero based. + const uint8_t *p2 = p1 - matches[count - 1].dist - 1; + + while (len_best < limit + && p1[len_best] == p2[len_best]) + ++len_best; + } + } + + *count_ptr = count; + + // Finally update the read position to indicate that match finder was + // run for this dictionary offset. + ++mf->read_ahead; + + return len_best; +} + + +/// Hash value to indicate unused element in the hash. Since we start the +/// positions from dict_size + 1, zero is always too far to qualify +/// as usable match position. +#define EMPTY_HASH_VALUE 0 + + +/// Normalization must be done when lzma_mf.offset + lzma_mf.read_pos +/// reaches MUST_NORMALIZE_POS. +#define MUST_NORMALIZE_POS UINT32_MAX + + +/// \brief Normalizes hash values +/// +/// The hash arrays store positions of match candidates. The positions are +/// relative to an arbitrary offset that is not the same as the absolute +/// offset in the input stream. The relative position of the current byte +/// is lzma_mf.offset + lzma_mf.read_pos. The distances of the matches are +/// the differences of the current read position and the position found from +/// the hash. +/// +/// To prevent integer overflows of the offsets stored in the hash arrays, +/// we need to "normalize" the stored values now and then. During the +/// normalization, we drop values that indicate distance greater than the +/// dictionary size, thus making space for new values. +static void +normalize(lzma_mf *mf) +{ + assert(mf->read_pos + mf->offset == MUST_NORMALIZE_POS); + + // In future we may not want to touch the lowest bits, because there + // may be match finders that use larger resolution than one byte. + const uint32_t subvalue + = (MUST_NORMALIZE_POS - mf->cyclic_size); + // & (~(UINT32_C(1) << 10) - 1); + + const uint32_t count = mf->hash_size_sum + mf->sons_count; + uint32_t *hash = mf->hash; + + for (uint32_t i = 0; i < count; ++i) { + // If the distance is greater than the dictionary size, + // we can simply mark the hash element as empty. + // + // NOTE: Only the first mf->hash_size_sum elements are + // initialized for sure. There may be uninitialized elements + // in mf->son. Since we go through both mf->hash and + // mf->son here in normalization, Valgrind may complain + // that the "if" below depends on uninitialized value. In + // this case it is safe to ignore the warning. See also the + // comments in lz_encoder_init() in lz_encoder.c. + if (hash[i] <= subvalue) + hash[i] = EMPTY_HASH_VALUE; + else + hash[i] -= subvalue; + } + + // Update offset to match the new locations. + mf->offset -= subvalue; + + return; +} + + +/// Mark the current byte as processed from point of view of the match finder. +static void +move_pos(lzma_mf *mf) +{ + if (++mf->cyclic_pos == mf->cyclic_size) + mf->cyclic_pos = 0; + + ++mf->read_pos; + assert(mf->read_pos <= mf->write_pos); + + if (unlikely(mf->read_pos + mf->offset == UINT32_MAX)) + normalize(mf); +} + + +/// When flushing, we cannot run the match finder unless there is nice_len +/// bytes available in the dictionary. Instead, we skip running the match +/// finder (indicating that no match was found), and count how many bytes we +/// have ignored this way. +/// +/// When new data is given after the flushing was completed, the match finder +/// is restarted by rewinding mf->read_pos backwards by mf->pending. Then +/// the missed bytes are added to the hash using the match finder's skip +/// function (with small amount of input, it may start using mf->pending +/// again if flushing). +/// +/// Due to this rewinding, we don't touch cyclic_pos or test for +/// normalization. It will be done when the match finder's skip function +/// catches up after a flush. +static void +move_pending(lzma_mf *mf) +{ + ++mf->read_pos; + assert(mf->read_pos <= mf->write_pos); + ++mf->pending; +} + + +/// Calculate len_limit and determine if there is enough input to run +/// the actual match finder code. Sets up "cur" and "pos". This macro +/// is used by all find functions and binary tree skip functions. Hash +/// chain skip function doesn't need len_limit so a simpler code is used +/// in them. +#define header(is_bt, len_min, ret_op) \ + uint32_t len_limit = mf_avail(mf); \ + if (mf->nice_len <= len_limit) { \ + len_limit = mf->nice_len; \ + } else if (len_limit < (len_min) \ + || (is_bt && mf->action == LZMA_SYNC_FLUSH)) { \ + assert(mf->action != LZMA_RUN); \ + move_pending(mf); \ + ret_op; \ + } \ + const uint8_t *cur = mf_ptr(mf); \ + const uint32_t pos = mf->read_pos + mf->offset + + +/// Header for find functions. "return 0" indicates that zero matches +/// were found. +#define header_find(is_bt, len_min) \ + header(is_bt, len_min, return 0); \ + uint32_t matches_count = 0 + + +/// Header for a loop in a skip function. "continue" tells to skip the rest +/// of the code in the loop. +#define header_skip(is_bt, len_min) \ + header(is_bt, len_min, continue) + + +/// Calls hc_find_func() or bt_find_func() and calculates the total number +/// of matches found. Updates the dictionary position and returns the number +/// of matches found. +#define call_find(func, len_best) \ +do { \ + matches_count = func(len_limit, pos, cur, cur_match, mf->depth, \ + mf->son, mf->cyclic_pos, mf->cyclic_size, \ + matches + matches_count, len_best) \ + - matches; \ + move_pos(mf); \ + return matches_count; \ +} while (0) + + +//////////////// +// Hash Chain // +//////////////// + +#if defined(HAVE_MF_HC3) || defined(HAVE_MF_HC4) +/// +/// +/// \param len_limit Don't look for matches longer than len_limit. +/// \param pos lzma_mf.read_pos + lzma_mf.offset +/// \param cur Pointer to current byte (mf_ptr(mf)) +/// \param cur_match Start position of the current match candidate +/// \param depth Maximum length of the hash chain +/// \param son lzma_mf.son (contains the hash chain) +/// \param cyclic_pos +/// \param cyclic_size +/// \param matches Array to hold the matches. +/// \param len_best The length of the longest match found so far. +static lzma_match * +hc_find_func( + const uint32_t len_limit, + const uint32_t pos, + const uint8_t *const cur, + uint32_t cur_match, + uint32_t depth, + uint32_t *const son, + const uint32_t cyclic_pos, + const uint32_t cyclic_size, + lzma_match *matches, + uint32_t len_best) +{ + son[cyclic_pos] = cur_match; + + while (true) { + const uint32_t delta = pos - cur_match; + if (depth-- == 0 || delta >= cyclic_size) + return matches; + + const uint8_t *const pb = cur - delta; + cur_match = son[cyclic_pos - delta + + (delta > cyclic_pos ? cyclic_size : 0)]; + + if (pb[len_best] == cur[len_best] && pb[0] == cur[0]) { + uint32_t len = 0; + while (++len != len_limit) + if (pb[len] != cur[len]) + break; + + if (len_best < len) { + len_best = len; + matches->len = len; + matches->dist = delta - 1; + ++matches; + + if (len == len_limit) + return matches; + } + } + } +} + + +#define hc_find(len_best) \ + call_find(hc_find_func, len_best) + + +#define hc_skip() \ +do { \ + mf->son[mf->cyclic_pos] = cur_match; \ + move_pos(mf); \ +} while (0) + +#endif + + +#ifdef HAVE_MF_HC3 +extern uint32_t +lzma_mf_hc3_find(lzma_mf *mf, lzma_match *matches) +{ + header_find(false, 3); + + hash_3_calc(); + + const uint32_t delta2 = pos - mf->hash[hash_2_value]; + const uint32_t cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value]; + + mf->hash[hash_2_value] = pos; + mf->hash[FIX_3_HASH_SIZE + hash_value] = pos; + + uint32_t len_best = 2; + + if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) { + for ( ; len_best != len_limit; ++len_best) + if (*(cur + len_best - delta2) != cur[len_best]) + break; + + matches[0].len = len_best; + matches[0].dist = delta2 - 1; + matches_count = 1; + + if (len_best == len_limit) { + hc_skip(); + return 1; // matches_count + } + } + + hc_find(len_best); +} + + +extern void +lzma_mf_hc3_skip(lzma_mf *mf, uint32_t amount) +{ + do { + if (mf_avail(mf) < 3) { + move_pending(mf); + continue; + } + + const uint8_t *cur = mf_ptr(mf); + const uint32_t pos = mf->read_pos + mf->offset; + + hash_3_calc(); + + const uint32_t cur_match + = mf->hash[FIX_3_HASH_SIZE + hash_value]; + + mf->hash[hash_2_value] = pos; + mf->hash[FIX_3_HASH_SIZE + hash_value] = pos; + + hc_skip(); + + } while (--amount != 0); +} +#endif + + +#ifdef HAVE_MF_HC4 +extern uint32_t +lzma_mf_hc4_find(lzma_mf *mf, lzma_match *matches) +{ + header_find(false, 4); + + hash_4_calc(); + + uint32_t delta2 = pos - mf->hash[hash_2_value]; + const uint32_t delta3 + = pos - mf->hash[FIX_3_HASH_SIZE + hash_3_value]; + const uint32_t cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value]; + + mf->hash[hash_2_value ] = pos; + mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos; + mf->hash[FIX_4_HASH_SIZE + hash_value] = pos; + + uint32_t len_best = 1; + + if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) { + len_best = 2; + matches[0].len = 2; + matches[0].dist = delta2 - 1; + matches_count = 1; + } + + if (delta2 != delta3 && delta3 < mf->cyclic_size + && *(cur - delta3) == *cur) { + len_best = 3; + matches[matches_count++].dist = delta3 - 1; + delta2 = delta3; + } + + if (matches_count != 0) { + for ( ; len_best != len_limit; ++len_best) + if (*(cur + len_best - delta2) != cur[len_best]) + break; + + matches[matches_count - 1].len = len_best; + + if (len_best == len_limit) { + hc_skip(); + return matches_count; + } + } + + if (len_best < 3) + len_best = 3; + + hc_find(len_best); +} + + +extern void +lzma_mf_hc4_skip(lzma_mf *mf, uint32_t amount) +{ + do { + if (mf_avail(mf) < 4) { + move_pending(mf); + continue; + } + + const uint8_t *cur = mf_ptr(mf); + const uint32_t pos = mf->read_pos + mf->offset; + + hash_4_calc(); + + const uint32_t cur_match + = mf->hash[FIX_4_HASH_SIZE + hash_value]; + + mf->hash[hash_2_value] = pos; + mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos; + mf->hash[FIX_4_HASH_SIZE + hash_value] = pos; + + hc_skip(); + + } while (--amount != 0); +} +#endif + + +///////////////// +// Binary Tree // +///////////////// + +#if defined(HAVE_MF_BT2) || defined(HAVE_MF_BT3) || defined(HAVE_MF_BT4) +static lzma_match * +bt_find_func( + const uint32_t len_limit, + const uint32_t pos, + const uint8_t *const cur, + uint32_t cur_match, + uint32_t depth, + uint32_t *const son, + const uint32_t cyclic_pos, + const uint32_t cyclic_size, + lzma_match *matches, + uint32_t len_best) +{ + uint32_t *ptr0 = son + (cyclic_pos << 1) + 1; + uint32_t *ptr1 = son + (cyclic_pos << 1); + + uint32_t len0 = 0; + uint32_t len1 = 0; + + while (true) { + const uint32_t delta = pos - cur_match; + if (depth-- == 0 || delta >= cyclic_size) { + *ptr0 = EMPTY_HASH_VALUE; + *ptr1 = EMPTY_HASH_VALUE; + return matches; + } + + uint32_t *const pair = son + ((cyclic_pos - delta + + (delta > cyclic_pos ? cyclic_size : 0)) + << 1); + + const uint8_t *const pb = cur - delta; + uint32_t len = my_min(len0, len1); + + if (pb[len] == cur[len]) { + while (++len != len_limit) + if (pb[len] != cur[len]) + break; + + if (len_best < len) { + len_best = len; + matches->len = len; + matches->dist = delta - 1; + ++matches; + + if (len == len_limit) { + *ptr1 = pair[0]; + *ptr0 = pair[1]; + return matches; + } + } + } + + if (pb[len] < cur[len]) { + *ptr1 = cur_match; + ptr1 = pair + 1; + cur_match = *ptr1; + len1 = len; + } else { + *ptr0 = cur_match; + ptr0 = pair; + cur_match = *ptr0; + len0 = len; + } + } +} + + +static void +bt_skip_func( + const uint32_t len_limit, + const uint32_t pos, + const uint8_t *const cur, + uint32_t cur_match, + uint32_t depth, + uint32_t *const son, + const uint32_t cyclic_pos, + const uint32_t cyclic_size) +{ + uint32_t *ptr0 = son + (cyclic_pos << 1) + 1; + uint32_t *ptr1 = son + (cyclic_pos << 1); + + uint32_t len0 = 0; + uint32_t len1 = 0; + + while (true) { + const uint32_t delta = pos - cur_match; + if (depth-- == 0 || delta >= cyclic_size) { + *ptr0 = EMPTY_HASH_VALUE; + *ptr1 = EMPTY_HASH_VALUE; + return; + } + + uint32_t *pair = son + ((cyclic_pos - delta + + (delta > cyclic_pos ? cyclic_size : 0)) + << 1); + const uint8_t *pb = cur - delta; + uint32_t len = my_min(len0, len1); + + if (pb[len] == cur[len]) { + while (++len != len_limit) + if (pb[len] != cur[len]) + break; + + if (len == len_limit) { + *ptr1 = pair[0]; + *ptr0 = pair[1]; + return; + } + } + + if (pb[len] < cur[len]) { + *ptr1 = cur_match; + ptr1 = pair + 1; + cur_match = *ptr1; + len1 = len; + } else { + *ptr0 = cur_match; + ptr0 = pair; + cur_match = *ptr0; + len0 = len; + } + } +} + + +#define bt_find(len_best) \ + call_find(bt_find_func, len_best) + +#define bt_skip() \ +do { \ + bt_skip_func(len_limit, pos, cur, cur_match, mf->depth, \ + mf->son, mf->cyclic_pos, \ + mf->cyclic_size); \ + move_pos(mf); \ +} while (0) + +#endif + + +#ifdef HAVE_MF_BT2 +extern uint32_t +lzma_mf_bt2_find(lzma_mf *mf, lzma_match *matches) +{ + header_find(true, 2); + + hash_2_calc(); + + const uint32_t cur_match = mf->hash[hash_value]; + mf->hash[hash_value] = pos; + + bt_find(1); +} + + +extern void +lzma_mf_bt2_skip(lzma_mf *mf, uint32_t amount) +{ + do { + header_skip(true, 2); + + hash_2_calc(); + + const uint32_t cur_match = mf->hash[hash_value]; + mf->hash[hash_value] = pos; + + bt_skip(); + + } while (--amount != 0); +} +#endif + + +#ifdef HAVE_MF_BT3 +extern uint32_t +lzma_mf_bt3_find(lzma_mf *mf, lzma_match *matches) +{ + header_find(true, 3); + + hash_3_calc(); + + const uint32_t delta2 = pos - mf->hash[hash_2_value]; + const uint32_t cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value]; + + mf->hash[hash_2_value] = pos; + mf->hash[FIX_3_HASH_SIZE + hash_value] = pos; + + uint32_t len_best = 2; + + if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) { + for ( ; len_best != len_limit; ++len_best) + if (*(cur + len_best - delta2) != cur[len_best]) + break; + + matches[0].len = len_best; + matches[0].dist = delta2 - 1; + matches_count = 1; + + if (len_best == len_limit) { + bt_skip(); + return 1; // matches_count + } + } + + bt_find(len_best); +} + + +extern void +lzma_mf_bt3_skip(lzma_mf *mf, uint32_t amount) +{ + do { + header_skip(true, 3); + + hash_3_calc(); + + const uint32_t cur_match + = mf->hash[FIX_3_HASH_SIZE + hash_value]; + + mf->hash[hash_2_value] = pos; + mf->hash[FIX_3_HASH_SIZE + hash_value] = pos; + + bt_skip(); + + } while (--amount != 0); +} +#endif + + +#ifdef HAVE_MF_BT4 +extern uint32_t +lzma_mf_bt4_find(lzma_mf *mf, lzma_match *matches) +{ + header_find(true, 4); + + hash_4_calc(); + + uint32_t delta2 = pos - mf->hash[hash_2_value]; + const uint32_t delta3 + = pos - mf->hash[FIX_3_HASH_SIZE + hash_3_value]; + const uint32_t cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value]; + + mf->hash[hash_2_value] = pos; + mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos; + mf->hash[FIX_4_HASH_SIZE + hash_value] = pos; + + uint32_t len_best = 1; + + if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) { + len_best = 2; + matches[0].len = 2; + matches[0].dist = delta2 - 1; + matches_count = 1; + } + + if (delta2 != delta3 && delta3 < mf->cyclic_size + && *(cur - delta3) == *cur) { + len_best = 3; + matches[matches_count++].dist = delta3 - 1; + delta2 = delta3; + } + + if (matches_count != 0) { + for ( ; len_best != len_limit; ++len_best) + if (*(cur + len_best - delta2) != cur[len_best]) + break; + + matches[matches_count - 1].len = len_best; + + if (len_best == len_limit) { + bt_skip(); + return matches_count; + } + } + + if (len_best < 3) + len_best = 3; + + bt_find(len_best); +} + + +extern void +lzma_mf_bt4_skip(lzma_mf *mf, uint32_t amount) +{ + do { + header_skip(true, 4); + + hash_4_calc(); + + const uint32_t cur_match + = mf->hash[FIX_4_HASH_SIZE + hash_value]; + + mf->hash[hash_2_value] = pos; + mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos; + mf->hash[FIX_4_HASH_SIZE + hash_value] = pos; + + bt_skip(); + + } while (--amount != 0); +} +#endif diff --git a/liblzma/lzma/Makefile.inc b/liblzma/lzma/Makefile.inc new file mode 100644 index 0000000..7fc4d17 --- /dev/null +++ b/liblzma/lzma/Makefile.inc @@ -0,0 +1,43 @@ +## +## Author: Lasse Collin +## +## This file has been put into the public domain. +## You can do whatever you want with this file. +## + +EXTRA_DIST += lzma/fastpos_tablegen.c + +liblzma_la_SOURCES += lzma/lzma_common.h + +if COND_ENCODER_LZMA1 +liblzma_la_SOURCES += \ + lzma/fastpos.h \ + lzma/lzma_encoder.h \ + lzma/lzma_encoder.c \ + lzma/lzma_encoder_presets.c \ + lzma/lzma_encoder_private.h \ + lzma/lzma_encoder_optimum_fast.c \ + lzma/lzma_encoder_optimum_normal.c + +if !COND_SMALL +liblzma_la_SOURCES += lzma/fastpos_table.c +endif +endif + +if COND_DECODER_LZMA1 +liblzma_la_SOURCES += \ + lzma/lzma_decoder.c \ + lzma/lzma_decoder.h +endif + +if COND_ENCODER_LZMA2 +liblzma_la_SOURCES += \ + lzma/lzma2_encoder.c \ + lzma/lzma2_encoder.h +endif + +if COND_DECODER_LZMA2 +liblzma_la_SOURCES += \ + lzma/lzma2_decoder.c \ + lzma/lzma2_decoder.h +endif diff --git a/liblzma/lzma/fastpos.h b/liblzma/lzma/fastpos.h new file mode 100644 index 0000000..4aea231 --- /dev/null +++ b/liblzma/lzma/fastpos.h @@ -0,0 +1,140 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file fastpos.h +/// \brief Kind of two-bit version of bit scan reverse +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_FASTPOS_H +#define LZMA_FASTPOS_H + +// LZMA encodes match distances (positions) by storing the highest two +// bits using a six-bit value [0, 63], and then the missing lower bits. +// Dictionary size is also stored using this encoding in the new .lzma +// file format header. +// +// fastpos.h provides a way to quickly find out the correct six-bit +// values. The following table gives some examples of this encoding: +// +// pos return +// 0 0 +// 1 1 +// 2 2 +// 3 3 +// 4 4 +// 5 4 +// 6 5 +// 7 5 +// 8 6 +// 11 6 +// 12 7 +// ... ... +// 15 7 +// 16 8 +// 17 8 +// ... ... +// 23 8 +// 24 9 +// 25 9 +// ... ... +// +// +// Provided functions or macros +// ---------------------------- +// +// get_pos_slot(pos) is the basic version. get_pos_slot_2(pos) +// assumes that pos >= FULL_DISTANCES, thus the result is at least +// FULL_DISTANCES_BITS * 2. Using get_pos_slot(pos) instead of +// get_pos_slot_2(pos) would give the same result, but get_pos_slot_2(pos) +// should be tiny bit faster due to the assumption being made. +// +// +// Size vs. speed +// -------------- +// +// With some CPUs that have fast BSR (bit scan reverse) instruction, the +// size optimized version is slightly faster than the bigger table based +// approach. Such CPUs include Intel Pentium Pro, Pentium II, Pentium III +// and Core 2 (possibly others). AMD K7 seems to have slower BSR, but that +// would still have speed roughly comparable to the table version. Older +// x86 CPUs like the original Pentium have very slow BSR; on those systems +// the table version is a lot faster. +// +// On some CPUs, the table version is a lot faster when using position +// dependent code, but with position independent code the size optimized +// version is slightly faster. This occurs at least on 32-bit SPARC (no +// ASM optimizations). +// +// I'm making the table version the default, because that has good speed +// on all systems I have tried. The size optimized version is sometimes +// slightly faster, but sometimes it is a lot slower. + +#ifdef HAVE_SMALL +# define get_pos_slot(pos) ((pos) <= 4 ? (pos) : get_pos_slot_2(pos)) + +static inline uint32_t +get_pos_slot_2(uint32_t pos) +{ + const uint32_t i = bsr32(pos); + return (i + i) + ((pos >> (i - 1)) & 1); +} + + +#else + +#define FASTPOS_BITS 13 + +extern const uint8_t lzma_fastpos[1 << FASTPOS_BITS]; + + +#define fastpos_shift(extra, n) \ + ((extra) + (n) * (FASTPOS_BITS - 1)) + +#define fastpos_limit(extra, n) \ + (UINT32_C(1) << (FASTPOS_BITS + fastpos_shift(extra, n))) + +#define fastpos_result(pos, extra, n) \ + lzma_fastpos[(pos) >> fastpos_shift(extra, n)] \ + + 2 * fastpos_shift(extra, n) + + +static inline uint32_t +get_pos_slot(uint32_t pos) +{ + // If it is small enough, we can pick the result directly from + // the precalculated table. + if (pos < fastpos_limit(0, 0)) + return lzma_fastpos[pos]; + + if (pos < fastpos_limit(0, 1)) + return fastpos_result(pos, 0, 1); + + return fastpos_result(pos, 0, 2); +} + + +#ifdef FULL_DISTANCES_BITS +static inline uint32_t +get_pos_slot_2(uint32_t pos) +{ + assert(pos >= FULL_DISTANCES); + + if (pos < fastpos_limit(FULL_DISTANCES_BITS - 1, 0)) + return fastpos_result(pos, FULL_DISTANCES_BITS - 1, 0); + + if (pos < fastpos_limit(FULL_DISTANCES_BITS - 1, 1)) + return fastpos_result(pos, FULL_DISTANCES_BITS - 1, 1); + + return fastpos_result(pos, FULL_DISTANCES_BITS - 1, 2); +} +#endif + +#endif + +#endif diff --git a/liblzma/lzma/fastpos_table.c b/liblzma/lzma/fastpos_table.c new file mode 100644 index 0000000..6a3ceac --- /dev/null +++ b/liblzma/lzma/fastpos_table.c @@ -0,0 +1,519 @@ +/* This file has been automatically generated by fastpos_tablegen.c. */ + +#include "common.h" +#include "fastpos.h" + +const uint8_t lzma_fastpos[1 << FASTPOS_BITS] = { + 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, + 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25 +}; diff --git a/liblzma/lzma/fastpos_tablegen.c b/liblzma/lzma/fastpos_tablegen.c new file mode 100644 index 0000000..c97e6f4 --- /dev/null +++ b/liblzma/lzma/fastpos_tablegen.c @@ -0,0 +1,56 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file fastpos_tablegen.c +/// \brief Generates the lzma_fastpos[] lookup table +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include "fastpos.h" + + +int +main(void) +{ + uint8_t fastpos[1 << FASTPOS_BITS]; + + const uint8_t fast_slots = 2 * FASTPOS_BITS; + uint32_t c = 2; + + fastpos[0] = 0; + fastpos[1] = 1; + + for (uint8_t slot_fast = 2; slot_fast < fast_slots; ++slot_fast) { + const uint32_t k = 1 << ((slot_fast >> 1) - 1); + for (uint32_t j = 0; j < k; ++j, ++c) + fastpos[c] = slot_fast; + } + + printf("/* This file has been automatically generated " + "by fastpos_tablegen.c. */\n\n" + "#include \"common.h\"\n" + "#include \"fastpos.h\"\n\n" + "const uint8_t lzma_fastpos[1 << FASTPOS_BITS] = {"); + + for (size_t i = 0; i < (1 << FASTPOS_BITS); ++i) { + if (i % 16 == 0) + printf("\n\t"); + + printf("%3u", (unsigned int)(fastpos[i])); + + if (i != (1 << FASTPOS_BITS) - 1) + printf(","); + } + + printf("\n};\n"); + + return 0; +} diff --git a/liblzma/lzma/lzma2_decoder.c b/liblzma/lzma/lzma2_decoder.c new file mode 100644 index 0000000..3e42575 --- /dev/null +++ b/liblzma/lzma/lzma2_decoder.c @@ -0,0 +1,304 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lzma2_decoder.c +/// \brief LZMA2 decoder +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "lzma2_decoder.h" +#include "lz_decoder.h" +#include "lzma_decoder.h" + + +struct lzma_coder_s { + enum sequence { + SEQ_CONTROL, + SEQ_UNCOMPRESSED_1, + SEQ_UNCOMPRESSED_2, + SEQ_COMPRESSED_0, + SEQ_COMPRESSED_1, + SEQ_PROPERTIES, + SEQ_LZMA, + SEQ_COPY, + } sequence; + + /// Sequence after the size fields have been decoded. + enum sequence next_sequence; + + /// LZMA decoder + lzma_lz_decoder lzma; + + /// Uncompressed size of LZMA chunk + size_t uncompressed_size; + + /// Compressed size of the chunk (naturally equals to uncompressed + /// size of uncompressed chunk) + size_t compressed_size; + + /// True if properties are needed. This is false before the + /// first LZMA chunk. + bool need_properties; + + /// True if dictionary reset is needed. This is false before the + /// first chunk (LZMA or uncompressed). + bool need_dictionary_reset; + + lzma_options_lzma options; +}; + + +static lzma_ret +lzma2_decode(lzma_coder *restrict coder, lzma_dict *restrict dict, + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size) +{ + // With SEQ_LZMA it is possible that no new input is needed to do + // some progress. The rest of the sequences assume that there is + // at least one byte of input. + while (*in_pos < in_size || coder->sequence == SEQ_LZMA) + switch (coder->sequence) { + case SEQ_CONTROL: { + const uint32_t control = in[*in_pos]; + ++*in_pos; + + // End marker + if (control == 0x00) + return LZMA_STREAM_END; + + if (control >= 0xE0 || control == 1) { + // Dictionary reset implies that next LZMA chunk has + // to set new properties. + coder->need_properties = true; + coder->need_dictionary_reset = true; + } else if (coder->need_dictionary_reset) { + return LZMA_DATA_ERROR; + } + + if (control >= 0x80) { + // LZMA chunk. The highest five bits of the + // uncompressed size are taken from the control byte. + coder->uncompressed_size = (control & 0x1F) << 16; + coder->sequence = SEQ_UNCOMPRESSED_1; + + // See if there are new properties or if we need to + // reset the state. + if (control >= 0xC0) { + // When there are new properties, state reset + // is done at SEQ_PROPERTIES. + coder->need_properties = false; + coder->next_sequence = SEQ_PROPERTIES; + + } else if (coder->need_properties) { + return LZMA_DATA_ERROR; + + } else { + coder->next_sequence = SEQ_LZMA; + + // If only state reset is wanted with old + // properties, do the resetting here for + // simplicity. + if (control >= 0xA0) + coder->lzma.reset(coder->lzma.coder, + &coder->options); + } + } else { + // Invalid control values + if (control > 2) + return LZMA_DATA_ERROR; + + // It's uncompressed chunk + coder->sequence = SEQ_COMPRESSED_0; + coder->next_sequence = SEQ_COPY; + } + + if (coder->need_dictionary_reset) { + // Finish the dictionary reset and let the caller + // flush the dictionary to the actual output buffer. + coder->need_dictionary_reset = false; + dict_reset(dict); + return LZMA_OK; + } + + break; + } + + case SEQ_UNCOMPRESSED_1: + coder->uncompressed_size += (uint32_t)(in[(*in_pos)++]) << 8; + coder->sequence = SEQ_UNCOMPRESSED_2; + break; + + case SEQ_UNCOMPRESSED_2: + coder->uncompressed_size += in[(*in_pos)++] + 1; + coder->sequence = SEQ_COMPRESSED_0; + coder->lzma.set_uncompressed(coder->lzma.coder, + coder->uncompressed_size); + break; + + case SEQ_COMPRESSED_0: + coder->compressed_size = (uint32_t)(in[(*in_pos)++]) << 8; + coder->sequence = SEQ_COMPRESSED_1; + break; + + case SEQ_COMPRESSED_1: + coder->compressed_size += in[(*in_pos)++] + 1; + coder->sequence = coder->next_sequence; + break; + + case SEQ_PROPERTIES: + if (lzma_lzma_lclppb_decode(&coder->options, in[(*in_pos)++])) + return LZMA_DATA_ERROR; + + coder->lzma.reset(coder->lzma.coder, &coder->options); + + coder->sequence = SEQ_LZMA; + break; + + case SEQ_LZMA: { + // Store the start offset so that we can update + // coder->compressed_size later. + const size_t in_start = *in_pos; + + // Decode from in[] to *dict. + const lzma_ret ret = coder->lzma.code(coder->lzma.coder, + dict, in, in_pos, in_size); + + // Validate and update coder->compressed_size. + const size_t in_used = *in_pos - in_start; + if (in_used > coder->compressed_size) + return LZMA_DATA_ERROR; + + coder->compressed_size -= in_used; + + // Return if we didn't finish the chunk, or an error occurred. + if (ret != LZMA_STREAM_END) + return ret; + + // The LZMA decoder must have consumed the whole chunk now. + // We don't need to worry about uncompressed size since it + // is checked by the LZMA decoder. + if (coder->compressed_size != 0) + return LZMA_DATA_ERROR; + + coder->sequence = SEQ_CONTROL; + break; + } + + case SEQ_COPY: { + // Copy from input to the dictionary as is. + dict_write(dict, in, in_pos, in_size, &coder->compressed_size); + if (coder->compressed_size != 0) + return LZMA_OK; + + coder->sequence = SEQ_CONTROL; + break; + } + + default: + assert(0); + return LZMA_PROG_ERROR; + } + + return LZMA_OK; +} + + +static void +lzma2_decoder_end(lzma_coder *coder, lzma_allocator *allocator) +{ + assert(coder->lzma.end == NULL); + lzma_free(coder->lzma.coder, allocator); + + lzma_free(coder, allocator); + + return; +} + + +static lzma_ret +lzma2_decoder_init(lzma_lz_decoder *lz, lzma_allocator *allocator, + const void *opt, lzma_lz_options *lz_options) +{ + if (lz->coder == NULL) { + lz->coder = lzma_alloc(sizeof(lzma_coder), allocator); + if (lz->coder == NULL) + return LZMA_MEM_ERROR; + + lz->code = &lzma2_decode; + lz->end = &lzma2_decoder_end; + + lz->coder->lzma = LZMA_LZ_DECODER_INIT; + } + + const lzma_options_lzma *options = opt; + + lz->coder->sequence = SEQ_CONTROL; + lz->coder->need_properties = true; + lz->coder->need_dictionary_reset = options->preset_dict == NULL + || options->preset_dict_size == 0; + + return lzma_lzma_decoder_create(&lz->coder->lzma, + allocator, options, lz_options); +} + + +extern lzma_ret +lzma_lzma2_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters) +{ + // LZMA2 can only be the last filter in the chain. This is enforced + // by the raw_decoder initialization. + assert(filters[1].init == NULL); + + return lzma_lz_decoder_init(next, allocator, filters, + &lzma2_decoder_init); +} + + +extern uint64_t +lzma_lzma2_decoder_memusage(const void *options) +{ + return sizeof(lzma_coder) + + lzma_lzma_decoder_memusage_nocheck(options); +} + + +extern lzma_ret +lzma_lzma2_props_decode(void **options, lzma_allocator *allocator, + const uint8_t *props, size_t props_size) +{ + if (props_size != 1) + return LZMA_OPTIONS_ERROR; + + // Check that reserved bits are unset. + if (props[0] & 0xC0) + return LZMA_OPTIONS_ERROR; + + // Decode the dictionary size. + if (props[0] > 40) + return LZMA_OPTIONS_ERROR; + + lzma_options_lzma *opt = lzma_alloc( + sizeof(lzma_options_lzma), allocator); + if (opt == NULL) + return LZMA_MEM_ERROR; + + if (props[0] == 40) { + opt->dict_size = UINT32_MAX; + } else { + opt->dict_size = 2 | (props[0] & 1); + opt->dict_size <<= props[0] / 2 + 11; + } + + opt->preset_dict = NULL; + opt->preset_dict_size = 0; + + *options = opt; + + return LZMA_OK; +} diff --git a/liblzma/lzma/lzma2_decoder.h b/liblzma/lzma/lzma2_decoder.h new file mode 100644 index 0000000..fac4ac4 --- /dev/null +++ b/liblzma/lzma/lzma2_decoder.h @@ -0,0 +1,28 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lzma2_decoder.h +/// \brief LZMA2 decoder +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_LZMA2_DECODER_H +#define LZMA_LZMA2_DECODER_H + +#include "common.h" + +extern lzma_ret lzma_lzma2_decoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + +extern uint64_t lzma_lzma2_decoder_memusage(const void *options); + +extern lzma_ret lzma_lzma2_props_decode( + void **options, lzma_allocator *allocator, + const uint8_t *props, size_t props_size); + +#endif diff --git a/liblzma/lzma/lzma2_encoder.c b/liblzma/lzma/lzma2_encoder.c new file mode 100644 index 0000000..992720c --- /dev/null +++ b/liblzma/lzma/lzma2_encoder.c @@ -0,0 +1,393 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lzma2_encoder.c +/// \brief LZMA2 encoder +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "lz_encoder.h" +#include "lzma_encoder.h" +#include "fastpos.h" +#include "lzma2_encoder.h" + + +struct lzma_coder_s { + enum { + SEQ_INIT, + SEQ_LZMA_ENCODE, + SEQ_LZMA_COPY, + SEQ_UNCOMPRESSED_HEADER, + SEQ_UNCOMPRESSED_COPY, + } sequence; + + /// LZMA encoder + lzma_coder *lzma; + + /// LZMA options currently in use. + lzma_options_lzma opt_cur; + + bool need_properties; + bool need_state_reset; + bool need_dictionary_reset; + + /// Uncompressed size of a chunk + size_t uncompressed_size; + + /// Compressed size of a chunk (excluding headers); this is also used + /// to indicate the end of buf[] in SEQ_LZMA_COPY. + size_t compressed_size; + + /// Read position in buf[] + size_t buf_pos; + + /// Buffer to hold the chunk header and LZMA compressed data + uint8_t buf[LZMA2_HEADER_MAX + LZMA2_CHUNK_MAX]; +}; + + +static void +lzma2_header_lzma(lzma_coder *coder) +{ + assert(coder->uncompressed_size > 0); + assert(coder->uncompressed_size <= LZMA2_UNCOMPRESSED_MAX); + assert(coder->compressed_size > 0); + assert(coder->compressed_size <= LZMA2_CHUNK_MAX); + + size_t pos; + + if (coder->need_properties) { + pos = 0; + + if (coder->need_dictionary_reset) + coder->buf[pos] = 0x80 + (3 << 5); + else + coder->buf[pos] = 0x80 + (2 << 5); + } else { + pos = 1; + + if (coder->need_state_reset) + coder->buf[pos] = 0x80 + (1 << 5); + else + coder->buf[pos] = 0x80; + } + + // Set the start position for copying. + coder->buf_pos = pos; + + // Uncompressed size + size_t size = coder->uncompressed_size - 1; + coder->buf[pos++] += size >> 16; + coder->buf[pos++] = (size >> 8) & 0xFF; + coder->buf[pos++] = size & 0xFF; + + // Compressed size + size = coder->compressed_size - 1; + coder->buf[pos++] = size >> 8; + coder->buf[pos++] = size & 0xFF; + + // Properties, if needed + if (coder->need_properties) + lzma_lzma_lclppb_encode(&coder->opt_cur, coder->buf + pos); + + coder->need_properties = false; + coder->need_state_reset = false; + coder->need_dictionary_reset = false; + + // The copying code uses coder->compressed_size to indicate the end + // of coder->buf[], so we need add the maximum size of the header here. + coder->compressed_size += LZMA2_HEADER_MAX; + + return; +} + + +static void +lzma2_header_uncompressed(lzma_coder *coder) +{ + assert(coder->uncompressed_size > 0); + assert(coder->uncompressed_size <= LZMA2_CHUNK_MAX); + + // If this is the first chunk, we need to include dictionary + // reset indicator. + if (coder->need_dictionary_reset) + coder->buf[0] = 1; + else + coder->buf[0] = 2; + + coder->need_dictionary_reset = false; + + // "Compressed" size + coder->buf[1] = (coder->uncompressed_size - 1) >> 8; + coder->buf[2] = (coder->uncompressed_size - 1) & 0xFF; + + // Set the start position for copying. + coder->buf_pos = 0; + return; +} + + +static lzma_ret +lzma2_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, + uint8_t *restrict out, size_t *restrict out_pos, + size_t out_size) +{ + while (*out_pos < out_size) + switch (coder->sequence) { + case SEQ_INIT: + // If there's no input left and we are flushing or finishing, + // don't start a new chunk. + if (mf_unencoded(mf) == 0) { + // Write end of payload marker if finishing. + if (mf->action == LZMA_FINISH) + out[(*out_pos)++] = 0; + + return mf->action == LZMA_RUN + ? LZMA_OK : LZMA_STREAM_END; + } + + if (coder->need_state_reset) + return_if_error(lzma_lzma_encoder_reset( + coder->lzma, &coder->opt_cur)); + + coder->uncompressed_size = 0; + coder->compressed_size = 0; + coder->sequence = SEQ_LZMA_ENCODE; + + // Fall through + + case SEQ_LZMA_ENCODE: { + // Calculate how much more uncompressed data this chunk + // could accept. + const uint32_t left = LZMA2_UNCOMPRESSED_MAX + - coder->uncompressed_size; + uint32_t limit; + + if (left < mf->match_len_max) { + // Must flush immediately since the next LZMA symbol + // could make the uncompressed size of the chunk too + // big. + limit = 0; + } else { + // Calculate maximum read_limit that is OK from point + // of view of LZMA2 chunk size. + limit = mf->read_pos - mf->read_ahead + + left - mf->match_len_max; + } + + // Save the start position so that we can update + // coder->uncompressed_size. + const uint32_t read_start = mf->read_pos - mf->read_ahead; + + // Call the LZMA encoder until the chunk is finished. + const lzma_ret ret = lzma_lzma_encode(coder->lzma, mf, + coder->buf + LZMA2_HEADER_MAX, + &coder->compressed_size, + LZMA2_CHUNK_MAX, limit); + + coder->uncompressed_size += mf->read_pos - mf->read_ahead + - read_start; + + assert(coder->compressed_size <= LZMA2_CHUNK_MAX); + assert(coder->uncompressed_size <= LZMA2_UNCOMPRESSED_MAX); + + if (ret != LZMA_STREAM_END) + return LZMA_OK; + + // See if the chunk compressed. If it didn't, we encode it + // as uncompressed chunk. This saves a few bytes of space + // and makes decoding faster. + if (coder->compressed_size >= coder->uncompressed_size) { + coder->uncompressed_size += mf->read_ahead; + assert(coder->uncompressed_size + <= LZMA2_UNCOMPRESSED_MAX); + mf->read_ahead = 0; + lzma2_header_uncompressed(coder); + coder->need_state_reset = true; + coder->sequence = SEQ_UNCOMPRESSED_HEADER; + break; + } + + // The chunk did compress at least by one byte, so we store + // the chunk as LZMA. + lzma2_header_lzma(coder); + + coder->sequence = SEQ_LZMA_COPY; + } + + // Fall through + + case SEQ_LZMA_COPY: + // Copy the compressed chunk along its headers to the + // output buffer. + lzma_bufcpy(coder->buf, &coder->buf_pos, + coder->compressed_size, + out, out_pos, out_size); + if (coder->buf_pos != coder->compressed_size) + return LZMA_OK; + + coder->sequence = SEQ_INIT; + break; + + case SEQ_UNCOMPRESSED_HEADER: + // Copy the three-byte header to indicate uncompressed chunk. + lzma_bufcpy(coder->buf, &coder->buf_pos, + LZMA2_HEADER_UNCOMPRESSED, + out, out_pos, out_size); + if (coder->buf_pos != LZMA2_HEADER_UNCOMPRESSED) + return LZMA_OK; + + coder->sequence = SEQ_UNCOMPRESSED_COPY; + + // Fall through + + case SEQ_UNCOMPRESSED_COPY: + // Copy the uncompressed data as is from the dictionary + // to the output buffer. + mf_read(mf, out, out_pos, out_size, &coder->uncompressed_size); + if (coder->uncompressed_size != 0) + return LZMA_OK; + + coder->sequence = SEQ_INIT; + break; + } + + return LZMA_OK; +} + + +static void +lzma2_encoder_end(lzma_coder *coder, lzma_allocator *allocator) +{ + lzma_free(coder->lzma, allocator); + lzma_free(coder, allocator); + return; +} + + +static lzma_ret +lzma2_encoder_options_update(lzma_coder *coder, const lzma_filter *filter) +{ + // New options can be set only when there is no incomplete chunk. + // This is the case at the beginning of the raw stream and right + // after LZMA_SYNC_FLUSH. + if (filter->options == NULL || coder->sequence != SEQ_INIT) + return LZMA_PROG_ERROR; + + // Look if there are new options. At least for now, + // only lc/lp/pb can be changed. + const lzma_options_lzma *opt = filter->options; + if (coder->opt_cur.lc != opt->lc || coder->opt_cur.lp != opt->lp + || coder->opt_cur.pb != opt->pb) { + // Validate the options. + if (opt->lc > LZMA_LCLP_MAX || opt->lp > LZMA_LCLP_MAX + || opt->lc + opt->lp > LZMA_LCLP_MAX + || opt->pb > LZMA_PB_MAX) + return LZMA_OPTIONS_ERROR; + + // The new options will be used when the encoder starts + // a new LZMA2 chunk. + coder->opt_cur.lc = opt->lc; + coder->opt_cur.lp = opt->lp; + coder->opt_cur.pb = opt->pb; + coder->need_properties = true; + coder->need_state_reset = true; + } + + return LZMA_OK; +} + + +static lzma_ret +lzma2_encoder_init(lzma_lz_encoder *lz, lzma_allocator *allocator, + const void *options, lzma_lz_options *lz_options) +{ + if (options == NULL) + return LZMA_PROG_ERROR; + + if (lz->coder == NULL) { + lz->coder = lzma_alloc(sizeof(lzma_coder), allocator); + if (lz->coder == NULL) + return LZMA_MEM_ERROR; + + lz->code = &lzma2_encode; + lz->end = &lzma2_encoder_end; + lz->options_update = &lzma2_encoder_options_update; + + lz->coder->lzma = NULL; + } + + lz->coder->opt_cur = *(const lzma_options_lzma *)(options); + + lz->coder->sequence = SEQ_INIT; + lz->coder->need_properties = true; + lz->coder->need_state_reset = false; + lz->coder->need_dictionary_reset + = lz->coder->opt_cur.preset_dict == NULL + || lz->coder->opt_cur.preset_dict_size == 0; + + // Initialize LZMA encoder + return_if_error(lzma_lzma_encoder_create(&lz->coder->lzma, allocator, + &lz->coder->opt_cur, lz_options)); + + // Make sure that we will always have enough history available in + // case we need to use uncompressed chunks. They are used when the + // compressed size of a chunk is not smaller than the uncompressed + // size, so we need to have at least LZMA2_COMPRESSED_MAX bytes + // history available. + if (lz_options->before_size + lz_options->dict_size < LZMA2_CHUNK_MAX) + lz_options->before_size + = LZMA2_CHUNK_MAX - lz_options->dict_size; + + return LZMA_OK; +} + + +extern lzma_ret +lzma_lzma2_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters) +{ + return lzma_lz_encoder_init( + next, allocator, filters, &lzma2_encoder_init); +} + + +extern uint64_t +lzma_lzma2_encoder_memusage(const void *options) +{ + const uint64_t lzma_mem = lzma_lzma_encoder_memusage(options); + if (lzma_mem == UINT64_MAX) + return UINT64_MAX; + + return sizeof(lzma_coder) + lzma_mem; +} + + +extern lzma_ret +lzma_lzma2_props_encode(const void *options, uint8_t *out) +{ + const lzma_options_lzma *const opt = options; + uint32_t d = my_max(opt->dict_size, LZMA_DICT_SIZE_MIN); + + // Round up to the next 2^n - 1 or 2^n + 2^(n - 1) - 1 depending + // on which one is the next: + --d; + d |= d >> 2; + d |= d >> 3; + d |= d >> 4; + d |= d >> 8; + d |= d >> 16; + + // Get the highest two bits using the proper encoding: + if (d == UINT32_MAX) + out[0] = 40; + else + out[0] = get_pos_slot(d + 1) - 24; + + return LZMA_OK; +} diff --git a/liblzma/lzma/lzma2_encoder.h b/liblzma/lzma/lzma2_encoder.h new file mode 100644 index 0000000..ca19ef4 --- /dev/null +++ b/liblzma/lzma/lzma2_encoder.h @@ -0,0 +1,41 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lzma2_encoder.h +/// \brief LZMA2 encoder +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_LZMA2_ENCODER_H +#define LZMA_LZMA2_ENCODER_H + +#include "common.h" + + +/// Maximum number of bytes of actual data per chunk (no headers) +#define LZMA2_CHUNK_MAX (UINT32_C(1) << 16) + +/// Maximum uncompressed size of LZMA chunk (no headers) +#define LZMA2_UNCOMPRESSED_MAX (UINT32_C(1) << 21) + +/// Maximum size of LZMA2 headers +#define LZMA2_HEADER_MAX 6 + +/// Size of a header for uncompressed chunk +#define LZMA2_HEADER_UNCOMPRESSED 3 + + +extern lzma_ret lzma_lzma2_encoder_init( + lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters); + +extern uint64_t lzma_lzma2_encoder_memusage(const void *options); + +extern lzma_ret lzma_lzma2_props_encode(const void *options, uint8_t *out); + +#endif diff --git a/liblzma/lzma/lzma_common.h b/liblzma/lzma/lzma_common.h new file mode 100644 index 0000000..e31e285 --- /dev/null +++ b/liblzma/lzma/lzma_common.h @@ -0,0 +1,223 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lzma_common.h +/// \brief Private definitions common to LZMA encoder and decoder +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_LZMA_COMMON_H +#define LZMA_LZMA_COMMON_H + +#include "common.h" +#include "range_common.h" + + +/////////////////// +// Miscellaneous // +/////////////////// + +/// Maximum number of position states. A position state is the lowest pos bits +/// number of bits of the current uncompressed offset. In some places there +/// are different sets of probabilities for different pos states. +#define POS_STATES_MAX (1 << LZMA_PB_MAX) + + +/// Validates lc, lp, and pb. +static inline bool +is_lclppb_valid(const lzma_options_lzma *options) +{ + return options->lc <= LZMA_LCLP_MAX && options->lp <= LZMA_LCLP_MAX + && options->lc + options->lp <= LZMA_LCLP_MAX + && options->pb <= LZMA_PB_MAX; +} + + +/////////// +// State // +/////////// + +/// This enum is used to track which events have occurred most recently and +/// in which order. This information is used to predict the next event. +/// +/// Events: +/// - Literal: One 8-bit byte +/// - Match: Repeat a chunk of data at some distance +/// - Long repeat: Multi-byte match at a recently seen distance +/// - Short repeat: One-byte repeat at a recently seen distance +/// +/// The event names are in from STATE_oldest_older_previous. REP means +/// either short or long repeated match, and NONLIT means any non-literal. +typedef enum { + STATE_LIT_LIT, + STATE_MATCH_LIT_LIT, + STATE_REP_LIT_LIT, + STATE_SHORTREP_LIT_LIT, + STATE_MATCH_LIT, + STATE_REP_LIT, + STATE_SHORTREP_LIT, + STATE_LIT_MATCH, + STATE_LIT_LONGREP, + STATE_LIT_SHORTREP, + STATE_NONLIT_MATCH, + STATE_NONLIT_REP, +} lzma_lzma_state; + + +/// Total number of states +#define STATES 12 + +/// The lowest 7 states indicate that the previous state was a literal. +#define LIT_STATES 7 + + +/// Indicate that the latest state was a literal. +#define update_literal(state) \ + state = ((state) <= STATE_SHORTREP_LIT_LIT \ + ? STATE_LIT_LIT \ + : ((state) <= STATE_LIT_SHORTREP \ + ? (state) - 3 \ + : (state) - 6)) + +/// Indicate that the latest state was a match. +#define update_match(state) \ + state = ((state) < LIT_STATES ? STATE_LIT_MATCH : STATE_NONLIT_MATCH) + +/// Indicate that the latest state was a long repeated match. +#define update_long_rep(state) \ + state = ((state) < LIT_STATES ? STATE_LIT_LONGREP : STATE_NONLIT_REP) + +/// Indicate that the latest state was a short match. +#define update_short_rep(state) \ + state = ((state) < LIT_STATES ? STATE_LIT_SHORTREP : STATE_NONLIT_REP) + +/// Test if the previous state was a literal. +#define is_literal_state(state) \ + ((state) < LIT_STATES) + + +///////////// +// Literal // +///////////// + +/// Each literal coder is divided in three sections: +/// - 0x001-0x0FF: Without match byte +/// - 0x101-0x1FF: With match byte; match bit is 0 +/// - 0x201-0x2FF: With match byte; match bit is 1 +/// +/// Match byte is used when the previous LZMA symbol was something else than +/// a literal (that is, it was some kind of match). +#define LITERAL_CODER_SIZE 0x300 + +/// Maximum number of literal coders +#define LITERAL_CODERS_MAX (1 << LZMA_LCLP_MAX) + +/// Locate the literal coder for the next literal byte. The choice depends on +/// - the lowest literal_pos_bits bits of the position of the current +/// byte; and +/// - the highest literal_context_bits bits of the previous byte. +#define literal_subcoder(probs, lc, lp_mask, pos, prev_byte) \ + ((probs)[(((pos) & lp_mask) << lc) + ((prev_byte) >> (8 - lc))]) + + +static inline void +literal_init(probability (*probs)[LITERAL_CODER_SIZE], + uint32_t lc, uint32_t lp) +{ + assert(lc + lp <= LZMA_LCLP_MAX); + + const uint32_t coders = 1U << (lc + lp); + + for (uint32_t i = 0; i < coders; ++i) + for (uint32_t j = 0; j < LITERAL_CODER_SIZE; ++j) + bit_reset(probs[i][j]); + + return; +} + + +////////////////// +// Match length // +////////////////// + +// Minimum length of a match is two bytes. +#define MATCH_LEN_MIN 2 + +// Match length is encoded with 4, 5, or 10 bits. +// +// Length Bits +// 2-9 4 = Choice=0 + 3 bits +// 10-17 5 = Choice=1 + Choice2=0 + 3 bits +// 18-273 10 = Choice=1 + Choice2=1 + 8 bits +#define LEN_LOW_BITS 3 +#define LEN_LOW_SYMBOLS (1 << LEN_LOW_BITS) +#define LEN_MID_BITS 3 +#define LEN_MID_SYMBOLS (1 << LEN_MID_BITS) +#define LEN_HIGH_BITS 8 +#define LEN_HIGH_SYMBOLS (1 << LEN_HIGH_BITS) +#define LEN_SYMBOLS (LEN_LOW_SYMBOLS + LEN_MID_SYMBOLS + LEN_HIGH_SYMBOLS) + +// Maximum length of a match is 273 which is a result of the encoding +// described above. +#define MATCH_LEN_MAX (MATCH_LEN_MIN + LEN_SYMBOLS - 1) + + +//////////////////// +// Match distance // +//////////////////// + +// Different set of probabilities is used for match distances that have very +// short match length: Lengths of 2, 3, and 4 bytes have a separate set of +// probabilities for each length. The matches with longer length use a shared +// set of probabilities. +#define LEN_TO_POS_STATES 4 + +// Macro to get the index of the appropriate probability array. +#define get_len_to_pos_state(len) \ + ((len) < LEN_TO_POS_STATES + MATCH_LEN_MIN \ + ? (len) - MATCH_LEN_MIN \ + : LEN_TO_POS_STATES - 1) + +// The highest two bits of a match distance (pos slot) are encoded using six +// bits. See fastpos.h for more explanation. +#define POS_SLOT_BITS 6 +#define POS_SLOTS (1 << POS_SLOT_BITS) + +// Match distances up to 127 are fully encoded using probabilities. Since +// the highest two bits (pos slot) are always encoded using six bits, the +// distances 0-3 don't need any additional bits to encode, since the pos +// slot itself is the same as the actual distance. START_POS_MODEL_INDEX +// indicates the first pos slot where at least one additional bit is needed. +#define START_POS_MODEL_INDEX 4 + +// Match distances greater than 127 are encoded in three pieces: +// - pos slot: the highest two bits +// - direct bits: 2-26 bits below the highest two bits +// - alignment bits: four lowest bits +// +// Direct bits don't use any probabilities. +// +// The pos slot value of 14 is for distances 128-191 (see the table in +// fastpos.h to understand why). +#define END_POS_MODEL_INDEX 14 + +// Pos slots that indicate a distance <= 127. +#define FULL_DISTANCES_BITS (END_POS_MODEL_INDEX / 2) +#define FULL_DISTANCES (1 << FULL_DISTANCES_BITS) + +// For match distances greater than 127, only the highest two bits and the +// lowest four bits (alignment) is encoded using probabilities. +#define ALIGN_BITS 4 +#define ALIGN_TABLE_SIZE (1 << ALIGN_BITS) +#define ALIGN_MASK (ALIGN_TABLE_SIZE - 1) + +// LZMA remembers the four most recent match distances. Reusing these distances +// tends to take less space than re-encoding the actual distance value. +#define REP_DISTANCES 4 + +#endif diff --git a/liblzma/lzma/lzma_decoder.c b/liblzma/lzma/lzma_decoder.c new file mode 100644 index 0000000..9979bb4 --- /dev/null +++ b/liblzma/lzma/lzma_decoder.c @@ -0,0 +1,1057 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lzma_decoder.c +/// \brief LZMA decoder +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "lz_decoder.h" +#include "lzma_common.h" +#include "lzma_decoder.h" +#include "range_decoder.h" + + +#ifdef HAVE_SMALL + +// Macros for (somewhat) size-optimized code. +#define seq_4(seq) seq + +#define seq_6(seq) seq + +#define seq_8(seq) seq + +#define seq_len(seq) \ + seq ## _CHOICE, \ + seq ## _CHOICE2, \ + seq ## _BITTREE + +#define len_decode(target, ld, pos_state, seq) \ +do { \ +case seq ## _CHOICE: \ + rc_if_0(ld.choice, seq ## _CHOICE) { \ + rc_update_0(ld.choice); \ + probs = ld.low[pos_state];\ + limit = LEN_LOW_SYMBOLS; \ + target = MATCH_LEN_MIN; \ + } else { \ + rc_update_1(ld.choice); \ +case seq ## _CHOICE2: \ + rc_if_0(ld.choice2, seq ## _CHOICE2) { \ + rc_update_0(ld.choice2); \ + probs = ld.mid[pos_state]; \ + limit = LEN_MID_SYMBOLS; \ + target = MATCH_LEN_MIN + LEN_LOW_SYMBOLS; \ + } else { \ + rc_update_1(ld.choice2); \ + probs = ld.high; \ + limit = LEN_HIGH_SYMBOLS; \ + target = MATCH_LEN_MIN + LEN_LOW_SYMBOLS \ + + LEN_MID_SYMBOLS; \ + } \ + } \ + symbol = 1; \ +case seq ## _BITTREE: \ + do { \ + rc_bit(probs[symbol], , , seq ## _BITTREE); \ + } while (symbol < limit); \ + target += symbol - limit; \ +} while (0) + +#else // HAVE_SMALL + +// Unrolled versions +#define seq_4(seq) \ + seq ## 0, \ + seq ## 1, \ + seq ## 2, \ + seq ## 3 + +#define seq_6(seq) \ + seq ## 0, \ + seq ## 1, \ + seq ## 2, \ + seq ## 3, \ + seq ## 4, \ + seq ## 5 + +#define seq_8(seq) \ + seq ## 0, \ + seq ## 1, \ + seq ## 2, \ + seq ## 3, \ + seq ## 4, \ + seq ## 5, \ + seq ## 6, \ + seq ## 7 + +#define seq_len(seq) \ + seq ## _CHOICE, \ + seq ## _LOW0, \ + seq ## _LOW1, \ + seq ## _LOW2, \ + seq ## _CHOICE2, \ + seq ## _MID0, \ + seq ## _MID1, \ + seq ## _MID2, \ + seq ## _HIGH0, \ + seq ## _HIGH1, \ + seq ## _HIGH2, \ + seq ## _HIGH3, \ + seq ## _HIGH4, \ + seq ## _HIGH5, \ + seq ## _HIGH6, \ + seq ## _HIGH7 + +#define len_decode(target, ld, pos_state, seq) \ +do { \ + symbol = 1; \ +case seq ## _CHOICE: \ + rc_if_0(ld.choice, seq ## _CHOICE) { \ + rc_update_0(ld.choice); \ + rc_bit_case(ld.low[pos_state][symbol], , , seq ## _LOW0); \ + rc_bit_case(ld.low[pos_state][symbol], , , seq ## _LOW1); \ + rc_bit_case(ld.low[pos_state][symbol], , , seq ## _LOW2); \ + target = symbol - LEN_LOW_SYMBOLS + MATCH_LEN_MIN; \ + } else { \ + rc_update_1(ld.choice); \ +case seq ## _CHOICE2: \ + rc_if_0(ld.choice2, seq ## _CHOICE2) { \ + rc_update_0(ld.choice2); \ + rc_bit_case(ld.mid[pos_state][symbol], , , \ + seq ## _MID0); \ + rc_bit_case(ld.mid[pos_state][symbol], , , \ + seq ## _MID1); \ + rc_bit_case(ld.mid[pos_state][symbol], , , \ + seq ## _MID2); \ + target = symbol - LEN_MID_SYMBOLS \ + + MATCH_LEN_MIN + LEN_LOW_SYMBOLS; \ + } else { \ + rc_update_1(ld.choice2); \ + rc_bit_case(ld.high[symbol], , , seq ## _HIGH0); \ + rc_bit_case(ld.high[symbol], , , seq ## _HIGH1); \ + rc_bit_case(ld.high[symbol], , , seq ## _HIGH2); \ + rc_bit_case(ld.high[symbol], , , seq ## _HIGH3); \ + rc_bit_case(ld.high[symbol], , , seq ## _HIGH4); \ + rc_bit_case(ld.high[symbol], , , seq ## _HIGH5); \ + rc_bit_case(ld.high[symbol], , , seq ## _HIGH6); \ + rc_bit_case(ld.high[symbol], , , seq ## _HIGH7); \ + target = symbol - LEN_HIGH_SYMBOLS \ + + MATCH_LEN_MIN \ + + LEN_LOW_SYMBOLS + LEN_MID_SYMBOLS; \ + } \ + } \ +} while (0) + +#endif // HAVE_SMALL + + +/// Length decoder probabilities; see comments in lzma_common.h. +typedef struct { + probability choice; + probability choice2; + probability low[POS_STATES_MAX][LEN_LOW_SYMBOLS]; + probability mid[POS_STATES_MAX][LEN_MID_SYMBOLS]; + probability high[LEN_HIGH_SYMBOLS]; +} lzma_length_decoder; + + +struct lzma_coder_s { + /////////////////// + // Probabilities // + /////////////////// + + /// Literals; see comments in lzma_common.h. + probability literal[LITERAL_CODERS_MAX][LITERAL_CODER_SIZE]; + + /// If 1, it's a match. Otherwise it's a single 8-bit literal. + probability is_match[STATES][POS_STATES_MAX]; + + /// If 1, it's a repeated match. The distance is one of rep0 .. rep3. + probability is_rep[STATES]; + + /// If 0, distance of a repeated match is rep0. + /// Otherwise check is_rep1. + probability is_rep0[STATES]; + + /// If 0, distance of a repeated match is rep1. + /// Otherwise check is_rep2. + probability is_rep1[STATES]; + + /// If 0, distance of a repeated match is rep2. Otherwise it is rep3. + probability is_rep2[STATES]; + + /// If 1, the repeated match has length of one byte. Otherwise + /// the length is decoded from rep_len_decoder. + probability is_rep0_long[STATES][POS_STATES_MAX]; + + /// Probability tree for the highest two bits of the match distance. + /// There is a separate probability tree for match lengths of + /// 2 (i.e. MATCH_LEN_MIN), 3, 4, and [5, 273]. + probability pos_slot[LEN_TO_POS_STATES][POS_SLOTS]; + + /// Probability trees for additional bits for match distance when the + /// distance is in the range [4, 127]. + probability pos_special[FULL_DISTANCES - END_POS_MODEL_INDEX]; + + /// Probability tree for the lowest four bits of a match distance + /// that is equal to or greater than 128. + probability pos_align[ALIGN_TABLE_SIZE]; + + /// Length of a normal match + lzma_length_decoder match_len_decoder; + + /// Length of a repeated match + lzma_length_decoder rep_len_decoder; + + /////////////////// + // Decoder state // + /////////////////// + + // Range coder + lzma_range_decoder rc; + + // Types of the most recently seen LZMA symbols + lzma_lzma_state state; + + uint32_t rep0; ///< Distance of the latest match + uint32_t rep1; ///< Distance of second latest match + uint32_t rep2; ///< Distance of third latest match + uint32_t rep3; ///< Distance of fourth latest match + + uint32_t pos_mask; // (1U << pb) - 1 + uint32_t literal_context_bits; + uint32_t literal_pos_mask; + + /// Uncompressed size as bytes, or LZMA_VLI_UNKNOWN if end of + /// payload marker is expected. + lzma_vli uncompressed_size; + + //////////////////////////////// + // State of incomplete symbol // + //////////////////////////////// + + /// Position where to continue the decoder loop + enum { + SEQ_NORMALIZE, + SEQ_IS_MATCH, + seq_8(SEQ_LITERAL), + seq_8(SEQ_LITERAL_MATCHED), + SEQ_LITERAL_WRITE, + SEQ_IS_REP, + seq_len(SEQ_MATCH_LEN), + seq_6(SEQ_POS_SLOT), + SEQ_POS_MODEL, + SEQ_DIRECT, + seq_4(SEQ_ALIGN), + SEQ_EOPM, + SEQ_IS_REP0, + SEQ_SHORTREP, + SEQ_IS_REP0_LONG, + SEQ_IS_REP1, + SEQ_IS_REP2, + seq_len(SEQ_REP_LEN), + SEQ_COPY, + } sequence; + + /// Base of the current probability tree + probability *probs; + + /// Symbol being decoded. This is also used as an index variable in + /// bittree decoders: probs[symbol] + uint32_t symbol; + + /// Used as a loop termination condition on bittree decoders and + /// direct bits decoder. + uint32_t limit; + + /// Matched literal decoder: 0x100 or 0 to help avoiding branches. + /// Bittree reverse decoders: Offset of the next bit: 1 << offset + uint32_t offset; + + /// If decoding a literal: match byte. + /// If decoding a match: length of the match. + uint32_t len; +}; + + +static lzma_ret +lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, + const uint8_t *restrict in, + size_t *restrict in_pos, size_t in_size) +{ + //////////////////// + // Initialization // + //////////////////// + + if (!rc_read_init(&coder->rc, in, in_pos, in_size)) + return LZMA_OK; + + /////////////// + // Variables // + /////////////// + + // Making local copies of often-used variables improves both + // speed and readability. + + lzma_dict dict = *dictptr; + + const size_t dict_start = dict.pos; + + // Range decoder + rc_to_local(coder->rc, *in_pos); + + // State + uint32_t state = coder->state; + uint32_t rep0 = coder->rep0; + uint32_t rep1 = coder->rep1; + uint32_t rep2 = coder->rep2; + uint32_t rep3 = coder->rep3; + + const uint32_t pos_mask = coder->pos_mask; + + // These variables are actually needed only if we last time ran + // out of input in the middle of the decoder loop. + probability *probs = coder->probs; + uint32_t symbol = coder->symbol; + uint32_t limit = coder->limit; + uint32_t offset = coder->offset; + uint32_t len = coder->len; + + const uint32_t literal_pos_mask = coder->literal_pos_mask; + const uint32_t literal_context_bits = coder->literal_context_bits; + + // Temporary variables + uint32_t pos_state = dict.pos & pos_mask; + + lzma_ret ret = LZMA_OK; + + // If uncompressed size is known, there must be no end of payload + // marker. + const bool no_eopm = coder->uncompressed_size + != LZMA_VLI_UNKNOWN; + if (no_eopm && coder->uncompressed_size < dict.limit - dict.pos) + dict.limit = dict.pos + (size_t)(coder->uncompressed_size); + + // The main decoder loop. The "switch" is used to restart the decoder at + // correct location. Once restarted, the "switch" is no longer used. + switch (coder->sequence) + while (true) { + // Calculate new pos_state. This is skipped on the first loop + // since we already calculated it when setting up the local + // variables. + pos_state = dict.pos & pos_mask; + + case SEQ_NORMALIZE: + case SEQ_IS_MATCH: + if (unlikely(no_eopm && dict.pos == dict.limit)) + break; + + rc_if_0(coder->is_match[state][pos_state], SEQ_IS_MATCH) { + rc_update_0(coder->is_match[state][pos_state]); + + // It's a literal i.e. a single 8-bit byte. + + probs = literal_subcoder(coder->literal, + literal_context_bits, literal_pos_mask, + dict.pos, dict_get(&dict, 0)); + symbol = 1; + + if (is_literal_state(state)) { + // Decode literal without match byte. +#ifdef HAVE_SMALL + case SEQ_LITERAL: + do { + rc_bit(probs[symbol], , , SEQ_LITERAL); + } while (symbol < (1 << 8)); +#else + rc_bit_case(probs[symbol], , , SEQ_LITERAL0); + rc_bit_case(probs[symbol], , , SEQ_LITERAL1); + rc_bit_case(probs[symbol], , , SEQ_LITERAL2); + rc_bit_case(probs[symbol], , , SEQ_LITERAL3); + rc_bit_case(probs[symbol], , , SEQ_LITERAL4); + rc_bit_case(probs[symbol], , , SEQ_LITERAL5); + rc_bit_case(probs[symbol], , , SEQ_LITERAL6); + rc_bit_case(probs[symbol], , , SEQ_LITERAL7); +#endif + } else { + // Decode literal with match byte. + // + // We store the byte we compare against + // ("match byte") to "len" to minimize the + // number of variables we need to store + // between decoder calls. + len = dict_get(&dict, rep0) << 1; + + // The usage of "offset" allows omitting some + // branches, which should give tiny speed + // improvement on some CPUs. "offset" gets + // set to zero if match_bit didn't match. + offset = 0x100; + +#ifdef HAVE_SMALL + case SEQ_LITERAL_MATCHED: + do { + const uint32_t match_bit + = len & offset; + const uint32_t subcoder_index + = offset + match_bit + + symbol; + + rc_bit(probs[subcoder_index], + offset &= ~match_bit, + offset &= match_bit, + SEQ_LITERAL_MATCHED); + + // It seems to be faster to do this + // here instead of putting it to the + // beginning of the loop and then + // putting the "case" in the middle + // of the loop. + len <<= 1; + + } while (symbol < (1 << 8)); +#else + // Unroll the loop. + uint32_t match_bit; + uint32_t subcoder_index; + +# define d(seq) \ + case seq: \ + match_bit = len & offset; \ + subcoder_index = offset + match_bit + symbol; \ + rc_bit(probs[subcoder_index], \ + offset &= ~match_bit, \ + offset &= match_bit, \ + seq) + + d(SEQ_LITERAL_MATCHED0); + len <<= 1; + d(SEQ_LITERAL_MATCHED1); + len <<= 1; + d(SEQ_LITERAL_MATCHED2); + len <<= 1; + d(SEQ_LITERAL_MATCHED3); + len <<= 1; + d(SEQ_LITERAL_MATCHED4); + len <<= 1; + d(SEQ_LITERAL_MATCHED5); + len <<= 1; + d(SEQ_LITERAL_MATCHED6); + len <<= 1; + d(SEQ_LITERAL_MATCHED7); +# undef d +#endif + } + + //update_literal(state); + // Use a lookup table to update to literal state, + // since compared to other state updates, this would + // need two branches. + static const lzma_lzma_state next_state[] = { + STATE_LIT_LIT, + STATE_LIT_LIT, + STATE_LIT_LIT, + STATE_LIT_LIT, + STATE_MATCH_LIT_LIT, + STATE_REP_LIT_LIT, + STATE_SHORTREP_LIT_LIT, + STATE_MATCH_LIT, + STATE_REP_LIT, + STATE_SHORTREP_LIT, + STATE_MATCH_LIT, + STATE_REP_LIT + }; + state = next_state[state]; + + case SEQ_LITERAL_WRITE: + if (unlikely(dict_put(&dict, symbol))) { + coder->sequence = SEQ_LITERAL_WRITE; + goto out; + } + + continue; + } + + // Instead of a new byte we are going to get a byte range + // (distance and length) which will be repeated from our + // output history. + + rc_update_1(coder->is_match[state][pos_state]); + + case SEQ_IS_REP: + rc_if_0(coder->is_rep[state], SEQ_IS_REP) { + // Not a repeated match + rc_update_0(coder->is_rep[state]); + update_match(state); + + // The latest three match distances are kept in + // memory in case there are repeated matches. + rep3 = rep2; + rep2 = rep1; + rep1 = rep0; + + // Decode the length of the match. + len_decode(len, coder->match_len_decoder, + pos_state, SEQ_MATCH_LEN); + + // Prepare to decode the highest two bits of the + // match distance. + probs = coder->pos_slot[get_len_to_pos_state(len)]; + symbol = 1; + +#ifdef HAVE_SMALL + case SEQ_POS_SLOT: + do { + rc_bit(probs[symbol], , , SEQ_POS_SLOT); + } while (symbol < POS_SLOTS); +#else + rc_bit_case(probs[symbol], , , SEQ_POS_SLOT0); + rc_bit_case(probs[symbol], , , SEQ_POS_SLOT1); + rc_bit_case(probs[symbol], , , SEQ_POS_SLOT2); + rc_bit_case(probs[symbol], , , SEQ_POS_SLOT3); + rc_bit_case(probs[symbol], , , SEQ_POS_SLOT4); + rc_bit_case(probs[symbol], , , SEQ_POS_SLOT5); +#endif + // Get rid of the highest bit that was needed for + // indexing of the probability array. + symbol -= POS_SLOTS; + assert(symbol <= 63); + + if (symbol < START_POS_MODEL_INDEX) { + // Match distances [0, 3] have only two bits. + rep0 = symbol; + } else { + // Decode the lowest [1, 29] bits of + // the match distance. + limit = (symbol >> 1) - 1; + assert(limit >= 1 && limit <= 30); + rep0 = 2 + (symbol & 1); + + if (symbol < END_POS_MODEL_INDEX) { + // Prepare to decode the low bits for + // a distance of [4, 127]. + assert(limit <= 5); + rep0 <<= limit; + assert(rep0 <= 96); + // -1 is fine, because we start + // decoding at probs[1], not probs[0]. + // NOTE: This violates the C standard, + // since we are doing pointer + // arithmetic past the beginning of + // the array. + assert((int32_t)(rep0 - symbol - 1) + >= -1); + assert((int32_t)(rep0 - symbol - 1) + <= 82); + probs = coder->pos_special + rep0 + - symbol - 1; + symbol = 1; + offset = 0; + case SEQ_POS_MODEL: +#ifdef HAVE_SMALL + do { + rc_bit(probs[symbol], , + rep0 += 1 << offset, + SEQ_POS_MODEL); + } while (++offset < limit); +#else + switch (limit) { + case 5: + assert(offset == 0); + rc_bit(probs[symbol], , + rep0 += 1, + SEQ_POS_MODEL); + ++offset; + --limit; + case 4: + rc_bit(probs[symbol], , + rep0 += 1 << offset, + SEQ_POS_MODEL); + ++offset; + --limit; + case 3: + rc_bit(probs[symbol], , + rep0 += 1 << offset, + SEQ_POS_MODEL); + ++offset; + --limit; + case 2: + rc_bit(probs[symbol], , + rep0 += 1 << offset, + SEQ_POS_MODEL); + ++offset; + --limit; + case 1: + // We need "symbol" only for + // indexing the probability + // array, thus we can use + // rc_bit_last() here to omit + // the unneeded updating of + // "symbol". + rc_bit_last(probs[symbol], , + rep0 += 1 << offset, + SEQ_POS_MODEL); + } +#endif + } else { + // The distance is >= 128. Decode the + // lower bits without probabilities + // except the lowest four bits. + assert(symbol >= 14); + assert(limit >= 6); + limit -= ALIGN_BITS; + assert(limit >= 2); + case SEQ_DIRECT: + // Not worth manual unrolling + do { + rc_direct(rep0, SEQ_DIRECT); + } while (--limit > 0); + + // Decode the lowest four bits using + // probabilities. + rep0 <<= ALIGN_BITS; + symbol = 1; +#ifdef HAVE_SMALL + offset = 0; + case SEQ_ALIGN: + do { + rc_bit(coder->pos_align[ + symbol], , + rep0 += 1 << offset, + SEQ_ALIGN); + } while (++offset < ALIGN_BITS); +#else + case SEQ_ALIGN0: + rc_bit(coder->pos_align[symbol], , + rep0 += 1, SEQ_ALIGN0); + case SEQ_ALIGN1: + rc_bit(coder->pos_align[symbol], , + rep0 += 2, SEQ_ALIGN1); + case SEQ_ALIGN2: + rc_bit(coder->pos_align[symbol], , + rep0 += 4, SEQ_ALIGN2); + case SEQ_ALIGN3: + // Like in SEQ_POS_MODEL, we don't + // need "symbol" for anything else + // than indexing the probability array. + rc_bit_last(coder->pos_align[symbol], , + rep0 += 8, SEQ_ALIGN3); +#endif + + if (rep0 == UINT32_MAX) { + // End of payload marker was + // found. It must not be + // present if uncompressed + // size is known. + if (coder->uncompressed_size + != LZMA_VLI_UNKNOWN) { + ret = LZMA_DATA_ERROR; + goto out; + } + + case SEQ_EOPM: + // LZMA1 stream with + // end-of-payload marker. + rc_normalize(SEQ_EOPM); + ret = LZMA_STREAM_END; + goto out; + } + } + } + + // Validate the distance we just decoded. + if (unlikely(!dict_is_distance_valid(&dict, rep0))) { + ret = LZMA_DATA_ERROR; + goto out; + } + + } else { + rc_update_1(coder->is_rep[state]); + + // Repeated match + // + // The match distance is a value that we have had + // earlier. The latest four match distances are + // available as rep0, rep1, rep2 and rep3. We will + // now decode which of them is the new distance. + // + // There cannot be a match if we haven't produced + // any output, so check that first. + if (unlikely(!dict_is_distance_valid(&dict, 0))) { + ret = LZMA_DATA_ERROR; + goto out; + } + + case SEQ_IS_REP0: + rc_if_0(coder->is_rep0[state], SEQ_IS_REP0) { + rc_update_0(coder->is_rep0[state]); + // The distance is rep0. + + case SEQ_IS_REP0_LONG: + rc_if_0(coder->is_rep0_long[state][pos_state], + SEQ_IS_REP0_LONG) { + rc_update_0(coder->is_rep0_long[ + state][pos_state]); + + update_short_rep(state); + + case SEQ_SHORTREP: + if (unlikely(dict_put(&dict, dict_get( + &dict, rep0)))) { + coder->sequence = SEQ_SHORTREP; + goto out; + } + + continue; + } + + // Repeating more than one byte at + // distance of rep0. + rc_update_1(coder->is_rep0_long[ + state][pos_state]); + + } else { + rc_update_1(coder->is_rep0[state]); + + case SEQ_IS_REP1: + // The distance is rep1, rep2 or rep3. Once + // we find out which one of these three, it + // is stored to rep0 and rep1, rep2 and rep3 + // are updated accordingly. + rc_if_0(coder->is_rep1[state], SEQ_IS_REP1) { + rc_update_0(coder->is_rep1[state]); + + const uint32_t distance = rep1; + rep1 = rep0; + rep0 = distance; + + } else { + rc_update_1(coder->is_rep1[state]); + case SEQ_IS_REP2: + rc_if_0(coder->is_rep2[state], + SEQ_IS_REP2) { + rc_update_0(coder->is_rep2[ + state]); + + const uint32_t distance = rep2; + rep2 = rep1; + rep1 = rep0; + rep0 = distance; + + } else { + rc_update_1(coder->is_rep2[ + state]); + + const uint32_t distance = rep3; + rep3 = rep2; + rep2 = rep1; + rep1 = rep0; + rep0 = distance; + } + } + } + + update_long_rep(state); + + // Decode the length of the repeated match. + len_decode(len, coder->rep_len_decoder, + pos_state, SEQ_REP_LEN); + } + + ///////////////////////////////// + // Repeat from history buffer. // + ///////////////////////////////// + + // The length is always between these limits. There is no way + // to trigger the algorithm to set len outside this range. + assert(len >= MATCH_LEN_MIN); + assert(len <= MATCH_LEN_MAX); + + case SEQ_COPY: + // Repeat len bytes from distance of rep0. + if (unlikely(dict_repeat(&dict, rep0, &len))) { + coder->sequence = SEQ_COPY; + goto out; + } + } + + rc_normalize(SEQ_NORMALIZE); + coder->sequence = SEQ_IS_MATCH; + +out: + // Save state + + // NOTE: Must not copy dict.limit. + dictptr->pos = dict.pos; + dictptr->full = dict.full; + + rc_from_local(coder->rc, *in_pos); + + coder->state = state; + coder->rep0 = rep0; + coder->rep1 = rep1; + coder->rep2 = rep2; + coder->rep3 = rep3; + + coder->probs = probs; + coder->symbol = symbol; + coder->limit = limit; + coder->offset = offset; + coder->len = len; + + // Update the remaining amount of uncompressed data if uncompressed + // size was known. + if (coder->uncompressed_size != LZMA_VLI_UNKNOWN) { + coder->uncompressed_size -= dict.pos - dict_start; + + // Since there cannot be end of payload marker if the + // uncompressed size was known, we check here if we + // finished decoding. + if (coder->uncompressed_size == 0 && ret == LZMA_OK + && coder->sequence != SEQ_NORMALIZE) + ret = coder->sequence == SEQ_IS_MATCH + ? LZMA_STREAM_END : LZMA_DATA_ERROR; + } + + // We can do an additional check in the range decoder to catch some + // corrupted files. + if (ret == LZMA_STREAM_END) { + if (!rc_is_finished(coder->rc)) + ret = LZMA_DATA_ERROR; + + // Reset the range decoder so that it is ready to reinitialize + // for a new LZMA2 chunk. + rc_reset(coder->rc); + } + + return ret; +} + + + +static void +lzma_decoder_uncompressed(lzma_coder *coder, lzma_vli uncompressed_size) +{ + coder->uncompressed_size = uncompressed_size; +} + +/* +extern void +lzma_lzma_decoder_uncompressed(void *coder_ptr, lzma_vli uncompressed_size) +{ + // This is hack. + (*(lzma_coder **)(coder))->uncompressed_size = uncompressed_size; +} +*/ + +static void +lzma_decoder_reset(lzma_coder *coder, const void *opt) +{ + const lzma_options_lzma *options = opt; + + // NOTE: We assume that lc/lp/pb are valid since they were + // successfully decoded with lzma_lzma_decode_properties(). + + // Calculate pos_mask. We don't need pos_bits as is for anything. + coder->pos_mask = (1U << options->pb) - 1; + + // Initialize the literal decoder. + literal_init(coder->literal, options->lc, options->lp); + + coder->literal_context_bits = options->lc; + coder->literal_pos_mask = (1U << options->lp) - 1; + + // State + coder->state = STATE_LIT_LIT; + coder->rep0 = 0; + coder->rep1 = 0; + coder->rep2 = 0; + coder->rep3 = 0; + coder->pos_mask = (1U << options->pb) - 1; + + // Range decoder + rc_reset(coder->rc); + + // Bit and bittree decoders + for (uint32_t i = 0; i < STATES; ++i) { + for (uint32_t j = 0; j <= coder->pos_mask; ++j) { + bit_reset(coder->is_match[i][j]); + bit_reset(coder->is_rep0_long[i][j]); + } + + bit_reset(coder->is_rep[i]); + bit_reset(coder->is_rep0[i]); + bit_reset(coder->is_rep1[i]); + bit_reset(coder->is_rep2[i]); + } + + for (uint32_t i = 0; i < LEN_TO_POS_STATES; ++i) + bittree_reset(coder->pos_slot[i], POS_SLOT_BITS); + + for (uint32_t i = 0; i < FULL_DISTANCES - END_POS_MODEL_INDEX; ++i) + bit_reset(coder->pos_special[i]); + + bittree_reset(coder->pos_align, ALIGN_BITS); + + // Len decoders (also bit/bittree) + const uint32_t num_pos_states = 1U << options->pb; + bit_reset(coder->match_len_decoder.choice); + bit_reset(coder->match_len_decoder.choice2); + bit_reset(coder->rep_len_decoder.choice); + bit_reset(coder->rep_len_decoder.choice2); + + for (uint32_t pos_state = 0; pos_state < num_pos_states; ++pos_state) { + bittree_reset(coder->match_len_decoder.low[pos_state], + LEN_LOW_BITS); + bittree_reset(coder->match_len_decoder.mid[pos_state], + LEN_MID_BITS); + + bittree_reset(coder->rep_len_decoder.low[pos_state], + LEN_LOW_BITS); + bittree_reset(coder->rep_len_decoder.mid[pos_state], + LEN_MID_BITS); + } + + bittree_reset(coder->match_len_decoder.high, LEN_HIGH_BITS); + bittree_reset(coder->rep_len_decoder.high, LEN_HIGH_BITS); + + coder->sequence = SEQ_IS_MATCH; + coder->probs = NULL; + coder->symbol = 0; + coder->limit = 0; + coder->offset = 0; + coder->len = 0; + + return; +} + + +extern lzma_ret +lzma_lzma_decoder_create(lzma_lz_decoder *lz, lzma_allocator *allocator, + const void *opt, lzma_lz_options *lz_options) +{ + if (lz->coder == NULL) { + lz->coder = lzma_alloc(sizeof(lzma_coder), allocator); + if (lz->coder == NULL) + return LZMA_MEM_ERROR; + + lz->code = &lzma_decode; + lz->reset = &lzma_decoder_reset; + lz->set_uncompressed = &lzma_decoder_uncompressed; + } + + // All dictionary sizes are OK here. LZ decoder will take care of + // the special cases. + const lzma_options_lzma *options = opt; + lz_options->dict_size = options->dict_size; + lz_options->preset_dict = options->preset_dict; + lz_options->preset_dict_size = options->preset_dict_size; + + return LZMA_OK; +} + + +/// Allocate and initialize LZMA decoder. This is used only via LZ +/// initialization (lzma_lzma_decoder_init() passes function pointer to +/// the LZ initialization). +static lzma_ret +lzma_decoder_init(lzma_lz_decoder *lz, lzma_allocator *allocator, + const void *options, lzma_lz_options *lz_options) +{ + if (!is_lclppb_valid(options)) + return LZMA_PROG_ERROR; + + return_if_error(lzma_lzma_decoder_create( + lz, allocator, options, lz_options)); + + lzma_decoder_reset(lz->coder, options); + lzma_decoder_uncompressed(lz->coder, LZMA_VLI_UNKNOWN); + + return LZMA_OK; +} + + +extern lzma_ret +lzma_lzma_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters) +{ + // LZMA can only be the last filter in the chain. This is enforced + // by the raw_decoder initialization. + assert(filters[1].init == NULL); + + return lzma_lz_decoder_init(next, allocator, filters, + &lzma_decoder_init); +} + + +extern bool +lzma_lzma_lclppb_decode(lzma_options_lzma *options, uint8_t byte) +{ + if (byte > (4 * 5 + 4) * 9 + 8) + return true; + + // See the file format specification to understand this. + options->pb = byte / (9 * 5); + byte -= options->pb * 9 * 5; + options->lp = byte / 9; + options->lc = byte - options->lp * 9; + + return options->lc + options->lp > LZMA_LCLP_MAX; +} + + +extern uint64_t +lzma_lzma_decoder_memusage_nocheck(const void *options) +{ + const lzma_options_lzma *const opt = options; + return sizeof(lzma_coder) + lzma_lz_decoder_memusage(opt->dict_size); +} + + +extern uint64_t +lzma_lzma_decoder_memusage(const void *options) +{ + if (!is_lclppb_valid(options)) + return UINT64_MAX; + + return lzma_lzma_decoder_memusage_nocheck(options); +} + + +extern lzma_ret +lzma_lzma_props_decode(void **options, lzma_allocator *allocator, + const uint8_t *props, size_t props_size) +{ + if (props_size != 5) + return LZMA_OPTIONS_ERROR; + + lzma_options_lzma *opt + = lzma_alloc(sizeof(lzma_options_lzma), allocator); + if (opt == NULL) + return LZMA_MEM_ERROR; + + if (lzma_lzma_lclppb_decode(opt, props[0])) + goto error; + + // All dictionary sizes are accepted, including zero. LZ decoder + // will automatically use a dictionary at least a few KiB even if + // a smaller dictionary is requested. + opt->dict_size = unaligned_read32le(props + 1); + + opt->preset_dict = NULL; + opt->preset_dict_size = 0; + + *options = opt; + + return LZMA_OK; + +error: + lzma_free(opt, allocator); + return LZMA_OPTIONS_ERROR; +} diff --git a/liblzma/lzma/lzma_decoder.h b/liblzma/lzma/lzma_decoder.h new file mode 100644 index 0000000..a463a76 --- /dev/null +++ b/liblzma/lzma/lzma_decoder.h @@ -0,0 +1,52 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lzma_decoder.h +/// \brief LZMA decoder API +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_LZMA_DECODER_H +#define LZMA_LZMA_DECODER_H + +#include "common.h" + + +/// Allocates and initializes LZMA decoder +extern lzma_ret lzma_lzma_decoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + +extern uint64_t lzma_lzma_decoder_memusage(const void *options); + +extern lzma_ret lzma_lzma_props_decode( + void **options, lzma_allocator *allocator, + const uint8_t *props, size_t props_size); + + +/// \brief Decodes the LZMA Properties byte (lc/lp/pb) +/// +/// \return true if error occurred, false on success +/// +extern bool lzma_lzma_lclppb_decode( + lzma_options_lzma *options, uint8_t byte); + + +#ifdef LZMA_LZ_DECODER_H +/// Allocate and setup function pointers only. This is used by LZMA1 and +/// LZMA2 decoders. +extern lzma_ret lzma_lzma_decoder_create( + lzma_lz_decoder *lz, lzma_allocator *allocator, + const void *opt, lzma_lz_options *lz_options); + +/// Gets memory usage without validating lc/lp/pb. This is used by LZMA2 +/// decoder, because raw LZMA2 decoding doesn't need lc/lp/pb. +extern uint64_t lzma_lzma_decoder_memusage_nocheck(const void *options); + +#endif + +#endif diff --git a/liblzma/lzma/lzma_encoder.c b/liblzma/lzma/lzma_encoder.c new file mode 100644 index 0000000..0b9ee9e --- /dev/null +++ b/liblzma/lzma/lzma_encoder.c @@ -0,0 +1,675 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lzma_encoder.c +/// \brief LZMA encoder +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "lzma2_encoder.h" +#include "lzma_encoder_private.h" +#include "fastpos.h" + + +///////////// +// Literal // +///////////// + +static inline void +literal_matched(lzma_range_encoder *rc, probability *subcoder, + uint32_t match_byte, uint32_t symbol) +{ + uint32_t offset = 0x100; + symbol += UINT32_C(1) << 8; + + do { + match_byte <<= 1; + const uint32_t match_bit = match_byte & offset; + const uint32_t subcoder_index + = offset + match_bit + (symbol >> 8); + const uint32_t bit = (symbol >> 7) & 1; + rc_bit(rc, &subcoder[subcoder_index], bit); + + symbol <<= 1; + offset &= ~(match_byte ^ symbol); + + } while (symbol < (UINT32_C(1) << 16)); +} + + +static inline void +literal(lzma_coder *coder, lzma_mf *mf, uint32_t position) +{ + // Locate the literal byte to be encoded and the subcoder. + const uint8_t cur_byte = mf->buffer[ + mf->read_pos - mf->read_ahead]; + probability *subcoder = literal_subcoder(coder->literal, + coder->literal_context_bits, coder->literal_pos_mask, + position, mf->buffer[mf->read_pos - mf->read_ahead - 1]); + + if (is_literal_state(coder->state)) { + // Previous LZMA-symbol was a literal. Encode a normal + // literal without a match byte. + rc_bittree(&coder->rc, subcoder, 8, cur_byte); + } else { + // Previous LZMA-symbol was a match. Use the last byte of + // the match as a "match byte". That is, compare the bits + // of the current literal and the match byte. + const uint8_t match_byte = mf->buffer[ + mf->read_pos - coder->reps[0] - 1 + - mf->read_ahead]; + literal_matched(&coder->rc, subcoder, match_byte, cur_byte); + } + + update_literal(coder->state); +} + + +////////////////// +// Match length // +////////////////// + +static void +length_update_prices(lzma_length_encoder *lc, const uint32_t pos_state) +{ + const uint32_t table_size = lc->table_size; + lc->counters[pos_state] = table_size; + + const uint32_t a0 = rc_bit_0_price(lc->choice); + const uint32_t a1 = rc_bit_1_price(lc->choice); + const uint32_t b0 = a1 + rc_bit_0_price(lc->choice2); + const uint32_t b1 = a1 + rc_bit_1_price(lc->choice2); + uint32_t *const prices = lc->prices[pos_state]; + + uint32_t i; + for (i = 0; i < table_size && i < LEN_LOW_SYMBOLS; ++i) + prices[i] = a0 + rc_bittree_price(lc->low[pos_state], + LEN_LOW_BITS, i); + + for (; i < table_size && i < LEN_LOW_SYMBOLS + LEN_MID_SYMBOLS; ++i) + prices[i] = b0 + rc_bittree_price(lc->mid[pos_state], + LEN_MID_BITS, i - LEN_LOW_SYMBOLS); + + for (; i < table_size; ++i) + prices[i] = b1 + rc_bittree_price(lc->high, LEN_HIGH_BITS, + i - LEN_LOW_SYMBOLS - LEN_MID_SYMBOLS); + + return; +} + + +static inline void +length(lzma_range_encoder *rc, lzma_length_encoder *lc, + const uint32_t pos_state, uint32_t len, const bool fast_mode) +{ + assert(len <= MATCH_LEN_MAX); + len -= MATCH_LEN_MIN; + + if (len < LEN_LOW_SYMBOLS) { + rc_bit(rc, &lc->choice, 0); + rc_bittree(rc, lc->low[pos_state], LEN_LOW_BITS, len); + } else { + rc_bit(rc, &lc->choice, 1); + len -= LEN_LOW_SYMBOLS; + + if (len < LEN_MID_SYMBOLS) { + rc_bit(rc, &lc->choice2, 0); + rc_bittree(rc, lc->mid[pos_state], LEN_MID_BITS, len); + } else { + rc_bit(rc, &lc->choice2, 1); + len -= LEN_MID_SYMBOLS; + rc_bittree(rc, lc->high, LEN_HIGH_BITS, len); + } + } + + // Only getoptimum uses the prices so don't update the table when + // in fast mode. + if (!fast_mode) + if (--lc->counters[pos_state] == 0) + length_update_prices(lc, pos_state); +} + + +/////////// +// Match // +/////////// + +static inline void +match(lzma_coder *coder, const uint32_t pos_state, + const uint32_t distance, const uint32_t len) +{ + update_match(coder->state); + + length(&coder->rc, &coder->match_len_encoder, pos_state, len, + coder->fast_mode); + + const uint32_t pos_slot = get_pos_slot(distance); + const uint32_t len_to_pos_state = get_len_to_pos_state(len); + rc_bittree(&coder->rc, coder->pos_slot[len_to_pos_state], + POS_SLOT_BITS, pos_slot); + + if (pos_slot >= START_POS_MODEL_INDEX) { + const uint32_t footer_bits = (pos_slot >> 1) - 1; + const uint32_t base = (2 | (pos_slot & 1)) << footer_bits; + const uint32_t pos_reduced = distance - base; + + if (pos_slot < END_POS_MODEL_INDEX) { + // Careful here: base - pos_slot - 1 can be -1, but + // rc_bittree_reverse starts at probs[1], not probs[0]. + rc_bittree_reverse(&coder->rc, + coder->pos_special + base - pos_slot - 1, + footer_bits, pos_reduced); + } else { + rc_direct(&coder->rc, pos_reduced >> ALIGN_BITS, + footer_bits - ALIGN_BITS); + rc_bittree_reverse( + &coder->rc, coder->pos_align, + ALIGN_BITS, pos_reduced & ALIGN_MASK); + ++coder->align_price_count; + } + } + + coder->reps[3] = coder->reps[2]; + coder->reps[2] = coder->reps[1]; + coder->reps[1] = coder->reps[0]; + coder->reps[0] = distance; + ++coder->match_price_count; +} + + +//////////////////// +// Repeated match // +//////////////////// + +static inline void +rep_match(lzma_coder *coder, const uint32_t pos_state, + const uint32_t rep, const uint32_t len) +{ + if (rep == 0) { + rc_bit(&coder->rc, &coder->is_rep0[coder->state], 0); + rc_bit(&coder->rc, + &coder->is_rep0_long[coder->state][pos_state], + len != 1); + } else { + const uint32_t distance = coder->reps[rep]; + rc_bit(&coder->rc, &coder->is_rep0[coder->state], 1); + + if (rep == 1) { + rc_bit(&coder->rc, &coder->is_rep1[coder->state], 0); + } else { + rc_bit(&coder->rc, &coder->is_rep1[coder->state], 1); + rc_bit(&coder->rc, &coder->is_rep2[coder->state], + rep - 2); + + if (rep == 3) + coder->reps[3] = coder->reps[2]; + + coder->reps[2] = coder->reps[1]; + } + + coder->reps[1] = coder->reps[0]; + coder->reps[0] = distance; + } + + if (len == 1) { + update_short_rep(coder->state); + } else { + length(&coder->rc, &coder->rep_len_encoder, pos_state, len, + coder->fast_mode); + update_long_rep(coder->state); + } +} + + +////////// +// Main // +////////// + +static void +encode_symbol(lzma_coder *coder, lzma_mf *mf, + uint32_t back, uint32_t len, uint32_t position) +{ + const uint32_t pos_state = position & coder->pos_mask; + + if (back == UINT32_MAX) { + // Literal i.e. eight-bit byte + assert(len == 1); + rc_bit(&coder->rc, + &coder->is_match[coder->state][pos_state], 0); + literal(coder, mf, position); + } else { + // Some type of match + rc_bit(&coder->rc, + &coder->is_match[coder->state][pos_state], 1); + + if (back < REP_DISTANCES) { + // It's a repeated match i.e. the same distance + // has been used earlier. + rc_bit(&coder->rc, &coder->is_rep[coder->state], 1); + rep_match(coder, pos_state, back, len); + } else { + // Normal match + rc_bit(&coder->rc, &coder->is_rep[coder->state], 0); + match(coder, pos_state, back - REP_DISTANCES, len); + } + } + + assert(mf->read_ahead >= len); + mf->read_ahead -= len; +} + + +static bool +encode_init(lzma_coder *coder, lzma_mf *mf) +{ + assert(mf_position(mf) == 0); + + if (mf->read_pos == mf->read_limit) { + if (mf->action == LZMA_RUN) + return false; // We cannot do anything. + + // We are finishing (we cannot get here when flushing). + assert(mf->write_pos == mf->read_pos); + assert(mf->action == LZMA_FINISH); + } else { + // Do the actual initialization. The first LZMA symbol must + // always be a literal. + mf_skip(mf, 1); + mf->read_ahead = 0; + rc_bit(&coder->rc, &coder->is_match[0][0], 0); + rc_bittree(&coder->rc, coder->literal[0], 8, mf->buffer[0]); + } + + // Initialization is done (except if empty file). + coder->is_initialized = true; + + return true; +} + + +static void +encode_eopm(lzma_coder *coder, uint32_t position) +{ + const uint32_t pos_state = position & coder->pos_mask; + rc_bit(&coder->rc, &coder->is_match[coder->state][pos_state], 1); + rc_bit(&coder->rc, &coder->is_rep[coder->state], 0); + match(coder, pos_state, UINT32_MAX, MATCH_LEN_MIN); +} + + +/// Number of bytes that a single encoding loop in lzma_lzma_encode() can +/// consume from the dictionary. This limit comes from lzma_lzma_optimum() +/// and may need to be updated if that function is significantly modified. +#define LOOP_INPUT_MAX (OPTS + 1) + + +extern lzma_ret +lzma_lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, + uint8_t *restrict out, size_t *restrict out_pos, + size_t out_size, uint32_t limit) +{ + // Initialize the stream if no data has been encoded yet. + if (!coder->is_initialized && !encode_init(coder, mf)) + return LZMA_OK; + + // Get the lowest bits of the uncompressed offset from the LZ layer. + uint32_t position = mf_position(mf); + + while (true) { + // Encode pending bits, if any. Calling this before encoding + // the next symbol is needed only with plain LZMA, since + // LZMA2 always provides big enough buffer to flush + // everything out from the range encoder. For the same reason, + // rc_encode() never returns true when this function is used + // as part of LZMA2 encoder. + if (rc_encode(&coder->rc, out, out_pos, out_size)) { + assert(limit == UINT32_MAX); + return LZMA_OK; + } + + // With LZMA2 we need to take care that compressed size of + // a chunk doesn't get too big. + // FIXME? Check if this could be improved. + if (limit != UINT32_MAX + && (mf->read_pos - mf->read_ahead >= limit + || *out_pos + rc_pending(&coder->rc) + >= LZMA2_CHUNK_MAX + - LOOP_INPUT_MAX)) + break; + + // Check that there is some input to process. + if (mf->read_pos >= mf->read_limit) { + if (mf->action == LZMA_RUN) + return LZMA_OK; + + if (mf->read_ahead == 0) + break; + } + + // Get optimal match (repeat position and length). + // Value ranges for pos: + // - [0, REP_DISTANCES): repeated match + // - [REP_DISTANCES, UINT32_MAX): + // match at (pos - REP_DISTANCES) + // - UINT32_MAX: not a match but a literal + // Value ranges for len: + // - [MATCH_LEN_MIN, MATCH_LEN_MAX] + uint32_t len; + uint32_t back; + + if (coder->fast_mode) + lzma_lzma_optimum_fast(coder, mf, &back, &len); + else + lzma_lzma_optimum_normal( + coder, mf, &back, &len, position); + + encode_symbol(coder, mf, back, len, position); + + position += len; + } + + if (!coder->is_flushed) { + coder->is_flushed = true; + + // We don't support encoding plain LZMA streams without EOPM, + // and LZMA2 doesn't use EOPM at LZMA level. + if (limit == UINT32_MAX) + encode_eopm(coder, position); + + // Flush the remaining bytes from the range encoder. + rc_flush(&coder->rc); + + // Copy the remaining bytes to the output buffer. If there + // isn't enough output space, we will copy out the remaining + // bytes on the next call to this function by using + // the rc_encode() call in the encoding loop above. + if (rc_encode(&coder->rc, out, out_pos, out_size)) { + assert(limit == UINT32_MAX); + return LZMA_OK; + } + } + + // Make it ready for the next LZMA2 chunk. + coder->is_flushed = false; + + return LZMA_STREAM_END; +} + + +static lzma_ret +lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, + uint8_t *restrict out, size_t *restrict out_pos, + size_t out_size) +{ + // Plain LZMA has no support for sync-flushing. + if (unlikely(mf->action == LZMA_SYNC_FLUSH)) + return LZMA_OPTIONS_ERROR; + + return lzma_lzma_encode(coder, mf, out, out_pos, out_size, UINT32_MAX); +} + + +//////////////////// +// Initialization // +//////////////////// + +static bool +is_options_valid(const lzma_options_lzma *options) +{ + // Validate some of the options. LZ encoder validates nice_len too + // but we need a valid value here earlier. + return is_lclppb_valid(options) + && options->nice_len >= MATCH_LEN_MIN + && options->nice_len <= MATCH_LEN_MAX + && (options->mode == LZMA_MODE_FAST + || options->mode == LZMA_MODE_NORMAL); +} + + +static void +set_lz_options(lzma_lz_options *lz_options, const lzma_options_lzma *options) +{ + // LZ encoder initialization does the validation for these so we + // don't need to validate here. + lz_options->before_size = OPTS; + lz_options->dict_size = options->dict_size; + lz_options->after_size = LOOP_INPUT_MAX; + lz_options->match_len_max = MATCH_LEN_MAX; + lz_options->nice_len = options->nice_len; + lz_options->match_finder = options->mf; + lz_options->depth = options->depth; + lz_options->preset_dict = options->preset_dict; + lz_options->preset_dict_size = options->preset_dict_size; + return; +} + + +static void +length_encoder_reset(lzma_length_encoder *lencoder, + const uint32_t num_pos_states, const bool fast_mode) +{ + bit_reset(lencoder->choice); + bit_reset(lencoder->choice2); + + for (size_t pos_state = 0; pos_state < num_pos_states; ++pos_state) { + bittree_reset(lencoder->low[pos_state], LEN_LOW_BITS); + bittree_reset(lencoder->mid[pos_state], LEN_MID_BITS); + } + + bittree_reset(lencoder->high, LEN_HIGH_BITS); + + if (!fast_mode) + for (size_t pos_state = 0; pos_state < num_pos_states; + ++pos_state) + length_update_prices(lencoder, pos_state); + + return; +} + + +extern lzma_ret +lzma_lzma_encoder_reset(lzma_coder *coder, const lzma_options_lzma *options) +{ + if (!is_options_valid(options)) + return LZMA_OPTIONS_ERROR; + + coder->pos_mask = (1U << options->pb) - 1; + coder->literal_context_bits = options->lc; + coder->literal_pos_mask = (1U << options->lp) - 1; + + // Range coder + rc_reset(&coder->rc); + + // State + coder->state = STATE_LIT_LIT; + for (size_t i = 0; i < REP_DISTANCES; ++i) + coder->reps[i] = 0; + + literal_init(coder->literal, options->lc, options->lp); + + // Bit encoders + for (size_t i = 0; i < STATES; ++i) { + for (size_t j = 0; j <= coder->pos_mask; ++j) { + bit_reset(coder->is_match[i][j]); + bit_reset(coder->is_rep0_long[i][j]); + } + + bit_reset(coder->is_rep[i]); + bit_reset(coder->is_rep0[i]); + bit_reset(coder->is_rep1[i]); + bit_reset(coder->is_rep2[i]); + } + + for (size_t i = 0; i < FULL_DISTANCES - END_POS_MODEL_INDEX; ++i) + bit_reset(coder->pos_special[i]); + + // Bit tree encoders + for (size_t i = 0; i < LEN_TO_POS_STATES; ++i) + bittree_reset(coder->pos_slot[i], POS_SLOT_BITS); + + bittree_reset(coder->pos_align, ALIGN_BITS); + + // Length encoders + length_encoder_reset(&coder->match_len_encoder, + 1U << options->pb, coder->fast_mode); + + length_encoder_reset(&coder->rep_len_encoder, + 1U << options->pb, coder->fast_mode); + + // Price counts are incremented every time appropriate probabilities + // are changed. price counts are set to zero when the price tables + // are updated, which is done when the appropriate price counts have + // big enough value, and lzma_mf.read_ahead == 0 which happens at + // least every OPTS (a few thousand) possible price count increments. + // + // By resetting price counts to UINT32_MAX / 2, we make sure that the + // price tables will be initialized before they will be used (since + // the value is definitely big enough), and that it is OK to increment + // price counts without risk of integer overflow (since UINT32_MAX / 2 + // is small enough). The current code doesn't increment price counts + // before initializing price tables, but it maybe done in future if + // we add support for saving the state between LZMA2 chunks. + coder->match_price_count = UINT32_MAX / 2; + coder->align_price_count = UINT32_MAX / 2; + + coder->opts_end_index = 0; + coder->opts_current_index = 0; + + return LZMA_OK; +} + + +extern lzma_ret +lzma_lzma_encoder_create(lzma_coder **coder_ptr, lzma_allocator *allocator, + const lzma_options_lzma *options, lzma_lz_options *lz_options) +{ + // Allocate lzma_coder if it wasn't already allocated. + if (*coder_ptr == NULL) { + *coder_ptr = lzma_alloc(sizeof(lzma_coder), allocator); + if (*coder_ptr == NULL) + return LZMA_MEM_ERROR; + } + + lzma_coder *coder = *coder_ptr; + + // Set compression mode. We haven't validates the options yet, + // but it's OK here, since nothing bad happens with invalid + // options in the code below, and they will get rejected by + // lzma_lzma_encoder_reset() call at the end of this function. + switch (options->mode) { + case LZMA_MODE_FAST: + coder->fast_mode = true; + break; + + case LZMA_MODE_NORMAL: { + coder->fast_mode = false; + + // Set dist_table_size. + // Round the dictionary size up to next 2^n. + uint32_t log_size = 0; + while ((UINT32_C(1) << log_size) < options->dict_size) + ++log_size; + + coder->dist_table_size = log_size * 2; + + // Length encoders' price table size + coder->match_len_encoder.table_size + = options->nice_len + 1 - MATCH_LEN_MIN; + coder->rep_len_encoder.table_size + = options->nice_len + 1 - MATCH_LEN_MIN; + break; + } + + default: + return LZMA_OPTIONS_ERROR; + } + + // We don't need to write the first byte as literal if there is + // a non-empty preset dictionary. encode_init() wouldn't even work + // if there is a non-empty preset dictionary, because encode_init() + // assumes that position is zero and previous byte is also zero. + coder->is_initialized = options->preset_dict != NULL + && options->preset_dict_size > 0; + coder->is_flushed = false; + + set_lz_options(lz_options, options); + + return lzma_lzma_encoder_reset(coder, options); +} + + +static lzma_ret +lzma_encoder_init(lzma_lz_encoder *lz, lzma_allocator *allocator, + const void *options, lzma_lz_options *lz_options) +{ + lz->code = &lzma_encode; + return lzma_lzma_encoder_create( + &lz->coder, allocator, options, lz_options); +} + + +extern lzma_ret +lzma_lzma_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters) +{ + return lzma_lz_encoder_init( + next, allocator, filters, &lzma_encoder_init); +} + + +extern uint64_t +lzma_lzma_encoder_memusage(const void *options) +{ + if (!is_options_valid(options)) + return UINT64_MAX; + + lzma_lz_options lz_options; + set_lz_options(&lz_options, options); + + const uint64_t lz_memusage = lzma_lz_encoder_memusage(&lz_options); + if (lz_memusage == UINT64_MAX) + return UINT64_MAX; + + return (uint64_t)(sizeof(lzma_coder)) + lz_memusage; +} + + +extern bool +lzma_lzma_lclppb_encode(const lzma_options_lzma *options, uint8_t *byte) +{ + if (!is_lclppb_valid(options)) + return true; + + *byte = (options->pb * 5 + options->lp) * 9 + options->lc; + assert(*byte <= (4 * 5 + 4) * 9 + 8); + + return false; +} + + +#ifdef HAVE_ENCODER_LZMA1 +extern lzma_ret +lzma_lzma_props_encode(const void *options, uint8_t *out) +{ + const lzma_options_lzma *const opt = options; + + if (lzma_lzma_lclppb_encode(opt, out)) + return LZMA_PROG_ERROR; + + unaligned_write32le(out + 1, opt->dict_size); + + return LZMA_OK; +} +#endif + + +extern LZMA_API(lzma_bool) +lzma_mode_is_supported(lzma_mode mode) +{ + return mode == LZMA_MODE_FAST || mode == LZMA_MODE_NORMAL; +} diff --git a/liblzma/lzma/lzma_encoder.h b/liblzma/lzma/lzma_encoder.h new file mode 100644 index 0000000..835e1f5 --- /dev/null +++ b/liblzma/lzma/lzma_encoder.h @@ -0,0 +1,54 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lzma_encoder.h +/// \brief LZMA encoder API +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_LZMA_ENCODER_H +#define LZMA_LZMA_ENCODER_H + +#include "common.h" + + +extern lzma_ret lzma_lzma_encoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + + +extern uint64_t lzma_lzma_encoder_memusage(const void *options); + +extern lzma_ret lzma_lzma_props_encode(const void *options, uint8_t *out); + + +/// Encodes lc/lp/pb into one byte. Returns false on success and true on error. +extern bool lzma_lzma_lclppb_encode( + const lzma_options_lzma *options, uint8_t *byte); + + +#ifdef LZMA_LZ_ENCODER_H + +/// Initializes raw LZMA encoder; this is used by LZMA2. +extern lzma_ret lzma_lzma_encoder_create( + lzma_coder **coder_ptr, lzma_allocator *allocator, + const lzma_options_lzma *options, lzma_lz_options *lz_options); + + +/// Resets an already initialized LZMA encoder; this is used by LZMA2. +extern lzma_ret lzma_lzma_encoder_reset( + lzma_coder *coder, const lzma_options_lzma *options); + + +extern lzma_ret lzma_lzma_encode(lzma_coder *restrict coder, + lzma_mf *restrict mf, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size, + uint32_t read_limit); + +#endif + +#endif diff --git a/liblzma/lzma/lzma_encoder_optimum_fast.c b/liblzma/lzma/lzma_encoder_optimum_fast.c new file mode 100644 index 0000000..f835f69 --- /dev/null +++ b/liblzma/lzma/lzma_encoder_optimum_fast.c @@ -0,0 +1,179 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lzma_encoder_optimum_fast.c +// +// Author: Igor Pavlov +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "lzma_encoder_private.h" + + +#define change_pair(small_dist, big_dist) \ + (((big_dist) >> 7) > (small_dist)) + + +extern void +lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, + uint32_t *restrict back_res, uint32_t *restrict len_res) +{ + const uint32_t nice_len = mf->nice_len; + + uint32_t len_main; + uint32_t matches_count; + if (mf->read_ahead == 0) { + len_main = mf_find(mf, &matches_count, coder->matches); + } else { + assert(mf->read_ahead == 1); + len_main = coder->longest_match_length; + matches_count = coder->matches_count; + } + + const uint8_t *buf = mf_ptr(mf) - 1; + const uint32_t buf_avail = my_min(mf_avail(mf) + 1, MATCH_LEN_MAX); + + if (buf_avail < 2) { + // There's not enough input left to encode a match. + *back_res = UINT32_MAX; + *len_res = 1; + return; + } + + // Look for repeated matches; scan the previous four match distances + uint32_t rep_len = 0; + uint32_t rep_index = 0; + + for (uint32_t i = 0; i < REP_DISTANCES; ++i) { + // Pointer to the beginning of the match candidate + const uint8_t *const buf_back = buf - coder->reps[i] - 1; + + // If the first two bytes (2 == MATCH_LEN_MIN) do not match, + // this rep is not useful. + if (not_equal_16(buf, buf_back)) + continue; + + // The first two bytes matched. + // Calculate the length of the match. + uint32_t len; + for (len = 2; len < buf_avail + && buf[len] == buf_back[len]; ++len) ; + + // If we have found a repeated match that is at least + // nice_len long, return it immediately. + if (len >= nice_len) { + *back_res = i; + *len_res = len; + mf_skip(mf, len - 1); + return; + } + + if (len > rep_len) { + rep_index = i; + rep_len = len; + } + } + + // We didn't find a long enough repeated match. Encode it as a normal + // match if the match length is at least nice_len. + if (len_main >= nice_len) { + *back_res = coder->matches[matches_count - 1].dist + + REP_DISTANCES; + *len_res = len_main; + mf_skip(mf, len_main - 1); + return; + } + + uint32_t back_main = 0; + if (len_main >= 2) { + back_main = coder->matches[matches_count - 1].dist; + + while (matches_count > 1 && len_main == + coder->matches[matches_count - 2].len + 1) { + if (!change_pair(coder->matches[ + matches_count - 2].dist, + back_main)) + break; + + --matches_count; + len_main = coder->matches[matches_count - 1].len; + back_main = coder->matches[matches_count - 1].dist; + } + + if (len_main == 2 && back_main >= 0x80) + len_main = 1; + } + + if (rep_len >= 2) { + if (rep_len + 1 >= len_main + || (rep_len + 2 >= len_main + && back_main > (UINT32_C(1) << 9)) + || (rep_len + 3 >= len_main + && back_main > (UINT32_C(1) << 15))) { + *back_res = rep_index; + *len_res = rep_len; + mf_skip(mf, rep_len - 1); + return; + } + } + + if (len_main < 2 || buf_avail <= 2) { + *back_res = UINT32_MAX; + *len_res = 1; + return; + } + + // Get the matches for the next byte. If we find a better match, + // the current byte is encoded as a literal. + coder->longest_match_length = mf_find(mf, + &coder->matches_count, coder->matches); + + if (coder->longest_match_length >= 2) { + const uint32_t new_dist = coder->matches[ + coder->matches_count - 1].dist; + + if ((coder->longest_match_length >= len_main + && new_dist < back_main) + || (coder->longest_match_length == len_main + 1 + && !change_pair(back_main, new_dist)) + || (coder->longest_match_length > len_main + 1) + || (coder->longest_match_length + 1 >= len_main + && len_main >= 3 + && change_pair(new_dist, back_main))) { + *back_res = UINT32_MAX; + *len_res = 1; + return; + } + } + + // In contrast to LZMA SDK, dictionary could not have been moved + // between mf_find() calls, thus it is safe to just increment + // the old buf pointer instead of recalculating it with mf_ptr(). + ++buf; + + const uint32_t limit = len_main - 1; + + for (uint32_t i = 0; i < REP_DISTANCES; ++i) { + const uint8_t *const buf_back = buf - coder->reps[i] - 1; + + if (not_equal_16(buf, buf_back)) + continue; + + uint32_t len; + for (len = 2; len < limit + && buf[len] == buf_back[len]; ++len) ; + + if (len >= limit) { + *back_res = UINT32_MAX; + *len_res = 1; + return; + } + } + + *back_res = back_main + REP_DISTANCES; + *len_res = len_main; + mf_skip(mf, len_main - 2); + return; +} diff --git a/liblzma/lzma/lzma_encoder_optimum_normal.c b/liblzma/lzma/lzma_encoder_optimum_normal.c new file mode 100644 index 0000000..7e85649 --- /dev/null +++ b/liblzma/lzma/lzma_encoder_optimum_normal.c @@ -0,0 +1,868 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lzma_encoder_optimum_normal.c +// +// Author: Igor Pavlov +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "lzma_encoder_private.h" +#include "fastpos.h" + + +//////////// +// Prices // +//////////// + +static uint32_t +get_literal_price(const lzma_coder *const coder, const uint32_t pos, + const uint32_t prev_byte, const bool match_mode, + uint32_t match_byte, uint32_t symbol) +{ + const probability *const subcoder = literal_subcoder(coder->literal, + coder->literal_context_bits, coder->literal_pos_mask, + pos, prev_byte); + + uint32_t price = 0; + + if (!match_mode) { + price = rc_bittree_price(subcoder, 8, symbol); + } else { + uint32_t offset = 0x100; + symbol += UINT32_C(1) << 8; + + do { + match_byte <<= 1; + + const uint32_t match_bit = match_byte & offset; + const uint32_t subcoder_index + = offset + match_bit + (symbol >> 8); + const uint32_t bit = (symbol >> 7) & 1; + price += rc_bit_price(subcoder[subcoder_index], bit); + + symbol <<= 1; + offset &= ~(match_byte ^ symbol); + + } while (symbol < (UINT32_C(1) << 16)); + } + + return price; +} + + +static inline uint32_t +get_len_price(const lzma_length_encoder *const lencoder, + const uint32_t len, const uint32_t pos_state) +{ + // NOTE: Unlike the other price tables, length prices are updated + // in lzma_encoder.c + return lencoder->prices[pos_state][len - MATCH_LEN_MIN]; +} + + +static inline uint32_t +get_short_rep_price(const lzma_coder *const coder, + const lzma_lzma_state state, const uint32_t pos_state) +{ + return rc_bit_0_price(coder->is_rep0[state]) + + rc_bit_0_price(coder->is_rep0_long[state][pos_state]); +} + + +static inline uint32_t +get_pure_rep_price(const lzma_coder *const coder, const uint32_t rep_index, + const lzma_lzma_state state, uint32_t pos_state) +{ + uint32_t price; + + if (rep_index == 0) { + price = rc_bit_0_price(coder->is_rep0[state]); + price += rc_bit_1_price(coder->is_rep0_long[state][pos_state]); + } else { + price = rc_bit_1_price(coder->is_rep0[state]); + + if (rep_index == 1) { + price += rc_bit_0_price(coder->is_rep1[state]); + } else { + price += rc_bit_1_price(coder->is_rep1[state]); + price += rc_bit_price(coder->is_rep2[state], + rep_index - 2); + } + } + + return price; +} + + +static inline uint32_t +get_rep_price(const lzma_coder *const coder, const uint32_t rep_index, + const uint32_t len, const lzma_lzma_state state, + const uint32_t pos_state) +{ + return get_len_price(&coder->rep_len_encoder, len, pos_state) + + get_pure_rep_price(coder, rep_index, state, pos_state); +} + + +static inline uint32_t +get_pos_len_price(const lzma_coder *const coder, const uint32_t pos, + const uint32_t len, const uint32_t pos_state) +{ + const uint32_t len_to_pos_state = get_len_to_pos_state(len); + uint32_t price; + + if (pos < FULL_DISTANCES) { + price = coder->distances_prices[len_to_pos_state][pos]; + } else { + const uint32_t pos_slot = get_pos_slot_2(pos); + price = coder->pos_slot_prices[len_to_pos_state][pos_slot] + + coder->align_prices[pos & ALIGN_MASK]; + } + + price += get_len_price(&coder->match_len_encoder, len, pos_state); + + return price; +} + + +static void +fill_distances_prices(lzma_coder *coder) +{ + for (uint32_t len_to_pos_state = 0; + len_to_pos_state < LEN_TO_POS_STATES; + ++len_to_pos_state) { + + uint32_t *const pos_slot_prices + = coder->pos_slot_prices[len_to_pos_state]; + + // Price to encode the pos_slot. + for (uint32_t pos_slot = 0; + pos_slot < coder->dist_table_size; ++pos_slot) + pos_slot_prices[pos_slot] = rc_bittree_price( + coder->pos_slot[len_to_pos_state], + POS_SLOT_BITS, pos_slot); + + // For matches with distance >= FULL_DISTANCES, add the price + // of the direct bits part of the match distance. (Align bits + // are handled by fill_align_prices()). + for (uint32_t pos_slot = END_POS_MODEL_INDEX; + pos_slot < coder->dist_table_size; ++pos_slot) + pos_slot_prices[pos_slot] += rc_direct_price( + ((pos_slot >> 1) - 1) - ALIGN_BITS); + + // Distances in the range [0, 3] are fully encoded with + // pos_slot, so they are used for coder->distances_prices + // as is. + for (uint32_t i = 0; i < START_POS_MODEL_INDEX; ++i) + coder->distances_prices[len_to_pos_state][i] + = pos_slot_prices[i]; + } + + // Distances in the range [4, 127] depend on pos_slot and pos_special. + // We do this in a loop separate from the above loop to avoid + // redundant calls to get_pos_slot(). + for (uint32_t i = START_POS_MODEL_INDEX; i < FULL_DISTANCES; ++i) { + const uint32_t pos_slot = get_pos_slot(i); + const uint32_t footer_bits = ((pos_slot >> 1) - 1); + const uint32_t base = (2 | (pos_slot & 1)) << footer_bits; + const uint32_t price = rc_bittree_reverse_price( + coder->pos_special + base - pos_slot - 1, + footer_bits, i - base); + + for (uint32_t len_to_pos_state = 0; + len_to_pos_state < LEN_TO_POS_STATES; + ++len_to_pos_state) + coder->distances_prices[len_to_pos_state][i] + = price + coder->pos_slot_prices[ + len_to_pos_state][pos_slot]; + } + + coder->match_price_count = 0; + return; +} + + +static void +fill_align_prices(lzma_coder *coder) +{ + for (uint32_t i = 0; i < ALIGN_TABLE_SIZE; ++i) + coder->align_prices[i] = rc_bittree_reverse_price( + coder->pos_align, ALIGN_BITS, i); + + coder->align_price_count = 0; + return; +} + + +///////////// +// Optimal // +///////////// + +static inline void +make_literal(lzma_optimal *optimal) +{ + optimal->back_prev = UINT32_MAX; + optimal->prev_1_is_literal = false; +} + + +static inline void +make_short_rep(lzma_optimal *optimal) +{ + optimal->back_prev = 0; + optimal->prev_1_is_literal = false; +} + + +#define is_short_rep(optimal) \ + ((optimal).back_prev == 0) + + +static void +backward(lzma_coder *restrict coder, uint32_t *restrict len_res, + uint32_t *restrict back_res, uint32_t cur) +{ + coder->opts_end_index = cur; + + uint32_t pos_mem = coder->opts[cur].pos_prev; + uint32_t back_mem = coder->opts[cur].back_prev; + + do { + if (coder->opts[cur].prev_1_is_literal) { + make_literal(&coder->opts[pos_mem]); + coder->opts[pos_mem].pos_prev = pos_mem - 1; + + if (coder->opts[cur].prev_2) { + coder->opts[pos_mem - 1].prev_1_is_literal + = false; + coder->opts[pos_mem - 1].pos_prev + = coder->opts[cur].pos_prev_2; + coder->opts[pos_mem - 1].back_prev + = coder->opts[cur].back_prev_2; + } + } + + const uint32_t pos_prev = pos_mem; + const uint32_t back_cur = back_mem; + + back_mem = coder->opts[pos_prev].back_prev; + pos_mem = coder->opts[pos_prev].pos_prev; + + coder->opts[pos_prev].back_prev = back_cur; + coder->opts[pos_prev].pos_prev = cur; + cur = pos_prev; + + } while (cur != 0); + + coder->opts_current_index = coder->opts[0].pos_prev; + *len_res = coder->opts[0].pos_prev; + *back_res = coder->opts[0].back_prev; + + return; +} + + +////////// +// Main // +////////// + +static inline uint32_t +helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, + uint32_t *restrict back_res, uint32_t *restrict len_res, + uint32_t position) +{ + const uint32_t nice_len = mf->nice_len; + + uint32_t len_main; + uint32_t matches_count; + + if (mf->read_ahead == 0) { + len_main = mf_find(mf, &matches_count, coder->matches); + } else { + assert(mf->read_ahead == 1); + len_main = coder->longest_match_length; + matches_count = coder->matches_count; + } + + const uint32_t buf_avail = my_min(mf_avail(mf) + 1, MATCH_LEN_MAX); + if (buf_avail < 2) { + *back_res = UINT32_MAX; + *len_res = 1; + return UINT32_MAX; + } + + const uint8_t *const buf = mf_ptr(mf) - 1; + + uint32_t rep_lens[REP_DISTANCES]; + uint32_t rep_max_index = 0; + + for (uint32_t i = 0; i < REP_DISTANCES; ++i) { + const uint8_t *const buf_back = buf - coder->reps[i] - 1; + + if (not_equal_16(buf, buf_back)) { + rep_lens[i] = 0; + continue; + } + + uint32_t len_test; + for (len_test = 2; len_test < buf_avail + && buf[len_test] == buf_back[len_test]; + ++len_test) ; + + rep_lens[i] = len_test; + if (len_test > rep_lens[rep_max_index]) + rep_max_index = i; + } + + if (rep_lens[rep_max_index] >= nice_len) { + *back_res = rep_max_index; + *len_res = rep_lens[rep_max_index]; + mf_skip(mf, *len_res - 1); + return UINT32_MAX; + } + + + if (len_main >= nice_len) { + *back_res = coder->matches[matches_count - 1].dist + + REP_DISTANCES; + *len_res = len_main; + mf_skip(mf, len_main - 1); + return UINT32_MAX; + } + + const uint8_t current_byte = *buf; + const uint8_t match_byte = *(buf - coder->reps[0] - 1); + + if (len_main < 2 && current_byte != match_byte + && rep_lens[rep_max_index] < 2) { + *back_res = UINT32_MAX; + *len_res = 1; + return UINT32_MAX; + } + + coder->opts[0].state = coder->state; + + const uint32_t pos_state = position & coder->pos_mask; + + coder->opts[1].price = rc_bit_0_price( + coder->is_match[coder->state][pos_state]) + + get_literal_price(coder, position, buf[-1], + !is_literal_state(coder->state), + match_byte, current_byte); + + make_literal(&coder->opts[1]); + + const uint32_t match_price = rc_bit_1_price( + coder->is_match[coder->state][pos_state]); + const uint32_t rep_match_price = match_price + + rc_bit_1_price(coder->is_rep[coder->state]); + + if (match_byte == current_byte) { + const uint32_t short_rep_price = rep_match_price + + get_short_rep_price( + coder, coder->state, pos_state); + + if (short_rep_price < coder->opts[1].price) { + coder->opts[1].price = short_rep_price; + make_short_rep(&coder->opts[1]); + } + } + + const uint32_t len_end = my_max(len_main, rep_lens[rep_max_index]); + + if (len_end < 2) { + *back_res = coder->opts[1].back_prev; + *len_res = 1; + return UINT32_MAX; + } + + coder->opts[1].pos_prev = 0; + + for (uint32_t i = 0; i < REP_DISTANCES; ++i) + coder->opts[0].backs[i] = coder->reps[i]; + + uint32_t len = len_end; + do { + coder->opts[len].price = RC_INFINITY_PRICE; + } while (--len >= 2); + + + for (uint32_t i = 0; i < REP_DISTANCES; ++i) { + uint32_t rep_len = rep_lens[i]; + if (rep_len < 2) + continue; + + const uint32_t price = rep_match_price + get_pure_rep_price( + coder, i, coder->state, pos_state); + + do { + const uint32_t cur_and_len_price = price + + get_len_price( + &coder->rep_len_encoder, + rep_len, pos_state); + + if (cur_and_len_price < coder->opts[rep_len].price) { + coder->opts[rep_len].price = cur_and_len_price; + coder->opts[rep_len].pos_prev = 0; + coder->opts[rep_len].back_prev = i; + coder->opts[rep_len].prev_1_is_literal = false; + } + } while (--rep_len >= 2); + } + + + const uint32_t normal_match_price = match_price + + rc_bit_0_price(coder->is_rep[coder->state]); + + len = rep_lens[0] >= 2 ? rep_lens[0] + 1 : 2; + if (len <= len_main) { + uint32_t i = 0; + while (len > coder->matches[i].len) + ++i; + + for(; ; ++len) { + const uint32_t dist = coder->matches[i].dist; + const uint32_t cur_and_len_price = normal_match_price + + get_pos_len_price(coder, + dist, len, pos_state); + + if (cur_and_len_price < coder->opts[len].price) { + coder->opts[len].price = cur_and_len_price; + coder->opts[len].pos_prev = 0; + coder->opts[len].back_prev + = dist + REP_DISTANCES; + coder->opts[len].prev_1_is_literal = false; + } + + if (len == coder->matches[i].len) + if (++i == matches_count) + break; + } + } + + return len_end; +} + + +static inline uint32_t +helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, + uint32_t len_end, uint32_t position, const uint32_t cur, + const uint32_t nice_len, const uint32_t buf_avail_full) +{ + uint32_t matches_count = coder->matches_count; + uint32_t new_len = coder->longest_match_length; + uint32_t pos_prev = coder->opts[cur].pos_prev; + lzma_lzma_state state; + + if (coder->opts[cur].prev_1_is_literal) { + --pos_prev; + + if (coder->opts[cur].prev_2) { + state = coder->opts[coder->opts[cur].pos_prev_2].state; + + if (coder->opts[cur].back_prev_2 < REP_DISTANCES) + update_long_rep(state); + else + update_match(state); + + } else { + state = coder->opts[pos_prev].state; + } + + update_literal(state); + + } else { + state = coder->opts[pos_prev].state; + } + + if (pos_prev == cur - 1) { + if (is_short_rep(coder->opts[cur])) + update_short_rep(state); + else + update_literal(state); + } else { + uint32_t pos; + if (coder->opts[cur].prev_1_is_literal + && coder->opts[cur].prev_2) { + pos_prev = coder->opts[cur].pos_prev_2; + pos = coder->opts[cur].back_prev_2; + update_long_rep(state); + } else { + pos = coder->opts[cur].back_prev; + if (pos < REP_DISTANCES) + update_long_rep(state); + else + update_match(state); + } + + if (pos < REP_DISTANCES) { + reps[0] = coder->opts[pos_prev].backs[pos]; + + uint32_t i; + for (i = 1; i <= pos; ++i) + reps[i] = coder->opts[pos_prev].backs[i - 1]; + + for (; i < REP_DISTANCES; ++i) + reps[i] = coder->opts[pos_prev].backs[i]; + + } else { + reps[0] = pos - REP_DISTANCES; + + for (uint32_t i = 1; i < REP_DISTANCES; ++i) + reps[i] = coder->opts[pos_prev].backs[i - 1]; + } + } + + coder->opts[cur].state = state; + + for (uint32_t i = 0; i < REP_DISTANCES; ++i) + coder->opts[cur].backs[i] = reps[i]; + + const uint32_t cur_price = coder->opts[cur].price; + + const uint8_t current_byte = *buf; + const uint8_t match_byte = *(buf - reps[0] - 1); + + const uint32_t pos_state = position & coder->pos_mask; + + const uint32_t cur_and_1_price = cur_price + + rc_bit_0_price(coder->is_match[state][pos_state]) + + get_literal_price(coder, position, buf[-1], + !is_literal_state(state), match_byte, current_byte); + + bool next_is_literal = false; + + if (cur_and_1_price < coder->opts[cur + 1].price) { + coder->opts[cur + 1].price = cur_and_1_price; + coder->opts[cur + 1].pos_prev = cur; + make_literal(&coder->opts[cur + 1]); + next_is_literal = true; + } + + const uint32_t match_price = cur_price + + rc_bit_1_price(coder->is_match[state][pos_state]); + const uint32_t rep_match_price = match_price + + rc_bit_1_price(coder->is_rep[state]); + + if (match_byte == current_byte + && !(coder->opts[cur + 1].pos_prev < cur + && coder->opts[cur + 1].back_prev == 0)) { + + const uint32_t short_rep_price = rep_match_price + + get_short_rep_price(coder, state, pos_state); + + if (short_rep_price <= coder->opts[cur + 1].price) { + coder->opts[cur + 1].price = short_rep_price; + coder->opts[cur + 1].pos_prev = cur; + make_short_rep(&coder->opts[cur + 1]); + next_is_literal = true; + } + } + + if (buf_avail_full < 2) + return len_end; + + const uint32_t buf_avail = my_min(buf_avail_full, nice_len); + + if (!next_is_literal && match_byte != current_byte) { // speed optimization + // try literal + rep0 + const uint8_t *const buf_back = buf - reps[0] - 1; + const uint32_t limit = my_min(buf_avail_full, nice_len + 1); + + uint32_t len_test = 1; + while (len_test < limit && buf[len_test] == buf_back[len_test]) + ++len_test; + + --len_test; + + if (len_test >= 2) { + lzma_lzma_state state_2 = state; + update_literal(state_2); + + const uint32_t pos_state_next = (position + 1) & coder->pos_mask; + const uint32_t next_rep_match_price = cur_and_1_price + + rc_bit_1_price(coder->is_match[state_2][pos_state_next]) + + rc_bit_1_price(coder->is_rep[state_2]); + + //for (; len_test >= 2; --len_test) { + const uint32_t offset = cur + 1 + len_test; + + while (len_end < offset) + coder->opts[++len_end].price = RC_INFINITY_PRICE; + + const uint32_t cur_and_len_price = next_rep_match_price + + get_rep_price(coder, 0, len_test, + state_2, pos_state_next); + + if (cur_and_len_price < coder->opts[offset].price) { + coder->opts[offset].price = cur_and_len_price; + coder->opts[offset].pos_prev = cur + 1; + coder->opts[offset].back_prev = 0; + coder->opts[offset].prev_1_is_literal = true; + coder->opts[offset].prev_2 = false; + } + //} + } + } + + + uint32_t start_len = 2; // speed optimization + + for (uint32_t rep_index = 0; rep_index < REP_DISTANCES; ++rep_index) { + const uint8_t *const buf_back = buf - reps[rep_index] - 1; + if (not_equal_16(buf, buf_back)) + continue; + + uint32_t len_test; + for (len_test = 2; len_test < buf_avail + && buf[len_test] == buf_back[len_test]; + ++len_test) ; + + while (len_end < cur + len_test) + coder->opts[++len_end].price = RC_INFINITY_PRICE; + + const uint32_t len_test_temp = len_test; + const uint32_t price = rep_match_price + get_pure_rep_price( + coder, rep_index, state, pos_state); + + do { + const uint32_t cur_and_len_price = price + + get_len_price(&coder->rep_len_encoder, + len_test, pos_state); + + if (cur_and_len_price < coder->opts[cur + len_test].price) { + coder->opts[cur + len_test].price = cur_and_len_price; + coder->opts[cur + len_test].pos_prev = cur; + coder->opts[cur + len_test].back_prev = rep_index; + coder->opts[cur + len_test].prev_1_is_literal = false; + } + } while (--len_test >= 2); + + len_test = len_test_temp; + + if (rep_index == 0) + start_len = len_test + 1; + + + uint32_t len_test_2 = len_test + 1; + const uint32_t limit = my_min(buf_avail_full, + len_test_2 + nice_len); + for (; len_test_2 < limit + && buf[len_test_2] == buf_back[len_test_2]; + ++len_test_2) ; + + len_test_2 -= len_test + 1; + + if (len_test_2 >= 2) { + lzma_lzma_state state_2 = state; + update_long_rep(state_2); + + uint32_t pos_state_next = (position + len_test) & coder->pos_mask; + + const uint32_t cur_and_len_literal_price = price + + get_len_price(&coder->rep_len_encoder, + len_test, pos_state) + + rc_bit_0_price(coder->is_match[state_2][pos_state_next]) + + get_literal_price(coder, position + len_test, + buf[len_test - 1], true, + buf_back[len_test], buf[len_test]); + + update_literal(state_2); + + pos_state_next = (position + len_test + 1) & coder->pos_mask; + + const uint32_t next_rep_match_price = cur_and_len_literal_price + + rc_bit_1_price(coder->is_match[state_2][pos_state_next]) + + rc_bit_1_price(coder->is_rep[state_2]); + + //for(; len_test_2 >= 2; len_test_2--) { + const uint32_t offset = cur + len_test + 1 + len_test_2; + + while (len_end < offset) + coder->opts[++len_end].price = RC_INFINITY_PRICE; + + const uint32_t cur_and_len_price = next_rep_match_price + + get_rep_price(coder, 0, len_test_2, + state_2, pos_state_next); + + if (cur_and_len_price < coder->opts[offset].price) { + coder->opts[offset].price = cur_and_len_price; + coder->opts[offset].pos_prev = cur + len_test + 1; + coder->opts[offset].back_prev = 0; + coder->opts[offset].prev_1_is_literal = true; + coder->opts[offset].prev_2 = true; + coder->opts[offset].pos_prev_2 = cur; + coder->opts[offset].back_prev_2 = rep_index; + } + //} + } + } + + + //for (uint32_t len_test = 2; len_test <= new_len; ++len_test) + if (new_len > buf_avail) { + new_len = buf_avail; + + matches_count = 0; + while (new_len > coder->matches[matches_count].len) + ++matches_count; + + coder->matches[matches_count++].len = new_len; + } + + + if (new_len >= start_len) { + const uint32_t normal_match_price = match_price + + rc_bit_0_price(coder->is_rep[state]); + + while (len_end < cur + new_len) + coder->opts[++len_end].price = RC_INFINITY_PRICE; + + uint32_t i = 0; + while (start_len > coder->matches[i].len) + ++i; + + for (uint32_t len_test = start_len; ; ++len_test) { + const uint32_t cur_back = coder->matches[i].dist; + uint32_t cur_and_len_price = normal_match_price + + get_pos_len_price(coder, + cur_back, len_test, pos_state); + + if (cur_and_len_price < coder->opts[cur + len_test].price) { + coder->opts[cur + len_test].price = cur_and_len_price; + coder->opts[cur + len_test].pos_prev = cur; + coder->opts[cur + len_test].back_prev + = cur_back + REP_DISTANCES; + coder->opts[cur + len_test].prev_1_is_literal = false; + } + + if (len_test == coder->matches[i].len) { + // Try Match + Literal + Rep0 + const uint8_t *const buf_back = buf - cur_back - 1; + uint32_t len_test_2 = len_test + 1; + const uint32_t limit = my_min(buf_avail_full, + len_test_2 + nice_len); + + for (; len_test_2 < limit && + buf[len_test_2] == buf_back[len_test_2]; + ++len_test_2) ; + + len_test_2 -= len_test + 1; + + if (len_test_2 >= 2) { + lzma_lzma_state state_2 = state; + update_match(state_2); + uint32_t pos_state_next + = (position + len_test) & coder->pos_mask; + + const uint32_t cur_and_len_literal_price = cur_and_len_price + + rc_bit_0_price( + coder->is_match[state_2][pos_state_next]) + + get_literal_price(coder, + position + len_test, + buf[len_test - 1], + true, + buf_back[len_test], + buf[len_test]); + + update_literal(state_2); + pos_state_next = (pos_state_next + 1) & coder->pos_mask; + + const uint32_t next_rep_match_price + = cur_and_len_literal_price + + rc_bit_1_price( + coder->is_match[state_2][pos_state_next]) + + rc_bit_1_price(coder->is_rep[state_2]); + + // for(; len_test_2 >= 2; --len_test_2) { + const uint32_t offset = cur + len_test + 1 + len_test_2; + + while (len_end < offset) + coder->opts[++len_end].price = RC_INFINITY_PRICE; + + cur_and_len_price = next_rep_match_price + + get_rep_price(coder, 0, len_test_2, + state_2, pos_state_next); + + if (cur_and_len_price < coder->opts[offset].price) { + coder->opts[offset].price = cur_and_len_price; + coder->opts[offset].pos_prev = cur + len_test + 1; + coder->opts[offset].back_prev = 0; + coder->opts[offset].prev_1_is_literal = true; + coder->opts[offset].prev_2 = true; + coder->opts[offset].pos_prev_2 = cur; + coder->opts[offset].back_prev_2 + = cur_back + REP_DISTANCES; + } + //} + } + + if (++i == matches_count) + break; + } + } + } + + return len_end; +} + + +extern void +lzma_lzma_optimum_normal(lzma_coder *restrict coder, lzma_mf *restrict mf, + uint32_t *restrict back_res, uint32_t *restrict len_res, + uint32_t position) +{ + // If we have symbols pending, return the next pending symbol. + if (coder->opts_end_index != coder->opts_current_index) { + assert(mf->read_ahead > 0); + *len_res = coder->opts[coder->opts_current_index].pos_prev + - coder->opts_current_index; + *back_res = coder->opts[coder->opts_current_index].back_prev; + coder->opts_current_index = coder->opts[ + coder->opts_current_index].pos_prev; + return; + } + + // Update the price tables. In LZMA SDK <= 4.60 (and possibly later) + // this was done in both initialization function and in the main loop. + // In liblzma they were moved into this single place. + if (mf->read_ahead == 0) { + if (coder->match_price_count >= (1 << 7)) + fill_distances_prices(coder); + + if (coder->align_price_count >= ALIGN_TABLE_SIZE) + fill_align_prices(coder); + } + + // TODO: This needs quite a bit of cleaning still. But splitting + // the original function into two pieces makes it at least a little + // more readable, since those two parts don't share many variables. + + uint32_t len_end = helper1(coder, mf, back_res, len_res, position); + if (len_end == UINT32_MAX) + return; + + uint32_t reps[REP_DISTANCES]; + memcpy(reps, coder->reps, sizeof(reps)); + + uint32_t cur; + for (cur = 1; cur < len_end; ++cur) { + assert(cur < OPTS); + + coder->longest_match_length = mf_find( + mf, &coder->matches_count, coder->matches); + + if (coder->longest_match_length >= mf->nice_len) + break; + + len_end = helper2(coder, reps, mf_ptr(mf) - 1, len_end, + position + cur, cur, mf->nice_len, + my_min(mf_avail(mf) + 1, OPTS - 1 - cur)); + } + + backward(coder, len_res, back_res, cur); + return; +} diff --git a/liblzma/lzma/lzma_encoder_presets.c b/liblzma/lzma/lzma_encoder_presets.c new file mode 100644 index 0000000..21e427a --- /dev/null +++ b/liblzma/lzma/lzma_encoder_presets.c @@ -0,0 +1,61 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lzma_encoder_presets.c +/// \brief Encoder presets +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "common.h" + + +extern LZMA_API(lzma_bool) +lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset) +{ + const uint32_t level = preset & LZMA_PRESET_LEVEL_MASK; + const uint32_t flags = preset & ~LZMA_PRESET_LEVEL_MASK; + const uint32_t supported_flags = LZMA_PRESET_EXTREME; + + if (level > 9 || (flags & ~supported_flags)) + return true; + + options->preset_dict = NULL; + options->preset_dict_size = 0; + + options->lc = LZMA_LC_DEFAULT; + options->lp = LZMA_LP_DEFAULT; + options->pb = LZMA_PB_DEFAULT; + + options->dict_size = UINT32_C(1) << (uint8_t []){ + 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 }[level]; + + if (level <= 3) { + options->mode = LZMA_MODE_FAST; + options->mf = level == 0 ? LZMA_MF_HC3 : LZMA_MF_HC4; + options->nice_len = level <= 1 ? 128 : 273; + options->depth = (uint8_t []){ 4, 8, 24, 48 }[level]; + } else { + options->mode = LZMA_MODE_NORMAL; + options->mf = LZMA_MF_BT4; + options->nice_len = level == 4 ? 16 : level == 5 ? 32 : 64; + options->depth = 0; + } + + if (flags & LZMA_PRESET_EXTREME) { + options->mode = LZMA_MODE_NORMAL; + options->mf = LZMA_MF_BT4; + if (level == 3 || level == 5) { + options->nice_len = 192; + options->depth = 0; + } else { + options->nice_len = 273; + options->depth = 512; + } + } + + return false; +} diff --git a/liblzma/lzma/lzma_encoder_private.h b/liblzma/lzma/lzma_encoder_private.h new file mode 100644 index 0000000..6847452 --- /dev/null +++ b/liblzma/lzma/lzma_encoder_private.h @@ -0,0 +1,148 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file lzma_encoder_private.h +/// \brief Private definitions for LZMA encoder +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_LZMA_ENCODER_PRIVATE_H +#define LZMA_LZMA_ENCODER_PRIVATE_H + +#include "lz_encoder.h" +#include "range_encoder.h" +#include "lzma_common.h" +#include "lzma_encoder.h" + + +// Macro to compare if the first two bytes in two buffers differ. This is +// needed in lzma_lzma_optimum_*() to test if the match is at least +// MATCH_LEN_MIN bytes. Unaligned access gives tiny gain so there's no +// reason to not use it when it is supported. +#ifdef TUKLIB_FAST_UNALIGNED_ACCESS +# define not_equal_16(a, b) \ + (*(const uint16_t *)(a) != *(const uint16_t *)(b)) +#else +# define not_equal_16(a, b) \ + ((a)[0] != (b)[0] || (a)[1] != (b)[1]) +#endif + + +// Optimal - Number of entries in the optimum array. +#define OPTS (1 << 12) + + +typedef struct { + probability choice; + probability choice2; + probability low[POS_STATES_MAX][LEN_LOW_SYMBOLS]; + probability mid[POS_STATES_MAX][LEN_MID_SYMBOLS]; + probability high[LEN_HIGH_SYMBOLS]; + + uint32_t prices[POS_STATES_MAX][LEN_SYMBOLS]; + uint32_t table_size; + uint32_t counters[POS_STATES_MAX]; + +} lzma_length_encoder; + + +typedef struct { + lzma_lzma_state state; + + bool prev_1_is_literal; + bool prev_2; + + uint32_t pos_prev_2; + uint32_t back_prev_2; + + uint32_t price; + uint32_t pos_prev; // pos_next; + uint32_t back_prev; + + uint32_t backs[REP_DISTANCES]; + +} lzma_optimal; + + +struct lzma_coder_s { + /// Range encoder + lzma_range_encoder rc; + + /// State + lzma_lzma_state state; + + /// The four most recent match distances + uint32_t reps[REP_DISTANCES]; + + /// Array of match candidates + lzma_match matches[MATCH_LEN_MAX + 1]; + + /// Number of match candidates in matches[] + uint32_t matches_count; + + /// Variable to hold the length of the longest match between calls + /// to lzma_lzma_optimum_*(). + uint32_t longest_match_length; + + /// True if using getoptimumfast + bool fast_mode; + + /// True if the encoder has been initialized by encoding the first + /// byte as a literal. + bool is_initialized; + + /// True if the range encoder has been flushed, but not all bytes + /// have been written to the output buffer yet. + bool is_flushed; + + uint32_t pos_mask; ///< (1 << pos_bits) - 1 + uint32_t literal_context_bits; + uint32_t literal_pos_mask; + + // These are the same as in lzma_decoder.c. See comments there. + probability literal[LITERAL_CODERS_MAX][LITERAL_CODER_SIZE]; + probability is_match[STATES][POS_STATES_MAX]; + probability is_rep[STATES]; + probability is_rep0[STATES]; + probability is_rep1[STATES]; + probability is_rep2[STATES]; + probability is_rep0_long[STATES][POS_STATES_MAX]; + probability pos_slot[LEN_TO_POS_STATES][POS_SLOTS]; + probability pos_special[FULL_DISTANCES - END_POS_MODEL_INDEX]; + probability pos_align[ALIGN_TABLE_SIZE]; + + // These are the same as in lzma_decoder.c except that the encoders + // include also price tables. + lzma_length_encoder match_len_encoder; + lzma_length_encoder rep_len_encoder; + + // Price tables + uint32_t pos_slot_prices[LEN_TO_POS_STATES][POS_SLOTS]; + uint32_t distances_prices[LEN_TO_POS_STATES][FULL_DISTANCES]; + uint32_t dist_table_size; + uint32_t match_price_count; + + uint32_t align_prices[ALIGN_TABLE_SIZE]; + uint32_t align_price_count; + + // Optimal + uint32_t opts_end_index; + uint32_t opts_current_index; + lzma_optimal opts[OPTS]; +}; + + +extern void lzma_lzma_optimum_fast( + lzma_coder *restrict coder, lzma_mf *restrict mf, + uint32_t *restrict back_res, uint32_t *restrict len_res); + +extern void lzma_lzma_optimum_normal(lzma_coder *restrict coder, + lzma_mf *restrict mf, uint32_t *restrict back_res, + uint32_t *restrict len_res, uint32_t position); + +#endif diff --git a/liblzma/rangecoder/Makefile.inc b/liblzma/rangecoder/Makefile.inc new file mode 100644 index 0000000..d8a597a --- /dev/null +++ b/liblzma/rangecoder/Makefile.inc @@ -0,0 +1,21 @@ +## +## Author: Lasse Collin +## +## This file has been put into the public domain. +## You can do whatever you want with this file. +## + +EXTRA_DIST += rangecoder/price_tablegen.c + +liblzma_la_SOURCES += rangecoder/range_common.h + +if COND_ENCODER_LZMA1 +liblzma_la_SOURCES += \ + rangecoder/range_encoder.h \ + rangecoder/price.h \ + rangecoder/price_table.c +endif + +if COND_DECODER_LZMA1 +liblzma_la_SOURCES += rangecoder/range_decoder.h +endif diff --git a/liblzma/rangecoder/price.h b/liblzma/rangecoder/price.h new file mode 100644 index 0000000..8ae02ca --- /dev/null +++ b/liblzma/rangecoder/price.h @@ -0,0 +1,92 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file price.h +/// \brief Probability price calculation +// +// Author: Igor Pavlov +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_PRICE_H +#define LZMA_PRICE_H + + +#define RC_MOVE_REDUCING_BITS 4 +#define RC_BIT_PRICE_SHIFT_BITS 4 +#define RC_PRICE_TABLE_SIZE (RC_BIT_MODEL_TOTAL >> RC_MOVE_REDUCING_BITS) + +#define RC_INFINITY_PRICE (UINT32_C(1) << 30) + + +/// Lookup table for the inline functions defined in this file. +extern const uint8_t lzma_rc_prices[RC_PRICE_TABLE_SIZE]; + + +static inline uint32_t +rc_bit_price(const probability prob, const uint32_t bit) +{ + return lzma_rc_prices[(prob ^ ((UINT32_C(0) - bit) + & (RC_BIT_MODEL_TOTAL - 1))) >> RC_MOVE_REDUCING_BITS]; +} + + +static inline uint32_t +rc_bit_0_price(const probability prob) +{ + return lzma_rc_prices[prob >> RC_MOVE_REDUCING_BITS]; +} + + +static inline uint32_t +rc_bit_1_price(const probability prob) +{ + return lzma_rc_prices[(prob ^ (RC_BIT_MODEL_TOTAL - 1)) + >> RC_MOVE_REDUCING_BITS]; +} + + +static inline uint32_t +rc_bittree_price(const probability *const probs, + const uint32_t bit_levels, uint32_t symbol) +{ + uint32_t price = 0; + symbol += UINT32_C(1) << bit_levels; + + do { + const uint32_t bit = symbol & 1; + symbol >>= 1; + price += rc_bit_price(probs[symbol], bit); + } while (symbol != 1); + + return price; +} + + +static inline uint32_t +rc_bittree_reverse_price(const probability *const probs, + uint32_t bit_levels, uint32_t symbol) +{ + uint32_t price = 0; + uint32_t model_index = 1; + + do { + const uint32_t bit = symbol & 1; + symbol >>= 1; + price += rc_bit_price(probs[model_index], bit); + model_index = (model_index << 1) + bit; + } while (--bit_levels != 0); + + return price; +} + + +static inline uint32_t +rc_direct_price(const uint32_t bits) +{ + return bits << RC_BIT_PRICE_SHIFT_BITS; +} + +#endif diff --git a/liblzma/rangecoder/price_table.c b/liblzma/rangecoder/price_table.c new file mode 100644 index 0000000..ac64bf6 --- /dev/null +++ b/liblzma/rangecoder/price_table.c @@ -0,0 +1,22 @@ +/* This file has been automatically generated by price_tablegen.c. */ + +#include "range_encoder.h" + +const uint8_t lzma_rc_prices[RC_PRICE_TABLE_SIZE] = { + 128, 103, 91, 84, 78, 73, 69, 66, + 63, 61, 58, 56, 54, 52, 51, 49, + 48, 46, 45, 44, 43, 42, 41, 40, + 39, 38, 37, 36, 35, 34, 34, 33, + 32, 31, 31, 30, 29, 29, 28, 28, + 27, 26, 26, 25, 25, 24, 24, 23, + 23, 22, 22, 22, 21, 21, 20, 20, + 19, 19, 19, 18, 18, 17, 17, 17, + 16, 16, 16, 15, 15, 15, 14, 14, + 14, 13, 13, 13, 12, 12, 12, 11, + 11, 11, 11, 10, 10, 10, 10, 9, + 9, 9, 9, 8, 8, 8, 8, 7, + 7, 7, 7, 6, 6, 6, 6, 5, + 5, 5, 5, 5, 4, 4, 4, 4, + 3, 3, 3, 3, 3, 2, 2, 2, + 2, 2, 2, 1, 1, 1, 1, 1 +}; diff --git a/liblzma/rangecoder/price_tablegen.c b/liblzma/rangecoder/price_tablegen.c new file mode 100644 index 0000000..bf08ce3 --- /dev/null +++ b/liblzma/rangecoder/price_tablegen.c @@ -0,0 +1,87 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file price_tablegen.c +/// \brief Probability price table generator +/// +/// Compiling: gcc -std=c99 -o price_tablegen price_tablegen.c +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include "range_common.h" +#include "price.h" + + +static uint32_t rc_prices[RC_PRICE_TABLE_SIZE]; + + +static void +init_price_table(void) +{ + for (uint32_t i = (UINT32_C(1) << RC_MOVE_REDUCING_BITS) / 2; + i < RC_BIT_MODEL_TOTAL; + i += (UINT32_C(1) << RC_MOVE_REDUCING_BITS)) { + const uint32_t cycles_bits = RC_BIT_PRICE_SHIFT_BITS; + uint32_t w = i; + uint32_t bit_count = 0; + + for (uint32_t j = 0; j < cycles_bits; ++j) { + w *= w; + bit_count <<= 1; + + while (w >= (UINT32_C(1) << 16)) { + w >>= 1; + ++bit_count; + } + } + + rc_prices[i >> RC_MOVE_REDUCING_BITS] + = (RC_BIT_MODEL_TOTAL_BITS << cycles_bits) + - 15 - bit_count; + } + + return; +} + + +static void +print_price_table(void) +{ + printf("/* This file has been automatically generated by " + "price_tablegen.c. */\n\n" + "#include \"range_encoder.h\"\n\n" + "const uint8_t lzma_rc_prices[" + "RC_PRICE_TABLE_SIZE] = {"); + + const size_t array_size = sizeof(lzma_rc_prices) + / sizeof(lzma_rc_prices[0]); + for (size_t i = 0; i < array_size; ++i) { + if (i % 8 == 0) + printf("\n\t"); + + printf("%4" PRIu32, rc_prices[i]); + + if (i != array_size - 1) + printf(","); + } + + printf("\n};\n"); + + return; +} + + +int +main(void) +{ + init_price_table(); + print_price_table(); + return 0; +} diff --git a/liblzma/rangecoder/range_common.h b/liblzma/rangecoder/range_common.h new file mode 100644 index 0000000..0e64241 --- /dev/null +++ b/liblzma/rangecoder/range_common.h @@ -0,0 +1,73 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file range_common.h +/// \brief Common things for range encoder and decoder +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_RANGE_COMMON_H +#define LZMA_RANGE_COMMON_H + +#ifdef HAVE_CONFIG_H +# include "common.h" +#endif + + +/////////////// +// Constants // +/////////////// + +#define RC_SHIFT_BITS 8 +#define RC_TOP_BITS 24 +#define RC_TOP_VALUE (UINT32_C(1) << RC_TOP_BITS) +#define RC_BIT_MODEL_TOTAL_BITS 11 +#define RC_BIT_MODEL_TOTAL (UINT32_C(1) << RC_BIT_MODEL_TOTAL_BITS) +#define RC_MOVE_BITS 5 + + +//////////// +// Macros // +//////////// + +// Resets the probability so that both 0 and 1 have probability of 50 % +#define bit_reset(prob) \ + prob = RC_BIT_MODEL_TOTAL >> 1 + +// This does the same for a complete bit tree. +// (A tree represented as an array.) +#define bittree_reset(probs, bit_levels) \ + for (uint32_t bt_i = 0; bt_i < (1 << (bit_levels)); ++bt_i) \ + bit_reset((probs)[bt_i]) + + +////////////////////// +// Type definitions // +////////////////////// + +/// \brief Type of probabilities used with range coder +/// +/// This needs to be at least 12-bit integer, so uint16_t is a logical choice. +/// However, on some architecture and compiler combinations, a bigger type +/// may give better speed, because the probability variables are accessed +/// a lot. On the other hand, bigger probability type increases cache +/// footprint, since there are 2 to 14 thousand probability variables in +/// LZMA (assuming the limit of lc + lp <= 4; with lc + lp <= 12 there +/// would be about 1.5 million variables). +/// +/// With malicious files, the initialization speed of the LZMA decoder can +/// become important. In that case, smaller probability variables mean that +/// there is less bytes to write to RAM, which makes initialization faster. +/// With big probability type, the initialization can become so slow that it +/// can be a problem e.g. for email servers doing virus scanning. +/// +/// I will be sticking to uint16_t unless some specific architectures +/// are *much* faster (20-50 %) with uint32_t. +typedef uint16_t probability; + +#endif diff --git a/liblzma/rangecoder/range_decoder.h b/liblzma/rangecoder/range_decoder.h new file mode 100644 index 0000000..fb96180 --- /dev/null +++ b/liblzma/rangecoder/range_decoder.h @@ -0,0 +1,179 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file range_decoder.h +/// \brief Range Decoder +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_RANGE_DECODER_H +#define LZMA_RANGE_DECODER_H + +#include "range_common.h" + + +typedef struct { + uint32_t range; + uint32_t code; + uint32_t init_bytes_left; +} lzma_range_decoder; + + +/// Reads the first five bytes to initialize the range decoder. +static inline bool +rc_read_init(lzma_range_decoder *rc, const uint8_t *restrict in, + size_t *restrict in_pos, size_t in_size) +{ + while (rc->init_bytes_left > 0) { + if (*in_pos == in_size) + return false; + + rc->code = (rc->code << 8) | in[*in_pos]; + ++*in_pos; + --rc->init_bytes_left; + } + + return true; +} + + +/// Makes local copies of range decoder and *in_pos variables. Doing this +/// improves speed significantly. The range decoder macros expect also +/// variables `in' and `in_size' to be defined. +#define rc_to_local(range_decoder, in_pos) \ + lzma_range_decoder rc = range_decoder; \ + size_t rc_in_pos = (in_pos); \ + uint32_t rc_bound + + +/// Stores the local copes back to the range decoder structure. +#define rc_from_local(range_decoder, in_pos) \ +do { \ + range_decoder = rc; \ + in_pos = rc_in_pos; \ +} while (0) + + +/// Resets the range decoder structure. +#define rc_reset(range_decoder) \ +do { \ + (range_decoder).range = UINT32_MAX; \ + (range_decoder).code = 0; \ + (range_decoder).init_bytes_left = 5; \ +} while (0) + + +/// When decoding has been properly finished, rc.code is always zero unless +/// the input stream is corrupt. So checking this can catch some corrupt +/// files especially if they don't have any other integrity check. +#define rc_is_finished(range_decoder) \ + ((range_decoder).code == 0) + + +/// Read the next input byte if needed. If more input is needed but there is +/// no more input available, "goto out" is used to jump out of the main +/// decoder loop. +#define rc_normalize(seq) \ +do { \ + if (rc.range < RC_TOP_VALUE) { \ + if (unlikely(rc_in_pos == in_size)) { \ + coder->sequence = seq; \ + goto out; \ + } \ + rc.range <<= RC_SHIFT_BITS; \ + rc.code = (rc.code << RC_SHIFT_BITS) | in[rc_in_pos++]; \ + } \ +} while (0) + + +/// Start decoding a bit. This must be used together with rc_update_0() +/// and rc_update_1(): +/// +/// rc_if_0(prob, seq) { +/// rc_update_0(prob); +/// // Do something +/// } else { +/// rc_update_1(prob); +/// // Do something else +/// } +/// +#define rc_if_0(prob, seq) \ + rc_normalize(seq); \ + rc_bound = (rc.range >> RC_BIT_MODEL_TOTAL_BITS) * (prob); \ + if (rc.code < rc_bound) + + +/// Update the range decoder state and the used probability variable to +/// match a decoded bit of 0. +#define rc_update_0(prob) \ +do { \ + rc.range = rc_bound; \ + prob += (RC_BIT_MODEL_TOTAL - (prob)) >> RC_MOVE_BITS; \ +} while (0) + + +/// Update the range decoder state and the used probability variable to +/// match a decoded bit of 1. +#define rc_update_1(prob) \ +do { \ + rc.range -= rc_bound; \ + rc.code -= rc_bound; \ + prob -= (prob) >> RC_MOVE_BITS; \ +} while (0) + + +/// Decodes one bit and runs action0 or action1 depending on the decoded bit. +/// This macro is used as the last step in bittree reverse decoders since +/// those don't use "symbol" for anything else than indexing the probability +/// arrays. +#define rc_bit_last(prob, action0, action1, seq) \ +do { \ + rc_if_0(prob, seq) { \ + rc_update_0(prob); \ + action0; \ + } else { \ + rc_update_1(prob); \ + action1; \ + } \ +} while (0) + + +/// Decodes one bit, updates "symbol", and runs action0 or action1 depending +/// on the decoded bit. +#define rc_bit(prob, action0, action1, seq) \ + rc_bit_last(prob, \ + symbol <<= 1; action0, \ + symbol = (symbol << 1) + 1; action1, \ + seq); + + +/// Like rc_bit() but add "case seq:" as a prefix. This makes the unrolled +/// loops more readable because the code isn't littered with "case" +/// statements. On the other hand this also makes it less readable, since +/// spotting the places where the decoder loop may be restarted is less +/// obvious. +#define rc_bit_case(prob, action0, action1, seq) \ + case seq: rc_bit(prob, action0, action1, seq) + + +/// Decode a bit without using a probability. +#define rc_direct(dest, seq) \ +do { \ + rc_normalize(seq); \ + rc.range >>= 1; \ + rc.code -= rc.range; \ + rc_bound = UINT32_C(0) - (rc.code >> 31); \ + rc.code += rc.range & rc_bound; \ + dest = (dest << 1) + (rc_bound + 1); \ +} while (0) + + +// NOTE: No macros are provided for bittree decoding. It seems to be simpler +// to just write them open in the code. + +#endif diff --git a/liblzma/rangecoder/range_encoder.h b/liblzma/rangecoder/range_encoder.h new file mode 100644 index 0000000..1e1c369 --- /dev/null +++ b/liblzma/rangecoder/range_encoder.h @@ -0,0 +1,231 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file range_encoder.h +/// \brief Range Encoder +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_RANGE_ENCODER_H +#define LZMA_RANGE_ENCODER_H + +#include "range_common.h" +#include "price.h" + + +/// Maximum number of symbols that can be put pending into lzma_range_encoder +/// structure between calls to lzma_rc_encode(). For LZMA, 52+5 is enough +/// (match with big distance and length followed by range encoder flush). +#define RC_SYMBOLS_MAX 58 + + +typedef struct { + uint64_t low; + uint64_t cache_size; + uint32_t range; + uint8_t cache; + + /// Number of symbols in the tables + size_t count; + + /// rc_encode()'s position in the tables + size_t pos; + + /// Symbols to encode + enum { + RC_BIT_0, + RC_BIT_1, + RC_DIRECT_0, + RC_DIRECT_1, + RC_FLUSH, + } symbols[RC_SYMBOLS_MAX]; + + /// Probabilities associated with RC_BIT_0 or RC_BIT_1 + probability *probs[RC_SYMBOLS_MAX]; + +} lzma_range_encoder; + + +static inline void +rc_reset(lzma_range_encoder *rc) +{ + rc->low = 0; + rc->cache_size = 1; + rc->range = UINT32_MAX; + rc->cache = 0; + rc->count = 0; + rc->pos = 0; +} + + +static inline void +rc_bit(lzma_range_encoder *rc, probability *prob, uint32_t bit) +{ + rc->symbols[rc->count] = bit; + rc->probs[rc->count] = prob; + ++rc->count; +} + + +static inline void +rc_bittree(lzma_range_encoder *rc, probability *probs, + uint32_t bit_count, uint32_t symbol) +{ + uint32_t model_index = 1; + + do { + const uint32_t bit = (symbol >> --bit_count) & 1; + rc_bit(rc, &probs[model_index], bit); + model_index = (model_index << 1) + bit; + } while (bit_count != 0); +} + + +static inline void +rc_bittree_reverse(lzma_range_encoder *rc, probability *probs, + uint32_t bit_count, uint32_t symbol) +{ + uint32_t model_index = 1; + + do { + const uint32_t bit = symbol & 1; + symbol >>= 1; + rc_bit(rc, &probs[model_index], bit); + model_index = (model_index << 1) + bit; + } while (--bit_count != 0); +} + + +static inline void +rc_direct(lzma_range_encoder *rc, + uint32_t value, uint32_t bit_count) +{ + do { + rc->symbols[rc->count++] + = RC_DIRECT_0 + ((value >> --bit_count) & 1); + } while (bit_count != 0); +} + + +static inline void +rc_flush(lzma_range_encoder *rc) +{ + for (size_t i = 0; i < 5; ++i) + rc->symbols[rc->count++] = RC_FLUSH; +} + + +static inline bool +rc_shift_low(lzma_range_encoder *rc, + uint8_t *out, size_t *out_pos, size_t out_size) +{ + if ((uint32_t)(rc->low) < (uint32_t)(0xFF000000) + || (uint32_t)(rc->low >> 32) != 0) { + do { + if (*out_pos == out_size) + return true; + + out[*out_pos] = rc->cache + (uint8_t)(rc->low >> 32); + ++*out_pos; + rc->cache = 0xFF; + + } while (--rc->cache_size != 0); + + rc->cache = (rc->low >> 24) & 0xFF; + } + + ++rc->cache_size; + rc->low = (rc->low & 0x00FFFFFF) << RC_SHIFT_BITS; + + return false; +} + + +static inline bool +rc_encode(lzma_range_encoder *rc, + uint8_t *out, size_t *out_pos, size_t out_size) +{ + assert(rc->count <= RC_SYMBOLS_MAX); + + while (rc->pos < rc->count) { + // Normalize + if (rc->range < RC_TOP_VALUE) { + if (rc_shift_low(rc, out, out_pos, out_size)) + return true; + + rc->range <<= RC_SHIFT_BITS; + } + + // Encode a bit + switch (rc->symbols[rc->pos]) { + case RC_BIT_0: { + probability prob = *rc->probs[rc->pos]; + rc->range = (rc->range >> RC_BIT_MODEL_TOTAL_BITS) + * prob; + prob += (RC_BIT_MODEL_TOTAL - prob) >> RC_MOVE_BITS; + *rc->probs[rc->pos] = prob; + break; + } + + case RC_BIT_1: { + probability prob = *rc->probs[rc->pos]; + const uint32_t bound = prob * (rc->range + >> RC_BIT_MODEL_TOTAL_BITS); + rc->low += bound; + rc->range -= bound; + prob -= prob >> RC_MOVE_BITS; + *rc->probs[rc->pos] = prob; + break; + } + + case RC_DIRECT_0: + rc->range >>= 1; + break; + + case RC_DIRECT_1: + rc->range >>= 1; + rc->low += rc->range; + break; + + case RC_FLUSH: + // Prevent further normalizations. + rc->range = UINT32_MAX; + + // Flush the last five bytes (see rc_flush()). + do { + if (rc_shift_low(rc, out, out_pos, out_size)) + return true; + } while (++rc->pos < rc->count); + + // Reset the range encoder so we are ready to continue + // encoding if we weren't finishing the stream. + rc_reset(rc); + return false; + + default: + assert(0); + break; + } + + ++rc->pos; + } + + rc->count = 0; + rc->pos = 0; + + return false; +} + + +static inline uint64_t +rc_pending(const lzma_range_encoder *rc) +{ + return rc->cache_size + 5 - 1; +} + +#endif diff --git a/liblzma/simple/Makefile.inc b/liblzma/simple/Makefile.inc new file mode 100644 index 0000000..8a5e2d7 --- /dev/null +++ b/liblzma/simple/Makefile.inc @@ -0,0 +1,47 @@ +## +## Author: Lasse Collin +## +## This file has been put into the public domain. +## You can do whatever you want with this file. +## + +liblzma_la_SOURCES += \ + simple/simple_coder.c \ + simple/simple_coder.h \ + simple/simple_private.h + +if COND_ENCODER_SIMPLE +liblzma_la_SOURCES += \ + simple/simple_encoder.c \ + simple/simple_encoder.h +endif + +if COND_DECODER_SIMPLE +liblzma_la_SOURCES += \ + simple/simple_decoder.c \ + simple/simple_decoder.h +endif + +if COND_FILTER_X86 +liblzma_la_SOURCES += simple/x86.c +endif + +if COND_FILTER_POWERPC +liblzma_la_SOURCES += simple/powerpc.c +endif + +if COND_FILTER_IA64 +liblzma_la_SOURCES += simple/ia64.c +endif + +if COND_FILTER_ARM +liblzma_la_SOURCES += simple/arm.c +endif + +if COND_FILTER_ARMTHUMB +liblzma_la_SOURCES += simple/armthumb.c +endif + +if COND_FILTER_SPARC +liblzma_la_SOURCES += simple/sparc.c +endif diff --git a/liblzma/simple/arm.c b/liblzma/simple/arm.c new file mode 100644 index 0000000..a84702a --- /dev/null +++ b/liblzma/simple/arm.c @@ -0,0 +1,69 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file arm.c +/// \brief Filter for ARM binaries +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "simple_private.h" + + +static size_t +arm_code(lzma_simple *simple lzma_attribute((__unused__)), + uint32_t now_pos, bool is_encoder, + uint8_t *buffer, size_t size) +{ + size_t i; + for (i = 0; i + 4 <= size; i += 4) { + if (buffer[i + 3] == 0xEB) { + uint32_t src = (buffer[i + 2] << 16) + | (buffer[i + 1] << 8) + | (buffer[i + 0]); + src <<= 2; + + uint32_t dest; + if (is_encoder) + dest = now_pos + (uint32_t)(i) + 8 + src; + else + dest = src - (now_pos + (uint32_t)(i) + 8); + + dest >>= 2; + buffer[i + 2] = (dest >> 16); + buffer[i + 1] = (dest >> 8); + buffer[i + 0] = dest; + } + } + + return i; +} + + +static lzma_ret +arm_coder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters, bool is_encoder) +{ + return lzma_simple_coder_init(next, allocator, filters, + &arm_code, 0, 4, 4, is_encoder); +} + + +extern lzma_ret +lzma_simple_arm_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters) +{ + return arm_coder_init(next, allocator, filters, true); +} + + +extern lzma_ret +lzma_simple_arm_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters) +{ + return arm_coder_init(next, allocator, filters, false); +} diff --git a/liblzma/simple/armthumb.c b/liblzma/simple/armthumb.c new file mode 100644 index 0000000..4b49175 --- /dev/null +++ b/liblzma/simple/armthumb.c @@ -0,0 +1,74 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file armthumb.c +/// \brief Filter for ARM-Thumb binaries +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "simple_private.h" + + +static size_t +armthumb_code(lzma_simple *simple lzma_attribute((__unused__)), + uint32_t now_pos, bool is_encoder, + uint8_t *buffer, size_t size) +{ + size_t i; + for (i = 0; i + 4 <= size; i += 2) { + if ((buffer[i + 1] & 0xF8) == 0xF0 + && (buffer[i + 3] & 0xF8) == 0xF8) { + uint32_t src = ((buffer[i + 1] & 0x7) << 19) + | (buffer[i + 0] << 11) + | ((buffer[i + 3] & 0x7) << 8) + | (buffer[i + 2]); + + src <<= 1; + + uint32_t dest; + if (is_encoder) + dest = now_pos + (uint32_t)(i) + 4 + src; + else + dest = src - (now_pos + (uint32_t)(i) + 4); + + dest >>= 1; + buffer[i + 1] = 0xF0 | ((dest >> 19) & 0x7); + buffer[i + 0] = (dest >> 11); + buffer[i + 3] = 0xF8 | ((dest >> 8) & 0x7); + buffer[i + 2] = (dest); + i += 2; + } + } + + return i; +} + + +static lzma_ret +armthumb_coder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters, bool is_encoder) +{ + return lzma_simple_coder_init(next, allocator, filters, + &armthumb_code, 0, 4, 2, is_encoder); +} + + +extern lzma_ret +lzma_simple_armthumb_encoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters) +{ + return armthumb_coder_init(next, allocator, filters, true); +} + + +extern lzma_ret +lzma_simple_armthumb_decoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters) +{ + return armthumb_coder_init(next, allocator, filters, false); +} diff --git a/liblzma/simple/ia64.c b/liblzma/simple/ia64.c new file mode 100644 index 0000000..ce3692b --- /dev/null +++ b/liblzma/simple/ia64.c @@ -0,0 +1,110 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file ia64.c +/// \brief Filter for IA64 (Itanium) binaries +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "simple_private.h" + + +static size_t +ia64_code(lzma_simple *simple lzma_attribute((__unused__)), + uint32_t now_pos, bool is_encoder, + uint8_t *buffer, size_t size) +{ + static const uint32_t BRANCH_TABLE[32] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 4, 4, 6, 6, 0, 0, 7, 7, + 4, 4, 0, 0, 4, 4, 0, 0 + }; + + size_t i; + for (i = 0; i + 16 <= size; i += 16) { + const uint32_t instr_template = buffer[i] & 0x1F; + const uint32_t mask = BRANCH_TABLE[instr_template]; + uint32_t bit_pos = 5; + + for (size_t slot = 0; slot < 3; ++slot, bit_pos += 41) { + if (((mask >> slot) & 1) == 0) + continue; + + const size_t byte_pos = (bit_pos >> 3); + const uint32_t bit_res = bit_pos & 0x7; + uint64_t instruction = 0; + + for (size_t j = 0; j < 6; ++j) + instruction += (uint64_t)( + buffer[i + j + byte_pos]) + << (8 * j); + + uint64_t inst_norm = instruction >> bit_res; + + if (((inst_norm >> 37) & 0xF) == 0x5 + && ((inst_norm >> 9) & 0x7) == 0 + /* && (inst_norm & 0x3F)== 0 */ + ) { + uint32_t src = (uint32_t)( + (inst_norm >> 13) & 0xFFFFF); + src |= ((inst_norm >> 36) & 1) << 20; + + src <<= 4; + + uint32_t dest; + if (is_encoder) + dest = now_pos + (uint32_t)(i) + src; + else + dest = src - (now_pos + (uint32_t)(i)); + + dest >>= 4; + + inst_norm &= ~((uint64_t)(0x8FFFFF) << 13); + inst_norm |= (uint64_t)(dest & 0xFFFFF) << 13; + inst_norm |= (uint64_t)(dest & 0x100000) + << (36 - 20); + + instruction &= (1 << bit_res) - 1; + instruction |= (inst_norm << bit_res); + + for (size_t j = 0; j < 6; j++) + buffer[i + j + byte_pos] = (uint8_t)( + instruction + >> (8 * j)); + } + } + } + + return i; +} + + +static lzma_ret +ia64_coder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters, bool is_encoder) +{ + return lzma_simple_coder_init(next, allocator, filters, + &ia64_code, 0, 16, 16, is_encoder); +} + + +extern lzma_ret +lzma_simple_ia64_encoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters) +{ + return ia64_coder_init(next, allocator, filters, true); +} + + +extern lzma_ret +lzma_simple_ia64_decoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters) +{ + return ia64_coder_init(next, allocator, filters, false); +} diff --git a/liblzma/simple/powerpc.c b/liblzma/simple/powerpc.c new file mode 100644 index 0000000..6f83511 --- /dev/null +++ b/liblzma/simple/powerpc.c @@ -0,0 +1,73 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file powerpc.c +/// \brief Filter for PowerPC (big endian) binaries +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "simple_private.h" + + +static size_t +powerpc_code(lzma_simple *simple lzma_attribute((__unused__)), + uint32_t now_pos, bool is_encoder, + uint8_t *buffer, size_t size) +{ + size_t i; + for (i = 0; i + 4 <= size; i += 4) { + // PowerPC branch 6(48) 24(Offset) 1(Abs) 1(Link) + if ((buffer[i] >> 2) == 0x12 + && ((buffer[i + 3] & 3) == 1)) { + + const uint32_t src = ((buffer[i + 0] & 3) << 24) + | (buffer[i + 1] << 16) + | (buffer[i + 2] << 8) + | (buffer[i + 3] & (~3)); + + uint32_t dest; + if (is_encoder) + dest = now_pos + (uint32_t)(i) + src; + else + dest = src - (now_pos + (uint32_t)(i)); + + buffer[i + 0] = 0x48 | ((dest >> 24) & 0x03); + buffer[i + 1] = (dest >> 16); + buffer[i + 2] = (dest >> 8); + buffer[i + 3] &= 0x03; + buffer[i + 3] |= dest; + } + } + + return i; +} + + +static lzma_ret +powerpc_coder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters, bool is_encoder) +{ + return lzma_simple_coder_init(next, allocator, filters, + &powerpc_code, 0, 4, 4, is_encoder); +} + + +extern lzma_ret +lzma_simple_powerpc_encoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters) +{ + return powerpc_coder_init(next, allocator, filters, true); +} + + +extern lzma_ret +lzma_simple_powerpc_decoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters) +{ + return powerpc_coder_init(next, allocator, filters, false); +} diff --git a/liblzma/simple/simple_coder.c b/liblzma/simple/simple_coder.c new file mode 100644 index 0000000..a02b039 --- /dev/null +++ b/liblzma/simple/simple_coder.c @@ -0,0 +1,277 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file simple_coder.c +/// \brief Wrapper for simple filters +/// +/// Simple filters don't change the size of the data i.e. number of bytes +/// in equals the number of bytes out. +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "simple_private.h" + + +/// Copied or encodes/decodes more data to out[]. +static lzma_ret +copy_or_code(lzma_coder *coder, lzma_allocator *allocator, + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size, lzma_action action) +{ + assert(!coder->end_was_reached); + + if (coder->next.code == NULL) { + lzma_bufcpy(in, in_pos, in_size, out, out_pos, out_size); + + // Check if end of stream was reached. + if (coder->is_encoder && action == LZMA_FINISH + && *in_pos == in_size) + coder->end_was_reached = true; + + } else { + // Call the next coder in the chain to provide us some data. + const lzma_ret ret = coder->next.code( + coder->next.coder, allocator, + in, in_pos, in_size, + out, out_pos, out_size, action); + + if (ret == LZMA_STREAM_END) { + assert(!coder->is_encoder + || action == LZMA_FINISH); + coder->end_was_reached = true; + + } else if (ret != LZMA_OK) { + return ret; + } + } + + return LZMA_OK; +} + + +static size_t +call_filter(lzma_coder *coder, uint8_t *buffer, size_t size) +{ + const size_t filtered = coder->filter(coder->simple, + coder->now_pos, coder->is_encoder, + buffer, size); + coder->now_pos += filtered; + return filtered; +} + + +static lzma_ret +simple_code(lzma_coder *coder, lzma_allocator *allocator, + const uint8_t *restrict in, size_t *restrict in_pos, + size_t in_size, uint8_t *restrict out, + size_t *restrict out_pos, size_t out_size, lzma_action action) +{ + // TODO: Add partial support for LZMA_SYNC_FLUSH. We can support it + // in cases when the filter is able to filter everything. With most + // simple filters it can be done at offset that is a multiple of 2, + // 4, or 16. With x86 filter, it needs good luck, and thus cannot + // be made to work predictably. + if (action == LZMA_SYNC_FLUSH) + return LZMA_OPTIONS_ERROR; + + // Flush already filtered data from coder->buffer[] to out[]. + if (coder->pos < coder->filtered) { + lzma_bufcpy(coder->buffer, &coder->pos, coder->filtered, + out, out_pos, out_size); + + // If we couldn't flush all the filtered data, return to + // application immediately. + if (coder->pos < coder->filtered) + return LZMA_OK; + + if (coder->end_was_reached) { + assert(coder->filtered == coder->size); + return LZMA_STREAM_END; + } + } + + // If we get here, there is no filtered data left in the buffer. + coder->filtered = 0; + + assert(!coder->end_was_reached); + + // If there is more output space left than there is unfiltered data + // in coder->buffer[], flush coder->buffer[] to out[], and copy/code + // more data to out[] hopefully filling it completely. Then filter + // the data in out[]. This step is where most of the data gets + // filtered if the buffer sizes used by the application are reasonable. + const size_t out_avail = out_size - *out_pos; + const size_t buf_avail = coder->size - coder->pos; + if (out_avail > buf_avail || buf_avail == 0) { + // Store the old position so that we know from which byte + // to start filtering. + const size_t out_start = *out_pos; + + // Flush data from coder->buffer[] to out[], but don't reset + // coder->pos and coder->size yet. This way the coder can be + // restarted if the next filter in the chain returns e.g. + // LZMA_MEM_ERROR. + memcpy(out + *out_pos, coder->buffer + coder->pos, buf_avail); + *out_pos += buf_avail; + + // Copy/Encode/Decode more data to out[]. + { + const lzma_ret ret = copy_or_code(coder, allocator, + in, in_pos, in_size, + out, out_pos, out_size, action); + assert(ret != LZMA_STREAM_END); + if (ret != LZMA_OK) + return ret; + } + + // Filter out[]. + const size_t size = *out_pos - out_start; + const size_t filtered = call_filter( + coder, out + out_start, size); + + const size_t unfiltered = size - filtered; + assert(unfiltered <= coder->allocated / 2); + + // Now we can update coder->pos and coder->size, because + // the next coder in the chain (if any) was successful. + coder->pos = 0; + coder->size = unfiltered; + + if (coder->end_was_reached) { + // The last byte has been copied to out[] already. + // They are left as is. + coder->size = 0; + + } else if (unfiltered > 0) { + // There is unfiltered data left in out[]. Copy it to + // coder->buffer[] and rewind *out_pos appropriately. + *out_pos -= unfiltered; + memcpy(coder->buffer, out + *out_pos, unfiltered); + } + } else if (coder->pos > 0) { + memmove(coder->buffer, coder->buffer + coder->pos, buf_avail); + coder->size -= coder->pos; + coder->pos = 0; + } + + assert(coder->pos == 0); + + // If coder->buffer[] isn't empty, try to fill it by copying/decoding + // more data. Then filter coder->buffer[] and copy the successfully + // filtered data to out[]. It is probable, that some filtered and + // unfiltered data will be left to coder->buffer[]. + if (coder->size > 0) { + { + const lzma_ret ret = copy_or_code(coder, allocator, + in, in_pos, in_size, + coder->buffer, &coder->size, + coder->allocated, action); + assert(ret != LZMA_STREAM_END); + if (ret != LZMA_OK) + return ret; + } + + coder->filtered = call_filter( + coder, coder->buffer, coder->size); + + // Everything is considered to be filtered if coder->buffer[] + // contains the last bytes of the data. + if (coder->end_was_reached) + coder->filtered = coder->size; + + // Flush as much as possible. + lzma_bufcpy(coder->buffer, &coder->pos, coder->filtered, + out, out_pos, out_size); + } + + // Check if we got everything done. + if (coder->end_was_reached && coder->pos == coder->size) + return LZMA_STREAM_END; + + return LZMA_OK; +} + + +static void +simple_coder_end(lzma_coder *coder, lzma_allocator *allocator) +{ + lzma_next_end(&coder->next, allocator); + lzma_free(coder->simple, allocator); + lzma_free(coder, allocator); + return; +} + + +static lzma_ret +simple_coder_update(lzma_coder *coder, lzma_allocator *allocator, + const lzma_filter *filters_null lzma_attribute((__unused__)), + const lzma_filter *reversed_filters) +{ + // No update support, just call the next filter in the chain. + return lzma_next_filter_update( + &coder->next, allocator, reversed_filters + 1); +} + + +extern lzma_ret +lzma_simple_coder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters, + size_t (*filter)(lzma_simple *simple, uint32_t now_pos, + bool is_encoder, uint8_t *buffer, size_t size), + size_t simple_size, size_t unfiltered_max, + uint32_t alignment, bool is_encoder) +{ + // Allocate memory for the lzma_coder structure if needed. + if (next->coder == NULL) { + // Here we allocate space also for the temporary buffer. We + // need twice the size of unfiltered_max, because then it + // is always possible to filter at least unfiltered_max bytes + // more data in coder->buffer[] if it can be filled completely. + next->coder = lzma_alloc(sizeof(lzma_coder) + + 2 * unfiltered_max, allocator); + if (next->coder == NULL) + return LZMA_MEM_ERROR; + + next->code = &simple_code; + next->end = &simple_coder_end; + next->update = &simple_coder_update; + + next->coder->next = LZMA_NEXT_CODER_INIT; + next->coder->filter = filter; + next->coder->allocated = 2 * unfiltered_max; + + // Allocate memory for filter-specific data structure. + if (simple_size > 0) { + next->coder->simple = lzma_alloc( + simple_size, allocator); + if (next->coder->simple == NULL) + return LZMA_MEM_ERROR; + } else { + next->coder->simple = NULL; + } + } + + if (filters[0].options != NULL) { + const lzma_options_bcj *simple = filters[0].options; + next->coder->now_pos = simple->start_offset; + if (next->coder->now_pos & (alignment - 1)) + return LZMA_OPTIONS_ERROR; + } else { + next->coder->now_pos = 0; + } + + // Reset variables. + next->coder->is_encoder = is_encoder; + next->coder->end_was_reached = false; + next->coder->pos = 0; + next->coder->filtered = 0; + next->coder->size = 0; + + return lzma_next_filter_init( + &next->coder->next, allocator, filters + 1); +} diff --git a/liblzma/simple/simple_coder.h b/liblzma/simple/simple_coder.h new file mode 100644 index 0000000..0952fad --- /dev/null +++ b/liblzma/simple/simple_coder.h @@ -0,0 +1,60 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file simple_coder.h +/// \brief Wrapper for simple filters +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_SIMPLE_CODER_H +#define LZMA_SIMPLE_CODER_H + +#include "common.h" + + +extern lzma_ret lzma_simple_x86_encoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + +extern lzma_ret lzma_simple_x86_decoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + + +extern lzma_ret lzma_simple_powerpc_encoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + +extern lzma_ret lzma_simple_powerpc_decoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + + +extern lzma_ret lzma_simple_ia64_encoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + +extern lzma_ret lzma_simple_ia64_decoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + + +extern lzma_ret lzma_simple_arm_encoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + +extern lzma_ret lzma_simple_arm_decoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + + +extern lzma_ret lzma_simple_armthumb_encoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + +extern lzma_ret lzma_simple_armthumb_decoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + + +extern lzma_ret lzma_simple_sparc_encoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + +extern lzma_ret lzma_simple_sparc_decoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters); + +#endif diff --git a/liblzma/simple/simple_decoder.c b/liblzma/simple/simple_decoder.c new file mode 100644 index 0000000..0beccd3 --- /dev/null +++ b/liblzma/simple/simple_decoder.c @@ -0,0 +1,40 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file simple_decoder.c +/// \brief Properties decoder for simple filters +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "simple_decoder.h" + + +extern lzma_ret +lzma_simple_props_decode(void **options, lzma_allocator *allocator, + const uint8_t *props, size_t props_size) +{ + if (props_size == 0) + return LZMA_OK; + + if (props_size != 4) + return LZMA_OPTIONS_ERROR; + + lzma_options_bcj *opt = lzma_alloc( + sizeof(lzma_options_bcj), allocator); + if (opt == NULL) + return LZMA_MEM_ERROR; + + opt->start_offset = unaligned_read32le(props); + + // Don't leave an options structure allocated if start_offset is zero. + if (opt->start_offset == 0) + lzma_free(opt, allocator); + else + *options = opt; + + return LZMA_OK; +} diff --git a/liblzma/simple/simple_decoder.h b/liblzma/simple/simple_decoder.h new file mode 100644 index 0000000..b8bf590 --- /dev/null +++ b/liblzma/simple/simple_decoder.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file simple_decoder.h +/// \brief Properties decoder for simple filters +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_SIMPLE_DECODER_H +#define LZMA_SIMPLE_DECODER_H + +#include "simple_coder.h" + +extern lzma_ret lzma_simple_props_decode( + void **options, lzma_allocator *allocator, + const uint8_t *props, size_t props_size); + +#endif diff --git a/liblzma/simple/simple_encoder.c b/liblzma/simple/simple_encoder.c new file mode 100644 index 0000000..8aa463b --- /dev/null +++ b/liblzma/simple/simple_encoder.c @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file simple_encoder.c +/// \brief Properties encoder for simple filters +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "simple_encoder.h" + + +extern lzma_ret +lzma_simple_props_size(uint32_t *size, const void *options) +{ + const lzma_options_bcj *const opt = options; + *size = (opt == NULL || opt->start_offset == 0) ? 0 : 4; + return LZMA_OK; +} + + +extern lzma_ret +lzma_simple_props_encode(const void *options, uint8_t *out) +{ + const lzma_options_bcj *const opt = options; + + // The default start offset is zero, so we don't need to store any + // options unless the start offset is non-zero. + if (opt == NULL || opt->start_offset == 0) + return LZMA_OK; + + unaligned_write32le(out, opt->start_offset); + + return LZMA_OK; +} diff --git a/liblzma/simple/simple_encoder.h b/liblzma/simple/simple_encoder.h new file mode 100644 index 0000000..1cee482 --- /dev/null +++ b/liblzma/simple/simple_encoder.h @@ -0,0 +1,23 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file simple_encoder.c +/// \brief Properties encoder for simple filters +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_SIMPLE_ENCODER_H +#define LZMA_SIMPLE_ENCODER_H + +#include "simple_coder.h" + + +extern lzma_ret lzma_simple_props_size(uint32_t *size, const void *options); + +extern lzma_ret lzma_simple_props_encode(const void *options, uint8_t *out); + +#endif diff --git a/liblzma/simple/simple_private.h b/liblzma/simple/simple_private.h new file mode 100644 index 0000000..fcf9f7c --- /dev/null +++ b/liblzma/simple/simple_private.h @@ -0,0 +1,75 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file simple_private.h +/// \brief Private definitions for so called simple filters +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef LZMA_SIMPLE_PRIVATE_H +#define LZMA_SIMPLE_PRIVATE_H + +#include "simple_coder.h" + + +typedef struct lzma_simple_s lzma_simple; + +struct lzma_coder_s { + /// Next filter in the chain + lzma_next_coder next; + + /// True if the next coder in the chain has returned LZMA_STREAM_END. + bool end_was_reached; + + /// True if filter() should encode the data; false to decode. + /// Currently all simple filters use the same function for encoding + /// and decoding, because the difference between encoders and decoders + /// is very small. + bool is_encoder; + + /// Pointer to filter-specific function, which does + /// the actual filtering. + size_t (*filter)(lzma_simple *simple, uint32_t now_pos, + bool is_encoder, uint8_t *buffer, size_t size); + + /// Pointer to filter-specific data, or NULL if filter doesn't need + /// any extra data. + lzma_simple *simple; + + /// The lowest 32 bits of the current position in the data. Most + /// filters need this to do conversions between absolute and relative + /// addresses. + uint32_t now_pos; + + /// Size of the memory allocated for the buffer. + size_t allocated; + + /// Flushing position in the temporary buffer. buffer[pos] is the + /// next byte to be copied to out[]. + size_t pos; + + /// buffer[filtered] is the first unfiltered byte. When pos is smaller + /// than filtered, there is unflushed filtered data in the buffer. + size_t filtered; + + /// Total number of bytes (both filtered and unfiltered) currently + /// in the temporary buffer. + size_t size; + + /// Temporary buffer + uint8_t buffer[]; +}; + + +extern lzma_ret lzma_simple_coder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters, + size_t (*filter)(lzma_simple *simple, uint32_t now_pos, + bool is_encoder, uint8_t *buffer, size_t size), + size_t simple_size, size_t unfiltered_max, + uint32_t alignment, bool is_encoder); + +#endif diff --git a/liblzma/simple/sparc.c b/liblzma/simple/sparc.c new file mode 100644 index 0000000..8270d6a --- /dev/null +++ b/liblzma/simple/sparc.c @@ -0,0 +1,81 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file sparc.c +/// \brief Filter for SPARC binaries +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "simple_private.h" + + +static size_t +sparc_code(lzma_simple *simple lzma_attribute((__unused__)), + uint32_t now_pos, bool is_encoder, + uint8_t *buffer, size_t size) +{ + size_t i; + for (i = 0; i + 4 <= size; i += 4) { + + if ((buffer[i] == 0x40 && (buffer[i + 1] & 0xC0) == 0x00) + || (buffer[i] == 0x7F + && (buffer[i + 1] & 0xC0) == 0xC0)) { + + uint32_t src = ((uint32_t)buffer[i + 0] << 24) + | ((uint32_t)buffer[i + 1] << 16) + | ((uint32_t)buffer[i + 2] << 8) + | ((uint32_t)buffer[i + 3]); + + src <<= 2; + + uint32_t dest; + if (is_encoder) + dest = now_pos + (uint32_t)(i) + src; + else + dest = src - (now_pos + (uint32_t)(i)); + + dest >>= 2; + + dest = (((0 - ((dest >> 22) & 1)) << 22) & 0x3FFFFFFF) + | (dest & 0x3FFFFF) + | 0x40000000; + + buffer[i + 0] = (uint8_t)(dest >> 24); + buffer[i + 1] = (uint8_t)(dest >> 16); + buffer[i + 2] = (uint8_t)(dest >> 8); + buffer[i + 3] = (uint8_t)(dest); + } + } + + return i; +} + + +static lzma_ret +sparc_coder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters, bool is_encoder) +{ + return lzma_simple_coder_init(next, allocator, filters, + &sparc_code, 0, 4, 4, is_encoder); +} + + +extern lzma_ret +lzma_simple_sparc_encoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters) +{ + return sparc_coder_init(next, allocator, filters, true); +} + + +extern lzma_ret +lzma_simple_sparc_decoder_init(lzma_next_coder *next, + lzma_allocator *allocator, const lzma_filter_info *filters) +{ + return sparc_coder_init(next, allocator, filters, false); +} diff --git a/liblzma/simple/x86.c b/liblzma/simple/x86.c new file mode 100644 index 0000000..5d1509b --- /dev/null +++ b/liblzma/simple/x86.c @@ -0,0 +1,154 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file x86.c +/// \brief Filter for x86 binaries (BCJ filter) +/// +// Authors: Igor Pavlov +// Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "simple_private.h" + + +#define Test86MSByte(b) ((b) == 0 || (b) == 0xFF) + + +struct lzma_simple_s { + uint32_t prev_mask; + uint32_t prev_pos; +}; + + +static size_t +x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder, + uint8_t *buffer, size_t size) +{ + static const bool MASK_TO_ALLOWED_STATUS[8] + = { true, true, true, false, true, false, false, false }; + + static const uint32_t MASK_TO_BIT_NUMBER[8] + = { 0, 1, 2, 2, 3, 3, 3, 3 }; + + uint32_t prev_mask = simple->prev_mask; + uint32_t prev_pos = simple->prev_pos; + + if (size < 5) + return 0; + + if (now_pos - prev_pos > 5) + prev_pos = now_pos - 5; + + const size_t limit = size - 5; + size_t buffer_pos = 0; + + while (buffer_pos <= limit) { + uint8_t b = buffer[buffer_pos]; + if (b != 0xE8 && b != 0xE9) { + ++buffer_pos; + continue; + } + + const uint32_t offset = now_pos + (uint32_t)(buffer_pos) + - prev_pos; + prev_pos = now_pos + (uint32_t)(buffer_pos); + + if (offset > 5) { + prev_mask = 0; + } else { + for (uint32_t i = 0; i < offset; ++i) { + prev_mask &= 0x77; + prev_mask <<= 1; + } + } + + b = buffer[buffer_pos + 4]; + + if (Test86MSByte(b) + && MASK_TO_ALLOWED_STATUS[(prev_mask >> 1) & 0x7] + && (prev_mask >> 1) < 0x10) { + + uint32_t src = ((uint32_t)(b) << 24) + | ((uint32_t)(buffer[buffer_pos + 3]) << 16) + | ((uint32_t)(buffer[buffer_pos + 2]) << 8) + | (buffer[buffer_pos + 1]); + + uint32_t dest; + while (true) { + if (is_encoder) + dest = src + (now_pos + (uint32_t)( + buffer_pos) + 5); + else + dest = src - (now_pos + (uint32_t)( + buffer_pos) + 5); + + if (prev_mask == 0) + break; + + const uint32_t i = MASK_TO_BIT_NUMBER[ + prev_mask >> 1]; + + b = (uint8_t)(dest >> (24 - i * 8)); + + if (!Test86MSByte(b)) + break; + + src = dest ^ ((1 << (32 - i * 8)) - 1); + } + + buffer[buffer_pos + 4] + = (uint8_t)(~(((dest >> 24) & 1) - 1)); + buffer[buffer_pos + 3] = (uint8_t)(dest >> 16); + buffer[buffer_pos + 2] = (uint8_t)(dest >> 8); + buffer[buffer_pos + 1] = (uint8_t)(dest); + buffer_pos += 5; + prev_mask = 0; + + } else { + ++buffer_pos; + prev_mask |= 1; + if (Test86MSByte(b)) + prev_mask |= 0x10; + } + } + + simple->prev_mask = prev_mask; + simple->prev_pos = prev_pos; + + return buffer_pos; +} + + +static lzma_ret +x86_coder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters, bool is_encoder) +{ + const lzma_ret ret = lzma_simple_coder_init(next, allocator, filters, + &x86_code, sizeof(lzma_simple), 5, 1, is_encoder); + + if (ret == LZMA_OK) { + next->coder->simple->prev_mask = 0; + next->coder->simple->prev_pos = (uint32_t)(-5); + } + + return ret; +} + + +extern lzma_ret +lzma_simple_x86_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters) +{ + return x86_coder_init(next, allocator, filters, true); +} + + +extern lzma_ret +lzma_simple_x86_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, + const lzma_filter_info *filters) +{ + return x86_coder_init(next, allocator, filters, false); +} http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8510533f0e713abeedf53a737c702d683b636ecb commit 8510533f0e713abeedf53a737c702d683b636ecb Author: Brad King AuthorDate: Mon Jul 21 14:06:03 2014 -0400 Commit: Brad King CommitDate: Mon Jul 21 14:08:46 2014 -0400 liblzma: Add .gitattributes to ignore whitespace checks Tell Git not to check whitespace in third-party code. diff --git a/Utilities/cmliblzma/.gitattributes b/Utilities/cmliblzma/.gitattributes new file mode 100644 index 0000000..562b12e --- /dev/null +++ b/Utilities/cmliblzma/.gitattributes @@ -0,0 +1 @@ +* -whitespace ----------------------------------------------------------------------- Summary of changes: CMakeLists.txt | 23 +- Utilities/cmThirdParty.h.in | 1 + Utilities/{cmThirdParty.h.in => cm_lzma.h} | 20 +- Utilities/cmlibarchive/CMakeLists.txt | 22 +- .../libarchive/archive_read_support_filter_xz.c | 2 +- .../libarchive/archive_read_support_format_7zip.c | 2 +- .../libarchive/archive_read_support_format_xar.c | 2 +- Utilities/cmlibarchive/libarchive/archive_util.c | 2 +- .../libarchive/archive_write_add_filter_xz.c | 2 +- .../libarchive/archive_write_set_format_7zip.c | 2 +- .../libarchive/archive_write_set_format_xar.c | 2 +- .../{cmlibarchive => cmliblzma}/.gitattributes | 0 Utilities/cmliblzma/CMakeLists.txt | 195 +++ Utilities/cmliblzma/COPYING | 65 + Utilities/cmliblzma/README-CMake.txt | 66 + Utilities/cmliblzma/common/common_w32res.rc | 50 + Utilities/cmliblzma/common/sysdefs.h | 200 +++ Utilities/cmliblzma/common/tuklib_integer.h | 531 ++++++++ Utilities/cmliblzma/config.h.in | 283 +++++ Utilities/cmliblzma/liblzma/api/lzma.h | 313 +++++ Utilities/cmliblzma/liblzma/api/lzma/base.h | 601 +++++++++ Utilities/cmliblzma/liblzma/api/lzma/bcj.h | 90 ++ Utilities/cmliblzma/liblzma/api/lzma/block.h | 530 ++++++++ Utilities/cmliblzma/liblzma/api/lzma/check.h | 150 +++ Utilities/cmliblzma/liblzma/api/lzma/container.h | 424 +++++++ Utilities/cmliblzma/liblzma/api/lzma/delta.h | 77 ++ Utilities/cmliblzma/liblzma/api/lzma/filter.h | 424 +++++++ Utilities/cmliblzma/liblzma/api/lzma/hardware.h | 50 + Utilities/cmliblzma/liblzma/api/lzma/index.h | 682 +++++++++++ Utilities/cmliblzma/liblzma/api/lzma/index_hash.h | 107 ++ Utilities/cmliblzma/liblzma/api/lzma/lzma.h | 420 +++++++ .../cmliblzma/liblzma/api/lzma/stream_flags.h | 223 ++++ Utilities/cmliblzma/liblzma/api/lzma/version.h | 121 ++ Utilities/cmliblzma/liblzma/api/lzma/vli.h | 166 +++ Utilities/cmliblzma/liblzma/check/check.c | 174 +++ Utilities/cmliblzma/liblzma/check/check.h | 95 ++ Utilities/cmliblzma/liblzma/check/crc32_fast.c | 86 ++ Utilities/cmliblzma/liblzma/check/crc32_small.c | 61 + Utilities/cmliblzma/liblzma/check/crc32_table.c | 19 + Utilities/cmliblzma/liblzma/check/crc32_table_be.h | 525 ++++++++ Utilities/cmliblzma/liblzma/check/crc32_table_le.h | 525 ++++++++ Utilities/cmliblzma/liblzma/check/crc32_tablegen.c | 117 ++ Utilities/cmliblzma/liblzma/check/crc32_x86.S | 304 +++++ Utilities/cmliblzma/liblzma/check/crc64_fast.c | 74 ++ Utilities/cmliblzma/liblzma/check/crc64_small.c | 53 + Utilities/cmliblzma/liblzma/check/crc64_table.c | 19 + Utilities/cmliblzma/liblzma/check/crc64_table_be.h | 521 ++++++++ Utilities/cmliblzma/liblzma/check/crc64_table_le.h | 521 ++++++++ Utilities/cmliblzma/liblzma/check/crc64_tablegen.c | 88 ++ Utilities/cmliblzma/liblzma/check/crc64_x86.S | 287 +++++ Utilities/cmliblzma/liblzma/check/crc_macros.h | 30 + Utilities/cmliblzma/liblzma/check/sha256.c | 208 ++++ Utilities/cmliblzma/liblzma/common/alone_decoder.c | 236 ++++ Utilities/cmliblzma/liblzma/common/alone_decoder.h | 23 + Utilities/cmliblzma/liblzma/common/alone_encoder.c | 155 +++ Utilities/cmliblzma/liblzma/common/auto_decoder.c | 186 +++ .../liblzma/common/block_buffer_decoder.c | 82 ++ .../liblzma/common/block_buffer_encoder.c | 315 +++++ Utilities/cmliblzma/liblzma/common/block_decoder.c | 242 ++++ Utilities/cmliblzma/liblzma/common/block_decoder.h | 22 + Utilities/cmliblzma/liblzma/common/block_encoder.c | 217 ++++ Utilities/cmliblzma/liblzma/common/block_encoder.h | 47 + .../liblzma/common/block_header_decoder.c | 121 ++ .../liblzma/common/block_header_encoder.c | 137 +++ Utilities/cmliblzma/liblzma/common/block_util.c | 95 ++ Utilities/cmliblzma/liblzma/common/common.c | 390 ++++++ Utilities/cmliblzma/liblzma/common/common.h | 305 +++++ .../cmliblzma/liblzma/common/easy_buffer_encoder.c | 27 + .../liblzma/common/easy_decoder_memusage.c | 24 + Utilities/cmliblzma/liblzma/common/easy_encoder.c | 25 + .../liblzma/common/easy_encoder_memusage.c | 24 + Utilities/cmliblzma/liblzma/common/easy_preset.c | 27 + Utilities/cmliblzma/liblzma/common/easy_preset.h | 32 + .../liblzma/common/filter_buffer_decoder.c | 91 ++ .../liblzma/common/filter_buffer_encoder.c | 57 + Utilities/cmliblzma/liblzma/common/filter_common.c | 342 ++++++ Utilities/cmliblzma/liblzma/common/filter_common.h | 48 + .../cmliblzma/liblzma/common/filter_decoder.c | 185 +++ .../cmliblzma/liblzma/common/filter_decoder.h | 23 + .../cmliblzma/liblzma/common/filter_encoder.c | 297 +++++ .../cmliblzma/liblzma/common/filter_encoder.h | 27 + .../liblzma/common/filter_flags_decoder.c | 48 + .../liblzma/common/filter_flags_encoder.c | 57 + .../cmliblzma/liblzma/common/hardware_physmem.c | 25 + Utilities/cmliblzma/liblzma/common/index.c | 1276 ++++++++++++++++++++ Utilities/cmliblzma/liblzma/common/index.h | 73 ++ Utilities/cmliblzma/liblzma/common/index_decoder.c | 347 ++++++ Utilities/cmliblzma/liblzma/common/index_encoder.c | 257 ++++ Utilities/cmliblzma/liblzma/common/index_encoder.h | 23 + Utilities/cmliblzma/liblzma/common/index_hash.c | 336 ++++++ .../liblzma/common/stream_buffer_decoder.c | 93 ++ .../liblzma/common/stream_buffer_encoder.c | 140 +++ .../cmliblzma/liblzma/common/stream_decoder.c | 459 +++++++ .../cmliblzma/liblzma/common/stream_decoder.h | 21 + .../cmliblzma/liblzma/common/stream_encoder.c | 338 ++++++ .../cmliblzma/liblzma/common/stream_encoder.h | 23 + .../cmliblzma/liblzma/common/stream_flags_common.c | 47 + .../cmliblzma/liblzma/common/stream_flags_common.h | 33 + .../liblzma/common/stream_flags_decoder.c | 86 ++ .../liblzma/common/stream_flags_encoder.c | 90 ++ Utilities/cmliblzma/liblzma/common/vli_decoder.c | 86 ++ Utilities/cmliblzma/liblzma/common/vli_encoder.c | 69 ++ Utilities/cmliblzma/liblzma/common/vli_size.c | 31 + Utilities/cmliblzma/liblzma/delta/delta_common.c | 72 ++ Utilities/cmliblzma/liblzma/delta/delta_common.h | 20 + Utilities/cmliblzma/liblzma/delta/delta_decoder.c | 79 ++ Utilities/cmliblzma/liblzma/delta/delta_decoder.h | 25 + Utilities/cmliblzma/liblzma/delta/delta_encoder.c | 124 ++ Utilities/cmliblzma/liblzma/delta/delta_encoder.h | 23 + Utilities/cmliblzma/liblzma/delta/delta_private.h | 37 + Utilities/cmliblzma/liblzma/liblzma.pc.in | 19 + Utilities/cmliblzma/liblzma/liblzma_w32res.rc | 14 + Utilities/cmliblzma/liblzma/lz/lz_decoder.c | 307 +++++ Utilities/cmliblzma/liblzma/lz/lz_decoder.h | 236 ++++ Utilities/cmliblzma/liblzma/lz/lz_encoder.c | 594 +++++++++ Utilities/cmliblzma/liblzma/lz/lz_encoder.h | 328 +++++ Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h | 105 ++ .../cmliblzma/liblzma/lz/lz_encoder_hash_table.h | 68 ++ Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c | 814 +++++++++++++ Utilities/cmliblzma/liblzma/lzma/fastpos.h | 142 +++ Utilities/cmliblzma/liblzma/lzma/fastpos_table.c | 519 ++++++++ .../cmliblzma/liblzma/lzma/fastpos_tablegen.c | 56 + Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c | 305 +++++ Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.h | 28 + Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c | 399 ++++++ Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.h | 41 + Utilities/cmliblzma/liblzma/lzma/lzma_common.h | 226 ++++ Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c | 1075 +++++++++++++++++ Utilities/cmliblzma/liblzma/lzma/lzma_decoder.h | 52 + Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c | 695 +++++++++++ Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h | 54 + .../liblzma/lzma/lzma_encoder_optimum_fast.c | 185 +++ .../liblzma/lzma/lzma_encoder_optimum_normal.c | 925 ++++++++++++++ .../cmliblzma/liblzma/lzma/lzma_encoder_presets.c | 63 + .../cmliblzma/liblzma/lzma/lzma_encoder_private.h | 148 +++ Utilities/cmliblzma/liblzma/rangecoder/price.h | 92 ++ .../cmliblzma/liblzma/rangecoder/price_table.c | 22 + .../cmliblzma/liblzma/rangecoder/price_tablegen.c | 87 ++ .../cmliblzma/liblzma/rangecoder/range_common.h | 74 ++ .../cmliblzma/liblzma/rangecoder/range_decoder.h | 179 +++ .../cmliblzma/liblzma/rangecoder/range_encoder.h | 232 ++++ Utilities/cmliblzma/liblzma/simple/arm.c | 69 ++ Utilities/cmliblzma/liblzma/simple/armthumb.c | 74 ++ Utilities/cmliblzma/liblzma/simple/ia64.c | 116 ++ Utilities/cmliblzma/liblzma/simple/powerpc.c | 73 ++ Utilities/cmliblzma/liblzma/simple/simple_coder.c | 283 +++++ Utilities/cmliblzma/liblzma/simple/simple_coder.h | 60 + .../cmliblzma/liblzma/simple/simple_decoder.c | 41 + .../cmliblzma/liblzma/simple/simple_decoder.h | 22 + .../cmliblzma/liblzma/simple/simple_encoder.c | 38 + .../cmliblzma/liblzma/simple/simple_encoder.h | 23 + .../cmliblzma/liblzma/simple/simple_private.h | 75 ++ Utilities/cmliblzma/liblzma/simple/sparc.c | 82 ++ Utilities/cmliblzma/liblzma/simple/x86.c | 161 +++ 154 files changed, 26868 insertions(+), 28 deletions(-) copy Utilities/{cmThirdParty.h.in => cm_lzma.h} (57%) copy Utilities/{cmlibarchive => cmliblzma}/.gitattributes (100%) create mode 100644 Utilities/cmliblzma/CMakeLists.txt create mode 100644 Utilities/cmliblzma/COPYING create mode 100644 Utilities/cmliblzma/README-CMake.txt create mode 100644 Utilities/cmliblzma/common/common_w32res.rc create mode 100644 Utilities/cmliblzma/common/sysdefs.h create mode 100644 Utilities/cmliblzma/common/tuklib_integer.h create mode 100644 Utilities/cmliblzma/config.h.in create mode 100644 Utilities/cmliblzma/liblzma/api/lzma.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/base.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/bcj.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/block.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/check.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/container.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/delta.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/filter.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/hardware.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/index.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/index_hash.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/lzma.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/stream_flags.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/version.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/vli.h create mode 100644 Utilities/cmliblzma/liblzma/check/check.c create mode 100644 Utilities/cmliblzma/liblzma/check/check.h create mode 100644 Utilities/cmliblzma/liblzma/check/crc32_fast.c create mode 100644 Utilities/cmliblzma/liblzma/check/crc32_small.c create mode 100644 Utilities/cmliblzma/liblzma/check/crc32_table.c create mode 100644 Utilities/cmliblzma/liblzma/check/crc32_table_be.h create mode 100644 Utilities/cmliblzma/liblzma/check/crc32_table_le.h create mode 100644 Utilities/cmliblzma/liblzma/check/crc32_tablegen.c create mode 100644 Utilities/cmliblzma/liblzma/check/crc32_x86.S create mode 100644 Utilities/cmliblzma/liblzma/check/crc64_fast.c create mode 100644 Utilities/cmliblzma/liblzma/check/crc64_small.c create mode 100644 Utilities/cmliblzma/liblzma/check/crc64_table.c create mode 100644 Utilities/cmliblzma/liblzma/check/crc64_table_be.h create mode 100644 Utilities/cmliblzma/liblzma/check/crc64_table_le.h create mode 100644 Utilities/cmliblzma/liblzma/check/crc64_tablegen.c create mode 100644 Utilities/cmliblzma/liblzma/check/crc64_x86.S create mode 100644 Utilities/cmliblzma/liblzma/check/crc_macros.h create mode 100644 Utilities/cmliblzma/liblzma/check/sha256.c create mode 100644 Utilities/cmliblzma/liblzma/common/alone_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/alone_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/common/alone_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/auto_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/block_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/block_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/common/block_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/block_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/common/block_header_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/block_header_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/block_util.c create mode 100644 Utilities/cmliblzma/liblzma/common/common.c create mode 100644 Utilities/cmliblzma/liblzma/common/common.h create mode 100644 Utilities/cmliblzma/liblzma/common/easy_buffer_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/easy_decoder_memusage.c create mode 100644 Utilities/cmliblzma/liblzma/common/easy_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/easy_encoder_memusage.c create mode 100644 Utilities/cmliblzma/liblzma/common/easy_preset.c create mode 100644 Utilities/cmliblzma/liblzma/common/easy_preset.h create mode 100644 Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/filter_common.c create mode 100644 Utilities/cmliblzma/liblzma/common/filter_common.h create mode 100644 Utilities/cmliblzma/liblzma/common/filter_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/filter_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/common/filter_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/filter_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/hardware_physmem.c create mode 100644 Utilities/cmliblzma/liblzma/common/index.c create mode 100644 Utilities/cmliblzma/liblzma/common/index.h create mode 100644 Utilities/cmliblzma/liblzma/common/index_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/index_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/index_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/common/index_hash.c create mode 100644 Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/stream_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/stream_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/common/stream_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/stream_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/common/stream_flags_common.c create mode 100644 Utilities/cmliblzma/liblzma/common/stream_flags_common.h create mode 100644 Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/vli_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/vli_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/vli_size.c create mode 100644 Utilities/cmliblzma/liblzma/delta/delta_common.c create mode 100644 Utilities/cmliblzma/liblzma/delta/delta_common.h create mode 100644 Utilities/cmliblzma/liblzma/delta/delta_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/delta/delta_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/delta/delta_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/delta/delta_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/delta/delta_private.h create mode 100644 Utilities/cmliblzma/liblzma/liblzma.pc.in create mode 100644 Utilities/cmliblzma/liblzma/liblzma_w32res.rc create mode 100644 Utilities/cmliblzma/liblzma/lz/lz_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/lz/lz_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/lz/lz_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/lz/lz_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h create mode 100644 Utilities/cmliblzma/liblzma/lz/lz_encoder_hash_table.h create mode 100644 Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/fastpos.h create mode 100644 Utilities/cmliblzma/liblzma/lzma/fastpos_table.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/fastpos_tablegen.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_common.h create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h create mode 100644 Utilities/cmliblzma/liblzma/rangecoder/price.h create mode 100644 Utilities/cmliblzma/liblzma/rangecoder/price_table.c create mode 100644 Utilities/cmliblzma/liblzma/rangecoder/price_tablegen.c create mode 100644 Utilities/cmliblzma/liblzma/rangecoder/range_common.h create mode 100644 Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/simple/arm.c create mode 100644 Utilities/cmliblzma/liblzma/simple/armthumb.c create mode 100644 Utilities/cmliblzma/liblzma/simple/ia64.c create mode 100644 Utilities/cmliblzma/liblzma/simple/powerpc.c create mode 100644 Utilities/cmliblzma/liblzma/simple/simple_coder.c create mode 100644 Utilities/cmliblzma/liblzma/simple/simple_coder.h create mode 100644 Utilities/cmliblzma/liblzma/simple/simple_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/simple/simple_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/simple/simple_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/simple/simple_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/simple/simple_private.h create mode 100644 Utilities/cmliblzma/liblzma/simple/sparc.c create mode 100644 Utilities/cmliblzma/liblzma/simple/x86.c hooks/post-receive -- CMake From bill.hoffman at kitware.com Wed Jul 23 11:14:21 2014 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Wed, 23 Jul 2014 11:14:21 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4461-g0bf9d58 Message-ID: <20140723151421.3654C470AB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 0bf9d5879e628db98995563428cd3089f4bede3b (commit) via 57a2df224a4bcf4463937d5e121f917d450c144f (commit) from c8bae9bacafb95d99f9ebfacf8fdfedbbaf56760 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0bf9d5879e628db98995563428cd3089f4bede3b commit 0bf9d5879e628db98995563428cd3089f4bede3b Merge: c8bae9b 57a2df2 Author: Bill Hoffman AuthorDate: Wed Jul 23 11:14:20 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 23 11:14:20 2014 -0400 Merge topic 'fix_tar_leaks' into next 57a2df22 Fix memory leaks in extract tar. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=57a2df224a4bcf4463937d5e121f917d450c144f commit 57a2df224a4bcf4463937d5e121f917d450c144f Author: Bill Hoffman AuthorDate: Wed Jul 23 11:13:17 2014 -0400 Commit: Bill Hoffman CommitDate: Wed Jul 23 11:13:17 2014 -0400 Fix memory leaks in extract tar. diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 444e143..fbb4416 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1701,6 +1701,8 @@ bool extract_tar(const char* outFileName, bool verbose, { cmSystemTools::Error("Problem with archive_read_open_file(): ", archive_error_string(a)); + archive_write_free(ext); + archive_read_close(a); return false; } for (;;) @@ -1776,6 +1778,7 @@ bool extract_tar(const char* outFileName, bool verbose, } } } + archive_write_free(ext); archive_read_close(a); archive_read_finish(a); return r == ARCHIVE_EOF || r == ARCHIVE_OK; ----------------------------------------------------------------------- Summary of changes: Source/cmSystemTools.cxx | 3 +++ 1 file changed, 3 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 23 11:40:01 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 23 Jul 2014 11:40:01 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4463-g4d5b9ce Message-ID: <20140723154001.E1189468C4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 4d5b9cedbbfc835801712143fd4b87da729dbdea (commit) via 3119297312e0a512c71863621a137871f405788a (commit) from 0bf9d5879e628db98995563428cd3089f4bede3b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4d5b9cedbbfc835801712143fd4b87da729dbdea commit 4d5b9cedbbfc835801712143fd4b87da729dbdea Merge: 0bf9d58 3119297 Author: Brad King AuthorDate: Wed Jul 23 11:40:01 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 23 11:40:01 2014 -0400 Merge topic 'add-liblzma' into next 31192973 liblzma: Port to VS 7.0 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3119297312e0a512c71863621a137871f405788a commit 3119297312e0a512c71863621a137871f405788a Author: Brad King AuthorDate: Wed Jul 23 11:38:18 2014 -0400 Commit: Brad King CommitDate: Wed Jul 23 11:38:18 2014 -0400 liblzma: Port to VS 7.0 Use the same UINT64_C suffix as that for VS 6. diff --git a/Utilities/cmliblzma/common/sysdefs.h b/Utilities/cmliblzma/common/sysdefs.h index 81e10c1..7481e3d 100644 --- a/Utilities/cmliblzma/common/sysdefs.h +++ b/Utilities/cmliblzma/common/sysdefs.h @@ -51,7 +51,7 @@ #endif -#if defined(_MSC_VER) && (_MSC_VER <= 1200) +#if defined(_MSC_VER) && (_MSC_VER < 1310) # define UINT64_C(n) n ## ui64 #endif ----------------------------------------------------------------------- Summary of changes: Utilities/cmliblzma/common/sysdefs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 23 11:55:02 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 23 Jul 2014 11:55:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4465-g07a2eb5 Message-ID: <20140723155502.759124793B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 07a2eb5d4fb3988bf61c71bad00636464a736e4a (commit) via 96e815146d6b185fcd0d024ee03ced59e6789341 (commit) from 4d5b9cedbbfc835801712143fd4b87da729dbdea (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=07a2eb5d4fb3988bf61c71bad00636464a736e4a commit 07a2eb5d4fb3988bf61c71bad00636464a736e4a Merge: 4d5b9ce 96e8151 Author: Brad King AuthorDate: Wed Jul 23 11:55:01 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 23 11:55:01 2014 -0400 Merge topic 'add-liblzma' into next 96e81514 liblzma: Disable warnings to avoid changing 3rd party code http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=96e815146d6b185fcd0d024ee03ced59e6789341 commit 96e815146d6b185fcd0d024ee03ced59e6789341 Author: Brad King AuthorDate: Wed Jul 23 11:55:25 2014 -0400 Commit: Brad King CommitDate: Wed Jul 23 11:55:25 2014 -0400 liblzma: Disable warnings to avoid changing 3rd party code diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt index 85efa8c..fc50dbe 100644 --- a/Utilities/cmliblzma/CMakeLists.txt +++ b/Utilities/cmliblzma/CMakeLists.txt @@ -190,6 +190,16 @@ INCLUDE_DIRECTORIES( "${CMLIBLZMA_BINARY_DIR}" ) +# Disable warnings to avoid changing 3rd party code. +IF("${CMAKE_C_COMPILER_ID}" MATCHES + "^(GNU|Clang|AppleClang|XL|VisualAge|SunPro|MIPSpro|HP|Intel)$") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") +ELSEIF("${CMAKE_C_COMPILER_ID}" MATCHES "^(PathScale)$") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall") +ELSEIF(BORLAND) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-") +ENDIF() + ADD_LIBRARY(cmliblzma ${LZMA_SRCS}) INSTALL(FILES COPYING DESTINATION ${CMAKE_DOC_DIR}/cmliblzma) ----------------------------------------------------------------------- Summary of changes: Utilities/cmliblzma/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 23 16:23:14 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 23 Jul 2014 16:23:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4471-g0afd1b4 Message-ID: <20140723202314.D8EFC4836E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 0afd1b43e011968426a0d8f892f03039334d997c (commit) via 09164c637b02f964152453bdbe1b1591c39c1f7c (commit) via 29a0642ba78392ab20037e677d28eae2eea23de7 (commit) via 8fa087ab38c41e76e502f438eff42d412962108f (commit) via 1c209ac165cd2c25c632cdd238a9948c1651f907 (commit) via 91c933546d1eebb6a637f403824d63177c86c11e (commit) from 07a2eb5d4fb3988bf61c71bad00636464a736e4a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0afd1b43e011968426a0d8f892f03039334d997c commit 0afd1b43e011968426a0d8f892f03039334d997c Merge: 07a2eb5 09164c6 Author: Brad King AuthorDate: Wed Jul 23 16:23:13 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 23 16:23:13 2014 -0400 Merge topic 'vs-escaping' into next 09164c63 VS: Encode more content correctly in vcxproj files (#15031) 29a0642b VS: Encode mapped flag values in XML project files (#15031) 8fa087ab cmVisualStudioGeneratorOptions: Simplify XML escaping API 1c209ac1 cmIDEOption: Store mapped flag values as a vector 91c93354 cmVisualStudio10TargetGenerator: Remove dupilcate line http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=09164c637b02f964152453bdbe1b1591c39c1f7c commit 09164c637b02f964152453bdbe1b1591c39c1f7c Author: Brad King AuthorDate: Wed Jul 23 15:03:28 2014 -0400 Commit: Brad King CommitDate: Wed Jul 23 15:14:47 2014 -0400 VS: Encode more content correctly in vcxproj files (#15031) In cmVisualStudio10TargetGenerator, add missing cmVS10EscapeXML calls around paths to source and object files, custom command dependencies and outputs, and platform name/version values. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 2429e59..5674317 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -343,19 +343,20 @@ void cmVisualStudio10TargetGenerator::Generate() } this->WriteString("", 2); - (*this->BuildFileStream) << this->Platform << "\n"; + (*this->BuildFileStream) << cmVS10EscapeXML(this->Platform) + << "\n"; const char* projLabel = this->Target->GetProperty("PROJECT_LABEL"); if(!projLabel) { projLabel = this->Name.c_str(); } this->WriteString("", 2); - (*this->BuildFileStream) << projLabel << "\n"; + (*this->BuildFileStream) << cmVS10EscapeXML(projLabel) << "\n"; if(const char* targetFrameworkVersion = this->Target->GetProperty( "VS_DOTNET_TARGET_FRAMEWORK_VERSION")) { this->WriteString("", 2); - (*this->BuildFileStream) << targetFrameworkVersion + (*this->BuildFileStream) << cmVS10EscapeXML(targetFrameworkVersion) << "\n"; } this->WriteString("\n", 1); @@ -507,7 +508,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations() this->WriteString("", 3); (*this->BuildFileStream ) << *i << "\n"; this->WriteString("", 3); - (*this->BuildFileStream) << this->Platform << "\n"; + (*this->BuildFileStream) << cmVS10EscapeXML(this->Platform) + << "\n"; this->WriteString("\n", 2); } this->WriteString("\n", 1); @@ -700,7 +702,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile const* source, (*this->BuildFileStream ) << script << "\n"; this->WritePlatformConfigTag("AdditionalInputs", i->c_str(), 3); - (*this->BuildFileStream ) << source->GetFullPath(); + (*this->BuildFileStream ) << cmVS10EscapeXML(source->GetFullPath()); for(std::vector::const_iterator d = ccg.GetDepends().begin(); d != ccg.GetDepends().end(); @@ -710,7 +712,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile const* source, if(this->LocalGenerator->GetRealDependency(d->c_str(), i->c_str(), dep)) { this->ConvertToWindowsSlash(dep); - (*this->BuildFileStream ) << ";" << dep; + (*this->BuildFileStream ) << ";" << cmVS10EscapeXML(dep); } } (*this->BuildFileStream ) << ";%(AdditionalInputs)\n"; @@ -723,7 +725,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile const* source, { std::string out = *o; this->ConvertToWindowsSlash(out); - (*this->BuildFileStream ) << sep << out; + (*this->BuildFileStream ) << sep << cmVS10EscapeXML(out); sep = ";"; } (*this->BuildFileStream ) << "\n"; @@ -824,7 +826,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() std::string obj = (*oi)->GetFullPath(); this->WriteString("ConvertToWindowsSlash(obj); - (*this->BuildFileStream ) << obj << "\">\n"; + (*this->BuildFileStream ) << cmVS10EscapeXML(obj) << "\">\n"; this->WriteString("Resource Files\n", 3); this->WriteString("\n", 2); } @@ -843,7 +845,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() std::string obj = *oi; this->WriteString("ConvertToWindowsSlash(obj); - (*this->BuildFileStream ) << obj << "\">\n"; + (*this->BuildFileStream ) << cmVS10EscapeXML(obj) << "\">\n"; this->WriteString("Object Libraries\n", 3); this->WriteString("\n", 2); } @@ -978,7 +980,7 @@ WriteGroupSources(const char* name, std::string path = this->ConvertPath(source, s->RelativePath); this->ConvertToWindowsSlash(path); (*this->BuildFileStream) << name << " Include=\"" - << path; + << cmVS10EscapeXML(path); if(strlen(filter)) { (*this->BuildFileStream) << "\">\n"; @@ -1033,7 +1035,8 @@ void cmVisualStudio10TargetGenerator::WriteSource( } this->ConvertToWindowsSlash(sourceFile); this->WriteString("<", 2); - (*this->BuildFileStream ) << tool << " Include=\"" << sourceFile << "\""; + (*this->BuildFileStream ) << tool << " Include=\"" + << cmVS10EscapeXML(sourceFile) << "\""; if(sf->GetExtension() == "h" && this->IsResxHeader(sf->GetFullPath())) @@ -1165,7 +1168,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() std::string obj = *oi; this->WriteString("ConvertToWindowsSlash(obj); - (*this->BuildFileStream ) << obj << "\" />\n"; + (*this->BuildFileStream ) << cmVS10EscapeXML(obj) << "\" />\n"; } this->WriteString("\n", 1); @@ -2044,7 +2047,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() path += dt->GetName(); path += ".vcxproj"; } - (*this->BuildFileStream) << path << "\">\n"; + (*this->BuildFileStream) << cmVS10EscapeXML(path) << "\">\n"; this->WriteString("", 3); (*this->BuildFileStream) << this->GlobalGenerator->GetGUID(name.c_str()) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=29a0642ba78392ab20037e677d28eae2eea23de7 commit 29a0642ba78392ab20037e677d28eae2eea23de7 Author: Brad King AuthorDate: Wed Jul 23 14:59:23 2014 -0400 Commit: Brad King CommitDate: Wed Jul 23 15:01:46 2014 -0400 VS: Encode mapped flag values in XML project files (#15031) Teach cmVisualStudioGeneratorOptions to encode FlagMap entries and the FlagString value properly in vcproj/vcxproj XML files. Update the one existing call site that pre-encoded the value to not do so. diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index e0fe0fd..3ed4a48 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1013,7 +1013,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, if(!this->ModuleDefinitionFile.empty()) { std::string defFile = - this->ConvertToXMLOutputPath(this->ModuleDefinitionFile.c_str()); + this->ConvertToOptionallyRelativeOutputPath(this->ModuleDefinitionFile); linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str()); } switch(target.GetType()) diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 2c43ad2..b14fc45 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -321,7 +321,7 @@ cmVisualStudioGeneratorOptions for(std::vector::iterator i = m->second.begin(); i != m->second.end(); ++i) { - fout << sep << *i; + fout << sep << cmVisualStudio10GeneratorOptionsEscapeForXML(*i); sep = ";"; } if (m->first == "AdditionalIncludeDirectories") @@ -341,7 +341,7 @@ cmVisualStudioGeneratorOptions for(std::vector::iterator i = m->second.begin(); i != m->second.end(); ++i) { - fout << sep << *i; + fout << sep << cmVisualStudioGeneratorOptionsEscapeForXML(*i); sep = ";"; } fout << "\"\n"; @@ -373,7 +373,7 @@ cmVisualStudioGeneratorOptions { fout << ""; } - fout << this->FlagString.c_str() + fout << cmVisualStudio10GeneratorOptionsEscapeForXML(this->FlagString) << " %(AdditionalOptions)\n"; } else http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8fa087ab38c41e76e502f438eff42d412962108f commit 8fa087ab38c41e76e502f438eff42d412962108f Author: Brad King AuthorDate: Wed Jul 23 13:58:22 2014 -0400 Commit: Brad King CommitDate: Wed Jul 23 14:56:51 2014 -0400 cmVisualStudioGeneratorOptions: Simplify XML escaping API Accept arguments as std::string to avoid c_str() calls. diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index f710780..2c43ad2 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -3,9 +3,9 @@ #include #include "cmVisualStudio10TargetGenerator.h" -inline std::string cmVisualStudio10GeneratorOptionsEscapeForXML(const char* s) +static +std::string cmVisualStudio10GeneratorOptionsEscapeForXML(std::string ret) { - std::string ret = s; cmSystemTools::ReplaceString(ret, ";", "%3B"); cmSystemTools::ReplaceString(ret, "&", "&"); cmSystemTools::ReplaceString(ret, "<", "<"); @@ -13,9 +13,9 @@ inline std::string cmVisualStudio10GeneratorOptionsEscapeForXML(const char* s) return ret; } -inline std::string cmVisualStudioGeneratorOptionsEscapeForXML(const char* s) +static +std::string cmVisualStudioGeneratorOptionsEscapeForXML(std::string ret) { - std::string ret = s; cmSystemTools::ReplaceString(ret, "&", "&"); cmSystemTools::ReplaceString(ret, "\"", """); cmSystemTools::ReplaceString(ret, "<", "<"); @@ -269,7 +269,7 @@ cmVisualStudioGeneratorOptions // Escape this flag for the IDE. if(this->Version >= cmLocalVisualStudioGenerator::VS10) { - define = cmVisualStudio10GeneratorOptionsEscapeForXML(define.c_str()); + define = cmVisualStudio10GeneratorOptionsEscapeForXML(define); if(lang == "RC") { @@ -278,7 +278,7 @@ cmVisualStudioGeneratorOptions } else { - define = cmVisualStudioGeneratorOptionsEscapeForXML(define.c_str()); + define = cmVisualStudioGeneratorOptionsEscapeForXML(define); } // Store the flag in the project file. fout << sep << define; @@ -379,8 +379,7 @@ cmVisualStudioGeneratorOptions else { fout << prefix << "AdditionalOptions=\""; - fout << - cmVisualStudioGeneratorOptionsEscapeForXML(this->FlagString.c_str()); + fout << cmVisualStudioGeneratorOptionsEscapeForXML(this->FlagString); fout << "\"" << suffix; } } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1c209ac165cd2c25c632cdd238a9948c1651f907 commit 1c209ac165cd2c25c632cdd238a9948c1651f907 Author: Brad King AuthorDate: Wed Jul 23 11:13:13 2014 -0400 Commit: Brad King CommitDate: Wed Jul 23 14:18:53 2014 -0400 cmIDEOption: Store mapped flag values as a vector Some FlagMap entries are ;-lists. Store values as vector so that individual values may contain ';' characters. Delay the construction of the final ;-list until writing to the VS project file. With this approach the generated file may contain ;-separated values that contain encoded ';' characters. diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx index 1f3c066..dfbece7 100644 --- a/Source/cmIDEOptions.cxx +++ b/Source/cmIDEOptions.cxx @@ -152,18 +152,7 @@ void cmIDEOptions::FlagMapUpdate(cmIDEFlagTable const* entry, } else if(entry->special & cmIDEFlagTable::SemicolonAppendable) { - std::map::iterator itr; - itr = this->FlagMap.find(entry->IDEName); - if(itr != this->FlagMap.end()) - { - // Append to old value (if present) with semicolons; - itr->second += ";"; - itr->second += new_value; - } - else - { - this->FlagMap[entry->IDEName] = new_value; - } + this->FlagMap[entry->IDEName].push_back(new_value); } else { @@ -200,6 +189,13 @@ void cmIDEOptions::AddFlag(const char* flag, const char* value) } //---------------------------------------------------------------------------- +void cmIDEOptions::AddFlag(const char* flag, + std::vector const& value) +{ + this->FlagMap[flag] = value; +} + +//---------------------------------------------------------------------------- void cmIDEOptions::RemoveFlag(const char* flag) { this->FlagMap.erase(flag); @@ -208,10 +204,11 @@ void cmIDEOptions::RemoveFlag(const char* flag) //---------------------------------------------------------------------------- const char* cmIDEOptions::GetFlag(const char* flag) { - std::map::iterator i = this->FlagMap.find(flag); - if(i != this->FlagMap.end()) + // This method works only for single-valued flags! + std::map::iterator i = this->FlagMap.find(flag); + if(i != this->FlagMap.end() && i->second.size() == 1) { - return i->second.c_str(); + return i->second[0].c_str(); } return 0; } diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h index e7749ec..313c003 100644 --- a/Source/cmIDEOptions.h +++ b/Source/cmIDEOptions.h @@ -29,6 +29,7 @@ public: void AddDefines(const char* defines); void AddDefines(const std::vector &defines); void AddFlag(const char* flag, const char* value); + void AddFlag(const char* flag, std::vector const& value); void RemoveFlag(const char* flag); const char* GetFlag(const char* flag); @@ -40,7 +41,23 @@ protected: // Then parse the command line flags specified in CMAKE_CXX_FLAGS // and CMAKE_C_FLAGS // and overwrite or add new values to this map - std::map FlagMap; + class FlagValue: public std::vector + { + typedef std::vector derived; + public: + FlagValue& operator=(std::string const& r) + { + this->resize(1); + this->operator[](0) = r; + return *this; + } + FlagValue& operator=(std::vector const& r) + { + this->derived::operator=(r); + return *this; + } + }; + std::map FlagMap; // Preprocessor definitions. std::vector Defines; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 35c48cf..2429e59 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1735,6 +1735,9 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) } // Replace spaces in libs with ; cmSystemTools::ReplaceString(libs, " ", ";"); + std::vector libVec; + cmSystemTools::ExpandListArgument(libs, libVec); + cmComputeLinkInformation* pcli = this->Target->GetLinkInformation(config.c_str()); if(!pcli) @@ -1746,27 +1749,21 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) } // add the libraries for the target to libs string cmComputeLinkInformation& cli = *pcli; - this->AddLibraries(cli, libs); - linkOptions.AddFlag("AdditionalDependencies", libs.c_str()); + this->AddLibraries(cli, libVec); + linkOptions.AddFlag("AdditionalDependencies", libVec); std::vector const& ldirs = cli.GetDirectories(); - const char* sep = ""; - std::string linkDirs; + std::vector linkDirs; for(std::vector::const_iterator d = ldirs.begin(); d != ldirs.end(); ++d) { // first just full path - linkDirs += sep; - linkDirs += *d; - sep = ";"; - linkDirs += sep; + linkDirs.push_back(*d); // next path with configuration type Debug, Release, etc - linkDirs += *d; - linkDirs += "/$(Configuration)"; - linkDirs += sep; + linkDirs.push_back(*d + "/$(Configuration)"); } - linkDirs += "%(AdditionalLibraryDirectories)"; - linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs.c_str()); + linkDirs.push_back("%(AdditionalLibraryDirectories)"); + linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs); std::string targetName; std::string targetNameSO; @@ -1866,11 +1863,10 @@ cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& config) void cmVisualStudio10TargetGenerator::AddLibraries( cmComputeLinkInformation& cli, - std::string& libstring) + std::vector& libVec) { typedef cmComputeLinkInformation::ItemVector ItemVector; ItemVector libs = cli.GetItems(); - const char* sep = ";"; for(ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) { if(l->IsPath) @@ -1880,14 +1876,12 @@ void cmVisualStudio10TargetGenerator::AddLibraries( cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED); this->ConvertToWindowsSlash(path); - libstring += sep; - libstring += path; + libVec.push_back(path); } else if (!l->Target || l->Target->GetType() != cmTarget::INTERFACE_LIBRARY) { - libstring += sep; - libstring += l->Value; + libVec.push_back(l->Value); } } } diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 6c92b57..7a329cb 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -90,7 +90,8 @@ private: void WriteGroups(); void WriteProjectReferences(); bool OutputSourceSpecificFlags(cmSourceFile const* source); - void AddLibraries(cmComputeLinkInformation& cli, std::string& libstring); + void AddLibraries(cmComputeLinkInformation& cli, + std::vector& libVec); void WriteLibOptions(std::string const& config); void WriteEvents(std::string const& configName); void WriteEvent(const char* name, diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 2cbf5db..f710780 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -301,7 +301,7 @@ cmVisualStudioGeneratorOptions { if(this->Version >= cmLocalVisualStudioGenerator::VS10) { - for(std::map::iterator m = this->FlagMap.begin(); + for(std::map::iterator m = this->FlagMap.begin(); m != this->FlagMap.end(); ++m) { fout << indent; @@ -317,20 +317,34 @@ cmVisualStudioGeneratorOptions { fout << "<" << m->first << ">"; } - fout << m->second; + const char* sep = ""; + for(std::vector::iterator i = m->second.begin(); + i != m->second.end(); ++i) + { + fout << sep << *i; + sep = ";"; + } if (m->first == "AdditionalIncludeDirectories") { - fout << ";%(AdditionalIncludeDirectories)"; + fout << sep << "%(AdditionalIncludeDirectories)"; } fout << "first << ">\n"; } } else { - for(std::map::iterator m = this->FlagMap.begin(); + for(std::map::iterator m = this->FlagMap.begin(); m != this->FlagMap.end(); ++m) { - fout << indent << m->first << "=\"" << m->second << "\"\n"; + fout << indent << m->first << "=\""; + const char* sep = ""; + for(std::vector::iterator i = m->second.begin(); + i != m->second.end(); ++i) + { + fout << sep << *i; + sep = ";"; + } + fout << "\"\n"; } } } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=91c933546d1eebb6a637f403824d63177c86c11e commit 91c933546d1eebb6a637f403824d63177c86c11e Author: Brad King AuthorDate: Wed Jul 23 11:44:28 2014 -0400 Commit: Brad King CommitDate: Wed Jul 23 13:23:10 2014 -0400 cmVisualStudio10TargetGenerator: Remove dupilcate line diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 15439f6..35c48cf 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1767,7 +1767,6 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) } linkDirs += "%(AdditionalLibraryDirectories)"; linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs.c_str()); - linkOptions.AddFlag("AdditionalDependencies", libs.c_str()); std::string targetName; std::string targetNameSO; ----------------------------------------------------------------------- Summary of changes: Source/cmIDEOptions.cxx | 27 ++++++------ Source/cmIDEOptions.h | 19 ++++++++- Source/cmLocalVisualStudio7Generator.cxx | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 62 +++++++++++++--------------- Source/cmVisualStudio10TargetGenerator.h | 3 +- Source/cmVisualStudioGeneratorOptions.cxx | 41 +++++++++++------- 6 files changed, 89 insertions(+), 65 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 23 16:35:10 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 23 Jul 2014 16:35:10 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4474-g8f819c4 Message-ID: <20140723203510.8A19D486FB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 8f819c4968965da6864b39446885e6ee51eb5d54 (commit) via a943d41d5c275fc30803909defd2d9adb557b518 (commit) via a9006316315bd4f0d091bdb2a5cb2f8de3e08e63 (commit) from 0afd1b43e011968426a0d8f892f03039334d997c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8f819c4968965da6864b39446885e6ee51eb5d54 commit 8f819c4968965da6864b39446885e6ee51eb5d54 Merge: 0afd1b4 a943d41 Author: Brad King AuthorDate: Wed Jul 23 16:35:08 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 23 16:35:08 2014 -0400 Merge topic 'cpack-ifw-generator' into next a943d41d CPackIFW: Replace use of strftime with cmTimestamp a9006316 CPack: Add an "IFW" generator for Qt Framework Installer http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a943d41d5c275fc30803909defd2d9adb557b518 commit a943d41d5c275fc30803909defd2d9adb557b518 Author: Brad King AuthorDate: Wed Jul 23 16:31:15 2014 -0400 Commit: Brad King CommitDate: Wed Jul 23 16:35:51 2014 -0400 CPackIFW: Replace use of strftime with cmTimestamp The latter is more portable. diff --git a/Source/CPack/cmCPackIFWGenerator.cxx b/Source/CPack/cmCPackIFWGenerator.cxx index a4f33b4..51c0f2e 100644 --- a/Source/CPack/cmCPackIFWGenerator.cxx +++ b/Source/CPack/cmCPackIFWGenerator.cxx @@ -19,6 +19,7 @@ #include "cmGeneratedFileStream.h" #include "cmCPackLog.h" #include "cmCPackComponentGroup.h" +#include "cmTimestamp.h" #include #include @@ -809,16 +810,8 @@ int cmCPackIFWGenerator::IfwCreatePackageFile() //---------------------------------------------------------------------- std::string cmCPackIFWGenerator::IfwCreateCurrentDate() { - time_t rawtime; - struct tm * timeinfo; - char buffer[80]; - - time (&rawtime); - timeinfo = localtime(&rawtime); - - strftime(buffer, 80, "%Y-%m-%d", timeinfo); - - return buffer; + cmTimestamp timestamp; + return timestamp.CurrentTime("%Y-%m-%d", false); } //---------------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a9006316315bd4f0d091bdb2a5cb2f8de3e08e63 commit a9006316315bd4f0d091bdb2a5cb2f8de3e08e63 Author: Konstantin Podsvirov AuthorDate: Wed Jul 23 11:01:59 2014 +0400 Commit: Brad King CommitDate: Wed Jul 23 16:35:45 2014 -0400 CPack: Add an "IFW" generator for Qt Framework Installer Add support for packaging with the Qt Framework Installer tools: http://qt-project.org/doc/qtinstallerframework/index.html Reviewed-by: Nils Gladitz diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index fb55bfc..9d56779 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -59,11 +59,39 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") if(${CPACK_SYSTEM_NAME} MATCHES Windows) if(CMAKE_CL_64) set(CPACK_SYSTEM_NAME win64-x64) + set(CPACK_IFW_TARGET_DIRECTORY "@RootDir@/Program Files/${CMAKE_PROJECT_NAME}") else() set(CPACK_SYSTEM_NAME win32-x86) endif() endif() + # default component for IFW + set(_CPACK_IFW_COMPONENT_NAME ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}) + string(TOUPPER ${_CPACK_IFW_COMPONENT_NAME} _CPACK_IFW_COMPONENT_UNAME) + + if(${CMAKE_SYSTEM_NAME} MATCHES Windows) + if(BUILD_QtDialog) + set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/bin/cmake-gui.exe\", \"@StartMenuDir@/CMake (cmake-gui).lnk\");\n") + endif() + if(SPHINX_HTML) + set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/html/index.html\", \"@StartMenuDir@/CMake Documentation.lnk\");\n") + endif() + configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in" + "${CMake_BINARY_DIR}/installscript.qs" @ONLY + ) + install(FILES "${CMake_SOURCE_DIR}/Source/QtIFW/cmake.org.html" + DESTINATION "." + ) + set(_CPACK_IFW_COMPONENT_SCRIPT "set(CPACK_IFW_COMPONENT_${_CPACK_IFW_COMPONENT_UNAME}_SCRIPT \"${CMake_BINARY_DIR}/installscript.qs\")") + endif() + + if(${CMAKE_SYSTEM_NAME} MATCHES Linux) + set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/${CMAKE_PROJECT_NAME}") + set(CPACK_IFW_ADMIN_TARGET_DIRECTORY "@ApplicationsDir@/${CMAKE_PROJECT_NAME}") + endif() + + set(_CPACK_IFW_PACKAGE_VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}) + if(NOT DEFINED CPACK_PACKAGE_FILE_NAME) # if the CPACK_PACKAGE_FILE_NAME is not defined by the cache # default to source package - system, on cygwin system is not diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index aba404f..135c07d 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -31,6 +31,20 @@ endif() # they might not if qt was not enabled for the build include("@QT_DIALOG_CPACK_OPTIONS_FILE@" OPTIONAL) +if(CPACK_GENERATOR MATCHES "IFW") + # Version with QtIFW limitations + set(CPACK_PACKAGE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + # Enable install default component + set(CPACK_COMPONENTS_ALL "@_CPACK_IFW_COMPONENT_NAME@") + # Configuration + set(CPACK_COMPONENT_ at _CPACK_IFW_COMPONENT_UNAME@_DISPLAY_NAME "@CPACK_PACKAGE_NAME@") + set(CPACK_COMPONENT_ at _CPACK_IFW_COMPONENT_UNAME@_DESCRIPTION "@CPACK_PACKAGE_DESCRIPTION_SUMMARY@") + # IFW Configuration + set(CPACK_IFW_COMPONENT_ at _CPACK_IFW_COMPONENT_UNAME@_NAME "@CPACK_PACKAGE_NAME@") + set(CPACK_IFW_COMPONENT_ at _CPACK_IFW_COMPONENT_UNAME@_LICENSES "@CPACK_PACKAGE_NAME@ Copyright" "@CPACK_RESOURCE_FILE_LICENSE@") + @_CPACK_IFW_COMPONENT_SCRIPT@ +endif() + if(CPACK_GENERATOR MATCHES "CygwinSource") # when packaging source make sure the .build directory is not included set(CPACK_SOURCE_IGNORE_FILES diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index ecc9cc4..91fffe9 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -55,6 +55,7 @@ All Modules /module/CPackCygwin /module/CPackDeb /module/CPackDMG + /module/CPackIFW /module/CPackNSIS /module/CPackPackageMaker /module/CPackRPM diff --git a/Help/module/CPackIFW.rst b/Help/module/CPackIFW.rst new file mode 100644 index 0000000..ea05796 --- /dev/null +++ b/Help/module/CPackIFW.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/CPackIFW.cmake diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 89547af..b58f944 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -435,6 +435,7 @@ if(NOT CPACK_GENERATOR) option(CPACK_BINARY_WIX "Enable to build WiX packages" OFF) option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF) endif() + option(CPACK_BINARY_IFW "Enable to build IFW packages" OFF) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_BUNDLE Bundle) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DRAGNDROP DragNDrop) @@ -450,6 +451,7 @@ if(NOT CPACK_GENERATOR) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TZ TZ) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_WIX WIX) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_ZIP ZIP) + cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_IFW IFW) endif() diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 1433d9e..5524a3f 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -458,6 +458,9 @@ macro(cpack_add_component_group grpname) cpack_append_string_variable_set_command( CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DESCRIPTION CPACK_ADDGRP_STR) + cpack_append_string_variable_set_command( + CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_PARENT_GROUP + CPACK_ADDGRP_STR) cpack_append_option_set_command( CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_EXPANDED CPACK_ADDGRP_STR) diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake new file mode 100644 index 0000000..f99488a --- /dev/null +++ b/Modules/CPackIFW.cmake @@ -0,0 +1,384 @@ +#.rst: +# CPackIFW +# -------- +# +# .. _QtIFW: http://qt-project.org/doc/qtinstallerframework/index.html +# +# This module looks for the location of the command line utilities supplied with +# the Qt Installer Framework (QtIFW_). +# +# The module also defines several commands to control the behavior of the +# CPack ``IFW`` generator. +# +# +# Overview +# ^^^^^^^^ +# +# CPack ``IFW`` generator helps you create online and offline +# binary cross-platform installers with a graphical user interface. +# +# CPack IFW generator prepare project installation and generate configuration +# and meta information for QtIFW_ tools. +# +# The QtIFW_ provides a set of tools and utilities to create +# installers for the supported desktop Qt platforms: Linux, Microsoft Windows, +# and Mac OS X. +# +# To use CPack ``IFW`` generator you must also install QtIFW_. +# +# Variables +# ^^^^^^^^^ +# +# Variables that Change Behavior +# """""""""""""""""""""""""""""" +# +# .. variable:: CPACK_IFW_TARGET_DIRECTORY +# +# Default target directory for installation. +# By default used "@ApplicationsDir@/:variable:`CPACK_PACKAGE_INSTALL_DIRECTORY`" +# +# You can use predefined variables. +# +# .. variable:: CPACK_IFW_ADMIN_TARGET_DIRECTORY +# +# Default target directory for installation with administrator rights. +# +# You can use predefined variables. +# +# .. variable:: CPACK_IFW_RESOLVE_DUPLICATE_NAMES +# +# Resolve duplicate names when installing components with groups. +# +# .. variable:: CPACK_IFW_PACKAGES_DIRECTORIES +# +# Additional prepared packages dirs that will be used to resolve +# dependent components. +# +# Advanced Variables +# """""""""""""""""" +# +# .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE +# +# The path to "binarycreator" command line client. +# +# This variable is cached and can be configured user if need. +# +# .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND +# +# True if the "binarycreator" command line client was found. +# +# .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE +# +# The path to "repogen" command line client. +# +# This variable is cached and can be configured user if need. +# +# .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE_FOUND +# +# True if the "repogen" command line client was found. +# +# Commands +# ^^^^^^^^^ +# +# The module defines the following commands: +# +# -------------------------------------------------------------------------- +# +# .. command:: cpack_ifw_configure_component +# +# Sets the arguments specific to the CPack IFW generator. +# +# :: +# +# cpack_ifw_configure_component( +# [VERSION ] +# [SCRIPT " << std::endl; + } + + // Check dependencies + std::set compDepSet; + // CMake dependencies + if (!compIt->second.Dependencies.empty()) + { + std::vector::iterator depCompIt; + for(depCompIt = compIt->second.Dependencies.begin(); + depCompIt != compIt->second.Dependencies.end(); + ++depCompIt) + { + compDepSet.insert(IfwGetComponentId(*depCompIt)); + } + } + // QtIFW dependencies + if(const char *ifwCompDepsStr = this->GetOption(macroPrefix + "_DEPENDS")) + { + std::vector ifwCompDepsVector; + cmSystemTools::ExpandListArgument(ifwCompDepsStr, + ifwCompDepsVector); + for(std::vector::iterator + depCompIt = ifwCompDepsVector.begin(); + depCompIt != ifwCompDepsVector.end(); ++depCompIt) + { + compDepSet.insert(*depCompIt); + ifwDependsComponents.insert(*depCompIt); + } + } + + // Write dependencies + if (!compDepSet.empty()) + { + pkgXml << " "; + std::set::iterator it = compDepSet.begin(); + pkgXml << *it; + ++it; + while(it != compDepSet.end()) + { + pkgXml << "," << *it; + ++it; + } + pkgXml << "" << std::endl; + } + + // Licenses + std::vector licenses; + if(IfwParseLicenses(licenses, macroPrefix + "_LICENSES", pkgMetaDir)) + { + pkgXml << " " << std::endl; + for(size_t i = 0; i < licenses.size(); i += 2) + { + pkgXml << " " <" << std::endl; + } + + // TODO: Check how enable virtual component (now it's allways disabled) + if (compIt->second.IsRequired) { + pkgXml << " true" + << std::endl; + } else if (compIt->second.IsDisabledByDefault) { + pkgXml << " false" << std::endl; + } else if (compIt->second.IsHidden) { + pkgXml << " true" << std::endl; + } else { + pkgXml << " true" << std::endl; + } + + // Priority + if(const char* ifwCompPriority = + this->GetOption(macroPrefix + "_PRIORITY")) + { + pkgXml << " " << ifwCompPriority + << "" << std::endl; + } + + pkgXml << "" << std::endl; + + // Downloaded + if (compIt->second.IsDownloaded) + { + if (!ifwDownloadedComponents.empty()) ifwDownloadedComponents += ","; + ifwDownloadedComponents += ifwCompId; + } + else + { + if (!ifwBinaryComponents.empty()) ifwBinaryComponents += ","; + ifwBinaryComponents += ifwCompId; + } + } + + // Run repogen + if (!ifwDownloadSite.empty()) + { + std::string ifwCmd = ifwRepoGen; + ifwCmd += " -c " + this->toplevel + "/config/config.xml"; + ifwCmd += " -p " + this->toplevel + "/packages"; + + if(!ifwPkgsDirsVector.empty()) + { + for(std::vector::iterator it = ifwPkgsDirsVector.begin(); + it != ifwPkgsDirsVector.end(); ++it) + { + ifwCmd += " -p " + *it; + } + } + + if (!ifwOnlineOnly && !ifwDownloadedComponents.empty()) { + ifwCmd += " -i " + ifwDownloadedComponents; + } + ifwCmd += " " + this->toplevel + "/repository"; + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ifwCmd + << std::endl); + std::string output; + int retVal = 1; + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "- Generate repository" << std::endl); + bool res = cmSystemTools::RunSingleCommand( + ifwCmd.c_str(), &output, &retVal, 0, this->GeneratorVerbose, 0); + if ( !res || retVal ) + { + cmGeneratedFileStream ofs(ifwTmpFile.c_str()); + ofs << "# Run command: " << ifwCmd << std::endl + << "# Output:" << std::endl + << output << std::endl; + cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running IFW command: " + << ifwCmd << std::endl + << "Please check " << ifwTmpFile << " for errors" + << std::endl); + return 0; + } + } + + // Run binary creator + { + std::string ifwCmd = ifwBinCreator; + ifwCmd += " -c " + this->toplevel + "/config/config.xml"; + ifwCmd += " -p " + this->toplevel + "/packages"; + + if(!ifwPkgsDirsVector.empty()) + { + for(std::vector::iterator it = ifwPkgsDirsVector.begin(); + it != ifwPkgsDirsVector.end(); ++it) + { + ifwCmd += " -p " + *it; + } + } + + if (ifwOnlineOnly) + { + ifwCmd += " --online-only"; + } + else if (!ifwDownloadedComponents.empty() && !ifwDownloadSite.empty()) + { + ifwCmd += " -e " + ifwDownloadedComponents; + } + else if (!ifwDependsComponents.empty()) + { + ifwCmd += " -i "; + std::set::iterator it = ifwDependsComponents.begin(); + ifwCmd += *it; + ++it; + while(it != ifwDependsComponents.end()) + { + ifwCmd += "," + (*it); + ++it; + } + + ifwCmd += "," + ifwBinaryComponents; + } + // TODO: set correct name for multipackages + if (this->packageFileNames.size() > 0) + { + ifwCmd += " " + packageFileNames[0]; + } + else + { + ifwCmd += " installer"; + } + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ifwCmd + << std::endl); + std::string output; + int retVal = 1; + cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Generate package" << std::endl); + bool res = cmSystemTools::RunSingleCommand( + ifwCmd.c_str(), &output, &retVal, 0, this->GeneratorVerbose, 0); + if ( !res || retVal ) + { + cmGeneratedFileStream ofs(ifwTmpFile.c_str()); + ofs << "# Run command: " << ifwCmd << std::endl + << "# Output:" << std::endl + << output << std::endl; + cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running IFW command: " + << ifwCmd << std::endl + << "Please check " << ifwTmpFile << " for errors" + << std::endl); + return 0; + } + } + + return 1; +} + +//---------------------------------------------------------------------- +const char *cmCPackIFWGenerator::GetPackagingInstallPrefix() +{ + const char *defPrefix = cmCPackGenerator::GetPackagingInstallPrefix(); + + std::string tmpPref = defPrefix ? defPrefix : ""; + + if(this->Components.empty()) + { + tmpPref += "packages/root/data"; + } + + this->SetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX", tmpPref.c_str()); + + return this->GetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX"); +} + +//---------------------------------------------------------------------- +const char *cmCPackIFWGenerator::GetOutputExtension() +{ + const char *suffix = this->GetOption("CMAKE_EXECUTABLE_SUFFIX"); + return suffix ? suffix : ""; +} + +//---------------------------------------------------------------------- +std::string cmCPackIFWGenerator::IfwGetGroupId(cmCPackComponentGroup *group) +{ + std::string ifwGroupId; + std::string ifwGroupName; + std::list groups; + while(group) + { + groups.push_front(group); + group = group->ParentGroup; + } + std::list::iterator it = groups.begin(); + if(it != groups.end()) + { + ifwGroupId = IfwGetGroupName(*it); + ++it; + } + while(it != groups.end()) + { + ifwGroupName = IfwGetGroupName(*it); + + if(ifwResolveDuplicateNames) + { + if(ifwGroupName.substr(0, ifwGroupId.size()) == ifwGroupId) + { + ifwGroupId = ifwGroupName; + ++it; + continue; + } + } + + ifwGroupId += "." + ifwGroupName; + + ++it; + } + + return ifwGroupId; +} + +//---------------------------------------------------------------------- +std::string cmCPackIFWGenerator::IfwGetComponentId(cmCPackComponent *component) +{ + std::string ifwCompId; + if(component) { + ifwCompId = IfwGetGroupId(component->Group); + if(!ifwCompId.empty()) ifwCompId += "."; + std::string ifwCompName = IfwGetComponentName(component); + if(ifwResolveDuplicateNames && + (ifwCompName.substr(0, ifwCompId.size()) == ifwCompId)) + { + ifwCompId = ifwCompName; + } + else + { + ifwCompId += ifwCompName; + } + } + return ifwCompId; +} + +//---------------------------------------------------------------------- +std::string cmCPackIFWGenerator::IfwGetGroupName(cmCPackComponentGroup *group) +{ + std::string ifwGroupName = group->Name; + if(const char* name = + this->GetOption("CPACK_IFW_COMPONENT_GROUP_" + + cmsys::SystemTools::UpperCase(group->Name) + "_NAME")) + { + ifwGroupName = name; + } + return ifwGroupName; +} + +//---------------------------------------------------------------------- +std::string +cmCPackIFWGenerator::IfwGetComponentName(cmCPackComponent *component) +{ + return IfwGetComponentName(component->Name); +} + +//---------------------------------------------------------------------- +std::string +cmCPackIFWGenerator::IfwGetComponentName(const std::string &componentName) +{ + std::string ifwCompName = componentName; + if(const char* name = + this->GetOption("CPACK_IFW_COMPONENT_" + + cmsys::SystemTools::UpperCase(componentName) + "_NAME")) + { + ifwCompName = name; + } + return ifwCompName; +} + +//---------------------------------------------------------------------- +int cmCPackIFWGenerator::InitializeInternal() +{ + // Search Qt Installer Framework tools + + if(!this->IsOn("CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND") || + !this->IsOn("CPACK_IFW_REPOGEN_EXECUTABLE_FOUND")) + { + this->ReadListFile("CPackIFW.cmake"); + } + + // Look 'binarycreator' executable (needs) + + if(this->IsOn("CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND")) + { + const char *ifwBinCreatorStr = + this->GetOption("CPACK_IFW_BINARYCREATOR_EXECUTABLE"); + ifwBinCreator = ifwBinCreatorStr ? ifwBinCreatorStr : ""; + } + else + { + ifwBinCreator = ""; + } + + if (ifwBinCreator.empty()) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Cannot find QtIFW compiler \"binarycreator\": " + "likely it is not installed, or not in your PATH" + << std::endl); + return 0; + } + + // Look 'repogen' executable (optional) + + if(this->IsOn("CPACK_IFW_REPOGEN_EXECUTABLE_FOUND")) + { + const char *ifwRepoGenStr = + this->GetOption("CPACK_IFW_REPOGEN_EXECUTABLE"); + ifwRepoGen = ifwRepoGenStr ? ifwRepoGenStr : ""; + } + else + { + ifwRepoGen = ""; + } + + // // Variables that Change Behavior + + // Resolve duplicate names + ifwResolveDuplicateNames = this->IsOn("CPACK_IFW_RESOLVE_DUPLICATE_NAMES"); + + // Additional packages dirs + ifwPkgsDirsVector.clear(); + if(const char* dirs = this->GetOption("CPACK_IFW_PACKAGES_DIRECTORIES")) + { + cmSystemTools::ExpandListArgument(dirs, + ifwPkgsDirsVector); + } + + // Remote repository + + if (const char *site = this->GetOption("CPACK_DOWNLOAD_SITE")) + { + ifwDownloadSite = site; + } + + ifwOnlineOnly = this->IsOn("CPACK_DOWNLOAD_ALL") ? true : false; + + if (!ifwDownloadSite.empty() && ifwRepoGen.empty()) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Cannot find QtIFW repository generator \"repogen\": " + "likely it is not installed, or not in your PATH" + << std::endl); + return 0; + } + + return this->Superclass::InitializeInternal(); +} + +//---------------------------------------------------------------------- +std::string +cmCPackIFWGenerator::GetComponentInstallDirNamePrefix( + const std::string& /*componentName*/) +{ + return "packages/"; +} + +//---------------------------------------------------------------------- +std::string +cmCPackIFWGenerator::GetComponentInstallDirNameSuffix( + const std::string& componentName) +{ + std::map::iterator + compIt = this->Components.find(componentName); + + cmCPackComponent *comp = + compIt != this->Components.end() ? &compIt->second : 0; + + const std::string prefix = GetComponentInstallDirNamePrefix(componentName); + const std::string suffix = "/data"; + + if (componentPackageMethod == ONE_PACKAGE_PER_COMPONENT) { + return prefix + IfwGetComponentId(comp) + suffix; + } + + if (componentPackageMethod == ONE_PACKAGE) { + return std::string(prefix + "ALL_COMPONENTS_IN_ONE" + suffix); + } + + return prefix + IfwGetComponentId(comp) + suffix; +} + +//---------------------------------------------------------------------- +bool cmCPackIFWGenerator::GetListOfSubdirectories( + const char* topdir, std::vector& dirs) +{ + cmsys::Directory dir; + dir.Load(topdir); + size_t fileNum; + for (fileNum = 0; fileNum < dir.GetNumberOfFiles(); ++fileNum) + { + if (strcmp(dir.GetFile(static_cast(fileNum)),".") && + strcmp(dir.GetFile(static_cast(fileNum)),"..")) + { + cmsys_stl::string fullPath = topdir; + fullPath += "/"; + fullPath += dir.GetFile(static_cast(fileNum)); + if(cmsys::SystemTools::FileIsDirectory(fullPath.c_str()) && + !cmsys::SystemTools::FileIsSymlink(fullPath.c_str())) + { + if (!this->GetListOfSubdirectories(fullPath.c_str(), dirs)) + { + return false; + } + } + } + } + dirs.push_back(topdir); + return true; +} + +//---------------------------------------------------------------------- +enum cmCPackGenerator::CPackSetDestdirSupport +cmCPackIFWGenerator::SupportsSetDestdir() const +{ + return cmCPackGenerator::SETDESTDIR_SHOULD_NOT_BE_USED; +} + +//---------------------------------------------------------------------- +bool cmCPackIFWGenerator::SupportsAbsoluteDestination() const +{ + return false; +} + +//---------------------------------------------------------------------- +bool cmCPackIFWGenerator::SupportsComponentInstallation() const +{ + return true; +} + +//---------------------------------------------------------------------- +int cmCPackIFWGenerator::IfwCreateConfigFile() +{ + cmGeneratedFileStream cfg((this->toplevel + "/config/config.xml").data()); + + std::string ifwPkgName; + if (const char *name = this->GetOption("CPACK_PACKAGE_NAME")) + { + ifwPkgName = name; + } + else + { + ifwPkgName = "Your package"; + } + + std::string ifwPkgDescription; + if (const char *name = this->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) + { + ifwPkgDescription = name; + } + else + { + ifwPkgDescription = "Your package description"; + } + + std::string ifwPkgVersion; + if (const char *version = this->GetOption("CPACK_PACKAGE_VERSION")) + { + ifwPkgVersion = version; + } + else + { + ifwPkgVersion = "1.0.0"; + } + + const char *ifwPkgInstDir = + this->GetOption("CPACK_PACKAGE_INSTALL_DIRECTORY"); + const char *ifwTargetDir = + this->GetOption("CPACK_IFW_TARGET_DIRECTORY"); + const char *ifwAdminTargetDir = + this->GetOption("CPACK_IFW_ADMIN_TARGET_DIRECTORY"); + + cfg << "" << std::endl; + cfg << "" << std::endl; + cfg << " " << cmXMLSafe(ifwPkgName).str() << "" << std::endl; + cfg << " " << ifwPkgVersion << "" << std::endl; + cfg << " " << cmXMLSafe(ifwPkgDescription).str() << "" + << std::endl; + + // Default target directory for installation + if (ifwTargetDir) + { + cfg << " " << ifwTargetDir << "" << std::endl; + } + else if (ifwPkgInstDir) + { + cfg << " @ApplicationsDir@/" << ifwPkgInstDir + << "" << std::endl; + } + else + { + cfg << " @RootDir@/usr/local" << std::endl; + } + + // Default target directory for installation with administrator rights + if (ifwAdminTargetDir) + { + cfg << " " << ifwAdminTargetDir + << "" << std::endl; + } + + if (!ifwDownloadSite.empty()) + { + cfg << " " << std::endl; + cfg << " " << std::endl; + cfg << " " << ifwDownloadSite << "" << std::endl; + // These properties can now be set from "cpack_configure_downloads" + // 1 + // user + // password + // Example repository + cfg << " " << std::endl; + cfg << " " << std::endl; + } + + // CPack IFW default policy + cfg << " " << std::endl; + cfg << " true" + << std::endl; + cfg << " true" << std::endl; + + cfg << "" << std::endl; + + return 1; +} + +//---------------------------------------------------------------------- +// Create default package file +int cmCPackIFWGenerator::IfwCreatePackageFile() +{ + std::string ifwPkgName; + if (const char *name = this->GetOption("CPACK_PACKAGE_NAME")) + { + ifwPkgName = name; + } + else + { + ifwPkgName = "Your package"; + } + + std::string ifwPkgDescription; + if (const char *name = this->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) + { + ifwPkgDescription = name; + } + else + { + ifwPkgDescription = "Your package description"; + } + + cmGeneratedFileStream + pkgXml((this->toplevel + "/packages/root/meta/package.xml").data()); + pkgXml << "" << std::endl; + pkgXml << "" << std::endl; + + pkgXml << " " << ifwPkgName << "" << std::endl; + pkgXml << " " << ifwPkgDescription + << "" << std::endl; + pkgXml << " " << "root" << "" << std::endl; + pkgXml << " " << this->GetOption("CPACK_PACKAGE_VERSION") + << "" << std::endl; + pkgXml << " " << IfwCreateCurrentDate() << "" + << std::endl; + + pkgXml << " true" << std::endl; + pkgXml << " true" << std::endl; + + pkgXml << "" << std::endl; + + return 1; +} + +//---------------------------------------------------------------------- +std::string cmCPackIFWGenerator::IfwCreateCurrentDate() +{ + time_t rawtime; + struct tm * timeinfo; + char buffer[80]; + + time (&rawtime); + timeinfo = localtime(&rawtime); + + strftime(buffer, 80, "%Y-%m-%d", timeinfo); + + return buffer; +} + +//---------------------------------------------------------------------- +bool cmCPackIFWGenerator::IfwParseLicenses(std::vector &licenses, + const std::string &variable, + const std::string &metaDir) +{ + if (const char *option = this->GetOption(variable)) + { + if(!licenses.empty()) licenses.clear(); + cmSystemTools::ExpandListArgument( option, licenses ); + } + else + { + return false; + } + + if ( licenses.size() % 2 != 0 ) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, variable + << " should contain pairs of and ." + << std::endl); + return false; + } + + for(size_t i = 1; i < licenses.size(); i += 2) + { + std::string name = cmSystemTools::GetFilenameName(licenses[i]); + std::string path = metaDir + "/" + name; + cmsys::SystemTools::CopyFileIfDifferent(licenses[i].data(), path.data()); + licenses[i] = name; + } + + return licenses.size() > 1; +} diff --git a/Source/CPack/cmCPackIFWGenerator.h b/Source/CPack/cmCPackIFWGenerator.h new file mode 100644 index 0000000..d70e52d --- /dev/null +++ b/Source/CPack/cmCPackIFWGenerator.h @@ -0,0 +1,82 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmCPackIFWGenerator_h +#define cmCPackIFWGenerator_h + + +#include "cmCPackGenerator.h" +#include + +/** \class cmCPackIFWGenerator + * \brief A generator for Qt Installer Framework tools + * + * http://qt-project.org/doc/qtinstallerframework/index.html + */ +class cmCPackIFWGenerator : public cmCPackGenerator +{ +public: + cmCPackTypeMacro(cmCPackIFWGenerator, cmCPackGenerator); + + /** + * Construct generator + */ + cmCPackIFWGenerator(); + virtual ~cmCPackIFWGenerator(); + +protected: + virtual int InitializeInternal(); + virtual int PackageFiles(); + virtual const char* GetPackagingInstallPrefix(); + + virtual const char* GetOutputExtension(); + + std::string IfwGetGroupId(cmCPackComponentGroup *group); + std::string IfwGetComponentId(cmCPackComponent *component); + + std::string IfwGetGroupName(cmCPackComponentGroup *group); + + std::string IfwGetComponentName(cmCPackComponent *component); + std::string IfwGetComponentName(const std::string &componentName); + + virtual std::string GetComponentInstallDirNamePrefix( + const std::string& componentName); + + virtual std::string GetComponentInstallDirNameSuffix( + const std::string& componentName); + + bool GetListOfSubdirectories(const char* dir, + std::vector& dirs); + + enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const; + virtual bool SupportsAbsoluteDestination() const; + virtual bool SupportsComponentInstallation() const; + +private: + int IfwCreateConfigFile(); + int IfwCreatePackageFile(); + std::string IfwCreateCurrentDate(); + bool IfwParseLicenses(std::vector &licenses, + const std::string &variable, + const std::string &metaDir); + + std::string ifwRepoGen; + std::string ifwBinCreator; + + std::string ifwDownloadSite; + + bool ifwOnlineOnly; + bool ifwResolveDuplicateNames; + std::vector ifwPkgsDirsVector; +}; + +#endif diff --git a/Source/QtIFW/cmake.org.html b/Source/QtIFW/cmake.org.html new file mode 100644 index 0000000..cf5649d --- /dev/null +++ b/Source/QtIFW/cmake.org.html @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Source/QtIFW/installscript.qs.in b/Source/QtIFW/installscript.qs.in new file mode 100644 index 0000000..5491611 --- /dev/null +++ b/Source/QtIFW/installscript.qs.in @@ -0,0 +1,24 @@ +function Component() +{ + // default constructor +} + +Component.prototype.createOperations = function() +{ + // call default implementation to actually install applications! + component.createOperations(); + + // Create shortcut + if (installer.value("os") === "win") { + + at _CPACK_IFW_SHORTCUT_OPTIONAL@ + + component.addOperation("CreateShortcut", + installer.value("TargetDir") + "/cmake.org.html", + installer.value("StartMenuDir") + "/CMake Web Site.lnk"); + + component.addOperation("CreateShortcut", + installer.value("TargetDir") + "/uninstall.exe", + installer.value("StartMenuDir") + "/Uninstall.lnk"); + } +} ----------------------------------------------------------------------- Summary of changes: CMakeCPack.cmake | 28 + CMakeCPackOptions.cmake.in | 14 + Help/manual/cmake-modules.7.rst | 1 + Help/module/CPackIFW.rst | 1 + Modules/CPack.cmake | 2 + Modules/CPackComponent.cmake | 3 + Modules/CPackIFW.cmake | 384 ++++++++++++++ Source/CMakeLists.txt | 1 + Source/CPack/cmCPackGeneratorFactory.cxx | 6 + Source/CPack/cmCPackIFWGenerator.cxx | 849 ++++++++++++++++++++++++++++++ Source/CPack/cmCPackIFWGenerator.h | 82 +++ Source/QtIFW/cmake.org.html | 7 + Source/QtIFW/installscript.qs.in | 24 + 13 files changed, 1402 insertions(+) create mode 100644 Help/module/CPackIFW.rst create mode 100644 Modules/CPackIFW.cmake create mode 100644 Source/CPack/cmCPackIFWGenerator.cxx create mode 100644 Source/CPack/cmCPackIFWGenerator.h create mode 100644 Source/QtIFW/cmake.org.html create mode 100644 Source/QtIFW/installscript.qs.in hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jul 24 00:01:11 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 24 Jul 2014 00:01:11 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1484-gafe21fc Message-ID: <20140724040111.EB78F4812E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via afe21fc3c43af0c031a77b3b48041d35f248f481 (commit) from fe4e6ed991b936e147536832bbf7190f05887814 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=afe21fc3c43af0c031a77b3b48041d35f248f481 commit afe21fc3c43af0c031a77b3b48041d35f248f481 Author: Kitware Robot AuthorDate: Thu Jul 24 00:01:10 2014 -0400 Commit: Kitware Robot CommitDate: Thu Jul 24 00:01:10 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2d17cbe..054cf09 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140723) +set(CMake_VERSION_PATCH 20140724) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 24 09:05:07 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 24 Jul 2014 09:05:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4476-gd43aa3f Message-ID: <20140724130507.C38934867C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d43aa3f5f438c407995fcb9c7f1702666ad1f04d (commit) via 2eaf208bba50cf120ddcdd0fc5bb078b5996b840 (commit) from 8f819c4968965da6864b39446885e6ee51eb5d54 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d43aa3f5f438c407995fcb9c7f1702666ad1f04d commit d43aa3f5f438c407995fcb9c7f1702666ad1f04d Merge: 8f819c4 2eaf208 Author: Brad King AuthorDate: Thu Jul 24 09:05:07 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 24 09:05:07 2014 -0400 Merge topic 'cpack-ifw-generator' into next 2eaf208b CMakeCPack: Fix for CMake < 2.8.9 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2eaf208bba50cf120ddcdd0fc5bb078b5996b840 commit 2eaf208bba50cf120ddcdd0fc5bb078b5996b840 Author: Brad King AuthorDate: Thu Jul 24 09:02:32 2014 -0400 Commit: Brad King CommitDate: Thu Jul 24 09:04:35 2014 -0400 CMakeCPack: Fix for CMake < 2.8.9 The CMAKE_INSTALL_DEFAULT_COMPONENT_NAME is not defined prior to CMake 2.8.9. diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index 9d56779..5b096ad 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -66,7 +66,11 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") endif() # default component for IFW - set(_CPACK_IFW_COMPONENT_NAME ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}) + if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME) + set(_CPACK_IFW_COMPONENT_NAME ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}) + else() + set(_CPACK_IFW_COMPONENT_NAME Unspecified) + endif() string(TOUPPER ${_CPACK_IFW_COMPONENT_NAME} _CPACK_IFW_COMPONENT_UNAME) if(${CMAKE_SYSTEM_NAME} MATCHES Windows) ----------------------------------------------------------------------- Summary of changes: CMakeCPack.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 24 09:33:17 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 24 Jul 2014 09:33:17 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4479-g8485d72 Message-ID: <20140724133317.A8CA34868C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 8485d720847ef5a4b60549bda4291b781951ed46 (commit) via c63d4d54d01d84297743fc0f48e1292df37290a2 (commit) via bf91e8362876c2be2fc6f6a16e8897a7a9cd963e (commit) from d43aa3f5f438c407995fcb9c7f1702666ad1f04d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8485d720847ef5a4b60549bda4291b781951ed46 commit 8485d720847ef5a4b60549bda4291b781951ed46 Merge: d43aa3f c63d4d5 Author: Brad King AuthorDate: Thu Jul 24 09:33:16 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 24 09:33:16 2014 -0400 Merge topic 'add-liblzma' into next c63d4d54 liblzma: Remove use of MSVC intrinsic bf91e836 liblzma: Suppress MSVC warnings http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c63d4d54d01d84297743fc0f48e1292df37290a2 commit c63d4d54d01d84297743fc0f48e1292df37290a2 Author: Brad King AuthorDate: Thu Jul 24 09:30:09 2014 -0400 Commit: Brad King CommitDate: Thu Jul 24 09:30:09 2014 -0400 liblzma: Remove use of MSVC intrinsic diff --git a/Utilities/cmliblzma/common/tuklib_integer.h b/Utilities/cmliblzma/common/tuklib_integer.h index e8cb6bf..5e8262a 100644 --- a/Utilities/cmliblzma/common/tuklib_integer.h +++ b/Utilities/cmliblzma/common/tuklib_integer.h @@ -387,13 +387,6 @@ bsr32(uint32_t n) __asm__("bsrl %1, %0" : "=r" (i) : "rm" (n)); return i; -#elif defined(_MSC_VER) && _MSC_VER >= 1400 - // MSVC isn't supported by tuklib, but since this code exists, - // it doesn't hurt to have it here anyway. - uint32_t i; - _BitScanReverse(&i, n); - return i; - #else uint32_t i = 31; @@ -441,11 +434,6 @@ clz32(uint32_t n) : "=r" (i) : "rm" (n)); return i; -#elif defined(_MSC_VER) && _MSC_VER >= 1400 - uint32_t i; - _BitScanReverse(&i, n); - return i ^ 31U; - #else uint32_t i = 0; @@ -491,11 +479,6 @@ ctz32(uint32_t n) __asm__("bsfl %1, %0" : "=r" (i) : "rm" (n)); return i; -#elif defined(_MSC_VER) && _MSC_VER >= 1400 - uint32_t i; - _BitScanForward(&i, n); - return i; - #else uint32_t i = 0; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bf91e8362876c2be2fc6f6a16e8897a7a9cd963e commit bf91e8362876c2be2fc6f6a16e8897a7a9cd963e Author: Brad King AuthorDate: Thu Jul 24 09:14:53 2014 -0400 Commit: Brad King CommitDate: Thu Jul 24 09:14:53 2014 -0400 liblzma: Suppress MSVC warnings diff --git a/Utilities/cmliblzma/common/sysdefs.h b/Utilities/cmliblzma/common/sysdefs.h index 7481e3d..2bcaeb3 100644 --- a/Utilities/cmliblzma/common/sysdefs.h +++ b/Utilities/cmliblzma/common/sysdefs.h @@ -17,7 +17,7 @@ #define LZMA_SYSDEFS_H #if defined(_MSC_VER) -# pragma warning(disable: 4028 4244 4761) +# pragma warning(push,1) #endif ////////////// ----------------------------------------------------------------------- Summary of changes: Utilities/cmliblzma/common/sysdefs.h | 2 +- Utilities/cmliblzma/common/tuklib_integer.h | 17 ----------------- 2 files changed, 1 insertion(+), 18 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 24 10:54:17 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 24 Jul 2014 10:54:17 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4481-ge307402 Message-ID: <20140724145417.5DAE04830B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via e30740211b432a546e9884149f92df0fb75f1c77 (commit) via 606d3df4e2712a534f3e773cb1524c2929c85c01 (commit) from 8485d720847ef5a4b60549bda4291b781951ed46 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e30740211b432a546e9884149f92df0fb75f1c77 commit e30740211b432a546e9884149f92df0fb75f1c77 Merge: 8485d72 606d3df Author: Brad King AuthorDate: Thu Jul 24 10:54:16 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 24 10:54:16 2014 -0400 Merge topic 'add-liblzma' into next 606d3df4 liblzma: Avoid defining a 'restrict' macro http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=606d3df4e2712a534f3e773cb1524c2929c85c01 commit 606d3df4e2712a534f3e773cb1524c2929c85c01 Author: Brad King AuthorDate: Thu Jul 24 10:51:21 2014 -0400 Commit: Brad King CommitDate: Thu Jul 24 10:52:36 2014 -0400 liblzma: Avoid defining a 'restrict' macro Any "#define restrict ..." line may conflict with MSVC header files that use "__declspec(restrict)". Define our own LZMA_RESTRICT macro in "Utilities/cmliblzma/config.h.in" and transform liblzma code to use it: git grep -lE '\' Utilities/cmliblzma/liblzma | xargs sed -i 's/\/LZMA_RESTRICT/g' diff --git a/Utilities/cmliblzma/config.h.in b/Utilities/cmliblzma/config.h.in index 391bb87..b197f27 100644 --- a/Utilities/cmliblzma/config.h.in +++ b/Utilities/cmliblzma/config.h.in @@ -188,10 +188,12 @@ typedef uint64_t uintmax_t; #ifndef HAVE_RESTRICT # ifdef HAVE___RESTRICT -# define restrict __restrict +# define LZMA_RESTRICT __restrict # else -# define restrict +# define LZMA_RESTRICT # endif +#else +# define LZMA_RESTRICT restrict #endif /* HAVE_RESTRICT */ #ifndef HAVE_INLINE diff --git a/Utilities/cmliblzma/liblzma/common/alone_decoder.c b/Utilities/cmliblzma/liblzma/common/alone_decoder.c index a20cf49..5f5e564 100644 --- a/Utilities/cmliblzma/liblzma/common/alone_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/alone_decoder.c @@ -52,9 +52,9 @@ struct lzma_coder_s { static lzma_ret alone_decode(lzma_coder *coder, lzma_allocator *allocator lzma_attribute((__unused__)), - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { while (*out_pos < out_size diff --git a/Utilities/cmliblzma/liblzma/common/alone_encoder.c b/Utilities/cmliblzma/liblzma/common/alone_encoder.c index 62df126..4207b4a 100644 --- a/Utilities/cmliblzma/liblzma/common/alone_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/alone_encoder.c @@ -33,9 +33,9 @@ struct lzma_coder_s { static lzma_ret alone_encode(lzma_coder *coder, lzma_allocator *allocator lzma_attribute((__unused__)), - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { while (*out_pos < out_size) diff --git a/Utilities/cmliblzma/liblzma/common/auto_decoder.c b/Utilities/cmliblzma/liblzma/common/auto_decoder.c index 6f3c862..24cf489 100644 --- a/Utilities/cmliblzma/liblzma/common/auto_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/auto_decoder.c @@ -31,9 +31,9 @@ struct lzma_coder_s { static lzma_ret auto_decode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { switch (coder->sequence) { case SEQ_INIT: diff --git a/Utilities/cmliblzma/liblzma/common/block_decoder.c b/Utilities/cmliblzma/liblzma/common/block_decoder.c index 3de3851..35996e7 100644 --- a/Utilities/cmliblzma/liblzma/common/block_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_decoder.c @@ -72,9 +72,9 @@ is_size_valid(lzma_vli size, lzma_vli reference) static lzma_ret block_decode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { switch (coder->sequence) { case SEQ_CODE: { diff --git a/Utilities/cmliblzma/liblzma/common/block_encoder.c b/Utilities/cmliblzma/liblzma/common/block_encoder.c index 63e2687..ed74827 100644 --- a/Utilities/cmliblzma/liblzma/common/block_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_encoder.c @@ -46,9 +46,9 @@ struct lzma_coder_s { static lzma_ret block_encode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { // Check that our amount of input stays in proper limits. if (LZMA_VLI_MAX - coder->uncompressed_size < in_size - *in_pos) diff --git a/Utilities/cmliblzma/liblzma/common/common.c b/Utilities/cmliblzma/liblzma/common/common.c index d0105e1..2e723c8 100644 --- a/Utilities/cmliblzma/liblzma/common/common.c +++ b/Utilities/cmliblzma/liblzma/common/common.c @@ -70,9 +70,9 @@ lzma_free(void *ptr, lzma_allocator *allocator) ////////// extern size_t -lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size) +lzma_bufcpy(const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size) { const size_t in_avail = in_size - *in_pos; const size_t out_avail = out_size - *out_pos; diff --git a/Utilities/cmliblzma/liblzma/common/common.h b/Utilities/cmliblzma/liblzma/common/common.h index a1a1591..a6a2818 100644 --- a/Utilities/cmliblzma/liblzma/common/common.h +++ b/Utilities/cmliblzma/liblzma/common/common.h @@ -88,9 +88,9 @@ typedef lzma_ret (*lzma_init_function)( /// function prototype. typedef lzma_ret (*lzma_code_function)( lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action); /// Type of a function to free the memory allocated for the coder @@ -234,9 +234,9 @@ extern void lzma_next_end(lzma_next_coder *next, lzma_allocator *allocator); /// Copy as much data as possible from in[] to out[] and update *in_pos /// and *out_pos accordingly. Returns the number of bytes copied. -extern size_t lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size); +extern size_t lzma_bufcpy(const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size); /// \brief Return if expression doesn't evaluate to LZMA_OK diff --git a/Utilities/cmliblzma/liblzma/common/index.c b/Utilities/cmliblzma/liblzma/common/index.c index f0f67ca..26135d2 100644 --- a/Utilities/cmliblzma/liblzma/common/index.c +++ b/Utilities/cmliblzma/liblzma/common/index.c @@ -780,7 +780,7 @@ index_cat_helper(const index_cat_info *info, index_stream *this) extern LZMA_API(lzma_ret) -lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src, +lzma_index_cat(lzma_index *LZMA_RESTRICT dest, lzma_index *LZMA_RESTRICT src, lzma_allocator *allocator) { index_cat_info info; diff --git a/Utilities/cmliblzma/liblzma/common/index_decoder.c b/Utilities/cmliblzma/liblzma/common/index_decoder.c index 6c91f10..943cfd5 100644 --- a/Utilities/cmliblzma/liblzma/common/index_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/index_decoder.c @@ -55,10 +55,10 @@ struct lzma_coder_s { static lzma_ret index_decode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, size_t in_size, - uint8_t *restrict out lzma_attribute((__unused__)), - size_t *restrict out_pos lzma_attribute((__unused__)), + uint8_t *LZMA_RESTRICT out lzma_attribute((__unused__)), + size_t *LZMA_RESTRICT out_pos lzma_attribute((__unused__)), size_t out_size lzma_attribute((__unused__)), lzma_action action lzma_attribute((__unused__))) { diff --git a/Utilities/cmliblzma/liblzma/common/index_encoder.c b/Utilities/cmliblzma/liblzma/common/index_encoder.c index a6f8598..194bf21 100644 --- a/Utilities/cmliblzma/liblzma/common/index_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/index_encoder.c @@ -43,10 +43,10 @@ struct lzma_coder_s { static lzma_ret index_encode(lzma_coder *coder, lzma_allocator *allocator lzma_attribute((__unused__)), - const uint8_t *restrict in lzma_attribute((__unused__)), - size_t *restrict in_pos lzma_attribute((__unused__)), + const uint8_t *LZMA_RESTRICT in lzma_attribute((__unused__)), + size_t *LZMA_RESTRICT in_pos lzma_attribute((__unused__)), size_t in_size lzma_attribute((__unused__)), - uint8_t *restrict out, size_t *restrict out_pos, + uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action lzma_attribute((__unused__))) { diff --git a/Utilities/cmliblzma/liblzma/common/stream_decoder.c b/Utilities/cmliblzma/liblzma/common/stream_decoder.c index 56a009b..5e9a220 100644 --- a/Utilities/cmliblzma/liblzma/common/stream_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_decoder.c @@ -97,9 +97,9 @@ stream_decoder_reset(lzma_coder *coder, lzma_allocator *allocator) static lzma_ret stream_decode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { // When decoding the actual Block, it may be able to produce more // output even if we don't give it any new input. diff --git a/Utilities/cmliblzma/liblzma/common/stream_encoder.c b/Utilities/cmliblzma/liblzma/common/stream_encoder.c index e2f2e10..1ba45ac 100644 --- a/Utilities/cmliblzma/liblzma/common/stream_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_encoder.c @@ -80,9 +80,9 @@ block_encoder_init(lzma_coder *coder, lzma_allocator *allocator) static lzma_ret stream_encode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { // Main loop while (*out_pos < out_size) diff --git a/Utilities/cmliblzma/liblzma/common/vli_decoder.c b/Utilities/cmliblzma/liblzma/common/vli_decoder.c index c181828..1c66384 100644 --- a/Utilities/cmliblzma/liblzma/common/vli_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/vli_decoder.c @@ -14,8 +14,8 @@ extern LZMA_API(lzma_ret) -lzma_vli_decode(lzma_vli *restrict vli, size_t *vli_pos, - const uint8_t *restrict in, size_t *restrict in_pos, +lzma_vli_decode(lzma_vli *LZMA_RESTRICT vli, size_t *vli_pos, + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, size_t in_size) { // If we haven't been given vli_pos, work in single-call mode. diff --git a/Utilities/cmliblzma/liblzma/common/vli_encoder.c b/Utilities/cmliblzma/liblzma/common/vli_encoder.c index f864269..09e90cb 100644 --- a/Utilities/cmliblzma/liblzma/common/vli_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/vli_encoder.c @@ -15,7 +15,7 @@ extern LZMA_API(lzma_ret) lzma_vli_encode(lzma_vli vli, size_t *vli_pos, - uint8_t *restrict out, size_t *restrict out_pos, + uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos, size_t out_size) { // If we haven't been given vli_pos, work in single-call mode. diff --git a/Utilities/cmliblzma/liblzma/delta/delta_decoder.c b/Utilities/cmliblzma/liblzma/delta/delta_decoder.c index 582e58e..28df727 100644 --- a/Utilities/cmliblzma/liblzma/delta/delta_decoder.c +++ b/Utilities/cmliblzma/liblzma/delta/delta_decoder.c @@ -29,9 +29,9 @@ decode_buffer(lzma_coder *coder, uint8_t *buffer, size_t size) static lzma_ret delta_decode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { const size_t out_start = *out_pos; lzma_ret ret; diff --git a/Utilities/cmliblzma/liblzma/delta/delta_encoder.c b/Utilities/cmliblzma/liblzma/delta/delta_encoder.c index 8b9e4a8..a39c154 100644 --- a/Utilities/cmliblzma/liblzma/delta/delta_encoder.c +++ b/Utilities/cmliblzma/liblzma/delta/delta_encoder.c @@ -19,7 +19,7 @@ /// encoder's filter stack). static void copy_and_encode(lzma_coder *coder, - const uint8_t *restrict in, uint8_t *restrict out, size_t size) + const uint8_t *LZMA_RESTRICT in, uint8_t *LZMA_RESTRICT out, size_t size) { size_t i; const size_t distance = coder->distance; @@ -52,9 +52,9 @@ encode_in_place(lzma_coder *coder, uint8_t *buffer, size_t size) static lzma_ret delta_encode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { lzma_ret ret; diff --git a/Utilities/cmliblzma/liblzma/lz/lz_decoder.c b/Utilities/cmliblzma/liblzma/lz/lz_decoder.c index f45984e..9fa1bdc 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_decoder.c +++ b/Utilities/cmliblzma/liblzma/lz/lz_decoder.c @@ -64,9 +64,9 @@ lz_decoder_reset(lzma_coder *coder) static lzma_ret decode_buffer(lzma_coder *coder, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size) { while (true) { size_t copy_size; @@ -131,9 +131,9 @@ decode_buffer(lzma_coder *coder, static lzma_ret lz_decode(lzma_coder *coder, lzma_allocator *allocator lzma_attribute((__unused__)), - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { if (coder->next.code == NULL) diff --git a/Utilities/cmliblzma/liblzma/lz/lz_decoder.h b/Utilities/cmliblzma/liblzma/lz/lz_decoder.h index 2d19cac..76011f2 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_decoder.h +++ b/Utilities/cmliblzma/liblzma/lz/lz_decoder.h @@ -56,9 +56,9 @@ typedef struct { lzma_coder *coder; /// Function to decode from in[] to *dict - lzma_ret (*code)(lzma_coder *restrict coder, - lzma_dict *restrict dict, const uint8_t *restrict in, - size_t *restrict in_pos, size_t in_size); + lzma_ret (*code)(lzma_coder *LZMA_RESTRICT coder, + lzma_dict *LZMA_RESTRICT dict, const uint8_t *LZMA_RESTRICT in, + size_t *LZMA_RESTRICT in_pos, size_t in_size); void (*reset)(lzma_coder *coder, const void *options); @@ -202,9 +202,9 @@ dict_put(lzma_dict *dict, uint8_t byte) /// Copies arbitrary amount of data into the dictionary. static inline void -dict_write(lzma_dict *restrict dict, const uint8_t *restrict in, - size_t *restrict in_pos, size_t in_size, - size_t *restrict left) +dict_write(lzma_dict *LZMA_RESTRICT dict, const uint8_t *LZMA_RESTRICT in, + size_t *LZMA_RESTRICT in_pos, size_t in_size, + size_t *LZMA_RESTRICT left) { // NOTE: If we are being given more data than the size of the // dictionary, it could be possible to optimize the LZ decoder diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder.c b/Utilities/cmliblzma/liblzma/lz/lz_encoder.c index a735c21..1dae924 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_encoder.c +++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder.c @@ -153,9 +153,9 @@ fill_window(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in, static lzma_ret lz_encode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, size_t in_size, - uint8_t *restrict out, size_t *restrict out_pos, + uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { while (*out_pos < out_size diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder.h b/Utilities/cmliblzma/liblzma/lz/lz_encoder.h index 647f5e2..dcb4b2c 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_encoder.h +++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder.h @@ -194,9 +194,9 @@ typedef struct { lzma_coder *coder; /// Function to encode from *dict to out[] - lzma_ret (*code)(lzma_coder *restrict coder, - lzma_mf *restrict mf, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size); + lzma_ret (*code)(lzma_coder *LZMA_RESTRICT coder, + lzma_mf *LZMA_RESTRICT mf, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size); /// Free allocated resources void (*end)(lzma_coder *coder, lzma_allocator *allocator); diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c index ca14c4a..bd2a737 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c @@ -54,8 +54,8 @@ struct lzma_coder_s { static lzma_ret -lzma2_decode(lzma_coder *restrict coder, lzma_dict *restrict dict, - const uint8_t *restrict in, size_t *restrict in_pos, +lzma2_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dict, + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, size_t in_size) { // With SEQ_LZMA it is possible that no new input is needed to do diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c index 8784f5d..a3651a7 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c @@ -134,8 +134,8 @@ lzma2_header_uncompressed(lzma_coder *coder) static lzma_ret -lzma2_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, - uint8_t *restrict out, size_t *restrict out_pos, +lzma2_encode(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf, + uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos, size_t out_size) { while (*out_pos < out_size) diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c index 1bee2a9..3c0f393 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c @@ -281,9 +281,9 @@ struct lzma_coder_s { static lzma_ret -lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, - const uint8_t *restrict in, - size_t *restrict in_pos, size_t in_size) +lzma_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dictptr, + const uint8_t *LZMA_RESTRICT in, + size_t *LZMA_RESTRICT in_pos, size_t in_size) { /////////////// // Variables // diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c index 6186f83..e8738f4 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c @@ -318,8 +318,8 @@ encode_eopm(lzma_coder *coder, uint32_t position) extern lzma_ret -lzma_lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, - uint8_t *restrict out, size_t *restrict out_pos, +lzma_lzma_encode(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf, + uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos, size_t out_size, uint32_t limit) { uint32_t position; @@ -414,8 +414,8 @@ lzma_lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, static lzma_ret -lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, - uint8_t *restrict out, size_t *restrict out_pos, +lzma_encode(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf, + uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos, size_t out_size) { // Plain LZMA has no support for sync-flushing. diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h index 835e1f5..abb8d8b 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h @@ -44,9 +44,9 @@ extern lzma_ret lzma_lzma_encoder_reset( lzma_coder *coder, const lzma_options_lzma *options); -extern lzma_ret lzma_lzma_encode(lzma_coder *restrict coder, - lzma_mf *restrict mf, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, +extern lzma_ret lzma_lzma_encode(lzma_coder *LZMA_RESTRICT coder, + lzma_mf *LZMA_RESTRICT mf, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, uint32_t read_limit); #endif diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c index 52c26e4..f983126 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c @@ -17,8 +17,8 @@ extern void -lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, - uint32_t *restrict back_res, uint32_t *restrict len_res) +lzma_lzma_optimum_fast(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf, + uint32_t *LZMA_RESTRICT back_res, uint32_t *LZMA_RESTRICT len_res) { const uint8_t *buf; uint32_t buf_avail; diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c index d2829a2..d3a6348 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c @@ -230,8 +230,8 @@ make_short_rep(lzma_optimal *optimal) static void -backward(lzma_coder *restrict coder, uint32_t *restrict len_res, - uint32_t *restrict back_res, uint32_t cur) +backward(lzma_coder *LZMA_RESTRICT coder, uint32_t *LZMA_RESTRICT len_res, + uint32_t *LZMA_RESTRICT back_res, uint32_t cur) { uint32_t pos_mem = coder->opts[cur].pos_prev; uint32_t back_mem = coder->opts[cur].back_prev; @@ -278,8 +278,8 @@ backward(lzma_coder *restrict coder, uint32_t *restrict len_res, ////////// static inline uint32_t -helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, - uint32_t *restrict back_res, uint32_t *restrict len_res, +helper1(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf, + uint32_t *LZMA_RESTRICT back_res, uint32_t *LZMA_RESTRICT len_res, uint32_t position) { uint32_t buf_avail; @@ -865,8 +865,8 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, extern void -lzma_lzma_optimum_normal(lzma_coder *restrict coder, lzma_mf *restrict mf, - uint32_t *restrict back_res, uint32_t *restrict len_res, +lzma_lzma_optimum_normal(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf, + uint32_t *LZMA_RESTRICT back_res, uint32_t *LZMA_RESTRICT len_res, uint32_t position) { uint32_t reps[REP_DISTANCES]; diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h index 6847452..04fb29e 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h @@ -138,11 +138,11 @@ struct lzma_coder_s { extern void lzma_lzma_optimum_fast( - lzma_coder *restrict coder, lzma_mf *restrict mf, - uint32_t *restrict back_res, uint32_t *restrict len_res); + lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf, + uint32_t *LZMA_RESTRICT back_res, uint32_t *LZMA_RESTRICT len_res); -extern void lzma_lzma_optimum_normal(lzma_coder *restrict coder, - lzma_mf *restrict mf, uint32_t *restrict back_res, - uint32_t *restrict len_res, uint32_t position); +extern void lzma_lzma_optimum_normal(lzma_coder *LZMA_RESTRICT coder, + lzma_mf *LZMA_RESTRICT mf, uint32_t *LZMA_RESTRICT back_res, + uint32_t *LZMA_RESTRICT len_res, uint32_t position); #endif diff --git a/Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h b/Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h index fb96180..199e7b5 100644 --- a/Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h +++ b/Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h @@ -26,8 +26,8 @@ typedef struct { /// Reads the first five bytes to initialize the range decoder. static inline bool -rc_read_init(lzma_range_decoder *rc, const uint8_t *restrict in, - size_t *restrict in_pos, size_t in_size) +rc_read_init(lzma_range_decoder *rc, const uint8_t *LZMA_RESTRICT in, + size_t *LZMA_RESTRICT in_pos, size_t in_size) { while (rc->init_bytes_left > 0) { if (*in_pos == in_size) diff --git a/Utilities/cmliblzma/liblzma/simple/simple_coder.c b/Utilities/cmliblzma/liblzma/simple/simple_coder.c index d147d4b..f3bbdd7 100644 --- a/Utilities/cmliblzma/liblzma/simple/simple_coder.c +++ b/Utilities/cmliblzma/liblzma/simple/simple_coder.c @@ -19,9 +19,9 @@ /// Copied or encodes/decodes more data to out[]. static lzma_ret copy_or_code(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { assert(!coder->end_was_reached); @@ -67,9 +67,9 @@ call_filter(lzma_coder *coder, uint8_t *buffer, size_t size) static lzma_ret simple_code(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { size_t out_avail; size_t buf_avail; ----------------------------------------------------------------------- Summary of changes: Utilities/cmliblzma/config.h.in | 6 ++++-- Utilities/cmliblzma/liblzma/common/alone_decoder.c | 6 +++--- Utilities/cmliblzma/liblzma/common/alone_encoder.c | 6 +++--- Utilities/cmliblzma/liblzma/common/auto_decoder.c | 6 +++--- Utilities/cmliblzma/liblzma/common/block_decoder.c | 6 +++--- Utilities/cmliblzma/liblzma/common/block_encoder.c | 6 +++--- Utilities/cmliblzma/liblzma/common/common.c | 6 +++--- Utilities/cmliblzma/liblzma/common/common.h | 12 ++++++------ Utilities/cmliblzma/liblzma/common/index.c | 2 +- Utilities/cmliblzma/liblzma/common/index_decoder.c | 6 +++--- Utilities/cmliblzma/liblzma/common/index_encoder.c | 6 +++--- Utilities/cmliblzma/liblzma/common/stream_decoder.c | 6 +++--- Utilities/cmliblzma/liblzma/common/stream_encoder.c | 6 +++--- Utilities/cmliblzma/liblzma/common/vli_decoder.c | 4 ++-- Utilities/cmliblzma/liblzma/common/vli_encoder.c | 2 +- Utilities/cmliblzma/liblzma/delta/delta_decoder.c | 6 +++--- Utilities/cmliblzma/liblzma/delta/delta_encoder.c | 8 ++++---- Utilities/cmliblzma/liblzma/lz/lz_decoder.c | 12 ++++++------ Utilities/cmliblzma/liblzma/lz/lz_decoder.h | 12 ++++++------ Utilities/cmliblzma/liblzma/lz/lz_encoder.c | 4 ++-- Utilities/cmliblzma/liblzma/lz/lz_encoder.h | 6 +++--- Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c | 4 ++-- Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c | 4 ++-- Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c | 6 +++--- Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c | 8 ++++---- Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h | 6 +++--- .../cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c | 4 ++-- .../cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c | 12 ++++++------ Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h | 10 +++++----- Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h | 4 ++-- Utilities/cmliblzma/liblzma/simple/simple_coder.c | 12 ++++++------ 31 files changed, 103 insertions(+), 101 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 24 10:57:50 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 24 Jul 2014 10:57:50 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4483-g696730b Message-ID: <20140724145750.AED59487CA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 696730b8850263ff439722e7e8cc009179f54a8c (commit) via 28cbcb351cafbebc2fe86a1a3b02561a69106ff5 (commit) from e30740211b432a546e9884149f92df0fb75f1c77 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=696730b8850263ff439722e7e8cc009179f54a8c commit 696730b8850263ff439722e7e8cc009179f54a8c Merge: e307402 28cbcb3 Author: Brad King AuthorDate: Thu Jul 24 10:57:49 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 24 10:57:49 2014 -0400 Merge topic 'add-liblzma' into next 28cbcb35 Help: Add notes for topic 'add-liblzma' http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=28cbcb351cafbebc2fe86a1a3b02561a69106ff5 commit 28cbcb351cafbebc2fe86a1a3b02561a69106ff5 Author: Brad King AuthorDate: Thu Jul 24 10:57:57 2014 -0400 Commit: Brad King CommitDate: Thu Jul 24 10:57:57 2014 -0400 Help: Add notes for topic 'add-liblzma' diff --git a/Help/release/dev/add-liblzma.rst b/Help/release/dev/add-liblzma.rst new file mode 100644 index 0000000..a59ec09 --- /dev/null +++ b/Help/release/dev/add-liblzma.rst @@ -0,0 +1,5 @@ +add-liblzma +----------- + +* The :manual:`cmake(1)` ``-E tar`` command learned to support + lzma-compressed files. ----------------------------------------------------------------------- Summary of changes: Help/release/dev/add-liblzma.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Help/release/dev/add-liblzma.rst hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 24 11:06:07 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 24 Jul 2014 11:06:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4485-g6ea3b0d Message-ID: <20140724150607.CB52348A75@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 6ea3b0d99f179a85fc432a7e710bf2857fc5f7a5 (commit) via da95567b89924c0e217caa04db85c0a1258c16ac (commit) from 696730b8850263ff439722e7e8cc009179f54a8c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6ea3b0d99f179a85fc432a7e710bf2857fc5f7a5 commit 6ea3b0d99f179a85fc432a7e710bf2857fc5f7a5 Merge: 696730b da95567 Author: Brad King AuthorDate: Thu Jul 24 11:06:06 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 24 11:06:06 2014 -0400 Merge topic 'cpack-ifw-generator' into next da95567b Help: Add notes for topic 'cpack-ifw-generator' http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=da95567b89924c0e217caa04db85c0a1258c16ac commit da95567b89924c0e217caa04db85c0a1258c16ac Author: Brad King AuthorDate: Thu Jul 24 11:07:14 2014 -0400 Commit: Brad King CommitDate: Thu Jul 24 11:07:14 2014 -0400 Help: Add notes for topic 'cpack-ifw-generator' diff --git a/Help/release/dev/cpack-ifw-generator.rst b/Help/release/dev/cpack-ifw-generator.rst new file mode 100644 index 0000000..f667136 --- /dev/null +++ b/Help/release/dev/cpack-ifw-generator.rst @@ -0,0 +1,5 @@ +cpack-ifw-generator +------------------- + +* :manual:`cpack(1)` gained an ``IFW`` generator to package using + Qt Framework Installer tools. See the :module:`CPackIFW` module. ----------------------------------------------------------------------- Summary of changes: Help/release/dev/cpack-ifw-generator.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Help/release/dev/cpack-ifw-generator.rst hooks/post-receive -- CMake From bill.hoffman at kitware.com Thu Jul 24 11:32:05 2014 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Thu, 24 Jul 2014 11:32:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4488-gcefe04f Message-ID: <20140724153205.28A5E48BA5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via cefe04f03d6888be7a80509225f2f6f509d445a6 (commit) via 5d40d88e0026824e237938a9e771206220857034 (commit) via afe21fc3c43af0c031a77b3b48041d35f248f481 (commit) from 6ea3b0d99f179a85fc432a7e710bf2857fc5f7a5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cefe04f03d6888be7a80509225f2f6f509d445a6 commit cefe04f03d6888be7a80509225f2f6f509d445a6 Merge: 6ea3b0d 5d40d88 Author: Bill Hoffman AuthorDate: Thu Jul 24 11:32:04 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 24 11:32:04 2014 -0400 Merge topic 'sanitizer_handle_more_pids' into next 5d40d88e Handle more than one process with sanitizer errors. afe21fc3 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5d40d88e0026824e237938a9e771206220857034 commit 5d40d88e0026824e237938a9e771206220857034 Author: Bill Hoffman AuthorDate: Thu Jul 24 11:25:59 2014 -0400 Commit: Bill Hoffman CommitDate: Thu Jul 24 11:25:59 2014 -0400 Handle more than one process with sanitizer errors. Since the Sanitizers write out one log file per process, a single test might have more than one log file. This commit allows ctest to read all of the log files found for a particual test. diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index ed57949..ced7982 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -1127,7 +1127,13 @@ cmCTestMemCheckHandler::PostProcessTest(cmCTestTestResult& res, } else { - this->AppendMemTesterOutput(res, test); + std::vector files; + this->TestOutputFileNames(test, files); + for(std::vector::iterator i = files.begin(); + i != files.end(); ++i) + { + this->AppendMemTesterOutput(res, *i); + } } } @@ -1141,11 +1147,13 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessBoundsCheckerTest for : " << res.Name << std::endl); - std::string ofile = this->TestOutputFileName(test); - if ( ofile.empty() ) + std::vector files; + this->TestOutputFileNames(test, files); + if ( files.size() == 0 ) { return; } + std::string ofile = files[0]; // put a scope around this to close ifs so the file can be removed { cmsys::ifstream ifs(ofile.c_str()); @@ -1175,9 +1183,8 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, void cmCTestMemCheckHandler::AppendMemTesterOutput(cmCTestTestResult& res, - int test) + std::string const& ofile) { - std::string ofile = this->TestOutputFileName(test); if ( ofile.empty() ) { return; @@ -1205,8 +1212,9 @@ cmCTestMemCheckHandler::AppendMemTesterOutput(cmCTestTestResult& res, } } -std::string -cmCTestMemCheckHandler::TestOutputFileName(int test) +void cmCTestMemCheckHandler::TestOutputFileNames(int test, + std::vector& + files) { std::string index; cmOStringStream stream; @@ -1229,7 +1237,8 @@ cmCTestMemCheckHandler::TestOutputFileName(int test) } else { - ofile = g.GetFiles()[0]; + files = g.GetFiles(); + return; } } else if ( !cmSystemTools::FileExists(ofile.c_str()) ) @@ -1239,5 +1248,5 @@ cmCTestMemCheckHandler::TestOutputFileName(int test) cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl); ofile = ""; } - return ofile; + files.push_back(ofile); } diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 2630fde..2195dab 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -145,10 +145,10 @@ private: ///! append MemoryTesterOutputFile to the test log void AppendMemTesterOutput(cmCTestTestHandler::cmCTestTestResult& res, - int test); + std::string const& filename); ///! generate the output filename for the given test index - std::string TestOutputFileName(int test); + void TestOutputFileNames(int test, std::vector& files); }; #endif diff --git a/Tests/CTestTestMemcheck/testLeakSanitizer.cmake b/Tests/CTestTestMemcheck/testLeakSanitizer.cmake index d0e38ce..02030be 100644 --- a/Tests/CTestTestMemcheck/testLeakSanitizer.cmake +++ b/Tests/CTestTestMemcheck/testLeakSanitizer.cmake @@ -11,6 +11,7 @@ endif() # clear the log file file(REMOVE "${LOG_FILE}.2343") +file(REMOVE "${LOG_FILE}.2344") # create an error of each type of thread santizer # these names come from tsan_report.cc in llvm @@ -24,6 +25,12 @@ Direct leak of 4360 byte(s) in 1 object(s) allocated from: #1 0x4823b4 in main /home/kitware/msan/memcheck.cxx:12 #2 0x7fa72bee476c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 +SUMMARY: AddressSanitizer: 4436 byte(s) leaked in 2 allocation(s). +") +file(APPEND "${LOG_FILE}.2342" +"================================================================= +==25308==ERROR: LeakSanitizer: detected memory leaks + Direct leak of 76 byte(s) in 1 object(s) allocated from: #0 0x46c669 in operator new[](unsigned long) (/home/kitware/msan/a.out+0x46c669) #1 0x4821b8 in foo() /home/kitware/msan/memcheck.cxx:4 ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- Source/CTest/cmCTestMemCheckHandler.cxx | 27 +++++++++++++++-------- Source/CTest/cmCTestMemCheckHandler.h | 4 ++-- Tests/CTestTestMemcheck/testLeakSanitizer.cmake | 7 ++++++ 4 files changed, 28 insertions(+), 12 deletions(-) hooks/post-receive -- CMake From bill.hoffman at kitware.com Thu Jul 24 11:34:49 2014 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Thu, 24 Jul 2014 11:34:49 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4490-g807661b Message-ID: <20140724153449.73FF548BFA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 807661bce77368f303b4b5b95f41fd2c4e3131f2 (commit) via 0e88b1d6d92b32b767dff33109855f079a272f00 (commit) from cefe04f03d6888be7a80509225f2f6f509d445a6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=807661bce77368f303b4b5b95f41fd2c4e3131f2 commit 807661bce77368f303b4b5b95f41fd2c4e3131f2 Merge: cefe04f 0e88b1d Author: Bill Hoffman AuthorDate: Thu Jul 24 11:34:48 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 24 11:34:48 2014 -0400 Merge topic 'fix_qt4_automoc_leak' into next 0e88b1d6 Fix memory leak of local generator detected by LeakSanitizer. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0e88b1d6d92b32b767dff33109855f079a272f00 commit 0e88b1d6d92b32b767dff33109855f079a272f00 Author: Bill Hoffman AuthorDate: Thu Jul 24 11:33:54 2014 -0400 Commit: Bill Hoffman CommitDate: Thu Jul 24 11:33:54 2014 -0400 Fix memory leak of local generator detected by LeakSanitizer. diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index cc6932d..d4d565c 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1000,6 +1000,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory, this->WriteOldMocDefinitionsFile(targetDirectory); + delete gg->GetCurrentLocalGenerator(); delete gg; gg = NULL; makefile = NULL; ----------------------------------------------------------------------- Summary of changes: Source/cmQtAutoGenerators.cxx | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 24 12:48:29 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 24 Jul 2014 12:48:29 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4492-ga790821 Message-ID: <20140724164829.A44C347DE1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via a79082165eb56ae51dddb7d9a68b45fd9dea1184 (commit) via 051fb2e22fedccd6ecc9bd6840c8ee6bcc1b26af (commit) from 807661bce77368f303b4b5b95f41fd2c4e3131f2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a79082165eb56ae51dddb7d9a68b45fd9dea1184 commit a79082165eb56ae51dddb7d9a68b45fd9dea1184 Merge: 807661b 051fb2e Author: Brad King AuthorDate: Thu Jul 24 12:48:28 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 24 12:48:28 2014 -0400 Merge topic 'fix-broken-re-cmake' into next 051fb2e2 Revert "cmake: Avoid overwriting compiler name if specified repeatedly." http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=051fb2e22fedccd6ecc9bd6840c8ee6bcc1b26af commit 051fb2e22fedccd6ecc9bd6840c8ee6bcc1b26af Author: Brad King AuthorDate: Thu Jul 24 12:49:33 2014 -0400 Commit: Brad King CommitDate: Thu Jul 24 12:49:33 2014 -0400 Revert "cmake: Avoid overwriting compiler name if specified repeatedly." This reverts commit a12e4e782c9c8d290071a3fb8f8abcf5cba24afe. We will use another approach to resolve this problem. diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 3e4ae17..a051c87 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -355,36 +355,6 @@ bool cmake::SetCacheArgs(const std::vector& args) } } - cmsys::RegularExpression compilerRex("^CMAKE_[a-zA-Z]+_COMPILER$"); - if (compilerRex.find(var)) - { - std::string newVal = cmSystemTools::FindProgram(value.c_str()); - const char* existing = - this->CacheManager->GetCacheValue(var.c_str()); - if (existing && existing == newVal) - { - // Repeated invocation of cmake with arguments specifying a - // compiler, such as -DCMAKE_CXX_COMPILER=clang++, should not - // re-populate the cache with the un-resolved name. On the - // first run of cmake, the CMakeDetermineCXXCompiler.cmake logic - // is executed and the result is resolved to a full path and - // cached, On subsequent runs of cmake, we wish to avoid - // re-executing the CMakeDetermineCXXCompiler.cmake logic. - // The cmGlobalGenerator::ResolveLanguageCompiler method is - // responsible for ensuring that the cache is deleted if the - // value in the cache is changed. - // A scripting environment can invoke cmake on the command line - // with arguments specifying the compiler in a way which is - // intended to give reproducible results. Ignore the value - // specified on the command line if it results in the same - // value as is already in the cache. Otherwise, - // cmMakefile::AddCacheDefinition would use CollapseFullPath on - // the entry, incorrectly resolving 'clang++' to - // '/clang++', which is unlikely to exist. - continue; - } - } - this->CacheManager->AddCacheEntry(var, value.c_str(), "No help, variable specified on the command line.", type); ----------------------------------------------------------------------- Summary of changes: Source/cmake.cxx | 30 ------------------------------ 1 file changed, 30 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 24 13:41:18 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 24 Jul 2014 13:41:18 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4495-g3a60ea4 Message-ID: <20140724174118.37BC0478A1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 3a60ea462359e6ef58a914d89cef3226229b43d0 (commit) via 8981513a810a97d10e299407e12c46aabe68f00a (commit) via 731427a646cd0ca81aa392872d18d125e917bf47 (commit) from a79082165eb56ae51dddb7d9a68b45fd9dea1184 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3a60ea462359e6ef58a914d89cef3226229b43d0 commit 3a60ea462359e6ef58a914d89cef3226229b43d0 Merge: a790821 8981513 Author: Brad King AuthorDate: Thu Jul 24 13:41:17 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 24 13:41:17 2014 -0400 Merge topic 'fix-re-cmake-with-compiler' into next 8981513a CMakeDetermineCompiler: Simplify CMAKE__COMPILER default force-cache 731427a6 cmGlobalGenerator: Do not re-add CMAKE__COMPILER http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8981513a810a97d10e299407e12c46aabe68f00a commit 8981513a810a97d10e299407e12c46aabe68f00a Author: Brad King AuthorDate: Thu Jul 24 13:10:05 2014 -0400 Commit: Brad King CommitDate: Thu Jul 24 13:37:07 2014 -0400 CMakeDetermineCompiler: Simplify CMAKE__COMPILER default force-cache If find_program does not find CMAKE__COMPILER, use set_property() to force the value to be that of CMAKE__COMPILER_INIT instead of set(). This allows us to set the value without re-specifying the type and documentation, thus preserving what find_program set. diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake index cd0f8b8..0ab3af6 100644 --- a/Modules/CMakeDetermineCompiler.cmake +++ b/Modules/CMakeDetermineCompiler.cmake @@ -65,7 +65,7 @@ macro(_cmake_find_compiler lang) endif() find_program(CMAKE_${lang}_COMPILER NAMES ${CMAKE_${lang}_COMPILER_LIST} DOC "${lang} compiler") if(CMAKE_${lang}_COMPILER_INIT AND NOT CMAKE_${lang}_COMPILER) - set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_INIT}" CACHE FILEPATH "${lang} compiler" FORCE) + set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${CMAKE_${lang}_COMPILER_INIT}") endif() unset(_${lang}_COMPILER_HINTS) unset(_languages) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=731427a646cd0ca81aa392872d18d125e917bf47 commit 731427a646cd0ca81aa392872d18d125e917bf47 Author: Brad King AuthorDate: Thu Jul 24 12:44:05 2014 -0400 Commit: Brad King CommitDate: Thu Jul 24 13:31:14 2014 -0400 cmGlobalGenerator: Do not re-add CMAKE__COMPILER The cmGlobalGenerator::ResolveLanguageCompiler method, invoked only by Makefile generators, contains code originally added by commit v2.4.0~796 (..., add new generators for msys and mingw, 2005-12-22) to compute the full path to the compiler and save the result back into the cache value. Since then the CMakeDetermine*Compiler modules have learned to resolve the full path to the compiler and save it in CMake*Compiler.cmake files configured in the build tree. The value of CMAKE__COMPILER in the cache is now only for reference of what the user originally specified. The full path is now available in a normal variable of the same name, and this is used by project code and the generators. When the user specifies -DCMAKE__COMPILER=name on the command-line of an existing build tree that uses a Makefile generator, it is first stored in the cache with an uninitialized type. Then later when ResolveLanguageCompiler updates the cache entry and sets the type to FILEPATH, cmMakefile::AddCacheDefinition does CollapseFullPath on the "name" and ends up with something like "$PWD/name" which is unlikely to be correct. Furthermore, cmMakefile::AddCacheDefinition proceeds to remove the normal variable of the same name, so the value originally saved in CMakeCompiler.cmake is ignored and the generators use the wrong path to the compiler. Resolve this by dropping the code from ResolveLanguageCompiler that touches the cache value of CMAKE__COMPILER. As explained above it is no longer needed anyway. diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ae6861e..249373c 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -148,8 +148,6 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, { return; } - std::string doc = lang; - doc += " compiler."; const char* cname = this->GetCMakeInstance()-> GetCacheManager()->GetCacheValue(langComp); std::string changeVars; @@ -186,8 +184,6 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, changeVars.c_str()); } } - mf->AddCacheDefinition(langComp, path.c_str(), - doc.c_str(), cmCacheManager::FILEPATH); } void cmGlobalGenerator::AddBuildExportSet(cmExportBuildFileGenerator* gen) ----------------------------------------------------------------------- Summary of changes: Modules/CMakeDetermineCompiler.cmake | 2 +- Source/cmGlobalGenerator.cxx | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Jul 24 13:43:51 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 24 Jul 2014 13:43:51 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4498-g74bdbe6 Message-ID: <20140724174351.311CE47D61@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 74bdbe6e7400afc49a7223295cf0e5e078b1c478 (commit) via 1342e0222fed06f748f266a3a4e82c907cb76726 (commit) via 6f5581c105d59ed00cc065b9ab9b3c8c0a441db3 (commit) from 3a60ea462359e6ef58a914d89cef3226229b43d0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=74bdbe6e7400afc49a7223295cf0e5e078b1c478 commit 74bdbe6e7400afc49a7223295cf0e5e078b1c478 Merge: 3a60ea4 1342e02 Author: Brad King AuthorDate: Thu Jul 24 13:43:50 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 24 13:43:50 2014 -0400 Merge topic 'FindImageMagick-arch-include-dir' into next 1342e022 FindImageMagick: Provide per-component include dirs (#15007) 6f5581c1 FindImageMagick: Find arch include dir (#15007) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1342e0222fed06f748f266a3a4e82c907cb76726 commit 1342e0222fed06f748f266a3a4e82c907cb76726 Author: Brad King AuthorDate: Wed Jul 23 15:33:48 2014 -0400 Commit: Brad King CommitDate: Wed Jul 23 15:33:48 2014 -0400 FindImageMagick: Provide per-component include dirs (#15007) Set the ImageMagick__INCLUDE_DIRS variable that is mentioned in the documentation but was not set before. diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake index 33f95ce..65458b7 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -143,13 +143,20 @@ function(FIND_IMAGEMAGICK_API component header) if(ImageMagick_${component}_INCLUDE_DIR AND ImageMagick_${component}_LIBRARY) set(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE) - list(APPEND ImageMagick_INCLUDE_DIRS + # Construct per-component include directories. + set(ImageMagick_${component}_INCLUDE_DIRS ${ImageMagick_${component}_INCLUDE_DIR} ) if(ImageMagick_${component}_ARCH_INCLUDE_DIR) - list(APPEND ImageMagick_INCLUDE_DIRS + list(APPEND ImageMagick_${component}_INCLUDE_DIRS ${ImageMagick_${component}_ARCH_INCLUDE_DIR}) endif() + list(REMOVE_DUPLICATES ImageMagick_${component}_INCLUDE_DIRS) + set(ImageMagick_${component}_INCLUDE_DIRS + ${ImageMagick_${component}_INCLUDE_DIRS} PARENT_SCOPE) + + # Add the per-component include directories to the full include dirs. + list(APPEND ImageMagick_INCLUDE_DIRS ${ImageMagick_${component}_INCLUDE_DIRS}) list(REMOVE_DUPLICATES ImageMagick_INCLUDE_DIRS) set(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS} PARENT_SCOPE) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6f5581c105d59ed00cc065b9ab9b3c8c0a441db3 commit 6f5581c105d59ed00cc065b9ab9b3c8c0a441db3 Author: bastien ROUCARIES AuthorDate: Tue Jul 22 22:24:15 2014 +0200 Commit: Brad King CommitDate: Wed Jul 23 09:44:55 2014 -0400 FindImageMagick: Find arch include dir (#15007) diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake index f6c8b3a..33f95ce 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -115,7 +115,19 @@ function(FIND_IMAGEMAGICK_API component header) "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include" PATH_SUFFIXES ImageMagick ImageMagick-6 - DOC "Path to the ImageMagick include dir." + DOC "Path to the ImageMagick arch-independent include dir." + ) + find_path(ImageMagick_${component}_ARCH_INCLUDE_DIR + NAMES magick/magick-baseconfig.h + HINTS + ${PC_${component}_INCLUDEDIR} + ${PC_${component}_INCLUDE_DIRS} + PATHS + ${ImageMagick_INCLUDE_DIRS} + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include" + PATH_SUFFIXES + ImageMagick ImageMagick-6 + DOC "Path to the ImageMagick arch-specific include dir." ) find_library(ImageMagick_${component}_LIBRARY NAMES ${ARGN} @@ -127,12 +139,17 @@ function(FIND_IMAGEMAGICK_API component header) DOC "Path to the ImageMagick Magick++ library." ) + # old version have only indep dir if(ImageMagick_${component}_INCLUDE_DIR AND ImageMagick_${component}_LIBRARY) set(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE) list(APPEND ImageMagick_INCLUDE_DIRS ${ImageMagick_${component}_INCLUDE_DIR} ) + if(ImageMagick_${component}_ARCH_INCLUDE_DIR) + list(APPEND ImageMagick_INCLUDE_DIRS + ${ImageMagick_${component}_ARCH_INCLUDE_DIR}) + endif() list(REMOVE_DUPLICATES ImageMagick_INCLUDE_DIRS) set(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS} PARENT_SCOPE) ----------------------------------------------------------------------- Summary of changes: Modules/FindImageMagick.cmake | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Thu Jul 24 16:31:55 2014 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Thu, 24 Jul 2014 16:31:55 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4501-g6b02906 Message-ID: <20140724203155.6C91E4863C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 6b02906522196cfc2f8c9c29fb3f483d6d5b61ff (commit) via 5e902985975f99a54522044f7e920cd881e91a4e (commit) via a6effabaa53f0ca3db31a81b50f7e99a9b2b976c (commit) from 74bdbe6e7400afc49a7223295cf0e5e078b1c478 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6b02906522196cfc2f8c9c29fb3f483d6d5b61ff commit 6b02906522196cfc2f8c9c29fb3f483d6d5b61ff Merge: 74bdbe6 5e90298 Author: Nils Gladitz AuthorDate: Thu Jul 24 16:31:54 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 24 16:31:54 2014 -0400 Merge topic 'pdb-genex' into next 5e902985 Genex: Implement generator expressions for target PDB files. a6effaba Genex: Simplify filesytem artifact code http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5e902985975f99a54522044f7e920cd881e91a4e commit 5e902985975f99a54522044f7e920cd881e91a4e Author: Nils Gladitz AuthorDate: Thu Jul 24 22:18:21 2014 +0200 Commit: Nils Gladitz CommitDate: Thu Jul 24 22:18:21 2014 +0200 Genex: Implement generator expressions for target PDB files. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index bc24798..4f55687 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -148,6 +148,12 @@ than 4.2.0. Name of file with soname (.so.3). ``$`` Directory of with soname (.so.3). +``$`` + Full path to program database file (.pdb) where ``tgt`` is the name of a target. +``$`` + Name of program database file (.pdb). +``$`` + Directory of program database file (.pdb). ``$`` Value of the property ``prop`` on the target ``tgt``. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 7e77e4a..8c7c53b 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1512,6 +1512,7 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode class ArtifactNameTag; class ArtifactLinkerTag; class ArtifactSonameTag; +class ArtifactPdbTag; class ArtifactPathTag; class ArtifactDirTag; @@ -1558,6 +1559,21 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) + { + std::string result = target->GetPDBDirectory(context->Config); + result += "/"; + result += target->GetPDBName(context->Config); + return result; + } +}; + +//---------------------------------------------------------------------------- +template<> struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, @@ -1702,6 +1718,9 @@ TargetFilesystemArtifactNodeGroup targetLinkerNodeGroup; static const TargetFilesystemArtifactNodeGroup targetSoNameNodeGroup; +static const +TargetFilesystemArtifactNodeGroup targetPdbNodeGroup; + //---------------------------------------------------------------------------- static const cmGeneratorExpressionNode* GetNode(const std::string &identifier) @@ -1729,12 +1748,15 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) nodeMap["TARGET_FILE"] = &targetNodeGroup.File; nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File; nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File; + nodeMap["TARGET_PDB_FILE"] = &targetPdbNodeGroup.File; nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName; nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName; nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName; + nodeMap["TARGET_PDB_FILE_NAME"] = &targetPdbNodeGroup.FileName; nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir; nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; + nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir; nodeMap["STREQUAL"] = &strEqualNode; nodeMap["EQUAL"] = &equalNode; nodeMap["LOWER_CASE"] = &lowerCaseNode; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6effabaa53f0ca3db31a81b50f7e99a9b2b976c commit a6effabaa53f0ca3db31a81b50f7e99a9b2b976c Author: Nils Gladitz AuthorDate: Thu Jul 24 21:36:21 2014 +0200 Commit: Nils Gladitz CommitDate: Thu Jul 24 21:36:21 2014 +0200 Genex: Simplify filesytem artifact code diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 28879f1..7e77e4a 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1509,7 +1509,16 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode } installPrefixNode; //---------------------------------------------------------------------------- -template +class ArtifactNameTag; +class ArtifactLinkerTag; +class ArtifactSonameTag; + +class ArtifactPathTag; +class ArtifactDirTag; +class ArtifactNameTag; + +//---------------------------------------------------------------------------- +template struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, @@ -1519,7 +1528,7 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultCreator +struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, cmGeneratorExpressionContext *context, @@ -1549,7 +1558,7 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultCreator +struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, cmGeneratorExpressionContext *context, @@ -1570,7 +1579,7 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultCreator +struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, cmGeneratorExpressionContext *context, @@ -1582,7 +1591,7 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- -template +template struct TargetFilesystemArtifactResultGetter { static std::string Get(const std::string &result); @@ -1590,7 +1599,7 @@ struct TargetFilesystemArtifactResultGetter //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultGetter +struct TargetFilesystemArtifactResultGetter { static std::string Get(const std::string &result) { return cmSystemTools::GetFilenameName(result); } @@ -1598,7 +1607,7 @@ struct TargetFilesystemArtifactResultGetter //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultGetter +struct TargetFilesystemArtifactResultGetter { static std::string Get(const std::string &result) { return cmSystemTools::GetFilenamePath(result); } @@ -1606,14 +1615,14 @@ struct TargetFilesystemArtifactResultGetter //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultGetter +struct TargetFilesystemArtifactResultGetter { static std::string Get(const std::string &result) { return result; } }; //---------------------------------------------------------------------------- -template +template struct TargetFilesystemArtifact : public cmGeneratorExpressionNode { TargetFilesystemArtifact() {} @@ -1661,7 +1670,7 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode context->AllTargets.insert(target); std::string result = - TargetFilesystemArtifactResultCreator::Create( + TargetFilesystemArtifactResultCreator::Create( target, context, content); @@ -1670,29 +1679,28 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode return std::string(); } return - TargetFilesystemArtifactResultGetter::Get(result); + TargetFilesystemArtifactResultGetter::Get(result); } }; //---------------------------------------------------------------------------- +template +struct TargetFilesystemArtifactNodeGroup +{ + TargetFilesystemArtifact File; + TargetFilesystemArtifact FileName; + TargetFilesystemArtifact FileDir; +}; + +//---------------------------------------------------------------------------- static const -TargetFilesystemArtifact targetFileNode; -static const -TargetFilesystemArtifact targetLinkerFileNode; -static const -TargetFilesystemArtifact targetSoNameFileNode; -static const -TargetFilesystemArtifact targetFileNameNode; -static const -TargetFilesystemArtifact targetLinkerFileNameNode; -static const -TargetFilesystemArtifact targetSoNameFileNameNode; -static const -TargetFilesystemArtifact targetFileDirNode; +TargetFilesystemArtifactNodeGroup targetNodeGroup; + static const -TargetFilesystemArtifact targetLinkerFileDirNode; +TargetFilesystemArtifactNodeGroup targetLinkerNodeGroup; + static const -TargetFilesystemArtifact targetSoNameFileDirNode; +TargetFilesystemArtifactNodeGroup targetSoNameNodeGroup; //---------------------------------------------------------------------------- static const @@ -1718,15 +1726,15 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) nodeMap["COMPILE_FEATURES"] = &compileFeaturesNode; nodeMap["CONFIGURATION"] = &configurationNode; nodeMap["CONFIG"] = &configurationTestNode; - nodeMap["TARGET_FILE"] = &targetFileNode; - nodeMap["TARGET_LINKER_FILE"] = &targetLinkerFileNode; - nodeMap["TARGET_SONAME_FILE"] = &targetSoNameFileNode; - nodeMap["TARGET_FILE_NAME"] = &targetFileNameNode; - nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerFileNameNode; - nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameFileNameNode; - nodeMap["TARGET_FILE_DIR"] = &targetFileDirNode; - nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerFileDirNode; - nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameFileDirNode; + nodeMap["TARGET_FILE"] = &targetNodeGroup.File; + nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File; + nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File; + nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName; + nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName; + nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName; + nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir; + nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; + nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; nodeMap["STREQUAL"] = &strEqualNode; nodeMap["EQUAL"] = &equalNode; nodeMap["LOWER_CASE"] = &lowerCaseNode; ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 6 ++ Source/cmGeneratorExpressionEvaluator.cxx | 98 ++++++++++++++++--------- 2 files changed, 70 insertions(+), 34 deletions(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Thu Jul 24 16:46:45 2014 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Thu, 24 Jul 2014 16:46:45 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4503-g58587a8 Message-ID: <20140724204645.2175E47EE7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 58587a8eb5cfe70478b8890980474f342e702421 (commit) via 1c5847871b490a0335d713f858e4f2ccc3fb2215 (commit) from 6b02906522196cfc2f8c9c29fb3f483d6d5b61ff (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=58587a8eb5cfe70478b8890980474f342e702421 commit 58587a8eb5cfe70478b8890980474f342e702421 Merge: 6b02906 1c58478 Author: Nils Gladitz AuthorDate: Thu Jul 24 16:46:44 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 24 16:46:44 2014 -0400 Merge topic 'pdb-genex' into next 1c584787 Genex: Fix unused parameter warning http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1c5847871b490a0335d713f858e4f2ccc3fb2215 commit 1c5847871b490a0335d713f858e4f2ccc3fb2215 Author: Nils Gladitz AuthorDate: Thu Jul 24 22:46:26 2014 +0200 Commit: Nils Gladitz CommitDate: Thu Jul 24 22:46:26 2014 +0200 Genex: Fix unused parameter warning diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 8c7c53b..0477afb 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1563,7 +1563,7 @@ struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content) + const GeneratorExpressionContent *) { std::string result = target->GetPDBDirectory(context->Config); result += "/"; ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpressionEvaluator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Thu Jul 24 16:47:35 2014 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Thu, 24 Jul 2014 16:47:35 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4505-g967d9be Message-ID: <20140724204735.04DA147FA6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 967d9be1cca9681872aeaf91f5a3b099e8e3b253 (commit) via a77ed8bfb8b9fae0b66e39d07de563b6991210c7 (commit) from 58587a8eb5cfe70478b8890980474f342e702421 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=967d9be1cca9681872aeaf91f5a3b099e8e3b253 commit 967d9be1cca9681872aeaf91f5a3b099e8e3b253 Merge: 58587a8 a77ed8b Author: Nils Gladitz AuthorDate: Thu Jul 24 16:47:34 2014 -0400 Commit: CMake Topic Stage CommitDate: Thu Jul 24 16:47:34 2014 -0400 Merge topic 'pdb-genex' into next a77ed8bf Genex: Implement generator expressions for target PDB files. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a77ed8bfb8b9fae0b66e39d07de563b6991210c7 commit a77ed8bfb8b9fae0b66e39d07de563b6991210c7 Author: Nils Gladitz AuthorDate: Thu Jul 24 22:18:21 2014 +0200 Commit: Nils Gladitz CommitDate: Thu Jul 24 22:47:14 2014 +0200 Genex: Implement generator expressions for target PDB files. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index bc24798..4f55687 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -148,6 +148,12 @@ than 4.2.0. Name of file with soname (.so.3). ``$`` Directory of with soname (.so.3). +``$`` + Full path to program database file (.pdb) where ``tgt`` is the name of a target. +``$`` + Name of program database file (.pdb). +``$`` + Directory of program database file (.pdb). ``$`` Value of the property ``prop`` on the target ``tgt``. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 7e77e4a..0477afb 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1512,6 +1512,7 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode class ArtifactNameTag; class ArtifactLinkerTag; class ArtifactSonameTag; +class ArtifactPdbTag; class ArtifactPathTag; class ArtifactDirTag; @@ -1558,6 +1559,21 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *) + { + std::string result = target->GetPDBDirectory(context->Config); + result += "/"; + result += target->GetPDBName(context->Config); + return result; + } +}; + +//---------------------------------------------------------------------------- +template<> struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, @@ -1702,6 +1718,9 @@ TargetFilesystemArtifactNodeGroup targetLinkerNodeGroup; static const TargetFilesystemArtifactNodeGroup targetSoNameNodeGroup; +static const +TargetFilesystemArtifactNodeGroup targetPdbNodeGroup; + //---------------------------------------------------------------------------- static const cmGeneratorExpressionNode* GetNode(const std::string &identifier) @@ -1729,12 +1748,15 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) nodeMap["TARGET_FILE"] = &targetNodeGroup.File; nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File; nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File; + nodeMap["TARGET_PDB_FILE"] = &targetPdbNodeGroup.File; nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName; nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName; nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName; + nodeMap["TARGET_PDB_FILE_NAME"] = &targetPdbNodeGroup.FileName; nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir; nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; + nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir; nodeMap["STREQUAL"] = &strEqualNode; nodeMap["EQUAL"] = &equalNode; nodeMap["LOWER_CASE"] = &lowerCaseNode; ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jul 25 00:01:09 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 25 Jul 2014 00:01:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1485-g4d7b937 Message-ID: <20140725040109.9560A4823D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 4d7b9375b0a56a78a6cfa823069cc57e37fe9766 (commit) from afe21fc3c43af0c031a77b3b48041d35f248f481 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4d7b9375b0a56a78a6cfa823069cc57e37fe9766 commit 4d7b9375b0a56a78a6cfa823069cc57e37fe9766 Author: Kitware Robot AuthorDate: Fri Jul 25 00:01:07 2014 -0400 Commit: Kitware Robot CommitDate: Fri Jul 25 00:01:07 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 054cf09..4f38f7d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140724) +set(CMake_VERSION_PATCH 20140725) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Fri Jul 25 03:09:42 2014 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Fri, 25 Jul 2014 03:09:42 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4507-g9f9a93b Message-ID: <20140725070942.F3C4A3FC0B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 9f9a93bdbfbcba4eec454eaf87b36e9aab444708 (commit) via 2e355be3e1ed4e4377102447a6f13b18af5e3853 (commit) from 967d9be1cca9681872aeaf91f5a3b099e8e3b253 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9f9a93bdbfbcba4eec454eaf87b36e9aab444708 commit 9f9a93bdbfbcba4eec454eaf87b36e9aab444708 Merge: 967d9be 2e355be Author: Nils Gladitz AuthorDate: Fri Jul 25 03:09:42 2014 -0400 Commit: CMake Topic Stage CommitDate: Fri Jul 25 03:09:42 2014 -0400 Merge topic 'pdb-genex' into next 2e355be3 Genex: Provide user defined default constructor http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2e355be3e1ed4e4377102447a6f13b18af5e3853 commit 2e355be3e1ed4e4377102447a6f13b18af5e3853 Author: Nils Gladitz AuthorDate: Fri Jul 25 09:08:27 2014 +0200 Commit: Nils Gladitz CommitDate: Fri Jul 25 09:08:27 2014 +0200 Genex: Provide user defined default constructor diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 0477afb..e3a7681 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1703,6 +1703,10 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode template struct TargetFilesystemArtifactNodeGroup { + TargetFilesystemArtifactNodeGroup() + { + } + TargetFilesystemArtifact File; TargetFilesystemArtifact FileName; TargetFilesystemArtifact FileDir; ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpressionEvaluator.cxx | 4 ++++ 1 file changed, 4 insertions(+) hooks/post-receive -- CMake From nilsgladitz at gmail.com Fri Jul 25 03:10:40 2014 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Fri, 25 Jul 2014 03:10:40 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4510-g500c21d Message-ID: <20140725071040.5B0BD475A9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 500c21da7f1427ad29e46d6c0dedc18d2a2d9044 (commit) via b43933af38a14c3c27e548346b89d9c228ff7f37 (commit) via dc131438fc2a6d93dde20534407e31af162a862f (commit) from 9f9a93bdbfbcba4eec454eaf87b36e9aab444708 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=500c21da7f1427ad29e46d6c0dedc18d2a2d9044 commit 500c21da7f1427ad29e46d6c0dedc18d2a2d9044 Merge: 9f9a93b b43933a Author: Nils Gladitz AuthorDate: Fri Jul 25 03:10:39 2014 -0400 Commit: CMake Topic Stage CommitDate: Fri Jul 25 03:10:39 2014 -0400 Merge topic 'pdb-genex' into next b43933af Genex: Implement generator expressions for target PDB files. dc131438 Genex: Simplify filesytem artifact code http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b43933af38a14c3c27e548346b89d9c228ff7f37 commit b43933af38a14c3c27e548346b89d9c228ff7f37 Author: Nils Gladitz AuthorDate: Thu Jul 24 22:18:21 2014 +0200 Commit: Nils Gladitz CommitDate: Fri Jul 25 09:10:07 2014 +0200 Genex: Implement generator expressions for target PDB files. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index bc24798..4f55687 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -148,6 +148,12 @@ than 4.2.0. Name of file with soname (.so.3). ``$`` Directory of with soname (.so.3). +``$`` + Full path to program database file (.pdb) where ``tgt`` is the name of a target. +``$`` + Name of program database file (.pdb). +``$`` + Directory of program database file (.pdb). ``$`` Value of the property ``prop`` on the target ``tgt``. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 6f940a6..e3a7681 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1512,6 +1512,7 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode class ArtifactNameTag; class ArtifactLinkerTag; class ArtifactSonameTag; +class ArtifactPdbTag; class ArtifactPathTag; class ArtifactDirTag; @@ -1558,6 +1559,21 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *) + { + std::string result = target->GetPDBDirectory(context->Config); + result += "/"; + result += target->GetPDBName(context->Config); + return result; + } +}; + +//---------------------------------------------------------------------------- +template<> struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, @@ -1706,6 +1722,9 @@ TargetFilesystemArtifactNodeGroup targetLinkerNodeGroup; static const TargetFilesystemArtifactNodeGroup targetSoNameNodeGroup; +static const +TargetFilesystemArtifactNodeGroup targetPdbNodeGroup; + //---------------------------------------------------------------------------- static const cmGeneratorExpressionNode* GetNode(const std::string &identifier) @@ -1733,12 +1752,15 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) nodeMap["TARGET_FILE"] = &targetNodeGroup.File; nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File; nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File; + nodeMap["TARGET_PDB_FILE"] = &targetPdbNodeGroup.File; nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName; nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName; nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName; + nodeMap["TARGET_PDB_FILE_NAME"] = &targetPdbNodeGroup.FileName; nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir; nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; + nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir; nodeMap["STREQUAL"] = &strEqualNode; nodeMap["EQUAL"] = &equalNode; nodeMap["LOWER_CASE"] = &lowerCaseNode; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc131438fc2a6d93dde20534407e31af162a862f commit dc131438fc2a6d93dde20534407e31af162a862f Author: Nils Gladitz AuthorDate: Thu Jul 24 21:36:21 2014 +0200 Commit: Nils Gladitz CommitDate: Fri Jul 25 09:10:07 2014 +0200 Genex: Simplify filesytem artifact code diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 28879f1..6f940a6 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1509,7 +1509,16 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode } installPrefixNode; //---------------------------------------------------------------------------- -template +class ArtifactNameTag; +class ArtifactLinkerTag; +class ArtifactSonameTag; + +class ArtifactPathTag; +class ArtifactDirTag; +class ArtifactNameTag; + +//---------------------------------------------------------------------------- +template struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, @@ -1519,7 +1528,7 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultCreator +struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, cmGeneratorExpressionContext *context, @@ -1549,7 +1558,7 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultCreator +struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, cmGeneratorExpressionContext *context, @@ -1570,7 +1579,7 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultCreator +struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, cmGeneratorExpressionContext *context, @@ -1582,7 +1591,7 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- -template +template struct TargetFilesystemArtifactResultGetter { static std::string Get(const std::string &result); @@ -1590,7 +1599,7 @@ struct TargetFilesystemArtifactResultGetter //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultGetter +struct TargetFilesystemArtifactResultGetter { static std::string Get(const std::string &result) { return cmSystemTools::GetFilenameName(result); } @@ -1598,7 +1607,7 @@ struct TargetFilesystemArtifactResultGetter //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultGetter +struct TargetFilesystemArtifactResultGetter { static std::string Get(const std::string &result) { return cmSystemTools::GetFilenamePath(result); } @@ -1606,14 +1615,14 @@ struct TargetFilesystemArtifactResultGetter //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultGetter +struct TargetFilesystemArtifactResultGetter { static std::string Get(const std::string &result) { return result; } }; //---------------------------------------------------------------------------- -template +template struct TargetFilesystemArtifact : public cmGeneratorExpressionNode { TargetFilesystemArtifact() {} @@ -1661,7 +1670,7 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode context->AllTargets.insert(target); std::string result = - TargetFilesystemArtifactResultCreator::Create( + TargetFilesystemArtifactResultCreator::Create( target, context, content); @@ -1670,29 +1679,32 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode return std::string(); } return - TargetFilesystemArtifactResultGetter::Get(result); + TargetFilesystemArtifactResultGetter::Get(result); } }; //---------------------------------------------------------------------------- +template +struct TargetFilesystemArtifactNodeGroup +{ + TargetFilesystemArtifactNodeGroup() + { + } + + TargetFilesystemArtifact File; + TargetFilesystemArtifact FileName; + TargetFilesystemArtifact FileDir; +}; + +//---------------------------------------------------------------------------- static const -TargetFilesystemArtifact targetFileNode; -static const -TargetFilesystemArtifact targetLinkerFileNode; -static const -TargetFilesystemArtifact targetSoNameFileNode; -static const -TargetFilesystemArtifact targetFileNameNode; -static const -TargetFilesystemArtifact targetLinkerFileNameNode; -static const -TargetFilesystemArtifact targetSoNameFileNameNode; -static const -TargetFilesystemArtifact targetFileDirNode; +TargetFilesystemArtifactNodeGroup targetNodeGroup; + static const -TargetFilesystemArtifact targetLinkerFileDirNode; +TargetFilesystemArtifactNodeGroup targetLinkerNodeGroup; + static const -TargetFilesystemArtifact targetSoNameFileDirNode; +TargetFilesystemArtifactNodeGroup targetSoNameNodeGroup; //---------------------------------------------------------------------------- static const @@ -1718,15 +1730,15 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) nodeMap["COMPILE_FEATURES"] = &compileFeaturesNode; nodeMap["CONFIGURATION"] = &configurationNode; nodeMap["CONFIG"] = &configurationTestNode; - nodeMap["TARGET_FILE"] = &targetFileNode; - nodeMap["TARGET_LINKER_FILE"] = &targetLinkerFileNode; - nodeMap["TARGET_SONAME_FILE"] = &targetSoNameFileNode; - nodeMap["TARGET_FILE_NAME"] = &targetFileNameNode; - nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerFileNameNode; - nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameFileNameNode; - nodeMap["TARGET_FILE_DIR"] = &targetFileDirNode; - nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerFileDirNode; - nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameFileDirNode; + nodeMap["TARGET_FILE"] = &targetNodeGroup.File; + nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File; + nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File; + nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName; + nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName; + nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName; + nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir; + nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; + nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; nodeMap["STREQUAL"] = &strEqualNode; nodeMap["EQUAL"] = &equalNode; nodeMap["LOWER_CASE"] = &lowerCaseNode; ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Sat Jul 26 00:01:09 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 26 Jul 2014 00:01:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1486-g06a190b Message-ID: <20140726040109.15C3148365@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 06a190b10a16f8504b546f21f1295696aac794d9 (commit) from 4d7b9375b0a56a78a6cfa823069cc57e37fe9766 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=06a190b10a16f8504b546f21f1295696aac794d9 commit 06a190b10a16f8504b546f21f1295696aac794d9 Author: Kitware Robot AuthorDate: Sat Jul 26 00:01:07 2014 -0400 Commit: Kitware Robot CommitDate: Sat Jul 26 00:01:07 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4f38f7d..2bd71ed 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140725) +set(CMake_VERSION_PATCH 20140726) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Jul 27 00:01:08 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 27 Jul 2014 00:01:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1487-ga31b42a Message-ID: <20140727040108.B31674859D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a31b42a46fe16376607fdda1cec160b7e860063a (commit) from 06a190b10a16f8504b546f21f1295696aac794d9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a31b42a46fe16376607fdda1cec160b7e860063a commit a31b42a46fe16376607fdda1cec160b7e860063a Author: Kitware Robot AuthorDate: Sun Jul 27 00:01:06 2014 -0400 Commit: Kitware Robot CommitDate: Sun Jul 27 00:01:06 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2bd71ed..b3c8e5f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140726) +set(CMake_VERSION_PATCH 20140727) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jul 28 00:01:10 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 28 Jul 2014 00:01:10 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1488-ga971de3 Message-ID: <20140728040110.82B904A168@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a971de3adf5f89cbbc37c492f1a53d1790d23729 (commit) from a31b42a46fe16376607fdda1cec160b7e860063a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a971de3adf5f89cbbc37c492f1a53d1790d23729 commit a971de3adf5f89cbbc37c492f1a53d1790d23729 Author: Kitware Robot AuthorDate: Mon Jul 28 00:01:06 2014 -0400 Commit: Kitware Robot CommitDate: Mon Jul 28 00:01:06 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b3c8e5f..769ab83 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140727) +set(CMake_VERSION_PATCH 20140728) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 09:36:14 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 09:36:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4512-gd655bff Message-ID: <20140728133614.BEC8E4B2F2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d655bffdfa67691dccbcad2acf5be9891e9f37e7 (commit) via 8201e0826a5f11e2101d3e071c8da7cfdde833dc (commit) from 500c21da7f1427ad29e46d6c0dedc18d2a2d9044 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d655bffdfa67691dccbcad2acf5be9891e9f37e7 commit d655bffdfa67691dccbcad2acf5be9891e9f37e7 Merge: 500c21d 8201e08 Author: Brad King AuthorDate: Mon Jul 28 09:36:14 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 09:36:14 2014 -0400 Merge topic 'add-liblzma' into next 8201e082 liblzma: Suppress more MSVC warnings http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8201e0826a5f11e2101d3e071c8da7cfdde833dc commit 8201e0826a5f11e2101d3e071c8da7cfdde833dc Author: Brad King AuthorDate: Mon Jul 28 09:35:35 2014 -0400 Commit: Brad King CommitDate: Mon Jul 28 09:35:35 2014 -0400 liblzma: Suppress more MSVC warnings diff --git a/Utilities/cmliblzma/common/sysdefs.h b/Utilities/cmliblzma/common/sysdefs.h index 2bcaeb3..c84f01c 100644 --- a/Utilities/cmliblzma/common/sysdefs.h +++ b/Utilities/cmliblzma/common/sysdefs.h @@ -18,6 +18,8 @@ #if defined(_MSC_VER) # pragma warning(push,1) +# pragma warning(disable: 4142) /* benign redefinition of type */ +# pragma warning(disable: 4761) /* integral size mismatch in argument */ #endif ////////////// ----------------------------------------------------------------------- Summary of changes: Utilities/cmliblzma/common/sysdefs.h | 2 ++ 1 file changed, 2 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 09:41:33 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 09:41:33 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4514-ga658e61 Message-ID: <20140728134133.A45F249C63@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via a658e61dadbc1619eda8a10da0b7d237eb737036 (commit) via 4b5052b0cd37e8896966ee2ce3040e1a8ded64e4 (commit) from d655bffdfa67691dccbcad2acf5be9891e9f37e7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a658e61dadbc1619eda8a10da0b7d237eb737036 commit a658e61dadbc1619eda8a10da0b7d237eb737036 Merge: d655bff 4b5052b Author: Brad King AuthorDate: Mon Jul 28 09:41:32 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 09:41:32 2014 -0400 Merge topic 'FindQt4-more-plugins' into next 4b5052b0 FindQt4: Add nativewifi and qtga plugins http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4b5052b0cd37e8896966ee2ce3040e1a8ded64e4 commit 4b5052b0cd37e8896966ee2ce3040e1a8ded64e4 Author: Mathieu MARACHE AuthorDate: Thu Jul 24 09:46:26 2014 +0200 Commit: Brad King CommitDate: Mon Jul 28 09:39:23 2014 -0400 FindQt4: Add nativewifi and qtga plugins While at it, update QT_QTGUI_PLUGINS to use QT_IMAGEFORMATS_PLUGINS instead of duplicating the list. diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index d0515c6..99e574e 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -1190,14 +1190,14 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) set( QT_PLUGIN_TYPES accessible bearer codecs decorations designer gfxdrivers graphicssystems iconengines imageformats inputmethods mousedrivers phonon_backend script sqldrivers ) set( QT_ACCESSIBLE_PLUGINS qtaccessiblecompatwidgets qtaccessiblewidgets ) - set( QT_BEARER_PLUGINS qcorewlanbearer qgenericbearer ) + set( QT_BEARER_PLUGINS qcorewlanbearer qgenericbearer qnativewifibearer ) set( QT_CODECS_PLUGINS qcncodecs qjpcodecs qkrcodecs qtwcodecs ) set( QT_DECORATIONS_PLUGINS qdecorationdefault qdecorationwindows ) set( QT_DESIGNER_PLUGINS arthurplugin containerextension customwidgetplugin phononwidgets qdeclarativeview qt3supportwidgets qwebview taskmenuextension worldtimeclockplugin ) set( QT_GRAPHICSDRIVERS_PLUGINS qgfxtransformed qgfxvnc qscreenvfb ) set( QT_GRAPHICSSYSTEMS_PLUGINS qglgraphicssystem qtracegraphicssystem ) set( QT_ICONENGINES_PLUGINS qsvgicon ) - set( QT_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qsvg qtiff ) + set( QT_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qsvg qtiff qtga ) set( QT_INPUTMETHODS_PLUGINS qimsw_multi ) set( QT_MOUSEDRIVERS_PLUGINS qwstslibmousehandler ) if(APPLE) @@ -1211,7 +1211,7 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) set( QT_PHONON_PLUGINS ${QT_PHONON_BACKEND_PLUGINS} ) set( QT_QT3SUPPORT_PLUGINS qtaccessiblecompatwidgets ) set( QT_QTCORE_PLUGINS ${QT_BEARER_PLUGINS} ${QT_CODECS_PLUGINS} ) - set( QT_QTGUI_PLUGINS qtaccessiblewidgets qgif qjpeg qmng qico qtiff ${QT_DECORATIONS_PLUGINS} ${QT_GRAPHICSDRIVERS_PLUGINS} ${QT_GRAPHICSSYSTEMS_PLUGINS} ${QT_INPUTMETHODS_PLUGINS} ${QT_MOUSEDRIVERS_PLUGINS} ) + set( QT_QTGUI_PLUGINS qtaccessiblewidgets ${QT_IMAGEFORMATS_PLUGINS} ${QT_DECORATIONS_PLUGINS} ${QT_GRAPHICSDRIVERS_PLUGINS} ${QT_GRAPHICSSYSTEMS_PLUGINS} ${QT_INPUTMETHODS_PLUGINS} ${QT_MOUSEDRIVERS_PLUGINS} ) set( QT_QTSCRIPT_PLUGINS ${QT_SCRIPT_PLUGINS} ) set( QT_QTSQL_PLUGINS ${QT_SQLDRIVERS_PLUGINS} ) set( QT_QTSVG_PLUGINS qsvg qsvgicon ) ----------------------------------------------------------------------- Summary of changes: Modules/FindQt4.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 10:03:51 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 10:03:51 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4520-gf8d67f9 Message-ID: <20140728140351.EBF6C4B194@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f8d67f90f0a88a368d154cc1e6bbe6566d9f7dc4 (commit) via 5b4faeefe36fd775fd60f98aedf0cc35202f99f4 (commit) via a971de3adf5f89cbbc37c492f1a53d1790d23729 (commit) via a31b42a46fe16376607fdda1cec160b7e860063a (commit) via 06a190b10a16f8504b546f21f1295696aac794d9 (commit) via 4d7b9375b0a56a78a6cfa823069cc57e37fe9766 (commit) from a658e61dadbc1619eda8a10da0b7d237eb737036 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f8d67f90f0a88a368d154cc1e6bbe6566d9f7dc4 commit f8d67f90f0a88a368d154cc1e6bbe6566d9f7dc4 Merge: a658e61 5b4faee Author: Brad King AuthorDate: Mon Jul 28 10:03:51 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 10:03:51 2014 -0400 Merge topic 'osx-no-sysroot-for-deployment' into next 5b4faeef OS X: Allow deployment target with "/" sysroot (#15040) a971de3a CMake Nightly Date Stamp a31b42a4 CMake Nightly Date Stamp 06a190b1 CMake Nightly Date Stamp 4d7b9375 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5b4faeefe36fd775fd60f98aedf0cc35202f99f4 commit 5b4faeefe36fd775fd60f98aedf0cc35202f99f4 Author: Jeremy Huddleston AuthorDate: Sat Jul 19 20:43:20 2014 -0700 Commit: Brad King CommitDate: Mon Jul 28 09:52:21 2014 -0400 OS X: Allow deployment target with "/" sysroot (#15040) Allow the combination -DCMAKE_OSX_DEPLOYMENT_TARGET="10.8" -DCMAKE_OSX_SYSROOT="/" to work. Treat the "/" sysroot as targeting the current OS X version. diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index e25df1e..e5c5f36 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -70,6 +70,8 @@ if(CMAKE_OSX_DEPLOYMENT_TARGET) set(_sdk_ver "${CMAKE_MATCH_1}") elseif("${_CMAKE_OSX_SYSROOT_ORIG}" MATCHES "^macosx([0-9]+\\.[0-9]+)$") set(_sdk_ver "${CMAKE_MATCH_1}") + elseif("${_CMAKE_OSX_SYSROOT_ORIG}" STREQUAL "/") + set(_sdk_ver "${_CURRENT_OSX_VERSION}") else() message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' " ----------------------------------------------------------------------- Summary of changes: Modules/Platform/Darwin.cmake | 2 ++ Source/CMakeVersion.cmake | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 10:23:17 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 10:23:17 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4524-g89907b3 Message-ID: <20140728142317.DC24E4A902@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 89907b37665ab05492a496eac7fdf19990e550e8 (commit) via b9be4d21779ba7b301f12a7a5c358000e1424cee (commit) via 73b336c9f145746b5d554c80b9d8d6c40613ec5c (commit) via 44850a267d1c2ee64947ebb93de3998549b59d03 (commit) from f8d67f90f0a88a368d154cc1e6bbe6566d9f7dc4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=89907b37665ab05492a496eac7fdf19990e550e8 commit 89907b37665ab05492a496eac7fdf19990e550e8 Merge: f8d67f9 b9be4d2 Author: Brad King AuthorDate: Mon Jul 28 10:23:16 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 10:23:16 2014 -0400 Merge topic 'cpack-ifw-generator' into next b9be4d21 Help: Add notes for topic 'cpack-ifw-generator' 73b336c9 CPackIFW: Replace use of strftime with cmTimestamp 44850a26 CPack: Add an "IFW" generator for Qt Framework Installer http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b9be4d21779ba7b301f12a7a5c358000e1424cee commit b9be4d21779ba7b301f12a7a5c358000e1424cee Author: Brad King AuthorDate: Thu Jul 24 11:07:14 2014 -0400 Commit: Brad King CommitDate: Mon Jul 28 10:24:03 2014 -0400 Help: Add notes for topic 'cpack-ifw-generator' diff --git a/Help/release/dev/cpack-ifw-generator.rst b/Help/release/dev/cpack-ifw-generator.rst new file mode 100644 index 0000000..f667136 --- /dev/null +++ b/Help/release/dev/cpack-ifw-generator.rst @@ -0,0 +1,5 @@ +cpack-ifw-generator +------------------- + +* :manual:`cpack(1)` gained an ``IFW`` generator to package using + Qt Framework Installer tools. See the :module:`CPackIFW` module. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=73b336c9f145746b5d554c80b9d8d6c40613ec5c commit 73b336c9f145746b5d554c80b9d8d6c40613ec5c Author: Brad King AuthorDate: Wed Jul 23 16:31:15 2014 -0400 Commit: Brad King CommitDate: Mon Jul 28 10:24:03 2014 -0400 CPackIFW: Replace use of strftime with cmTimestamp The latter is more portable. diff --git a/Source/CPack/cmCPackIFWGenerator.cxx b/Source/CPack/cmCPackIFWGenerator.cxx index a4f33b4..51c0f2e 100644 --- a/Source/CPack/cmCPackIFWGenerator.cxx +++ b/Source/CPack/cmCPackIFWGenerator.cxx @@ -19,6 +19,7 @@ #include "cmGeneratedFileStream.h" #include "cmCPackLog.h" #include "cmCPackComponentGroup.h" +#include "cmTimestamp.h" #include #include @@ -809,16 +810,8 @@ int cmCPackIFWGenerator::IfwCreatePackageFile() //---------------------------------------------------------------------- std::string cmCPackIFWGenerator::IfwCreateCurrentDate() { - time_t rawtime; - struct tm * timeinfo; - char buffer[80]; - - time (&rawtime); - timeinfo = localtime(&rawtime); - - strftime(buffer, 80, "%Y-%m-%d", timeinfo); - - return buffer; + cmTimestamp timestamp; + return timestamp.CurrentTime("%Y-%m-%d", false); } //---------------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=44850a267d1c2ee64947ebb93de3998549b59d03 commit 44850a267d1c2ee64947ebb93de3998549b59d03 Author: Konstantin Podsvirov AuthorDate: Wed Jul 23 11:01:59 2014 +0400 Commit: Brad King CommitDate: Mon Jul 28 10:24:03 2014 -0400 CPack: Add an "IFW" generator for Qt Framework Installer Add support for packaging with the Qt Framework Installer tools: http://qt-project.org/doc/qtinstallerframework/index.html Reviewed-by: Nils Gladitz diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index fb55bfc..5b096ad 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -59,11 +59,43 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") if(${CPACK_SYSTEM_NAME} MATCHES Windows) if(CMAKE_CL_64) set(CPACK_SYSTEM_NAME win64-x64) + set(CPACK_IFW_TARGET_DIRECTORY "@RootDir@/Program Files/${CMAKE_PROJECT_NAME}") else() set(CPACK_SYSTEM_NAME win32-x86) endif() endif() + # default component for IFW + if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME) + set(_CPACK_IFW_COMPONENT_NAME ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}) + else() + set(_CPACK_IFW_COMPONENT_NAME Unspecified) + endif() + string(TOUPPER ${_CPACK_IFW_COMPONENT_NAME} _CPACK_IFW_COMPONENT_UNAME) + + if(${CMAKE_SYSTEM_NAME} MATCHES Windows) + if(BUILD_QtDialog) + set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/bin/cmake-gui.exe\", \"@StartMenuDir@/CMake (cmake-gui).lnk\");\n") + endif() + if(SPHINX_HTML) + set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/html/index.html\", \"@StartMenuDir@/CMake Documentation.lnk\");\n") + endif() + configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in" + "${CMake_BINARY_DIR}/installscript.qs" @ONLY + ) + install(FILES "${CMake_SOURCE_DIR}/Source/QtIFW/cmake.org.html" + DESTINATION "." + ) + set(_CPACK_IFW_COMPONENT_SCRIPT "set(CPACK_IFW_COMPONENT_${_CPACK_IFW_COMPONENT_UNAME}_SCRIPT \"${CMake_BINARY_DIR}/installscript.qs\")") + endif() + + if(${CMAKE_SYSTEM_NAME} MATCHES Linux) + set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/${CMAKE_PROJECT_NAME}") + set(CPACK_IFW_ADMIN_TARGET_DIRECTORY "@ApplicationsDir@/${CMAKE_PROJECT_NAME}") + endif() + + set(_CPACK_IFW_PACKAGE_VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}) + if(NOT DEFINED CPACK_PACKAGE_FILE_NAME) # if the CPACK_PACKAGE_FILE_NAME is not defined by the cache # default to source package - system, on cygwin system is not diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index aba404f..135c07d 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -31,6 +31,20 @@ endif() # they might not if qt was not enabled for the build include("@QT_DIALOG_CPACK_OPTIONS_FILE@" OPTIONAL) +if(CPACK_GENERATOR MATCHES "IFW") + # Version with QtIFW limitations + set(CPACK_PACKAGE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + # Enable install default component + set(CPACK_COMPONENTS_ALL "@_CPACK_IFW_COMPONENT_NAME@") + # Configuration + set(CPACK_COMPONENT_ at _CPACK_IFW_COMPONENT_UNAME@_DISPLAY_NAME "@CPACK_PACKAGE_NAME@") + set(CPACK_COMPONENT_ at _CPACK_IFW_COMPONENT_UNAME@_DESCRIPTION "@CPACK_PACKAGE_DESCRIPTION_SUMMARY@") + # IFW Configuration + set(CPACK_IFW_COMPONENT_ at _CPACK_IFW_COMPONENT_UNAME@_NAME "@CPACK_PACKAGE_NAME@") + set(CPACK_IFW_COMPONENT_ at _CPACK_IFW_COMPONENT_UNAME@_LICENSES "@CPACK_PACKAGE_NAME@ Copyright" "@CPACK_RESOURCE_FILE_LICENSE@") + @_CPACK_IFW_COMPONENT_SCRIPT@ +endif() + if(CPACK_GENERATOR MATCHES "CygwinSource") # when packaging source make sure the .build directory is not included set(CPACK_SOURCE_IGNORE_FILES diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index ecc9cc4..91fffe9 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -55,6 +55,7 @@ All Modules /module/CPackCygwin /module/CPackDeb /module/CPackDMG + /module/CPackIFW /module/CPackNSIS /module/CPackPackageMaker /module/CPackRPM diff --git a/Help/module/CPackIFW.rst b/Help/module/CPackIFW.rst new file mode 100644 index 0000000..ea05796 --- /dev/null +++ b/Help/module/CPackIFW.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/CPackIFW.cmake diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 89547af..b58f944 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -435,6 +435,7 @@ if(NOT CPACK_GENERATOR) option(CPACK_BINARY_WIX "Enable to build WiX packages" OFF) option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF) endif() + option(CPACK_BINARY_IFW "Enable to build IFW packages" OFF) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_BUNDLE Bundle) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DRAGNDROP DragNDrop) @@ -450,6 +451,7 @@ if(NOT CPACK_GENERATOR) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TZ TZ) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_WIX WIX) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_ZIP ZIP) + cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_IFW IFW) endif() diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 1433d9e..5524a3f 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -458,6 +458,9 @@ macro(cpack_add_component_group grpname) cpack_append_string_variable_set_command( CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DESCRIPTION CPACK_ADDGRP_STR) + cpack_append_string_variable_set_command( + CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_PARENT_GROUP + CPACK_ADDGRP_STR) cpack_append_option_set_command( CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_EXPANDED CPACK_ADDGRP_STR) diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake new file mode 100644 index 0000000..f99488a --- /dev/null +++ b/Modules/CPackIFW.cmake @@ -0,0 +1,384 @@ +#.rst: +# CPackIFW +# -------- +# +# .. _QtIFW: http://qt-project.org/doc/qtinstallerframework/index.html +# +# This module looks for the location of the command line utilities supplied with +# the Qt Installer Framework (QtIFW_). +# +# The module also defines several commands to control the behavior of the +# CPack ``IFW`` generator. +# +# +# Overview +# ^^^^^^^^ +# +# CPack ``IFW`` generator helps you create online and offline +# binary cross-platform installers with a graphical user interface. +# +# CPack IFW generator prepare project installation and generate configuration +# and meta information for QtIFW_ tools. +# +# The QtIFW_ provides a set of tools and utilities to create +# installers for the supported desktop Qt platforms: Linux, Microsoft Windows, +# and Mac OS X. +# +# To use CPack ``IFW`` generator you must also install QtIFW_. +# +# Variables +# ^^^^^^^^^ +# +# Variables that Change Behavior +# """""""""""""""""""""""""""""" +# +# .. variable:: CPACK_IFW_TARGET_DIRECTORY +# +# Default target directory for installation. +# By default used "@ApplicationsDir@/:variable:`CPACK_PACKAGE_INSTALL_DIRECTORY`" +# +# You can use predefined variables. +# +# .. variable:: CPACK_IFW_ADMIN_TARGET_DIRECTORY +# +# Default target directory for installation with administrator rights. +# +# You can use predefined variables. +# +# .. variable:: CPACK_IFW_RESOLVE_DUPLICATE_NAMES +# +# Resolve duplicate names when installing components with groups. +# +# .. variable:: CPACK_IFW_PACKAGES_DIRECTORIES +# +# Additional prepared packages dirs that will be used to resolve +# dependent components. +# +# Advanced Variables +# """""""""""""""""" +# +# .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE +# +# The path to "binarycreator" command line client. +# +# This variable is cached and can be configured user if need. +# +# .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND +# +# True if the "binarycreator" command line client was found. +# +# .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE +# +# The path to "repogen" command line client. +# +# This variable is cached and can be configured user if need. +# +# .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE_FOUND +# +# True if the "repogen" command line client was found. +# +# Commands +# ^^^^^^^^^ +# +# The module defines the following commands: +# +# -------------------------------------------------------------------------- +# +# .. command:: cpack_ifw_configure_component +# +# Sets the arguments specific to the CPack IFW generator. +# +# :: +# +# cpack_ifw_configure_component( +# [VERSION ] +# [SCRIPT " << std::endl; + } + + // Check dependencies + std::set compDepSet; + // CMake dependencies + if (!compIt->second.Dependencies.empty()) + { + std::vector::iterator depCompIt; + for(depCompIt = compIt->second.Dependencies.begin(); + depCompIt != compIt->second.Dependencies.end(); + ++depCompIt) + { + compDepSet.insert(IfwGetComponentId(*depCompIt)); + } + } + // QtIFW dependencies + if(const char *ifwCompDepsStr = this->GetOption(macroPrefix + "_DEPENDS")) + { + std::vector ifwCompDepsVector; + cmSystemTools::ExpandListArgument(ifwCompDepsStr, + ifwCompDepsVector); + for(std::vector::iterator + depCompIt = ifwCompDepsVector.begin(); + depCompIt != ifwCompDepsVector.end(); ++depCompIt) + { + compDepSet.insert(*depCompIt); + ifwDependsComponents.insert(*depCompIt); + } + } + + // Write dependencies + if (!compDepSet.empty()) + { + pkgXml << " "; + std::set::iterator it = compDepSet.begin(); + pkgXml << *it; + ++it; + while(it != compDepSet.end()) + { + pkgXml << "," << *it; + ++it; + } + pkgXml << "" << std::endl; + } + + // Licenses + std::vector licenses; + if(IfwParseLicenses(licenses, macroPrefix + "_LICENSES", pkgMetaDir)) + { + pkgXml << " " << std::endl; + for(size_t i = 0; i < licenses.size(); i += 2) + { + pkgXml << " " <" << std::endl; + } + + // TODO: Check how enable virtual component (now it's allways disabled) + if (compIt->second.IsRequired) { + pkgXml << " true" + << std::endl; + } else if (compIt->second.IsDisabledByDefault) { + pkgXml << " false" << std::endl; + } else if (compIt->second.IsHidden) { + pkgXml << " true" << std::endl; + } else { + pkgXml << " true" << std::endl; + } + + // Priority + if(const char* ifwCompPriority = + this->GetOption(macroPrefix + "_PRIORITY")) + { + pkgXml << " " << ifwCompPriority + << "" << std::endl; + } + + pkgXml << "" << std::endl; + + // Downloaded + if (compIt->second.IsDownloaded) + { + if (!ifwDownloadedComponents.empty()) ifwDownloadedComponents += ","; + ifwDownloadedComponents += ifwCompId; + } + else + { + if (!ifwBinaryComponents.empty()) ifwBinaryComponents += ","; + ifwBinaryComponents += ifwCompId; + } + } + + // Run repogen + if (!ifwDownloadSite.empty()) + { + std::string ifwCmd = ifwRepoGen; + ifwCmd += " -c " + this->toplevel + "/config/config.xml"; + ifwCmd += " -p " + this->toplevel + "/packages"; + + if(!ifwPkgsDirsVector.empty()) + { + for(std::vector::iterator it = ifwPkgsDirsVector.begin(); + it != ifwPkgsDirsVector.end(); ++it) + { + ifwCmd += " -p " + *it; + } + } + + if (!ifwOnlineOnly && !ifwDownloadedComponents.empty()) { + ifwCmd += " -i " + ifwDownloadedComponents; + } + ifwCmd += " " + this->toplevel + "/repository"; + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ifwCmd + << std::endl); + std::string output; + int retVal = 1; + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "- Generate repository" << std::endl); + bool res = cmSystemTools::RunSingleCommand( + ifwCmd.c_str(), &output, &retVal, 0, this->GeneratorVerbose, 0); + if ( !res || retVal ) + { + cmGeneratedFileStream ofs(ifwTmpFile.c_str()); + ofs << "# Run command: " << ifwCmd << std::endl + << "# Output:" << std::endl + << output << std::endl; + cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running IFW command: " + << ifwCmd << std::endl + << "Please check " << ifwTmpFile << " for errors" + << std::endl); + return 0; + } + } + + // Run binary creator + { + std::string ifwCmd = ifwBinCreator; + ifwCmd += " -c " + this->toplevel + "/config/config.xml"; + ifwCmd += " -p " + this->toplevel + "/packages"; + + if(!ifwPkgsDirsVector.empty()) + { + for(std::vector::iterator it = ifwPkgsDirsVector.begin(); + it != ifwPkgsDirsVector.end(); ++it) + { + ifwCmd += " -p " + *it; + } + } + + if (ifwOnlineOnly) + { + ifwCmd += " --online-only"; + } + else if (!ifwDownloadedComponents.empty() && !ifwDownloadSite.empty()) + { + ifwCmd += " -e " + ifwDownloadedComponents; + } + else if (!ifwDependsComponents.empty()) + { + ifwCmd += " -i "; + std::set::iterator it = ifwDependsComponents.begin(); + ifwCmd += *it; + ++it; + while(it != ifwDependsComponents.end()) + { + ifwCmd += "," + (*it); + ++it; + } + + ifwCmd += "," + ifwBinaryComponents; + } + // TODO: set correct name for multipackages + if (this->packageFileNames.size() > 0) + { + ifwCmd += " " + packageFileNames[0]; + } + else + { + ifwCmd += " installer"; + } + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ifwCmd + << std::endl); + std::string output; + int retVal = 1; + cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Generate package" << std::endl); + bool res = cmSystemTools::RunSingleCommand( + ifwCmd.c_str(), &output, &retVal, 0, this->GeneratorVerbose, 0); + if ( !res || retVal ) + { + cmGeneratedFileStream ofs(ifwTmpFile.c_str()); + ofs << "# Run command: " << ifwCmd << std::endl + << "# Output:" << std::endl + << output << std::endl; + cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running IFW command: " + << ifwCmd << std::endl + << "Please check " << ifwTmpFile << " for errors" + << std::endl); + return 0; + } + } + + return 1; +} + +//---------------------------------------------------------------------- +const char *cmCPackIFWGenerator::GetPackagingInstallPrefix() +{ + const char *defPrefix = cmCPackGenerator::GetPackagingInstallPrefix(); + + std::string tmpPref = defPrefix ? defPrefix : ""; + + if(this->Components.empty()) + { + tmpPref += "packages/root/data"; + } + + this->SetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX", tmpPref.c_str()); + + return this->GetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX"); +} + +//---------------------------------------------------------------------- +const char *cmCPackIFWGenerator::GetOutputExtension() +{ + const char *suffix = this->GetOption("CMAKE_EXECUTABLE_SUFFIX"); + return suffix ? suffix : ""; +} + +//---------------------------------------------------------------------- +std::string cmCPackIFWGenerator::IfwGetGroupId(cmCPackComponentGroup *group) +{ + std::string ifwGroupId; + std::string ifwGroupName; + std::list groups; + while(group) + { + groups.push_front(group); + group = group->ParentGroup; + } + std::list::iterator it = groups.begin(); + if(it != groups.end()) + { + ifwGroupId = IfwGetGroupName(*it); + ++it; + } + while(it != groups.end()) + { + ifwGroupName = IfwGetGroupName(*it); + + if(ifwResolveDuplicateNames) + { + if(ifwGroupName.substr(0, ifwGroupId.size()) == ifwGroupId) + { + ifwGroupId = ifwGroupName; + ++it; + continue; + } + } + + ifwGroupId += "." + ifwGroupName; + + ++it; + } + + return ifwGroupId; +} + +//---------------------------------------------------------------------- +std::string cmCPackIFWGenerator::IfwGetComponentId(cmCPackComponent *component) +{ + std::string ifwCompId; + if(component) { + ifwCompId = IfwGetGroupId(component->Group); + if(!ifwCompId.empty()) ifwCompId += "."; + std::string ifwCompName = IfwGetComponentName(component); + if(ifwResolveDuplicateNames && + (ifwCompName.substr(0, ifwCompId.size()) == ifwCompId)) + { + ifwCompId = ifwCompName; + } + else + { + ifwCompId += ifwCompName; + } + } + return ifwCompId; +} + +//---------------------------------------------------------------------- +std::string cmCPackIFWGenerator::IfwGetGroupName(cmCPackComponentGroup *group) +{ + std::string ifwGroupName = group->Name; + if(const char* name = + this->GetOption("CPACK_IFW_COMPONENT_GROUP_" + + cmsys::SystemTools::UpperCase(group->Name) + "_NAME")) + { + ifwGroupName = name; + } + return ifwGroupName; +} + +//---------------------------------------------------------------------- +std::string +cmCPackIFWGenerator::IfwGetComponentName(cmCPackComponent *component) +{ + return IfwGetComponentName(component->Name); +} + +//---------------------------------------------------------------------- +std::string +cmCPackIFWGenerator::IfwGetComponentName(const std::string &componentName) +{ + std::string ifwCompName = componentName; + if(const char* name = + this->GetOption("CPACK_IFW_COMPONENT_" + + cmsys::SystemTools::UpperCase(componentName) + "_NAME")) + { + ifwCompName = name; + } + return ifwCompName; +} + +//---------------------------------------------------------------------- +int cmCPackIFWGenerator::InitializeInternal() +{ + // Search Qt Installer Framework tools + + if(!this->IsOn("CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND") || + !this->IsOn("CPACK_IFW_REPOGEN_EXECUTABLE_FOUND")) + { + this->ReadListFile("CPackIFW.cmake"); + } + + // Look 'binarycreator' executable (needs) + + if(this->IsOn("CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND")) + { + const char *ifwBinCreatorStr = + this->GetOption("CPACK_IFW_BINARYCREATOR_EXECUTABLE"); + ifwBinCreator = ifwBinCreatorStr ? ifwBinCreatorStr : ""; + } + else + { + ifwBinCreator = ""; + } + + if (ifwBinCreator.empty()) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Cannot find QtIFW compiler \"binarycreator\": " + "likely it is not installed, or not in your PATH" + << std::endl); + return 0; + } + + // Look 'repogen' executable (optional) + + if(this->IsOn("CPACK_IFW_REPOGEN_EXECUTABLE_FOUND")) + { + const char *ifwRepoGenStr = + this->GetOption("CPACK_IFW_REPOGEN_EXECUTABLE"); + ifwRepoGen = ifwRepoGenStr ? ifwRepoGenStr : ""; + } + else + { + ifwRepoGen = ""; + } + + // // Variables that Change Behavior + + // Resolve duplicate names + ifwResolveDuplicateNames = this->IsOn("CPACK_IFW_RESOLVE_DUPLICATE_NAMES"); + + // Additional packages dirs + ifwPkgsDirsVector.clear(); + if(const char* dirs = this->GetOption("CPACK_IFW_PACKAGES_DIRECTORIES")) + { + cmSystemTools::ExpandListArgument(dirs, + ifwPkgsDirsVector); + } + + // Remote repository + + if (const char *site = this->GetOption("CPACK_DOWNLOAD_SITE")) + { + ifwDownloadSite = site; + } + + ifwOnlineOnly = this->IsOn("CPACK_DOWNLOAD_ALL") ? true : false; + + if (!ifwDownloadSite.empty() && ifwRepoGen.empty()) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Cannot find QtIFW repository generator \"repogen\": " + "likely it is not installed, or not in your PATH" + << std::endl); + return 0; + } + + return this->Superclass::InitializeInternal(); +} + +//---------------------------------------------------------------------- +std::string +cmCPackIFWGenerator::GetComponentInstallDirNamePrefix( + const std::string& /*componentName*/) +{ + return "packages/"; +} + +//---------------------------------------------------------------------- +std::string +cmCPackIFWGenerator::GetComponentInstallDirNameSuffix( + const std::string& componentName) +{ + std::map::iterator + compIt = this->Components.find(componentName); + + cmCPackComponent *comp = + compIt != this->Components.end() ? &compIt->second : 0; + + const std::string prefix = GetComponentInstallDirNamePrefix(componentName); + const std::string suffix = "/data"; + + if (componentPackageMethod == ONE_PACKAGE_PER_COMPONENT) { + return prefix + IfwGetComponentId(comp) + suffix; + } + + if (componentPackageMethod == ONE_PACKAGE) { + return std::string(prefix + "ALL_COMPONENTS_IN_ONE" + suffix); + } + + return prefix + IfwGetComponentId(comp) + suffix; +} + +//---------------------------------------------------------------------- +bool cmCPackIFWGenerator::GetListOfSubdirectories( + const char* topdir, std::vector& dirs) +{ + cmsys::Directory dir; + dir.Load(topdir); + size_t fileNum; + for (fileNum = 0; fileNum < dir.GetNumberOfFiles(); ++fileNum) + { + if (strcmp(dir.GetFile(static_cast(fileNum)),".") && + strcmp(dir.GetFile(static_cast(fileNum)),"..")) + { + cmsys_stl::string fullPath = topdir; + fullPath += "/"; + fullPath += dir.GetFile(static_cast(fileNum)); + if(cmsys::SystemTools::FileIsDirectory(fullPath.c_str()) && + !cmsys::SystemTools::FileIsSymlink(fullPath.c_str())) + { + if (!this->GetListOfSubdirectories(fullPath.c_str(), dirs)) + { + return false; + } + } + } + } + dirs.push_back(topdir); + return true; +} + +//---------------------------------------------------------------------- +enum cmCPackGenerator::CPackSetDestdirSupport +cmCPackIFWGenerator::SupportsSetDestdir() const +{ + return cmCPackGenerator::SETDESTDIR_SHOULD_NOT_BE_USED; +} + +//---------------------------------------------------------------------- +bool cmCPackIFWGenerator::SupportsAbsoluteDestination() const +{ + return false; +} + +//---------------------------------------------------------------------- +bool cmCPackIFWGenerator::SupportsComponentInstallation() const +{ + return true; +} + +//---------------------------------------------------------------------- +int cmCPackIFWGenerator::IfwCreateConfigFile() +{ + cmGeneratedFileStream cfg((this->toplevel + "/config/config.xml").data()); + + std::string ifwPkgName; + if (const char *name = this->GetOption("CPACK_PACKAGE_NAME")) + { + ifwPkgName = name; + } + else + { + ifwPkgName = "Your package"; + } + + std::string ifwPkgDescription; + if (const char *name = this->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) + { + ifwPkgDescription = name; + } + else + { + ifwPkgDescription = "Your package description"; + } + + std::string ifwPkgVersion; + if (const char *version = this->GetOption("CPACK_PACKAGE_VERSION")) + { + ifwPkgVersion = version; + } + else + { + ifwPkgVersion = "1.0.0"; + } + + const char *ifwPkgInstDir = + this->GetOption("CPACK_PACKAGE_INSTALL_DIRECTORY"); + const char *ifwTargetDir = + this->GetOption("CPACK_IFW_TARGET_DIRECTORY"); + const char *ifwAdminTargetDir = + this->GetOption("CPACK_IFW_ADMIN_TARGET_DIRECTORY"); + + cfg << "" << std::endl; + cfg << "" << std::endl; + cfg << " " << cmXMLSafe(ifwPkgName).str() << "" << std::endl; + cfg << " " << ifwPkgVersion << "" << std::endl; + cfg << " " << cmXMLSafe(ifwPkgDescription).str() << "" + << std::endl; + + // Default target directory for installation + if (ifwTargetDir) + { + cfg << " " << ifwTargetDir << "" << std::endl; + } + else if (ifwPkgInstDir) + { + cfg << " @ApplicationsDir@/" << ifwPkgInstDir + << "" << std::endl; + } + else + { + cfg << " @RootDir@/usr/local" << std::endl; + } + + // Default target directory for installation with administrator rights + if (ifwAdminTargetDir) + { + cfg << " " << ifwAdminTargetDir + << "" << std::endl; + } + + if (!ifwDownloadSite.empty()) + { + cfg << " " << std::endl; + cfg << " " << std::endl; + cfg << " " << ifwDownloadSite << "" << std::endl; + // These properties can now be set from "cpack_configure_downloads" + // 1 + // user + // password + // Example repository + cfg << " " << std::endl; + cfg << " " << std::endl; + } + + // CPack IFW default policy + cfg << " " << std::endl; + cfg << " true" + << std::endl; + cfg << " true" << std::endl; + + cfg << "" << std::endl; + + return 1; +} + +//---------------------------------------------------------------------- +// Create default package file +int cmCPackIFWGenerator::IfwCreatePackageFile() +{ + std::string ifwPkgName; + if (const char *name = this->GetOption("CPACK_PACKAGE_NAME")) + { + ifwPkgName = name; + } + else + { + ifwPkgName = "Your package"; + } + + std::string ifwPkgDescription; + if (const char *name = this->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) + { + ifwPkgDescription = name; + } + else + { + ifwPkgDescription = "Your package description"; + } + + cmGeneratedFileStream + pkgXml((this->toplevel + "/packages/root/meta/package.xml").data()); + pkgXml << "" << std::endl; + pkgXml << "" << std::endl; + + pkgXml << " " << ifwPkgName << "" << std::endl; + pkgXml << " " << ifwPkgDescription + << "" << std::endl; + pkgXml << " " << "root" << "" << std::endl; + pkgXml << " " << this->GetOption("CPACK_PACKAGE_VERSION") + << "" << std::endl; + pkgXml << " " << IfwCreateCurrentDate() << "" + << std::endl; + + pkgXml << " true" << std::endl; + pkgXml << " true" << std::endl; + + pkgXml << "" << std::endl; + + return 1; +} + +//---------------------------------------------------------------------- +std::string cmCPackIFWGenerator::IfwCreateCurrentDate() +{ + time_t rawtime; + struct tm * timeinfo; + char buffer[80]; + + time (&rawtime); + timeinfo = localtime(&rawtime); + + strftime(buffer, 80, "%Y-%m-%d", timeinfo); + + return buffer; +} + +//---------------------------------------------------------------------- +bool cmCPackIFWGenerator::IfwParseLicenses(std::vector &licenses, + const std::string &variable, + const std::string &metaDir) +{ + if (const char *option = this->GetOption(variable)) + { + if(!licenses.empty()) licenses.clear(); + cmSystemTools::ExpandListArgument( option, licenses ); + } + else + { + return false; + } + + if ( licenses.size() % 2 != 0 ) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, variable + << " should contain pairs of and ." + << std::endl); + return false; + } + + for(size_t i = 1; i < licenses.size(); i += 2) + { + std::string name = cmSystemTools::GetFilenameName(licenses[i]); + std::string path = metaDir + "/" + name; + cmsys::SystemTools::CopyFileIfDifferent(licenses[i].data(), path.data()); + licenses[i] = name; + } + + return licenses.size() > 1; +} diff --git a/Source/CPack/cmCPackIFWGenerator.h b/Source/CPack/cmCPackIFWGenerator.h new file mode 100644 index 0000000..d70e52d --- /dev/null +++ b/Source/CPack/cmCPackIFWGenerator.h @@ -0,0 +1,82 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmCPackIFWGenerator_h +#define cmCPackIFWGenerator_h + + +#include "cmCPackGenerator.h" +#include + +/** \class cmCPackIFWGenerator + * \brief A generator for Qt Installer Framework tools + * + * http://qt-project.org/doc/qtinstallerframework/index.html + */ +class cmCPackIFWGenerator : public cmCPackGenerator +{ +public: + cmCPackTypeMacro(cmCPackIFWGenerator, cmCPackGenerator); + + /** + * Construct generator + */ + cmCPackIFWGenerator(); + virtual ~cmCPackIFWGenerator(); + +protected: + virtual int InitializeInternal(); + virtual int PackageFiles(); + virtual const char* GetPackagingInstallPrefix(); + + virtual const char* GetOutputExtension(); + + std::string IfwGetGroupId(cmCPackComponentGroup *group); + std::string IfwGetComponentId(cmCPackComponent *component); + + std::string IfwGetGroupName(cmCPackComponentGroup *group); + + std::string IfwGetComponentName(cmCPackComponent *component); + std::string IfwGetComponentName(const std::string &componentName); + + virtual std::string GetComponentInstallDirNamePrefix( + const std::string& componentName); + + virtual std::string GetComponentInstallDirNameSuffix( + const std::string& componentName); + + bool GetListOfSubdirectories(const char* dir, + std::vector& dirs); + + enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const; + virtual bool SupportsAbsoluteDestination() const; + virtual bool SupportsComponentInstallation() const; + +private: + int IfwCreateConfigFile(); + int IfwCreatePackageFile(); + std::string IfwCreateCurrentDate(); + bool IfwParseLicenses(std::vector &licenses, + const std::string &variable, + const std::string &metaDir); + + std::string ifwRepoGen; + std::string ifwBinCreator; + + std::string ifwDownloadSite; + + bool ifwOnlineOnly; + bool ifwResolveDuplicateNames; + std::vector ifwPkgsDirsVector; +}; + +#endif diff --git a/Source/QtIFW/cmake.org.html b/Source/QtIFW/cmake.org.html new file mode 100644 index 0000000..cf5649d --- /dev/null +++ b/Source/QtIFW/cmake.org.html @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Source/QtIFW/installscript.qs.in b/Source/QtIFW/installscript.qs.in new file mode 100644 index 0000000..5491611 --- /dev/null +++ b/Source/QtIFW/installscript.qs.in @@ -0,0 +1,24 @@ +function Component() +{ + // default constructor +} + +Component.prototype.createOperations = function() +{ + // call default implementation to actually install applications! + component.createOperations(); + + // Create shortcut + if (installer.value("os") === "win") { + + at _CPACK_IFW_SHORTCUT_OPTIONAL@ + + component.addOperation("CreateShortcut", + installer.value("TargetDir") + "/cmake.org.html", + installer.value("StartMenuDir") + "/CMake Web Site.lnk"); + + component.addOperation("CreateShortcut", + installer.value("TargetDir") + "/uninstall.exe", + installer.value("StartMenuDir") + "/Uninstall.lnk"); + } +} ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 10:35:41 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 10:35:41 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1491-gd128c6c Message-ID: <20140728143541.6C1674B2CB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via d128c6c9b33f4ca3139352baee774a9e08f6c32e (commit) via 133cd996d161cd349e67d90052ac4e20d9488620 (commit) via a4d58722a47b3712d1f78683371f88a3b6182a59 (commit) from a971de3adf5f89cbbc37c492f1a53d1790d23729 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d128c6c9b33f4ca3139352baee774a9e08f6c32e commit d128c6c9b33f4ca3139352baee774a9e08f6c32e Merge: a971de3 133cd99 Author: Brad King AuthorDate: Mon Jul 28 10:35:40 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 10:35:40 2014 -0400 Merge topic 'target-drop-build-setting-cache' 133cd996 cmTarget: Drop internal cache of build properties a4d58722 cmTarget: Drop internal cache of link interface usage requirements ----------------------------------------------------------------------- Summary of changes: Source/cmTarget.cxx | 380 +++++++++++++++++---------------------------------- 1 file changed, 126 insertions(+), 254 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 10:35:43 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 10:35:43 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1498-g9303da5 Message-ID: <20140728143543.345134B2D3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 9303da53ce980bf71df52f3e75ed18f93127d7b9 (commit) via 7b743a2e761783f930de41db3f7a706b065bbb2e (commit) via 807e4ffeefb0e10ef0546e0eb7383f3d5533809b (commit) via 46099b82ed71394f1dc6e0bbb91704d274edab7d (commit) via 438d9c7c822f42c4fccd77a47b1a32f52a87e617 (commit) via fe665fdda8986b3af061ec91a7ab5fbe8f606e4f (commit) via 9d13e1679f2b52e88748a710edd201ed9fba7447 (commit) from d128c6c9b33f4ca3139352baee774a9e08f6c32e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9303da53ce980bf71df52f3e75ed18f93127d7b9 commit 9303da53ce980bf71df52f3e75ed18f93127d7b9 Merge: d128c6c 7b743a2 Author: Brad King AuthorDate: Mon Jul 28 10:35:42 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 10:35:42 2014 -0400 Merge topic 'genex-head-sensitive-conditions' 7b743a2e cmTarget: Avoid re-computing head-independent link interfaces 807e4ffe Genex: Track whether an expression depends on the 'head' target 46099b82 cmTarget: Move ComputeLinkImplementation* to internals 438d9c7c cmTarget: Re-order link interface map lookup logic fe665fdd cmTarget: Refactor link interface map storage 9d13e167 cmTarget: Remove duplicate link interface map ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpression.cxx | 3 + Source/cmGeneratorExpression.h | 5 + Source/cmGeneratorExpressionEvaluator.cxx | 14 +++ Source/cmGeneratorExpressionEvaluator.h | 1 + Source/cmTarget.cxx | 193 ++++++++++++++++++----------- Source/cmTarget.h | 8 +- 6 files changed, 148 insertions(+), 76 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 10:35:44 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 10:35:44 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1500-g90f6de8 Message-ID: <20140728143544.F3DD54B2CF@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 90f6de8a0192eb169be2a7e0ddbe8bce9d6714fb (commit) via 57a2df224a4bcf4463937d5e121f917d450c144f (commit) from 9303da53ce980bf71df52f3e75ed18f93127d7b9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90f6de8a0192eb169be2a7e0ddbe8bce9d6714fb commit 90f6de8a0192eb169be2a7e0ddbe8bce9d6714fb Merge: 9303da5 57a2df2 Author: Brad King AuthorDate: Mon Jul 28 10:35:44 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 10:35:44 2014 -0400 Merge topic 'fix_tar_leaks' 57a2df22 Fix memory leaks in extract tar. ----------------------------------------------------------------------- Summary of changes: Source/cmSystemTools.cxx | 3 +++ 1 file changed, 3 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 10:35:46 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 10:35:46 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1506-g107db68 Message-ID: <20140728143546.B27374B2D0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 107db681e3a1298463c7f432a2756ee59516ad47 (commit) via 09164c637b02f964152453bdbe1b1591c39c1f7c (commit) via 29a0642ba78392ab20037e677d28eae2eea23de7 (commit) via 8fa087ab38c41e76e502f438eff42d412962108f (commit) via 1c209ac165cd2c25c632cdd238a9948c1651f907 (commit) via 91c933546d1eebb6a637f403824d63177c86c11e (commit) from 90f6de8a0192eb169be2a7e0ddbe8bce9d6714fb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=107db681e3a1298463c7f432a2756ee59516ad47 commit 107db681e3a1298463c7f432a2756ee59516ad47 Merge: 90f6de8 09164c6 Author: Brad King AuthorDate: Mon Jul 28 10:35:45 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 10:35:45 2014 -0400 Merge topic 'vs-escaping' 09164c63 VS: Encode more content correctly in vcxproj files (#15031) 29a0642b VS: Encode mapped flag values in XML project files (#15031) 8fa087ab cmVisualStudioGeneratorOptions: Simplify XML escaping API 1c209ac1 cmIDEOption: Store mapped flag values as a vector 91c93354 cmVisualStudio10TargetGenerator: Remove dupilcate line ----------------------------------------------------------------------- Summary of changes: Source/cmIDEOptions.cxx | 27 ++++++------ Source/cmIDEOptions.h | 19 ++++++++- Source/cmLocalVisualStudio7Generator.cxx | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 62 +++++++++++++--------------- Source/cmVisualStudio10TargetGenerator.h | 3 +- Source/cmVisualStudioGeneratorOptions.cxx | 41 +++++++++++------- 6 files changed, 89 insertions(+), 65 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 10:35:48 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 10:35:48 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1509-g95c47f6 Message-ID: <20140728143548.584C84B2DB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 95c47f6d379764c818bd0693b1928d3339401a52 (commit) via 1342e0222fed06f748f266a3a4e82c907cb76726 (commit) via 6f5581c105d59ed00cc065b9ab9b3c8c0a441db3 (commit) from 107db681e3a1298463c7f432a2756ee59516ad47 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95c47f6d379764c818bd0693b1928d3339401a52 commit 95c47f6d379764c818bd0693b1928d3339401a52 Merge: 107db68 1342e02 Author: Brad King AuthorDate: Mon Jul 28 10:35:47 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 10:35:47 2014 -0400 Merge topic 'FindImageMagick-arch-include-dir' 1342e022 FindImageMagick: Provide per-component include dirs (#15007) 6f5581c1 FindImageMagick: Find arch include dir (#15007) ----------------------------------------------------------------------- Summary of changes: Modules/FindImageMagick.cmake | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 10:35:50 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 10:35:50 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1513-g68f4a0e Message-ID: <20140728143550.B53144B2DA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 68f4a0ee306e5b5aec1252d0e7ed2af93273ee9f (commit) via b9be4d21779ba7b301f12a7a5c358000e1424cee (commit) via 73b336c9f145746b5d554c80b9d8d6c40613ec5c (commit) via 44850a267d1c2ee64947ebb93de3998549b59d03 (commit) from 95c47f6d379764c818bd0693b1928d3339401a52 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=68f4a0ee306e5b5aec1252d0e7ed2af93273ee9f commit 68f4a0ee306e5b5aec1252d0e7ed2af93273ee9f Merge: 95c47f6 b9be4d2 Author: Brad King AuthorDate: Mon Jul 28 10:35:49 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 10:35:49 2014 -0400 Merge topic 'cpack-ifw-generator' b9be4d21 Help: Add notes for topic 'cpack-ifw-generator' 73b336c9 CPackIFW: Replace use of strftime with cmTimestamp 44850a26 CPack: Add an "IFW" generator for Qt Framework Installer ----------------------------------------------------------------------- Summary of changes: CMakeCPack.cmake | 32 ++ CMakeCPackOptions.cmake.in | 14 + Help/manual/cmake-modules.7.rst | 1 + Help/module/CPackIFW.rst | 1 + Help/release/dev/cpack-ifw-generator.rst | 5 + Modules/CPack.cmake | 2 + Modules/CPackComponent.cmake | 3 + Modules/CPackIFW.cmake | 384 ++++++++++++++ Source/CMakeLists.txt | 1 + Source/CPack/cmCPackGeneratorFactory.cxx | 6 + Source/CPack/cmCPackIFWGenerator.cxx | 849 ++++++++++++++++++++++++++++++ Source/CPack/cmCPackIFWGenerator.h | 82 +++ Source/QtIFW/cmake.org.html | 7 + Source/QtIFW/installscript.qs.in | 24 + 14 files changed, 1411 insertions(+) create mode 100644 Help/module/CPackIFW.rst create mode 100644 Help/release/dev/cpack-ifw-generator.rst create mode 100644 Modules/CPackIFW.cmake create mode 100644 Source/CPack/cmCPackIFWGenerator.cxx create mode 100644 Source/CPack/cmCPackIFWGenerator.h create mode 100644 Source/QtIFW/cmake.org.html create mode 100644 Source/QtIFW/installscript.qs.in hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 10:35:52 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 10:35:52 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1515-gfd0229e Message-ID: <20140728143552.673FF4B2DC@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via fd0229e8c5bffa4807962dbe4e077ae7ac2d3dda (commit) via 0e88b1d6d92b32b767dff33109855f079a272f00 (commit) from 68f4a0ee306e5b5aec1252d0e7ed2af93273ee9f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd0229e8c5bffa4807962dbe4e077ae7ac2d3dda commit fd0229e8c5bffa4807962dbe4e077ae7ac2d3dda Merge: 68f4a0e 0e88b1d Author: Brad King AuthorDate: Mon Jul 28 10:35:51 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 10:35:51 2014 -0400 Merge topic 'fix_qt4_automoc_leak' 0e88b1d6 Fix memory leak of local generator detected by LeakSanitizer. ----------------------------------------------------------------------- Summary of changes: Source/cmQtAutoGenerators.cxx | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 10:35:54 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 10:35:54 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1518-g2699ac5 Message-ID: <20140728143554.1AFFE4B2DE@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 2699ac5ef727c824e22dc515149529783d8b9a8f (commit) via 8981513a810a97d10e299407e12c46aabe68f00a (commit) via 731427a646cd0ca81aa392872d18d125e917bf47 (commit) from fd0229e8c5bffa4807962dbe4e077ae7ac2d3dda (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2699ac5ef727c824e22dc515149529783d8b9a8f commit 2699ac5ef727c824e22dc515149529783d8b9a8f Merge: fd0229e 8981513 Author: Brad King AuthorDate: Mon Jul 28 10:35:53 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 10:35:53 2014 -0400 Merge topic 'fix-re-cmake-with-compiler' 8981513a CMakeDetermineCompiler: Simplify CMAKE__COMPILER default force-cache 731427a6 cmGlobalGenerator: Do not re-add CMAKE__COMPILER ----------------------------------------------------------------------- Summary of changes: Modules/CMakeDetermineCompiler.cmake | 2 +- Source/cmGlobalGenerator.cxx | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 10:35:55 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 10:35:55 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1520-g0f06bb5 Message-ID: <20140728143555.BC07E4B2E4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 0f06bb52baafca335d495a14de5a942fae8dffe8 (commit) via 5d40d88e0026824e237938a9e771206220857034 (commit) from 2699ac5ef727c824e22dc515149529783d8b9a8f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0f06bb52baafca335d495a14de5a942fae8dffe8 commit 0f06bb52baafca335d495a14de5a942fae8dffe8 Merge: 2699ac5 5d40d88 Author: Brad King AuthorDate: Mon Jul 28 10:35:54 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 10:35:54 2014 -0400 Merge topic 'sanitizer_handle_more_pids' 5d40d88e Handle more than one process with sanitizer errors. ----------------------------------------------------------------------- Summary of changes: Source/CTest/cmCTestMemCheckHandler.cxx | 27 +++++++++++++++-------- Source/CTest/cmCTestMemCheckHandler.h | 4 ++-- Tests/CTestTestMemcheck/testLeakSanitizer.cmake | 7 ++++++ 3 files changed, 27 insertions(+), 11 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 10:36:09 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 10:36:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4534-gd7ab2e4 Message-ID: <20140728143609.A89F74B2EA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d7ab2e432828b7af15840956a643900ff22479d6 (commit) via 0f06bb52baafca335d495a14de5a942fae8dffe8 (commit) via 2699ac5ef727c824e22dc515149529783d8b9a8f (commit) via fd0229e8c5bffa4807962dbe4e077ae7ac2d3dda (commit) via 68f4a0ee306e5b5aec1252d0e7ed2af93273ee9f (commit) via 95c47f6d379764c818bd0693b1928d3339401a52 (commit) via 107db681e3a1298463c7f432a2756ee59516ad47 (commit) via 90f6de8a0192eb169be2a7e0ddbe8bce9d6714fb (commit) via 9303da53ce980bf71df52f3e75ed18f93127d7b9 (commit) via d128c6c9b33f4ca3139352baee774a9e08f6c32e (commit) from 89907b37665ab05492a496eac7fdf19990e550e8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d7ab2e432828b7af15840956a643900ff22479d6 commit d7ab2e432828b7af15840956a643900ff22479d6 Merge: 89907b3 0f06bb5 Author: Brad King AuthorDate: Mon Jul 28 10:37:26 2014 -0400 Commit: Brad King CommitDate: Mon Jul 28 10:37:26 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 10:45:13 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 10:45:13 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1524-gf188845 Message-ID: <20140728144513.487534A57C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via f188845237cdfee74dae0658888a61c855e285b3 (commit) via ce7a5ca895d0669b33d213c6fc94f484611d6e24 (commit) via 9d2bada3d4948f2a7c40d3e73ebc0a15d1c2dc3a (commit) via d8934eedaf679d45b2f183aa2f6f70ac1eaa93a1 (commit) from 0f06bb52baafca335d495a14de5a942fae8dffe8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 10:45:13 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 10:45:13 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4539-gdea3d88 Message-ID: <20140728144513.7A67B4A580@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via dea3d880aff4e50131a1ebf3ad082a70826f1e0c (commit) via f188845237cdfee74dae0658888a61c855e285b3 (commit) via ce7a5ca895d0669b33d213c6fc94f484611d6e24 (commit) via 9d2bada3d4948f2a7c40d3e73ebc0a15d1c2dc3a (commit) via d8934eedaf679d45b2f183aa2f6f70ac1eaa93a1 (commit) from d7ab2e432828b7af15840956a643900ff22479d6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dea3d880aff4e50131a1ebf3ad082a70826f1e0c commit dea3d880aff4e50131a1ebf3ad082a70826f1e0c Merge: d7ab2e4 f188845 Author: Brad King AuthorDate: Mon Jul 28 10:46:23 2014 -0400 Commit: Brad King CommitDate: Mon Jul 28 10:46:23 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 10:45:13 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 10:45:13 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.0.0-23-gce7a5ca Message-ID: <20140728144513.C6A0D4A58E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via ce7a5ca895d0669b33d213c6fc94f484611d6e24 (commit) via cc3248f45231d24061bbc88fa6dd66897162cb3a (commit) via 9d2bada3d4948f2a7c40d3e73ebc0a15d1c2dc3a (commit) via fd63722dc86ec30e8a6f543881d56b3c473da34d (commit) via d8934eedaf679d45b2f183aa2f6f70ac1eaa93a1 (commit) via 3151024d241c581463d20bf0ce3d1060bdd22de4 (commit) from afc452fe210f5b46e5a2c9fbbde70b4e6880d4e9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/QCC-C.cmake | 2 ++ Modules/Compiler/QCC-CXX.cmake | 12 +++++++++++ .../Linux-GNU.cmake => Compiler/QCC.cmake} | 19 ++++++++--------- Modules/Platform/QNX-QCC-C.cmake | 4 ---- Modules/Platform/QNX-QCC-CXX.cmake | 4 ---- Modules/Platform/QNX.cmake | 22 +++----------------- Source/kwsys/SystemInformation.cxx | 5 ++++- Utilities/cmcurl/hostip.c | 2 +- 8 files changed, 31 insertions(+), 39 deletions(-) create mode 100644 Modules/Compiler/QCC-C.cmake create mode 100644 Modules/Compiler/QCC-CXX.cmake copy Modules/{Platform/Linux-GNU.cmake => Compiler/QCC.cmake} (60%) delete mode 100644 Modules/Platform/QNX-QCC-C.cmake delete mode 100644 Modules/Platform/QNX-QCC-CXX.cmake hooks/post-receive -- CMake From daniele.domenichelli at gmail.com Mon Jul 28 11:06:31 2014 From: daniele.domenichelli at gmail.com (Daniele E. Domenichelli) Date: Mon, 28 Jul 2014 11:06:31 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4544-g309d1a6 Message-ID: <20140728150631.C58664B476@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 309d1a645e358d0b88414d6b95e0d13185d8c1f6 (commit) via 8bab4454afa9e364d1ff08501309b902e65d98f2 (commit) via b01fdb58b36bcd6694cf6c5d02a3db70f3befc82 (commit) via 9528e6a6a17a43207fb22e051fa7df06a8844223 (commit) via 855e76e90d249664fafb66b9f0b2d37cfc508a40 (commit) from dea3d880aff4e50131a1ebf3ad082a70826f1e0c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=309d1a645e358d0b88414d6b95e0d13185d8c1f6 commit 309d1a645e358d0b88414d6b95e0d13185d8c1f6 Merge: dea3d88 8bab445 Author: Daniele E. Domenichelli AuthorDate: Mon Jul 28 11:06:30 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 11:06:30 2014 -0400 Merge topic 'CMakePackageConfigHelpers_build_tree' into next 8bab4454 CMakePackageConfigHelpers: Add unit tests for BUILD_TREE option b01fdb58 CMakePackageConfigHelpers: Add BUILD_TREE option 9528e6a6 CMakePackageConfigHelpers: restructure documentation and document commands 855e76e9 CMakePackageConfigHelpers: Remove unused variable http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8bab4454afa9e364d1ff08501309b902e65d98f2 commit 8bab4454afa9e364d1ff08501309b902e65d98f2 Author: Daniele E. Domenichelli AuthorDate: Tue Jul 15 19:51:16 2014 +0200 Commit: Daniele E. Domenichelli CommitDate: Mon Jul 28 17:03:06 2014 +0200 CMakePackageConfigHelpers: Add unit tests for BUILD_TREE option diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 092bf20..5a81b44 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -374,6 +374,7 @@ endif() include(CMakePackageConfigHelpers) +# Generate a config file ready to be installed. set(INCLUDE_INSTALL_DIR include ) set(SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/" ) set(CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" ) @@ -407,6 +408,43 @@ if(Relocatable_FOUND) message(SEND_ERROR "Relocatable_FOUND set to TRUE !") endif() +# Generate a config file for the build tree. +set(INCLUDE_INSTALL_DIR include ) +set(SHARE_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/share/" ) +set(CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" ) + +configure_package_config_file(RelocatableConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake" + INSTALL_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" + PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR + BUILD_TREE + ) + +set(Relocatable_FIND_COMPONENTS AComp BComp CComp) +set(Relocatable_FIND_REQUIRED_BComp 1) +include("${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake") + +if(NOT "${RELOC_INCLUDE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/include") + message(SEND_ERROR "RELOC_INCLUDE_DIR set by configure_package_config_file() is set to \"${RELOC_INCLUDE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/include\")") +endif() + +if(NOT "${RELOC_SHARE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/share/") + message(SEND_ERROR "RELOC_SHARE_DIR set by configure_package_config_file() is set to \"${RELOC_SHARE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/share/\")") +endif() + +if(NOT "${RELOC_BUILD_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") + message(SEND_ERROR "RELOC_BUILD_DIR set by configure_package_config_file() is set to \"${RELOC_BUILD_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}\")") +endif() + +if(NOT DEFINED Relocatable_FOUND) + message(SEND_ERROR "Relocatable_FOUND not defined !") +endif() + +if(Relocatable_FOUND) + message(SEND_ERROR "Relocatable_FOUND set to TRUE !") +endif() + + + #----------------------------------------------------------------------------- # Test write_basic_config_version_file(). http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b01fdb58b36bcd6694cf6c5d02a3db70f3befc82 commit b01fdb58b36bcd6694cf6c5d02a3db70f3befc82 Author: Daniele E. Domenichelli AuthorDate: Tue Jul 15 19:10:54 2014 +0200 Commit: Daniele E. Domenichelli CommitDate: Mon Jul 28 17:03:06 2014 +0200 CMakePackageConfigHelpers: Add BUILD_TREE option This option instructs configure_package_config_file to consider paths that are not absolute as relative to the CMAKE_BINARY_DIR directory instead of relative to the CMAKE_INSTALL_PREFIX` directory. The new signature is therefore: configure_package_config_file( INSTALL_DESTINATION [PATH_VARS ... ] [NO_SET_AND_CHECK_MACRO] [NO_CHECK_REQUIRED_COMPONENTS_MACRO] [BUILD_TREE]) diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index 712ced2..8ec9c69 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -18,7 +18,8 @@ # configure_package_config_file( INSTALL_DESTINATION # [PATH_VARS ... ] # [NO_SET_AND_CHECK_MACRO] -# [NO_CHECK_REQUIRED_COMPONENTS_MACRO]) +# [NO_CHECK_REQUIRED_COMPONENTS_MACRO] +# [BUILD_TREE]) # # # ``configure_package_config_file()`` should be used instead of the plain @@ -77,6 +78,12 @@ # only if the absolute location is a subdirectory of # :variable:`CMAKE_INSTALL_PREFIX`. # +# When generating a FooConfig.cmake file to use your package from the build +# tree the option ``BUILD_TREE`` should be passed, in order to consider +# paths that are not absolute as relative to the +# :cmake:variable:`CMAKE_BINARY_DIR` directory instead of relative to the +# :cmake:variable:`CMAKE_INSTALL_PREFIX` directory. +# # By default ``configure_package_config_file`` also generates two helper macros, # ``set_and_check()`` and ``check_required_components()`` into the # ``FooConfig.cmake`` file. @@ -209,7 +216,7 @@ macro(WRITE_BASIC_PACKAGE_VERSION_FILE) endmacro() function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) - set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO) + set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO BUILD_TREE) set(oneValueArgs INSTALL_DESTINATION ) set(multiValueArgs PATH_VARS ) @@ -225,19 +232,31 @@ function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}") set(absInstallDir "${CCF_INSTALL_DESTINATION}") + elseif(CCF_BUILD_TREE) + set(absInstallDir "${CMAKE_BINARY_DIR}/${CCF_INSTALL_DESTINATION}") else() set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}") endif() - file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" ) + + if(CCF_BUILD_TREE) + file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_BINARY_DIR}" ) + else() + file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" ) + endif() foreach(var ${CCF_PATH_VARS}) if(NOT DEFINED ${var}) message(FATAL_ERROR "Variable ${var} does not exist") else() if(IS_ABSOLUTE "${${var}}") - string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}" - PACKAGE_${var} "${${var}}") + if(CCF_BUILD_TREE) + string(REPLACE "${CMAKE_BINARY_DIR}" "\${PACKAGE_PREFIX_DIR}" + PACKAGE_${var} "${${var}}") + else() + string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}" + PACKAGE_${var} "${${var}}") + endif() else() set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}") endif() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9528e6a6a17a43207fb22e051fa7df06a8844223 commit 9528e6a6a17a43207fb22e051fa7df06a8844223 Author: Daniele E. Domenichelli AuthorDate: Tue Jul 15 19:10:28 2014 +0200 Commit: Daniele E. Domenichelli CommitDate: Mon Jul 28 17:03:06 2014 +0200 CMakePackageConfigHelpers: restructure documentation and document commands diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index 318382e..712ced2 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -2,29 +2,35 @@ # CMakePackageConfigHelpers # ------------------------- # -# CONFIGURE_PACKAGE_CONFIG_FILE(), WRITE_BASIC_PACKAGE_VERSION_FILE() +# Helpers functions for creating config files that can be included by other +# projects to find and use a package. # +# Adds the :command:`configure_package_config_file()` and +# :command:`write_basic_package_version_file()` commands. # +# Generating a Package Configuration File +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # -# :: +# .. command:: configure_package_config_file # -# CONFIGURE_PACKAGE_CONFIG_FILE( INSTALL_DESTINATION +# Create a config file for a project:: +# +# configure_package_config_file( INSTALL_DESTINATION # [PATH_VARS ... ] # [NO_SET_AND_CHECK_MACRO] # [NO_CHECK_REQUIRED_COMPONENTS_MACRO]) # # +# ``configure_package_config_file()`` should be used instead of the plain +# :command:`configure_file()` command when creating the ``Config.cmake`` +# or ``-config.cmake`` file for installing a project or library. It helps +# making the resulting package relocatable by avoiding hardcoded paths in the +# installed ``Config.cmake`` file. # -# CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain -# configure_file() command when creating the Config.cmake or -# -config.cmake file for installing a project or library. It -# helps making the resulting package relocatable by avoiding hardcoded -# paths in the installed Config.cmake file. -# -# In a FooConfig.cmake file there may be code like this to make the -# install destinations know to the using project: +# In a ``FooConfig.cmake`` file there may be code like this to make the install +# destinations know to the using project: # -# :: +# .. code-block:: cmake # # set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" ) # set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" ) @@ -32,121 +38,126 @@ # ...logic to determine installedPrefix from the own location... # set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" ) # -# All 4 options shown above are not sufficient, since the first 3 -# hardcode the absolute directory locations, and the 4th case works only -# if the logic to determine the installedPrefix is correct, and if -# CONFIG_INSTALL_DIR contains a relative path, which in general cannot -# be guaranteed. This has the effect that the resulting FooConfig.cmake -# file would work poorly under Windows and OSX, where users are used to -# choose the install location of a binary package at install time, -# independent from how CMAKE_INSTALL_PREFIX was set at build/cmake time. -# -# Using CONFIGURE_PACKAGE_CONFIG_FILE() helps. If used correctly, it -# makes the resulting FooConfig.cmake file relocatable. Usage: +# All 4 options shown above are not sufficient, since the first 3 hardcode the +# absolute directory locations, and the 4th case works only if the logic to +# determine the ``installedPrefix`` is correct, and if ``CONFIG_INSTALL_DIR`` +# contains a relative path, which in general cannot be guaranteed. This has the +# effect that the resulting ``FooConfig.cmake`` file would work poorly under +# Windows and OSX, where users are used to choose the install location of a +# binary package at install time, independent from how +# :variable:`CMAKE_INSTALL_PREFIX` was set at build/cmake time. # -# :: +# Using ``configure_package_config_file`` helps. If used correctly, it makes +# the resulting ``FooConfig.cmake`` file relocatable. Usage: # -# 1. write a FooConfig.cmake.in file as you are used to -# 2. insert a line containing only the string "@PACKAGE_INIT@" -# 3. instead of set(FOO_DIR "@SOME_INSTALL_DIR@"), use set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@") -# (this must be after the @PACKAGE_INIT@ line) -# 4. instead of using the normal configure_file(), use CONFIGURE_PACKAGE_CONFIG_FILE() +# 1. write a ``FooConfig.cmake.in`` file as you are used to +# 2. insert a line containing only the string ``@PACKAGE_INIT@`` +# 3. instead of ``set(FOO_DIR "@SOME_INSTALL_DIR@")``, use +# ``set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@")`` (this must be after the +# ``@PACKAGE_INIT@`` line) +# 4. instead of using the normal :command:`configure_file()`, use +# ``configure_package_config_file()`` # # # -# The and arguments are the input and output file, the -# same way as in configure_file(). +# The ```` and ```` arguments are the input and output file, the +# same way as in :command:`configure_file()`. # -# The given to INSTALL_DESTINATION must be the destination where -# the FooConfig.cmake file will be installed to. This can either be a +# The ```` given to ``INSTALL_DESTINATION`` must be the destination where +# the ``FooConfig.cmake`` file will be installed to. This can either be a # relative or absolute path, both work. # -# The variables to given as PATH_VARS are the variables -# which contain install destinations. For each of them the macro will -# create a helper variable PACKAGE_. These helper variables -# must be used in the FooConfig.cmake.in file for setting the installed -# location. They are calculated by CONFIGURE_PACKAGE_CONFIG_FILE() so -# that they are always relative to the installed location of the -# package. This works both for relative and also for absolute -# locations. For absolute locations it works only if the absolute -# location is a subdirectory of CMAKE_INSTALL_PREFIX. -# -# By default configure_package_config_file() also generates two helper -# macros, set_and_check() and check_required_components() into the -# FooConfig.cmake file. -# -# set_and_check() should be used instead of the normal set() command for -# setting directories and file locations. Additionally to setting the -# variable it also checks that the referenced file or directory actually -# exists and fails with a FATAL_ERROR otherwise. This makes sure that -# the created FooConfig.cmake file does not contain wrong references. -# When using the NO_SET_AND_CHECK_MACRO, this macro is not generated -# into the FooConfig.cmake file. -# -# check_required_components() should be called at the end -# of the FooConfig.cmake file if the package supports components. This -# macro checks whether all requested, non-optional components have been -# found, and if this is not the case, sets the Foo_FOUND variable to -# FALSE, so that the package is considered to be not found. It does -# that by testing the Foo__FOUND variables for all requested -# required components. When using the NO_CHECK_REQUIRED_COMPONENTS -# option, this macro is not generated into the FooConfig.cmake file. +# The variables ```` to ```` given as ``PATH_VARS`` are the +# variables which contain install destinations. For each of them the macro will +# create a helper variable ``PACKAGE_``. These helper variables must be +# used in the ``FooConfig.cmake.in`` file for setting the installed location. +# They are calculated by ``configure_package_config_file`` so that they are +# always relative to the installed location of the package. This works both for +# relative and also for absolute locations. For absolute locations it works +# only if the absolute location is a subdirectory of +# :variable:`CMAKE_INSTALL_PREFIX`. +# +# By default ``configure_package_config_file`` also generates two helper macros, +# ``set_and_check()`` and ``check_required_components()`` into the +# ``FooConfig.cmake`` file. +# +# ``set_and_check()`` should be used instead of the normal ``set()`` command for +# setting directories and file locations. Additionally to setting the variable +# it also checks that the referenced file or directory actually exists and fails? +# with a ``FATAL_ERROR`` otherwise. This makes sure that the created +# ``FooConfig.cmake`` file does not contain wrong references. +# When using the ``NO_SET_AND_CHECK_MACRO``, this macro is not generated +# into the ``FooConfig.cmake`` file. +# +# ``check_required_components()`` should be called at the end of +# the ``FooConfig.cmake`` file if the package supports components. This macro +# checks whether all requested, non-optional components have been found, and if +# this is not the case, sets the ``Foo_FOUND`` variable to ``FALSE``, so that +# the package is considered to be not found. It does that by testing the +# ``Foo__FOUND`` variables for all requested required components. +# When using the ``NO_CHECK_REQUIRED_COMPONENTS_MACRO`` option, this macro is +# not generated into the ``FooConfig.cmake`` file. # # For an example see below the documentation for -# WRITE_BASIC_PACKAGE_VERSION_FILE(). -# -# -# -# :: -# -# WRITE_BASIC_PACKAGE_VERSION_FILE( filename [VERSION major.minor.patch] COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) ) -# -# -# -# Writes a file for use as ConfigVersion.cmake file to -# . See the documentation of find_package() for details on -# this. -# -# :: -# -# filename is the output filename, it should be in the build tree. -# major.minor.patch is the version number of the project to be installed -# -# If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable -# is used. If this hasn't been set, it errors out. -# -# The COMPATIBILITY mode AnyNewerVersion means that the installed -# package version will be considered compatible if it is newer or -# exactly the same as the requested version. This mode should be used -# for packages which are fully backward compatible, also across major -# versions. If SameMajorVersion is used instead, then the behaviour -# differs from AnyNewerVersion in that the major version number must be -# the same as requested, e.g. version 2.0 will not be considered -# compatible if 1.0 is requested. This mode should be used for packages -# which guarantee backward compatibility within the same major version. -# If ExactVersion is used, then the package is only considered -# compatible if the requested version matches exactly its own version -# number (not considering the tweak version). For example, version -# 1.2.3 of a package is only considered compatible to requested version -# 1.2.3. This mode is for packages without compatibility guarantees. -# If your project has more elaborated version matching rules, you will -# need to write your own custom ConfigVersion.cmake file instead of -# using this macro. -# -# Internally, this macro executes configure_file() to create the -# resulting version file. Depending on the COMPATIBLITY, either the -# file BasicConfigVersion-SameMajorVersion.cmake.in or -# BasicConfigVersion-AnyNewerVersion.cmake.in is used. Please note that +# :command:`write_basic_package_version_file()`. +# +# Generating a Package Version File +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# .. command:: write_basic_package_version_file +# +# Create a version file for a project:: +# +# write_basic_package_version_file( +# [VERSION ] +# COMPATIBILITY ) +# +# +# Writes a file for use as ``ConfigVersion.cmake`` file to +# ````. See the documentation of :command:`find_package()` for +# details on this. +# +# ```` is the output filename, it should be in the build tree. +# ```` is the version number of the project to be installed. +# +# If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable is used. +# If this hasn't been set, it errors out. +# +# The ``COMPATIBILITY`` mode ``AnyNewerVersion`` means that the installed +# package version will be considered compatible if it is newer or exactly the +# same as the requested version. This mode should be used for packages which +# are fully backward compatible, also across major versions. +# If ``SameMajorVersion`` is used instead, then the behaviour differs from +# ``AnyNewerVersion`` in that the major version number must be the same as +# requested, e.g. version 2.0 will not be considered compatible if 1.0 is +# requested. This mode should be used for packages which guarantee backward +# compatibility within the same major version. +# If ``ExactVersion`` is used, then the package is only considered compatible if +# the requested version matches exactly its own version number (not considering +# the tweak version). For example, version 1.2.3 of a package is only +# considered compatible to requested version 1.2.3. This mode is for packages +# without compatibility guarantees. +# If your project has more elaborated version matching rules, you will need to +# write your own custom ``ConfigVersion.cmake`` file instead of using this +# macro. +# +# Internally, this macro executes :command:`configure_file()` to create the +# resulting version file. Depending on the ``COMPATIBLITY``, either the file +# ``BasicConfigVersion-SameMajorVersion.cmake.in`` or +# ``BasicConfigVersion-AnyNewerVersion.cmake.in`` is used. Please note that # these two files are internal to CMake and you should not call -# configure_file() on them yourself, but they can be used as starting -# point to create more sophisticted custom ConfigVersion.cmake files. +# :command:`configure_file()` on them yourself, but they can be used as starting +# point to create more sophisticted custom ``ConfigVersion.cmake`` files. # +# Example Generating Package Files +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # +# Example using both :command:`configure_package_config_file` and +# ``write_basic_package_version_file()``: # -# Example using both configure_package_config_file() and -# write_basic_package_version_file(): CMakeLists.txt: +# ``CMakeLists.txt``: # -# :: +# .. code-block:: cmake # # set(INCLUDE_INSTALL_DIR include/ ... CACHE ) # set(LIB_INSTALL_DIR lib/ ... CACHE ) @@ -162,11 +173,9 @@ # install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake # DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake ) # +# ``FooConfig.cmake.in``: # -# -# With a FooConfig.cmake.in: -# -# :: +# .. code-block:: cmake # # set(FOO_VERSION x.y.z) # ... @@ -175,10 +184,6 @@ # set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") # set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@") # -# -# -# :: -# # check_required_components(Foo) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=855e76e90d249664fafb66b9f0b2d37cfc508a40 commit 855e76e90d249664fafb66b9f0b2d37cfc508a40 Author: Daniele E. Domenichelli AuthorDate: Tue Jul 15 18:47:05 2014 +0200 Commit: Daniele E. Domenichelli CommitDate: Mon Jul 28 17:03:06 2014 +0200 CMakePackageConfigHelpers: Remove unused variable diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index 473bbe5..318382e 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -203,8 +203,6 @@ macro(WRITE_BASIC_PACKAGE_VERSION_FILE) write_basic_config_version_file(${ARGN}) endmacro() -set(cfpch_dir ${CMAKE_CURRENT_LIST_DIR}) - function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO) set(oneValueArgs INSTALL_DESTINATION ) ----------------------------------------------------------------------- Summary of changes: Modules/CMakePackageConfigHelpers.cmake | 276 +++++++++++++++++-------------- Tests/FindPackageTest/CMakeLists.txt | 38 +++++ 2 files changed, 187 insertions(+), 127 deletions(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Mon Jul 28 11:49:24 2014 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Mon, 28 Jul 2014 11:49:24 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4547-gdf5e2d8 Message-ID: <20140728154924.D593E4AC6D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via df5e2d8d9bd26508d1d3e4fa974928ff16aaf42d (commit) via 4869bb3f75c5776134a2ceb4a54619ec23a355df (commit) via 6dda62e70bd12ef813377b4a699500e131483346 (commit) from 309d1a645e358d0b88414d6b95e0d13185d8c1f6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=df5e2d8d9bd26508d1d3e4fa974928ff16aaf42d commit df5e2d8d9bd26508d1d3e4fa974928ff16aaf42d Merge: 309d1a6 4869bb3 Author: Nils Gladitz AuthorDate: Mon Jul 28 11:49:24 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 11:49:24 2014 -0400 Merge topic 'pdb-genex' into next 4869bb3f Genex: Disallow PDB genex on targets not created by linker 6dda62e7 Genex: Revise documentation on PDB generator expressions http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4869bb3f75c5776134a2ceb4a54619ec23a355df commit 4869bb3f75c5776134a2ceb4a54619ec23a355df Author: Nils Gladitz AuthorDate: Mon Jul 28 17:48:13 2014 +0200 Commit: Nils Gladitz CommitDate: Mon Jul 28 17:48:13 2014 +0200 Genex: Disallow PDB genex on targets not created by linker diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index e3a7681..35df9cd 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1563,8 +1563,28 @@ struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *) + const GeneratorExpressionContent *content) { + if(!target->IsDLLPlatform()) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_PDB_FILE is only allowed " + "for DLL target platforms."); + return std::string(); + } + + cmTarget::TargetType targetType = target->GetType(); + + if(targetType != cmTarget::SHARED_LIBRARY && + targetType != cmTarget::MODULE_LIBRARY && + targetType != cmTarget::EXECUTABLE) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_PDB_FILE is allowed only for " + "targets with linker created artifacts."); + return std::string(); + } + std::string result = target->GetPDBDirectory(context->Config); result += "/"; result += target->GetPDBName(context->Config); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6dda62e70bd12ef813377b4a699500e131483346 commit 6dda62e70bd12ef813377b4a699500e131483346 Author: Nils Gladitz AuthorDate: Mon Jul 28 16:52:11 2014 +0200 Commit: Nils Gladitz CommitDate: Mon Jul 28 16:52:11 2014 +0200 Genex: Revise documentation on PDB generator expressions diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 4f55687..77259a0 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -149,11 +149,16 @@ than 4.2.0. ``$`` Directory of with soname (.so.3). ``$`` - Full path to program database file (.pdb) where ``tgt`` is the name of a target. + Full path to the linker generated program database file (.pdb) + where ``tgt`` is the name of a target. + + See also the :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY` + target properties and their configuration specific variants + :prop_tgt:`PDB_NAME_` and :prop_tgt:`PDB_OUTPUT_DIRECTORY_`. ``$`` - Name of program database file (.pdb). + Name of the linker generated program database file (.pdb). ``$`` - Directory of program database file (.pdb). + Directory of the linker generated program database file (.pdb). ``$`` Value of the property ``prop`` on the target ``tgt``. ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 11 ++++++++--- Source/cmGeneratorExpressionEvaluator.cxx | 22 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Mon Jul 28 11:50:13 2014 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Mon, 28 Jul 2014 11:50:13 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4549-g32adeae Message-ID: <20140728155013.B5F934AD01@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 32adeae6c4c1edae5087c0a7ddb833f65aa79de8 (commit) via c161023ca9fcddbb5ab09d7fc732ecc0c5fdba94 (commit) from df5e2d8d9bd26508d1d3e4fa974928ff16aaf42d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=32adeae6c4c1edae5087c0a7ddb833f65aa79de8 commit 32adeae6c4c1edae5087c0a7ddb833f65aa79de8 Merge: df5e2d8 c161023 Author: Nils Gladitz AuthorDate: Mon Jul 28 11:50:13 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 11:50:13 2014 -0400 Merge topic 'pdb-genex' into next c161023c Genex: Implement generator expressions for target PDB files. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c161023ca9fcddbb5ab09d7fc732ecc0c5fdba94 commit c161023ca9fcddbb5ab09d7fc732ecc0c5fdba94 Author: Nils Gladitz AuthorDate: Thu Jul 24 22:18:21 2014 +0200 Commit: Nils Gladitz CommitDate: Mon Jul 28 17:49:54 2014 +0200 Genex: Implement generator expressions for target PDB files. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index bc24798..77259a0 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -148,6 +148,17 @@ than 4.2.0. Name of file with soname (.so.3). ``$`` Directory of with soname (.so.3). +``$`` + Full path to the linker generated program database file (.pdb) + where ``tgt`` is the name of a target. + + See also the :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY` + target properties and their configuration specific variants + :prop_tgt:`PDB_NAME_` and :prop_tgt:`PDB_OUTPUT_DIRECTORY_`. +``$`` + Name of the linker generated program database file (.pdb). +``$`` + Directory of the linker generated program database file (.pdb). ``$`` Value of the property ``prop`` on the target ``tgt``. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 6f940a6..35df9cd 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1512,6 +1512,7 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode class ArtifactNameTag; class ArtifactLinkerTag; class ArtifactSonameTag; +class ArtifactPdbTag; class ArtifactPathTag; class ArtifactDirTag; @@ -1558,6 +1559,41 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) + { + if(!target->IsDLLPlatform()) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_PDB_FILE is only allowed " + "for DLL target platforms."); + return std::string(); + } + + cmTarget::TargetType targetType = target->GetType(); + + if(targetType != cmTarget::SHARED_LIBRARY && + targetType != cmTarget::MODULE_LIBRARY && + targetType != cmTarget::EXECUTABLE) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_PDB_FILE is allowed only for " + "targets with linker created artifacts."); + return std::string(); + } + + std::string result = target->GetPDBDirectory(context->Config); + result += "/"; + result += target->GetPDBName(context->Config); + return result; + } +}; + +//---------------------------------------------------------------------------- +template<> struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, @@ -1706,6 +1742,9 @@ TargetFilesystemArtifactNodeGroup targetLinkerNodeGroup; static const TargetFilesystemArtifactNodeGroup targetSoNameNodeGroup; +static const +TargetFilesystemArtifactNodeGroup targetPdbNodeGroup; + //---------------------------------------------------------------------------- static const cmGeneratorExpressionNode* GetNode(const std::string &identifier) @@ -1733,12 +1772,15 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) nodeMap["TARGET_FILE"] = &targetNodeGroup.File; nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File; nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File; + nodeMap["TARGET_PDB_FILE"] = &targetPdbNodeGroup.File; nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName; nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName; nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName; + nodeMap["TARGET_PDB_FILE_NAME"] = &targetPdbNodeGroup.FileName; nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir; nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; + nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir; nodeMap["STREQUAL"] = &strEqualNode; nodeMap["EQUAL"] = &equalNode; nodeMap["LOWER_CASE"] = &lowerCaseNode; ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 12:45:23 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 12:45:23 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4551-g53ecb02 Message-ID: <20140728164523.58B114AA37@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 53ecb02357acb3e5b520aa400d1205e8d823b957 (commit) via 8c03f157765256113928edb5e58ef3a5cf82125c (commit) from 32adeae6c4c1edae5087c0a7ddb833f65aa79de8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=53ecb02357acb3e5b520aa400d1205e8d823b957 commit 53ecb02357acb3e5b520aa400d1205e8d823b957 Merge: 32adeae 8c03f15 Author: Brad King AuthorDate: Mon Jul 28 12:45:22 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 12:45:22 2014 -0400 Merge topic 'doc-tll-flags' into next 8c03f157 Help: Clarify target_link_libraries treatment of flags (#15034) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c03f157765256113928edb5e58ef3a5cf82125c commit 8c03f157765256113928edb5e58ef3a5cf82125c Author: Brad King AuthorDate: Mon Jul 28 12:45:06 2014 -0400 Commit: Brad King CommitDate: Mon Jul 28 12:45:06 2014 -0400 Help: Clarify target_link_libraries treatment of flags (#15034) Explain that link flags should not be used in transitive contexts. diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst index bced169..39537a7 100644 --- a/Help/command/target_link_libraries.rst +++ b/Help/command/target_link_libraries.rst @@ -18,7 +18,10 @@ If a library name matches that of another target in the project a dependency will automatically be added in the build system to make sure the library being linked is up-to-date before the target links. Item names starting with ``-``, but not ``-l`` or ``-framework``, are treated as -linker flags. +linker flags. Note that such flags will be treated like any other library +link item for purposes of transitive dependencies, so they are generally +safe to specify only as private link items that will not propagate to +dependents of ````. A ``debug``, ``optimized``, or ``general`` keyword indicates that the library immediately following it is to be used only for the ----------------------------------------------------------------------- Summary of changes: Help/command/target_link_libraries.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 13:14:58 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 13:14:58 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4553-ge5c672d Message-ID: <20140728171458.BE13E4A768@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via e5c672d0d46ee61ccd9c789ba0aaf0c20916b567 (commit) via 608cf8149ccbf8954926ab7c86fd658099a52f7b (commit) from 53ecb02357acb3e5b520aa400d1205e8d823b957 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e5c672d0d46ee61ccd9c789ba0aaf0c20916b567 commit e5c672d0d46ee61ccd9c789ba0aaf0c20916b567 Merge: 53ecb02 608cf81 Author: Brad King AuthorDate: Mon Jul 28 13:14:58 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 13:14:58 2014 -0400 Merge topic 'xcode-6-librarian-flags' into next 608cf814 Xcode: Fix static library creation for Xcode 6 (#15038) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=608cf8149ccbf8954926ab7c86fd658099a52f7b commit 608cf8149ccbf8954926ab7c86fd658099a52f7b Author: Brad King AuthorDate: Mon Jul 28 11:41:53 2014 -0400 Commit: Brad King CommitDate: Mon Jul 28 13:06:33 2014 -0400 Xcode: Fix static library creation for Xcode 6 (#15038) Xcode 6 introduced an 'OTHER_LIBTOOLFLAGS' setting for the "Other Librarian Flags" of a static library. Now 'OTHER_LDFLAGS' are ignored. Teach the Xcode generator to choose the correct name for the build setting based on the type of target and the version of Xcode. Inspired-by: Jamie Kirkpatrick diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 484b28f..3503e19 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2298,7 +2298,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, } } - buildSettings->AddAttribute("OTHER_LDFLAGS", + buildSettings->AddAttribute(this->GetTargetLinkFlagsVar(target), this->CreateString(extraLinkOptions.c_str())); buildSettings->AddAttribute("OTHER_REZFLAGS", this->CreateString("")); @@ -2522,6 +2522,22 @@ std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target, } //---------------------------------------------------------------------------- +const char* +cmGlobalXCodeGenerator::GetTargetLinkFlagsVar(cmTarget const& cmtarget) const +{ + if(this->XcodeVersion >= 60 && + (cmtarget.GetType() == cmTarget::STATIC_LIBRARY || + cmtarget.GetType() == cmTarget::OBJECT_LIBRARY)) + { + return "OTHER_LIBTOOLFLAGS"; + } + else + { + return "OTHER_LDFLAGS"; + } +} + +//---------------------------------------------------------------------------- const char* cmGlobalXCodeGenerator::GetTargetFileType(cmTarget& cmtarget) { switch(cmtarget.GetType()) @@ -2834,8 +2850,9 @@ void cmGlobalXCodeGenerator sep = " "; linkObjs += this->XCodeEscapePath(oi->c_str()); } - this->AppendBuildSettingAttribute(target, "OTHER_LDFLAGS", - linkObjs.c_str(), configName); + this->AppendBuildSettingAttribute( + target, this->GetTargetLinkFlagsVar(*cmtarget), + linkObjs.c_str(), configName); } // Skip link information for object libraries. @@ -2913,8 +2930,9 @@ void cmGlobalXCodeGenerator target->AddDependTarget(configName, li->Target->GetName()); } } - this->AppendBuildSettingAttribute(target, "OTHER_LDFLAGS", - linkLibs.c_str(), configName); + this->AppendBuildSettingAttribute( + target, this->GetTargetLinkFlagsVar(*cmtarget), + linkLibs.c_str(), configName); } } } diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index c9d20c2..a7b54e9 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -141,6 +141,7 @@ private: cmXCodeObject* buildPhases); void ForceLinkerLanguages(); void ForceLinkerLanguage(cmTarget& cmtarget); + const char* GetTargetLinkFlagsVar(cmTarget const& cmtarget) const; const char* GetTargetFileType(cmTarget& cmtarget); const char* GetTargetProductType(cmTarget& cmtarget); std::string AddConfigurations(cmXCodeObject* target, cmTarget& cmtarget); ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalXCodeGenerator.cxx | 28 +++++++++++++++++++++++----- Source/cmGlobalXCodeGenerator.h | 1 + 2 files changed, 24 insertions(+), 5 deletions(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Mon Jul 28 15:08:53 2014 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Mon, 28 Jul 2014 15:08:53 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4555-g2a4a4c3 Message-ID: <20140728190853.946FA4BC4A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 2a4a4c3f152c7de8ca4cf13170d0ddbfdb587274 (commit) via 9e5e7e71c5b34f442be4008daf7be7e33438556a (commit) from e5c672d0d46ee61ccd9c789ba0aaf0c20916b567 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2a4a4c3f152c7de8ca4cf13170d0ddbfdb587274 commit 2a4a4c3f152c7de8ca4cf13170d0ddbfdb587274 Merge: e5c672d 9e5e7e7 Author: Nils Gladitz AuthorDate: Mon Jul 28 15:08:52 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 15:08:52 2014 -0400 Merge topic 'fix-qthelp-windows' into next 9e5e7e71 Help: Fix QtHelp commands on Windows http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e5e7e71c5b34f442be4008daf7be7e33438556a commit 9e5e7e71c5b34f442be4008daf7be7e33438556a Author: Nils Gladitz AuthorDate: Mon Jul 28 21:07:53 2014 +0200 Commit: Nils Gladitz CommitDate: Mon Jul 28 21:07:53 2014 +0200 Help: Fix QtHelp commands on Windows Explicitly invoke python script through the interpreter since windows does not act on hashbangs. Use the found qcollectiongenerator executable rather than what happens to be in PATH. diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index fd8cda9..a58604e 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -69,6 +69,8 @@ if(SPHINX_TEXT) list(APPEND doc_formats text) endif() if(SPHINX_QTHELP) + find_package(PythonInterp REQUIRED) + find_program(QCOLLECTIONGENERATOR_EXECUTABLE NAMES qcollectiongenerator DOC "qcollectiongenerator tool" @@ -91,9 +93,12 @@ if(SPHINX_QTHELP) # Create proper identifiers. Workaround for # https://bitbucket.org/birkenfeld/sphinx/issue/1491/qthelp-should-generate-identifiers-for - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/create_identifiers.py" "${CMAKE_CURRENT_BINARY_DIR}/qthelp/" + COMMAND "${PYTHON_EXECUTABLE}" + "${CMAKE_CURRENT_SOURCE_DIR}/create_identifiers.py" + "${CMAKE_CURRENT_BINARY_DIR}/qthelp/" - COMMAND qcollectiongenerator ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake.qhcp + COMMAND ${QCOLLECTIONGENERATOR_EXECUTABLE} + ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake.qhcp ) endif() ----------------------------------------------------------------------- Summary of changes: Utilities/Sphinx/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 16:23:05 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 16:23:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4559-g4dbe189 Message-ID: <20140728202305.7EBC04B79B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 4dbe18970588193b9b181bd6c8b5102bb2cfb1c9 (commit) via 7079f33d6ac00f9417d2d7aa222c8d0675ce3752 (commit) via 05373f7ea79f950bf56657e6b5aabb02b34d4c76 (commit) via 1acde6b003812e9964bdf67db5c1ce68a566e675 (commit) from 2a4a4c3f152c7de8ca4cf13170d0ddbfdb587274 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4dbe18970588193b9b181bd6c8b5102bb2cfb1c9 commit 4dbe18970588193b9b181bd6c8b5102bb2cfb1c9 Merge: 2a4a4c3 7079f33 Author: Brad King AuthorDate: Mon Jul 28 16:23:04 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 16:23:04 2014 -0400 Merge topic 'windows-ce-cleanup' into next 7079f33d WindowsCE: Drop unused Platform/WindowsCE-MSVC module 05373f7e WindowsCE: Refactor setting of "WINCE" 1acde6b0 MSVC: Use STREQUAL to check for WindowsCE http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7079f33d6ac00f9417d2d7aa222c8d0675ce3752 commit 7079f33d6ac00f9417d2d7aa222c8d0675ce3752 Author: Brad King AuthorDate: Mon Jul 28 14:06:52 2014 -0400 Commit: Brad King CommitDate: Mon Jul 28 16:21:50 2014 -0400 WindowsCE: Drop unused Platform/WindowsCE-MSVC module This module was created to mirror Platform/Windows-MSVC.cmake, but this is not necessary because nothing includes "Platform/-.cmake" directly. The Platform/Windows-MSVC module is only a helper for the Platform/Windows-MSVC- modules. diff --git a/Modules/Platform/WindowsCE-MSVC.cmake b/Modules/Platform/WindowsCE-MSVC.cmake deleted file mode 100644 index d28b4ab..0000000 --- a/Modules/Platform/WindowsCE-MSVC.cmake +++ /dev/null @@ -1 +0,0 @@ -include(Platform/Windows-MSVC) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=05373f7ea79f950bf56657e6b5aabb02b34d4c76 commit 05373f7ea79f950bf56657e6b5aabb02b34d4c76 Author: Brad King AuthorDate: Mon Jul 28 14:14:58 2014 -0400 Commit: Brad King CommitDate: Mon Jul 28 16:21:47 2014 -0400 WindowsCE: Refactor setting of "WINCE" Move it to the Platform/Windows module since it is independent of the compiler used. While at it, remove redundant "WIN32" setting from Platform/Windows-MSVC since Plaform/Windows already sets its. diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 5b57ee7..2cfe6fe 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -36,13 +36,10 @@ else() set(CMAKE_CL_NOLOGO "/nologo") endif() -set(WIN32 1) - if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE") set(CMAKE_CREATE_WIN32_EXE "/entry:WinMainCRTStartup") set(CMAKE_CREATE_CONSOLE_EXE "/entry:mainACRTStartup") set(_PLATFORM_LINK_FLAGS " /subsystem:windowsce") - set(WINCE 1) else() set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows") set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console") diff --git a/Modules/Platform/Windows.cmake b/Modules/Platform/Windows.cmake index b158a9d..7e97111 100644 --- a/Modules/Platform/Windows.cmake +++ b/Modules/Platform/Windows.cmake @@ -1,5 +1,9 @@ set(WIN32 1) +if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE") + set(WINCE 1) +endif() + set(CMAKE_STATIC_LIBRARY_PREFIX "") set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") set(CMAKE_SHARED_LIBRARY_PREFIX "") # lib http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1acde6b003812e9964bdf67db5c1ce68a566e675 commit 1acde6b003812e9964bdf67db5c1ce68a566e675 Author: Brad King AuthorDate: Mon Jul 28 14:12:39 2014 -0400 Commit: Brad King CommitDate: Mon Jul 28 16:21:45 2014 -0400 MSVC: Use STREQUAL to check for WindowsCE In the Platform/Windows-MSVC module it is not necessary to use MATCHES because we are comparing against an exact string. diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 8e988c9..5b57ee7 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -38,7 +38,7 @@ endif() set(WIN32 1) -if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE") +if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE") set(CMAKE_CREATE_WIN32_EXE "/entry:WinMainCRTStartup") set(CMAKE_CREATE_CONSOLE_EXE "/entry:mainACRTStartup") set(_PLATFORM_LINK_FLAGS " /subsystem:windowsce") ----------------------------------------------------------------------- Summary of changes: Modules/Platform/Windows-MSVC.cmake | 5 +---- Modules/Platform/Windows.cmake | 4 ++++ Modules/Platform/WindowsCE-MSVC.cmake | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 Modules/Platform/WindowsCE-MSVC.cmake hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 16:24:04 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 16:24:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4561-g4cedb1e Message-ID: <20140728202404.893D84B818@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 4cedb1e377afb5ee7f6cbf8f2016bb0ff6d03e95 (commit) via 99e14a3865f96371284daef463df5e261b5698e3 (commit) from 4dbe18970588193b9b181bd6c8b5102bb2cfb1c9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4cedb1e377afb5ee7f6cbf8f2016bb0ff6d03e95 commit 4cedb1e377afb5ee7f6cbf8f2016bb0ff6d03e95 Merge: 4dbe189 99e14a3 Author: Brad King AuthorDate: Mon Jul 28 16:24:03 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 16:24:03 2014 -0400 Merge topic 'vs10-comment-typo' into next 99e14a38 cmGlobalVisualStudio10Generator: Fix typo KHLM => HKLM http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=99e14a3865f96371284daef463df5e261b5698e3 commit 99e14a3865f96371284daef463df5e261b5698e3 Author: Gilles Khouzam AuthorDate: Mon Jul 28 14:04:45 2014 -0400 Commit: Brad King CommitDate: Mon Jul 28 16:23:54 2014 -0400 cmGlobalVisualStudio10Generator: Fix typo KHLM => HKLM diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index c1b087a..80fd9f0 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -435,7 +435,7 @@ bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf) // This edition does not come with 64-bit tools. Look for them. // // TODO: Detect available tools? x64\v100 exists but does not work? - // KHLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0;VCTargetsPath + // HKLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0;VCTargetsPath // c:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/Platforms/ // {Itanium,Win32,x64}/PlatformToolsets/{v100,v90,Windows7.1SDK} std::string winSDK_7_1; ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalVisualStudio10Generator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Jul 28 16:29:28 2014 From: brad.king at kitware.com (Brad King) Date: Mon, 28 Jul 2014 16:29:28 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4564-g7f962df Message-ID: <20140728202929.6E2134BA6C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 7f962dfebf65a6d0aa386c5def86d85725da34bd (commit) via e58f97531aa6e2a124540f38b5acd18fd989cf3b (commit) via d0dd28fa92cb2223e20f3586b8973a931aa61dac (commit) from 4cedb1e377afb5ee7f6cbf8f2016bb0ff6d03e95 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7f962dfebf65a6d0aa386c5def86d85725da34bd commit 7f962dfebf65a6d0aa386c5def86d85725da34bd Merge: 4cedb1e e58f975 Author: Brad King AuthorDate: Mon Jul 28 16:29:28 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 16:29:28 2014 -0400 Merge topic 'vs10-system-hook' into next e58f9753 VS: Add a hook to adapt to SystemName and SystemVersion d0dd28fa VS: Save system name and version in global generator members http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e58f97531aa6e2a124540f38b5acd18fd989cf3b commit e58f97531aa6e2a124540f38b5acd18fd989cf3b Author: Brad King AuthorDate: Mon Jul 28 15:37:15 2014 -0400 Commit: Brad King CommitDate: Mon Jul 28 16:26:00 2014 -0400 VS: Add a hook to adapt to SystemName and SystemVersion Add a virtual cmGlobalVisualStudio10Generator::InitializeSystem method called from SetSystemName once the SystemName and SystemVersion members have been populated. This will give VS version-specific generators a chance to recognize and adapt to the target system. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index ad74537..32049b3 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -130,6 +130,10 @@ bool cmGlobalVisualStudio10Generator::SetSystemName(std::string const& s, { this->SystemName = s; this->SystemVersion = mf->GetSafeDefinition("CMAKE_SYSTEM_VERSION"); + if(!this->InitializeSystem(mf)) + { + return false; + } if(this->PlatformName == "Itanium" || this->PlatformName == "x64") { if(this->IsExpressEdition() && !this->Find64BitTools(mf)) @@ -142,6 +146,12 @@ bool cmGlobalVisualStudio10Generator::SetSystemName(std::string const& s, } //---------------------------------------------------------------------------- +bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile*) +{ + return true; +} + +//---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator ::AddVSPlatformToolsetDefinition(cmMakefile* mf) const { diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index dfdb649..4d7ff80 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -92,6 +92,7 @@ public: protected: virtual void Generate(); + virtual bool InitializeSystem(cmMakefile* mf); virtual const char* GetIDEVersion() { return "10.0"; } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d0dd28fa92cb2223e20f3586b8973a931aa61dac commit d0dd28fa92cb2223e20f3586b8973a931aa61dac Author: Brad King AuthorDate: Mon Jul 28 15:33:40 2014 -0400 Commit: Brad King CommitDate: Mon Jul 28 16:25:08 2014 -0400 VS: Save system name and version in global generator members Add to cmGlobalVisualStudio10Generator members for SystemName and SystemVersion and populate them in SetSystemName. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index c1b087a..ad74537 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -128,6 +128,8 @@ cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts, bool cmGlobalVisualStudio10Generator::SetSystemName(std::string const& s, cmMakefile* mf) { + this->SystemName = s; + this->SystemVersion = mf->GetSafeDefinition("CMAKE_SYSTEM_VERSION"); if(this->PlatformName == "Itanium" || this->PlatformName == "x64") { if(this->IsExpressEdition() && !this->Find64BitTools(mf)) diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 9f154e9..dfdb649 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -99,6 +99,8 @@ protected: std::string GeneratorToolset; std::string DefaultPlatformToolset; + std::string SystemName; + std::string SystemVersion; bool ExpressEdition; bool MasmEnabled; ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalVisualStudio10Generator.cxx | 12 ++++++++++++ Source/cmGlobalVisualStudio10Generator.h | 3 +++ 2 files changed, 15 insertions(+) hooks/post-receive -- CMake From nilsgladitz at gmail.com Mon Jul 28 17:36:35 2014 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Mon, 28 Jul 2014 17:36:35 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4567-gb2c6c53 Message-ID: <20140728213635.8687F4BDB9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via b2c6c531909aa6c58c5a89bf99f0e0767cb39208 (commit) via d31508452fb4a2ec691b0472a4c9a326159d4b3f (commit) via beedfd1136f7200be90e4e368ce65d450d511af8 (commit) from 7f962dfebf65a6d0aa386c5def86d85725da34bd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b2c6c531909aa6c58c5a89bf99f0e0767cb39208 commit b2c6c531909aa6c58c5a89bf99f0e0767cb39208 Merge: 7f962df d315084 Author: Nils Gladitz AuthorDate: Mon Jul 28 17:36:34 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 17:36:34 2014 -0400 Merge topic 'pdb-genex' into next d3150845 Genex: Introduce CMAKE__LINKER_SUPPORTS_PDB beedfd11 Genex: Add tests for new PDB genex http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d31508452fb4a2ec691b0472a4c9a326159d4b3f commit d31508452fb4a2ec691b0472a4c9a326159d4b3f Author: Nils Gladitz AuthorDate: Mon Jul 28 23:33:39 2014 +0200 Commit: Nils Gladitz CommitDate: Mon Jul 28 23:33:39 2014 +0200 Genex: Introduce CMAKE__LINKER_SUPPORTS_PDB diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 8e988c9..ecb323a 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -261,4 +261,5 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON) endmacro() diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 35df9cd..3547e66 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1565,11 +1565,14 @@ struct TargetFilesystemArtifactResultCreator cmGeneratorExpressionContext *context, const GeneratorExpressionContent *content) { - if(!target->IsDLLPlatform()) + std::string language = target->GetLinkerLanguage(context->Config); + + std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB"; + + if(!context->Makefile->IsOn(pdbSupportVar)) { ::reportError(context, content->GetOriginalExpression(), - "TARGET_PDB_FILE is only allowed " - "for DLL target platforms."); + "TARGET_PDB_FILE is not supported by the target linker."); return std::string(); } diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index ff3b9a0..7ba44fb 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -7,6 +7,7 @@ macro(add_RunCMake_test test) -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test} + -DRunCMake_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID} ${${test}_ARGS} -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake" ) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt deleted file mode 100644 index b1b91e3..0000000 --- a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at NonValidCompiler-TARGET_PDB_FILE.cmake:6 \(file\): - Error evaluating generator expression: - - \$ - - TARGET_PDB_FILE is only allowed for DLL target platforms. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake deleted file mode 100644 index a85c20e..0000000 --- a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake +++ /dev/null @@ -1,9 +0,0 @@ - -enable_language(C) - -add_library(empty SHARED empty.c) - -file(GENERATE - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "$" -) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index e93808b..75f2cc9 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -17,9 +17,7 @@ run_cmake(NonValidTarget-CXX_COMPILER_VERSION) run_cmake(NonValidTarget-TARGET_PROPERTY) run_cmake(NonValidTarget-TARGET_POLICY) -if(WIN32) +if(RunCMake_CXX_COMPILER_ID MATCHES "MSVC") run_cmake(NonValidTarget-TARGET_PDB_FILE) run_cmake(ValidTarget-TARGET_PDB_FILE) -else() - run_cmake(NonValidCompiler-TARGET_PDB_FILE) endif() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=beedfd1136f7200be90e4e368ce65d450d511af8 commit beedfd1136f7200be90e4e368ce65d450d511af8 Author: Nils Gladitz AuthorDate: Mon Jul 28 22:49:16 2014 +0200 Commit: Nils Gladitz CommitDate: Mon Jul 28 22:49:16 2014 +0200 Genex: Add tests for new PDB genex diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..b1b91e3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidCompiler-TARGET_PDB_FILE.cmake:6 \(file\): + Error evaluating generator expression: + + \$ + + TARGET_PDB_FILE is only allowed for DLL target platforms. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..a85c20e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty SHARED empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "$" +) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..e5f21e2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidTarget-TARGET_PDB_FILE.cmake:6 \(file\): + Error evaluating generator expression: + + \$ + + TARGET_PDB_FILE is allowed only for targets with linker created artifacts. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..84a2b2e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$]" +) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index c8f3fdf..e93808b 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -16,3 +16,10 @@ run_cmake(NonValidTarget-C_COMPILER_VERSION) run_cmake(NonValidTarget-CXX_COMPILER_VERSION) run_cmake(NonValidTarget-TARGET_PROPERTY) run_cmake(NonValidTarget-TARGET_POLICY) + +if(WIN32) + run_cmake(NonValidTarget-TARGET_PDB_FILE) + run_cmake(ValidTarget-TARGET_PDB_FILE) +else() + run_cmake(NonValidCompiler-TARGET_PDB_FILE) +endif() diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake new file mode 100644 index 0000000..748d14f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake @@ -0,0 +1,17 @@ +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT) + +list(GET TEST_TXT 0 PDB_PATH) +list(GET TEST_TXT 1 PDB_NAME) +list(GET TEST_TXT 2 PDB_DIR) + +if(NOT PDB_PATH MATCHES "empty\\.pdb") + message(FATAL_ERROR "unexpected PDB_PATH [${PDB_PATH}]") +endif() + +if(NOT PDB_NAME STREQUAL "empty.pdb") + message(FATAL_ERROR "unexpected PDB_NAME [${PDB_NAME}]") +endif() + +if(PDB_DIR MATCHES "empty\\.pdb") + message(FATAL_ERROR "unexpected PDB_DIR [${PDB_DIR}]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..e8c5184 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake @@ -0,0 +1,13 @@ + +enable_language(C) + +add_library(empty SHARED empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT +[[$ +$ +$ +]] +) ----------------------------------------------------------------------- Summary of changes: Modules/Platform/Windows-MSVC.cmake | 1 + Source/cmGeneratorExpressionEvaluator.cxx | 9 ++++++--- Tests/RunCMake/CMakeLists.txt | 1 + .../NonValidTarget-TARGET_PDB_FILE-result.txt} | 0 .../NonValidTarget-TARGET_PDB_FILE-stderr.txt | 8 ++++++++ .../NonValidTarget-TARGET_PDB_FILE.cmake | 9 +++++++++ Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake | 5 +++++ .../ValidTarget-TARGET_PDB_FILE-check.cmake | 17 +++++++++++++++++ .../ValidTarget-TARGET_PDB_FILE.cmake | 13 +++++++++++++ 9 files changed, 60 insertions(+), 3 deletions(-) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake hooks/post-receive -- CMake From nilsgladitz at gmail.com Mon Jul 28 18:09:59 2014 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Mon, 28 Jul 2014 18:09:59 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4569-g767c8c3 Message-ID: <20140728220959.E91084A1FC@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 767c8c39ef2a37ab0c3cbe4c50a429abd1613886 (commit) via 8402e1d79ee41ef65101636c23abac14a8ea42e2 (commit) from b2c6c531909aa6c58c5a89bf99f0e0767cb39208 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=767c8c39ef2a37ab0c3cbe4c50a429abd1613886 commit 767c8c39ef2a37ab0c3cbe4c50a429abd1613886 Merge: b2c6c53 8402e1d Author: Nils Gladitz AuthorDate: Mon Jul 28 18:09:59 2014 -0400 Commit: CMake Topic Stage CommitDate: Mon Jul 28 18:09:59 2014 -0400 Merge topic 'pdb-genex' into next 8402e1d7 Genex: Use first available config in multi-config generators http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8402e1d79ee41ef65101636c23abac14a8ea42e2 commit 8402e1d79ee41ef65101636c23abac14a8ea42e2 Author: Nils Gladitz AuthorDate: Tue Jul 29 00:09:45 2014 +0200 Commit: Nils Gladitz CommitDate: Tue Jul 29 00:09:45 2014 +0200 Genex: Use first available config in multi-config generators diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake index e8c5184..2cd6db3 100644 --- a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake @@ -3,6 +3,11 @@ enable_language(C) add_library(empty SHARED empty.c) +if(CMAKE_CONFIGURATION_TYPES) + list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) + set(GENERATE_CONDITION CONDITION ${FIRST_CONFIG}) +endif() + file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" CONTENT @@ -10,4 +15,5 @@ file(GENERATE $ $ ]] + ${GENERATE_CONDITION} ) ----------------------------------------------------------------------- Summary of changes: .../GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake | 6 ++++++ 1 file changed, 6 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jul 29 00:01:13 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 29 Jul 2014 00:01:13 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1525-gb6acd96 Message-ID: <20140729040113.5B29B4B743@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via b6acd96f7fbe4df80e3735b101271cb801ba375a (commit) from f188845237cdfee74dae0658888a61c855e285b3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b6acd96f7fbe4df80e3735b101271cb801ba375a commit b6acd96f7fbe4df80e3735b101271cb801ba375a Author: Kitware Robot AuthorDate: Tue Jul 29 00:01:12 2014 -0400 Commit: Kitware Robot CommitDate: Tue Jul 29 00:01:12 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 769ab83..94f9919 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140728) +set(CMake_VERSION_PATCH 20140729) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Tue Jul 29 03:18:40 2014 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Tue, 29 Jul 2014 03:18:40 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4571-g0449dbf Message-ID: <20140729071840.881804B3D9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 0449dbf7f6b21752133352e9cfedcc868aaa48a6 (commit) via b906af0d7d6cc7e02b16f527fa8ae654f95042e6 (commit) from 767c8c39ef2a37ab0c3cbe4c50a429abd1613886 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0449dbf7f6b21752133352e9cfedcc868aaa48a6 commit 0449dbf7f6b21752133352e9cfedcc868aaa48a6 Merge: 767c8c3 b906af0 Author: Nils Gladitz AuthorDate: Tue Jul 29 03:18:38 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 03:18:38 2014 -0400 Merge topic 'pdb-genex' into next b906af0d Genex: Extended PDB test http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b906af0d7d6cc7e02b16f527fa8ae654f95042e6 commit b906af0d7d6cc7e02b16f527fa8ae654f95042e6 Author: Nils Gladitz AuthorDate: Tue Jul 29 09:17:38 2014 +0200 Commit: Nils Gladitz CommitDate: Tue Jul 29 09:17:38 2014 +0200 Genex: Extended PDB test diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..831edad --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidCompiler-TARGET_PDB_FILE.cmake:6 \(file\): + Error evaluating generator expression: + + \$ + + TARGET_PDB_FILE is not supported by the target linker. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..84a2b2e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$]" +) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 75f2cc9..ca2d7ea 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -21,3 +21,7 @@ if(RunCMake_CXX_COMPILER_ID MATCHES "MSVC") run_cmake(NonValidTarget-TARGET_PDB_FILE) run_cmake(ValidTarget-TARGET_PDB_FILE) endif() + +if(NOT WIN32) + run_cmake(NonValidCompiler-TARGET_PDB_FILE) +endif() ----------------------------------------------------------------------- Summary of changes: .../NonValidCompiler-TARGET_PDB_FILE-result.txt} | 0 ...FILE-stderr.txt => NonValidCompiler-TARGET_PDB_FILE-stderr.txt} | 4 ++-- ...ARGET_PDB_FILE.cmake => NonValidCompiler-TARGET_PDB_FILE.cmake} | 0 Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake | 4 ++++ 4 files changed, 6 insertions(+), 2 deletions(-) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt} (100%) copy Tests/RunCMake/GeneratorExpression/{NonValidTarget-TARGET_PDB_FILE-stderr.txt => NonValidCompiler-TARGET_PDB_FILE-stderr.txt} (50%) copy Tests/RunCMake/GeneratorExpression/{NonValidTarget-TARGET_PDB_FILE.cmake => NonValidCompiler-TARGET_PDB_FILE.cmake} (100%) hooks/post-receive -- CMake From nilsgladitz at gmail.com Tue Jul 29 03:20:00 2014 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Tue, 29 Jul 2014 03:20:00 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4573-g0abadbb Message-ID: <20140729072000.A3ACE4B41F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 0abadbb4b10518a5ee8ef718cd1db3c9e43dc44c (commit) via b7b2780e85a873c55864f1110d197b7f03c04933 (commit) from 0449dbf7f6b21752133352e9cfedcc868aaa48a6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0abadbb4b10518a5ee8ef718cd1db3c9e43dc44c commit 0abadbb4b10518a5ee8ef718cd1db3c9e43dc44c Merge: 0449dbf b7b2780 Author: Nils Gladitz AuthorDate: Tue Jul 29 03:19:59 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 03:19:59 2014 -0400 Merge topic 'pdb-genex' into next b7b2780e Genex: Implement generator expressions for target PDB files. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b7b2780e85a873c55864f1110d197b7f03c04933 commit b7b2780e85a873c55864f1110d197b7f03c04933 Author: Nils Gladitz AuthorDate: Thu Jul 24 22:18:21 2014 +0200 Commit: Nils Gladitz CommitDate: Tue Jul 29 09:19:23 2014 +0200 Genex: Implement generator expressions for target PDB files. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index bc24798..77259a0 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -148,6 +148,17 @@ than 4.2.0. Name of file with soname (.so.3). ``$`` Directory of with soname (.so.3). +``$`` + Full path to the linker generated program database file (.pdb) + where ``tgt`` is the name of a target. + + See also the :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY` + target properties and their configuration specific variants + :prop_tgt:`PDB_NAME_` and :prop_tgt:`PDB_OUTPUT_DIRECTORY_`. +``$`` + Name of the linker generated program database file (.pdb). +``$`` + Directory of the linker generated program database file (.pdb). ``$`` Value of the property ``prop`` on the target ``tgt``. diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 8e988c9..ecb323a 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -261,4 +261,5 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON) endmacro() diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 6f940a6..3547e66 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1512,6 +1512,7 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode class ArtifactNameTag; class ArtifactLinkerTag; class ArtifactSonameTag; +class ArtifactPdbTag; class ArtifactPathTag; class ArtifactDirTag; @@ -1558,6 +1559,44 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) + { + std::string language = target->GetLinkerLanguage(context->Config); + + std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB"; + + if(!context->Makefile->IsOn(pdbSupportVar)) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_PDB_FILE is not supported by the target linker."); + return std::string(); + } + + cmTarget::TargetType targetType = target->GetType(); + + if(targetType != cmTarget::SHARED_LIBRARY && + targetType != cmTarget::MODULE_LIBRARY && + targetType != cmTarget::EXECUTABLE) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_PDB_FILE is allowed only for " + "targets with linker created artifacts."); + return std::string(); + } + + std::string result = target->GetPDBDirectory(context->Config); + result += "/"; + result += target->GetPDBName(context->Config); + return result; + } +}; + +//---------------------------------------------------------------------------- +template<> struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, @@ -1706,6 +1745,9 @@ TargetFilesystemArtifactNodeGroup targetLinkerNodeGroup; static const TargetFilesystemArtifactNodeGroup targetSoNameNodeGroup; +static const +TargetFilesystemArtifactNodeGroup targetPdbNodeGroup; + //---------------------------------------------------------------------------- static const cmGeneratorExpressionNode* GetNode(const std::string &identifier) @@ -1733,12 +1775,15 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) nodeMap["TARGET_FILE"] = &targetNodeGroup.File; nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File; nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File; + nodeMap["TARGET_PDB_FILE"] = &targetPdbNodeGroup.File; nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName; nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName; nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName; + nodeMap["TARGET_PDB_FILE_NAME"] = &targetPdbNodeGroup.FileName; nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir; nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; + nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir; nodeMap["STREQUAL"] = &strEqualNode; nodeMap["EQUAL"] = &equalNode; nodeMap["LOWER_CASE"] = &lowerCaseNode; diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index ff3b9a0..7ba44fb 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -7,6 +7,7 @@ macro(add_RunCMake_test test) -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test} + -DRunCMake_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID} ${${test}_ARGS} -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake" ) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..831edad --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidCompiler-TARGET_PDB_FILE.cmake:6 \(file\): + Error evaluating generator expression: + + \$ + + TARGET_PDB_FILE is not supported by the target linker. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..84a2b2e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$]" +) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..e5f21e2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidTarget-TARGET_PDB_FILE.cmake:6 \(file\): + Error evaluating generator expression: + + \$ + + TARGET_PDB_FILE is allowed only for targets with linker created artifacts. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..84a2b2e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$]" +) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index c8f3fdf..ca2d7ea 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -16,3 +16,12 @@ run_cmake(NonValidTarget-C_COMPILER_VERSION) run_cmake(NonValidTarget-CXX_COMPILER_VERSION) run_cmake(NonValidTarget-TARGET_PROPERTY) run_cmake(NonValidTarget-TARGET_POLICY) + +if(RunCMake_CXX_COMPILER_ID MATCHES "MSVC") + run_cmake(NonValidTarget-TARGET_PDB_FILE) + run_cmake(ValidTarget-TARGET_PDB_FILE) +endif() + +if(NOT WIN32) + run_cmake(NonValidCompiler-TARGET_PDB_FILE) +endif() diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake new file mode 100644 index 0000000..748d14f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake @@ -0,0 +1,17 @@ +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT) + +list(GET TEST_TXT 0 PDB_PATH) +list(GET TEST_TXT 1 PDB_NAME) +list(GET TEST_TXT 2 PDB_DIR) + +if(NOT PDB_PATH MATCHES "empty\\.pdb") + message(FATAL_ERROR "unexpected PDB_PATH [${PDB_PATH}]") +endif() + +if(NOT PDB_NAME STREQUAL "empty.pdb") + message(FATAL_ERROR "unexpected PDB_NAME [${PDB_NAME}]") +endif() + +if(PDB_DIR MATCHES "empty\\.pdb") + message(FATAL_ERROR "unexpected PDB_DIR [${PDB_DIR}]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..2cd6db3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake @@ -0,0 +1,19 @@ + +enable_language(C) + +add_library(empty SHARED empty.c) + +if(CMAKE_CONFIGURATION_TYPES) + list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) + set(GENERATE_CONDITION CONDITION ${FIRST_CONFIG}) +endif() + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT +[[$ +$ +$ +]] + ${GENERATE_CONDITION} +) ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From nilsgladitz at gmail.com Tue Jul 29 04:38:27 2014 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Tue, 29 Jul 2014 04:38:27 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4575-g9b62856 Message-ID: <20140729083827.C97814B76A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 9b6285615ccbb54be13a758962cfd75fcf007a09 (commit) via 522c19ab395f4286f835fde798c184e7d92e5d9c (commit) from 0abadbb4b10518a5ee8ef718cd1db3c9e43dc44c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9b6285615ccbb54be13a758962cfd75fcf007a09 commit 9b6285615ccbb54be13a758962cfd75fcf007a09 Merge: 0abadbb 522c19a Author: Nils Gladitz AuthorDate: Tue Jul 29 04:38:27 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 04:38:27 2014 -0400 Merge topic 'pdb-genex' into next 522c19ab Genex: file(GENERATE) CONDITION has to evaluate to 1 or 0 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=522c19ab395f4286f835fde798c184e7d92e5d9c commit 522c19ab395f4286f835fde798c184e7d92e5d9c Author: Nils Gladitz AuthorDate: Tue Jul 29 10:38:01 2014 +0200 Commit: Nils Gladitz CommitDate: Tue Jul 29 10:38:01 2014 +0200 Genex: file(GENERATE) CONDITION has to evaluate to 1 or 0 diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake index 2cd6db3..38e47f9 100644 --- a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake @@ -5,7 +5,7 @@ add_library(empty SHARED empty.c) if(CMAKE_CONFIGURATION_TYPES) list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) - set(GENERATE_CONDITION CONDITION ${FIRST_CONFIG}) + set(GENERATE_CONDITION CONDITION $) endif() file(GENERATE ----------------------------------------------------------------------- Summary of changes: Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 08:38:19 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 08:38:19 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4577-g90febc3 Message-ID: <20140729123819.DAEEF4BD46@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 90febc35eae3a662b80c81d35911e05c56fd1284 (commit) via 3227e676d4f95a667d7de177322894b8d82c23ed (commit) from 9b6285615ccbb54be13a758962cfd75fcf007a09 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90febc35eae3a662b80c81d35911e05c56fd1284 commit 90febc35eae3a662b80c81d35911e05c56fd1284 Merge: 9b62856 3227e67 Author: Brad King AuthorDate: Tue Jul 29 08:38:19 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 08:38:19 2014 -0400 Merge topic 'add-liblzma' into next 3227e676 libarchive: Suppress MSVC warning C4142 from lzma.h http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3227e676d4f95a667d7de177322894b8d82c23ed commit 3227e676d4f95a667d7de177322894b8d82c23ed Author: Brad King AuthorDate: Tue Jul 29 08:37:29 2014 -0400 Commit: Brad King CommitDate: Tue Jul 29 08:37:52 2014 -0400 libarchive: Suppress MSVC warning C4142 from lzma.h diff --git a/Utilities/cmlibarchive/libarchive/archive_windows.h b/Utilities/cmlibarchive/libarchive/archive_windows.h index 9a19cdf..dc2f241 100644 --- a/Utilities/cmlibarchive/libarchive/archive_windows.h +++ b/Utilities/cmlibarchive/libarchive/archive_windows.h @@ -76,6 +76,7 @@ #if defined(_MSC_VER) #pragma warning(push,1) +#pragma warning(disable:4142) /* benign redefinition of type */ #pragma warning(disable:4761) /* integral size mismatch in argument; conversion supplied */ #endif #if defined(__BORLANDC__) ----------------------------------------------------------------------- Summary of changes: Utilities/cmlibarchive/libarchive/archive_windows.h | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 08:47:07 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 08:47:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4584-gf8c3e8b Message-ID: <20140729124707.B3CD54B159@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f8c3e8b576f845cadbaca6fb30c781c6534ab79c (commit) via 65a0ea456d5d92644fe67bbbcbe973df3f111822 (commit) via 8436d18115a9d997fb92fc7a019da1f28646a2f8 (commit) via 73eab246fbfad22bcc1b0bb5599f8e0cffb79c0d (commit) via 90e7a4d41f588d87415381fdb507735e6438992c (commit) via c20b45027e8288114fd6ee33f99218440b60da77 (commit) via 7a92eddbcb2b2e6419062538e346908f0e502586 (commit) from 90febc35eae3a662b80c81d35911e05c56fd1284 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f8c3e8b576f845cadbaca6fb30c781c6534ab79c commit f8c3e8b576f845cadbaca6fb30c781c6534ab79c Merge: 90febc3 65a0ea4 Author: Brad King AuthorDate: Tue Jul 29 08:47:05 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 08:47:05 2014 -0400 Merge topic 'add-liblzma' into next 65a0ea45 Help: Add notes for topic 'add-liblzma' 8436d181 CMake: Enable use of liblzma in libarchive (#14504) 73eab246 liblzma: Avoid defining a 'restrict' macro 90e7a4d4 liblzma: Disable warnings to avoid changing 3rd party code c20b4502 liblzma: Port to VS 6, 7.0 7a92eddb liblzma: Port from C99 to C89/90 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65a0ea456d5d92644fe67bbbcbe973df3f111822 commit 65a0ea456d5d92644fe67bbbcbe973df3f111822 Author: Brad King AuthorDate: Thu Jul 24 10:57:57 2014 -0400 Commit: Brad King CommitDate: Tue Jul 29 08:45:36 2014 -0400 Help: Add notes for topic 'add-liblzma' diff --git a/Help/release/dev/add-liblzma.rst b/Help/release/dev/add-liblzma.rst new file mode 100644 index 0000000..a59ec09 --- /dev/null +++ b/Help/release/dev/add-liblzma.rst @@ -0,0 +1,5 @@ +add-liblzma +----------- + +* The :manual:`cmake(1)` ``-E tar`` command learned to support + lzma-compressed files. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8436d18115a9d997fb92fc7a019da1f28646a2f8 commit 8436d18115a9d997fb92fc7a019da1f28646a2f8 Author: Daniel Pfeifer AuthorDate: Sun Jul 13 22:23:22 2014 +0200 Commit: Brad King CommitDate: Tue Jul 29 08:45:36 2014 -0400 CMake: Enable use of liblzma in libarchive (#14504) Build liblzma as part of CMake or find one on the system. Modify our port of libarchive to use the liblzma configured for use with CMake. diff --git a/CMakeLists.txt b/CMakeLists.txt index e210f74..54aad83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,7 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES) # Allow the user to enable/disable all system utility library options by # defining CMAKE_USE_SYSTEM_LIBRARIES or CMAKE_USE_SYSTEM_LIBRARY_${util}. - set(UTILITIES BZIP2 CURL EXPAT LIBARCHIVE ZLIB) + set(UTILITIES BZIP2 CURL EXPAT LIBARCHIVE LIBLZMA ZLIB) foreach(util ${UTILITIES}) if(NOT DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util} AND DEFINED CMAKE_USE_SYSTEM_LIBRARIES) @@ -93,6 +93,8 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES) "${CMAKE_USE_SYSTEM_LIBRARY_ZLIB}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE;NOT CMAKE_USE_SYSTEM_CURL" ON) CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_BZIP2 "Use system-installed bzip2" "${CMAKE_USE_SYSTEM_LIBRARY_BZIP2}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON) + CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_LIBLZMA "Use system-installed liblzma" + "${CMAKE_USE_SYSTEM_LIBRARY_LIBLZMA}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON) # Mention to the user what system libraries are being used. foreach(util ${UTILITIES}) @@ -301,6 +303,23 @@ macro (CMAKE_BUILD_UTILITIES) endif() #--------------------------------------------------------------------- + # Build or use system liblzma for libarchive. + if(CMAKE_USE_SYSTEM_LIBLZMA) + find_package(LibLZMA) + if(NOT LIBLZMA_FOUND) + message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBLZMA is ON but LibLZMA is not found!") + endif() + set(LZMA_INCLUDE_DIR ${LIBLZMA_INCLUDE_DIRS}) + set(LZMA_LIBRARY ${LIBLZMA_LIBRARIES}) + else() + add_subdirectory(Utilities/cmliblzma) + CMAKE_SET_TARGET_FOLDER(cmliblzma "Utilities/3rdParty") + set(LZMA_INCLUDE_DIR + "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmliblzma/liblzma/api") + set(LZMA_LIBRARY cmliblzma) + endif() + + #--------------------------------------------------------------------- # Build or use system libarchive for CMake and CTest. if(CMAKE_USE_SYSTEM_LIBARCHIVE) find_package(LibArchive) @@ -315,7 +334,7 @@ macro (CMAKE_BUILD_UTILITIES) add_definitions(-DLIBARCHIVE_STATIC) set(ENABLE_NETTLE OFF CACHE INTERNAL "Enable use of Nettle") set(ENABLE_OPENSSL ${CMAKE_USE_OPENSSL} CACHE INTERNAL "Enable use of OpenSSL") - set(ENABLE_LZMA OFF CACHE INTERNAL "Enable the use of the system found LZMA library if found") + set(ENABLE_LZMA ON CACHE INTERNAL "Enable the use of the system found LZMA library if found") set(ENABLE_ZLIB ON CACHE INTERNAL "Enable the use of the system found ZLIB library if found") set(ENABLE_BZip2 ON CACHE INTERNAL "Enable the use of the system found BZip2 library if found") set(ENABLE_EXPAT OFF CACHE INTERNAL "Enable the use of the system found EXPAT library if found") diff --git a/Utilities/cmThirdParty.h.in b/Utilities/cmThirdParty.h.in index c824085..b0b5779 100644 --- a/Utilities/cmThirdParty.h.in +++ b/Utilities/cmThirdParty.h.in @@ -18,6 +18,7 @@ #cmakedefine CMAKE_USE_SYSTEM_ZLIB #cmakedefine CMAKE_USE_SYSTEM_BZIP2 #cmakedefine CMAKE_USE_SYSTEM_LIBARCHIVE +#cmakedefine CMAKE_USE_SYSTEM_LIBLZMA #cmakedefine CTEST_USE_XMLRPC #endif diff --git a/Utilities/cmThirdParty.h.in b/Utilities/cm_lzma.h similarity index 57% copy from Utilities/cmThirdParty.h.in copy to Utilities/cm_lzma.h index c824085..c11c916 100644 --- a/Utilities/cmThirdParty.h.in +++ b/Utilities/cm_lzma.h @@ -1,6 +1,6 @@ /*============================================================================ CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + Copyright 2014 Kitware, Inc., Insight Software Consortium Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. @@ -9,15 +9,15 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef __cmThirdParty_h -#define __cmThirdParty_h +#ifndef __cm_lzma_h +#define __cm_lzma_h -/* Whether CMake is using its own utility libraries. */ -#cmakedefine CMAKE_USE_SYSTEM_CURL -#cmakedefine CMAKE_USE_SYSTEM_EXPAT -#cmakedefine CMAKE_USE_SYSTEM_ZLIB -#cmakedefine CMAKE_USE_SYSTEM_BZIP2 -#cmakedefine CMAKE_USE_SYSTEM_LIBARCHIVE -#cmakedefine CTEST_USE_XMLRPC +/* Use the liblzma configured for CMake. */ +#include "cmThirdParty.h" +#ifdef CMAKE_USE_SYSTEM_LIBLZMA +# include +#else +# include +#endif #endif diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt index 9b1533d..87a9c3f 100644 --- a/Utilities/cmlibarchive/CMakeLists.txt +++ b/Utilities/cmlibarchive/CMakeLists.txt @@ -275,7 +275,6 @@ IF(BZIP2_FOUND) ENDIF(BZIP2_FOUND) MARK_AS_ADVANCED(CLEAR BZIP2_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR BZIP2_LIBRARIES) -IF(0) # CMake does not need LZMA or LZO2 support in libarchive # # Find LZMA # @@ -291,15 +290,19 @@ IF(LZMA_FOUND) SET(HAVE_LZMA_H 1) INCLUDE_DIRECTORIES(${LZMA_INCLUDE_DIR}) LIST(APPEND ADDITIONAL_LIBS ${LZMA_LIBRARIES}) - # Test if a macro is needed for the library. - TRY_MACRO_FOR_LIBRARY( - "${LZMA_INCLUDE_DIR}" "${LZMA_LIBRARIES}" - COMPILES - "#include \nint main() {return (int)lzma_version_number(); }" - "WITHOUT_LZMA_API_STATIC;LZMA_API_STATIC") - IF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC) + IF(CMAKE_USE_SYSTEM_LIBLZMA) + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${LZMA_INCLUDE_DIR}" "${LZMA_LIBRARIES}" + COMPILES + "#include \nint main() {return (int)lzma_version_number(); }" + "WITHOUT_LZMA_API_STATIC;LZMA_API_STATIC") + IF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC) + ADD_DEFINITIONS(-DLZMA_API_STATIC) + ENDIF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC) + ELSE() ADD_DEFINITIONS(-DLZMA_API_STATIC) - ENDIF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC) + ENDIF() ELSEIF(LZMADEC_FOUND) SET(HAVE_LIBLZMADEC 1) SET(HAVE_LZMADEC_H 1) @@ -308,6 +311,7 @@ ELSEIF(LZMADEC_FOUND) ELSE(LZMA_FOUND) # LZMA not found and will not be used. ENDIF(LZMA_FOUND) +IF(0) # CMake does not need LZO2 support in libarchive # # Find LZO2 # diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_xz.c b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_xz.c index 7bda263..a3ad67a 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_xz.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_xz.c @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include #endif #if HAVE_LZMA_H -#include +#include #elif HAVE_LZMADEC_H #include #endif diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c index 8cd241b..47e0752 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$"); #include #endif #ifdef HAVE_LZMA_H -#include +#include #endif #ifdef HAVE_ZLIB_H #include diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c index af89ded..68485d1 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include #endif #if HAVE_LZMA_H -#include +#include #elif HAVE_LZMADEC_H #include #endif diff --git a/Utilities/cmlibarchive/libarchive/archive_util.c b/Utilities/cmlibarchive/libarchive/archive_util.c index b53beca..96b88d8 100644 --- a/Utilities/cmlibarchive/libarchive/archive_util.c +++ b/Utilities/cmlibarchive/libarchive/archive_util.c @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_util.c 201098 2009-12-28 02:58:1 #include #endif #ifdef HAVE_LZMA_H -#include +#include #endif #ifdef HAVE_BZLIB_H #include diff --git a/Utilities/cmlibarchive/libarchive/archive_windows.h b/Utilities/cmlibarchive/libarchive/archive_windows.h index 9a19cdf..dc2f241 100644 --- a/Utilities/cmlibarchive/libarchive/archive_windows.h +++ b/Utilities/cmlibarchive/libarchive/archive_windows.h @@ -76,6 +76,7 @@ #if defined(_MSC_VER) #pragma warning(push,1) +#pragma warning(disable:4142) /* benign redefinition of type */ #pragma warning(disable:4761) /* integral size mismatch in argument; conversion supplied */ #endif #if defined(__BORLANDC__) diff --git a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_xz.c b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_xz.c index fa73311..a566732 100644 --- a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_xz.c +++ b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_xz.c @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_compression_xz.c 20110 #endif #include #ifdef HAVE_LZMA_H -#include +#include #endif #include "archive.h" diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c index 4f1bc26..5158854 100644 --- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c +++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c @@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$"); #include #endif #if HAVE_LZMA_H -#include +#include #endif #ifdef HAVE_ZLIB_H #include diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c index a4ce7ee..4cd2b9d 100644 --- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c +++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); #include #endif #if HAVE_LZMA_H -#include +#include #endif #ifdef HAVE_ZLIB_H #include http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=73eab246fbfad22bcc1b0bb5599f8e0cffb79c0d commit 73eab246fbfad22bcc1b0bb5599f8e0cffb79c0d Author: Brad King AuthorDate: Thu Jul 24 10:51:21 2014 -0400 Commit: Brad King CommitDate: Tue Jul 29 08:45:36 2014 -0400 liblzma: Avoid defining a 'restrict' macro Any "#define restrict ..." line may conflict with MSVC header files that use "__declspec(restrict)". Define our own LZMA_RESTRICT macro in "Utilities/cmliblzma/config.h.in" and transform liblzma code to use it: git grep -lE '\' Utilities/cmliblzma/liblzma | xargs sed -i 's/\/LZMA_RESTRICT/g' diff --git a/Utilities/cmliblzma/config.h.in b/Utilities/cmliblzma/config.h.in index 391bb87..b197f27 100644 --- a/Utilities/cmliblzma/config.h.in +++ b/Utilities/cmliblzma/config.h.in @@ -188,10 +188,12 @@ typedef uint64_t uintmax_t; #ifndef HAVE_RESTRICT # ifdef HAVE___RESTRICT -# define restrict __restrict +# define LZMA_RESTRICT __restrict # else -# define restrict +# define LZMA_RESTRICT # endif +#else +# define LZMA_RESTRICT restrict #endif /* HAVE_RESTRICT */ #ifndef HAVE_INLINE diff --git a/Utilities/cmliblzma/liblzma/common/alone_decoder.c b/Utilities/cmliblzma/liblzma/common/alone_decoder.c index a20cf49..5f5e564 100644 --- a/Utilities/cmliblzma/liblzma/common/alone_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/alone_decoder.c @@ -52,9 +52,9 @@ struct lzma_coder_s { static lzma_ret alone_decode(lzma_coder *coder, lzma_allocator *allocator lzma_attribute((__unused__)), - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { while (*out_pos < out_size diff --git a/Utilities/cmliblzma/liblzma/common/alone_encoder.c b/Utilities/cmliblzma/liblzma/common/alone_encoder.c index 62df126..4207b4a 100644 --- a/Utilities/cmliblzma/liblzma/common/alone_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/alone_encoder.c @@ -33,9 +33,9 @@ struct lzma_coder_s { static lzma_ret alone_encode(lzma_coder *coder, lzma_allocator *allocator lzma_attribute((__unused__)), - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { while (*out_pos < out_size) diff --git a/Utilities/cmliblzma/liblzma/common/auto_decoder.c b/Utilities/cmliblzma/liblzma/common/auto_decoder.c index 6f3c862..24cf489 100644 --- a/Utilities/cmliblzma/liblzma/common/auto_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/auto_decoder.c @@ -31,9 +31,9 @@ struct lzma_coder_s { static lzma_ret auto_decode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { switch (coder->sequence) { case SEQ_INIT: diff --git a/Utilities/cmliblzma/liblzma/common/block_decoder.c b/Utilities/cmliblzma/liblzma/common/block_decoder.c index 3de3851..35996e7 100644 --- a/Utilities/cmliblzma/liblzma/common/block_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_decoder.c @@ -72,9 +72,9 @@ is_size_valid(lzma_vli size, lzma_vli reference) static lzma_ret block_decode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { switch (coder->sequence) { case SEQ_CODE: { diff --git a/Utilities/cmliblzma/liblzma/common/block_encoder.c b/Utilities/cmliblzma/liblzma/common/block_encoder.c index 63e2687..ed74827 100644 --- a/Utilities/cmliblzma/liblzma/common/block_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_encoder.c @@ -46,9 +46,9 @@ struct lzma_coder_s { static lzma_ret block_encode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { // Check that our amount of input stays in proper limits. if (LZMA_VLI_MAX - coder->uncompressed_size < in_size - *in_pos) diff --git a/Utilities/cmliblzma/liblzma/common/common.c b/Utilities/cmliblzma/liblzma/common/common.c index d0105e1..2e723c8 100644 --- a/Utilities/cmliblzma/liblzma/common/common.c +++ b/Utilities/cmliblzma/liblzma/common/common.c @@ -70,9 +70,9 @@ lzma_free(void *ptr, lzma_allocator *allocator) ////////// extern size_t -lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size) +lzma_bufcpy(const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size) { const size_t in_avail = in_size - *in_pos; const size_t out_avail = out_size - *out_pos; diff --git a/Utilities/cmliblzma/liblzma/common/common.h b/Utilities/cmliblzma/liblzma/common/common.h index a1a1591..a6a2818 100644 --- a/Utilities/cmliblzma/liblzma/common/common.h +++ b/Utilities/cmliblzma/liblzma/common/common.h @@ -88,9 +88,9 @@ typedef lzma_ret (*lzma_init_function)( /// function prototype. typedef lzma_ret (*lzma_code_function)( lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action); /// Type of a function to free the memory allocated for the coder @@ -234,9 +234,9 @@ extern void lzma_next_end(lzma_next_coder *next, lzma_allocator *allocator); /// Copy as much data as possible from in[] to out[] and update *in_pos /// and *out_pos accordingly. Returns the number of bytes copied. -extern size_t lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size); +extern size_t lzma_bufcpy(const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size); /// \brief Return if expression doesn't evaluate to LZMA_OK diff --git a/Utilities/cmliblzma/liblzma/common/index.c b/Utilities/cmliblzma/liblzma/common/index.c index f0f67ca..26135d2 100644 --- a/Utilities/cmliblzma/liblzma/common/index.c +++ b/Utilities/cmliblzma/liblzma/common/index.c @@ -780,7 +780,7 @@ index_cat_helper(const index_cat_info *info, index_stream *this) extern LZMA_API(lzma_ret) -lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src, +lzma_index_cat(lzma_index *LZMA_RESTRICT dest, lzma_index *LZMA_RESTRICT src, lzma_allocator *allocator) { index_cat_info info; diff --git a/Utilities/cmliblzma/liblzma/common/index_decoder.c b/Utilities/cmliblzma/liblzma/common/index_decoder.c index 6c91f10..943cfd5 100644 --- a/Utilities/cmliblzma/liblzma/common/index_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/index_decoder.c @@ -55,10 +55,10 @@ struct lzma_coder_s { static lzma_ret index_decode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, size_t in_size, - uint8_t *restrict out lzma_attribute((__unused__)), - size_t *restrict out_pos lzma_attribute((__unused__)), + uint8_t *LZMA_RESTRICT out lzma_attribute((__unused__)), + size_t *LZMA_RESTRICT out_pos lzma_attribute((__unused__)), size_t out_size lzma_attribute((__unused__)), lzma_action action lzma_attribute((__unused__))) { diff --git a/Utilities/cmliblzma/liblzma/common/index_encoder.c b/Utilities/cmliblzma/liblzma/common/index_encoder.c index a6f8598..194bf21 100644 --- a/Utilities/cmliblzma/liblzma/common/index_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/index_encoder.c @@ -43,10 +43,10 @@ struct lzma_coder_s { static lzma_ret index_encode(lzma_coder *coder, lzma_allocator *allocator lzma_attribute((__unused__)), - const uint8_t *restrict in lzma_attribute((__unused__)), - size_t *restrict in_pos lzma_attribute((__unused__)), + const uint8_t *LZMA_RESTRICT in lzma_attribute((__unused__)), + size_t *LZMA_RESTRICT in_pos lzma_attribute((__unused__)), size_t in_size lzma_attribute((__unused__)), - uint8_t *restrict out, size_t *restrict out_pos, + uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action lzma_attribute((__unused__))) { diff --git a/Utilities/cmliblzma/liblzma/common/stream_decoder.c b/Utilities/cmliblzma/liblzma/common/stream_decoder.c index 56a009b..5e9a220 100644 --- a/Utilities/cmliblzma/liblzma/common/stream_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_decoder.c @@ -97,9 +97,9 @@ stream_decoder_reset(lzma_coder *coder, lzma_allocator *allocator) static lzma_ret stream_decode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { // When decoding the actual Block, it may be able to produce more // output even if we don't give it any new input. diff --git a/Utilities/cmliblzma/liblzma/common/stream_encoder.c b/Utilities/cmliblzma/liblzma/common/stream_encoder.c index e2f2e10..1ba45ac 100644 --- a/Utilities/cmliblzma/liblzma/common/stream_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_encoder.c @@ -80,9 +80,9 @@ block_encoder_init(lzma_coder *coder, lzma_allocator *allocator) static lzma_ret stream_encode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { // Main loop while (*out_pos < out_size) diff --git a/Utilities/cmliblzma/liblzma/common/vli_decoder.c b/Utilities/cmliblzma/liblzma/common/vli_decoder.c index c181828..1c66384 100644 --- a/Utilities/cmliblzma/liblzma/common/vli_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/vli_decoder.c @@ -14,8 +14,8 @@ extern LZMA_API(lzma_ret) -lzma_vli_decode(lzma_vli *restrict vli, size_t *vli_pos, - const uint8_t *restrict in, size_t *restrict in_pos, +lzma_vli_decode(lzma_vli *LZMA_RESTRICT vli, size_t *vli_pos, + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, size_t in_size) { // If we haven't been given vli_pos, work in single-call mode. diff --git a/Utilities/cmliblzma/liblzma/common/vli_encoder.c b/Utilities/cmliblzma/liblzma/common/vli_encoder.c index f864269..09e90cb 100644 --- a/Utilities/cmliblzma/liblzma/common/vli_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/vli_encoder.c @@ -15,7 +15,7 @@ extern LZMA_API(lzma_ret) lzma_vli_encode(lzma_vli vli, size_t *vli_pos, - uint8_t *restrict out, size_t *restrict out_pos, + uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos, size_t out_size) { // If we haven't been given vli_pos, work in single-call mode. diff --git a/Utilities/cmliblzma/liblzma/delta/delta_decoder.c b/Utilities/cmliblzma/liblzma/delta/delta_decoder.c index 582e58e..28df727 100644 --- a/Utilities/cmliblzma/liblzma/delta/delta_decoder.c +++ b/Utilities/cmliblzma/liblzma/delta/delta_decoder.c @@ -29,9 +29,9 @@ decode_buffer(lzma_coder *coder, uint8_t *buffer, size_t size) static lzma_ret delta_decode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { const size_t out_start = *out_pos; lzma_ret ret; diff --git a/Utilities/cmliblzma/liblzma/delta/delta_encoder.c b/Utilities/cmliblzma/liblzma/delta/delta_encoder.c index 8b9e4a8..a39c154 100644 --- a/Utilities/cmliblzma/liblzma/delta/delta_encoder.c +++ b/Utilities/cmliblzma/liblzma/delta/delta_encoder.c @@ -19,7 +19,7 @@ /// encoder's filter stack). static void copy_and_encode(lzma_coder *coder, - const uint8_t *restrict in, uint8_t *restrict out, size_t size) + const uint8_t *LZMA_RESTRICT in, uint8_t *LZMA_RESTRICT out, size_t size) { size_t i; const size_t distance = coder->distance; @@ -52,9 +52,9 @@ encode_in_place(lzma_coder *coder, uint8_t *buffer, size_t size) static lzma_ret delta_encode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { lzma_ret ret; diff --git a/Utilities/cmliblzma/liblzma/lz/lz_decoder.c b/Utilities/cmliblzma/liblzma/lz/lz_decoder.c index f45984e..9fa1bdc 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_decoder.c +++ b/Utilities/cmliblzma/liblzma/lz/lz_decoder.c @@ -64,9 +64,9 @@ lz_decoder_reset(lzma_coder *coder) static lzma_ret decode_buffer(lzma_coder *coder, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size) { while (true) { size_t copy_size; @@ -131,9 +131,9 @@ decode_buffer(lzma_coder *coder, static lzma_ret lz_decode(lzma_coder *coder, lzma_allocator *allocator lzma_attribute((__unused__)), - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { if (coder->next.code == NULL) diff --git a/Utilities/cmliblzma/liblzma/lz/lz_decoder.h b/Utilities/cmliblzma/liblzma/lz/lz_decoder.h index 2d19cac..76011f2 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_decoder.h +++ b/Utilities/cmliblzma/liblzma/lz/lz_decoder.h @@ -56,9 +56,9 @@ typedef struct { lzma_coder *coder; /// Function to decode from in[] to *dict - lzma_ret (*code)(lzma_coder *restrict coder, - lzma_dict *restrict dict, const uint8_t *restrict in, - size_t *restrict in_pos, size_t in_size); + lzma_ret (*code)(lzma_coder *LZMA_RESTRICT coder, + lzma_dict *LZMA_RESTRICT dict, const uint8_t *LZMA_RESTRICT in, + size_t *LZMA_RESTRICT in_pos, size_t in_size); void (*reset)(lzma_coder *coder, const void *options); @@ -202,9 +202,9 @@ dict_put(lzma_dict *dict, uint8_t byte) /// Copies arbitrary amount of data into the dictionary. static inline void -dict_write(lzma_dict *restrict dict, const uint8_t *restrict in, - size_t *restrict in_pos, size_t in_size, - size_t *restrict left) +dict_write(lzma_dict *LZMA_RESTRICT dict, const uint8_t *LZMA_RESTRICT in, + size_t *LZMA_RESTRICT in_pos, size_t in_size, + size_t *LZMA_RESTRICT left) { // NOTE: If we are being given more data than the size of the // dictionary, it could be possible to optimize the LZ decoder diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder.c b/Utilities/cmliblzma/liblzma/lz/lz_encoder.c index a735c21..1dae924 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_encoder.c +++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder.c @@ -153,9 +153,9 @@ fill_window(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in, static lzma_ret lz_encode(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, size_t in_size, - uint8_t *restrict out, size_t *restrict out_pos, + uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { while (*out_pos < out_size diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder.h b/Utilities/cmliblzma/liblzma/lz/lz_encoder.h index 647f5e2..dcb4b2c 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_encoder.h +++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder.h @@ -194,9 +194,9 @@ typedef struct { lzma_coder *coder; /// Function to encode from *dict to out[] - lzma_ret (*code)(lzma_coder *restrict coder, - lzma_mf *restrict mf, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size); + lzma_ret (*code)(lzma_coder *LZMA_RESTRICT coder, + lzma_mf *LZMA_RESTRICT mf, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size); /// Free allocated resources void (*end)(lzma_coder *coder, lzma_allocator *allocator); diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c index ca14c4a..bd2a737 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c @@ -54,8 +54,8 @@ struct lzma_coder_s { static lzma_ret -lzma2_decode(lzma_coder *restrict coder, lzma_dict *restrict dict, - const uint8_t *restrict in, size_t *restrict in_pos, +lzma2_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dict, + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, size_t in_size) { // With SEQ_LZMA it is possible that no new input is needed to do diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c index 8784f5d..a3651a7 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c @@ -134,8 +134,8 @@ lzma2_header_uncompressed(lzma_coder *coder) static lzma_ret -lzma2_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, - uint8_t *restrict out, size_t *restrict out_pos, +lzma2_encode(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf, + uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos, size_t out_size) { while (*out_pos < out_size) diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c index 1bee2a9..3c0f393 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c @@ -281,9 +281,9 @@ struct lzma_coder_s { static lzma_ret -lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, - const uint8_t *restrict in, - size_t *restrict in_pos, size_t in_size) +lzma_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dictptr, + const uint8_t *LZMA_RESTRICT in, + size_t *LZMA_RESTRICT in_pos, size_t in_size) { /////////////// // Variables // diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c index 6186f83..e8738f4 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c @@ -318,8 +318,8 @@ encode_eopm(lzma_coder *coder, uint32_t position) extern lzma_ret -lzma_lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, - uint8_t *restrict out, size_t *restrict out_pos, +lzma_lzma_encode(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf, + uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos, size_t out_size, uint32_t limit) { uint32_t position; @@ -414,8 +414,8 @@ lzma_lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, static lzma_ret -lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, - uint8_t *restrict out, size_t *restrict out_pos, +lzma_encode(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf, + uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos, size_t out_size) { // Plain LZMA has no support for sync-flushing. diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h index 835e1f5..abb8d8b 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h @@ -44,9 +44,9 @@ extern lzma_ret lzma_lzma_encoder_reset( lzma_coder *coder, const lzma_options_lzma *options); -extern lzma_ret lzma_lzma_encode(lzma_coder *restrict coder, - lzma_mf *restrict mf, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, +extern lzma_ret lzma_lzma_encode(lzma_coder *LZMA_RESTRICT coder, + lzma_mf *LZMA_RESTRICT mf, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, uint32_t read_limit); #endif diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c index 52c26e4..f983126 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c @@ -17,8 +17,8 @@ extern void -lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, - uint32_t *restrict back_res, uint32_t *restrict len_res) +lzma_lzma_optimum_fast(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf, + uint32_t *LZMA_RESTRICT back_res, uint32_t *LZMA_RESTRICT len_res) { const uint8_t *buf; uint32_t buf_avail; diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c index d2829a2..d3a6348 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c @@ -230,8 +230,8 @@ make_short_rep(lzma_optimal *optimal) static void -backward(lzma_coder *restrict coder, uint32_t *restrict len_res, - uint32_t *restrict back_res, uint32_t cur) +backward(lzma_coder *LZMA_RESTRICT coder, uint32_t *LZMA_RESTRICT len_res, + uint32_t *LZMA_RESTRICT back_res, uint32_t cur) { uint32_t pos_mem = coder->opts[cur].pos_prev; uint32_t back_mem = coder->opts[cur].back_prev; @@ -278,8 +278,8 @@ backward(lzma_coder *restrict coder, uint32_t *restrict len_res, ////////// static inline uint32_t -helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, - uint32_t *restrict back_res, uint32_t *restrict len_res, +helper1(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf, + uint32_t *LZMA_RESTRICT back_res, uint32_t *LZMA_RESTRICT len_res, uint32_t position) { uint32_t buf_avail; @@ -865,8 +865,8 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, extern void -lzma_lzma_optimum_normal(lzma_coder *restrict coder, lzma_mf *restrict mf, - uint32_t *restrict back_res, uint32_t *restrict len_res, +lzma_lzma_optimum_normal(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf, + uint32_t *LZMA_RESTRICT back_res, uint32_t *LZMA_RESTRICT len_res, uint32_t position) { uint32_t reps[REP_DISTANCES]; diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h index 6847452..04fb29e 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h @@ -138,11 +138,11 @@ struct lzma_coder_s { extern void lzma_lzma_optimum_fast( - lzma_coder *restrict coder, lzma_mf *restrict mf, - uint32_t *restrict back_res, uint32_t *restrict len_res); + lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf, + uint32_t *LZMA_RESTRICT back_res, uint32_t *LZMA_RESTRICT len_res); -extern void lzma_lzma_optimum_normal(lzma_coder *restrict coder, - lzma_mf *restrict mf, uint32_t *restrict back_res, - uint32_t *restrict len_res, uint32_t position); +extern void lzma_lzma_optimum_normal(lzma_coder *LZMA_RESTRICT coder, + lzma_mf *LZMA_RESTRICT mf, uint32_t *LZMA_RESTRICT back_res, + uint32_t *LZMA_RESTRICT len_res, uint32_t position); #endif diff --git a/Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h b/Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h index fb96180..199e7b5 100644 --- a/Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h +++ b/Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h @@ -26,8 +26,8 @@ typedef struct { /// Reads the first five bytes to initialize the range decoder. static inline bool -rc_read_init(lzma_range_decoder *rc, const uint8_t *restrict in, - size_t *restrict in_pos, size_t in_size) +rc_read_init(lzma_range_decoder *rc, const uint8_t *LZMA_RESTRICT in, + size_t *LZMA_RESTRICT in_pos, size_t in_size) { while (rc->init_bytes_left > 0) { if (*in_pos == in_size) diff --git a/Utilities/cmliblzma/liblzma/simple/simple_coder.c b/Utilities/cmliblzma/liblzma/simple/simple_coder.c index d147d4b..f3bbdd7 100644 --- a/Utilities/cmliblzma/liblzma/simple/simple_coder.c +++ b/Utilities/cmliblzma/liblzma/simple/simple_coder.c @@ -19,9 +19,9 @@ /// Copied or encodes/decodes more data to out[]. static lzma_ret copy_or_code(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { assert(!coder->end_was_reached); @@ -67,9 +67,9 @@ call_filter(lzma_coder *coder, uint8_t *buffer, size_t size) static lzma_ret simple_code(lzma_coder *coder, lzma_allocator *allocator, - const uint8_t *restrict in, size_t *restrict in_pos, - size_t in_size, uint8_t *restrict out, - size_t *restrict out_pos, size_t out_size, lzma_action action) + const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos, + size_t in_size, uint8_t *LZMA_RESTRICT out, + size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action) { size_t out_avail; size_t buf_avail; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90e7a4d41f588d87415381fdb507735e6438992c commit 90e7a4d41f588d87415381fdb507735e6438992c Author: Brad King AuthorDate: Wed Jul 23 11:55:25 2014 -0400 Commit: Brad King CommitDate: Tue Jul 29 08:45:36 2014 -0400 liblzma: Disable warnings to avoid changing 3rd party code diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt index 85efa8c..fc50dbe 100644 --- a/Utilities/cmliblzma/CMakeLists.txt +++ b/Utilities/cmliblzma/CMakeLists.txt @@ -190,6 +190,16 @@ INCLUDE_DIRECTORIES( "${CMLIBLZMA_BINARY_DIR}" ) +# Disable warnings to avoid changing 3rd party code. +IF("${CMAKE_C_COMPILER_ID}" MATCHES + "^(GNU|Clang|AppleClang|XL|VisualAge|SunPro|MIPSpro|HP|Intel)$") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") +ELSEIF("${CMAKE_C_COMPILER_ID}" MATCHES "^(PathScale)$") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall") +ELSEIF(BORLAND) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-") +ENDIF() + ADD_LIBRARY(cmliblzma ${LZMA_SRCS}) INSTALL(FILES COPYING DESTINATION ${CMAKE_DOC_DIR}/cmliblzma) diff --git a/Utilities/cmliblzma/common/sysdefs.h b/Utilities/cmliblzma/common/sysdefs.h index 7481e3d..c84f01c 100644 --- a/Utilities/cmliblzma/common/sysdefs.h +++ b/Utilities/cmliblzma/common/sysdefs.h @@ -17,7 +17,9 @@ #define LZMA_SYSDEFS_H #if defined(_MSC_VER) -# pragma warning(disable: 4028 4244 4761) +# pragma warning(push,1) +# pragma warning(disable: 4142) /* benign redefinition of type */ +# pragma warning(disable: 4761) /* integral size mismatch in argument */ #endif ////////////// http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c20b45027e8288114fd6ee33f99218440b60da77 commit c20b45027e8288114fd6ee33f99218440b60da77 Author: Daniel Pfeifer AuthorDate: Sun Jul 13 22:21:58 2014 +0200 Commit: Brad King CommitDate: Tue Jul 29 08:45:36 2014 -0400 liblzma: Port to VS 6, 7.0 Also remove use of MSVC intrinsic. diff --git a/Utilities/cmliblzma/common/sysdefs.h b/Utilities/cmliblzma/common/sysdefs.h index 5beda5c..7481e3d 100644 --- a/Utilities/cmliblzma/common/sysdefs.h +++ b/Utilities/cmliblzma/common/sysdefs.h @@ -16,6 +16,10 @@ #ifndef LZMA_SYSDEFS_H #define LZMA_SYSDEFS_H +#if defined(_MSC_VER) +# pragma warning(disable: 4028 4244 4761) +#endif + ////////////// // Includes // ////////////// @@ -46,6 +50,12 @@ # include #endif + +#if defined(_MSC_VER) && (_MSC_VER < 1310) +# define UINT64_C(n) n ## ui64 +#endif + + // Be more compatible with systems that have non-conforming inttypes.h. // We assume that int is 32-bit and that long is either 32-bit or 64-bit. // Full Autoconf test could be more correct, but this should work well enough. diff --git a/Utilities/cmliblzma/common/tuklib_integer.h b/Utilities/cmliblzma/common/tuklib_integer.h index 1897438..5e8262a 100644 --- a/Utilities/cmliblzma/common/tuklib_integer.h +++ b/Utilities/cmliblzma/common/tuklib_integer.h @@ -387,13 +387,6 @@ bsr32(uint32_t n) __asm__("bsrl %1, %0" : "=r" (i) : "rm" (n)); return i; -#elif defined(_MSC_VER) && _MSC_VER >= 1400 - // MSVC isn't supported by tuklib, but since this code exists, - // it doesn't hurt to have it here anyway. - uint32_t i; - _BitScanReverse((DWORD *)&i, n); - return i; - #else uint32_t i = 31; @@ -441,11 +434,6 @@ clz32(uint32_t n) : "=r" (i) : "rm" (n)); return i; -#elif defined(_MSC_VER) && _MSC_VER >= 1400 - uint32_t i; - _BitScanReverse((DWORD *)&i, n); - return i ^ 31U; - #else uint32_t i = 0; @@ -491,11 +479,6 @@ ctz32(uint32_t n) __asm__("bsfl %1, %0" : "=r" (i) : "rm" (n)); return i; -#elif defined(_MSC_VER) && _MSC_VER >= 1400 - uint32_t i; - _BitScanForward((DWORD *)&i, n); - return i; - #else uint32_t i = 0; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7a92eddbcb2b2e6419062538e346908f0e502586 commit 7a92eddbcb2b2e6419062538e346908f0e502586 Author: Daniel Pfeifer AuthorDate: Sun Jul 13 22:21:58 2014 +0200 Commit: Brad King CommitDate: Tue Jul 29 08:44:36 2014 -0400 liblzma: Port from C99 to C89/90 Remove use of designated initializers and declarations of variables after statements. Leave "//" comments as-is for now. diff --git a/Utilities/cmliblzma/liblzma/check/check.c b/Utilities/cmliblzma/liblzma/check/check.c index 428ddae..979b0a8 100644 --- a/Utilities/cmliblzma/liblzma/check/check.c +++ b/Utilities/cmliblzma/liblzma/check/check.c @@ -16,9 +16,6 @@ extern LZMA_API(lzma_bool) lzma_check_is_supported(lzma_check type) { - if ((unsigned int)(type) > LZMA_CHECK_ID_MAX) - return false; - static const lzma_bool available_checks[LZMA_CHECK_ID_MAX + 1] = { true, // LZMA_CHECK_NONE @@ -56,6 +53,9 @@ lzma_check_is_supported(lzma_check type) false, // Reserved }; + if ((unsigned int)(type) > LZMA_CHECK_ID_MAX) + return false; + return available_checks[(unsigned int)(type)]; } @@ -63,9 +63,6 @@ lzma_check_is_supported(lzma_check type) extern LZMA_API(uint32_t) lzma_check_size(lzma_check type) { - if ((unsigned int)(type) > LZMA_CHECK_ID_MAX) - return UINT32_MAX; - // See file-format.txt section 2.1.1.2. static const uint8_t check_sizes[LZMA_CHECK_ID_MAX + 1] = { 0, @@ -76,6 +73,9 @@ lzma_check_size(lzma_check type) 64, 64, 64 }; + if ((unsigned int)(type) > LZMA_CHECK_ID_MAX) + return UINT32_MAX; + return check_sizes[(unsigned int)(type)]; } diff --git a/Utilities/cmliblzma/liblzma/check/crc32_fast.c b/Utilities/cmliblzma/liblzma/check/crc32_fast.c index 94da855..13f65b4 100644 --- a/Utilities/cmliblzma/liblzma/check/crc32_fast.c +++ b/Utilities/cmliblzma/liblzma/check/crc32_fast.c @@ -33,6 +33,8 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) #endif if (size > 8) { + const uint8_t * limit; + // Fix the alignment, if needed. The if statement above // ensures that this won't read past the end of buf[]. while ((uintptr_t)(buf) & 7) { @@ -41,7 +43,7 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) } // Calculate the position where to stop. - const uint8_t *const limit = buf + (size & ~(size_t)(7)); + limit = buf + (size & ~(size_t)(7)); // Calculate how many bytes must be calculated separately // before returning the result. @@ -49,6 +51,8 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) // Calculate the CRC32 using the slice-by-eight algorithm. while (buf < limit) { + uint32_t tmp; + crc ^= *(const uint32_t *)(buf); buf += 4; @@ -57,7 +61,7 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) ^ lzma_crc32_table[5][C(crc)] ^ lzma_crc32_table[4][D(crc)]; - const uint32_t tmp = *(const uint32_t *)(buf); + tmp = *(const uint32_t *)(buf); buf += 4; // At least with some compilers, it is critical for diff --git a/Utilities/cmliblzma/liblzma/check/crc64_fast.c b/Utilities/cmliblzma/liblzma/check/crc64_fast.c index 52af29e..1436557 100644 --- a/Utilities/cmliblzma/liblzma/check/crc64_fast.c +++ b/Utilities/cmliblzma/liblzma/check/crc64_fast.c @@ -36,12 +36,14 @@ lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc) #endif if (size > 4) { + const uint8_t *limit; + while ((uintptr_t)(buf) & 3) { crc = lzma_crc64_table[0][*buf++ ^ A1(crc)] ^ S8(crc); --size; } - const uint8_t *const limit = buf + (size & ~(size_t)(3)); + limit = buf + (size & ~(size_t)(3)); size &= (size_t)(3); while (buf < limit) { diff --git a/Utilities/cmliblzma/liblzma/check/sha256.c b/Utilities/cmliblzma/liblzma/check/sha256.c index 23bda92..b09ccbf 100644 --- a/Utilities/cmliblzma/liblzma/check/sha256.c +++ b/Utilities/cmliblzma/liblzma/check/sha256.c @@ -80,16 +80,21 @@ static const uint32_t SHA256_K[64] = { static void +#ifndef _MSC_VER transform(uint32_t state[static 8], const uint32_t data[static 16]) +#else +transform(uint32_t state[], const uint32_t data[]) +#endif { uint32_t W[16]; uint32_t T[8]; + unsigned int j; // Copy state[] to working vars. memcpy(T, state, sizeof(T)); // 64 operations, partially loop unrolled - for (unsigned int j = 0; j < 64; j += 16) { + for (j = 0; j < 64; j += 16) { R( 0); R( 1); R( 2); R( 3); R( 4); R( 5); R( 6); R( 7); R( 8); R( 9); R(10); R(11); @@ -116,8 +121,9 @@ process(lzma_check_state *check) #else uint32_t data[16]; + size_t i; - for (size_t i = 0; i < 16; ++i) + for (i = 0; i < 16; ++i) data[i] = bswap32(check->buffer.u32[i]); transform(check->state.sha256.state, data); @@ -172,6 +178,8 @@ lzma_sha256_update(const uint8_t *buf, size_t size, lzma_check_state *check) extern void lzma_sha256_finish(lzma_check_state *check) { + size_t i; + // Add padding as described in RFC 3174 (it describes SHA-1 but // the same padding style is used for SHA-256 too). size_t pos = check->state.sha256.size & 0x3F; @@ -193,7 +201,7 @@ lzma_sha256_finish(lzma_check_state *check) process(check); - for (size_t i = 0; i < 8; ++i) + for (i = 0; i < 8; ++i) check->buffer.u32[i] = conv32be(check->state.sha256.state[i]); return; diff --git a/Utilities/cmliblzma/liblzma/common/alone_decoder.c b/Utilities/cmliblzma/liblzma/common/alone_decoder.c index c25112e..a20cf49 100644 --- a/Utilities/cmliblzma/liblzma/common/alone_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/alone_decoder.c @@ -126,19 +126,17 @@ alone_decode(lzma_coder *coder, // Fall through case SEQ_CODER_INIT: { - if (coder->memusage > coder->memlimit) - return LZMA_MEMLIMIT_ERROR; + lzma_ret ret; lzma_filter_info filters[2] = { - { - .init = &lzma_lzma_decoder_init, - .options = &coder->options, - }, { - .init = NULL, - } + { 0, &lzma_lzma_decoder_init, &coder->options }, + { 0, NULL, NULL } }; - const lzma_ret ret = lzma_next_filter_init(&coder->next, + if (coder->memusage > coder->memlimit) + return LZMA_MEMLIMIT_ERROR; + + ret = lzma_next_filter_init(&coder->next, allocator, filters); if (ret != LZMA_OK) return ret; @@ -229,7 +227,7 @@ lzma_alone_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_alone_decoder(lzma_stream *strm, uint64_t memlimit) { - lzma_next_strm_init(lzma_alone_decoder_init, strm, memlimit, false); + lzma_next_strm_init2(lzma_alone_decoder_init, strm, memlimit, false); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; diff --git a/Utilities/cmliblzma/liblzma/common/alone_encoder.c b/Utilities/cmliblzma/liblzma/common/alone_encoder.c index eb1697e..62df126 100644 --- a/Utilities/cmliblzma/liblzma/common/alone_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/alone_encoder.c @@ -78,6 +78,14 @@ static lzma_ret alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, const lzma_options_lzma *options) { + uint32_t d; + + // Initialize the LZMA encoder. + const lzma_filter_info filters[2] = { + { 0, &lzma_lzma_encoder_init, (void *)(options) }, + { 0, NULL, NULL } + }; + lzma_next_coder_init(&alone_encoder_init, next, allocator); if (next->coder == NULL) { @@ -107,7 +115,7 @@ alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, // one is the next unless it is UINT32_MAX. While the header would // allow any 32-bit integer, we do this to keep the decoder of liblzma // accepting the resulting files. - uint32_t d = options->dict_size - 1; + d = options->dict_size - 1; d |= d >> 2; d |= d >> 3; d |= d >> 4; @@ -121,16 +129,6 @@ alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, // - Uncompressed size (always unknown and using EOPM) memset(next->coder->header + 1 + 4, 0xFF, 8); - // Initialize the LZMA encoder. - const lzma_filter_info filters[2] = { - { - .init = &lzma_lzma_encoder_init, - .options = (void *)(options), - }, { - .init = NULL, - } - }; - return lzma_next_filter_init(&next->coder->next, allocator, filters); } @@ -148,7 +146,7 @@ lzma_alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_alone_encoder(lzma_stream *strm, const lzma_options_lzma *options) { - lzma_next_strm_init(alone_encoder_init, strm, options); + lzma_next_strm_init1(alone_encoder_init, strm, options); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; diff --git a/Utilities/cmliblzma/liblzma/common/auto_decoder.c b/Utilities/cmliblzma/liblzma/common/auto_decoder.c index 35c895f..6f3c862 100644 --- a/Utilities/cmliblzma/liblzma/common/auto_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/auto_decoder.c @@ -177,7 +177,7 @@ auto_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_auto_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags) { - lzma_next_strm_init(auto_decoder_init, strm, memlimit, flags); + lzma_next_strm_init2(auto_decoder_init, strm, memlimit, flags); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; diff --git a/Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c b/Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c index ff27a11..b4bd388 100644 --- a/Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c @@ -18,6 +18,9 @@ lzma_block_buffer_decode(lzma_block *block, lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) { + lzma_next_coder block_decoder; + lzma_ret ret; + if (in_pos == NULL || (in == NULL && *in_pos != in_size) || *in_pos > in_size || out_pos == NULL || (out == NULL && *out_pos != out_size) @@ -25,9 +28,8 @@ lzma_block_buffer_decode(lzma_block *block, lzma_allocator *allocator, return LZMA_PROG_ERROR; // Initialize the Block decoder. - lzma_next_coder block_decoder = LZMA_NEXT_CODER_INIT; - lzma_ret ret = lzma_block_decoder_init( - &block_decoder, allocator, block); + block_decoder = LZMA_NEXT_CODER_INIT; + ret = lzma_block_decoder_init(&block_decoder, allocator, block); if (ret == LZMA_OK) { // Save the positions so that we can restore them in case diff --git a/Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c b/Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c index 519c6a6..136f7f5 100644 --- a/Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c @@ -31,6 +31,8 @@ static lzma_vli lzma2_bound(lzma_vli uncompressed_size) { + lzma_vli overhead; + // Prevent integer overflow in overhead calculation. if (uncompressed_size > COMPRESSED_SIZE_MAX) return 0; @@ -39,7 +41,7 @@ lzma2_bound(lzma_vli uncompressed_size) // uncompressed_size up to the next multiple of LZMA2_CHUNK_MAX, // multiply by the size of per-chunk header, and add one byte for // the end marker. - const lzma_vli overhead = ((uncompressed_size + LZMA2_CHUNK_MAX - 1) + overhead = ((uncompressed_size + LZMA2_CHUNK_MAX - 1) / LZMA2_CHUNK_MAX) * LZMA2_HEADER_UNCOMPRESSED + 1; @@ -82,15 +84,17 @@ static lzma_ret block_encode_uncompressed(lzma_block *block, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) { + size_t in_pos = 0; + uint8_t control = 0x01; // Dictionary reset + lzma_filter *filters_orig; + // TODO: Figure out if the last filter is LZMA2 or Subblock and use // that filter to encode the uncompressed chunks. // Use LZMA2 uncompressed chunks. We wouldn't need a dictionary at // all, but LZMA2 always requires a dictionary, so use the minimum // value to minimize memory usage of the decoder. - lzma_options_lzma lzma2 = { - .dict_size = LZMA_DICT_SIZE_MIN, - }; + lzma_options_lzma lzma2 = { LZMA_DICT_SIZE_MIN }; lzma_filter filters[2]; filters[0].id = LZMA_FILTER_LZMA2; @@ -99,7 +103,7 @@ block_encode_uncompressed(lzma_block *block, const uint8_t *in, size_t in_size, // Set the above filter options to *block temporarily so that we can // encode the Block Header. - lzma_filter *filters_orig = block->filters; + filters_orig = block->filters; block->filters = filters; if (lzma_block_header_size(block) != LZMA_OK) { @@ -128,18 +132,17 @@ block_encode_uncompressed(lzma_block *block, const uint8_t *in, size_t in_size, *out_pos += block->header_size; // Encode the data using LZMA2 uncompressed chunks. - size_t in_pos = 0; - uint8_t control = 0x01; // Dictionary reset while (in_pos < in_size) { + size_t copy_size; + // Control byte: Indicate uncompressed chunk, of which // the first resets the dictionary. out[(*out_pos)++] = control; control = 0x02; // No dictionary reset // Size of the uncompressed chunk - const size_t copy_size - = my_min(in_size - in_pos, LZMA2_CHUNK_MAX); + copy_size = my_min(in_size - in_pos, LZMA2_CHUNK_MAX); out[(*out_pos)++] = (copy_size - 1) >> 8; out[(*out_pos)++] = (copy_size - 1) & 0xFF; @@ -164,6 +167,10 @@ block_encode_normal(lzma_block *block, lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) { + size_t out_start; + lzma_next_coder raw_encoder = LZMA_NEXT_CODER_INIT; + lzma_ret ret; + // Find out the size of the Block Header. block->compressed_size = lzma2_bound(in_size); if (block->compressed_size == 0) @@ -176,7 +183,7 @@ block_encode_normal(lzma_block *block, lzma_allocator *allocator, if (out_size - *out_pos <= block->header_size) return LZMA_BUF_ERROR; - const size_t out_start = *out_pos; + out_start = *out_pos; *out_pos += block->header_size; // Limit out_size so that we stop encoding if the output would grow @@ -186,8 +193,7 @@ block_encode_normal(lzma_block *block, lzma_allocator *allocator, // TODO: In many common cases this could be optimized to use // significantly less memory. - lzma_next_coder raw_encoder = LZMA_NEXT_CODER_INIT; - lzma_ret ret = lzma_raw_encoder_init( + ret = lzma_raw_encoder_init( &raw_encoder, allocator, block->filters); if (ret == LZMA_OK) { @@ -226,6 +232,10 @@ lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) { + size_t check_size; + lzma_ret ret; + size_t i; + // Validate the arguments. if (block == NULL || (in == NULL && in_size != 0) || out == NULL || out_pos == NULL || *out_pos > out_size) @@ -249,7 +259,7 @@ lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator, out_size -= (out_size - *out_pos) & 3; // Get the size of the Check field. - const size_t check_size = lzma_check_size(block->check); + check_size = lzma_check_size(block->check); assert(check_size != UINT32_MAX); // Reserve space for the Check field. @@ -259,7 +269,7 @@ lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator, out_size -= check_size; // Do the actual compression. - const lzma_ret ret = block_encode_normal(block, allocator, + ret = block_encode_normal(block, allocator, in, in_size, out, out_pos, out_size); if (ret != LZMA_OK) { // If the error was something else than output buffer @@ -281,7 +291,7 @@ lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator, // Block Padding. No buffer overflow here, because we already adjusted // out_size so that (out_size - out_start) is a multiple of four. // Thus, if the buffer is full, the loop body can never run. - for (size_t i = (size_t)(block->compressed_size); i & 3; ++i) { + for (i = (size_t)(block->compressed_size); i & 3; ++i) { assert(*out_pos < out_size); out[(*out_pos)++] = 0x00; } diff --git a/Utilities/cmliblzma/liblzma/common/block_decoder.c b/Utilities/cmliblzma/liblzma/common/block_decoder.c index a3ce6f4..3de3851 100644 --- a/Utilities/cmliblzma/liblzma/common/block_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_decoder.c @@ -233,7 +233,7 @@ lzma_block_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_block_decoder(lzma_stream *strm, lzma_block *block) { - lzma_next_strm_init(lzma_block_decoder_init, strm, block); + lzma_next_strm_init1(lzma_block_decoder_init, strm, block); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; diff --git a/Utilities/cmliblzma/liblzma/common/block_encoder.c b/Utilities/cmliblzma/liblzma/common/block_encoder.c index 1eeb502..63e2687 100644 --- a/Utilities/cmliblzma/liblzma/common/block_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_encoder.c @@ -208,7 +208,7 @@ lzma_block_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_block_encoder(lzma_stream *strm, lzma_block *block) { - lzma_next_strm_init(lzma_block_encoder_init, strm, block); + lzma_next_strm_init1(lzma_block_encoder_init, strm, block); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; diff --git a/Utilities/cmliblzma/liblzma/common/block_header_decoder.c b/Utilities/cmliblzma/liblzma/common/block_header_decoder.c index 2c9573e..f6e470e 100644 --- a/Utilities/cmliblzma/liblzma/common/block_header_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_header_decoder.c @@ -17,10 +17,12 @@ static void free_properties(lzma_block *block, lzma_allocator *allocator) { + size_t i; + // Free allocated filter options. The last array member is not // touched after the initialization in the beginning of // lzma_block_header_decode(), so we don't need to touch that here. - for (size_t i = 0; i < LZMA_FILTERS_MAX; ++i) { + for (i = 0; i < LZMA_FILTERS_MAX; ++i) { lzma_free(block->filters[i].options, allocator); block->filters[i].id = LZMA_VLI_UNKNOWN; block->filters[i].options = NULL; @@ -34,6 +36,13 @@ extern LZMA_API(lzma_ret) lzma_block_header_decode(lzma_block *block, lzma_allocator *allocator, const uint8_t *in) { + const size_t filter_count = (in[1] & 3) + 1; + size_t in_size; + size_t i; + + // Start after the Block Header Size and Block Flags fields. + size_t in_pos = 2; + // NOTE: We consider the header to be corrupt not only when the // CRC32 doesn't match, but also when variable-length integers // are invalid or over 63 bits, or if the header is too small @@ -41,7 +50,7 @@ lzma_block_header_decode(lzma_block *block, // Initialize the filter options array. This way the caller can // safely free() the options even if an error occurs in this function. - for (size_t i = 0; i <= LZMA_FILTERS_MAX; ++i) { + for (i = 0; i <= LZMA_FILTERS_MAX; ++i) { block->filters[i].id = LZMA_VLI_UNKNOWN; block->filters[i].options = NULL; } @@ -56,7 +65,7 @@ lzma_block_header_decode(lzma_block *block, return LZMA_PROG_ERROR; // Exclude the CRC32 field. - const size_t in_size = block->header_size - 4; + in_size = block->header_size - 4; // Verify CRC32 if (lzma_crc32(in, in_size, 0) != unaligned_read32le(in + in_size)) @@ -66,9 +75,6 @@ lzma_block_header_decode(lzma_block *block, if (in[1] & 0x3C) return LZMA_OPTIONS_ERROR; - // Start after the Block Header Size and Block Flags fields. - size_t in_pos = 2; - // Compressed Size if (in[1] & 0x40) { return_if_error(lzma_vli_decode(&block->compressed_size, @@ -90,8 +96,7 @@ lzma_block_header_decode(lzma_block *block, block->uncompressed_size = LZMA_VLI_UNKNOWN; // Filter Flags - const size_t filter_count = (in[1] & 3) + 1; - for (size_t i = 0; i < filter_count; ++i) { + for (i = 0; i < filter_count; ++i) { const lzma_ret ret = lzma_filter_flags_decode( &block->filters[i], allocator, in, &in_pos, in_size); diff --git a/Utilities/cmliblzma/liblzma/common/block_header_encoder.c b/Utilities/cmliblzma/liblzma/common/block_header_encoder.c index 707dd0c..650295c 100644 --- a/Utilities/cmliblzma/liblzma/common/block_header_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/block_header_encoder.c @@ -17,12 +17,14 @@ extern LZMA_API(lzma_ret) lzma_block_header_size(lzma_block *block) { - if (block->version != 0) - return LZMA_OPTIONS_ERROR; + size_t i; // Block Header Size + Block Flags + CRC32. uint32_t size = 1 + 1 + 4; + if (block->version != 0) + return LZMA_OPTIONS_ERROR; + // Compressed Size if (block->compressed_size != LZMA_VLI_UNKNOWN) { const uint32_t add = lzma_vli_size(block->compressed_size); @@ -45,12 +47,13 @@ lzma_block_header_size(lzma_block *block) if (block->filters == NULL || block->filters[0].id == LZMA_VLI_UNKNOWN) return LZMA_PROG_ERROR; - for (size_t i = 0; block->filters[i].id != LZMA_VLI_UNKNOWN; ++i) { + for (i = 0; block->filters[i].id != LZMA_VLI_UNKNOWN; ++i) { + uint32_t add; + // Don't allow too many filters. if (i == LZMA_FILTERS_MAX) return LZMA_PROG_ERROR; - uint32_t add; return_if_error(lzma_filter_flags_size(&add, block->filters + i)); @@ -73,20 +76,23 @@ lzma_block_header_size(lzma_block *block) extern LZMA_API(lzma_ret) lzma_block_header_encode(const lzma_block *block, uint8_t *out) { + size_t out_size; + size_t out_pos = 2; + size_t filter_count = 0; + // Validate everything but filters. if (lzma_block_unpadded_size(block) == 0 || !lzma_vli_is_valid(block->uncompressed_size)) return LZMA_PROG_ERROR; // Indicate the size of the buffer _excluding_ the CRC32 field. - const size_t out_size = block->header_size - 4; + out_size = block->header_size - 4; // Store the Block Header Size. out[0] = out_size / 4; // We write Block Flags in pieces. out[1] = 0x00; - size_t out_pos = 2; // Compressed Size if (block->compressed_size != LZMA_VLI_UNKNOWN) { @@ -108,7 +114,6 @@ lzma_block_header_encode(const lzma_block *block, uint8_t *out) if (block->filters == NULL || block->filters[0].id == LZMA_VLI_UNKNOWN) return LZMA_PROG_ERROR; - size_t filter_count = 0; do { // There can be a maximum of four filters. if (filter_count == LZMA_FILTERS_MAX) diff --git a/Utilities/cmliblzma/liblzma/common/block_util.c b/Utilities/cmliblzma/liblzma/common/block_util.c index 62c9345..4cd34d1 100644 --- a/Utilities/cmliblzma/liblzma/common/block_util.c +++ b/Utilities/cmliblzma/liblzma/common/block_util.c @@ -17,11 +17,14 @@ extern LZMA_API(lzma_ret) lzma_block_compressed_size(lzma_block *block, lzma_vli unpadded_size) { + uint32_t container_size; + lzma_vli compressed_size; + // Validate everything but Uncompressed Size and filters. if (lzma_block_unpadded_size(block) == 0) return LZMA_PROG_ERROR; - const uint32_t container_size = block->header_size + container_size = block->header_size + lzma_check_size(block->check); // Validate that Compressed Size will be greater than zero. @@ -31,7 +34,7 @@ lzma_block_compressed_size(lzma_block *block, lzma_vli unpadded_size) // Calculate what Compressed Size is supposed to be. // If Compressed Size was present in Block Header, // compare that the new value matches it. - const lzma_vli compressed_size = unpadded_size - container_size; + compressed_size = unpadded_size - container_size; if (block->compressed_size != LZMA_VLI_UNKNOWN && block->compressed_size != compressed_size) return LZMA_DATA_ERROR; @@ -45,6 +48,8 @@ lzma_block_compressed_size(lzma_block *block, lzma_vli unpadded_size) extern LZMA_API(lzma_vli) lzma_block_unpadded_size(const lzma_block *block) { + lzma_vli unpadded_size; + // Validate the values that we are interested in i.e. all but // Uncompressed Size and the filters. // @@ -66,7 +71,7 @@ lzma_block_unpadded_size(const lzma_block *block) return LZMA_VLI_UNKNOWN; // Calculate Unpadded Size and validate it. - const lzma_vli unpadded_size = block->compressed_size + unpadded_size = block->compressed_size + block->header_size + lzma_check_size(block->check); diff --git a/Utilities/cmliblzma/liblzma/common/common.c b/Utilities/cmliblzma/liblzma/common/common.c index b9e3860..d0105e1 100644 --- a/Utilities/cmliblzma/liblzma/common/common.c +++ b/Utilities/cmliblzma/liblzma/common/common.c @@ -38,12 +38,12 @@ lzma_version_string(void) extern void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1) lzma_alloc(size_t size, lzma_allocator *allocator) { + void *ptr; + // Some malloc() variants return NULL if called with size == 0. if (size == 0) size = 1; - void *ptr; - if (allocator != NULL && allocator->alloc != NULL) ptr = allocator->alloc(allocator->opaque, 1, size); else @@ -173,6 +173,10 @@ lzma_strm_init(lzma_stream *strm) extern LZMA_API(lzma_ret) lzma_code(lzma_stream *strm, lzma_action action) { + size_t in_pos = 0; + size_t out_pos = 0; + lzma_ret ret; + // Sanity checks if ((strm->next_in == NULL && strm->avail_in != 0) || (strm->next_out == NULL && strm->avail_out != 0) @@ -248,9 +252,7 @@ lzma_code(lzma_stream *strm, lzma_action action) return LZMA_PROG_ERROR; } - size_t in_pos = 0; - size_t out_pos = 0; - lzma_ret ret = strm->internal->next.code( + ret = strm->internal->next.code( strm->internal->next.coder, strm->allocator, strm->next_in, &in_pos, strm->avail_in, strm->next_out, &out_pos, strm->avail_out, action); diff --git a/Utilities/cmliblzma/liblzma/common/common.h b/Utilities/cmliblzma/liblzma/common/common.h index 6d7412f..a1a1591 100644 --- a/Utilities/cmliblzma/liblzma/common/common.h +++ b/Utilities/cmliblzma/liblzma/common/common.h @@ -155,18 +155,18 @@ struct lzma_next_coder_s { }; -/// Macro to initialize lzma_next_coder structure -#define LZMA_NEXT_CODER_INIT \ - (lzma_next_coder){ \ - .coder = NULL, \ - .init = (uintptr_t)(NULL), \ - .id = LZMA_VLI_UNKNOWN, \ - .code = NULL, \ - .end = NULL, \ - .get_check = NULL, \ - .memconfig = NULL, \ - .update = NULL, \ - } +/// Constant to initialize lzma_next_coder structure +static const lzma_next_coder LZMA_NEXT_CODER_INIT = + { + NULL, + LZMA_VLI_UNKNOWN, + (uintptr_t)(NULL), + NULL, + NULL, + NULL, + NULL, + NULL, + }; /// Internal data for lzma_strm_init, lzma_code, and lzma_end. A pointer to @@ -211,7 +211,7 @@ extern void lzma_free(void *ptr, lzma_allocator *allocator); /// Allocates strm->internal if it is NULL, and initializes *strm and -/// strm->internal. This function is only called via lzma_next_strm_init macro. +/// strm->internal. This function is only called via lzma_next_strm_init2 macro. extern lzma_ret lzma_strm_init(lzma_stream *strm); /// Initializes the next filter in the chain, if any. This takes care of @@ -269,15 +269,37 @@ do { \ /// (The function being called will use lzma_next_coder_init()). If /// initialization fails, memory that wasn't freed by func() is freed /// along strm->internal. -#define lzma_next_strm_init(func, strm, ...) \ +#define lzma_next_strm_init1(func, strm, arg1) \ do { \ - return_if_error(lzma_strm_init(strm)); \ - const lzma_ret ret_ = func(&(strm)->internal->next, \ - (strm)->allocator, __VA_ARGS__); \ - if (ret_ != LZMA_OK) { \ - lzma_end(strm); \ - return ret_; \ - } \ + lzma_ret ret_; \ + return_if_error(lzma_strm_init(strm)); \ + ret_ = func(&(strm)->internal->next, (strm)->allocator, arg1); \ + if (ret_ != LZMA_OK) { \ + lzma_end(strm); \ + return ret_; \ + } \ +} while (0) + +#define lzma_next_strm_init2(func, strm, arg1, arg2) \ +do { \ + lzma_ret ret_; \ + return_if_error(lzma_strm_init(strm)); \ + ret_ = func(&(strm)->internal->next, (strm)->allocator, arg1, arg2); \ + if (ret_ != LZMA_OK) { \ + lzma_end(strm); \ + return ret_; \ + } \ +} while (0) + +#define lzma_next_strm_init3(func, strm, arg1, arg2, arg3) \ +do { \ + lzma_ret ret_; \ + return_if_error(lzma_strm_init(strm)); \ + ret_ = func(&(strm)->internal->next, (strm)->allocator, arg1, arg2, arg3); \ + if (ret_ != LZMA_OK) { \ + lzma_end(strm); \ + return ret_; \ + } \ } while (0) #endif diff --git a/Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c b/Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c index 2d35ef8..65665c1 100644 --- a/Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c @@ -18,22 +18,26 @@ lzma_raw_buffer_decode(const lzma_filter *filters, lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) { + lzma_next_coder next = LZMA_NEXT_CODER_INIT; + size_t in_start; + size_t out_start; + lzma_ret ret; + // Validate what isn't validated later in filter_common.c. if (in == NULL || in_pos == NULL || *in_pos > in_size || out == NULL || out_pos == NULL || *out_pos > out_size) return LZMA_PROG_ERROR; // Initialize the decoer. - lzma_next_coder next = LZMA_NEXT_CODER_INIT; return_if_error(lzma_raw_decoder_init(&next, allocator, filters)); // Store the positions so that we can restore them if something // goes wrong. - const size_t in_start = *in_pos; - const size_t out_start = *out_pos; + in_start = *in_pos; + out_start = *out_pos; // Do the actual decoding and free decoder's memory. - lzma_ret ret = next.code(next.coder, allocator, in, in_pos, in_size, + ret = next.code(next.coder, allocator, in, in_pos, in_size, out, out_pos, out_size, LZMA_FINISH); if (ret == LZMA_STREAM_END) { diff --git a/Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c b/Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c index 646e1b3..b23329f 100644 --- a/Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c @@ -18,22 +18,25 @@ lzma_raw_buffer_encode(const lzma_filter *filters, lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) { + lzma_next_coder next = LZMA_NEXT_CODER_INIT; + size_t out_start; + size_t in_pos = 0; + lzma_ret ret; + // Validate what isn't validated later in filter_common.c. if ((in == NULL && in_size != 0) || out == NULL || out_pos == NULL || *out_pos > out_size) return LZMA_PROG_ERROR; // Initialize the encoder - lzma_next_coder next = LZMA_NEXT_CODER_INIT; return_if_error(lzma_raw_encoder_init(&next, allocator, filters)); // Store the output position so that we can restore it if // something goes wrong. - const size_t out_start = *out_pos; + out_start = *out_pos; // Do the actual encoding and free coder's memory. - size_t in_pos = 0; - lzma_ret ret = next.code(next.coder, allocator, in, &in_pos, in_size, + ret = next.code(next.coder, allocator, in, &in_pos, in_size, out, out_pos, out_size, LZMA_FINISH); lzma_next_end(&next, allocator); diff --git a/Utilities/cmliblzma/liblzma/common/filter_common.c b/Utilities/cmliblzma/liblzma/common/filter_common.c index 7c95b05..d2b9e08 100644 --- a/Utilities/cmliblzma/liblzma/common/filter_common.c +++ b/Utilities/cmliblzma/liblzma/common/filter_common.c @@ -36,87 +36,87 @@ static const struct { } features[] = { #if defined (HAVE_ENCODER_LZMA1) || defined(HAVE_DECODER_LZMA1) { - .id = LZMA_FILTER_LZMA1, - .options_size = sizeof(lzma_options_lzma), - .non_last_ok = false, - .last_ok = true, - .changes_size = true, + LZMA_FILTER_LZMA1, + sizeof(lzma_options_lzma), + false, + true, + true, }, #endif #if defined(HAVE_ENCODER_LZMA2) || defined(HAVE_DECODER_LZMA2) { - .id = LZMA_FILTER_LZMA2, - .options_size = sizeof(lzma_options_lzma), - .non_last_ok = false, - .last_ok = true, - .changes_size = true, + LZMA_FILTER_LZMA2, + sizeof(lzma_options_lzma), + false, + true, + true, }, #endif #if defined(HAVE_ENCODER_X86) || defined(HAVE_DECODER_X86) { - .id = LZMA_FILTER_X86, - .options_size = sizeof(lzma_options_bcj), - .non_last_ok = true, - .last_ok = false, - .changes_size = false, + LZMA_FILTER_X86, + sizeof(lzma_options_bcj), + true, + false, + false, }, #endif #if defined(HAVE_ENCODER_POWERPC) || defined(HAVE_DECODER_POWERPC) { - .id = LZMA_FILTER_POWERPC, - .options_size = sizeof(lzma_options_bcj), - .non_last_ok = true, - .last_ok = false, - .changes_size = false, + LZMA_FILTER_POWERPC, + sizeof(lzma_options_bcj), + true, + false, + false, }, #endif #if defined(HAVE_ENCODER_IA64) || defined(HAVE_DECODER_IA64) { - .id = LZMA_FILTER_IA64, - .options_size = sizeof(lzma_options_bcj), - .non_last_ok = true, - .last_ok = false, - .changes_size = false, + LZMA_FILTER_IA64, + sizeof(lzma_options_bcj), + true, + false, + false, }, #endif #if defined(HAVE_ENCODER_ARM) || defined(HAVE_DECODER_ARM) { - .id = LZMA_FILTER_ARM, - .options_size = sizeof(lzma_options_bcj), - .non_last_ok = true, - .last_ok = false, - .changes_size = false, + LZMA_FILTER_ARM, + sizeof(lzma_options_bcj), + true, + false, + false, }, #endif #if defined(HAVE_ENCODER_ARMTHUMB) || defined(HAVE_DECODER_ARMTHUMB) { - .id = LZMA_FILTER_ARMTHUMB, - .options_size = sizeof(lzma_options_bcj), - .non_last_ok = true, - .last_ok = false, - .changes_size = false, + LZMA_FILTER_ARMTHUMB, + sizeof(lzma_options_bcj), + true, + false, + false, }, #endif #if defined(HAVE_ENCODER_SPARC) || defined(HAVE_DECODER_SPARC) { - .id = LZMA_FILTER_SPARC, - .options_size = sizeof(lzma_options_bcj), - .non_last_ok = true, - .last_ok = false, - .changes_size = false, + LZMA_FILTER_SPARC, + sizeof(lzma_options_bcj), + true, + false, + false, }, #endif #if defined(HAVE_ENCODER_DELTA) || defined(HAVE_DECODER_DELTA) { - .id = LZMA_FILTER_DELTA, - .options_size = sizeof(lzma_options_delta), - .non_last_ok = true, - .last_ok = false, - .changes_size = false, + LZMA_FILTER_DELTA, + sizeof(lzma_options_delta), + true, + false, + false, }, #endif { - .id = LZMA_VLI_UNKNOWN + LZMA_VLI_UNKNOWN } }; @@ -125,11 +125,12 @@ extern LZMA_API(lzma_ret) lzma_filters_copy(const lzma_filter *src, lzma_filter *dest, lzma_allocator *allocator) { + size_t i; + lzma_ret ret; + if (src == NULL || dest == NULL) return LZMA_PROG_ERROR; - lzma_ret ret; - size_t i; for (i = 0; src[i].id != LZMA_VLI_UNKNOWN; ++i) { // There must be a maximum of four filters plus // the array terminator. @@ -193,10 +194,6 @@ error: static lzma_ret validate_chain(const lzma_filter *filters, size_t *count) { - // There must be at least one filter. - if (filters == NULL || filters[0].id == LZMA_VLI_UNKNOWN) - return LZMA_PROG_ERROR; - // Number of non-last filters that may change the size of the data // significantly (that is, more than 1-2 % or so). size_t changes_size_count = 0; @@ -210,6 +207,11 @@ validate_chain(const lzma_filter *filters, size_t *count) bool last_ok = false; size_t i = 0; + + // There must be at least one filter. + if (filters == NULL || filters[0].id == LZMA_VLI_UNKNOWN) + return LZMA_PROG_ERROR; + do { size_t j; for (j = 0; filters[i].id != features[j].id; ++j) @@ -243,14 +245,17 @@ lzma_raw_coder_init(lzma_next_coder *next, lzma_allocator *allocator, const lzma_filter *options, lzma_filter_find coder_find, bool is_encoder) { - // Do some basic validation and get the number of filters. + lzma_filter_info filters[LZMA_FILTERS_MAX + 1]; size_t count; + size_t i; + lzma_ret ret; + + // Do some basic validation and get the number of filters. return_if_error(validate_chain(options, &count)); // Set the filter functions and copy the options pointer. - lzma_filter_info filters[LZMA_FILTERS_MAX + 1]; if (is_encoder) { - for (size_t i = 0; i < count; ++i) { + for (i = 0; i < count; ++i) { // The order of the filters is reversed in the // encoder. It allows more efficient handling // of the uncompressed data. @@ -266,7 +271,7 @@ lzma_raw_coder_init(lzma_next_coder *next, lzma_allocator *allocator, filters[j].options = options[i].options; } } else { - for (size_t i = 0; i < count; ++i) { + for (i = 0; i < count; ++i) { const lzma_filter_coder *const fc = coder_find(options[i].id); if (fc == NULL || fc->init == NULL) @@ -283,7 +288,7 @@ lzma_raw_coder_init(lzma_next_coder *next, lzma_allocator *allocator, filters[count].init = NULL; // Initialize the filters. - const lzma_ret ret = lzma_next_filter_init(next, allocator, filters); + ret = lzma_next_filter_init(next, allocator, filters); if (ret != LZMA_OK) lzma_next_end(next, allocator); @@ -295,6 +300,9 @@ extern uint64_t lzma_raw_coder_memusage(lzma_filter_find coder_find, const lzma_filter *filters) { + uint64_t total = 0; + size_t i = 0; + // The chain has to have at least one filter. { size_t tmp; @@ -302,9 +310,6 @@ lzma_raw_coder_memusage(lzma_filter_find coder_find, return UINT64_MAX; } - uint64_t total = 0; - size_t i = 0; - do { const lzma_filter_coder *const fc = coder_find(filters[i].id); diff --git a/Utilities/cmliblzma/liblzma/common/filter_decoder.c b/Utilities/cmliblzma/liblzma/common/filter_decoder.c index 1ebbe2a..cce2b30 100644 --- a/Utilities/cmliblzma/liblzma/common/filter_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_decoder.c @@ -44,74 +44,74 @@ typedef struct { static const lzma_filter_decoder decoders[] = { #ifdef HAVE_DECODER_LZMA1 { - .id = LZMA_FILTER_LZMA1, - .init = &lzma_lzma_decoder_init, - .memusage = &lzma_lzma_decoder_memusage, - .props_decode = &lzma_lzma_props_decode, + LZMA_FILTER_LZMA1, + &lzma_lzma_decoder_init, + &lzma_lzma_decoder_memusage, + &lzma_lzma_props_decode, }, #endif #ifdef HAVE_DECODER_LZMA2 { - .id = LZMA_FILTER_LZMA2, - .init = &lzma_lzma2_decoder_init, - .memusage = &lzma_lzma2_decoder_memusage, - .props_decode = &lzma_lzma2_props_decode, + LZMA_FILTER_LZMA2, + &lzma_lzma2_decoder_init, + &lzma_lzma2_decoder_memusage, + &lzma_lzma2_props_decode, }, #endif #ifdef HAVE_DECODER_X86 { - .id = LZMA_FILTER_X86, - .init = &lzma_simple_x86_decoder_init, - .memusage = NULL, - .props_decode = &lzma_simple_props_decode, + LZMA_FILTER_X86, + &lzma_simple_x86_decoder_init, + NULL, + &lzma_simple_props_decode, }, #endif #ifdef HAVE_DECODER_POWERPC { - .id = LZMA_FILTER_POWERPC, - .init = &lzma_simple_powerpc_decoder_init, - .memusage = NULL, - .props_decode = &lzma_simple_props_decode, + LZMA_FILTER_POWERPC, + &lzma_simple_powerpc_decoder_init, + NULL, + &lzma_simple_props_decode, }, #endif #ifdef HAVE_DECODER_IA64 { - .id = LZMA_FILTER_IA64, - .init = &lzma_simple_ia64_decoder_init, - .memusage = NULL, - .props_decode = &lzma_simple_props_decode, + LZMA_FILTER_IA64, + &lzma_simple_ia64_decoder_init, + NULL, + &lzma_simple_props_decode, }, #endif #ifdef HAVE_DECODER_ARM { - .id = LZMA_FILTER_ARM, - .init = &lzma_simple_arm_decoder_init, - .memusage = NULL, - .props_decode = &lzma_simple_props_decode, + LZMA_FILTER_ARM, + &lzma_simple_arm_decoder_init, + NULL, + &lzma_simple_props_decode, }, #endif #ifdef HAVE_DECODER_ARMTHUMB { - .id = LZMA_FILTER_ARMTHUMB, - .init = &lzma_simple_armthumb_decoder_init, - .memusage = NULL, - .props_decode = &lzma_simple_props_decode, + LZMA_FILTER_ARMTHUMB, + &lzma_simple_armthumb_decoder_init, + NULL, + &lzma_simple_props_decode, }, #endif #ifdef HAVE_DECODER_SPARC { - .id = LZMA_FILTER_SPARC, - .init = &lzma_simple_sparc_decoder_init, - .memusage = NULL, - .props_decode = &lzma_simple_props_decode, + LZMA_FILTER_SPARC, + &lzma_simple_sparc_decoder_init, + NULL, + &lzma_simple_props_decode, }, #endif #ifdef HAVE_DECODER_DELTA { - .id = LZMA_FILTER_DELTA, - .init = &lzma_delta_decoder_init, - .memusage = &lzma_delta_coder_memusage, - .props_decode = &lzma_delta_props_decode, + LZMA_FILTER_DELTA, + &lzma_delta_decoder_init, + &lzma_delta_coder_memusage, + &lzma_delta_props_decode, }, #endif }; @@ -120,7 +120,8 @@ static const lzma_filter_decoder decoders[] = { static const lzma_filter_decoder * decoder_find(lzma_vli id) { - for (size_t i = 0; i < ARRAY_SIZE(decoders); ++i) + size_t i; + for (i = 0; i < ARRAY_SIZE(decoders); ++i) if (decoders[i].id == id) return decoders + i; @@ -147,7 +148,7 @@ lzma_raw_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_raw_decoder(lzma_stream *strm, const lzma_filter *options) { - lzma_next_strm_init(lzma_raw_decoder_init, strm, options); + lzma_next_strm_init1(lzma_raw_decoder_init, strm, options); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; @@ -168,10 +169,11 @@ extern LZMA_API(lzma_ret) lzma_properties_decode(lzma_filter *filter, lzma_allocator *allocator, const uint8_t *props, size_t props_size) { + const lzma_filter_decoder *const fd = decoder_find(filter->id); + // Make it always NULL so that the caller can always safely free() it. filter->options = NULL; - const lzma_filter_decoder *const fd = decoder_find(filter->id); if (fd == NULL) return LZMA_OPTIONS_ERROR; diff --git a/Utilities/cmliblzma/liblzma/common/filter_encoder.c b/Utilities/cmliblzma/liblzma/common/filter_encoder.c index 635d812..9fdb100 100644 --- a/Utilities/cmliblzma/liblzma/common/filter_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_encoder.c @@ -56,95 +56,101 @@ typedef struct { static const lzma_filter_encoder encoders[] = { #ifdef HAVE_ENCODER_LZMA1 { - .id = LZMA_FILTER_LZMA1, - .init = &lzma_lzma_encoder_init, - .memusage = &lzma_lzma_encoder_memusage, - .chunk_size = NULL, // FIXME - .props_size_get = NULL, - .props_size_fixed = 5, - .props_encode = &lzma_lzma_props_encode, + LZMA_FILTER_LZMA1, + &lzma_lzma_encoder_init, + &lzma_lzma_encoder_memusage, + NULL, // FIXME + NULL, + 5, + &lzma_lzma_props_encode, }, #endif #ifdef HAVE_ENCODER_LZMA2 { - .id = LZMA_FILTER_LZMA2, - .init = &lzma_lzma2_encoder_init, - .memusage = &lzma_lzma2_encoder_memusage, - .chunk_size = NULL, // FIXME - .props_size_get = NULL, - .props_size_fixed = 1, - .props_encode = &lzma_lzma2_props_encode, + LZMA_FILTER_LZMA2, + &lzma_lzma2_encoder_init, + &lzma_lzma2_encoder_memusage, + NULL, // FIXME + NULL, + 1, + &lzma_lzma2_props_encode, }, #endif #ifdef HAVE_ENCODER_X86 { - .id = LZMA_FILTER_X86, - .init = &lzma_simple_x86_encoder_init, - .memusage = NULL, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + LZMA_FILTER_X86, + &lzma_simple_x86_encoder_init, + NULL, + NULL, + &lzma_simple_props_size, + 0, + &lzma_simple_props_encode, }, #endif #ifdef HAVE_ENCODER_POWERPC { - .id = LZMA_FILTER_POWERPC, - .init = &lzma_simple_powerpc_encoder_init, - .memusage = NULL, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + LZMA_FILTER_POWERPC, + &lzma_simple_powerpc_encoder_init, + NULL, + NULL, + &lzma_simple_props_size, + 0, + &lzma_simple_props_encode, }, #endif #ifdef HAVE_ENCODER_IA64 { - .id = LZMA_FILTER_IA64, - .init = &lzma_simple_ia64_encoder_init, - .memusage = NULL, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + LZMA_FILTER_IA64, + &lzma_simple_ia64_encoder_init, + NULL, + NULL, + &lzma_simple_props_size, + 0, + &lzma_simple_props_encode, }, #endif #ifdef HAVE_ENCODER_ARM { - .id = LZMA_FILTER_ARM, - .init = &lzma_simple_arm_encoder_init, - .memusage = NULL, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + LZMA_FILTER_ARM, + &lzma_simple_arm_encoder_init, + NULL, + NULL, + &lzma_simple_props_size, + 0, + &lzma_simple_props_encode, }, #endif #ifdef HAVE_ENCODER_ARMTHUMB { - .id = LZMA_FILTER_ARMTHUMB, - .init = &lzma_simple_armthumb_encoder_init, - .memusage = NULL, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + LZMA_FILTER_ARMTHUMB, + &lzma_simple_armthumb_encoder_init, + NULL, + NULL, + &lzma_simple_props_size, + 0, + &lzma_simple_props_encode, }, #endif #ifdef HAVE_ENCODER_SPARC { - .id = LZMA_FILTER_SPARC, - .init = &lzma_simple_sparc_encoder_init, - .memusage = NULL, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + LZMA_FILTER_SPARC, + &lzma_simple_sparc_encoder_init, + NULL, + NULL, + &lzma_simple_props_size, + 0, + &lzma_simple_props_encode, }, #endif #ifdef HAVE_ENCODER_DELTA { - .id = LZMA_FILTER_DELTA, - .init = &lzma_delta_encoder_init, - .memusage = &lzma_delta_coder_memusage, - .chunk_size = NULL, - .props_size_get = NULL, - .props_size_fixed = 1, - .props_encode = &lzma_delta_props_encode, + LZMA_FILTER_DELTA, + &lzma_delta_encoder_init, + &lzma_delta_coder_memusage, + NULL, + NULL, + 1, + &lzma_delta_props_encode, }, #endif }; @@ -153,7 +159,8 @@ static const lzma_filter_encoder encoders[] = { static const lzma_filter_encoder * encoder_find(lzma_vli id) { - for (size_t i = 0; i < ARRAY_SIZE(encoders); ++i) + size_t i; + for (i = 0; i < ARRAY_SIZE(encoders); ++i) if (encoders[i].id == id) return encoders + i; @@ -171,6 +178,10 @@ lzma_filter_encoder_is_supported(lzma_vli id) extern LZMA_API(lzma_ret) lzma_filters_update(lzma_stream *strm, const lzma_filter *filters) { + size_t i; + size_t count = 1; + lzma_filter reversed_filters[LZMA_FILTERS_MAX + 1]; + if (strm->internal->next.update == NULL) return LZMA_PROG_ERROR; @@ -180,12 +191,10 @@ lzma_filters_update(lzma_stream *strm, const lzma_filter *filters) // The actual filter chain in the encoder is reversed. Some things // still want the normal order chain, so we provide both. - size_t count = 1; while (filters[count].id != LZMA_VLI_UNKNOWN) ++count; - lzma_filter reversed_filters[LZMA_FILTERS_MAX + 1]; - for (size_t i = 0; i < count; ++i) + for (i = 0; i < count; ++i) reversed_filters[count - i - 1] = filters[i]; reversed_filters[count].id = LZMA_VLI_UNKNOWN; @@ -207,7 +216,7 @@ lzma_raw_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_raw_encoder(lzma_stream *strm, const lzma_filter *options) { - lzma_next_strm_init(lzma_raw_coder_init, strm, options, + lzma_next_strm_init3(lzma_raw_coder_init, strm, options, (lzma_filter_find)(&encoder_find), true); strm->internal->supported_actions[LZMA_RUN] = true; diff --git a/Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c b/Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c index caae10c..aa2dbd5 100644 --- a/Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c @@ -18,6 +18,9 @@ lzma_filter_flags_decode( lzma_filter *filter, lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size) { + lzma_vli props_size; + lzma_ret ret; + // Set the pointer to NULL so the caller can always safely free it. filter->options = NULL; @@ -29,7 +32,6 @@ lzma_filter_flags_decode( return LZMA_DATA_ERROR; // Size of Properties - lzma_vli props_size; return_if_error(lzma_vli_decode(&props_size, NULL, in, in_pos, in_size)); @@ -37,7 +39,7 @@ lzma_filter_flags_decode( if (in_size - *in_pos < props_size) return LZMA_DATA_ERROR; - const lzma_ret ret = lzma_properties_decode( + ret = lzma_properties_decode( filter, allocator, in + *in_pos, props_size); *in_pos += props_size; diff --git a/Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c b/Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c index d110566..755c407 100644 --- a/Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c @@ -31,6 +31,8 @@ extern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filter, uint8_t *out, size_t *out_pos, size_t out_size) { + uint32_t props_size; + // Filter ID if (filter->id >= LZMA_FILTER_RESERVED_START) return LZMA_PROG_ERROR; @@ -39,7 +41,6 @@ lzma_filter_flags_encode(const lzma_filter *filter, out, out_pos, out_size)); // Size of Properties - uint32_t props_size; return_if_error(lzma_properties_size(&props_size, filter)); return_if_error(lzma_vli_encode(props_size, NULL, out, out_pos, out_size)); diff --git a/Utilities/cmliblzma/liblzma/common/index.c b/Utilities/cmliblzma/liblzma/common/index.c index 9af4bc1..f0f67ca 100644 --- a/Utilities/cmliblzma/liblzma/common/index.c +++ b/Utilities/cmliblzma/liblzma/common/index.c @@ -230,6 +230,7 @@ index_tree_end(index_tree *tree, lzma_allocator *allocator, static void index_tree_append(index_tree *tree, index_tree_node *node) { + uint32_t up; node->parent = tree->rightmost; node->left = NULL; node->right = NULL; @@ -258,8 +259,10 @@ index_tree_append(index_tree *tree, index_tree_node *node) // and thus know the state of the tree just by looking at the node // count. From the node count we can calculate how many steps to go // up in the tree to find the rotation root. - uint32_t up = tree->count ^ (UINT32_C(1) << bsr32(tree->count)); + up = tree->count ^ (UINT32_C(1) << bsr32(tree->count)); if (up != 0) { + index_tree_node *pivot; + // Locate the root node for the rotation. up = ctz32(tree->count) + 2; do { @@ -267,7 +270,7 @@ index_tree_append(index_tree *tree, index_tree_node *node) } while (--up > 0); // Rotate left using node as the rotation root. - index_tree_node *pivot = node->right; + pivot = node->right; if (node->parent == NULL) { tree->root = pivot; @@ -397,11 +400,13 @@ index_init_plain(lzma_allocator *allocator) extern LZMA_API(lzma_index *) lzma_index_init(lzma_allocator *allocator) { + index_stream *s; + lzma_index *i = index_init_plain(allocator); if (i == NULL) return NULL; - index_stream *s = index_stream_init(0, 0, 1, 0, allocator); + s = index_stream_init(0, 0, 1, 0, allocator); if (s == NULL) { lzma_free(i, allocator); return NULL; @@ -600,6 +605,8 @@ lzma_index_padding_size(const lzma_index *i) extern LZMA_API(lzma_ret) lzma_index_stream_flags(lzma_index *i, const lzma_stream_flags *stream_flags) { + index_stream *s; + if (i == NULL || stream_flags == NULL) return LZMA_PROG_ERROR; @@ -607,7 +614,7 @@ lzma_index_stream_flags(lzma_index *i, const lzma_stream_flags *stream_flags) return_if_error(lzma_stream_flags_compare( stream_flags, stream_flags)); - index_stream *s = (index_stream *)(i->streams.rightmost); + s = (index_stream *)(i->streams.rightmost); s->stream_flags = *stream_flags; return LZMA_OK; @@ -617,14 +624,17 @@ lzma_index_stream_flags(lzma_index *i, const lzma_stream_flags *stream_flags) extern LZMA_API(lzma_ret) lzma_index_stream_padding(lzma_index *i, lzma_vli stream_padding) { + index_stream *s; + lzma_vli old_stream_padding; + if (i == NULL || stream_padding > LZMA_VLI_MAX || (stream_padding & 3) != 0) return LZMA_PROG_ERROR; - index_stream *s = (index_stream *)(i->streams.rightmost); + s = (index_stream *)(i->streams.rightmost); // Check that the new value won't make the file grow too big. - const lzma_vli old_stream_padding = s->stream_padding; + old_stream_padding = s->stream_padding; s->stream_padding = 0; if (lzma_index_file_size(i) + stream_padding > LZMA_VLI_MAX) { s->stream_padding = old_stream_padding; @@ -640,20 +650,26 @@ extern LZMA_API(lzma_ret) lzma_index_append(lzma_index *i, lzma_allocator *allocator, lzma_vli unpadded_size, lzma_vli uncompressed_size) { + index_stream *s; + index_group *g; + lzma_vli compressed_base; + lzma_vli uncompressed_base; + uint32_t index_list_size_add; + // Validate. if (i == NULL || unpadded_size < UNPADDED_SIZE_MIN || unpadded_size > UNPADDED_SIZE_MAX || uncompressed_size > LZMA_VLI_MAX) return LZMA_PROG_ERROR; - index_stream *s = (index_stream *)(i->streams.rightmost); - index_group *g = (index_group *)(s->groups.rightmost); + s = (index_stream *)(i->streams.rightmost); + g = (index_group *)(s->groups.rightmost); - const lzma_vli compressed_base = g == NULL ? 0 + compressed_base = g == NULL ? 0 : vli_ceil4(g->records[g->last].unpadded_sum); - const lzma_vli uncompressed_base = g == NULL ? 0 + uncompressed_base = g == NULL ? 0 : g->records[g->last].uncompressed_sum; - const uint32_t index_list_size_add = lzma_vli_size(unpadded_size) + index_list_size_add = lzma_vli_size(unpadded_size) + lzma_vli_size(uncompressed_size); // Check that the file size will stay within limits. @@ -767,6 +783,7 @@ extern LZMA_API(lzma_ret) lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src, lzma_allocator *allocator) { + index_cat_info info; const lzma_vli dest_file_size = lzma_index_file_size(dest); // Check that we don't exceed the file size limits. @@ -796,10 +813,12 @@ lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src, index_stream *s = (index_stream *)(dest->streams.rightmost); index_group *g = (index_group *)(s->groups.rightmost); if (g != NULL && g->last + 1 < g->allocated) { + index_group *newg; + assert(g->node.left == NULL); assert(g->node.right == NULL); - index_group *newg = lzma_alloc(sizeof(index_group) + newg = lzma_alloc(sizeof(index_group) + (g->last + 1) * sizeof(index_record), allocator); @@ -834,13 +853,12 @@ lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src, // Add all the Streams from src to dest. Update the base offsets // of each Stream from src. - const index_cat_info info = { - .uncompressed_size = dest->uncompressed_size, - .file_size = dest_file_size, - .stream_number_add = dest->streams.count, - .block_number_add = dest->record_count, - .streams = &dest->streams, - }; + info.uncompressed_size = dest->uncompressed_size; + info.file_size = dest_file_size; + info.stream_number_add = dest->streams.count; + info.block_number_add = dest->record_count; + info.streams = &dest->streams; + index_cat_helper(&info, (index_stream *)(src->streams.root)); // Update info about all the combined Streams. @@ -861,12 +879,17 @@ lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src, static index_stream * index_dup_stream(const index_stream *src, lzma_allocator *allocator) { + index_stream *dest; + index_group *destg; + index_group *srcg; + size_t i = 0; + // Catch a somewhat theoretical integer overflow. if (src->record_count > PREALLOC_MAX) return NULL; // Allocate and initialize a new Stream. - index_stream *dest = index_stream_init(src->node.compressed_base, + dest = index_stream_init(src->node.compressed_base, src->node.uncompressed_base, src->number, src->block_number_base, allocator); @@ -884,7 +907,7 @@ index_dup_stream(const index_stream *src, lzma_allocator *allocator) // Allocate memory for the Records. We put all the Records into // a single group. It's simplest and also tends to make // lzma_index_locate() a little bit faster with very big Indexes. - index_group *destg = lzma_alloc(sizeof(index_group) + destg = lzma_alloc(sizeof(index_group) + src->record_count * sizeof(index_record), allocator); if (destg == NULL) { @@ -900,8 +923,7 @@ index_dup_stream(const index_stream *src, lzma_allocator *allocator) destg->last = src->record_count - 1; // Go through all the groups in src and copy the Records into destg. - const index_group *srcg = (const index_group *)(src->groups.leftmost); - size_t i = 0; + srcg = (index_group *)(src->groups.leftmost); do { memcpy(destg->records + i, srcg->records, (srcg->last + 1) * sizeof(index_record)); @@ -921,6 +943,9 @@ index_dup_stream(const index_stream *src, lzma_allocator *allocator) extern LZMA_API(lzma_index *) lzma_index_dup(const lzma_index *src, lzma_allocator *allocator) { + index_stream *srcstream; + index_stream *deststream; + // Allocate the base structure (no initial Stream). lzma_index *dest = index_init_plain(allocator); if (dest == NULL) @@ -933,11 +958,9 @@ lzma_index_dup(const lzma_index *src, lzma_allocator *allocator) dest->index_list_size = src->index_list_size; // Copy the Streams and the groups in them. - const index_stream *srcstream - = (const index_stream *)(src->streams.leftmost); + srcstream = (index_stream *)(src->streams.leftmost); do { - index_stream *deststream = index_dup_stream( - srcstream, allocator); + deststream = index_dup_stream(srcstream, allocator); if (deststream == NULL) { lzma_index_end(dest, allocator); return NULL; @@ -1096,14 +1119,19 @@ lzma_index_iter_rewind(lzma_index_iter *iter) extern LZMA_API(lzma_bool) lzma_index_iter_next(lzma_index_iter *iter, lzma_index_iter_mode mode) { + const lzma_index *i; + const index_stream *stream; + const index_group *group; + size_t record; + // Catch unsupported mode values. if ((unsigned int)(mode) > LZMA_INDEX_ITER_NONEMPTY_BLOCK) return true; - const lzma_index *i = iter->internal[ITER_INDEX].p; - const index_stream *stream = iter->internal[ITER_STREAM].p; - const index_group *group = NULL; - size_t record = iter->internal[ITER_RECORD].s; + i = iter->internal[ITER_INDEX].p; + stream = iter->internal[ITER_STREAM].p; + group = NULL; + record = iter->internal[ITER_RECORD].s; // If we are being asked for the next Stream, leave group to NULL // so that the rest of the this function thinks that this Stream @@ -1203,6 +1231,10 @@ again: extern LZMA_API(lzma_bool) lzma_index_iter_locate(lzma_index_iter *iter, lzma_vli target) { + const index_stream *stream; + const index_group *group; + size_t left, right; + const lzma_index *i = iter->internal[ITER_INDEX].p; // If the target is past the end of the file, return immediately. @@ -1210,12 +1242,12 @@ lzma_index_iter_locate(lzma_index_iter *iter, lzma_vli target) return true; // Locate the Stream containing the target offset. - const index_stream *stream = index_tree_locate(&i->streams, target); + stream = index_tree_locate(&i->streams, target); assert(stream != NULL); target -= stream->node.uncompressed_base; // Locate the group containing the target offset. - const index_group *group = index_tree_locate(&stream->groups, target); + group = index_tree_locate(&stream->groups, target); assert(group != NULL); // Use binary search to locate the exact Record. It is the first @@ -1223,8 +1255,8 @@ lzma_index_iter_locate(lzma_index_iter *iter, lzma_vli target) // This is because we want the rightmost Record that fullfills the // search criterion. It is possible that there are empty Blocks; // we don't want to return them. - size_t left = 0; - size_t right = group->last; + left = 0; + right = group->last; while (left < right) { const size_t pos = left + (right - left) / 2; diff --git a/Utilities/cmliblzma/liblzma/common/index_decoder.c b/Utilities/cmliblzma/liblzma/common/index_decoder.c index 83c8a3a..6c91f10 100644 --- a/Utilities/cmliblzma/liblzma/common/index_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/index_decoder.c @@ -289,7 +289,7 @@ index_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit) { - lzma_next_strm_init(index_decoder_init, strm, i, memlimit); + lzma_next_strm_init2(index_decoder_init, strm, i, memlimit); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; @@ -303,21 +303,23 @@ lzma_index_buffer_decode( lzma_index **i, uint64_t *memlimit, lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size) { + lzma_coder coder; + lzma_ret ret; + + // Store the input start position so that we can restore it in case + // of an error. + const size_t in_start = *in_pos; + // Sanity checks if (i == NULL || memlimit == NULL || in == NULL || in_pos == NULL || *in_pos > in_size) return LZMA_PROG_ERROR; // Initialize the decoder. - lzma_coder coder; return_if_error(index_decoder_reset(&coder, allocator, i, *memlimit)); - // Store the input start position so that we can restore it in case - // of an error. - const size_t in_start = *in_pos; - // Do the actual decoding. - lzma_ret ret = index_decode(&coder, allocator, in, in_pos, in_size, + ret = index_decode(&coder, allocator, in, in_pos, in_size, NULL, NULL, 0, LZMA_RUN); if (ret == LZMA_STREAM_END) { diff --git a/Utilities/cmliblzma/liblzma/common/index_encoder.c b/Utilities/cmliblzma/liblzma/common/index_encoder.c index 45919f0..a6f8598 100644 --- a/Utilities/cmliblzma/liblzma/common/index_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/index_encoder.c @@ -207,7 +207,7 @@ lzma_index_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_index_encoder(lzma_stream *strm, const lzma_index *i) { - lzma_next_strm_init(lzma_index_encoder_init, strm, i); + lzma_next_strm_init1(lzma_index_encoder_init, strm, i); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; @@ -220,6 +220,10 @@ extern LZMA_API(lzma_ret) lzma_index_buffer_encode(const lzma_index *i, uint8_t *out, size_t *out_pos, size_t out_size) { + lzma_coder coder; + size_t out_start; + lzma_ret ret; + // Validate the arguments. if (i == NULL || out == NULL || out_pos == NULL || *out_pos > out_size) return LZMA_PROG_ERROR; @@ -230,13 +234,12 @@ lzma_index_buffer_encode(const lzma_index *i, // The Index encoder needs just one small data structure so we can // allocate it on stack. - lzma_coder coder; index_encoder_reset(&coder, i); // Do the actual encoding. This should never fail, but store // the original *out_pos just in case. - const size_t out_start = *out_pos; - lzma_ret ret = index_encode(&coder, NULL, NULL, NULL, 0, + out_start = *out_pos; + ret = index_encode(&coder, NULL, NULL, NULL, 0, out, out_pos, out_size, LZMA_RUN); if (ret == LZMA_STREAM_END) { diff --git a/Utilities/cmliblzma/liblzma/common/index_hash.c b/Utilities/cmliblzma/liblzma/common/index_hash.c index e3e9386..0cf86b3 100644 --- a/Utilities/cmliblzma/liblzma/common/index_hash.c +++ b/Utilities/cmliblzma/liblzma/common/index_hash.c @@ -124,13 +124,14 @@ static lzma_ret hash_append(lzma_index_hash_info *info, lzma_vli unpadded_size, lzma_vli uncompressed_size) { + const lzma_vli sizes[2] = { unpadded_size, uncompressed_size }; + info->blocks_size += vli_ceil4(unpadded_size); info->uncompressed_size += uncompressed_size; info->index_list_size += lzma_vli_size(unpadded_size) + lzma_vli_size(uncompressed_size); ++info->count; - const lzma_vli sizes[2] = { unpadded_size, uncompressed_size }; lzma_check_update(&info->check, LZMA_CHECK_BEST, (const uint8_t *)(sizes), sizeof(sizes)); @@ -173,6 +174,9 @@ extern LZMA_API(lzma_ret) lzma_index_hash_decode(lzma_index_hash *index_hash, const uint8_t *in, size_t *in_pos, size_t in_size) { + size_t in_start; + lzma_ret ret; + // Catch zero input buffer here, because in contrast to Index encoder // and decoder functions, applications call this function directly // instead of via lzma_code(), which does the buffer checking. @@ -182,8 +186,8 @@ lzma_index_hash_decode(lzma_index_hash *index_hash, const uint8_t *in, // NOTE: This function has many similarities to index_encode() and // index_decode() functions found from index_encoder.c and // index_decoder.c. See the comments especially in index_encoder.c. - const size_t in_start = *in_pos; - lzma_ret ret = LZMA_OK; + in_start = *in_pos; + ret = LZMA_OK; while (*in_pos < in_size) switch (index_hash->sequence) { diff --git a/Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c b/Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c index ae75315..9e2e1da 100644 --- a/Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c @@ -19,6 +19,9 @@ lzma_stream_buffer_decode(uint64_t *memlimit, uint32_t flags, const uint8_t *in, size_t *in_pos, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) { + lzma_next_coder stream_decoder = LZMA_NEXT_CODER_INIT; + lzma_ret ret; + // Sanity checks if (in_pos == NULL || (in == NULL && *in_pos != in_size) || *in_pos > in_size || out_pos == NULL @@ -33,8 +36,7 @@ lzma_stream_buffer_decode(uint64_t *memlimit, uint32_t flags, // Initialize the Stream decoder. // TODO: We need something to tell the decoder that it can use the // output buffer as workspace, and thus save significant amount of RAM. - lzma_next_coder stream_decoder = LZMA_NEXT_CODER_INIT; - lzma_ret ret = lzma_stream_decoder_init( + ret = lzma_stream_decoder_init( &stream_decoder, allocator, *memlimit, flags); if (ret == LZMA_OK) { diff --git a/Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c b/Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c index 2450ee2..8bca87f 100644 --- a/Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c @@ -45,6 +45,10 @@ lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check, lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos_ptr, size_t out_size) { + lzma_stream_flags stream_flags = { 0 }; + lzma_block block = { 0 }; + size_t out_pos; + // Sanity checks if (filters == NULL || (unsigned int)(check) > LZMA_CHECK_ID_MAX || (in == NULL && in_size != 0) || out == NULL @@ -61,7 +65,7 @@ lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check, // Use a local copy. We update *out_pos_ptr only if everything // succeeds. - size_t out_pos = *out_pos_ptr; + out_pos = *out_pos_ptr; // Check that there's enough space for both Stream Header and // Stream Footer. @@ -73,10 +77,7 @@ lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check, out_size -= LZMA_STREAM_HEADER_SIZE; // Encode the Stream Header. - lzma_stream_flags stream_flags = { - .version = 0, - .check = check, - }; + stream_flags.check = check; if (lzma_stream_header_encode(&stream_flags, out + out_pos) != LZMA_OK) @@ -85,11 +86,8 @@ lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check, out_pos += LZMA_STREAM_HEADER_SIZE; // Encode a Block but only if there is at least one byte of input. - lzma_block block = { - .version = 0, - .check = check, - .filters = filters, - }; + block.check = check; + block.filters = filters; if (in_size > 0) return_if_error(lzma_block_buffer_encode(&block, allocator, @@ -97,6 +95,8 @@ lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check, // Index { + lzma_ret ret; + // Create an Index. It will have one Record if there was // at least one byte of input to encode. Otherwise the // Index will be empty. @@ -104,7 +104,7 @@ lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check, if (i == NULL) return LZMA_MEM_ERROR; - lzma_ret ret = LZMA_OK; + ret = LZMA_OK; if (in_size > 0) ret = lzma_index_append(i, allocator, diff --git a/Utilities/cmliblzma/liblzma/common/stream_decoder.c b/Utilities/cmliblzma/liblzma/common/stream_decoder.c index 37ea71e..56a009b 100644 --- a/Utilities/cmliblzma/liblzma/common/stream_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_decoder.c @@ -106,6 +106,8 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, while (true) switch (coder->sequence) { case SEQ_STREAM_HEADER: { + lzma_ret ret; + // Copy the Stream Header to the internal buffer. lzma_bufcpy(in, in_pos, in_size, coder->buffer, &coder->pos, LZMA_STREAM_HEADER_SIZE); @@ -117,7 +119,7 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, coder->pos = 0; // Decode the Stream Header. - const lzma_ret ret = lzma_stream_header_decode( + ret = lzma_stream_header_decode( &coder->stream_flags, coder->buffer); if (ret != LZMA_OK) return ret == LZMA_FORMAT_ERROR && !coder->first_stream @@ -154,6 +156,11 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, // Fall through case SEQ_BLOCK_HEADER: { + lzma_filter filters[LZMA_FILTERS_MAX + 1]; + uint64_t memusage; + lzma_ret ret; + size_t i; + if (*in_pos >= in_size) return LZMA_OK; @@ -188,7 +195,6 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, // Set up a buffer to hold the filter chain. Block Header // decoder will initialize all members of this array so // we don't need to do it here. - lzma_filter filters[LZMA_FILTERS_MAX + 1]; coder->block_options.filters = filters; // Decode the Block Header. @@ -196,9 +202,7 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, allocator, coder->buffer)); // Check the memory usage limit. - const uint64_t memusage = lzma_raw_decoder_memusage(filters); - lzma_ret ret; - + memusage = lzma_raw_decoder_memusage(filters); if (memusage == UINT64_MAX) { // One or more unknown Filter IDs. ret = LZMA_OPTIONS_ERROR; @@ -224,7 +228,7 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, // Free the allocated filter options since they are needed // only to initialize the Block decoder. - for (size_t i = 0; i < LZMA_FILTERS_MAX; ++i) + for (i = 0; i < LZMA_FILTERS_MAX; ++i) lzma_free(filters[i].options, allocator); coder->block_options.filters = NULL; @@ -260,6 +264,8 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, } case SEQ_INDEX: { + lzma_ret ret; + // If we don't have any input, don't call // lzma_index_hash_decode() since it would return // LZMA_BUF_ERROR, which we must not do here. @@ -268,7 +274,7 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, // Decode the Index and compare it to the hash calculated // from the sizes of the Blocks (if any). - const lzma_ret ret = lzma_index_hash_decode(coder->index_hash, + ret = lzma_index_hash_decode(coder->index_hash, in, in_pos, in_size); if (ret != LZMA_STREAM_END) return ret; @@ -279,6 +285,9 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, // Fall through case SEQ_STREAM_FOOTER: { + lzma_stream_flags footer_flags; + lzma_ret ret; + // Copy the Stream Footer to the internal buffer. lzma_bufcpy(in, in_pos, in_size, coder->buffer, &coder->pos, LZMA_STREAM_HEADER_SIZE); @@ -292,8 +301,7 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator, // Decode the Stream Footer. The decoder gives // LZMA_FORMAT_ERROR if the magic bytes don't match, // so convert that return code to LZMA_DATA_ERROR. - lzma_stream_flags footer_flags; - const lzma_ret ret = lzma_stream_footer_decode( + ret = lzma_stream_footer_decode( &footer_flags, coder->buffer); if (ret != LZMA_OK) return ret == LZMA_FORMAT_ERROR @@ -442,7 +450,7 @@ lzma_stream_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern LZMA_API(lzma_ret) lzma_stream_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags) { - lzma_next_strm_init(lzma_stream_decoder_init, strm, memlimit, flags); + lzma_next_strm_init2(lzma_stream_decoder_init, strm, memlimit, flags); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; diff --git a/Utilities/cmliblzma/liblzma/common/stream_encoder.c b/Utilities/cmliblzma/liblzma/common/stream_encoder.c index 97a7a23..e2f2e10 100644 --- a/Utilities/cmliblzma/liblzma/common/stream_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_encoder.c @@ -147,6 +147,8 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator, } case SEQ_BLOCK_ENCODE: { + lzma_vli unpadded_size; + static const lzma_action convert[4] = { LZMA_RUN, LZMA_SYNC_FLUSH, @@ -162,7 +164,7 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator, return ret; // Add a new Index Record. - const lzma_vli unpadded_size = lzma_block_unpadded_size( + unpadded_size = lzma_block_unpadded_size( &coder->block_options); assert(unpadded_size != 0); return_if_error(lzma_index_append(coder->index, allocator, @@ -174,6 +176,12 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator, } case SEQ_INDEX_ENCODE: { + const lzma_stream_flags stream_flags = { + 0, + lzma_index_size(coder->index), + coder->block_options.check, + }; + // Call the Index encoder. It doesn't take any input, so // those pointers can be NULL. const lzma_ret ret = coder->index_encoder.code( @@ -184,11 +192,6 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator, return ret; // Encode the Stream Footer into coder->buffer. - const lzma_stream_flags stream_flags = { - .version = 0, - .backward_size = lzma_index_size(coder->index), - .check = coder->block_options.check, - }; if (lzma_stream_footer_encode(&stream_flags, coder->buffer) != LZMA_OK) @@ -211,11 +214,13 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator, static void stream_encoder_end(lzma_coder *coder, lzma_allocator *allocator) { + size_t i; + lzma_next_end(&coder->block_encoder, allocator); lzma_next_end(&coder->index_encoder, allocator); lzma_index_end(coder->index, allocator); - for (size_t i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i) + for (i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i) lzma_free(coder->filters[i].options, allocator); lzma_free(coder, allocator); @@ -228,14 +233,18 @@ stream_encoder_update(lzma_coder *coder, lzma_allocator *allocator, const lzma_filter *filters, const lzma_filter *reversed_filters) { + size_t i; + if (coder->sequence <= SEQ_BLOCK_INIT) { + lzma_ret ret; + // There is no incomplete Block waiting to be finished, // thus we can change the whole filter chain. Start by // trying to initialize the Block encoder with the new // chain. This way we detect if the chain is valid. coder->block_encoder_is_initialized = false; coder->block_options.filters = (lzma_filter *)(filters); - const lzma_ret ret = block_encoder_init(coder, allocator); + ret = block_encoder_init(coder, allocator); coder->block_options.filters = coder->filters; if (ret != LZMA_OK) return ret; @@ -255,7 +264,7 @@ stream_encoder_update(lzma_coder *coder, lzma_allocator *allocator, } // Free the copy of the old chain and make a copy of the new chain. - for (size_t i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i) + for (i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i) lzma_free(coder->filters[i].options, allocator); return lzma_filters_copy(filters, coder->filters, allocator); @@ -266,6 +275,8 @@ extern lzma_ret lzma_stream_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, const lzma_filter *filters, lzma_check check) { + lzma_stream_flags stream_flags = { 0, 0, check }; + lzma_next_coder_init(&lzma_stream_encoder_init, next, allocator); if (filters == NULL) @@ -298,10 +309,6 @@ lzma_stream_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, return LZMA_MEM_ERROR; // Encode the Stream Header - lzma_stream_flags stream_flags = { - .version = 0, - .check = check, - }; return_if_error(lzma_stream_header_encode( &stream_flags, next->coder->buffer)); @@ -320,7 +327,7 @@ extern LZMA_API(lzma_ret) lzma_stream_encoder(lzma_stream *strm, const lzma_filter *filters, lzma_check check) { - lzma_next_strm_init(lzma_stream_encoder_init, strm, filters, check); + lzma_next_strm_init2(lzma_stream_encoder_init, strm, filters, check); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true; diff --git a/Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c b/Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c index 1bc2f97..8cf48a4 100644 --- a/Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c @@ -30,13 +30,15 @@ stream_flags_decode(lzma_stream_flags *options, const uint8_t *in) extern LZMA_API(lzma_ret) lzma_stream_header_decode(lzma_stream_flags *options, const uint8_t *in) { + uint32_t crc; + // Magic if (memcmp(in, lzma_header_magic, sizeof(lzma_header_magic)) != 0) return LZMA_FORMAT_ERROR; // Verify the CRC32 so we can distinguish between corrupt // and unsupported files. - const uint32_t crc = lzma_crc32(in + sizeof(lzma_header_magic), + crc = lzma_crc32(in + sizeof(lzma_header_magic), LZMA_STREAM_FLAGS_SIZE, 0); if (crc != unaligned_read32le(in + sizeof(lzma_header_magic) + LZMA_STREAM_FLAGS_SIZE)) @@ -59,13 +61,15 @@ lzma_stream_header_decode(lzma_stream_flags *options, const uint8_t *in) extern LZMA_API(lzma_ret) lzma_stream_footer_decode(lzma_stream_flags *options, const uint8_t *in) { + uint32_t crc; + // Magic if (memcmp(in + sizeof(uint32_t) * 2 + LZMA_STREAM_FLAGS_SIZE, lzma_footer_magic, sizeof(lzma_footer_magic)) != 0) return LZMA_FORMAT_ERROR; // CRC32 - const uint32_t crc = lzma_crc32(in + sizeof(uint32_t), + crc = lzma_crc32(in + sizeof(uint32_t), sizeof(uint32_t) + LZMA_STREAM_FLAGS_SIZE, 0); if (crc != unaligned_read32le(in)) return LZMA_DATA_ERROR; diff --git a/Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c b/Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c index 4e71715..290339e 100644 --- a/Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c @@ -29,6 +29,8 @@ stream_flags_encode(const lzma_stream_flags *options, uint8_t *out) extern LZMA_API(lzma_ret) lzma_stream_header_encode(const lzma_stream_flags *options, uint8_t *out) { + uint32_t crc; + assert(sizeof(lzma_header_magic) + LZMA_STREAM_FLAGS_SIZE + 4 == LZMA_STREAM_HEADER_SIZE); @@ -43,7 +45,7 @@ lzma_stream_header_encode(const lzma_stream_flags *options, uint8_t *out) return LZMA_PROG_ERROR; // CRC32 of the Stream Header - const uint32_t crc = lzma_crc32(out + sizeof(lzma_header_magic), + crc = lzma_crc32(out + sizeof(lzma_header_magic), LZMA_STREAM_FLAGS_SIZE, 0); unaligned_write32le(out + sizeof(lzma_header_magic) @@ -56,6 +58,8 @@ lzma_stream_header_encode(const lzma_stream_flags *options, uint8_t *out) extern LZMA_API(lzma_ret) lzma_stream_footer_encode(const lzma_stream_flags *options, uint8_t *out) { + uint32_t crc; + assert(2 * 4 + LZMA_STREAM_FLAGS_SIZE + sizeof(lzma_footer_magic) == LZMA_STREAM_HEADER_SIZE); @@ -73,7 +77,7 @@ lzma_stream_footer_encode(const lzma_stream_flags *options, uint8_t *out) return LZMA_PROG_ERROR; // CRC32 - const uint32_t crc = lzma_crc32( + crc = lzma_crc32( out + 4, 4 + LZMA_STREAM_FLAGS_SIZE, 0); unaligned_write32le(out, crc); diff --git a/Utilities/cmliblzma/liblzma/common/vli_size.c b/Utilities/cmliblzma/liblzma/common/vli_size.c index ec1b4fa..8b931e4 100644 --- a/Utilities/cmliblzma/liblzma/common/vli_size.c +++ b/Utilities/cmliblzma/liblzma/common/vli_size.c @@ -16,10 +16,11 @@ extern LZMA_API(uint32_t) lzma_vli_size(lzma_vli vli) { + uint32_t i = 0; + if (vli > LZMA_VLI_MAX) return 0; - uint32_t i = 0; do { vli >>= 7; ++i; diff --git a/Utilities/cmliblzma/liblzma/delta/delta_common.c b/Utilities/cmliblzma/liblzma/delta/delta_common.c index 930ad21..803e674 100644 --- a/Utilities/cmliblzma/liblzma/delta/delta_common.c +++ b/Utilities/cmliblzma/liblzma/delta/delta_common.c @@ -27,6 +27,8 @@ extern lzma_ret lzma_delta_coder_init(lzma_next_coder *next, lzma_allocator *allocator, const lzma_filter_info *filters) { + const lzma_options_delta *opt; + // Allocate memory for the decoder if needed. if (next->coder == NULL) { next->coder = lzma_alloc(sizeof(lzma_coder), allocator); @@ -43,7 +45,7 @@ lzma_delta_coder_init(lzma_next_coder *next, lzma_allocator *allocator, return LZMA_OPTIONS_ERROR; // Set the delta distance. - const lzma_options_delta *opt = filters[0].options; + opt = filters[0].options; next->coder->distance = opt->dist; // Initialize the rest of the variables. diff --git a/Utilities/cmliblzma/liblzma/delta/delta_decoder.c b/Utilities/cmliblzma/liblzma/delta/delta_decoder.c index 2cf60d5..582e58e 100644 --- a/Utilities/cmliblzma/liblzma/delta/delta_decoder.c +++ b/Utilities/cmliblzma/liblzma/delta/delta_decoder.c @@ -17,9 +17,10 @@ static void decode_buffer(lzma_coder *coder, uint8_t *buffer, size_t size) { + size_t i; const size_t distance = coder->distance; - for (size_t i = 0; i < size; ++i) { + for (i = 0; i < size; ++i) { buffer[i] += coder->history[(distance + coder->pos) & 0xFF]; coder->history[coder->pos-- & 0xFF] = buffer[i]; } @@ -32,11 +33,12 @@ delta_decode(lzma_coder *coder, lzma_allocator *allocator, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_action action) { - assert(coder->next.code != NULL); - const size_t out_start = *out_pos; + lzma_ret ret; - const lzma_ret ret = coder->next.code(coder->next.coder, allocator, + assert(coder->next.code != NULL); + + ret = coder->next.code(coder->next.coder, allocator, in, in_pos, in_size, out, out_pos, out_size, action); @@ -59,11 +61,12 @@ extern lzma_ret lzma_delta_props_decode(void **options, lzma_allocator *allocator, const uint8_t *props, size_t props_size) { + lzma_options_delta *opt; + if (props_size != 1) return LZMA_OPTIONS_ERROR; - lzma_options_delta *opt - = lzma_alloc(sizeof(lzma_options_delta), allocator); + opt = lzma_alloc(sizeof(lzma_options_delta), allocator); if (opt == NULL) return LZMA_MEM_ERROR; diff --git a/Utilities/cmliblzma/liblzma/delta/delta_encoder.c b/Utilities/cmliblzma/liblzma/delta/delta_encoder.c index 15c7951..8b9e4a8 100644 --- a/Utilities/cmliblzma/liblzma/delta/delta_encoder.c +++ b/Utilities/cmliblzma/liblzma/delta/delta_encoder.c @@ -21,9 +21,10 @@ static void copy_and_encode(lzma_coder *coder, const uint8_t *restrict in, uint8_t *restrict out, size_t size) { + size_t i; const size_t distance = coder->distance; - for (size_t i = 0; i < size; ++i) { + for (i = 0; i < size; ++i) { const uint8_t tmp = coder->history[ (distance + coder->pos) & 0xFF]; coder->history[coder->pos-- & 0xFF] = in[i]; @@ -37,9 +38,10 @@ copy_and_encode(lzma_coder *coder, static void encode_in_place(lzma_coder *coder, uint8_t *buffer, size_t size) { + size_t i; const size_t distance = coder->distance; - for (size_t i = 0; i < size; ++i) { + for (i = 0; i < size; ++i) { const uint8_t tmp = coder->history[ (distance + coder->pos) & 0xFF]; coder->history[coder->pos-- & 0xFF] = buffer[i]; @@ -109,12 +111,13 @@ lzma_delta_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern lzma_ret lzma_delta_props_encode(const void *options, uint8_t *out) { + const lzma_options_delta *opt = options; + // The caller must have already validated the options, so it's // LZMA_PROG_ERROR if they are invalid. if (lzma_delta_coder_memusage(options) == UINT64_MAX) return LZMA_PROG_ERROR; - const lzma_options_delta *opt = options; out[0] = opt->dist - LZMA_DELTA_DIST_MIN; return LZMA_OK; diff --git a/Utilities/cmliblzma/liblzma/lz/lz_decoder.c b/Utilities/cmliblzma/liblzma/lz/lz_decoder.c index d74085c..f45984e 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_decoder.c +++ b/Utilities/cmliblzma/liblzma/lz/lz_decoder.c @@ -69,13 +69,17 @@ decode_buffer(lzma_coder *coder, size_t *restrict out_pos, size_t out_size) { while (true) { + size_t copy_size; + size_t dict_start; + lzma_ret ret; + // Wrap the dictionary if needed. if (coder->dict.pos == coder->dict.size) coder->dict.pos = 0; // Store the current dictionary position. It is needed to know // where to start copying to the out[] buffer. - const size_t dict_start = coder->dict.pos; + dict_start = coder->dict.pos; // Calculate how much we allow coder->lz.code() to decode. // It must not decode past the end of the dictionary @@ -86,13 +90,13 @@ decode_buffer(lzma_coder *coder, coder->dict.size - coder->dict.pos); // Call the coder->lz.code() to do the actual decoding. - const lzma_ret ret = coder->lz.code( + ret = coder->lz.code( coder->lz.coder, &coder->dict, in, in_pos, in_size); // Copy the decoded data from the dictionary to the out[] // buffer. - const size_t copy_size = coder->dict.pos - dict_start; + copy_size = coder->dict.pos - dict_start; assert(copy_size <= out_size - *out_pos); memcpy(out + *out_pos, coder->dict.buf + dict_start, copy_size); @@ -139,13 +143,15 @@ lz_decode(lzma_coder *coder, // We aren't the last coder in the chain, we need to decode // our input to a temporary buffer. while (*out_pos < out_size) { + lzma_ret ret; + // Fill the temporary buffer if it is empty. if (!coder->next_finished && coder->temp.pos == coder->temp.size) { coder->temp.pos = 0; coder->temp.size = 0; - const lzma_ret ret = coder->next.code( + ret = coder->next.code( coder->next.coder, allocator, in, in_pos, in_size, coder->temp.buffer, &coder->temp.size, @@ -167,7 +173,7 @@ lz_decode(lzma_coder *coder, return LZMA_OK; } - const lzma_ret ret = decode_buffer(coder, coder->temp.buffer, + ret = decode_buffer(coder, coder->temp.buffer, &coder->temp.pos, coder->temp.size, out, out_pos, out_size); @@ -206,6 +212,8 @@ lzma_lz_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, lzma_allocator *allocator, const void *options, lzma_lz_options *lz_options)) { + lzma_lz_options lz_options; + // Allocate the base structure if it isn't already allocated. if (next->coder == NULL) { next->coder = lzma_alloc(sizeof(lzma_coder), allocator); @@ -223,7 +231,6 @@ lzma_lz_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, // Allocate and initialize the LZ-based decoder. It will also give // us the dictionary size. - lzma_lz_options lz_options; return_if_error(lz_init(&next->coder->lz, allocator, filters[0].options, &lz_options)); diff --git a/Utilities/cmliblzma/liblzma/lz/lz_decoder.h b/Utilities/cmliblzma/liblzma/lz/lz_decoder.h index 7266e80..2d19cac 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_decoder.h +++ b/Utilities/cmliblzma/liblzma/lz/lz_decoder.h @@ -72,14 +72,14 @@ typedef struct { } lzma_lz_decoder; -#define LZMA_LZ_DECODER_INIT \ - (lzma_lz_decoder){ \ - .coder = NULL, \ - .code = NULL, \ - .reset = NULL, \ - .set_uncompressed = NULL, \ - .end = NULL, \ - } +static const lzma_lz_decoder LZMA_LZ_DECODER_INIT = + { + NULL, + NULL, + NULL, + NULL, + NULL, + }; extern lzma_ret lzma_lz_decoder_init(lzma_next_coder *next, @@ -151,13 +151,15 @@ dict_repeat(lzma_dict *dict, uint32_t distance, uint32_t *len) dict->pos += left; } else { + uint32_t copy_pos; + uint32_t copy_size; + // The bigger the dictionary, the more rare this // case occurs. We need to "wrap" the dict, thus // we might need two memcpy() to copy all the data. assert(dict->full == dict->size); - const uint32_t copy_pos - = dict->pos - distance - 1 + dict->size; - uint32_t copy_size = dict->size - copy_pos; + copy_pos = dict->pos - distance - 1 + dict->size; + copy_size = dict->size - copy_pos; if (copy_size < left) { memmove(dict->buf + dict->pos, dict->buf + copy_pos, diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder.c b/Utilities/cmliblzma/liblzma/lz/lz_encoder.c index e240696..a735c21 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_encoder.c +++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder.c @@ -43,16 +43,18 @@ struct lzma_coder_s { static void move_window(lzma_mf *mf) { + uint32_t move_offset; + size_t move_size; + // Align the move to a multiple of 16 bytes. Some LZ-based encoders // like LZMA use the lowest bits of mf->read_pos to know the // alignment of the uncompressed data. We also get better speed // for memmove() with aligned buffers. assert(mf->read_pos > mf->keep_size_before); - const uint32_t move_offset - = (mf->read_pos - mf->keep_size_before) & ~UINT32_C(15); + move_offset = (mf->read_pos - mf->keep_size_before) & ~UINT32_C(15); assert(mf->write_pos > move_offset); - const size_t move_size = mf->write_pos - move_offset; + move_size = mf->write_pos - move_offset; assert(move_offset + move_size <= mf->size); @@ -79,6 +81,9 @@ static lzma_ret fill_window(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, lzma_action action) { + size_t write_pos; + lzma_ret ret; + assert(coder->mf.read_pos <= coder->mf.write_pos); // Move the sliding window if needed. @@ -88,8 +93,7 @@ fill_window(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in, // Maybe this is ugly, but lzma_mf uses uint32_t for most things // (which I find cleanest), but we need size_t here when filling // the history window. - size_t write_pos = coder->mf.write_pos; - lzma_ret ret; + write_pos = coder->mf.write_pos; if (coder->next.code == NULL) { // Not using a filter, simply memcpy() as much as possible. lzma_bufcpy(in, in_pos, in_size, coder->mf.buffer, @@ -156,6 +160,8 @@ lz_encode(lzma_coder *coder, lzma_allocator *allocator, { while (*out_pos < out_size && (*in_pos < in_size || action != LZMA_RUN)) { + lzma_ret ret; + // Read more data to coder->mf.buffer if needed. if (coder->mf.action == LZMA_RUN && coder->mf.read_pos >= coder->mf.read_limit) @@ -163,7 +169,7 @@ lz_encode(lzma_coder *coder, lzma_allocator *allocator, in, in_pos, in_size, action)); // Encode - const lzma_ret ret = coder->lz.code(coder->lz.coder, + ret = coder->lz.code(coder->lz.coder, &coder->mf, out, out_pos, out_size); if (ret != LZMA_OK) { // Setting this to LZMA_RUN for cases when we are @@ -182,6 +188,14 @@ static bool lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator, const lzma_lz_options *lz_options) { + bool is_bt; + uint32_t new_count; + uint32_t reserve; + uint32_t old_size; + uint32_t hash_bytes; + uint32_t hs; + uint32_t old_count; + // For now, the dictionary size is limited to 1.5 GiB. This may grow // in the future if needed, but it needs a little more work than just // changing this check. @@ -207,14 +221,14 @@ lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator, // to size_t. // - Memory usage calculation needs something too, e.g. use uint64_t // for mf->size. - uint32_t reserve = lz_options->dict_size / 2; + reserve = lz_options->dict_size / 2; if (reserve > (UINT32_C(1) << 30)) reserve /= 2; reserve += (lz_options->before_size + lz_options->match_len_max + lz_options->after_size) / 2 + (UINT32_C(1) << 19); - const uint32_t old_size = mf->size; + old_size = mf->size; mf->size = mf->keep_size_before + reserve + mf->keep_size_after; // Deallocate the old history buffer if it exists but has different @@ -284,12 +298,11 @@ lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator, // Calculate the sizes of mf->hash and mf->son and check that // nice_len is big enough for the selected match finder. - const uint32_t hash_bytes = lz_options->match_finder & 0x0F; + hash_bytes = lz_options->match_finder & 0x0F; if (hash_bytes > mf->nice_len) return true; - const bool is_bt = (lz_options->match_finder & 0x10) != 0; - uint32_t hs; + is_bt = (lz_options->match_finder & 0x10) != 0; if (hash_bytes == 2) { hs = 0xFFFF; @@ -331,13 +344,13 @@ lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator, // hash_size_sum + sons_count cannot overflow. assert(hs < UINT32_MAX / 5); - const uint32_t old_count = mf->hash_size_sum + mf->sons_count; + old_count = mf->hash_size_sum + mf->sons_count; mf->hash_size_sum = hs; mf->sons_count = mf->cyclic_size; if (is_bt) mf->sons_count *= 2; - const uint32_t new_count = mf->hash_size_sum + mf->sons_count; + new_count = mf->hash_size_sum + mf->sons_count; // Deallocate the old hash array if it exists and has different size // than what is needed now. @@ -363,6 +376,8 @@ static bool lz_encoder_init(lzma_mf *mf, lzma_allocator *allocator, const lzma_lz_options *lz_options) { + size_t alloc_count; + // Allocate the history buffer. if (mf->buffer == NULL) { mf->buffer = lzma_alloc(mf->size, allocator); @@ -382,7 +397,7 @@ lz_encoder_init(lzma_mf *mf, lzma_allocator *allocator, mf->pending = 0; // Allocate match finder's hash array. - const size_t alloc_count = mf->hash_size_sum + mf->sons_count; + alloc_count = mf->hash_size_sum + mf->sons_count; #if UINT32_MAX >= SIZE_MAX / 4 // Check for integer overflow. (Huge dictionaries are not @@ -442,12 +457,7 @@ extern uint64_t lzma_lz_encoder_memusage(const lzma_lz_options *lz_options) { // Old buffers must not exist when calling lz_encoder_prepare(). - lzma_mf mf = { - .buffer = NULL, - .hash = NULL, - .hash_size_sum = 0, - .sons_count = 0, - }; + lzma_mf mf = { NULL }; // Setup the size information into mf. if (lz_encoder_prepare(&mf, NULL, lz_options)) @@ -501,6 +511,8 @@ lzma_lz_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, lzma_allocator *allocator, const void *options, lzma_lz_options *lz_options)) { + lzma_lz_options lz_options; + #ifdef HAVE_SMALL // We need that the CRC32 table has been initialized. lzma_crc32_init(); @@ -529,7 +541,6 @@ lzma_lz_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, } // Initialize the LZ-based encoder. - lzma_lz_options lz_options; return_if_error(lz_init(&next->coder->lz, allocator, filters[0].options, &lz_options)); diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder.h b/Utilities/cmliblzma/liblzma/lz/lz_encoder.h index 741c453..647f5e2 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_encoder.h +++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder.h @@ -218,7 +218,7 @@ typedef struct { /// Get pointer to the first byte not ran through the match finder -static inline const uint8_t * +static inline uint8_t * mf_ptr(const lzma_mf *mf) { return mf->buffer + mf->read_pos; diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h b/Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h index 342a333..de17c54 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h +++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h @@ -39,25 +39,22 @@ // Endianness doesn't matter in hash_2_calc() (no effect on the output). #ifdef TUKLIB_FAST_UNALIGNED_ACCESS # define hash_2_calc() \ - const uint32_t hash_value = *(const uint16_t *)(cur) + hash_value = *(const uint16_t *)(cur) #else # define hash_2_calc() \ - const uint32_t hash_value \ - = (uint32_t)(cur[0]) | ((uint32_t)(cur[1]) << 8) + hash_value = (uint32_t)(cur[0]) | ((uint32_t)(cur[1]) << 8) #endif #define hash_3_calc() \ - const uint32_t temp = hash_table[cur[0]] ^ cur[1]; \ - const uint32_t hash_2_value = temp & HASH_2_MASK; \ - const uint32_t hash_value \ - = (temp ^ ((uint32_t)(cur[2]) << 8)) & mf->hash_mask + temp = hash_table[cur[0]] ^ cur[1]; \ + hash_2_value = temp & HASH_2_MASK; \ + hash_value = (temp ^ ((uint32_t)(cur[2]) << 8)) & mf->hash_mask #define hash_4_calc() \ - const uint32_t temp = hash_table[cur[0]] ^ cur[1]; \ - const uint32_t hash_2_value = temp & HASH_2_MASK; \ - const uint32_t hash_3_value \ - = (temp ^ ((uint32_t)(cur[2]) << 8)) & HASH_3_MASK; \ - const uint32_t hash_value = (temp ^ ((uint32_t)(cur[2]) << 8) \ + temp = hash_table[cur[0]] ^ cur[1]; \ + hash_2_value = temp & HASH_2_MASK; \ + hash_3_value = (temp ^ ((uint32_t)(cur[2]) << 8)) & HASH_3_MASK; \ + hash_value = (temp ^ ((uint32_t)(cur[2]) << 8) \ ^ (hash_table[cur[3]] << 5)) & mf->hash_mask diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c b/Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c index f82a1c1..50c3459 100644 --- a/Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c +++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c @@ -32,8 +32,9 @@ lzma_mf_find(lzma_mf *mf, uint32_t *count_ptr, lzma_match *matches) if (count > 0) { #ifndef NDEBUG + uint32_t i; // Validate the matches. - for (uint32_t i = 0; i < count; ++i) { + for (i = 0; i < count; ++i) { assert(matches[i].len <= mf->nice_len); assert(matches[i].dist < mf->read_pos); assert(memcmp(mf_ptr(mf) - 1, @@ -49,6 +50,9 @@ lzma_mf_find(lzma_mf *mf, uint32_t *count_ptr, lzma_match *matches) // If a match of maximum search length was found, try to // extend the match to maximum possible length. if (len_best == mf->nice_len) { + uint8_t *p1; + uint8_t *p2; + // The limit for the match length is either the // maximum match length supported by the LZ-based // encoder or the number of bytes left in the @@ -59,11 +63,11 @@ lzma_mf_find(lzma_mf *mf, uint32_t *count_ptr, lzma_match *matches) // Pointer to the byte we just ran through // the match finder. - const uint8_t *p1 = mf_ptr(mf) - 1; + p1 = mf_ptr(mf) - 1; // Pointer to the beginning of the match. We need -1 // here because the match distances are zero based. - const uint8_t *p2 = p1 - matches[count - 1].dist - 1; + p2 = p1 - matches[count - 1].dist - 1; while (len_best < limit && p1[len_best] == p2[len_best]) @@ -108,18 +112,22 @@ lzma_mf_find(lzma_mf *mf, uint32_t *count_ptr, lzma_match *matches) static void normalize(lzma_mf *mf) { + uint32_t i; + uint32_t subvalue; + uint32_t count; + uint32_t *hash; + assert(mf->read_pos + mf->offset == MUST_NORMALIZE_POS); // In future we may not want to touch the lowest bits, because there // may be match finders that use larger resolution than one byte. - const uint32_t subvalue - = (MUST_NORMALIZE_POS - mf->cyclic_size); + subvalue = (MUST_NORMALIZE_POS - mf->cyclic_size); // & (~(UINT32_C(1) << 10) - 1); - const uint32_t count = mf->hash_size_sum + mf->sons_count; - uint32_t *hash = mf->hash; + count = mf->hash_size_sum + mf->sons_count; + hash = mf->hash; - for (uint32_t i = 0; i < count; ++i) { + for (i = 0; i < count; ++i) { // If the distance is greater than the dictionary size, // we can simply mark the hash element as empty. // @@ -196,15 +204,14 @@ move_pending(lzma_mf *mf) move_pending(mf); \ ret_op; \ } \ - const uint8_t *cur = mf_ptr(mf); \ - const uint32_t pos = mf->read_pos + mf->offset + cur = mf_ptr(mf); \ + pos = mf->read_pos + mf->offset /// Header for find functions. "return 0" indicates that zero matches /// were found. #define header_find(is_bt, len_min) \ - header(is_bt, len_min, return 0); \ - uint32_t matches_count = 0 + header(is_bt, len_min, return 0) /// Header for a loop in a skip function. "continue" tells to skip the rest @@ -261,10 +268,11 @@ hc_find_func( while (true) { const uint32_t delta = pos - cur_match; + const uint8_t *pb; if (depth-- == 0 || delta >= cyclic_size) return matches; - const uint8_t *const pb = cur - delta; + pb = cur - delta; cur_match = son[cyclic_pos - delta + (delta > cyclic_pos ? cyclic_size : 0)]; @@ -305,18 +313,23 @@ do { \ extern uint32_t lzma_mf_hc3_find(lzma_mf *mf, lzma_match *matches) { + const uint8_t *cur; + uint32_t pos; + uint32_t temp, hash_value, hash_2_value; /* hash_3_calc */ + uint32_t delta2, cur_match; + uint32_t len_best = 2; + uint32_t matches_count = 0; + header_find(false, 3); hash_3_calc(); - const uint32_t delta2 = pos - mf->hash[hash_2_value]; - const uint32_t cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value]; + delta2 = pos - mf->hash[hash_2_value]; + cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value]; mf->hash[hash_2_value] = pos; mf->hash[FIX_3_HASH_SIZE + hash_value] = pos; - uint32_t len_best = 2; - if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) { for ( ; len_best != len_limit; ++len_best) if (*(cur + len_best - delta2) != cur[len_best]) @@ -340,18 +353,22 @@ extern void lzma_mf_hc3_skip(lzma_mf *mf, uint32_t amount) { do { + const uint8_t *cur; + uint32_t pos; + uint32_t temp, hash_value, hash_2_value; /* hash_3_calc */ + uint32_t cur_match; + if (mf_avail(mf) < 3) { move_pending(mf); continue; } - const uint8_t *cur = mf_ptr(mf); - const uint32_t pos = mf->read_pos + mf->offset; + cur = mf_ptr(mf); + pos = mf->read_pos + mf->offset; hash_3_calc(); - const uint32_t cur_match - = mf->hash[FIX_3_HASH_SIZE + hash_value]; + cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value]; mf->hash[hash_2_value] = pos; mf->hash[FIX_3_HASH_SIZE + hash_value] = pos; @@ -367,21 +384,25 @@ lzma_mf_hc3_skip(lzma_mf *mf, uint32_t amount) extern uint32_t lzma_mf_hc4_find(lzma_mf *mf, lzma_match *matches) { + const uint8_t *cur; + uint32_t pos; + uint32_t temp, hash_value, hash_2_value, hash_3_value; /* hash_4_calc */ + uint32_t delta2, delta3, cur_match; + uint32_t len_best = 1; + uint32_t matches_count = 0; + header_find(false, 4); hash_4_calc(); - uint32_t delta2 = pos - mf->hash[hash_2_value]; - const uint32_t delta3 - = pos - mf->hash[FIX_3_HASH_SIZE + hash_3_value]; - const uint32_t cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value]; + delta2 = pos - mf->hash[hash_2_value]; + delta3 = pos - mf->hash[FIX_3_HASH_SIZE + hash_3_value]; + cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value]; mf->hash[hash_2_value ] = pos; mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos; mf->hash[FIX_4_HASH_SIZE + hash_value] = pos; - uint32_t len_best = 1; - if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) { len_best = 2; matches[0].len = 2; @@ -420,18 +441,22 @@ extern void lzma_mf_hc4_skip(lzma_mf *mf, uint32_t amount) { do { + const uint8_t *cur; + uint32_t pos; + uint32_t temp, hash_value, hash_2_value, hash_3_value; /* hash_4_calc */ + uint32_t cur_match; + if (mf_avail(mf) < 4) { move_pending(mf); continue; } - const uint8_t *cur = mf_ptr(mf); - const uint32_t pos = mf->read_pos + mf->offset; + cur = mf_ptr(mf); + pos = mf->read_pos + mf->offset; hash_4_calc(); - const uint32_t cur_match - = mf->hash[FIX_4_HASH_SIZE + hash_value]; + cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value]; mf->hash[hash_2_value] = pos; mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos; @@ -469,6 +494,10 @@ bt_find_func( uint32_t len1 = 0; while (true) { + uint32_t *pair; + const uint8_t *pb; + uint32_t len; + const uint32_t delta = pos - cur_match; if (depth-- == 0 || delta >= cyclic_size) { *ptr0 = EMPTY_HASH_VALUE; @@ -476,12 +505,12 @@ bt_find_func( return matches; } - uint32_t *const pair = son + ((cyclic_pos - delta + pair = son + ((cyclic_pos - delta + (delta > cyclic_pos ? cyclic_size : 0)) << 1); - const uint8_t *const pb = cur - delta; - uint32_t len = my_min(len0, len1); + pb = cur - delta; + len = my_min(len0, len1); if (pb[len] == cur[len]) { while (++len != len_limit) @@ -535,6 +564,10 @@ bt_skip_func( uint32_t len1 = 0; while (true) { + uint32_t *pair; + const uint8_t *pb; + uint32_t len; + const uint32_t delta = pos - cur_match; if (depth-- == 0 || delta >= cyclic_size) { *ptr0 = EMPTY_HASH_VALUE; @@ -542,11 +575,11 @@ bt_skip_func( return; } - uint32_t *pair = son + ((cyclic_pos - delta + pair = son + ((cyclic_pos - delta + (delta > cyclic_pos ? cyclic_size : 0)) << 1); - const uint8_t *pb = cur - delta; - uint32_t len = my_min(len0, len1); + pb = cur - delta; + len = my_min(len0, len1); if (pb[len] == cur[len]) { while (++len != len_limit) @@ -593,11 +626,17 @@ do { \ extern uint32_t lzma_mf_bt2_find(lzma_mf *mf, lzma_match *matches) { + const uint8_t *cur; + uint32_t pos; + uint32_t hash_value; /* hash_2_calc */ + uint32_t cur_match; + uint32_t matches_count = 0; + header_find(true, 2); hash_2_calc(); - const uint32_t cur_match = mf->hash[hash_value]; + cur_match = mf->hash[hash_value]; mf->hash[hash_value] = pos; bt_find(1); @@ -608,11 +647,16 @@ extern void lzma_mf_bt2_skip(lzma_mf *mf, uint32_t amount) { do { + const uint8_t *cur; + uint32_t pos; + uint32_t hash_value; /* hash_2_calc */ + uint32_t cur_match; + header_skip(true, 2); hash_2_calc(); - const uint32_t cur_match = mf->hash[hash_value]; + cur_match = mf->hash[hash_value]; mf->hash[hash_value] = pos; bt_skip(); @@ -626,18 +670,23 @@ lzma_mf_bt2_skip(lzma_mf *mf, uint32_t amount) extern uint32_t lzma_mf_bt3_find(lzma_mf *mf, lzma_match *matches) { + const uint8_t *cur; + uint32_t pos; + uint32_t temp, hash_value, hash_2_value; /* hash_3_calc */ + uint32_t delta2, cur_match; + uint32_t len_best = 2; + uint32_t matches_count = 0; + header_find(true, 3); hash_3_calc(); - const uint32_t delta2 = pos - mf->hash[hash_2_value]; - const uint32_t cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value]; + delta2 = pos - mf->hash[hash_2_value]; + cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value]; mf->hash[hash_2_value] = pos; mf->hash[FIX_3_HASH_SIZE + hash_value] = pos; - uint32_t len_best = 2; - if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) { for ( ; len_best != len_limit; ++len_best) if (*(cur + len_best - delta2) != cur[len_best]) @@ -661,12 +710,16 @@ extern void lzma_mf_bt3_skip(lzma_mf *mf, uint32_t amount) { do { + const uint8_t *cur; + uint32_t pos; + uint32_t temp, hash_value, hash_2_value; /* hash_3_calc */ + uint32_t cur_match; + header_skip(true, 3); hash_3_calc(); - const uint32_t cur_match - = mf->hash[FIX_3_HASH_SIZE + hash_value]; + cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value]; mf->hash[hash_2_value] = pos; mf->hash[FIX_3_HASH_SIZE + hash_value] = pos; @@ -682,21 +735,25 @@ lzma_mf_bt3_skip(lzma_mf *mf, uint32_t amount) extern uint32_t lzma_mf_bt4_find(lzma_mf *mf, lzma_match *matches) { + const uint8_t *cur; + uint32_t pos; + uint32_t temp, hash_value, hash_2_value, hash_3_value; /* hash_4_calc */ + uint32_t delta2, delta3, cur_match; + uint32_t len_best = 1; + uint32_t matches_count = 0; + header_find(true, 4); hash_4_calc(); - uint32_t delta2 = pos - mf->hash[hash_2_value]; - const uint32_t delta3 - = pos - mf->hash[FIX_3_HASH_SIZE + hash_3_value]; - const uint32_t cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value]; + delta2 = pos - mf->hash[hash_2_value]; + delta3 = pos - mf->hash[FIX_3_HASH_SIZE + hash_3_value]; + cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value]; mf->hash[hash_2_value] = pos; mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos; mf->hash[FIX_4_HASH_SIZE + hash_value] = pos; - uint32_t len_best = 1; - if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) { len_best = 2; matches[0].len = 2; @@ -735,12 +792,16 @@ extern void lzma_mf_bt4_skip(lzma_mf *mf, uint32_t amount) { do { + const uint8_t *cur; + uint32_t pos; + uint32_t temp, hash_value, hash_2_value, hash_3_value; /* hash_4_calc */ + uint32_t cur_match; + header_skip(true, 4); hash_4_calc(); - const uint32_t cur_match - = mf->hash[FIX_4_HASH_SIZE + hash_value]; + cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value]; mf->hash[hash_2_value] = pos; mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos; diff --git a/Utilities/cmliblzma/liblzma/lzma/fastpos.h b/Utilities/cmliblzma/liblzma/lzma/fastpos.h index 4aea231..5a834d6 100644 --- a/Utilities/cmliblzma/liblzma/lzma/fastpos.h +++ b/Utilities/cmliblzma/liblzma/lzma/fastpos.h @@ -75,6 +75,8 @@ // on all systems I have tried. The size optimized version is sometimes // slightly faster, but sometimes it is a lot slower. +#include "config.h" + #ifdef HAVE_SMALL # define get_pos_slot(pos) ((pos) <= 4 ? (pos) : get_pos_slot_2(pos)) diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c index 3e42575..ca14c4a 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c @@ -224,6 +224,8 @@ static lzma_ret lzma2_decoder_init(lzma_lz_decoder *lz, lzma_allocator *allocator, const void *opt, lzma_lz_options *lz_options) { + const lzma_options_lzma *options = opt; + if (lz->coder == NULL) { lz->coder = lzma_alloc(sizeof(lzma_coder), allocator); if (lz->coder == NULL) @@ -235,8 +237,6 @@ lzma2_decoder_init(lzma_lz_decoder *lz, lzma_allocator *allocator, lz->coder->lzma = LZMA_LZ_DECODER_INIT; } - const lzma_options_lzma *options = opt; - lz->coder->sequence = SEQ_CONTROL; lz->coder->need_properties = true; lz->coder->need_dictionary_reset = options->preset_dict == NULL @@ -272,6 +272,8 @@ extern lzma_ret lzma_lzma2_props_decode(void **options, lzma_allocator *allocator, const uint8_t *props, size_t props_size) { + lzma_options_lzma *opt; + if (props_size != 1) return LZMA_OPTIONS_ERROR; @@ -283,8 +285,7 @@ lzma_lzma2_props_decode(void **options, lzma_allocator *allocator, if (props[0] > 40) return LZMA_OPTIONS_ERROR; - lzma_options_lzma *opt = lzma_alloc( - sizeof(lzma_options_lzma), allocator); + opt = lzma_alloc(sizeof(lzma_options_lzma), allocator); if (opt == NULL) return LZMA_MEM_ERROR; diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c index 992720c..8784f5d 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c @@ -54,13 +54,14 @@ struct lzma_coder_s { static void lzma2_header_lzma(lzma_coder *coder) { + size_t pos; + size_t size; + assert(coder->uncompressed_size > 0); assert(coder->uncompressed_size <= LZMA2_UNCOMPRESSED_MAX); assert(coder->compressed_size > 0); assert(coder->compressed_size <= LZMA2_CHUNK_MAX); - size_t pos; - if (coder->need_properties) { pos = 0; @@ -81,7 +82,7 @@ lzma2_header_lzma(lzma_coder *coder) coder->buf_pos = pos; // Uncompressed size - size_t size = coder->uncompressed_size - 1; + size = coder->uncompressed_size - 1; coder->buf[pos++] += size >> 16; coder->buf[pos++] = (size >> 8) & 0xFF; coder->buf[pos++] = size & 0xFF; @@ -162,6 +163,9 @@ lzma2_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, // Fall through case SEQ_LZMA_ENCODE: { + uint32_t read_start; + lzma_ret ret; + // Calculate how much more uncompressed data this chunk // could accept. const uint32_t left = LZMA2_UNCOMPRESSED_MAX @@ -182,10 +186,10 @@ lzma2_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, // Save the start position so that we can update // coder->uncompressed_size. - const uint32_t read_start = mf->read_pos - mf->read_ahead; + read_start = mf->read_pos - mf->read_ahead; // Call the LZMA encoder until the chunk is finished. - const lzma_ret ret = lzma_lzma_encode(coder->lzma, mf, + ret = lzma_lzma_encode(coder->lzma, mf, coder->buf + LZMA2_HEADER_MAX, &coder->compressed_size, LZMA2_CHUNK_MAX, limit); @@ -273,6 +277,8 @@ lzma2_encoder_end(lzma_coder *coder, lzma_allocator *allocator) static lzma_ret lzma2_encoder_options_update(lzma_coder *coder, const lzma_filter *filter) { + lzma_options_lzma *opt; + // New options can be set only when there is no incomplete chunk. // This is the case at the beginning of the raw stream and right // after LZMA_SYNC_FLUSH. @@ -281,7 +287,7 @@ lzma2_encoder_options_update(lzma_coder *coder, const lzma_filter *filter) // Look if there are new options. At least for now, // only lc/lp/pb can be changed. - const lzma_options_lzma *opt = filter->options; + opt = filter->options; if (coder->opt_cur.lc != opt->lc || coder->opt_cur.lp != opt->lp || coder->opt_cur.pb != opt->pb) { // Validate the options. diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_common.h b/Utilities/cmliblzma/liblzma/lzma/lzma_common.h index e31e285..36267dc 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_common.h +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_common.h @@ -129,12 +129,15 @@ static inline void literal_init(probability (*probs)[LITERAL_CODER_SIZE], uint32_t lc, uint32_t lp) { + uint32_t coders; + uint32_t i, j; + assert(lc + lp <= LZMA_LCLP_MAX); - const uint32_t coders = 1U << (lc + lp); + coders = 1U << (lc + lp); - for (uint32_t i = 0; i < coders; ++i) - for (uint32_t j = 0; j < LITERAL_CODER_SIZE; ++j) + for (i = 0; i < coders; ++i) + for (j = 0; j < LITERAL_CODER_SIZE; ++j) bit_reset(probs[i][j]); return; diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c index 9979bb4..1bee2a9 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c @@ -114,33 +114,33 @@ do { \ case seq ## _CHOICE: \ rc_if_0(ld.choice, seq ## _CHOICE) { \ rc_update_0(ld.choice); \ - rc_bit_case(ld.low[pos_state][symbol], , , seq ## _LOW0); \ - rc_bit_case(ld.low[pos_state][symbol], , , seq ## _LOW1); \ - rc_bit_case(ld.low[pos_state][symbol], , , seq ## _LOW2); \ + rc_bit_case(ld.low[pos_state][symbol], 0, 0, seq ## _LOW0); \ + rc_bit_case(ld.low[pos_state][symbol], 0, 0, seq ## _LOW1); \ + rc_bit_case(ld.low[pos_state][symbol], 0, 0, seq ## _LOW2); \ target = symbol - LEN_LOW_SYMBOLS + MATCH_LEN_MIN; \ } else { \ rc_update_1(ld.choice); \ case seq ## _CHOICE2: \ rc_if_0(ld.choice2, seq ## _CHOICE2) { \ rc_update_0(ld.choice2); \ - rc_bit_case(ld.mid[pos_state][symbol], , , \ + rc_bit_case(ld.mid[pos_state][symbol], 0, 0, \ seq ## _MID0); \ - rc_bit_case(ld.mid[pos_state][symbol], , , \ + rc_bit_case(ld.mid[pos_state][symbol], 0, 0, \ seq ## _MID1); \ - rc_bit_case(ld.mid[pos_state][symbol], , , \ + rc_bit_case(ld.mid[pos_state][symbol], 0, 0, \ seq ## _MID2); \ target = symbol - LEN_MID_SYMBOLS \ + MATCH_LEN_MIN + LEN_LOW_SYMBOLS; \ } else { \ rc_update_1(ld.choice2); \ - rc_bit_case(ld.high[symbol], , , seq ## _HIGH0); \ - rc_bit_case(ld.high[symbol], , , seq ## _HIGH1); \ - rc_bit_case(ld.high[symbol], , , seq ## _HIGH2); \ - rc_bit_case(ld.high[symbol], , , seq ## _HIGH3); \ - rc_bit_case(ld.high[symbol], , , seq ## _HIGH4); \ - rc_bit_case(ld.high[symbol], , , seq ## _HIGH5); \ - rc_bit_case(ld.high[symbol], , , seq ## _HIGH6); \ - rc_bit_case(ld.high[symbol], , , seq ## _HIGH7); \ + rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH0); \ + rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH1); \ + rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH2); \ + rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH3); \ + rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH4); \ + rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH5); \ + rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH6); \ + rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH7); \ target = symbol - LEN_HIGH_SYMBOLS \ + MATCH_LEN_MIN \ + LEN_LOW_SYMBOLS + LEN_MID_SYMBOLS; \ @@ -285,13 +285,6 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size) { - //////////////////// - // Initialization // - //////////////////// - - if (!rc_read_init(&coder->rc, in, in_pos, in_size)) - return LZMA_OK; - /////////////// // Variables // /////////////// @@ -338,6 +331,16 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, if (no_eopm && coder->uncompressed_size < dict.limit - dict.pos) dict.limit = dict.pos + (size_t)(coder->uncompressed_size); + //////////////////// + // Initialization // + //////////////////// + + if (!rc_read_init(&coder->rc, in, in_pos, in_size)) + return LZMA_OK; + + rc = coder->rc; + rc_in_pos = *in_pos; + // The main decoder loop. The "switch" is used to restart the decoder at // correct location. Once restarted, the "switch" is no longer used. switch (coder->sequence) @@ -353,6 +356,21 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, break; rc_if_0(coder->is_match[state][pos_state], SEQ_IS_MATCH) { + static const lzma_lzma_state next_state[] = { + STATE_LIT_LIT, + STATE_LIT_LIT, + STATE_LIT_LIT, + STATE_LIT_LIT, + STATE_MATCH_LIT_LIT, + STATE_REP_LIT_LIT, + STATE_SHORTREP_LIT_LIT, + STATE_MATCH_LIT, + STATE_REP_LIT, + STATE_SHORTREP_LIT, + STATE_MATCH_LIT, + STATE_REP_LIT + }; + rc_update_0(coder->is_match[state][pos_state]); // It's a literal i.e. a single 8-bit byte. @@ -370,16 +388,21 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, rc_bit(probs[symbol], , , SEQ_LITERAL); } while (symbol < (1 << 8)); #else - rc_bit_case(probs[symbol], , , SEQ_LITERAL0); - rc_bit_case(probs[symbol], , , SEQ_LITERAL1); - rc_bit_case(probs[symbol], , , SEQ_LITERAL2); - rc_bit_case(probs[symbol], , , SEQ_LITERAL3); - rc_bit_case(probs[symbol], , , SEQ_LITERAL4); - rc_bit_case(probs[symbol], , , SEQ_LITERAL5); - rc_bit_case(probs[symbol], , , SEQ_LITERAL6); - rc_bit_case(probs[symbol], , , SEQ_LITERAL7); + rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL0); + rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL1); + rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL2); + rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL3); + rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL4); + rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL5); + rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL6); + rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL7); #endif } else { +#ifndef HAVE_SMALL + uint32_t match_bit; + uint32_t subcoder_index; +#endif + // Decode literal with match byte. // // We store the byte we compare against @@ -418,8 +441,6 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, } while (symbol < (1 << 8)); #else // Unroll the loop. - uint32_t match_bit; - uint32_t subcoder_index; # define d(seq) \ case seq: \ @@ -453,20 +474,6 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, // Use a lookup table to update to literal state, // since compared to other state updates, this would // need two branches. - static const lzma_lzma_state next_state[] = { - STATE_LIT_LIT, - STATE_LIT_LIT, - STATE_LIT_LIT, - STATE_LIT_LIT, - STATE_MATCH_LIT_LIT, - STATE_REP_LIT_LIT, - STATE_SHORTREP_LIT_LIT, - STATE_MATCH_LIT, - STATE_REP_LIT, - STATE_SHORTREP_LIT, - STATE_MATCH_LIT, - STATE_REP_LIT - }; state = next_state[state]; case SEQ_LITERAL_WRITE: @@ -511,12 +518,12 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, rc_bit(probs[symbol], , , SEQ_POS_SLOT); } while (symbol < POS_SLOTS); #else - rc_bit_case(probs[symbol], , , SEQ_POS_SLOT0); - rc_bit_case(probs[symbol], , , SEQ_POS_SLOT1); - rc_bit_case(probs[symbol], , , SEQ_POS_SLOT2); - rc_bit_case(probs[symbol], , , SEQ_POS_SLOT3); - rc_bit_case(probs[symbol], , , SEQ_POS_SLOT4); - rc_bit_case(probs[symbol], , , SEQ_POS_SLOT5); + rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT0); + rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT1); + rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT2); + rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT3); + rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT4); + rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT5); #endif // Get rid of the highest bit that was needed for // indexing of the probability array. @@ -564,25 +571,25 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, switch (limit) { case 5: assert(offset == 0); - rc_bit(probs[symbol], , + rc_bit(probs[symbol], 0, rep0 += 1, SEQ_POS_MODEL); ++offset; --limit; case 4: - rc_bit(probs[symbol], , + rc_bit(probs[symbol], 0, rep0 += 1 << offset, SEQ_POS_MODEL); ++offset; --limit; case 3: - rc_bit(probs[symbol], , + rc_bit(probs[symbol], 0, rep0 += 1 << offset, SEQ_POS_MODEL); ++offset; --limit; case 2: - rc_bit(probs[symbol], , + rc_bit(probs[symbol], 0, rep0 += 1 << offset, SEQ_POS_MODEL); ++offset; @@ -594,7 +601,7 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, // rc_bit_last() here to omit // the unneeded updating of // "symbol". - rc_bit_last(probs[symbol], , + rc_bit_last(probs[symbol], 0, rep0 += 1 << offset, SEQ_POS_MODEL); } @@ -628,19 +635,19 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, } while (++offset < ALIGN_BITS); #else case SEQ_ALIGN0: - rc_bit(coder->pos_align[symbol], , + rc_bit(coder->pos_align[symbol], 0, rep0 += 1, SEQ_ALIGN0); case SEQ_ALIGN1: - rc_bit(coder->pos_align[symbol], , + rc_bit(coder->pos_align[symbol], 0, rep0 += 2, SEQ_ALIGN1); case SEQ_ALIGN2: - rc_bit(coder->pos_align[symbol], , + rc_bit(coder->pos_align[symbol], 0, rep0 += 4, SEQ_ALIGN2); case SEQ_ALIGN3: // Like in SEQ_POS_MODEL, we don't // need "symbol" for anything else // than indexing the probability array. - rc_bit_last(coder->pos_align[symbol], , + rc_bit_last(coder->pos_align[symbol], 0, rep0 += 8, SEQ_ALIGN3); #endif @@ -725,9 +732,11 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, // is stored to rep0 and rep1, rep2 and rep3 // are updated accordingly. rc_if_0(coder->is_rep1[state], SEQ_IS_REP1) { + uint32_t distance; + rc_update_0(coder->is_rep1[state]); - const uint32_t distance = rep1; + distance = rep1; rep1 = rep0; rep0 = distance; @@ -736,19 +745,23 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, case SEQ_IS_REP2: rc_if_0(coder->is_rep2[state], SEQ_IS_REP2) { + uint32_t distance; + rc_update_0(coder->is_rep2[ state]); - const uint32_t distance = rep2; + distance = rep2; rep2 = rep1; rep1 = rep0; rep0 = distance; } else { + uint32_t distance; + rc_update_1(coder->is_rep2[ state]); - const uint32_t distance = rep3; + distance = rep3; rep3 = rep2; rep2 = rep1; rep1 = rep0; @@ -853,6 +866,9 @@ lzma_lzma_decoder_uncompressed(void *coder_ptr, lzma_vli uncompressed_size) static void lzma_decoder_reset(lzma_coder *coder, const void *opt) { + uint32_t i, j, pos_state; + uint32_t num_pos_states; + const lzma_options_lzma *options = opt; // NOTE: We assume that lc/lp/pb are valid since they were @@ -879,8 +895,8 @@ lzma_decoder_reset(lzma_coder *coder, const void *opt) rc_reset(coder->rc); // Bit and bittree decoders - for (uint32_t i = 0; i < STATES; ++i) { - for (uint32_t j = 0; j <= coder->pos_mask; ++j) { + for (i = 0; i < STATES; ++i) { + for (j = 0; j <= coder->pos_mask; ++j) { bit_reset(coder->is_match[i][j]); bit_reset(coder->is_rep0_long[i][j]); } @@ -891,22 +907,22 @@ lzma_decoder_reset(lzma_coder *coder, const void *opt) bit_reset(coder->is_rep2[i]); } - for (uint32_t i = 0; i < LEN_TO_POS_STATES; ++i) + for (i = 0; i < LEN_TO_POS_STATES; ++i) bittree_reset(coder->pos_slot[i], POS_SLOT_BITS); - for (uint32_t i = 0; i < FULL_DISTANCES - END_POS_MODEL_INDEX; ++i) + for (i = 0; i < FULL_DISTANCES - END_POS_MODEL_INDEX; ++i) bit_reset(coder->pos_special[i]); bittree_reset(coder->pos_align, ALIGN_BITS); // Len decoders (also bit/bittree) - const uint32_t num_pos_states = 1U << options->pb; + num_pos_states = 1U << options->pb; bit_reset(coder->match_len_decoder.choice); bit_reset(coder->match_len_decoder.choice2); bit_reset(coder->rep_len_decoder.choice); bit_reset(coder->rep_len_decoder.choice2); - for (uint32_t pos_state = 0; pos_state < num_pos_states; ++pos_state) { + for (pos_state = 0; pos_state < num_pos_states; ++pos_state) { bittree_reset(coder->match_len_decoder.low[pos_state], LEN_LOW_BITS); bittree_reset(coder->match_len_decoder.mid[pos_state], @@ -936,6 +952,8 @@ extern lzma_ret lzma_lzma_decoder_create(lzma_lz_decoder *lz, lzma_allocator *allocator, const void *opt, lzma_lz_options *lz_options) { + const lzma_options_lzma *options = opt; + if (lz->coder == NULL) { lz->coder = lzma_alloc(sizeof(lzma_coder), allocator); if (lz->coder == NULL) @@ -948,7 +966,6 @@ lzma_lzma_decoder_create(lzma_lz_decoder *lz, lzma_allocator *allocator, // All dictionary sizes are OK here. LZ decoder will take care of // the special cases. - const lzma_options_lzma *options = opt; lz_options->dict_size = options->dict_size; lz_options->preset_dict = options->preset_dict; lz_options->preset_dict_size = options->preset_dict_size; @@ -1028,11 +1045,12 @@ extern lzma_ret lzma_lzma_props_decode(void **options, lzma_allocator *allocator, const uint8_t *props, size_t props_size) { + lzma_options_lzma *opt; + if (props_size != 5) return LZMA_OPTIONS_ERROR; - lzma_options_lzma *opt - = lzma_alloc(sizeof(lzma_options_lzma), allocator); + opt = lzma_alloc(sizeof(lzma_options_lzma), allocator); if (opt == NULL) return LZMA_MEM_ERROR; diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c index 0b9ee9e..6186f83 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c @@ -28,11 +28,14 @@ literal_matched(lzma_range_encoder *rc, probability *subcoder, symbol += UINT32_C(1) << 8; do { + uint32_t match_bit; + uint32_t subcoder_index; + uint32_t bit; + match_byte <<= 1; - const uint32_t match_bit = match_byte & offset; - const uint32_t subcoder_index - = offset + match_bit + (symbol >> 8); - const uint32_t bit = (symbol >> 7) & 1; + match_bit = match_byte & offset; + subcoder_index = offset + match_bit + (symbol >> 8); + bit = (symbol >> 7) & 1; rc_bit(rc, &subcoder[subcoder_index], bit); symbol <<= 1; @@ -77,16 +80,19 @@ literal(lzma_coder *coder, lzma_mf *mf, uint32_t position) static void length_update_prices(lzma_length_encoder *lc, const uint32_t pos_state) { + uint32_t a0, a1, b0, b1; + uint32_t *prices; + uint32_t i; + const uint32_t table_size = lc->table_size; lc->counters[pos_state] = table_size; - const uint32_t a0 = rc_bit_0_price(lc->choice); - const uint32_t a1 = rc_bit_1_price(lc->choice); - const uint32_t b0 = a1 + rc_bit_0_price(lc->choice2); - const uint32_t b1 = a1 + rc_bit_1_price(lc->choice2); - uint32_t *const prices = lc->prices[pos_state]; + a0 = rc_bit_0_price(lc->choice); + a1 = rc_bit_1_price(lc->choice); + b0 = a1 + rc_bit_0_price(lc->choice2); + b1 = a1 + rc_bit_1_price(lc->choice2); + prices = lc->prices[pos_state]; - uint32_t i; for (i = 0; i < table_size && i < LEN_LOW_SYMBOLS; ++i) prices[i] = a0 + rc_bittree_price(lc->low[pos_state], LEN_LOW_BITS, i); @@ -143,13 +149,16 @@ static inline void match(lzma_coder *coder, const uint32_t pos_state, const uint32_t distance, const uint32_t len) { + uint32_t pos_slot; + uint32_t len_to_pos_state; + update_match(coder->state); length(&coder->rc, &coder->match_len_encoder, pos_state, len, coder->fast_mode); - const uint32_t pos_slot = get_pos_slot(distance); - const uint32_t len_to_pos_state = get_len_to_pos_state(len); + pos_slot = get_pos_slot(distance); + len_to_pos_state = get_len_to_pos_state(len); rc_bittree(&coder->rc, coder->pos_slot[len_to_pos_state], POS_SLOT_BITS, pos_slot); @@ -313,14 +322,19 @@ lzma_lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, uint32_t limit) { + uint32_t position; + // Initialize the stream if no data has been encoded yet. if (!coder->is_initialized && !encode_init(coder, mf)) return LZMA_OK; // Get the lowest bits of the uncompressed offset from the LZ layer. - uint32_t position = mf_position(mf); + position = mf_position(mf); while (true) { + uint32_t len; + uint32_t back; + // Encode pending bits, if any. Calling this before encoding // the next symbol is needed only with plain LZMA, since // LZMA2 always provides big enough buffer to flush @@ -359,8 +373,6 @@ lzma_lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, // - UINT32_MAX: not a match but a literal // Value ranges for len: // - [MATCH_LEN_MIN, MATCH_LEN_MAX] - uint32_t len; - uint32_t back; if (coder->fast_mode) lzma_lzma_optimum_fast(coder, mf, &back, &len); @@ -453,10 +465,12 @@ static void length_encoder_reset(lzma_length_encoder *lencoder, const uint32_t num_pos_states, const bool fast_mode) { + size_t pos_state; + bit_reset(lencoder->choice); bit_reset(lencoder->choice2); - for (size_t pos_state = 0; pos_state < num_pos_states; ++pos_state) { + for (pos_state = 0; pos_state < num_pos_states; ++pos_state) { bittree_reset(lencoder->low[pos_state], LEN_LOW_BITS); bittree_reset(lencoder->mid[pos_state], LEN_MID_BITS); } @@ -464,7 +478,7 @@ length_encoder_reset(lzma_length_encoder *lencoder, bittree_reset(lencoder->high, LEN_HIGH_BITS); if (!fast_mode) - for (size_t pos_state = 0; pos_state < num_pos_states; + for (pos_state = 0; pos_state < num_pos_states; ++pos_state) length_update_prices(lencoder, pos_state); @@ -475,6 +489,8 @@ length_encoder_reset(lzma_length_encoder *lencoder, extern lzma_ret lzma_lzma_encoder_reset(lzma_coder *coder, const lzma_options_lzma *options) { + size_t i, j; + if (!is_options_valid(options)) return LZMA_OPTIONS_ERROR; @@ -487,14 +503,14 @@ lzma_lzma_encoder_reset(lzma_coder *coder, const lzma_options_lzma *options) // State coder->state = STATE_LIT_LIT; - for (size_t i = 0; i < REP_DISTANCES; ++i) + for (i = 0; i < REP_DISTANCES; ++i) coder->reps[i] = 0; literal_init(coder->literal, options->lc, options->lp); // Bit encoders - for (size_t i = 0; i < STATES; ++i) { - for (size_t j = 0; j <= coder->pos_mask; ++j) { + for (i = 0; i < STATES; ++i) { + for (j = 0; j <= coder->pos_mask; ++j) { bit_reset(coder->is_match[i][j]); bit_reset(coder->is_rep0_long[i][j]); } @@ -505,11 +521,11 @@ lzma_lzma_encoder_reset(lzma_coder *coder, const lzma_options_lzma *options) bit_reset(coder->is_rep2[i]); } - for (size_t i = 0; i < FULL_DISTANCES - END_POS_MODEL_INDEX; ++i) + for (i = 0; i < FULL_DISTANCES - END_POS_MODEL_INDEX; ++i) bit_reset(coder->pos_special[i]); // Bit tree encoders - for (size_t i = 0; i < LEN_TO_POS_STATES; ++i) + for (i = 0; i < LEN_TO_POS_STATES; ++i) bittree_reset(coder->pos_slot[i], POS_SLOT_BITS); bittree_reset(coder->pos_align, ALIGN_BITS); @@ -548,6 +564,9 @@ extern lzma_ret lzma_lzma_encoder_create(lzma_coder **coder_ptr, lzma_allocator *allocator, const lzma_options_lzma *options, lzma_lz_options *lz_options) { + lzma_coder *coder; + uint32_t log_size = 0; + // Allocate lzma_coder if it wasn't already allocated. if (*coder_ptr == NULL) { *coder_ptr = lzma_alloc(sizeof(lzma_coder), allocator); @@ -555,7 +574,7 @@ lzma_lzma_encoder_create(lzma_coder **coder_ptr, lzma_allocator *allocator, return LZMA_MEM_ERROR; } - lzma_coder *coder = *coder_ptr; + coder = *coder_ptr; // Set compression mode. We haven't validates the options yet, // but it's OK here, since nothing bad happens with invalid @@ -571,7 +590,6 @@ lzma_lzma_encoder_create(lzma_coder **coder_ptr, lzma_allocator *allocator, // Set dist_table_size. // Round the dictionary size up to next 2^n. - uint32_t log_size = 0; while ((UINT32_C(1) << log_size) < options->dict_size) ++log_size; @@ -625,13 +643,15 @@ lzma_lzma_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, extern uint64_t lzma_lzma_encoder_memusage(const void *options) { + lzma_lz_options lz_options; + uint64_t lz_memusage; + if (!is_options_valid(options)) return UINT64_MAX; - lzma_lz_options lz_options; set_lz_options(&lz_options, options); - const uint64_t lz_memusage = lzma_lz_encoder_memusage(&lz_options); + lz_memusage = lzma_lz_encoder_memusage(&lz_options); if (lz_memusage == UINT64_MAX) return UINT64_MAX; diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c index f835f69..52c26e4 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c @@ -20,6 +20,14 @@ extern void lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, uint32_t *restrict back_res, uint32_t *restrict len_res) { + const uint8_t *buf; + uint32_t buf_avail; + uint32_t i; + uint32_t rep_len = 0; + uint32_t rep_index = 0; + uint32_t back_main = 0; + uint32_t limit; + const uint32_t nice_len = mf->nice_len; uint32_t len_main; @@ -32,8 +40,8 @@ lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, matches_count = coder->matches_count; } - const uint8_t *buf = mf_ptr(mf) - 1; - const uint32_t buf_avail = my_min(mf_avail(mf) + 1, MATCH_LEN_MAX); + buf = mf_ptr(mf) - 1; + buf_avail = my_min(mf_avail(mf) + 1, MATCH_LEN_MAX); if (buf_avail < 2) { // There's not enough input left to encode a match. @@ -43,10 +51,9 @@ lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, } // Look for repeated matches; scan the previous four match distances - uint32_t rep_len = 0; - uint32_t rep_index = 0; + for (i = 0; i < REP_DISTANCES; ++i) { + uint32_t len; - for (uint32_t i = 0; i < REP_DISTANCES; ++i) { // Pointer to the beginning of the match candidate const uint8_t *const buf_back = buf - coder->reps[i] - 1; @@ -57,7 +64,6 @@ lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, // The first two bytes matched. // Calculate the length of the match. - uint32_t len; for (len = 2; len < buf_avail && buf[len] == buf_back[len]; ++len) ; @@ -86,7 +92,6 @@ lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, return; } - uint32_t back_main = 0; if (len_main >= 2) { back_main = coder->matches[matches_count - 1].dist; @@ -153,15 +158,16 @@ lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, // the old buf pointer instead of recalculating it with mf_ptr(). ++buf; - const uint32_t limit = len_main - 1; + limit = len_main - 1; + + for (i = 0; i < REP_DISTANCES; ++i) { + uint32_t len; - for (uint32_t i = 0; i < REP_DISTANCES; ++i) { const uint8_t *const buf_back = buf - coder->reps[i] - 1; if (not_equal_16(buf, buf_back)) continue; - uint32_t len; for (len = 2; len < limit && buf[len] == buf_back[len]; ++len) ; diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c index 7e85649..d2829a2 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c @@ -35,12 +35,15 @@ get_literal_price(const lzma_coder *const coder, const uint32_t pos, symbol += UINT32_C(1) << 8; do { + uint32_t match_bit; + uint32_t subcoder_index; + uint32_t bit; + match_byte <<= 1; - const uint32_t match_bit = match_byte & offset; - const uint32_t subcoder_index - = offset + match_bit + (symbol >> 8); - const uint32_t bit = (symbol >> 7) & 1; + match_bit = match_byte & offset; + subcoder_index = offset + match_bit + (symbol >> 8); + bit = (symbol >> 7) & 1; price += rc_bit_price(subcoder[subcoder_index], bit); symbol <<= 1; @@ -131,7 +134,11 @@ get_pos_len_price(const lzma_coder *const coder, const uint32_t pos, static void fill_distances_prices(lzma_coder *coder) { - for (uint32_t len_to_pos_state = 0; + uint32_t len_to_pos_state; + uint32_t pos_slot; + uint32_t i; + + for (len_to_pos_state = 0; len_to_pos_state < LEN_TO_POS_STATES; ++len_to_pos_state) { @@ -139,7 +146,7 @@ fill_distances_prices(lzma_coder *coder) = coder->pos_slot_prices[len_to_pos_state]; // Price to encode the pos_slot. - for (uint32_t pos_slot = 0; + for (pos_slot = 0; pos_slot < coder->dist_table_size; ++pos_slot) pos_slot_prices[pos_slot] = rc_bittree_price( coder->pos_slot[len_to_pos_state], @@ -148,7 +155,7 @@ fill_distances_prices(lzma_coder *coder) // For matches with distance >= FULL_DISTANCES, add the price // of the direct bits part of the match distance. (Align bits // are handled by fill_align_prices()). - for (uint32_t pos_slot = END_POS_MODEL_INDEX; + for (pos_slot = END_POS_MODEL_INDEX; pos_slot < coder->dist_table_size; ++pos_slot) pos_slot_prices[pos_slot] += rc_direct_price( ((pos_slot >> 1) - 1) - ALIGN_BITS); @@ -156,7 +163,7 @@ fill_distances_prices(lzma_coder *coder) // Distances in the range [0, 3] are fully encoded with // pos_slot, so they are used for coder->distances_prices // as is. - for (uint32_t i = 0; i < START_POS_MODEL_INDEX; ++i) + for (i = 0; i < START_POS_MODEL_INDEX; ++i) coder->distances_prices[len_to_pos_state][i] = pos_slot_prices[i]; } @@ -164,7 +171,7 @@ fill_distances_prices(lzma_coder *coder) // Distances in the range [4, 127] depend on pos_slot and pos_special. // We do this in a loop separate from the above loop to avoid // redundant calls to get_pos_slot(). - for (uint32_t i = START_POS_MODEL_INDEX; i < FULL_DISTANCES; ++i) { + for (i = START_POS_MODEL_INDEX; i < FULL_DISTANCES; ++i) { const uint32_t pos_slot = get_pos_slot(i); const uint32_t footer_bits = ((pos_slot >> 1) - 1); const uint32_t base = (2 | (pos_slot & 1)) << footer_bits; @@ -172,7 +179,7 @@ fill_distances_prices(lzma_coder *coder) coder->pos_special + base - pos_slot - 1, footer_bits, i - base); - for (uint32_t len_to_pos_state = 0; + for (len_to_pos_state = 0; len_to_pos_state < LEN_TO_POS_STATES; ++len_to_pos_state) coder->distances_prices[len_to_pos_state][i] @@ -188,7 +195,8 @@ fill_distances_prices(lzma_coder *coder) static void fill_align_prices(lzma_coder *coder) { - for (uint32_t i = 0; i < ALIGN_TABLE_SIZE; ++i) + uint32_t i; + for (i = 0; i < ALIGN_TABLE_SIZE; ++i) coder->align_prices[i] = rc_bittree_reverse_price( coder->pos_align, ALIGN_BITS, i); @@ -225,12 +233,15 @@ static void backward(lzma_coder *restrict coder, uint32_t *restrict len_res, uint32_t *restrict back_res, uint32_t cur) { - coder->opts_end_index = cur; - uint32_t pos_mem = coder->opts[cur].pos_prev; uint32_t back_mem = coder->opts[cur].back_prev; + coder->opts_end_index = cur; + do { + const uint32_t pos_prev = pos_mem; + const uint32_t back_cur = back_mem; + if (coder->opts[cur].prev_1_is_literal) { make_literal(&coder->opts[pos_mem]); coder->opts[pos_mem].pos_prev = pos_mem - 1; @@ -245,9 +256,6 @@ backward(lzma_coder *restrict coder, uint32_t *restrict len_res, } } - const uint32_t pos_prev = pos_mem; - const uint32_t back_cur = back_mem; - back_mem = coder->opts[pos_prev].back_prev; pos_mem = coder->opts[pos_prev].pos_prev; @@ -274,6 +282,23 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, uint32_t *restrict back_res, uint32_t *restrict len_res, uint32_t position) { + uint32_t buf_avail; + const uint8_t *buf; + uint32_t rep_lens[REP_DISTANCES]; + uint32_t rep_max_index = 0; + uint32_t i; + + uint8_t current_byte; + uint8_t match_byte; + + uint32_t pos_state; + uint32_t match_price; + uint32_t rep_match_price; + uint32_t len_end; + uint32_t len; + + uint32_t normal_match_price; + const uint32_t nice_len = mf->nice_len; uint32_t len_main; @@ -287,19 +312,18 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, matches_count = coder->matches_count; } - const uint32_t buf_avail = my_min(mf_avail(mf) + 1, MATCH_LEN_MAX); + buf_avail = my_min(mf_avail(mf) + 1, MATCH_LEN_MAX); if (buf_avail < 2) { *back_res = UINT32_MAX; *len_res = 1; return UINT32_MAX; } - const uint8_t *const buf = mf_ptr(mf) - 1; + buf = mf_ptr(mf) - 1; - uint32_t rep_lens[REP_DISTANCES]; - uint32_t rep_max_index = 0; + for (i = 0; i < REP_DISTANCES; ++i) { + uint32_t len_test; - for (uint32_t i = 0; i < REP_DISTANCES; ++i) { const uint8_t *const buf_back = buf - coder->reps[i] - 1; if (not_equal_16(buf, buf_back)) { @@ -307,7 +331,6 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, continue; } - uint32_t len_test; for (len_test = 2; len_test < buf_avail && buf[len_test] == buf_back[len_test]; ++len_test) ; @@ -333,8 +356,8 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, return UINT32_MAX; } - const uint8_t current_byte = *buf; - const uint8_t match_byte = *(buf - coder->reps[0] - 1); + current_byte = *buf; + match_byte = *(buf - coder->reps[0] - 1); if (len_main < 2 && current_byte != match_byte && rep_lens[rep_max_index] < 2) { @@ -345,7 +368,7 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, coder->opts[0].state = coder->state; - const uint32_t pos_state = position & coder->pos_mask; + pos_state = position & coder->pos_mask; coder->opts[1].price = rc_bit_0_price( coder->is_match[coder->state][pos_state]) @@ -355,9 +378,9 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, make_literal(&coder->opts[1]); - const uint32_t match_price = rc_bit_1_price( + match_price = rc_bit_1_price( coder->is_match[coder->state][pos_state]); - const uint32_t rep_match_price = match_price + rep_match_price = match_price + rc_bit_1_price(coder->is_rep[coder->state]); if (match_byte == current_byte) { @@ -371,7 +394,7 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, } } - const uint32_t len_end = my_max(len_main, rep_lens[rep_max_index]); + len_end = my_max(len_main, rep_lens[rep_max_index]); if (len_end < 2) { *back_res = coder->opts[1].back_prev; @@ -381,21 +404,23 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, coder->opts[1].pos_prev = 0; - for (uint32_t i = 0; i < REP_DISTANCES; ++i) + for (i = 0; i < REP_DISTANCES; ++i) coder->opts[0].backs[i] = coder->reps[i]; - uint32_t len = len_end; + len = len_end; do { coder->opts[len].price = RC_INFINITY_PRICE; } while (--len >= 2); - for (uint32_t i = 0; i < REP_DISTANCES; ++i) { + for (i = 0; i < REP_DISTANCES; ++i) { + uint32_t price; + uint32_t rep_len = rep_lens[i]; if (rep_len < 2) continue; - const uint32_t price = rep_match_price + get_pure_rep_price( + price = rep_match_price + get_pure_rep_price( coder, i, coder->state, pos_state); do { @@ -414,7 +439,7 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf, } - const uint32_t normal_match_price = match_price + normal_match_price = match_price + rc_bit_0_price(coder->is_rep[coder->state]); len = rep_lens[0] >= 2 ? rep_lens[0] + 1 : 2; @@ -456,6 +481,19 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, uint32_t new_len = coder->longest_match_length; uint32_t pos_prev = coder->opts[cur].pos_prev; lzma_lzma_state state; + uint32_t buf_avail; + uint32_t rep_index; + uint32_t i; + + uint32_t cur_price; + uint8_t current_byte; + uint8_t match_byte; + uint32_t pos_state; + uint32_t cur_and_1_price; + bool next_is_literal = false; + uint32_t match_price; + uint32_t rep_match_price; + uint32_t start_len = 2; if (coder->opts[cur].prev_1_is_literal) { --pos_prev; @@ -499,9 +537,10 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, } if (pos < REP_DISTANCES) { + uint32_t i; + reps[0] = coder->opts[pos_prev].backs[pos]; - uint32_t i; for (i = 1; i <= pos; ++i) reps[i] = coder->opts[pos_prev].backs[i - 1]; @@ -511,30 +550,28 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, } else { reps[0] = pos - REP_DISTANCES; - for (uint32_t i = 1; i < REP_DISTANCES; ++i) + for (i = 1; i < REP_DISTANCES; ++i) reps[i] = coder->opts[pos_prev].backs[i - 1]; } } coder->opts[cur].state = state; - for (uint32_t i = 0; i < REP_DISTANCES; ++i) + for (i = 0; i < REP_DISTANCES; ++i) coder->opts[cur].backs[i] = reps[i]; - const uint32_t cur_price = coder->opts[cur].price; + cur_price = coder->opts[cur].price; - const uint8_t current_byte = *buf; - const uint8_t match_byte = *(buf - reps[0] - 1); + current_byte = *buf; + match_byte = *(buf - reps[0] - 1); - const uint32_t pos_state = position & coder->pos_mask; + pos_state = position & coder->pos_mask; - const uint32_t cur_and_1_price = cur_price + cur_and_1_price = cur_price + rc_bit_0_price(coder->is_match[state][pos_state]) + get_literal_price(coder, position, buf[-1], !is_literal_state(state), match_byte, current_byte); - bool next_is_literal = false; - if (cur_and_1_price < coder->opts[cur + 1].price) { coder->opts[cur + 1].price = cur_and_1_price; coder->opts[cur + 1].pos_prev = cur; @@ -542,9 +579,9 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, next_is_literal = true; } - const uint32_t match_price = cur_price + match_price = cur_price + rc_bit_1_price(coder->is_match[state][pos_state]); - const uint32_t rep_match_price = match_price + rep_match_price = match_price + rc_bit_1_price(coder->is_rep[state]); if (match_byte == current_byte @@ -565,7 +602,7 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, if (buf_avail_full < 2) return len_end; - const uint32_t buf_avail = my_min(buf_avail_full, nice_len); + buf_avail = my_min(buf_avail_full, nice_len); if (!next_is_literal && match_byte != current_byte) { // speed optimization // try literal + rep0 @@ -579,21 +616,26 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, --len_test; if (len_test >= 2) { + uint32_t pos_state_next; + uint32_t next_rep_match_price; + uint32_t offset; + uint32_t cur_and_len_price; + lzma_lzma_state state_2 = state; update_literal(state_2); - const uint32_t pos_state_next = (position + 1) & coder->pos_mask; - const uint32_t next_rep_match_price = cur_and_1_price + pos_state_next = (position + 1) & coder->pos_mask; + next_rep_match_price = cur_and_1_price + rc_bit_1_price(coder->is_match[state_2][pos_state_next]) + rc_bit_1_price(coder->is_rep[state_2]); //for (; len_test >= 2; --len_test) { - const uint32_t offset = cur + 1 + len_test; + offset = cur + 1 + len_test; while (len_end < offset) coder->opts[++len_end].price = RC_INFINITY_PRICE; - const uint32_t cur_and_len_price = next_rep_match_price + cur_and_len_price = next_rep_match_price + get_rep_price(coder, 0, len_test, state_2, pos_state_next); @@ -609,14 +651,14 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, } - uint32_t start_len = 2; // speed optimization + for (rep_index = 0; rep_index < REP_DISTANCES; ++rep_index) { + uint32_t len_test, len_test_2, len_test_temp; + uint32_t price, limit; - for (uint32_t rep_index = 0; rep_index < REP_DISTANCES; ++rep_index) { const uint8_t *const buf_back = buf - reps[rep_index] - 1; if (not_equal_16(buf, buf_back)) continue; - uint32_t len_test; for (len_test = 2; len_test < buf_avail && buf[len_test] == buf_back[len_test]; ++len_test) ; @@ -624,8 +666,8 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, while (len_end < cur + len_test) coder->opts[++len_end].price = RC_INFINITY_PRICE; - const uint32_t len_test_temp = len_test; - const uint32_t price = rep_match_price + get_pure_rep_price( + len_test_temp = len_test; + price = rep_match_price + get_pure_rep_price( coder, rep_index, state, pos_state); do { @@ -647,8 +689,8 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, start_len = len_test + 1; - uint32_t len_test_2 = len_test + 1; - const uint32_t limit = my_min(buf_avail_full, + len_test_2 = len_test + 1; + limit = my_min(buf_avail_full, len_test_2 + nice_len); for (; len_test_2 < limit && buf[len_test_2] == buf_back[len_test_2]; @@ -657,12 +699,18 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, len_test_2 -= len_test + 1; if (len_test_2 >= 2) { + uint32_t pos_state_next; + uint32_t cur_and_len_literal_price; + uint32_t next_rep_match_price; + uint32_t offset; + uint32_t cur_and_len_price; + lzma_lzma_state state_2 = state; update_long_rep(state_2); - uint32_t pos_state_next = (position + len_test) & coder->pos_mask; + pos_state_next = (position + len_test) & coder->pos_mask; - const uint32_t cur_and_len_literal_price = price + cur_and_len_literal_price = price + get_len_price(&coder->rep_len_encoder, len_test, pos_state) + rc_bit_0_price(coder->is_match[state_2][pos_state_next]) @@ -674,17 +722,17 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, pos_state_next = (position + len_test + 1) & coder->pos_mask; - const uint32_t next_rep_match_price = cur_and_len_literal_price + next_rep_match_price = cur_and_len_literal_price + rc_bit_1_price(coder->is_match[state_2][pos_state_next]) + rc_bit_1_price(coder->is_rep[state_2]); //for(; len_test_2 >= 2; len_test_2--) { - const uint32_t offset = cur + len_test + 1 + len_test_2; + offset = cur + len_test + 1 + len_test_2; while (len_end < offset) coder->opts[++len_end].price = RC_INFINITY_PRICE; - const uint32_t cur_and_len_price = next_rep_match_price + cur_and_len_price = next_rep_match_price + get_rep_price(coder, 0, len_test_2, state_2, pos_state_next); @@ -715,17 +763,19 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, if (new_len >= start_len) { + uint32_t len_test; + uint32_t i = 0; + const uint32_t normal_match_price = match_price + rc_bit_0_price(coder->is_rep[state]); while (len_end < cur + new_len) coder->opts[++len_end].price = RC_INFINITY_PRICE; - uint32_t i = 0; while (start_len > coder->matches[i].len) ++i; - for (uint32_t len_test = start_len; ; ++len_test) { + for (len_test = start_len; ; ++len_test) { const uint32_t cur_back = coder->matches[i].dist; uint32_t cur_and_len_price = normal_match_price + get_pos_len_price(coder, @@ -753,12 +803,16 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, len_test_2 -= len_test + 1; if (len_test_2 >= 2) { + uint32_t pos_state_next; + uint32_t cur_and_len_literal_price; + uint32_t next_rep_match_price; + uint32_t offset; + lzma_lzma_state state_2 = state; update_match(state_2); - uint32_t pos_state_next - = (position + len_test) & coder->pos_mask; + pos_state_next = (position + len_test) & coder->pos_mask; - const uint32_t cur_and_len_literal_price = cur_and_len_price + cur_and_len_literal_price = cur_and_len_price + rc_bit_0_price( coder->is_match[state_2][pos_state_next]) + get_literal_price(coder, @@ -771,14 +825,14 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf, update_literal(state_2); pos_state_next = (pos_state_next + 1) & coder->pos_mask; - const uint32_t next_rep_match_price + next_rep_match_price = cur_and_len_literal_price + rc_bit_1_price( coder->is_match[state_2][pos_state_next]) + rc_bit_1_price(coder->is_rep[state_2]); // for(; len_test_2 >= 2; --len_test_2) { - const uint32_t offset = cur + len_test + 1 + len_test_2; + offset = cur + len_test + 1 + len_test_2; while (len_end < offset) coder->opts[++len_end].price = RC_INFINITY_PRICE; @@ -815,6 +869,10 @@ lzma_lzma_optimum_normal(lzma_coder *restrict coder, lzma_mf *restrict mf, uint32_t *restrict back_res, uint32_t *restrict len_res, uint32_t position) { + uint32_t reps[REP_DISTANCES]; + uint32_t len_end; + uint32_t cur; + // If we have symbols pending, return the next pending symbol. if (coder->opts_end_index != coder->opts_current_index) { assert(mf->read_ahead > 0); @@ -841,14 +899,13 @@ lzma_lzma_optimum_normal(lzma_coder *restrict coder, lzma_mf *restrict mf, // the original function into two pieces makes it at least a little // more readable, since those two parts don't share many variables. - uint32_t len_end = helper1(coder, mf, back_res, len_res, position); + len_end = helper1(coder, mf, back_res, len_res, position); if (len_end == UINT32_MAX) return; - uint32_t reps[REP_DISTANCES]; + memcpy(reps, coder->reps, sizeof(reps)); - uint32_t cur; for (cur = 1; cur < len_end; ++cur) { assert(cur < OPTS); diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c index 21e427a..8af9b9f 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c @@ -16,6 +16,9 @@ extern LZMA_API(lzma_bool) lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset) { + static const uint8_t dict_size_values[] = { 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 }; + static const uint8_t depth_values[] = { 4, 8, 24, 48 }; + const uint32_t level = preset & LZMA_PRESET_LEVEL_MASK; const uint32_t flags = preset & ~LZMA_PRESET_LEVEL_MASK; const uint32_t supported_flags = LZMA_PRESET_EXTREME; @@ -30,14 +33,13 @@ lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset) options->lp = LZMA_LP_DEFAULT; options->pb = LZMA_PB_DEFAULT; - options->dict_size = UINT32_C(1) << (uint8_t []){ - 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 }[level]; + options->dict_size = UINT32_C(1) << dict_size_values[level]; if (level <= 3) { options->mode = LZMA_MODE_FAST; options->mf = level == 0 ? LZMA_MF_HC3 : LZMA_MF_HC4; options->nice_len = level <= 1 ? 128 : 273; - options->depth = (uint8_t []){ 4, 8, 24, 48 }[level]; + options->depth = depth_values[level]; } else { options->mode = LZMA_MODE_NORMAL; options->mf = LZMA_MF_BT4; diff --git a/Utilities/cmliblzma/liblzma/rangecoder/range_common.h b/Utilities/cmliblzma/liblzma/rangecoder/range_common.h index 2c74dc1..f15623e 100644 --- a/Utilities/cmliblzma/liblzma/rangecoder/range_common.h +++ b/Utilities/cmliblzma/liblzma/rangecoder/range_common.h @@ -40,8 +40,11 @@ // This does the same for a complete bit tree. // (A tree represented as an array.) #define bittree_reset(probs, bit_levels) \ - for (uint32_t bt_i = 0; bt_i < (1 << (bit_levels)); ++bt_i) \ - bit_reset((probs)[bt_i]) + do { \ + uint32_t bt_i; \ + for (bt_i = 0; bt_i < (1 << (bit_levels)); ++bt_i) \ + bit_reset((probs)[bt_i]); \ + } while (0) ////////////////////// diff --git a/Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h b/Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h index 1e1c369..e9614f2 100644 --- a/Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h +++ b/Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h @@ -115,7 +115,8 @@ rc_direct(lzma_range_encoder *rc, static inline void rc_flush(lzma_range_encoder *rc) { - for (size_t i = 0; i < 5; ++i) + size_t i; + for (i = 0; i < 5; ++i) rc->symbols[rc->count++] = RC_FLUSH; } diff --git a/Utilities/cmliblzma/liblzma/simple/arm.c b/Utilities/cmliblzma/liblzma/simple/arm.c index a84702a..8dcba39 100644 --- a/Utilities/cmliblzma/liblzma/simple/arm.c +++ b/Utilities/cmliblzma/liblzma/simple/arm.c @@ -22,12 +22,12 @@ arm_code(lzma_simple *simple lzma_attribute((__unused__)), size_t i; for (i = 0; i + 4 <= size; i += 4) { if (buffer[i + 3] == 0xEB) { + uint32_t dest; uint32_t src = (buffer[i + 2] << 16) | (buffer[i + 1] << 8) | (buffer[i + 0]); src <<= 2; - uint32_t dest; if (is_encoder) dest = now_pos + (uint32_t)(i) + 8 + src; else diff --git a/Utilities/cmliblzma/liblzma/simple/armthumb.c b/Utilities/cmliblzma/liblzma/simple/armthumb.c index 4b49175..4b890a3 100644 --- a/Utilities/cmliblzma/liblzma/simple/armthumb.c +++ b/Utilities/cmliblzma/liblzma/simple/armthumb.c @@ -23,6 +23,7 @@ armthumb_code(lzma_simple *simple lzma_attribute((__unused__)), for (i = 0; i + 4 <= size; i += 2) { if ((buffer[i + 1] & 0xF8) == 0xF0 && (buffer[i + 3] & 0xF8) == 0xF8) { + uint32_t dest; uint32_t src = ((buffer[i + 1] & 0x7) << 19) | (buffer[i + 0] << 11) | ((buffer[i + 3] & 0x7) << 8) @@ -30,7 +31,6 @@ armthumb_code(lzma_simple *simple lzma_attribute((__unused__)), src <<= 1; - uint32_t dest; if (is_encoder) dest = now_pos + (uint32_t)(i) + 4 + src; else diff --git a/Utilities/cmliblzma/liblzma/simple/ia64.c b/Utilities/cmliblzma/liblzma/simple/ia64.c index ce3692b..c537cac 100644 --- a/Utilities/cmliblzma/liblzma/simple/ia64.c +++ b/Utilities/cmliblzma/liblzma/simple/ia64.c @@ -28,36 +28,42 @@ ia64_code(lzma_simple *simple lzma_attribute((__unused__)), size_t i; for (i = 0; i + 16 <= size; i += 16) { + size_t slot; + const uint32_t instr_template = buffer[i] & 0x1F; const uint32_t mask = BRANCH_TABLE[instr_template]; uint32_t bit_pos = 5; - for (size_t slot = 0; slot < 3; ++slot, bit_pos += 41) { - if (((mask >> slot) & 1) == 0) - continue; - + for (slot = 0; slot < 3; ++slot, bit_pos += 41) { const size_t byte_pos = (bit_pos >> 3); const uint32_t bit_res = bit_pos & 0x7; uint64_t instruction = 0; + uint64_t inst_norm; + size_t j; + + if (((mask >> slot) & 1) == 0) + continue; - for (size_t j = 0; j < 6; ++j) + for (j = 0; j < 6; ++j) instruction += (uint64_t)( buffer[i + j + byte_pos]) << (8 * j); - uint64_t inst_norm = instruction >> bit_res; + inst_norm = instruction >> bit_res; if (((inst_norm >> 37) & 0xF) == 0x5 && ((inst_norm >> 9) & 0x7) == 0 /* && (inst_norm & 0x3F)== 0 */ ) { + uint32_t dest; + size_t j; + uint32_t src = (uint32_t)( (inst_norm >> 13) & 0xFFFFF); src |= ((inst_norm >> 36) & 1) << 20; src <<= 4; - uint32_t dest; if (is_encoder) dest = now_pos + (uint32_t)(i) + src; else @@ -73,7 +79,7 @@ ia64_code(lzma_simple *simple lzma_attribute((__unused__)), instruction &= (1 << bit_res) - 1; instruction |= (inst_norm << bit_res); - for (size_t j = 0; j < 6; j++) + for (j = 0; j < 6; j++) buffer[i + j + byte_pos] = (uint8_t)( instruction >> (8 * j)); diff --git a/Utilities/cmliblzma/liblzma/simple/simple_coder.c b/Utilities/cmliblzma/liblzma/simple/simple_coder.c index a02b039..d147d4b 100644 --- a/Utilities/cmliblzma/liblzma/simple/simple_coder.c +++ b/Utilities/cmliblzma/liblzma/simple/simple_coder.c @@ -71,6 +71,9 @@ simple_code(lzma_coder *coder, lzma_allocator *allocator, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_action action) { + size_t out_avail; + size_t buf_avail; + // TODO: Add partial support for LZMA_SYNC_FLUSH. We can support it // in cases when the filter is able to filter everything. With most // simple filters it can be done at offset that is a multiple of 2, @@ -105,9 +108,13 @@ simple_code(lzma_coder *coder, lzma_allocator *allocator, // more data to out[] hopefully filling it completely. Then filter // the data in out[]. This step is where most of the data gets // filtered if the buffer sizes used by the application are reasonable. - const size_t out_avail = out_size - *out_pos; - const size_t buf_avail = coder->size - coder->pos; + out_avail = out_size - *out_pos; + buf_avail = coder->size - coder->pos; if (out_avail > buf_avail || buf_avail == 0) { + size_t size; + size_t filtered; + size_t unfiltered; + // Store the old position so that we know from which byte // to start filtering. const size_t out_start = *out_pos; @@ -130,11 +137,10 @@ simple_code(lzma_coder *coder, lzma_allocator *allocator, } // Filter out[]. - const size_t size = *out_pos - out_start; - const size_t filtered = call_filter( - coder, out + out_start, size); + size = *out_pos - out_start; + filtered = call_filter(coder, out + out_start, size); - const size_t unfiltered = size - filtered; + unfiltered = size - filtered; assert(unfiltered <= coder->allocated / 2); // Now we can update coder->pos and coder->size, because diff --git a/Utilities/cmliblzma/liblzma/simple/simple_decoder.c b/Utilities/cmliblzma/liblzma/simple/simple_decoder.c index 0beccd3..034e158 100644 --- a/Utilities/cmliblzma/liblzma/simple/simple_decoder.c +++ b/Utilities/cmliblzma/liblzma/simple/simple_decoder.c @@ -17,14 +17,15 @@ extern lzma_ret lzma_simple_props_decode(void **options, lzma_allocator *allocator, const uint8_t *props, size_t props_size) { + lzma_options_bcj *opt; + if (props_size == 0) return LZMA_OK; if (props_size != 4) return LZMA_OPTIONS_ERROR; - lzma_options_bcj *opt = lzma_alloc( - sizeof(lzma_options_bcj), allocator); + opt = lzma_alloc(sizeof(lzma_options_bcj), allocator); if (opt == NULL) return LZMA_MEM_ERROR; diff --git a/Utilities/cmliblzma/liblzma/simple/sparc.c b/Utilities/cmliblzma/liblzma/simple/sparc.c index 8270d6a..0ddd2ac 100644 --- a/Utilities/cmliblzma/liblzma/simple/sparc.c +++ b/Utilities/cmliblzma/liblzma/simple/sparc.c @@ -26,6 +26,8 @@ sparc_code(lzma_simple *simple lzma_attribute((__unused__)), || (buffer[i] == 0x7F && (buffer[i + 1] & 0xC0) == 0xC0)) { + uint32_t dest; + uint32_t src = ((uint32_t)buffer[i + 0] << 24) | ((uint32_t)buffer[i + 1] << 16) | ((uint32_t)buffer[i + 2] << 8) @@ -33,7 +35,6 @@ sparc_code(lzma_simple *simple lzma_attribute((__unused__)), src <<= 2; - uint32_t dest; if (is_encoder) dest = now_pos + (uint32_t)(i) + src; else diff --git a/Utilities/cmliblzma/liblzma/simple/x86.c b/Utilities/cmliblzma/liblzma/simple/x86.c index 5d1509b..101d8ed 100644 --- a/Utilities/cmliblzma/liblzma/simple/x86.c +++ b/Utilities/cmliblzma/liblzma/simple/x86.c @@ -36,30 +36,36 @@ x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder, uint32_t prev_mask = simple->prev_mask; uint32_t prev_pos = simple->prev_pos; + size_t limit; + size_t buffer_pos; + if (size < 5) return 0; if (now_pos - prev_pos > 5) prev_pos = now_pos - 5; - const size_t limit = size - 5; - size_t buffer_pos = 0; + limit = size - 5; + buffer_pos = 0; while (buffer_pos <= limit) { + uint32_t offset; + uint32_t i; + uint8_t b = buffer[buffer_pos]; if (b != 0xE8 && b != 0xE9) { ++buffer_pos; continue; } - const uint32_t offset = now_pos + (uint32_t)(buffer_pos) + offset = now_pos + (uint32_t)(buffer_pos) - prev_pos; prev_pos = now_pos + (uint32_t)(buffer_pos); if (offset > 5) { prev_mask = 0; } else { - for (uint32_t i = 0; i < offset; ++i) { + for (i = 0; i < offset; ++i) { prev_mask &= 0x77; prev_mask <<= 1; } @@ -78,6 +84,8 @@ x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder, uint32_t dest; while (true) { + uint32_t i; + if (is_encoder) dest = src + (now_pos + (uint32_t)( buffer_pos) + 5); @@ -88,8 +96,7 @@ x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder, if (prev_mask == 0) break; - const uint32_t i = MASK_TO_BIT_NUMBER[ - prev_mask >> 1]; + i = MASK_TO_BIT_NUMBER[prev_mask >> 1]; b = (uint8_t)(dest >> (24 - i * 8)); ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 08:52:09 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 08:52:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1538-g4d574ee Message-ID: <20140729125209.BAD4C4B6BA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 4d574ee3a1a8dcc54835d90d7eab55677deb4cfb (commit) via 65a0ea456d5d92644fe67bbbcbe973df3f111822 (commit) via 8436d18115a9d997fb92fc7a019da1f28646a2f8 (commit) via 73eab246fbfad22bcc1b0bb5599f8e0cffb79c0d (commit) via 90e7a4d41f588d87415381fdb507735e6438992c (commit) via c20b45027e8288114fd6ee33f99218440b60da77 (commit) via 7a92eddbcb2b2e6419062538e346908f0e502586 (commit) via b2a07ca49c66665f5b51b592f44ecc4f66c7556b (commit) via d44ad1612bfe01891bb16b4289f5fa5a2e29a546 (commit) via a53caea3b6609f94063dfc21cbdf5361e9145040 (commit) via 133d42fe59e2f15610afaed287ef80ec4ff6f888 (commit) via c289e63491982dd8aed7c6b6f54d390df91aaf95 (commit) via 8510533f0e713abeedf53a737c702d683b636ecb (commit) from b6acd96f7fbe4df80e3735b101271cb801ba375a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4d574ee3a1a8dcc54835d90d7eab55677deb4cfb commit 4d574ee3a1a8dcc54835d90d7eab55677deb4cfb Merge: b6acd96 65a0ea4 Author: Brad King AuthorDate: Tue Jul 29 08:52:08 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 08:52:08 2014 -0400 Merge topic 'add-liblzma' 65a0ea45 Help: Add notes for topic 'add-liblzma' 8436d181 CMake: Enable use of liblzma in libarchive (#14504) 73eab246 liblzma: Avoid defining a 'restrict' macro 90e7a4d4 liblzma: Disable warnings to avoid changing 3rd party code c20b4502 liblzma: Port to VS 6, 7.0 7a92eddb liblzma: Port from C99 to C89/90 b2a07ca4 liblzma: Add CMake build system d44ad161 liblzma: Remove unused Makefile.* files a53caea3 liblzma: Add README-CMake.txt 133d42fe Merge branch 'liblzma-upstream' into add-liblzma c289e634 liblzma 5.0.5-gb69900ed (reduced) 8510533f liblzma: Add .gitattributes to ignore whitespace checks ----------------------------------------------------------------------- Summary of changes: CMakeLists.txt | 23 +- Help/release/dev/add-liblzma.rst | 5 + Utilities/cmThirdParty.h.in | 1 + Utilities/{cmThirdParty.h.in => cm_lzma.h} | 20 +- Utilities/cmlibarchive/CMakeLists.txt | 22 +- .../libarchive/archive_read_support_filter_xz.c | 2 +- .../libarchive/archive_read_support_format_7zip.c | 2 +- .../libarchive/archive_read_support_format_xar.c | 2 +- Utilities/cmlibarchive/libarchive/archive_util.c | 2 +- .../cmlibarchive/libarchive/archive_windows.h | 1 + .../libarchive/archive_write_add_filter_xz.c | 2 +- .../libarchive/archive_write_set_format_7zip.c | 2 +- .../libarchive/archive_write_set_format_xar.c | 2 +- .../{cmlibarchive => cmliblzma}/.gitattributes | 0 Utilities/cmliblzma/CMakeLists.txt | 205 ++++ Utilities/cmliblzma/COPYING | 65 + Utilities/cmliblzma/README-CMake.txt | 66 + Utilities/cmliblzma/common/common_w32res.rc | 50 + Utilities/cmliblzma/common/sysdefs.h | 202 ++++ Utilities/cmliblzma/common/tuklib_integer.h | 514 ++++++++ Utilities/cmliblzma/config.h.in | 285 +++++ Utilities/cmliblzma/liblzma/api/lzma.h | 313 +++++ Utilities/cmliblzma/liblzma/api/lzma/base.h | 601 +++++++++ Utilities/cmliblzma/liblzma/api/lzma/bcj.h | 90 ++ Utilities/cmliblzma/liblzma/api/lzma/block.h | 530 ++++++++ Utilities/cmliblzma/liblzma/api/lzma/check.h | 150 +++ Utilities/cmliblzma/liblzma/api/lzma/container.h | 424 +++++++ Utilities/cmliblzma/liblzma/api/lzma/delta.h | 77 ++ Utilities/cmliblzma/liblzma/api/lzma/filter.h | 424 +++++++ Utilities/cmliblzma/liblzma/api/lzma/hardware.h | 50 + Utilities/cmliblzma/liblzma/api/lzma/index.h | 682 +++++++++++ Utilities/cmliblzma/liblzma/api/lzma/index_hash.h | 107 ++ Utilities/cmliblzma/liblzma/api/lzma/lzma.h | 420 +++++++ .../cmliblzma/liblzma/api/lzma/stream_flags.h | 223 ++++ Utilities/cmliblzma/liblzma/api/lzma/version.h | 121 ++ Utilities/cmliblzma/liblzma/api/lzma/vli.h | 166 +++ Utilities/cmliblzma/liblzma/check/check.c | 174 +++ Utilities/cmliblzma/liblzma/check/check.h | 95 ++ Utilities/cmliblzma/liblzma/check/crc32_fast.c | 86 ++ Utilities/cmliblzma/liblzma/check/crc32_small.c | 61 + Utilities/cmliblzma/liblzma/check/crc32_table.c | 19 + Utilities/cmliblzma/liblzma/check/crc32_table_be.h | 525 ++++++++ Utilities/cmliblzma/liblzma/check/crc32_table_le.h | 525 ++++++++ Utilities/cmliblzma/liblzma/check/crc32_tablegen.c | 117 ++ Utilities/cmliblzma/liblzma/check/crc32_x86.S | 304 +++++ Utilities/cmliblzma/liblzma/check/crc64_fast.c | 74 ++ Utilities/cmliblzma/liblzma/check/crc64_small.c | 53 + Utilities/cmliblzma/liblzma/check/crc64_table.c | 19 + Utilities/cmliblzma/liblzma/check/crc64_table_be.h | 521 ++++++++ Utilities/cmliblzma/liblzma/check/crc64_table_le.h | 521 ++++++++ Utilities/cmliblzma/liblzma/check/crc64_tablegen.c | 88 ++ Utilities/cmliblzma/liblzma/check/crc64_x86.S | 287 +++++ Utilities/cmliblzma/liblzma/check/crc_macros.h | 30 + Utilities/cmliblzma/liblzma/check/sha256.c | 208 ++++ Utilities/cmliblzma/liblzma/common/alone_decoder.c | 236 ++++ Utilities/cmliblzma/liblzma/common/alone_decoder.h | 23 + Utilities/cmliblzma/liblzma/common/alone_encoder.c | 155 +++ Utilities/cmliblzma/liblzma/common/auto_decoder.c | 186 +++ .../liblzma/common/block_buffer_decoder.c | 82 ++ .../liblzma/common/block_buffer_encoder.c | 315 +++++ Utilities/cmliblzma/liblzma/common/block_decoder.c | 242 ++++ Utilities/cmliblzma/liblzma/common/block_decoder.h | 22 + Utilities/cmliblzma/liblzma/common/block_encoder.c | 217 ++++ Utilities/cmliblzma/liblzma/common/block_encoder.h | 47 + .../liblzma/common/block_header_decoder.c | 121 ++ .../liblzma/common/block_header_encoder.c | 137 +++ Utilities/cmliblzma/liblzma/common/block_util.c | 95 ++ Utilities/cmliblzma/liblzma/common/common.c | 390 ++++++ Utilities/cmliblzma/liblzma/common/common.h | 305 +++++ .../cmliblzma/liblzma/common/easy_buffer_encoder.c | 27 + .../liblzma/common/easy_decoder_memusage.c | 24 + Utilities/cmliblzma/liblzma/common/easy_encoder.c | 25 + .../liblzma/common/easy_encoder_memusage.c | 24 + Utilities/cmliblzma/liblzma/common/easy_preset.c | 27 + Utilities/cmliblzma/liblzma/common/easy_preset.h | 32 + .../liblzma/common/filter_buffer_decoder.c | 91 ++ .../liblzma/common/filter_buffer_encoder.c | 57 + Utilities/cmliblzma/liblzma/common/filter_common.c | 342 ++++++ Utilities/cmliblzma/liblzma/common/filter_common.h | 48 + .../cmliblzma/liblzma/common/filter_decoder.c | 185 +++ .../cmliblzma/liblzma/common/filter_decoder.h | 23 + .../cmliblzma/liblzma/common/filter_encoder.c | 297 +++++ .../cmliblzma/liblzma/common/filter_encoder.h | 27 + .../liblzma/common/filter_flags_decoder.c | 48 + .../liblzma/common/filter_flags_encoder.c | 57 + .../cmliblzma/liblzma/common/hardware_physmem.c | 25 + Utilities/cmliblzma/liblzma/common/index.c | 1276 ++++++++++++++++++++ Utilities/cmliblzma/liblzma/common/index.h | 73 ++ Utilities/cmliblzma/liblzma/common/index_decoder.c | 347 ++++++ Utilities/cmliblzma/liblzma/common/index_encoder.c | 257 ++++ Utilities/cmliblzma/liblzma/common/index_encoder.h | 23 + Utilities/cmliblzma/liblzma/common/index_hash.c | 336 ++++++ .../liblzma/common/stream_buffer_decoder.c | 93 ++ .../liblzma/common/stream_buffer_encoder.c | 140 +++ .../cmliblzma/liblzma/common/stream_decoder.c | 459 +++++++ .../cmliblzma/liblzma/common/stream_decoder.h | 21 + .../cmliblzma/liblzma/common/stream_encoder.c | 338 ++++++ .../cmliblzma/liblzma/common/stream_encoder.h | 23 + .../cmliblzma/liblzma/common/stream_flags_common.c | 47 + .../cmliblzma/liblzma/common/stream_flags_common.h | 33 + .../liblzma/common/stream_flags_decoder.c | 86 ++ .../liblzma/common/stream_flags_encoder.c | 90 ++ Utilities/cmliblzma/liblzma/common/vli_decoder.c | 86 ++ Utilities/cmliblzma/liblzma/common/vli_encoder.c | 69 ++ Utilities/cmliblzma/liblzma/common/vli_size.c | 31 + Utilities/cmliblzma/liblzma/delta/delta_common.c | 72 ++ Utilities/cmliblzma/liblzma/delta/delta_common.h | 20 + Utilities/cmliblzma/liblzma/delta/delta_decoder.c | 79 ++ Utilities/cmliblzma/liblzma/delta/delta_decoder.h | 25 + Utilities/cmliblzma/liblzma/delta/delta_encoder.c | 124 ++ Utilities/cmliblzma/liblzma/delta/delta_encoder.h | 23 + Utilities/cmliblzma/liblzma/delta/delta_private.h | 37 + Utilities/cmliblzma/liblzma/liblzma.pc.in | 19 + Utilities/cmliblzma/liblzma/liblzma_w32res.rc | 14 + Utilities/cmliblzma/liblzma/lz/lz_decoder.c | 307 +++++ Utilities/cmliblzma/liblzma/lz/lz_decoder.h | 236 ++++ Utilities/cmliblzma/liblzma/lz/lz_encoder.c | 594 +++++++++ Utilities/cmliblzma/liblzma/lz/lz_encoder.h | 328 +++++ Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h | 105 ++ .../cmliblzma/liblzma/lz/lz_encoder_hash_table.h | 68 ++ Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c | 814 +++++++++++++ Utilities/cmliblzma/liblzma/lzma/fastpos.h | 142 +++ Utilities/cmliblzma/liblzma/lzma/fastpos_table.c | 519 ++++++++ .../cmliblzma/liblzma/lzma/fastpos_tablegen.c | 56 + Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c | 305 +++++ Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.h | 28 + Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c | 399 ++++++ Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.h | 41 + Utilities/cmliblzma/liblzma/lzma/lzma_common.h | 226 ++++ Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c | 1075 +++++++++++++++++ Utilities/cmliblzma/liblzma/lzma/lzma_decoder.h | 52 + Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c | 695 +++++++++++ Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h | 54 + .../liblzma/lzma/lzma_encoder_optimum_fast.c | 185 +++ .../liblzma/lzma/lzma_encoder_optimum_normal.c | 925 ++++++++++++++ .../cmliblzma/liblzma/lzma/lzma_encoder_presets.c | 63 + .../cmliblzma/liblzma/lzma/lzma_encoder_private.h | 148 +++ Utilities/cmliblzma/liblzma/rangecoder/price.h | 92 ++ .../cmliblzma/liblzma/rangecoder/price_table.c | 22 + .../cmliblzma/liblzma/rangecoder/price_tablegen.c | 87 ++ .../cmliblzma/liblzma/rangecoder/range_common.h | 74 ++ .../cmliblzma/liblzma/rangecoder/range_decoder.h | 179 +++ .../cmliblzma/liblzma/rangecoder/range_encoder.h | 232 ++++ Utilities/cmliblzma/liblzma/simple/arm.c | 69 ++ Utilities/cmliblzma/liblzma/simple/armthumb.c | 74 ++ Utilities/cmliblzma/liblzma/simple/ia64.c | 116 ++ Utilities/cmliblzma/liblzma/simple/powerpc.c | 73 ++ Utilities/cmliblzma/liblzma/simple/simple_coder.c | 283 +++++ Utilities/cmliblzma/liblzma/simple/simple_coder.h | 60 + .../cmliblzma/liblzma/simple/simple_decoder.c | 41 + .../cmliblzma/liblzma/simple/simple_decoder.h | 22 + .../cmliblzma/liblzma/simple/simple_encoder.c | 38 + .../cmliblzma/liblzma/simple/simple_encoder.h | 23 + .../cmliblzma/liblzma/simple/simple_private.h | 75 ++ Utilities/cmliblzma/liblzma/simple/sparc.c | 82 ++ Utilities/cmliblzma/liblzma/simple/x86.c | 161 +++ 156 files changed, 26871 insertions(+), 28 deletions(-) create mode 100644 Help/release/dev/add-liblzma.rst copy Utilities/{cmThirdParty.h.in => cm_lzma.h} (57%) copy Utilities/{cmlibarchive => cmliblzma}/.gitattributes (100%) create mode 100644 Utilities/cmliblzma/CMakeLists.txt create mode 100644 Utilities/cmliblzma/COPYING create mode 100644 Utilities/cmliblzma/README-CMake.txt create mode 100644 Utilities/cmliblzma/common/common_w32res.rc create mode 100644 Utilities/cmliblzma/common/sysdefs.h create mode 100644 Utilities/cmliblzma/common/tuklib_integer.h create mode 100644 Utilities/cmliblzma/config.h.in create mode 100644 Utilities/cmliblzma/liblzma/api/lzma.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/base.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/bcj.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/block.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/check.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/container.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/delta.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/filter.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/hardware.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/index.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/index_hash.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/lzma.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/stream_flags.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/version.h create mode 100644 Utilities/cmliblzma/liblzma/api/lzma/vli.h create mode 100644 Utilities/cmliblzma/liblzma/check/check.c create mode 100644 Utilities/cmliblzma/liblzma/check/check.h create mode 100644 Utilities/cmliblzma/liblzma/check/crc32_fast.c create mode 100644 Utilities/cmliblzma/liblzma/check/crc32_small.c create mode 100644 Utilities/cmliblzma/liblzma/check/crc32_table.c create mode 100644 Utilities/cmliblzma/liblzma/check/crc32_table_be.h create mode 100644 Utilities/cmliblzma/liblzma/check/crc32_table_le.h create mode 100644 Utilities/cmliblzma/liblzma/check/crc32_tablegen.c create mode 100644 Utilities/cmliblzma/liblzma/check/crc32_x86.S create mode 100644 Utilities/cmliblzma/liblzma/check/crc64_fast.c create mode 100644 Utilities/cmliblzma/liblzma/check/crc64_small.c create mode 100644 Utilities/cmliblzma/liblzma/check/crc64_table.c create mode 100644 Utilities/cmliblzma/liblzma/check/crc64_table_be.h create mode 100644 Utilities/cmliblzma/liblzma/check/crc64_table_le.h create mode 100644 Utilities/cmliblzma/liblzma/check/crc64_tablegen.c create mode 100644 Utilities/cmliblzma/liblzma/check/crc64_x86.S create mode 100644 Utilities/cmliblzma/liblzma/check/crc_macros.h create mode 100644 Utilities/cmliblzma/liblzma/check/sha256.c create mode 100644 Utilities/cmliblzma/liblzma/common/alone_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/alone_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/common/alone_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/auto_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/block_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/block_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/common/block_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/block_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/common/block_header_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/block_header_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/block_util.c create mode 100644 Utilities/cmliblzma/liblzma/common/common.c create mode 100644 Utilities/cmliblzma/liblzma/common/common.h create mode 100644 Utilities/cmliblzma/liblzma/common/easy_buffer_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/easy_decoder_memusage.c create mode 100644 Utilities/cmliblzma/liblzma/common/easy_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/easy_encoder_memusage.c create mode 100644 Utilities/cmliblzma/liblzma/common/easy_preset.c create mode 100644 Utilities/cmliblzma/liblzma/common/easy_preset.h create mode 100644 Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/filter_common.c create mode 100644 Utilities/cmliblzma/liblzma/common/filter_common.h create mode 100644 Utilities/cmliblzma/liblzma/common/filter_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/filter_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/common/filter_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/filter_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/hardware_physmem.c create mode 100644 Utilities/cmliblzma/liblzma/common/index.c create mode 100644 Utilities/cmliblzma/liblzma/common/index.h create mode 100644 Utilities/cmliblzma/liblzma/common/index_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/index_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/index_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/common/index_hash.c create mode 100644 Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/stream_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/stream_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/common/stream_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/stream_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/common/stream_flags_common.c create mode 100644 Utilities/cmliblzma/liblzma/common/stream_flags_common.h create mode 100644 Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/vli_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/vli_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/common/vli_size.c create mode 100644 Utilities/cmliblzma/liblzma/delta/delta_common.c create mode 100644 Utilities/cmliblzma/liblzma/delta/delta_common.h create mode 100644 Utilities/cmliblzma/liblzma/delta/delta_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/delta/delta_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/delta/delta_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/delta/delta_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/delta/delta_private.h create mode 100644 Utilities/cmliblzma/liblzma/liblzma.pc.in create mode 100644 Utilities/cmliblzma/liblzma/liblzma_w32res.rc create mode 100644 Utilities/cmliblzma/liblzma/lz/lz_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/lz/lz_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/lz/lz_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/lz/lz_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h create mode 100644 Utilities/cmliblzma/liblzma/lz/lz_encoder_hash_table.h create mode 100644 Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/fastpos.h create mode 100644 Utilities/cmliblzma/liblzma/lzma/fastpos_table.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/fastpos_tablegen.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_common.h create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c create mode 100644 Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h create mode 100644 Utilities/cmliblzma/liblzma/rangecoder/price.h create mode 100644 Utilities/cmliblzma/liblzma/rangecoder/price_table.c create mode 100644 Utilities/cmliblzma/liblzma/rangecoder/price_tablegen.c create mode 100644 Utilities/cmliblzma/liblzma/rangecoder/range_common.h create mode 100644 Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/simple/arm.c create mode 100644 Utilities/cmliblzma/liblzma/simple/armthumb.c create mode 100644 Utilities/cmliblzma/liblzma/simple/ia64.c create mode 100644 Utilities/cmliblzma/liblzma/simple/powerpc.c create mode 100644 Utilities/cmliblzma/liblzma/simple/simple_coder.c create mode 100644 Utilities/cmliblzma/liblzma/simple/simple_coder.h create mode 100644 Utilities/cmliblzma/liblzma/simple/simple_decoder.c create mode 100644 Utilities/cmliblzma/liblzma/simple/simple_decoder.h create mode 100644 Utilities/cmliblzma/liblzma/simple/simple_encoder.c create mode 100644 Utilities/cmliblzma/liblzma/simple/simple_encoder.h create mode 100644 Utilities/cmliblzma/liblzma/simple/simple_private.h create mode 100644 Utilities/cmliblzma/liblzma/simple/sparc.c create mode 100644 Utilities/cmliblzma/liblzma/simple/x86.c hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 08:52:12 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 08:52:12 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1540-g3574689 Message-ID: <20140729125212.163224B6C3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 35746899a32de0b4f4ee2c0586d399a06b633421 (commit) via 4b5052b0cd37e8896966ee2ce3040e1a8ded64e4 (commit) from 4d574ee3a1a8dcc54835d90d7eab55677deb4cfb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=35746899a32de0b4f4ee2c0586d399a06b633421 commit 35746899a32de0b4f4ee2c0586d399a06b633421 Merge: 4d574ee 4b5052b Author: Brad King AuthorDate: Tue Jul 29 08:52:11 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 08:52:11 2014 -0400 Merge topic 'FindQt4-more-plugins' 4b5052b0 FindQt4: Add nativewifi and qtga plugins ----------------------------------------------------------------------- Summary of changes: Modules/FindQt4.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 08:52:14 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 08:52:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1542-ge869886 Message-ID: <20140729125214.7ECA84B6C6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via e8698861c69c3159aaa353af1e016aa7a387283a (commit) via 5b4faeefe36fd775fd60f98aedf0cc35202f99f4 (commit) from 35746899a32de0b4f4ee2c0586d399a06b633421 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e8698861c69c3159aaa353af1e016aa7a387283a commit e8698861c69c3159aaa353af1e016aa7a387283a Merge: 3574689 5b4faee Author: Brad King AuthorDate: Tue Jul 29 08:52:13 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 08:52:13 2014 -0400 Merge topic 'osx-no-sysroot-for-deployment' 5b4faeef OS X: Allow deployment target with "/" sysroot (#15040) ----------------------------------------------------------------------- Summary of changes: Modules/Platform/Darwin.cmake | 2 ++ 1 file changed, 2 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 08:52:16 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 08:52:16 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1544-g99a9034 Message-ID: <20140729125216.47DF74B6D0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 99a9034759c562ebad9be6e9b1fa111c3cb97daf (commit) via 8c03f157765256113928edb5e58ef3a5cf82125c (commit) from e8698861c69c3159aaa353af1e016aa7a387283a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=99a9034759c562ebad9be6e9b1fa111c3cb97daf commit 99a9034759c562ebad9be6e9b1fa111c3cb97daf Merge: e869886 8c03f15 Author: Brad King AuthorDate: Tue Jul 29 08:52:15 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 08:52:15 2014 -0400 Merge topic 'doc-tll-flags' 8c03f157 Help: Clarify target_link_libraries treatment of flags (#15034) ----------------------------------------------------------------------- Summary of changes: Help/command/target_link_libraries.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 08:52:18 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 08:52:18 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1546-g05d064f Message-ID: <20140729125218.548344B6C7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 05d064fec3ad47a39ac62f9a579472aa238c3f24 (commit) via 608cf8149ccbf8954926ab7c86fd658099a52f7b (commit) from 99a9034759c562ebad9be6e9b1fa111c3cb97daf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=05d064fec3ad47a39ac62f9a579472aa238c3f24 commit 05d064fec3ad47a39ac62f9a579472aa238c3f24 Merge: 99a9034 608cf81 Author: Brad King AuthorDate: Tue Jul 29 08:52:17 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 08:52:17 2014 -0400 Merge topic 'xcode-6-librarian-flags' 608cf814 Xcode: Fix static library creation for Xcode 6 (#15038) ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalXCodeGenerator.cxx | 28 +++++++++++++++++++++++----- Source/cmGlobalXCodeGenerator.h | 1 + 2 files changed, 24 insertions(+), 5 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 08:52:20 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 08:52:20 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1548-gb5728f5 Message-ID: <20140729125220.8C4ED4B6C4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via b5728f555d88fff4b014c44d4ebd4860980dbdbe (commit) via 9e5e7e71c5b34f442be4008daf7be7e33438556a (commit) from 05d064fec3ad47a39ac62f9a579472aa238c3f24 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b5728f555d88fff4b014c44d4ebd4860980dbdbe commit b5728f555d88fff4b014c44d4ebd4860980dbdbe Merge: 05d064f 9e5e7e7 Author: Brad King AuthorDate: Tue Jul 29 08:52:19 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 08:52:19 2014 -0400 Merge topic 'fix-qthelp-windows' 9e5e7e71 Help: Fix QtHelp commands on Windows ----------------------------------------------------------------------- Summary of changes: Utilities/Sphinx/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 08:52:22 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 08:52:22 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1552-g8cd83e0 Message-ID: <20140729125222.5A90C4B6C7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 8cd83e0b71b71e30bdef81e275278f64abe42ce0 (commit) via 7079f33d6ac00f9417d2d7aa222c8d0675ce3752 (commit) via 05373f7ea79f950bf56657e6b5aabb02b34d4c76 (commit) via 1acde6b003812e9964bdf67db5c1ce68a566e675 (commit) from b5728f555d88fff4b014c44d4ebd4860980dbdbe (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8cd83e0b71b71e30bdef81e275278f64abe42ce0 commit 8cd83e0b71b71e30bdef81e275278f64abe42ce0 Merge: b5728f5 7079f33 Author: Brad King AuthorDate: Tue Jul 29 08:52:21 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 08:52:21 2014 -0400 Merge topic 'windows-ce-cleanup' 7079f33d WindowsCE: Drop unused Platform/WindowsCE-MSVC module 05373f7e WindowsCE: Refactor setting of "WINCE" 1acde6b0 MSVC: Use STREQUAL to check for WindowsCE ----------------------------------------------------------------------- Summary of changes: Modules/Platform/Windows-MSVC.cmake | 5 +---- Modules/Platform/Windows.cmake | 4 ++++ Modules/Platform/WindowsCE-MSVC.cmake | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 Modules/Platform/WindowsCE-MSVC.cmake hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 08:52:24 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 08:52:24 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1554-g104a4cb Message-ID: <20140729125224.26DAC4B6CB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 104a4cb783b7381452c3eff8bdefe8c985079f2e (commit) via 99e14a3865f96371284daef463df5e261b5698e3 (commit) from 8cd83e0b71b71e30bdef81e275278f64abe42ce0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=104a4cb783b7381452c3eff8bdefe8c985079f2e commit 104a4cb783b7381452c3eff8bdefe8c985079f2e Merge: 8cd83e0 99e14a3 Author: Brad King AuthorDate: Tue Jul 29 08:52:23 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 08:52:23 2014 -0400 Merge topic 'vs10-comment-typo' 99e14a38 cmGlobalVisualStudio10Generator: Fix typo KHLM => HKLM ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalVisualStudio10Generator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 08:52:25 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 08:52:25 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1557-g3806556 Message-ID: <20140729125225.ECFCF4B6C7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 38065563b6fb0093004d0c89b5de0f82a76b5a31 (commit) via e58f97531aa6e2a124540f38b5acd18fd989cf3b (commit) via d0dd28fa92cb2223e20f3586b8973a931aa61dac (commit) from 104a4cb783b7381452c3eff8bdefe8c985079f2e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=38065563b6fb0093004d0c89b5de0f82a76b5a31 commit 38065563b6fb0093004d0c89b5de0f82a76b5a31 Merge: 104a4cb e58f975 Author: Brad King AuthorDate: Tue Jul 29 08:52:24 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 08:52:24 2014 -0400 Merge topic 'vs10-system-hook' e58f9753 VS: Add a hook to adapt to SystemName and SystemVersion d0dd28fa VS: Save system name and version in global generator members ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalVisualStudio10Generator.cxx | 12 ++++++++++++ Source/cmGlobalVisualStudio10Generator.h | 3 +++ 2 files changed, 15 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 08:52:56 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 08:52:56 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4595-gc1f4dd4 Message-ID: <20140729125256.D44824B6D1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via c1f4dd4d54b26dcc13dd8f1d5c363a0dc1cf0058 (commit) via 38065563b6fb0093004d0c89b5de0f82a76b5a31 (commit) via 104a4cb783b7381452c3eff8bdefe8c985079f2e (commit) via 8cd83e0b71b71e30bdef81e275278f64abe42ce0 (commit) via b5728f555d88fff4b014c44d4ebd4860980dbdbe (commit) via 05d064fec3ad47a39ac62f9a579472aa238c3f24 (commit) via 99a9034759c562ebad9be6e9b1fa111c3cb97daf (commit) via e8698861c69c3159aaa353af1e016aa7a387283a (commit) via 35746899a32de0b4f4ee2c0586d399a06b633421 (commit) via 4d574ee3a1a8dcc54835d90d7eab55677deb4cfb (commit) via b6acd96f7fbe4df80e3735b101271cb801ba375a (commit) from f8c3e8b576f845cadbaca6fb30c781c6534ab79c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c1f4dd4d54b26dcc13dd8f1d5c363a0dc1cf0058 commit c1f4dd4d54b26dcc13dd8f1d5c363a0dc1cf0058 Merge: f8c3e8b 3806556 Author: Brad King AuthorDate: Tue Jul 29 08:54:11 2014 -0400 Commit: Brad King CommitDate: Tue Jul 29 08:54:11 2014 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 09:20:55 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 09:20:55 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4597-g604c68e Message-ID: <20140729132055.9B4C74B47C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 604c68eb482c0dbeb83056e259ce61c3171c8a62 (commit) via 58e9f838ee2f28b7ac63f58c9b0e2489ecaa21ef (commit) from c1f4dd4d54b26dcc13dd8f1d5c363a0dc1cf0058 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=604c68eb482c0dbeb83056e259ce61c3171c8a62 commit 604c68eb482c0dbeb83056e259ce61c3171c8a62 Merge: c1f4dd4 58e9f83 Author: Brad King AuthorDate: Tue Jul 29 09:20:54 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 09:20:54 2014 -0400 Merge topic 'pdb-genex' into next 58e9f838 Genex: Revise RunCMake.GeneratorExpression PDB test cases http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=58e9f838ee2f28b7ac63f58c9b0e2489ecaa21ef commit 58e9f838ee2f28b7ac63f58c9b0e2489ecaa21ef Author: Brad King AuthorDate: Tue Jul 29 09:16:48 2014 -0400 Commit: Brad King CommitDate: Tue Jul 29 09:20:41 2014 -0400 Genex: Revise RunCMake.GeneratorExpression PDB test cases Use if(MSVC) as condition so it passes for Intel on Windows too. Add expected stderr in success case to ensure it is empty. diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 7ba44fb..2375ba6 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -7,7 +7,6 @@ macro(add_RunCMake_test test) -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test} - -DRunCMake_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID} ${${test}_ARGS} -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake" ) @@ -22,6 +21,10 @@ if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 2) set(File_Generate_ARGS -DXCODE_BELOW_2=1) endif() +if(MSVC) + set(GeneratorExpression_ARGS -DLINKER_SUPPORTS_PDB=1) +endif() + add_RunCMake_test(CMP0019) add_RunCMake_test(CMP0022) add_RunCMake_test(CMP0026) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index ca2d7ea..6c32393 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -17,11 +17,9 @@ run_cmake(NonValidTarget-CXX_COMPILER_VERSION) run_cmake(NonValidTarget-TARGET_PROPERTY) run_cmake(NonValidTarget-TARGET_POLICY) -if(RunCMake_CXX_COMPILER_ID MATCHES "MSVC") +if(LINKER_SUPPORTS_PDB) run_cmake(NonValidTarget-TARGET_PDB_FILE) run_cmake(ValidTarget-TARGET_PDB_FILE) -endif() - -if(NOT WIN32) +else() run_cmake(NonValidCompiler-TARGET_PDB_FILE) endif() diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1 @@ +^$ ----------------------------------------------------------------------- Summary of changes: Tests/RunCMake/CMakeLists.txt | 5 ++++- Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake | 6 ++---- .../ValidTarget-TARGET_PDB_FILE-stderr.txt} | 0 3 files changed, 6 insertions(+), 5 deletions(-) copy Tests/RunCMake/{CMP0022/CMP0022-NOWARN-exe-stderr.txt => GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt} (100%) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 09:23:02 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 09:23:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4600-g853867d Message-ID: <20140729132302.5C1204B513@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 853867d644671401af8bf8796e7a2f969f6038de (commit) via 164aa9f15b6f40c506264e1fa7987120bec72132 (commit) via 028ad31878d25dad055ed9588d81568b284a272e (commit) from 604c68eb482c0dbeb83056e259ce61c3171c8a62 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=853867d644671401af8bf8796e7a2f969f6038de commit 853867d644671401af8bf8796e7a2f969f6038de Merge: 604c68e 164aa9f Author: Brad King AuthorDate: Tue Jul 29 09:23:01 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 09:23:01 2014 -0400 Merge topic 'pdb-genex' into next 164aa9f1 Genex: Implement generator expressions for target PDB files. 028ad318 Genex: Simplify filesytem artifact code http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=164aa9f15b6f40c506264e1fa7987120bec72132 commit 164aa9f15b6f40c506264e1fa7987120bec72132 Author: Nils Gladitz AuthorDate: Thu Jul 24 22:18:21 2014 +0200 Commit: Brad King CommitDate: Tue Jul 29 09:21:55 2014 -0400 Genex: Implement generator expressions for target PDB files. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index bc24798..77259a0 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -148,6 +148,17 @@ than 4.2.0. Name of file with soname (.so.3). ``$`` Directory of with soname (.so.3). +``$`` + Full path to the linker generated program database file (.pdb) + where ``tgt`` is the name of a target. + + See also the :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY` + target properties and their configuration specific variants + :prop_tgt:`PDB_NAME_` and :prop_tgt:`PDB_OUTPUT_DIRECTORY_`. +``$`` + Name of the linker generated program database file (.pdb). +``$`` + Directory of the linker generated program database file (.pdb). ``$`` Value of the property ``prop`` on the target ``tgt``. diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 8e988c9..ecb323a 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -261,4 +261,5 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON) endmacro() diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 6f940a6..3547e66 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1512,6 +1512,7 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode class ArtifactNameTag; class ArtifactLinkerTag; class ArtifactSonameTag; +class ArtifactPdbTag; class ArtifactPathTag; class ArtifactDirTag; @@ -1558,6 +1559,44 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) + { + std::string language = target->GetLinkerLanguage(context->Config); + + std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB"; + + if(!context->Makefile->IsOn(pdbSupportVar)) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_PDB_FILE is not supported by the target linker."); + return std::string(); + } + + cmTarget::TargetType targetType = target->GetType(); + + if(targetType != cmTarget::SHARED_LIBRARY && + targetType != cmTarget::MODULE_LIBRARY && + targetType != cmTarget::EXECUTABLE) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_PDB_FILE is allowed only for " + "targets with linker created artifacts."); + return std::string(); + } + + std::string result = target->GetPDBDirectory(context->Config); + result += "/"; + result += target->GetPDBName(context->Config); + return result; + } +}; + +//---------------------------------------------------------------------------- +template<> struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, @@ -1706,6 +1745,9 @@ TargetFilesystemArtifactNodeGroup targetLinkerNodeGroup; static const TargetFilesystemArtifactNodeGroup targetSoNameNodeGroup; +static const +TargetFilesystemArtifactNodeGroup targetPdbNodeGroup; + //---------------------------------------------------------------------------- static const cmGeneratorExpressionNode* GetNode(const std::string &identifier) @@ -1733,12 +1775,15 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) nodeMap["TARGET_FILE"] = &targetNodeGroup.File; nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File; nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File; + nodeMap["TARGET_PDB_FILE"] = &targetPdbNodeGroup.File; nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName; nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName; nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName; + nodeMap["TARGET_PDB_FILE_NAME"] = &targetPdbNodeGroup.FileName; nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir; nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; + nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir; nodeMap["STREQUAL"] = &strEqualNode; nodeMap["EQUAL"] = &equalNode; nodeMap["LOWER_CASE"] = &lowerCaseNode; diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index ff3b9a0..2375ba6 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -21,6 +21,10 @@ if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 2) set(File_Generate_ARGS -DXCODE_BELOW_2=1) endif() +if(MSVC) + set(GeneratorExpression_ARGS -DLINKER_SUPPORTS_PDB=1) +endif() + add_RunCMake_test(CMP0019) add_RunCMake_test(CMP0022) add_RunCMake_test(CMP0026) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..831edad --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidCompiler-TARGET_PDB_FILE.cmake:6 \(file\): + Error evaluating generator expression: + + \$ + + TARGET_PDB_FILE is not supported by the target linker. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..84a2b2e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$]" +) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..e5f21e2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidTarget-TARGET_PDB_FILE.cmake:6 \(file\): + Error evaluating generator expression: + + \$ + + TARGET_PDB_FILE is allowed only for targets with linker created artifacts. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..84a2b2e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$]" +) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index c8f3fdf..6c32393 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -16,3 +16,10 @@ run_cmake(NonValidTarget-C_COMPILER_VERSION) run_cmake(NonValidTarget-CXX_COMPILER_VERSION) run_cmake(NonValidTarget-TARGET_PROPERTY) run_cmake(NonValidTarget-TARGET_POLICY) + +if(LINKER_SUPPORTS_PDB) + run_cmake(NonValidTarget-TARGET_PDB_FILE) + run_cmake(ValidTarget-TARGET_PDB_FILE) +else() + run_cmake(NonValidCompiler-TARGET_PDB_FILE) +endif() diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake new file mode 100644 index 0000000..748d14f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake @@ -0,0 +1,17 @@ +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT) + +list(GET TEST_TXT 0 PDB_PATH) +list(GET TEST_TXT 1 PDB_NAME) +list(GET TEST_TXT 2 PDB_DIR) + +if(NOT PDB_PATH MATCHES "empty\\.pdb") + message(FATAL_ERROR "unexpected PDB_PATH [${PDB_PATH}]") +endif() + +if(NOT PDB_NAME STREQUAL "empty.pdb") + message(FATAL_ERROR "unexpected PDB_NAME [${PDB_NAME}]") +endif() + +if(PDB_DIR MATCHES "empty\\.pdb") + message(FATAL_ERROR "unexpected PDB_DIR [${PDB_DIR}]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..38e47f9 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake @@ -0,0 +1,19 @@ + +enable_language(C) + +add_library(empty SHARED empty.c) + +if(CMAKE_CONFIGURATION_TYPES) + list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) + set(GENERATE_CONDITION CONDITION $) +endif() + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT +[[$ +$ +$ +]] + ${GENERATE_CONDITION} +) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=028ad31878d25dad055ed9588d81568b284a272e commit 028ad31878d25dad055ed9588d81568b284a272e Author: Nils Gladitz AuthorDate: Thu Jul 24 21:36:21 2014 +0200 Commit: Brad King CommitDate: Tue Jul 29 09:21:34 2014 -0400 Genex: Simplify filesytem artifact code diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 28879f1..6f940a6 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1509,7 +1509,16 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode } installPrefixNode; //---------------------------------------------------------------------------- -template +class ArtifactNameTag; +class ArtifactLinkerTag; +class ArtifactSonameTag; + +class ArtifactPathTag; +class ArtifactDirTag; +class ArtifactNameTag; + +//---------------------------------------------------------------------------- +template struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, @@ -1519,7 +1528,7 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultCreator +struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, cmGeneratorExpressionContext *context, @@ -1549,7 +1558,7 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultCreator +struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, cmGeneratorExpressionContext *context, @@ -1570,7 +1579,7 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultCreator +struct TargetFilesystemArtifactResultCreator { static std::string Create(cmTarget* target, cmGeneratorExpressionContext *context, @@ -1582,7 +1591,7 @@ struct TargetFilesystemArtifactResultCreator //---------------------------------------------------------------------------- -template +template struct TargetFilesystemArtifactResultGetter { static std::string Get(const std::string &result); @@ -1590,7 +1599,7 @@ struct TargetFilesystemArtifactResultGetter //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultGetter +struct TargetFilesystemArtifactResultGetter { static std::string Get(const std::string &result) { return cmSystemTools::GetFilenameName(result); } @@ -1598,7 +1607,7 @@ struct TargetFilesystemArtifactResultGetter //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultGetter +struct TargetFilesystemArtifactResultGetter { static std::string Get(const std::string &result) { return cmSystemTools::GetFilenamePath(result); } @@ -1606,14 +1615,14 @@ struct TargetFilesystemArtifactResultGetter //---------------------------------------------------------------------------- template<> -struct TargetFilesystemArtifactResultGetter +struct TargetFilesystemArtifactResultGetter { static std::string Get(const std::string &result) { return result; } }; //---------------------------------------------------------------------------- -template +template struct TargetFilesystemArtifact : public cmGeneratorExpressionNode { TargetFilesystemArtifact() {} @@ -1661,7 +1670,7 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode context->AllTargets.insert(target); std::string result = - TargetFilesystemArtifactResultCreator::Create( + TargetFilesystemArtifactResultCreator::Create( target, context, content); @@ -1670,29 +1679,32 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode return std::string(); } return - TargetFilesystemArtifactResultGetter::Get(result); + TargetFilesystemArtifactResultGetter::Get(result); } }; //---------------------------------------------------------------------------- +template +struct TargetFilesystemArtifactNodeGroup +{ + TargetFilesystemArtifactNodeGroup() + { + } + + TargetFilesystemArtifact File; + TargetFilesystemArtifact FileName; + TargetFilesystemArtifact FileDir; +}; + +//---------------------------------------------------------------------------- static const -TargetFilesystemArtifact targetFileNode; -static const -TargetFilesystemArtifact targetLinkerFileNode; -static const -TargetFilesystemArtifact targetSoNameFileNode; -static const -TargetFilesystemArtifact targetFileNameNode; -static const -TargetFilesystemArtifact targetLinkerFileNameNode; -static const -TargetFilesystemArtifact targetSoNameFileNameNode; -static const -TargetFilesystemArtifact targetFileDirNode; +TargetFilesystemArtifactNodeGroup targetNodeGroup; + static const -TargetFilesystemArtifact targetLinkerFileDirNode; +TargetFilesystemArtifactNodeGroup targetLinkerNodeGroup; + static const -TargetFilesystemArtifact targetSoNameFileDirNode; +TargetFilesystemArtifactNodeGroup targetSoNameNodeGroup; //---------------------------------------------------------------------------- static const @@ -1718,15 +1730,15 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) nodeMap["COMPILE_FEATURES"] = &compileFeaturesNode; nodeMap["CONFIGURATION"] = &configurationNode; nodeMap["CONFIG"] = &configurationTestNode; - nodeMap["TARGET_FILE"] = &targetFileNode; - nodeMap["TARGET_LINKER_FILE"] = &targetLinkerFileNode; - nodeMap["TARGET_SONAME_FILE"] = &targetSoNameFileNode; - nodeMap["TARGET_FILE_NAME"] = &targetFileNameNode; - nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerFileNameNode; - nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameFileNameNode; - nodeMap["TARGET_FILE_DIR"] = &targetFileDirNode; - nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerFileDirNode; - nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameFileDirNode; + nodeMap["TARGET_FILE"] = &targetNodeGroup.File; + nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File; + nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File; + nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName; + nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName; + nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName; + nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir; + nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; + nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; nodeMap["STREQUAL"] = &strEqualNode; nodeMap["EQUAL"] = &equalNode; nodeMap["LOWER_CASE"] = &lowerCaseNode; ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 09:28:20 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 09:28:20 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4602-ge912114 Message-ID: <20140729132820.4EA7D4BB1B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via e9121142e5481e82ab828d164716897d6e82c785 (commit) via 87c0959aff8eb21de5d1334559e5b75b0fafc6da (commit) from 853867d644671401af8bf8796e7a2f969f6038de (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e9121142e5481e82ab828d164716897d6e82c785 commit e9121142e5481e82ab828d164716897d6e82c785 Merge: 853867d 87c0959 Author: Brad King AuthorDate: Tue Jul 29 09:28:19 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 09:28:19 2014 -0400 Merge topic 'cpack-add-lzma' into next 87c0959a CPack: add generators for .7z and .tar.xz (#13072, #14519) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=87c0959aff8eb21de5d1334559e5b75b0fafc6da commit 87c0959aff8eb21de5d1334559e5b75b0fafc6da Author: Daniel Pfeifer AuthorDate: Thu Jul 10 00:21:36 2014 +0200 Commit: Brad King CommitDate: Tue Jul 29 09:28:43 2014 -0400 CPack: add generators for .7z and .tar.xz (#13072, #14519) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index c394946..7f36bb2 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -580,9 +580,11 @@ set(CPACK_SRCS CPack/cmCPackIFWGenerator.cxx CPack/cmCPackSTGZGenerator.cxx CPack/cmCPackTGZGenerator.cxx + CPack/cmCPackTXZGenerator.cxx CPack/cmCPackTarBZip2Generator.cxx CPack/cmCPackTarCompressGenerator.cxx CPack/cmCPackZIPGenerator.cxx + CPack/cmCPack7zGenerator.cxx ) if(CYGWIN) diff --git a/Source/CPack/cmCPack7zGenerator.cxx b/Source/CPack/cmCPack7zGenerator.cxx new file mode 100644 index 0000000..ce31ad4 --- /dev/null +++ b/Source/CPack/cmCPack7zGenerator.cxx @@ -0,0 +1,25 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmCPack7zGenerator.h" + +//---------------------------------------------------------------------- +cmCPack7zGenerator::cmCPack7zGenerator() + :cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, + cmArchiveWrite::Type7Zip) +{ +} + +//---------------------------------------------------------------------- +cmCPack7zGenerator::~cmCPack7zGenerator() +{ +} diff --git a/Source/CPack/cmCPack7zGenerator.h b/Source/CPack/cmCPack7zGenerator.h new file mode 100644 index 0000000..f5a323f --- /dev/null +++ b/Source/CPack/cmCPack7zGenerator.h @@ -0,0 +1,36 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmCPack7zGenerator_h +#define cmCPack7zGenerator_h + +#include "cmCPackArchiveGenerator.h" + +/** \class cmCPack7zGenerator + * \brief A generator for 7z files + */ +class cmCPack7zGenerator : public cmCPackArchiveGenerator +{ +public: + cmCPackTypeMacro(cmCPack7zGenerator, cmCPackArchiveGenerator); + + /** + * Construct generator + */ + cmCPack7zGenerator(); + virtual ~cmCPack7zGenerator(); + +protected: + virtual const char* GetOutputExtension() { return ".7z"; } +}; + +#endif diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index 788e785..da97657 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -14,9 +14,11 @@ #include "cmCPackGenerator.h" #include "cmCPackTGZGenerator.h" +#include "cmCPackTXZGenerator.h" #include "cmCPackTarBZip2Generator.h" #include "cmCPackTarCompressGenerator.h" #include "cmCPackZIPGenerator.h" +#include "cmCPack7zGenerator.h" #include "cmCPackSTGZGenerator.h" #include "cmCPackNSISGenerator.h" #include "cmCPackIFWGenerator.h" @@ -57,6 +59,11 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory() this->RegisterGenerator("TGZ", "Tar GZip compression", cmCPackTGZGenerator::CreateGenerator); } + if (cmCPackTXZGenerator::CanGenerate()) + { + this->RegisterGenerator("TXZ", "Tar XZ compression", + cmCPackTXZGenerator::CreateGenerator); + } if (cmCPackSTGZGenerator::CanGenerate()) { this->RegisterGenerator("STGZ", "Self extracting Tar GZip compression", @@ -92,6 +99,11 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory() this->RegisterGenerator("ZIP", "ZIP file format", cmCPackZIPGenerator::CreateGenerator); } + if (cmCPack7zGenerator::CanGenerate()) + { + this->RegisterGenerator("7Z", "7-Zip file format", + cmCPack7zGenerator::CreateGenerator); + } #ifdef _WIN32 if (cmCPackWIXGenerator::CanGenerate()) { diff --git a/Source/CPack/cmCPackTXZGenerator.cxx b/Source/CPack/cmCPackTXZGenerator.cxx new file mode 100644 index 0000000..ecfc177 --- /dev/null +++ b/Source/CPack/cmCPackTXZGenerator.cxx @@ -0,0 +1,25 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmCPackTXZGenerator.h" + +//---------------------------------------------------------------------- +cmCPackTXZGenerator::cmCPackTXZGenerator() + :cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, + cmArchiveWrite::TypeTAR) +{ +} + +//---------------------------------------------------------------------- +cmCPackTXZGenerator::~cmCPackTXZGenerator() +{ +} diff --git a/Source/CPack/cmCPackTXZGenerator.h b/Source/CPack/cmCPackTXZGenerator.h new file mode 100644 index 0000000..bf8152f --- /dev/null +++ b/Source/CPack/cmCPackTXZGenerator.h @@ -0,0 +1,35 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmCPackTXZGenerator_h +#define cmCPackTXZGenerator_h + +#include "cmCPackArchiveGenerator.h" + +/** \class cmCPackTXZGenerator + * \brief A generator for TXZ files + * + */ +class cmCPackTXZGenerator : public cmCPackArchiveGenerator +{ +public: + cmCPackTypeMacro(cmCPackTXZGenerator, cmCPackArchiveGenerator); + /** + * Construct generator + */ + cmCPackTXZGenerator(); + virtual ~cmCPackTXZGenerator(); +protected: + virtual const char* GetOutputExtension() { return ".tar.xz"; } +}; + +#endif diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index 3b0ead5..a2aecac 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -159,7 +159,15 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, Type t): this->Error += cm_archive_error_string(this->Archive); return; } - break; + break; + case Type7Zip: + if(archive_write_set_format_7zip(this->Archive) != ARCHIVE_OK) + { + this->Error = "archive_write_set_format_7zip: "; + this->Error += cm_archive_error_string(this->Archive); + return; + } + break; } // do not pad the last block!! diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h index 3e3b2f0..a6dcc0e 100644 --- a/Source/cmArchiveWrite.h +++ b/Source/cmArchiveWrite.h @@ -42,7 +42,8 @@ public: enum Type { TypeTAR, - TypeZIP + TypeZIP, + Type7Zip }; /** Construct with output stream to which to write archive. */ ----------------------------------------------------------------------- Summary of changes: Source/CMakeLists.txt | 2 ++ ...mCPackZIPGenerator.cxx => cmCPack7zGenerator.cxx} | 9 ++++----- .../{cmCPackZIPGenerator.h => cmCPack7zGenerator.h} | 18 +++++++++--------- Source/CPack/cmCPackGeneratorFactory.cxx | 12 ++++++++++++ ...CPackTGZGenerator.cxx => cmCPackTXZGenerator.cxx} | 9 ++++----- .../{cmCPackTGZGenerator.h => cmCPackTXZGenerator.h} | 18 +++++++++--------- Source/cmArchiveWrite.cxx | 10 +++++++++- Source/cmArchiveWrite.h | 3 ++- 8 files changed, 51 insertions(+), 30 deletions(-) copy Source/CPack/{cmCPackZIPGenerator.cxx => cmCPack7zGenerator.cxx} (81%) copy Source/CPack/{cmCPackZIPGenerator.h => cmCPack7zGenerator.h} (63%) copy Source/CPack/{cmCPackTGZGenerator.cxx => cmCPackTXZGenerator.cxx} (81%) copy Source/CPack/{cmCPackTGZGenerator.h => cmCPackTXZGenerator.h} (63%) hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 09:32:45 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 09:32:45 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4605-g69ea5f3 Message-ID: <20140729133245.B7F384BC1C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 69ea5f3e97dff415422b2b6614ddd6d6116b1f52 (commit) via 56e6975ce98660c86690c5fb97e443402f4885a3 (commit) via 98ea03443bea81188cfe55a885ac64c3ddd93b40 (commit) from e9121142e5481e82ab828d164716897d6e82c785 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=69ea5f3e97dff415422b2b6614ddd6d6116b1f52 commit 69ea5f3e97dff415422b2b6614ddd6d6116b1f52 Merge: e912114 56e6975 Author: Brad King AuthorDate: Tue Jul 29 09:32:44 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 09:32:44 2014 -0400 Merge topic 'ExternalProject-add-lzma' into next 56e6975c ExternalProject: Recognize lzma-compressed files (#13515) 98ea0344 ExternalProject: Recognize .tbz2 extension http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=56e6975ce98660c86690c5fb97e443402f4885a3 commit 56e6975ce98660c86690c5fb97e443402f4885a3 Author: Brad King AuthorDate: Wed Jul 23 15:54:04 2014 -0400 Commit: Brad King CommitDate: Tue Jul 29 09:32:27 2014 -0400 ExternalProject: Recognize lzma-compressed files (#13515) Add .7z, .tar.xz, and .txz file extensions. Inspired-by: Joke de Buhr Inspired-by: David Cole diff --git a/Help/release/dev/ExternalProject-add-lzma.rst b/Help/release/dev/ExternalProject-add-lzma.rst new file mode 100644 index 0000000..cb398ef --- /dev/null +++ b/Help/release/dev/ExternalProject-add-lzma.rst @@ -0,0 +1,5 @@ +ExternalProject-add-lzma +------------------------ + +* The :module:`ExternalProject` module learned to support lzma-compressed + source tarballs with ``.7z``, ``.tar.xz``, and ``.txz`` extensions. diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 8274a53..dbce9f4 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -737,7 +737,7 @@ endfunction() function(_ep_write_extractfile_script script_filename name filename directory) set(args "") - if(filename MATCHES "(\\.|=)(tar\\.bz2|tar\\.gz|tbz2|tgz|zip)$") + if(filename MATCHES "(\\.|=)(7z|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$") set(args xfz) endif() @@ -746,7 +746,7 @@ function(_ep_write_extractfile_script script_filename name filename directory) endif() if(args STREQUAL "") - message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .tar, .tar.bz2, .tar.gz, .tbz2, .tgz and .zip") + message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .7z, .tar, .tar.bz2, .tar.gz, .tar.xz, .tbz2, .tgz, .txz and .zip") return() endif() @@ -1540,11 +1540,11 @@ function(_ep_add_download_command name) if("x${fname}" STREQUAL "x") string(REGEX MATCH "[^/\\?]*$" fname "${url}") endif() - if(NOT "${fname}" MATCHES "(\\.|=)(tar|tar\\.bz2|tar\\.gz|tbz2|tgz|zip)$") - string(REGEX MATCH "([^/\\?]+(\\.|=)(tar|tar\\.bz2|tar\\.gz|tbz2|tgz|zip))/.*$" match_result "${url}") + if(NOT "${fname}" MATCHES "(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$") + string(REGEX MATCH "([^/\\?]+(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip))/.*$" match_result "${url}") set(fname "${CMAKE_MATCH_1}") endif() - if(NOT "${fname}" MATCHES "(\\.|=)(tar|tar\\.bz2|tar\\.gz|tbz2|tgz|zip)$") + if(NOT "${fname}" MATCHES "(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$") message(FATAL_ERROR "Could not extract tarball filename from url:\n ${url}") endif() string(REPLACE ";" "-" fname "${fname}") http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=98ea03443bea81188cfe55a885ac64c3ddd93b40 commit 98ea03443bea81188cfe55a885ac64c3ddd93b40 Author: Brad King AuthorDate: Wed Jul 23 15:52:51 2014 -0400 Commit: Brad King CommitDate: Tue Jul 29 09:29:57 2014 -0400 ExternalProject: Recognize .tbz2 extension Also fix .bz2 extension to be .tar.bz2 since we only support compressed tarballs and not plain compressed files. Suggested-by: Nils Gladitz Suggested-by: Rolf Eike Beer diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 0d35cca..8274a53 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -737,7 +737,7 @@ endfunction() function(_ep_write_extractfile_script script_filename name filename directory) set(args "") - if(filename MATCHES "(\\.|=)(bz2|tar\\.gz|tgz|zip)$") + if(filename MATCHES "(\\.|=)(tar\\.bz2|tar\\.gz|tbz2|tgz|zip)$") set(args xfz) endif() @@ -746,7 +746,7 @@ function(_ep_write_extractfile_script script_filename name filename directory) endif() if(args STREQUAL "") - message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .bz2, .tar, .tar.gz, .tgz and .zip") + message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .tar, .tar.bz2, .tar.gz, .tbz2, .tgz and .zip") return() endif() @@ -1540,11 +1540,11 @@ function(_ep_add_download_command name) if("x${fname}" STREQUAL "x") string(REGEX MATCH "[^/\\?]*$" fname "${url}") endif() - if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$") - string(REGEX MATCH "([^/\\?]+(\\.|=)(bz2|tar|tgz|tar\\.gz|zip))/.*$" match_result "${url}") + if(NOT "${fname}" MATCHES "(\\.|=)(tar|tar\\.bz2|tar\\.gz|tbz2|tgz|zip)$") + string(REGEX MATCH "([^/\\?]+(\\.|=)(tar|tar\\.bz2|tar\\.gz|tbz2|tgz|zip))/.*$" match_result "${url}") set(fname "${CMAKE_MATCH_1}") endif() - if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$") + if(NOT "${fname}" MATCHES "(\\.|=)(tar|tar\\.bz2|tar\\.gz|tbz2|tgz|zip)$") message(FATAL_ERROR "Could not extract tarball filename from url:\n ${url}") endif() string(REPLACE ";" "-" fname "${fname}") ----------------------------------------------------------------------- Summary of changes: Help/release/dev/ExternalProject-add-lzma.rst | 5 +++++ Modules/ExternalProject.cmake | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 Help/release/dev/ExternalProject-add-lzma.rst hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 09:47:12 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 09:47:12 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4607-gf4586a1 Message-ID: <20140729134712.E29D54AFF9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f4586a1b7b736f5058fc2304efb57d86f3277ad2 (commit) via 4a98698dfa63489bac5d8a4013fe52722e43b418 (commit) from 69ea5f3e97dff415422b2b6614ddd6d6116b1f52 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f4586a1b7b736f5058fc2304efb57d86f3277ad2 commit f4586a1b7b736f5058fc2304efb57d86f3277ad2 Merge: 69ea5f3 4a98698 Author: Brad King AuthorDate: Tue Jul 29 09:47:12 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 09:47:12 2014 -0400 Merge topic 'cpack-add-lzma' into next 4a98698d Help: Add notes for topic 'cpack-add-lzma' http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4a98698dfa63489bac5d8a4013fe52722e43b418 commit 4a98698dfa63489bac5d8a4013fe52722e43b418 Author: Brad King AuthorDate: Tue Jul 29 09:48:19 2014 -0400 Commit: Brad King CommitDate: Tue Jul 29 09:48:19 2014 -0400 Help: Add notes for topic 'cpack-add-lzma' diff --git a/Help/release/dev/cpack-add-lzma.rst b/Help/release/dev/cpack-add-lzma.rst new file mode 100644 index 0000000..ad59f35 --- /dev/null +++ b/Help/release/dev/cpack-add-lzma.rst @@ -0,0 +1,5 @@ +cpack-add-lzma +-------------- + +* :manual:`cpack(1)` gained ``7Z`` and ``TXZ`` generators supporting + lzma-compressed archives. ----------------------------------------------------------------------- Summary of changes: Help/release/dev/cpack-add-lzma.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Help/release/dev/cpack-add-lzma.rst hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 09:47:31 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 09:47:31 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4609-g4f99c03 Message-ID: <20140729134731.489744B01F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 4f99c0343b748cac444f74f0a11bde10ced32222 (commit) via f931a18c334bd471c22f7af4e580b2433ba14a69 (commit) from f4586a1b7b736f5058fc2304efb57d86f3277ad2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4f99c0343b748cac444f74f0a11bde10ced32222 commit 4f99c0343b748cac444f74f0a11bde10ced32222 Merge: f4586a1 f931a18 Author: Brad King AuthorDate: Tue Jul 29 09:47:30 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 09:47:30 2014 -0400 Merge topic 'cpack-add-lzma' into next f931a18c CPack: add generators for .7z and .tar.xz (#13072, #14519) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f931a18c334bd471c22f7af4e580b2433ba14a69 commit f931a18c334bd471c22f7af4e580b2433ba14a69 Author: Daniel Pfeifer AuthorDate: Thu Jul 10 00:21:36 2014 +0200 Commit: Brad King CommitDate: Tue Jul 29 09:48:41 2014 -0400 CPack: add generators for .7z and .tar.xz (#13072, #14519) diff --git a/Help/release/dev/cpack-add-lzma.rst b/Help/release/dev/cpack-add-lzma.rst new file mode 100644 index 0000000..ad59f35 --- /dev/null +++ b/Help/release/dev/cpack-add-lzma.rst @@ -0,0 +1,5 @@ +cpack-add-lzma +-------------- + +* :manual:`cpack(1)` gained ``7Z`` and ``TXZ`` generators supporting + lzma-compressed archives. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index c394946..7f36bb2 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -580,9 +580,11 @@ set(CPACK_SRCS CPack/cmCPackIFWGenerator.cxx CPack/cmCPackSTGZGenerator.cxx CPack/cmCPackTGZGenerator.cxx + CPack/cmCPackTXZGenerator.cxx CPack/cmCPackTarBZip2Generator.cxx CPack/cmCPackTarCompressGenerator.cxx CPack/cmCPackZIPGenerator.cxx + CPack/cmCPack7zGenerator.cxx ) if(CYGWIN) diff --git a/Source/CPack/cmCPack7zGenerator.cxx b/Source/CPack/cmCPack7zGenerator.cxx new file mode 100644 index 0000000..ce31ad4 --- /dev/null +++ b/Source/CPack/cmCPack7zGenerator.cxx @@ -0,0 +1,25 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmCPack7zGenerator.h" + +//---------------------------------------------------------------------- +cmCPack7zGenerator::cmCPack7zGenerator() + :cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, + cmArchiveWrite::Type7Zip) +{ +} + +//---------------------------------------------------------------------- +cmCPack7zGenerator::~cmCPack7zGenerator() +{ +} diff --git a/Source/CPack/cmCPack7zGenerator.h b/Source/CPack/cmCPack7zGenerator.h new file mode 100644 index 0000000..f5a323f --- /dev/null +++ b/Source/CPack/cmCPack7zGenerator.h @@ -0,0 +1,36 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmCPack7zGenerator_h +#define cmCPack7zGenerator_h + +#include "cmCPackArchiveGenerator.h" + +/** \class cmCPack7zGenerator + * \brief A generator for 7z files + */ +class cmCPack7zGenerator : public cmCPackArchiveGenerator +{ +public: + cmCPackTypeMacro(cmCPack7zGenerator, cmCPackArchiveGenerator); + + /** + * Construct generator + */ + cmCPack7zGenerator(); + virtual ~cmCPack7zGenerator(); + +protected: + virtual const char* GetOutputExtension() { return ".7z"; } +}; + +#endif diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index 788e785..da97657 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -14,9 +14,11 @@ #include "cmCPackGenerator.h" #include "cmCPackTGZGenerator.h" +#include "cmCPackTXZGenerator.h" #include "cmCPackTarBZip2Generator.h" #include "cmCPackTarCompressGenerator.h" #include "cmCPackZIPGenerator.h" +#include "cmCPack7zGenerator.h" #include "cmCPackSTGZGenerator.h" #include "cmCPackNSISGenerator.h" #include "cmCPackIFWGenerator.h" @@ -57,6 +59,11 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory() this->RegisterGenerator("TGZ", "Tar GZip compression", cmCPackTGZGenerator::CreateGenerator); } + if (cmCPackTXZGenerator::CanGenerate()) + { + this->RegisterGenerator("TXZ", "Tar XZ compression", + cmCPackTXZGenerator::CreateGenerator); + } if (cmCPackSTGZGenerator::CanGenerate()) { this->RegisterGenerator("STGZ", "Self extracting Tar GZip compression", @@ -92,6 +99,11 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory() this->RegisterGenerator("ZIP", "ZIP file format", cmCPackZIPGenerator::CreateGenerator); } + if (cmCPack7zGenerator::CanGenerate()) + { + this->RegisterGenerator("7Z", "7-Zip file format", + cmCPack7zGenerator::CreateGenerator); + } #ifdef _WIN32 if (cmCPackWIXGenerator::CanGenerate()) { diff --git a/Source/CPack/cmCPackTXZGenerator.cxx b/Source/CPack/cmCPackTXZGenerator.cxx new file mode 100644 index 0000000..ecfc177 --- /dev/null +++ b/Source/CPack/cmCPackTXZGenerator.cxx @@ -0,0 +1,25 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmCPackTXZGenerator.h" + +//---------------------------------------------------------------------- +cmCPackTXZGenerator::cmCPackTXZGenerator() + :cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, + cmArchiveWrite::TypeTAR) +{ +} + +//---------------------------------------------------------------------- +cmCPackTXZGenerator::~cmCPackTXZGenerator() +{ +} diff --git a/Source/CPack/cmCPackTXZGenerator.h b/Source/CPack/cmCPackTXZGenerator.h new file mode 100644 index 0000000..bf8152f --- /dev/null +++ b/Source/CPack/cmCPackTXZGenerator.h @@ -0,0 +1,35 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmCPackTXZGenerator_h +#define cmCPackTXZGenerator_h + +#include "cmCPackArchiveGenerator.h" + +/** \class cmCPackTXZGenerator + * \brief A generator for TXZ files + * + */ +class cmCPackTXZGenerator : public cmCPackArchiveGenerator +{ +public: + cmCPackTypeMacro(cmCPackTXZGenerator, cmCPackArchiveGenerator); + /** + * Construct generator + */ + cmCPackTXZGenerator(); + virtual ~cmCPackTXZGenerator(); +protected: + virtual const char* GetOutputExtension() { return ".tar.xz"; } +}; + +#endif diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index 3b0ead5..a2aecac 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -159,7 +159,15 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, Type t): this->Error += cm_archive_error_string(this->Archive); return; } - break; + break; + case Type7Zip: + if(archive_write_set_format_7zip(this->Archive) != ARCHIVE_OK) + { + this->Error = "archive_write_set_format_7zip: "; + this->Error += cm_archive_error_string(this->Archive); + return; + } + break; } // do not pad the last block!! diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h index 3e3b2f0..a6dcc0e 100644 --- a/Source/cmArchiveWrite.h +++ b/Source/cmArchiveWrite.h @@ -42,7 +42,8 @@ public: enum Type { TypeTAR, - TypeZIP + TypeZIP, + Type7Zip }; /** Construct with output stream to which to write archive. */ ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Jul 29 15:10:21 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 29 Jul 2014 15:10:21 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4617-gab5ffdf Message-ID: <20140729191021.F297046A60@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ab5ffdfbbdfdc25736a4193b070819225eac23c8 (commit) via 0ac28adc01c68bb9c11a34af122bac0071733965 (commit) via 58bb14d4ac64686923d69bf515e8700f095c4ff5 (commit) via 972cf1d7afd1476c550ca0503d75ec93bd764124 (commit) via 15fb102278c1cf9141e42174d89bbfe5ef26f634 (commit) via c2ef6d238a5e30234756a38943436e326b986b58 (commit) via 2df389115e7636756cd1f1d6c422651b4899522d (commit) via 143b40051a71c2f53e487be69069f1932ccc25d1 (commit) from 4f99c0343b748cac444f74f0a11bde10ced32222 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ab5ffdfbbdfdc25736a4193b070819225eac23c8 commit ab5ffdfbbdfdc25736a4193b070819225eac23c8 Merge: 4f99c03 0ac28ad Author: Brad King AuthorDate: Tue Jul 29 15:10:21 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 15:10:21 2014 -0400 Merge topic 'vs-refactor-source-tools' into next 0ac28adc VS: Map .jpg and .png sources to Image tool 58bb14d4 VS: Map .xml to XML tool 972cf1d7 VS: Map .appxmanifest sources to AppxManifest tool 15fb1022 VS: Refactor handling of resx headers c2ef6d23 VS: Refactor handling of "header" sources in VS >= 10 2df38911 VS: Refactor handling of "extra" sources in VS >= 10 143b4005 VS: Convert 'WriteSource' tool argument to std::string http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0ac28adc01c68bb9c11a34af122bac0071733965 commit 0ac28adc01c68bb9c11a34af122bac0071733965 Author: Brad King AuthorDate: Tue Jul 29 13:52:42 2014 -0400 Commit: Brad King CommitDate: Tue Jul 29 15:06:37 2014 -0400 VS: Map .jpg and .png sources to Image tool Inspired-by: Gilles Khouzam diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index b294e68..d9013e0 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1019,6 +1019,11 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) { tool = "AppxManifest"; } + else if(ext == "jpg" || + ext == "png") + { + tool = "Image"; + } else if(ext == "xml") { tool = "XML"; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=58bb14d4ac64686923d69bf515e8700f095c4ff5 commit 58bb14d4ac64686923d69bf515e8700f095c4ff5 Author: Brad King AuthorDate: Tue Jul 29 13:45:23 2014 -0400 Commit: Brad King CommitDate: Tue Jul 29 15:06:35 2014 -0400 VS: Map .xml to XML tool Inspired-by: Gilles Khouzam diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 50c303f..b294e68 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1019,6 +1019,10 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) { tool = "AppxManifest"; } + else if(ext == "xml") + { + tool = "XML"; + } this->WriteSource(tool, sf); } http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=972cf1d7afd1476c550ca0503d75ec93bd764124 commit 972cf1d7afd1476c550ca0503d75ec93bd764124 Author: Brad King AuthorDate: Tue Jul 29 13:43:35 2014 -0400 Commit: Brad King CommitDate: Tue Jul 29 15:06:32 2014 -0400 VS: Map .appxmanifest sources to AppxManifest tool Inspired-by: Minmin Gong diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 872f187..50c303f 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1013,7 +1013,13 @@ void cmVisualStudio10TargetGenerator::WriteHeaderSource(cmSourceFile const* sf) void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) { - this->WriteSource("None", sf); + std::string tool = "None"; + std::string const& ext = sf->GetExtension(); + if(ext == "appxmanifest") + { + tool = "AppxManifest"; + } + this->WriteSource(tool, sf); } void cmVisualStudio10TargetGenerator::WriteSource( http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=15fb102278c1cf9141e42174d89bbfe5ef26f634 commit 15fb102278c1cf9141e42174d89bbfe5ef26f634 Author: Brad King AuthorDate: Tue Jul 29 13:41:17 2014 -0400 Commit: Brad King CommitDate: Tue Jul 29 15:06:30 2014 -0400 VS: Refactor handling of resx headers Move generation of the ClInclude element to WriteHeaderSource. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 22e2461..872f187 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -999,7 +999,16 @@ WriteGroupSources(const char* name, void cmVisualStudio10TargetGenerator::WriteHeaderSource(cmSourceFile const* sf) { - this->WriteSource("ClInclude", sf); + if(this->IsResxHeader(sf->GetFullPath())) + { + this->WriteSource("ClInclude", sf, ">\n"); + this->WriteString("CppForm\n", 3); + this->WriteString("\n", 2); + } + else + { + this->WriteSource("ClInclude", sf); + } } void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) @@ -1046,19 +1055,8 @@ void cmVisualStudio10TargetGenerator::WriteSource( this->ConvertToWindowsSlash(sourceFile); this->WriteString("<", 2); (*this->BuildFileStream ) << tool << " Include=\"" - << cmVS10EscapeXML(sourceFile) << "\""; - - if(sf->GetExtension() == "h" && - this->IsResxHeader(sf->GetFullPath())) - { - (*this->BuildFileStream ) << ">\n"; - this->WriteString("CppForm\n", 3); - this->WriteString("\n", 2); - } - else - { - (*this->BuildFileStream ) << (end? end : " />\n"); - } + << cmVS10EscapeXML(sourceFile) << "\"" + << (end? end : " />\n"); ToolSource toolSource = {sf, forceRelative}; this->Tools[tool].push_back(toolSource); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c2ef6d238a5e30234756a38943436e326b986b58 commit c2ef6d238a5e30234756a38943436e326b986b58 Author: Brad King AuthorDate: Tue Jul 29 13:36:53 2014 -0400 Commit: Brad King CommitDate: Tue Jul 29 15:06:28 2014 -0400 VS: Refactor handling of "header" sources in VS >= 10 Create a WriteHeaderSource method to handle writing of sources classified by cmGeneratorTarget as header files. This will be useful to add special VS-specific handling for some headers. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index d50bdde..22e2461 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -997,6 +997,11 @@ WriteGroupSources(const char* name, this->WriteString("\n", 1); } +void cmVisualStudio10TargetGenerator::WriteHeaderSource(cmSourceFile const* sf) +{ + this->WriteSource("ClInclude", sf); +} + void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) { this->WriteSource("None", sf); @@ -1079,7 +1084,11 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() std::vector headerSources; this->GeneratorTarget->GetHeaderSources(headerSources, ""); - this->WriteSources("ClInclude", headerSources); + for(std::vector::const_iterator + si = headerSources.begin(); si != headerSources.end(); ++si) + { + this->WriteHeaderSource(*si); + } std::vector idlSources; this->GeneratorTarget->GetIDLSources(idlSources, ""); this->WriteSources("Midl", idlSources); diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 8966f93..7436372 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -57,6 +57,7 @@ private: void WriteProjectConfigurations(); void WriteProjectConfigurationValues(); void WriteMSToolConfigurationValues(std::string const& config); + void WriteHeaderSource(cmSourceFile const* sf); void WriteExtraSource(cmSourceFile const* sf); void WriteSource(std::string const& tool, cmSourceFile const* sf, const char* end = 0); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2df389115e7636756cd1f1d6c422651b4899522d commit 2df389115e7636756cd1f1d6c422651b4899522d Author: Brad King AuthorDate: Tue Jul 29 13:32:22 2014 -0400 Commit: Brad King CommitDate: Tue Jul 29 15:06:26 2014 -0400 VS: Refactor handling of "extra" sources in VS >= 10 Create a WriteExtraSource method to handle writing of sources not classified by cmGeneratorTarget for any particular purpose. This will be useful to add special VS-specific handling for some sources. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ca6c41e..d50bdde 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -997,6 +997,11 @@ WriteGroupSources(const char* name, this->WriteString("\n", 1); } +void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) +{ + this->WriteSource("None", sf); +} + void cmVisualStudio10TargetGenerator::WriteSource( std::string const& tool, cmSourceFile const* sf, const char* end) { @@ -1157,7 +1162,11 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() std::vector extraSources; this->GeneratorTarget->GetExtraSources(extraSources, ""); - this->WriteSources("None", extraSources); + for(std::vector::const_iterator + si = extraSources.begin(); si != extraSources.end(); ++si) + { + this->WriteExtraSource(*si); + } // Add object library contents as external objects. std::vector objs; diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 23d86da..8966f93 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -57,6 +57,7 @@ private: void WriteProjectConfigurations(); void WriteProjectConfigurationValues(); void WriteMSToolConfigurationValues(std::string const& config); + void WriteExtraSource(cmSourceFile const* sf); void WriteSource(std::string const& tool, cmSourceFile const* sf, const char* end = 0); void WriteSources(std::string const& tool, http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=143b40051a71c2f53e487be69069f1932ccc25d1 commit 143b40051a71c2f53e487be69069f1932ccc25d1 Author: Brad King AuthorDate: Tue Jul 29 13:26:19 2014 -0400 Commit: Brad King CommitDate: Tue Jul 29 15:06:24 2014 -0400 VS: Convert 'WriteSource' tool argument to std::string diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 5674317..ca6c41e 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -998,7 +998,7 @@ WriteGroupSources(const char* name, } void cmVisualStudio10TargetGenerator::WriteSource( - const char* tool, cmSourceFile const* sf, const char* end) + std::string const& tool, cmSourceFile const* sf, const char* end) { // Visual Studio tools append relative paths to the current dir, as in: // @@ -1055,7 +1055,7 @@ void cmVisualStudio10TargetGenerator::WriteSource( } void cmVisualStudio10TargetGenerator::WriteSources( - const char* tool, std::vector const& sources) + std::string const& tool, std::vector const& sources) { for(std::vector::const_iterator si = sources.begin(); si != sources.end(); ++si) @@ -1086,7 +1086,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() si != objectSources.end(); ++si) { const std::string& lang = (*si)->GetLanguage(); - const char* tool = NULL; + std::string tool; if (lang == "C"|| lang == "CXX") { tool = "ClCompile"; @@ -1101,7 +1101,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() tool = "ResourceCompile"; } - if (tool) + if (!tool.empty()) { this->WriteSource(tool, *si, " "); if (this->OutputSourceSpecificFlags(*si)) diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 7a329cb..23d86da 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -57,9 +57,9 @@ private: void WriteProjectConfigurations(); void WriteProjectConfigurationValues(); void WriteMSToolConfigurationValues(std::string const& config); - void WriteSource(const char* tool, cmSourceFile const* sf, + void WriteSource(std::string const& tool, cmSourceFile const* sf, const char* end = 0); - void WriteSources(const char* tool, + void WriteSources(std::string const& tool, std::vector const&); void WriteAllSources(); void WriteDotNetReferences(); ----------------------------------------------------------------------- Summary of changes: Source/cmVisualStudio10TargetGenerator.cxx | 69 ++++++++++++++++++++-------- Source/cmVisualStudio10TargetGenerator.h | 6 ++- 2 files changed, 54 insertions(+), 21 deletions(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Tue Jul 29 15:34:33 2014 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Tue, 29 Jul 2014 15:34:33 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4619-g7d5a57c Message-ID: <20140729193433.439584BC07@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 7d5a57c48614053a182eb46c3badd5886adcb894 (commit) via 250ad08a085f54c1445369cdf3bf278613c6c0e5 (commit) from ab5ffdfbbdfdc25736a4193b070819225eac23c8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7d5a57c48614053a182eb46c3badd5886adcb894 commit 7d5a57c48614053a182eb46c3badd5886adcb894 Merge: ab5ffdf 250ad08 Author: Nils Gladitz AuthorDate: Tue Jul 29 15:34:32 2014 -0400 Commit: CMake Topic Stage CommitDate: Tue Jul 29 15:34:32 2014 -0400 Merge topic 'remove-link-remnants' into next 250ad08a Ninja: Remove _COMPILER_LINKER_OPTION_FLAG_ remnants http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=250ad08a085f54c1445369cdf3bf278613c6c0e5 commit 250ad08a085f54c1445369cdf3bf278613c6c0e5 Author: Nils Gladitz AuthorDate: Tue Jul 29 21:33:38 2014 +0200 Commit: Nils Gladitz CommitDate: Tue Jul 29 21:33:38 2014 +0200 Ninja: Remove _COMPILER_LINKER_OPTION_FLAG_ remnants diff --git a/Modules/Platform/Windows-df.cmake b/Modules/Platform/Windows-df.cmake index 8dfb610..211cc9d 100644 --- a/Modules/Platform/Windows-df.cmake +++ b/Modules/Platform/Windows-df.cmake @@ -26,7 +26,6 @@ set(CMAKE_Fortran_COMPILE_OBJECT set(CMAKE_COMPILE_RESOURCE "rc /fo ") -set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link") set(CMAKE_Fortran_LINK_EXECUTABLE " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /exe: /link ${CMAKE_END_TEMP_FILE}") diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 15a1b32..e344df4 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -187,12 +187,7 @@ cmNinjaNormalTargetGenerator responseFlag += rspfile; // build response file content - std::string linkOptionVar = cmakeVarLang; - linkOptionVar += "_COMPILER_LINKER_OPTION_FLAG_"; - linkOptionVar += cmTarget::GetTargetTypeName(targetType); - const std::string linkOption = - GetMakefile()->GetSafeDefinition(linkOptionVar); - rspcontent = "$in_newline "+linkOption+" $LINK_PATH $LINK_LIBRARIES"; + rspcontent = "$in_newline $LINK_PATH $LINK_LIBRARIES"; vars.Objects = responseFlag.c_str(); vars.LinkLibraries = ""; } ----------------------------------------------------------------------- Summary of changes: Modules/Platform/Windows-df.cmake | 1 - Source/cmNinjaNormalTargetGenerator.cxx | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jul 30 00:01:10 2014 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 30 Jul 2014 00:01:10 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.0.0-1558-gb801754 Message-ID: <20140730040110.41BD94BB37@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via b801754d1ec8740146ea76047d241b9ff331e069 (commit) from 38065563b6fb0093004d0c89b5de0f82a76b5a31 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b801754d1ec8740146ea76047d241b9ff331e069 commit b801754d1ec8740146ea76047d241b9ff331e069 Author: Kitware Robot AuthorDate: Wed Jul 30 00:01:08 2014 -0400 Commit: Kitware Robot CommitDate: Wed Jul 30 00:01:08 2014 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 94f9919..1208b8a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140729) +set(CMake_VERSION_PATCH 20140730) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Jul 30 09:14:07 2014 From: brad.king at kitware.com (Brad King) Date: Wed, 30 Jul 2014 09:14:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.0.0-4622-gee75b00 Message-ID: <20140730131407.EBD934ACD6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ee75b00eadb9b6edb840873c6056bc66c70dc3e4 (commit) via e7511b7fbe09a4007269992edcde2dc98144da47 (commit) via b234000184bbf314bf0a7380a1d4ebb54f7c8f69 (commit) from 7d5a57c48614053a182eb46c3badd5886adcb894 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ee75b00eadb9b6edb840873c6056bc66c70dc3e4 commit ee75b00eadb9b6edb840873c6056bc66c70dc3e4 Merge: 7d5a57c e7511b7 Author: Brad King AuthorDate: Wed Jul 30 09:14:06 2014 -0400 Commit: CMake Topic Stage CommitDate: Wed Jul 30 09:14:06 2014 -0400 Merge topic 'cpack-ifw-generator' into next e7511b7f CPackIFW: Add package configuration variables b2340001 CPackIFW: Document cpack_ifw_configure_component DEPENDS option http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e7511b7fbe09a4007269992edcde2dc98144da47 commit e7511b7fbe09a4007269992edcde2dc98144da47 Author: Konstantin Podsvirov AuthorDate: Tue Jul 29 01:58:37 2014 +0400 Commit: Brad King CommitDate: Tue Jul 29 15:55:19 2014 -0400 CPackIFW: Add package configuration variables diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index 5b096ad..b27cd69 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -74,6 +74,7 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") string(TOUPPER ${_CPACK_IFW_COMPONENT_NAME} _CPACK_IFW_COMPONENT_UNAME) if(${CMAKE_SYSTEM_NAME} MATCHES Windows) + set(_CPACK_IFW_PACKAGE_ICON "set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")") if(BUILD_QtDialog) set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/bin/cmake-gui.exe\", \"@StartMenuDir@/CMake (cmake-gui).lnk\");\n") endif() diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 135c07d..5127220 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -34,12 +34,17 @@ include("@QT_DIALOG_CPACK_OPTIONS_FILE@" OPTIONAL) if(CPACK_GENERATOR MATCHES "IFW") # Version with QtIFW limitations set(CPACK_PACKAGE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + # Installer configuration + set(CPACK_IFW_PACKAGE_TITLE "CMake Build Tool") + set(CPACK_IFW_PRODUCT_URL "http://www.cmake.org") + @_CPACK_IFW_PACKAGE_ICON@ + set(CPACK_IFW_PACKAGE_WINDOW_ICON "@CMake_SOURCE_DIR@/Source/QtDialog/CMakeSetup128.png") # Enable install default component set(CPACK_COMPONENTS_ALL "@_CPACK_IFW_COMPONENT_NAME@") - # Configuration + # Component configuration set(CPACK_COMPONENT_ at _CPACK_IFW_COMPONENT_UNAME@_DISPLAY_NAME "@CPACK_PACKAGE_NAME@") set(CPACK_COMPONENT_ at _CPACK_IFW_COMPONENT_UNAME@_DESCRIPTION "@CPACK_PACKAGE_DESCRIPTION_SUMMARY@") - # IFW Configuration + # IFW component onfiguration set(CPACK_IFW_COMPONENT_ at _CPACK_IFW_COMPONENT_UNAME@_NAME "@CPACK_PACKAGE_NAME@") set(CPACK_IFW_COMPONENT_ at _CPACK_IFW_COMPONENT_UNAME@_LICENSES "@CPACK_PACKAGE_NAME@ Copyright" "@CPACK_RESOURCE_FILE_LICENSE@") @_CPACK_IFW_COMPONENT_SCRIPT@ diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index 8207b5e..1f6de8f 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -29,8 +29,37 @@ # Variables # ^^^^^^^^^ # -# Variables that Change Behavior -# """""""""""""""""""""""""""""" +# You can use the following variables to change behavior of CPack ``IFW`` generator. +# +# Package +# """"""" +# +# .. variable:: CPACK_IFW_PACKAGE_TITLE +# +# Name of the installer as displayed on the title bar. +# By default used :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` +# +# .. variable:: CPACK_IFW_PACKAGE_PUBLISHER +# +# Publisher of the software (as shown in the Windows Control Panel). +# By default used :variable:`CPACK_PACKAGE_VENDOR` +# +# .. variable:: CPACK_IFW_PRODUCT_URL +# +# URL to a page that contains product information on your web site. +# +# .. variable:: CPACK_IFW_PACKAGE_ICON +# +# Filename for a custom installer icon. The actual file is '.icns' (Mac OS X), +# '.ico' (Windows). No functionality on Unix. +# +# .. variable:: CPACK_IFW_PACKAGE_WINDOW_ICON +# +# Filename for a custom window icon in PNG format for the Installer application. +# +# .. variable:: CPACK_IFW_PACKAGE_LOGO +# +# Filename for a logo used as QWizard::LogoPixmap. # # .. variable:: CPACK_IFW_TARGET_DIRECTORY # @@ -45,6 +74,9 @@ # # You can use predefined variables. # +# Components +# """""""""" +# # .. variable:: CPACK_IFW_RESOLVE_DUPLICATE_NAMES # # Resolve duplicate names when installing components with groups. @@ -54,8 +86,8 @@ # Additional prepared packages dirs that will be used to resolve # dependent components. # -# Advanced Variables -# """""""""""""""""" +# Advanced +# """""""" # # .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE # diff --git a/Source/CPack/cmCPackIFWGenerator.cxx b/Source/CPack/cmCPackIFWGenerator.cxx index 51c0f2e..3a7f539 100644 --- a/Source/CPack/cmCPackIFWGenerator.cxx +++ b/Source/CPack/cmCPackIFWGenerator.cxx @@ -680,14 +680,19 @@ int cmCPackIFWGenerator::IfwCreateConfigFile() ifwPkgName = "Your package"; } - std::string ifwPkgDescription; - if (const char *name = this->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) + std::string pkgTitle; + if (const char *title = this->GetOption("CPACK_IFW_PACKAGE_TITLE")) { - ifwPkgDescription = name; + pkgTitle = title; + } + else if (const char *description = + this->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) + { + pkgTitle = description; } else { - ifwPkgDescription = "Your package description"; + pkgTitle = "Your package description"; } std::string ifwPkgVersion; @@ -711,9 +716,64 @@ int cmCPackIFWGenerator::IfwCreateConfigFile() cfg << "" << std::endl; cfg << " " << cmXMLSafe(ifwPkgName).str() << "" << std::endl; cfg << " " << ifwPkgVersion << "" << std::endl; - cfg << " " << cmXMLSafe(ifwPkgDescription).str() << "" + cfg << " " << cmXMLSafe(pkgTitle).str() << "" << std::endl; + // Publisher + std::string ifwPublisher; + if(const char *publisher = GetOption("CPACK_IFW_PACKAGE_PUBLISHER")) + { + ifwPublisher = publisher; + } + else if(const char *vendor = GetOption("CPACK_PACKAGE_VENDOR")) + { + ifwPublisher = vendor; + } + if(!ifwPublisher.empty()) + { + cfg << " " << cmXMLSafe(ifwPublisher).str() + << "" << std::endl; + } + + // ProductUrl + if(const char *url = GetOption("CPACK_IFW_PRODUCT_URL")) + { + cfg << " " << url << "" << std::endl; + } + + // ApplicationIcon + const char *pkgApplicationIcon = GetOption("CPACK_IFW_PACKAGE_ICON"); + if(pkgApplicationIcon && cmSystemTools::FileExists(pkgApplicationIcon)) + { + std::string name = cmSystemTools::GetFilenameName(pkgApplicationIcon); + std::string path = this->toplevel + "/config/" + name; + name = cmSystemTools::GetFilenameWithoutExtension(name); + cmsys::SystemTools::CopyFileIfDifferent(pkgApplicationIcon, path.data()); + cfg << " " << name + << "" << std::endl; + } + + // WindowIcon + const char *pkgWindowIcon = GetOption("CPACK_IFW_PACKAGE_WINDOW_ICON"); + if(pkgWindowIcon && cmSystemTools::FileExists(pkgWindowIcon)) + { + std::string name = cmSystemTools::GetFilenameName(pkgWindowIcon); + std::string path = this->toplevel + "/config/" + name; + cmsys::SystemTools::CopyFileIfDifferent(pkgWindowIcon, path.data()); + cfg << " " << name + << "" << std::endl; + } + + // Logo + const char *pkgLogo = GetOption("CPACK_IFW_PACKAGE_LOGO"); + if(pkgLogo && cmSystemTools::FileExists(pkgLogo)) + { + std::string name = cmSystemTools::GetFilenameName(pkgLogo); + std::string path = this->toplevel + "/config/" + name; + cmsys::SystemTools::CopyFileIfDifferent(pkgLogo, path.data()); + cfg << " " << name << "" << std::endl; + } + // Default target directory for installation if (ifwTargetDir) { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b234000184bbf314bf0a7380a1d4ebb54f7c8f69 commit b234000184bbf314bf0a7380a1d4ebb54f7c8f69 Author: Konstantin Podsvirov AuthorDate: Fri Jul 25 10:47:07 2014 +0400 Commit: Brad King CommitDate: Tue Jul 29 15:52:01 2014 -0400 CPackIFW: Document cpack_ifw_configure_component DEPENDS option diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index f99488a..8207b5e 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -95,6 +95,7 @@ # [SCRIPT