diff options
31 files changed, 479 insertions, 139 deletions
diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index c733969..0ccbfac 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -60,6 +60,12 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles") ENDIF(CMAKE_GENERATOR MATCHES "Unix Makefiles") ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") +IF(CMAKE_GENERATOR MATCHES "Ninja") + SET(CMAKE_EXPORT_COMPILE_COMMANDS OFF CACHE BOOL + "Enable/Disable output of compile commands during generation." + ) + MARK_AS_ADVANCED(CMAKE_EXPORT_COMPILE_COMMANDS) +ENDIF(CMAKE_GENERATOR MATCHES "Ninja") # GetDefaultWindowsPrefixBase # diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index cba746f..ae93512 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -488,7 +488,10 @@ FOREACH(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLIC MESSAGE("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") ENDIF(CPACK_RPM_PACKAGE_DEBUG) SET(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") -ENDIF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) + ELSE(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) + # Do not forget to unset previously set header (from previous component) + UNSET(TMP_RPM_${_RPM_SPEC_HEADER}) + ENDIF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) ENDFOREACH(_RPM_SPEC_HEADER) # CPACK_RPM_SPEC_INSTALL_POST diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index 7130192..ce7f255 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -22,11 +22,15 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(BZIP2_INCLUDE_DIR bzlib.h ) +SET(_BZIP2_PATHS PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Bzip2;InstallPath]" + ) + +FIND_PATH(BZIP2_INCLUDE_DIR bzlib.h ${_BZIP2_PATHS} PATH_SUFFIXES include) IF (NOT BZIP2_LIBRARIES) - FIND_LIBRARY(BZIP2_LIBRARY_RELEASE NAMES bz2 bzip2 ) - FIND_LIBRARY(BZIP2_LIBRARY_DEBUG NAMES bzip2d ) + FIND_LIBRARY(BZIP2_LIBRARY_RELEASE NAMES bz2 bzip2 ${_BZIP2_PATHS} PATH_SUFFIXES lib) + FIND_LIBRARY(BZIP2_LIBRARY_DEBUG NAMES bzip2d ${_BZIP2_PATHS} PATH_SUFFIXES lib) INCLUDE(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) SELECT_LIBRARY_CONFIGURATIONS(BZIP2) diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake new file mode 100644 index 0000000..729f5ce --- /dev/null +++ b/Modules/FindLibLZMA.cmake @@ -0,0 +1,69 @@ +# - Find LibLZMA +# Find LibLZMA headers and library +# +# LIBLZMA_FOUND - True if liblzma is found. +# LIBLZMA_INCLUDE_DIRS - Directory where liblzma headers are located. +# LIBLZMA_LIBRARIES - Lzma libraries to link against. +# LIBLZMA_HAS_AUTO_DECODER - True if lzma_auto_decoder() is found (required). +# LIBLZMA_HAS_EASY_ENCODER - True if lzma_easy_encoder() is found (required). +# LIBLZMA_HAS_LZMA_PRESET - True if lzma_lzma_preset() is found (required). +# LIBLZMA_VERSION_MAJOR - The major version of lzma +# LIBLZMA_VERSION_MINOR - The minor version of lzma +# LIBLZMA_VERSION_PATCH - The patch version of lzma +# LIBLZMA_VERSION_STRING - version number as a string (ex: "5.0.3") + +#============================================================================= +# Copyright 2008 Per Øyvind Karlsen <peroyvind@mandriva.org> +# Copyright 2009 Alexander Neundorf <neundorf@kde.org> +# Copyright 2009 Helio Chissini de Castro <helio@kde.org> +# Copyright 2012 Mario Bensi <mbensi@ipsquad.net> +# +# 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.) + + +FIND_PATH(LIBLZMA_INCLUDE_DIR lzma.h ) +FIND_LIBRARY(LIBLZMA_LIBRARY lzma) + +IF(LIBLZMA_INCLUDE_DIR AND EXISTS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h") + FILE(READ "${LIBLZMA_INCLUDE_DIR}/lzma/version.h" LIBLZMA_HEADER_CONTENTS) + + STRING(REGEX REPLACE ".*#define LZMA_VERSION_MAJOR ([0-9]+).*" "\\1" LIBLZMA_VERSION_MAJOR "${LIBLZMA_HEADER_CONTENTS}") + STRING(REGEX REPLACE ".*#define LZMA_VERSION_MINOR ([0-9]+).*" "\\1" LIBLZMA_VERSION_MINOR "${LIBLZMA_HEADER_CONTENTS}") + STRING(REGEX REPLACE ".*#define LZMA_VERSION_PATCH ([0-9]+).*" "\\1" LIBLZMA_VERSION_PATCH "${LIBLZMA_HEADER_CONTENTS}") + + SET(LIBLZMA_VERSION_STRING "${LIBLZMA_VERSION_MAJOR}.${LIBLZMA_VERSION_MINOR}.${LIBLZMA_VERSION_PATCH}") +ENDIF(LIBLZMA_INCLUDE_DIR AND EXISTS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h") + +# We're using new code known now as XZ, even library still been called LZMA +# it can be found in http://tukaani.org/xz/ +# Avoid using old codebase +IF (LIBLZMA_LIBRARY) + INCLUDE(CheckLibraryExists) + CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER) + CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER) + CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET) +ENDIF (LIBLZMA_LIBRARY) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibLZMA REQUIRED_VARS LIBLZMA_INCLUDE_DIR + LIBLZMA_LIBRARY + LIBLZMA_HAS_AUTO_DECODER + LIBLZMA_HAS_EASY_ENCODER + LIBLZMA_HAS_LZMA_PRESET + VERSION_VAR LIBLZMA_VERSION_STRING + ) + +IF (LIBLZMA_FOUND) + SET(LIBLZMA_LIBRARIES ${LIBLZMA_LIBRARY}) + SET(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_INCLUDE_DIR}) +ENDIF (LIBLZMA_FOUND) + +MARK_AS_ADVANCED( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY ) diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 478ebcb..11ff196 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -45,13 +45,19 @@ IF(PythonLibs_FIND_VERSION) STRING(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION}") STRING(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}") UNSET(_PYTHON_FIND_OTHER_VERSIONS) - IF(NOT PythonLibs_FIND_VERSION_EXACT) + IF(PythonLibs_FIND_VERSION_EXACT) + IF(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION) + SET(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}") + ELSE(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION) + SET(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}" "${_PYTHON_FIND_MAJ_MIN}") + ENDIF(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION) + ELSE(PythonLibs_FIND_VERSION_EXACT) FOREACH(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS}) IF(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN) LIST(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V}) ENDIF() ENDFOREACH() - ENDIF(NOT PythonLibs_FIND_VERSION_EXACT) + ENDIF(PythonLibs_FIND_VERSION_EXACT) UNSET(_PYTHON_FIND_MAJ_MIN) UNSET(_PYTHON_FIND_MAJ) ELSE(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index f9db5e1..391797e 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -1059,7 +1059,11 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION) SET( QT_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qsvg qtiff ) SET( QT_INPUTMETHODS_PLUGINS qimsw_multi ) SET( QT_MOUSEDRIVERS_PLUGINS qwstslibmousehandler ) - SET( QT_PHONON_BACKEND_PLUGINS phonon_qt7 ) + IF(APPLE) + SET( QT_PHONON_BACKEND_PLUGINS phonon_qt7 ) + ELSEIF(WIN32) + SET( QT_PHONON_BACKEND_PLUGINS phonon_ds9 ) + ENDIF() SET( QT_SCRIPT_PLUGINS qtscriptdbus ) SET( QT_SQLDRIVERS_PLUGINS qsqldb2 qsqlibase qsqlite qsqlite2 qsqlmysql qsqloci qsqlodbc qsqlpsql qsqltds ) diff --git a/Modules/Platform/Darwin-icc.cmake b/Modules/Platform/Darwin-icc.cmake index e675c0e..b592e5f 100644 --- a/Modules/Platform/Darwin-icc.cmake +++ b/Modules/Platform/Darwin-icc.cmake @@ -106,7 +106,9 @@ SET(CMAKE_Fortran_CREATE_SHARED_MODULE # default to searching for frameworks first -SET(CMAKE_FIND_FRAMEWORK FIRST) +IF(NOT DEFINED CMAKE_FIND_FRAMEWORK) + SET(CMAKE_FIND_FRAMEWORK FIRST) +ENDIF() # set up the default search directories for frameworks SET(CMAKE_SYSTEM_FRAMEWORK_PATH ~/Library/Frameworks @@ -115,7 +117,9 @@ SET(CMAKE_SYSTEM_FRAMEWORK_PATH /System/Library/Frameworks) # default to searching for application bundles first -SET(CMAKE_FIND_APPBUNDLE FIRST) +IF(NOT DEFINED CMAKE_FIND_APPBUNDLE) + SET(CMAKE_FIND_APPBUNDLE FIRST) +ENDIF() # set up the default search directories for application bundles SET(CMAKE_SYSTEM_APPBUNDLE_PATH ~/Applications @@ -125,4 +129,3 @@ SET(CMAKE_SYSTEM_APPBUNDLE_PATH INCLUDE(Platform/UnixPaths) SET(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH} /sw/include) SET(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH} /sw/lib) - diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index a19bfe7..eff07b2 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -228,9 +228,10 @@ SET(CMAKE_CXX_CREATE_MACOSX_FRAMEWORK "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") - # default to searching for frameworks first -SET(CMAKE_FIND_FRAMEWORK FIRST) +IF(NOT DEFINED CMAKE_FIND_FRAMEWORK) + SET(CMAKE_FIND_FRAMEWORK FIRST) +ENDIF() # set up the default search directories for frameworks SET(CMAKE_SYSTEM_FRAMEWORK_PATH ~/Library/Frameworks @@ -239,7 +240,9 @@ SET(CMAKE_SYSTEM_FRAMEWORK_PATH /System/Library/Frameworks) # default to searching for application bundles first -SET(CMAKE_FIND_APPBUNDLE FIRST) +IF(NOT DEFINED CMAKE_FIND_APPBUNDLE) + SET(CMAKE_FIND_APPBUNDLE FIRST) +ENDIF() # set up the default search directories for application bundles SET(_apps_paths) FOREACH(_path diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index f327125..f867bc5 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -182,23 +182,31 @@ MACRO (QT4_ADD_RESOURCES outfiles ) GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE) GET_FILENAME_COMPONENT(rc_path ${infile} PATH) SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx) - # parse file for dependencies - # all files are absolute paths or relative to the location of the qrc file - FILE(READ "${infile}" _RC_FILE_CONTENTS) - STRING(REGEX MATCHALL "<file[^<]+" _RC_FILES "${_RC_FILE_CONTENTS}") + SET(_RC_DEPENDS) - FOREACH(_RC_FILE ${_RC_FILES}) - STRING(REGEX REPLACE "^<file[^>]*>" "" _RC_FILE "${_RC_FILE}") - IF(NOT IS_ABSOLUTE "${_RC_FILE}") - SET(_RC_FILE "${rc_path}/${_RC_FILE}") - ENDIF(NOT IS_ABSOLUTE "${_RC_FILE}") - SET(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}") - ENDFOREACH(_RC_FILE) - # Since this cmake macro is doing the dependency scanning for these files, - # let's make a configured file and add it as a dependency so cmake is run - # again when dependencies need to be recomputed. - QT4_MAKE_OUTPUT_FILE("${infile}" "" "qrc.depends" out_depends) - CONFIGURE_FILE("${infile}" "${out_depends}" COPY_ONLY) + IF(EXISTS "${infile}") + # parse file for dependencies + # all files are absolute paths or relative to the location of the qrc file + FILE(READ "${infile}" _RC_FILE_CONTENTS) + STRING(REGEX MATCHALL "<file[^<]+" _RC_FILES "${_RC_FILE_CONTENTS}") + FOREACH(_RC_FILE ${_RC_FILES}) + STRING(REGEX REPLACE "^<file[^>]*>" "" _RC_FILE "${_RC_FILE}") + IF(NOT IS_ABSOLUTE "${_RC_FILE}") + SET(_RC_FILE "${rc_path}/${_RC_FILE}") + ENDIF(NOT IS_ABSOLUTE "${_RC_FILE}") + SET(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}") + ENDFOREACH(_RC_FILE) + # Since this cmake macro is doing the dependency scanning for these files, + # let's make a configured file and add it as a dependency so cmake is run + # again when dependencies need to be recomputed. + QT4_MAKE_OUTPUT_FILE("${infile}" "" "qrc.depends" out_depends) + CONFIGURE_FILE("${infile}" "${out_depends}" COPY_ONLY) + ELSE(EXISTS "${infile}") + # The .qrc file does not exist (yet). Let's add a dependency and hope + # that it will be generated later + SET(out_depends) + ENDIF(EXISTS "${infile}") + ADD_CUSTOM_COMMAND(OUTPUT ${outfile} COMMAND ${QT_RCC_EXECUTABLE} ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile} diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 30cc920..0b2d1b8 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -533,9 +533,9 @@ function (find_jar VARIABLE) endif (${_state} STREQUAL "name") endforeach (arg ${ARGN}) - if (${_jar_names} STREQUAL "") + if (NOT _jar_names) message(FATAL_ERROR "find_jar: No name to search for given") - endif (${_jar_names} STREQUAL "") + endif (NOT _jar_names) foreach (jar_name ${_jar_names}) foreach (version ${_jar_versions}) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2e95a19..345a56f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 8) SET(CMake_VERSION_PATCH 8) -SET(CMake_VERSION_TWEAK 20120604) +SET(CMake_VERSION_TWEAK 20120612) #SET(CMake_VERSION_RC 1) diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index dc6b749..b410e44 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -240,6 +240,7 @@ bool cmArchiveWrite::AddFile(const char* file, // Clear acl and xattr fields not useful for distribution. archive_entry_acl_clear(e); archive_entry_xattr_clear(e); + archive_entry_set_fflags(e, 0, 0); if(archive_write_header(this->Archive, e) != ARCHIVE_OK) { this->Error = "archive_write_header: "; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index f3a7090..a47ca36 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2495,3 +2495,16 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target) cmSystemTools::RemoveFile(file.c_str()); } } + +//---------------------------------------------------------------------------- +// static +std::string cmGlobalGenerator::EscapeJSON(const std::string& s) { + std::string result; + for (std::string::size_type i = 0; i < s.size(); ++i) { + if (s[i] == '"' || s[i] == '\\') { + result += '\\'; + } + result += s[i]; + } + return result; +} diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 0ac38a0..ce91793 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -282,6 +282,8 @@ public: /** Generate an <output>.rule file path for a given command output. */ virtual std::string GenerateRuleFile(std::string const& output) const; + static std::string EscapeJSON(const std::string& s); + protected: typedef std::vector<cmLocalGenerator*> GeneratorVector; // for a project collect all its targets by following depend diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 328706c..40348e6 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -66,7 +66,7 @@ std::string cmGlobalNinjaGenerator::EncodeIdent(const std::string &ident, if (std::find_if(ident.begin(), ident.end(), std::not1(std::ptr_fun(IsIdentChar))) != ident.end()) { static unsigned VarNum = 0; - std::ostringstream names; + cmOStringStream names; names << "ident" << VarNum++; vars << names.str() << " = " << ident << "\n"; return "$" + names.str(); @@ -123,7 +123,7 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os, cmGlobalNinjaGenerator::WriteComment(os, comment); - std::ostringstream builds; + cmOStringStream builds; // TODO: Better formatting for when there are multiple input/output files. @@ -341,6 +341,7 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator() : cmGlobalGenerator() , BuildFileStream(0) , RulesFileStream(0) + , CompileCommandsStream(0) , Rules() , AllDependencies() { @@ -390,6 +391,7 @@ void cmGlobalNinjaGenerator::Generate() this->BuildFileStream->setstate(std::ios_base::failbit); } + this->CloseCompileCommandsStream(); this->CloseRulesFileStream(); this->CloseBuildFileStream(); } @@ -623,6 +625,46 @@ void cmGlobalNinjaGenerator::CloseRulesFileStream() } } +void cmGlobalNinjaGenerator::AddCXXCompileCommand( + const std::string &commandLine, + const std::string &sourceFile) +{ + // Compute Ninja's build file path. + std::string buildFileDir = + this->GetCMakeInstance()->GetHomeOutputDirectory(); + if (!this->CompileCommandsStream) + { + std::string buildFilePath = buildFileDir + "/compile_commands.json"; + + // Get a stream where to generate things. + this->CompileCommandsStream = + new cmGeneratedFileStream(buildFilePath.c_str()); + *this->CompileCommandsStream << "["; + } else { + *this->CompileCommandsStream << "," << std::endl; + } + + *this->CompileCommandsStream << "\n{\n" + << " \"directory\": \"" + << cmGlobalGenerator::EscapeJSON(buildFileDir) << "\",\n" + << " \"command\": \"" + << cmGlobalGenerator::EscapeJSON(commandLine) << "\",\n" + << " \"file\": \"" + << cmGlobalGenerator::EscapeJSON(sourceFile) << "\"\n" + << "}"; +} + +void cmGlobalNinjaGenerator::CloseCompileCommandsStream() +{ + if (this->CompileCommandsStream) + { + *this->CompileCommandsStream << "\n]"; + delete this->CompileCommandsStream; + this->CompileCommandsStream = 0; + } + +} + void cmGlobalNinjaGenerator::WriteDisclaimer(std::ostream& os) { os @@ -783,7 +825,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) cmLocalGenerator *lg = this->LocalGenerators[0]; cmMakefile* mfRoot = lg->GetMakefile(); - std::ostringstream cmd; + cmOStringStream cmd; cmd << lg->ConvertToOutputFormat( mfRoot->GetRequiredDefinition("CMAKE_COMMAND"), cmLocalGenerator::SHELL) diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index e652972..7b6b9b7 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -213,6 +213,9 @@ public: cmGeneratedFileStream* GetRulesFileStream() const { return this->RulesFileStream; } + void AddCXXCompileCommand(const std::string &commandLine, + const std::string &sourceFile); + /** * Add a rule to the generated build system. * Call WriteRule() behind the scene but perform some check before like: @@ -254,6 +257,8 @@ private: void OpenBuildFileStream(); void CloseBuildFileStream(); + void CloseCompileCommandsStream(); + void OpenRulesFileStream(); void CloseRulesFileStream(); @@ -311,6 +316,7 @@ private: /// The file containing the rule statements. (The action attached to each /// edge of the compilation DAG). cmGeneratedFileStream* RulesFileStream; + cmGeneratedFileStream* CompileCommandsStream; /// The type used to store the set of rules added to the generated build /// system. diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index e63de9c..ebd8219 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -103,18 +103,6 @@ cmGlobalUnixMakefileGenerator3 } } -//---------------------------------------------------------------------------- -std::string EscapeJSON(const std::string& s) { - std::string result; - for (std::string::size_type i = 0; i < s.size(); ++i) { - if (s[i] == '"' || s[i] == '\\') { - result += '\\'; - } - result += s[i]; - } - return result; -} - void cmGlobalUnixMakefileGenerator3::Generate() { // first do superclass method @@ -179,11 +167,14 @@ void cmGlobalUnixMakefileGenerator3::AddCXXCompileCommand( *this->CommandDatabase << "," << std::endl; } *this->CommandDatabase << "{" << std::endl - << " \"directory\": \"" << EscapeJSON(workingDirectory) << "\"," + << " \"directory\": \"" + << cmGlobalGenerator::EscapeJSON(workingDirectory) << "\"," << std::endl - << " \"command\": \"" << EscapeJSON(compileCommand) << "\"," + << " \"command\": \"" << + cmGlobalGenerator::EscapeJSON(compileCommand) << "\"," << std::endl - << " \"file\": \"" << EscapeJSON(sourceFile) << "\"" + << " \"file\": \"" << + cmGlobalGenerator::EscapeJSON(sourceFile) << "\"" << std::endl << "}"; } diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 18a786d..947a1c9 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -278,3 +278,9 @@ void cmGlobalVisualStudio10Generator::PathTooLong( this->LongestSource.SourceRel = sfRel; } } + +//---------------------------------------------------------------------------- +bool cmGlobalVisualStudio10Generator::UseFolderProperty() +{ + return IsExpressEdition() ? false : cmGlobalGenerator::UseFolderProperty(); +} diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 4236563..060cdff 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -88,6 +88,9 @@ protected: std::string PlatformToolset; bool ExpressEdition; + + bool UseFolderProperty(); + private: struct LongestSourcePath { diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 425b219..f6a6bc2 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -280,7 +280,7 @@ std::string cmLocalNinjaGenerator::BuildCommandLine( // $in variables. A discussion about dealing with multiple commands in // a rule is started here: // groups.google.com/group/ninja-build/browse_thread/thread/d515f23a78986008 - std::ostringstream cmd; + cmOStringStream cmd; for (std::vector<std::string>::const_iterator li = cmdLines.begin(); li != cmdLines.end(); ++li) { if (li != cmdLines.begin()) @@ -299,7 +299,7 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(const cmCustomCommand *cc, if (!wd) wd = this->GetMakefile()->GetStartOutputDirectory(); - std::ostringstream cdCmd; + cmOStringStream cdCmd; cdCmd << "cd " << this->ConvertToOutputFormat(wd, SHELL); cmdLines.push_back(cdCmd.str()); } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index a645303..db93529 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -36,6 +36,30 @@ #include <queue> //---------------------------------------------------------------------------- +// Escape special characters in Makefile dependency lines +class cmMakeSafe +{ +public: + cmMakeSafe(const char* s): Data(s) {} + cmMakeSafe(std::string const& s): Data(s.c_str()) {} +private: + const char* Data; + friend std::ostream& operator<<(std::ostream& os, + cmMakeSafe const& self) + { + for(const char* c = self.Data; *c; ++c) + { + switch (*c) + { + case '=': os << "$(EQUALS)"; break; + default: os << *c; break; + } + } + return os; + } +}; + +//---------------------------------------------------------------------------- // Helper function used below. static std::string cmSplitExtension(std::string const& in, std::string& base) { @@ -555,28 +579,13 @@ cmLocalUnixMakefileGenerator3 space = " "; } - // Warn about paths not supported by Make tools. - std::string::size_type pos = tgt.find_first_of("="); - if(pos != std::string::npos) - { - cmOStringStream m; - m << - "Make rule for\n" - " " << tgt << "\n" - "has '=' on left hand side. " - "The make tool may not support this."; - cmListFileBacktrace bt; - this->GlobalGenerator->GetCMakeInstance() - ->IssueMessage(cmake::WARNING, m.str(), bt); - } - // Mark the rule as symbolic if requested. if(symbolic) { if(const char* sym = this->Makefile->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE")) { - os << tgt.c_str() << space << ": " << sym << "\n"; + os << cmMakeSafe(tgt) << space << ": " << sym << "\n"; } } @@ -584,7 +593,7 @@ cmLocalUnixMakefileGenerator3 if(depends.empty()) { // No dependencies. The commands will always run. - os << tgt.c_str() << space << ":\n"; + os << cmMakeSafe(tgt) << space << ":\n"; } else { @@ -595,7 +604,7 @@ cmLocalUnixMakefileGenerator3 { replace = *dep; replace = this->Convert(replace.c_str(),HOME_OUTPUT,MAKEFILE); - os << tgt.c_str() << space << ": " << replace.c_str() << "\n"; + os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n"; } } @@ -608,7 +617,7 @@ cmLocalUnixMakefileGenerator3 } if(symbolic && !this->WatcomWMake) { - os << ".PHONY : " << tgt.c_str() << "\n"; + os << ".PHONY : " << cmMakeSafe(tgt) << "\n"; } os << "\n"; // Add the output to the local help if requested. @@ -687,6 +696,10 @@ cmLocalUnixMakefileGenerator3 << this->ConvertShellCommand(cmakecommand, FULL) << " -E remove -f\n" << "\n"; + makefileStream + << "# Escaping for special characters.\n" + << "EQUALS = =\n" + << "\n"; if(const char* edit_cmd = this->Makefile->GetDefinition("CMAKE_EDIT_COMMAND")) diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 9faf46d..f2ab79d 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1933,9 +1933,11 @@ cmLocalVisualStudio7Generator vskey += "\\Packages\\" CM_INTEL_PLUGIN_GUID ";ProductVersion"; cmSystemTools::ReadRegistryValue(vskey.c_str(), intelVersion, cmSystemTools::KeyWOW64_32); - if (intelVersion.find("12") == 0 || (intelVersion.find("11") == 0)) + if (intelVersion.find("13") == 0 || + intelVersion.find("12") == 0 || + intelVersion.find("11") == 0) { - // Version 11.x and 12.x actually use 11.0 in project files! + // Version 11.x, 12.x, and 13.x actually use 11.0 in project files! intelVersion = "11.0" ; } else if(intelVersion.find("10") == 0) diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 8b86a98..1751091 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -215,10 +215,10 @@ cmNinjaNormalTargetGenerator this->GetLocalGenerator()->BuildCommandLine(linkCmds); // Write the linker rule. - std::ostringstream comment; + cmOStringStream comment; comment << "Rule for linking " << this->TargetLinkLanguage << " " << this->GetVisibleTypeName() << "."; - std::ostringstream description; + cmOStringStream description; description << "Linking " << this->TargetLinkLanguage << " " << this->GetVisibleTypeName() << " $out"; this->GetGlobalGenerator()->AddRule(ruleName, @@ -353,7 +353,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() /*implib=*/true).c_str()); // Compute the comment. - std::ostringstream comment; + cmOStringStream comment; comment << "Link the " << this->GetVisibleTypeName() << " " << targetOutputReal; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index b3394bb..a362d13 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -362,9 +362,9 @@ cmNinjaTargetGenerator this->GetLocalGenerator()->BuildCommandLine(compileCmds); // Write the rule for compiling file of the given language. - std::ostringstream comment; + cmOStringStream comment; comment << "Rule for compiling " << language << " files."; - std::ostringstream description; + cmOStringStream description; description << "Building " << language << " object $out"; this->GetGlobalGenerator()->AddRule(this->LanguageCompilerRule(language), cmdLine, @@ -484,6 +484,39 @@ cmNinjaTargetGenerator vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( this->GetTargetPDB().c_str(), cmLocalGenerator::SHELL); + if(this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS")) + { + cmLocalGenerator::RuleVariables compileObjectVars; + std::string lang = language; + compileObjectVars.Language = lang.c_str(); + std::string escapedSourceFileName = + this->LocalGenerator->ConvertToOutputFormat( + sourceFileName.c_str(), cmLocalGenerator::SHELL); + compileObjectVars.Source = escapedSourceFileName.c_str(); + compileObjectVars.Object = objectFileName.c_str(); + compileObjectVars.Flags = vars["FLAGS"].c_str(); + compileObjectVars.Defines = vars["DEFINES"].c_str(); + + // Rule for compiling object file. + std::string compileCmdVar = "CMAKE_"; + compileCmdVar += language; + compileCmdVar += "_COMPILE_OBJECT"; + std::string compileCmd = + this->GetMakefile()->GetRequiredDefinition(compileCmdVar.c_str()); + std::vector<std::string> compileCmds; + cmSystemTools::ExpandListArgument(compileCmd, compileCmds); + + for (std::vector<std::string>::iterator i = compileCmds.begin(); + i != compileCmds.end(); ++i) + this->GetLocalGenerator()->ExpandRuleVariables(*i, compileObjectVars); + + std::string cmdLine = + this->GetLocalGenerator()->BuildCommandLine(compileCmds); + + this->GetGlobalGenerator()->AddCXXCompileCommand(cmdLine, + sourceFileName); + } + cmGlobalNinjaGenerator::WriteBuild(this->GetBuildFileStream(), comment, rule, diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index ca27530..113d678 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -18,6 +18,7 @@ #include "cmSystemTools.h" #include <cmsys/Terminal.h> +#include <cmsys/ios/sstream> #include <string.h> #if defined(__APPLE__) @@ -549,7 +550,7 @@ bool cmQtAutomoc::RunAutomoc() this->GenerateMoc(it->first, it->second); } - std::stringstream outStream(std::stringstream::out); + cmsys_ios::stringstream outStream; outStream << "/* This file is autogenerated, do not edit*/\n"; bool automocCppChanged = false; @@ -1077,7 +1078,7 @@ bool cmQtAutomoc::EndsWith(const std::string& str, const std::string& with) std::string cmQtAutomoc::ReadAll(const std::string& filename) { std::ifstream file(filename.c_str()); - std::stringstream stream; + cmsys_ios::stringstream stream; stream << file.rdbuf(); file.close(); return stream.str(); diff --git a/Source/kwsys/hashtable.hxx.in b/Source/kwsys/hashtable.hxx.in index db52fc8..c835503 100644 --- a/Source/kwsys/hashtable.hxx.in +++ b/Source/kwsys/hashtable.hxx.in @@ -394,7 +394,7 @@ enum { _stl_num_primes = 31 }; // create a function with a static local to that function that returns // the static -inline const unsigned long* get_stl_prime_list() { +static inline const unsigned long* get_stl_prime_list() { static const unsigned long _stl_prime_list[_stl_num_primes] = { diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx index 3f141c5..434cbee 100644 --- a/Tests/CMakeLib/run_compile_commands.cxx +++ b/Tests/CMakeLib/run_compile_commands.cxx @@ -35,7 +35,7 @@ private: void ParseTranslationUnits() { this->TranslationUnits = TranslationUnitsType(); - ExpectOrDie('[', "at start of compile command file"); + ExpectOrDie('[', "at start of compile command file\n"); do { ParseTranslationUnit(); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 68c08a4..9deb8ac 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -47,7 +47,7 @@ CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in # Testing IF(BUILD_TESTING) - IF("${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles") + IF("${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_TEST_GENERATOR}" MATCHES Ninja AND NOT WIN32)) SET(TEST_CompileCommandOutput 1) ENDIF() diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index fc65e58..551cee3 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -71,7 +71,7 @@ endmacro(check_version_string) # reported. foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HSPELL - JASPER LIBXML2 LIBXSLT PERL PKG_CONFIG PostgreSQL TIFF ZLIB) + JASPER LIBLZMA LIBXML2 LIBXSLT PERL PKG_CONFIG PostgreSQL TIFF ZLIB) check_version_string(${VTEST} ${VTEST}_VERSION_STRING) endforeach(VTEST) diff --git a/Utilities/KWIML/INT.h.in b/Utilities/KWIML/INT.h.in index 3c1f05d..d40edcd 100644 --- a/Utilities/KWIML/INT.h.in +++ b/Utilities/KWIML/INT.h.in @@ -87,6 +87,10 @@ An includer may test the following macros after inclusion: The SCN*8 and SCN*64 format macros will not be defined on systems with scanf implementations known not to support them. + @KWIML@_INT_BROKEN_<fmt># = macro <fmt># is incorrect if defined + Some compilers define integer format macros incorrectly for their + own formatted print/scan implementations. + @KWIML@_INT_BROKEN_INT64_C = macro INT64_C is incorrect if defined @KWIML@_INT_BROKEN_UINT64_C = macro UINT64_C is incorrect if defined Some compilers define integer constant macros incorrectly and @@ -172,6 +176,65 @@ An includer may test the following macros after inclusion: #define @KWIML@_INT_HAVE_UINTPTR_T 1 #endif +#if defined(_AIX43) && !defined(_AIX50) && !defined(_AIX51) + /* AIX 4.3 defines these incorrectly with % and no quotes. */ +# define @KWIML@_INT_BROKEN_PRId8 +# define @KWIML@_INT_BROKEN_SCNd8 +# define @KWIML@_INT_BROKEN_PRIi8 +# define @KWIML@_INT_BROKEN_SCNi8 +# define @KWIML@_INT_BROKEN_PRIo8 +# define @KWIML@_INT_BROKEN_SCNo8 +# define @KWIML@_INT_BROKEN_PRIu8 +# define @KWIML@_INT_BROKEN_SCNu8 +# define @KWIML@_INT_BROKEN_PRIx8 +# define @KWIML@_INT_BROKEN_SCNx8 +# define @KWIML@_INT_BROKEN_PRIX8 +# define @KWIML@_INT_BROKEN_PRId16 +# define @KWIML@_INT_BROKEN_SCNd16 +# define @KWIML@_INT_BROKEN_PRIi16 +# define @KWIML@_INT_BROKEN_SCNi16 +# define @KWIML@_INT_BROKEN_PRIo16 +# define @KWIML@_INT_BROKEN_SCNo16 +# define @KWIML@_INT_BROKEN_PRIu16 +# define @KWIML@_INT_BROKEN_SCNu16 +# define @KWIML@_INT_BROKEN_PRIx16 +# define @KWIML@_INT_BROKEN_SCNx16 +# define @KWIML@_INT_BROKEN_PRIX16 +# define @KWIML@_INT_BROKEN_PRId32 +# define @KWIML@_INT_BROKEN_SCNd32 +# define @KWIML@_INT_BROKEN_PRIi32 +# define @KWIML@_INT_BROKEN_SCNi32 +# define @KWIML@_INT_BROKEN_PRIo32 +# define @KWIML@_INT_BROKEN_SCNo32 +# define @KWIML@_INT_BROKEN_PRIu32 +# define @KWIML@_INT_BROKEN_SCNu32 +# define @KWIML@_INT_BROKEN_PRIx32 +# define @KWIML@_INT_BROKEN_SCNx32 +# define @KWIML@_INT_BROKEN_PRIX32 +# define @KWIML@_INT_BROKEN_PRId64 +# define @KWIML@_INT_BROKEN_SCNd64 +# define @KWIML@_INT_BROKEN_PRIi64 +# define @KWIML@_INT_BROKEN_SCNi64 +# define @KWIML@_INT_BROKEN_PRIo64 +# define @KWIML@_INT_BROKEN_SCNo64 +# define @KWIML@_INT_BROKEN_PRIu64 +# define @KWIML@_INT_BROKEN_SCNu64 +# define @KWIML@_INT_BROKEN_PRIx64 +# define @KWIML@_INT_BROKEN_SCNx64 +# define @KWIML@_INT_BROKEN_PRIX64 +# define @KWIML@_INT_BROKEN_PRIdPTR +# define @KWIML@_INT_BROKEN_SCNdPTR +# define @KWIML@_INT_BROKEN_PRIiPTR +# define @KWIML@_INT_BROKEN_SCNiPTR +# define @KWIML@_INT_BROKEN_PRIoPTR +# define @KWIML@_INT_BROKEN_SCNoPTR +# define @KWIML@_INT_BROKEN_PRIuPTR +# define @KWIML@_INT_BROKEN_SCNuPTR +# define @KWIML@_INT_BROKEN_PRIxPTR +# define @KWIML@_INT_BROKEN_SCNxPTR +# define @KWIML@_INT_BROKEN_PRIXPTR +#endif + #if (defined(__SUNPRO_C)||defined(__SUNPRO_CC)) && defined(_CHAR_IS_UNSIGNED) # define @KWIML@_INT_BROKEN_INT8_T /* system type defined incorrectly */ #elif defined(__BORLANDC__) && defined(_CHAR_UNSIGNED) @@ -208,59 +271,70 @@ An includer may test the following macros after inclusion: #endif /* 8-bit d, i */ -#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(PRId8) +#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(PRId8) \ + && !defined(@KWIML@_INT_BROKEN_PRId8) # define @KWIML@_INT_PRId8 PRId8 #else # define @KWIML@_INT_PRId8 "d" #endif -#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(SCNd8) +#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(SCNd8) \ + && !defined(@KWIML@_INT_BROKEN_SCNd8) # define @KWIML@_INT_SCNd8 SCNd8 #elif !defined(@KWIML@_INT__NO_SCN8) # define @KWIML@_INT_SCNd8 "hhd" #endif -#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(PRIi8) +#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(PRIi8) \ + && !defined(@KWIML@_INT_BROKEN_PRIi8) # define @KWIML@_INT_PRIi8 PRIi8 #else # define @KWIML@_INT_PRIi8 "i" #endif -#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(SCNi8) +#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(SCNi8) \ + && !defined(@KWIML@_INT_BROKEN_SCNi8) # define @KWIML@_INT_SCNi8 SCNi8 #elif !defined(@KWIML@_INT__NO_SCN8) # define @KWIML@_INT_SCNi8 "hhi" #endif /* 8-bit o, u, x, X */ -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIo8) +#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIo8) \ + && !defined(@KWIML@_INT_BROKEN_PRIo8) # define @KWIML@_INT_PRIo8 PRIo8 #else # define @KWIML@_INT_PRIo8 "o" #endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNo8) +#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNo8) \ + && !defined(@KWIML@_INT_BROKEN_SCNo8) # define @KWIML@_INT_SCNo8 SCNo8 #elif !defined(@KWIML@_INT__NO_SCN8) # define @KWIML@_INT_SCNo8 "hho" #endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIu8) +#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIu8) \ + && !defined(@KWIML@_INT_BROKEN_PRIu8) # define @KWIML@_INT_PRIu8 PRIu8 #else # define @KWIML@_INT_PRIu8 "u" #endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNu8) +#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNu8) \ + && !defined(@KWIML@_INT_BROKEN_SCNu8) # define @KWIML@_INT_SCNu8 SCNu8 #elif !defined(@KWIML@_INT__NO_SCN8) # define @KWIML@_INT_SCNu8 "hhu" #endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIx8) +#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIx8) \ + && !defined(@KWIML@_INT_BROKEN_PRIx8) # define @KWIML@_INT_PRIx8 PRIx8 #else # define @KWIML@_INT_PRIx8 "x" #endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNx8) +#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNx8) \ + && !defined(@KWIML@_INT_BROKEN_SCNx8) # define @KWIML@_INT_SCNx8 SCNx8 #elif !defined(@KWIML@_INT__NO_SCN8) # define @KWIML@_INT_SCNx8 "hhx" #endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIX8) +#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIX8) \ + && !defined(@KWIML@_INT_BROKEN_PRIX8) # define @KWIML@_INT_PRIX8 PRIX8 #else # define @KWIML@_INT_PRIX8 "X" @@ -291,59 +365,70 @@ An includer may test the following macros after inclusion: #endif /* 16-bit d, i */ -#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(PRId16) +#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(PRId16) \ + && !defined(@KWIML@_INT_BROKEN_PRId16) # define @KWIML@_INT_PRId16 PRId16 #else # define @KWIML@_INT_PRId16 "d" #endif -#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(SCNd16) +#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(SCNd16) \ + && !defined(@KWIML@_INT_BROKEN_SCNd16) # define @KWIML@_INT_SCNd16 SCNd16 #else # define @KWIML@_INT_SCNd16 "hd" #endif -#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(PRIi16) +#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(PRIi16) \ + && !defined(@KWIML@_INT_BROKEN_PRIi16) # define @KWIML@_INT_PRIi16 PRIi16 #else # define @KWIML@_INT_PRIi16 "i" #endif -#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(SCNi16) +#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(SCNi16) \ + && !defined(@KWIML@_INT_BROKEN_SCNi16) # define @KWIML@_INT_SCNi16 SCNi16 #else # define @KWIML@_INT_SCNi16 "hi" #endif /* 16-bit o, u, x, X */ -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIo16) +#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIo16) \ + && !defined(@KWIML@_INT_BROKEN_PRIo16) # define @KWIML@_INT_PRIo16 PRIo16 #else # define @KWIML@_INT_PRIo16 "o" #endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNo16) +#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNo16) \ + && !defined(@KWIML@_INT_BROKEN_SCNo16) # define @KWIML@_INT_SCNo16 SCNo16 #else # define @KWIML@_INT_SCNo16 "ho" #endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIu16) +#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIu16) \ + && !defined(@KWIML@_INT_BROKEN_PRIu16) # define @KWIML@_INT_PRIu16 PRIu16 #else # define @KWIML@_INT_PRIu16 "u" #endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNu16) +#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNu16) \ + && !defined(@KWIML@_INT_BROKEN_SCNu16) # define @KWIML@_INT_SCNu16 SCNu16 #else # define @KWIML@_INT_SCNu16 "hu" #endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIx16) +#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIx16) \ + && !defined(@KWIML@_INT_BROKEN_PRIx16) # define @KWIML@_INT_PRIx16 PRIx16 #else # define @KWIML@_INT_PRIx16 "x" #endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNx16) +#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNx16) \ + && !defined(@KWIML@_INT_BROKEN_SCNx16) # define @KWIML@_INT_SCNx16 SCNx16 #else # define @KWIML@_INT_SCNx16 "hx" #endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIX16) +#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIX16) \ + && !defined(@KWIML@_INT_BROKEN_PRIX16) # define @KWIML@_INT_PRIX16 PRIX16 #else # define @KWIML@_INT_PRIX16 "X" @@ -374,59 +459,70 @@ An includer may test the following macros after inclusion: #endif /* 32-bit d, i */ -#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(PRId32) +#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(PRId32) \ + && !defined(@KWIML@_INT_BROKEN_PRId32) # define @KWIML@_INT_PRId32 PRId32 #else # define @KWIML@_INT_PRId32 "d" #endif -#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(SCNd32) +#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(SCNd32) \ + && !defined(@KWIML@_INT_BROKEN_SCNd32) # define @KWIML@_INT_SCNd32 SCNd32 #else # define @KWIML@_INT_SCNd32 "d" #endif -#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(PRIi32) +#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(PRIi32) \ + && !defined(@KWIML@_INT_BROKEN_PRIi32) # define @KWIML@_INT_PRIi32 PRIi32 #else # define @KWIML@_INT_PRIi32 "i" #endif -#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(SCNi32) +#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(SCNi32) \ + && !defined(@KWIML@_INT_BROKEN_SCNi32) # define @KWIML@_INT_SCNi32 SCNi32 #else # define @KWIML@_INT_SCNi32 "i" #endif /* 32-bit o, u, x, X */ -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIo32) +#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIo32) \ + && !defined(@KWIML@_INT_BROKEN_PRIo32) # define @KWIML@_INT_PRIo32 PRIo32 #else # define @KWIML@_INT_PRIo32 "o" #endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNo32) +#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNo32) \ + && !defined(@KWIML@_INT_BROKEN_SCNo32) # define @KWIML@_INT_SCNo32 SCNo32 #else # define @KWIML@_INT_SCNo32 "o" #endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIu32) +#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIu32) \ + && !defined(@KWIML@_INT_BROKEN_PRIu32) # define @KWIML@_INT_PRIu32 PRIu32 #else # define @KWIML@_INT_PRIu32 "u" #endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNu32) +#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNu32) \ + && !defined(@KWIML@_INT_BROKEN_SCNu32) # define @KWIML@_INT_SCNu32 SCNu32 #else # define @KWIML@_INT_SCNu32 "u" #endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIx32) +#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIx32) \ + && !defined(@KWIML@_INT_BROKEN_PRIx32) # define @KWIML@_INT_PRIx32 PRIx32 #else # define @KWIML@_INT_PRIx32 "x" #endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNx32) +#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNx32) \ + && !defined(@KWIML@_INT_BROKEN_SCNx32) # define @KWIML@_INT_SCNx32 SCNx32 #else # define @KWIML@_INT_SCNx32 "x" #endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIX32) +#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIX32) \ + && !defined(@KWIML@_INT_BROKEN_PRIX32) # define @KWIML@_INT_PRIX32 PRIX32 #else # define @KWIML@_INT_PRIX32 "X" @@ -498,59 +594,70 @@ An includer may test the following macros after inclusion: #endif /* 64-bit d, i */ -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(PRId64) +#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(PRId64) \ + && !defined(@KWIML@_INT_BROKEN_PRId64) # define @KWIML@_INT_PRId64 PRId64 #elif defined(@KWIML@_INT__FMT64) # define @KWIML@_INT_PRId64 @KWIML@_INT__FMT64 "d" #endif -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(SCNd64) +#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(SCNd64) \ + && !defined(@KWIML@_INT_BROKEN_SCNd64) # define @KWIML@_INT_SCNd64 SCNd64 #elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) # define @KWIML@_INT_SCNd64 @KWIML@_INT__FMT64 "d" #endif -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(PRIi64) +#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(PRIi64) \ + && !defined(@KWIML@_INT_BROKEN_PRIi64) # define @KWIML@_INT_PRIi64 PRIi64 #elif defined(@KWIML@_INT__FMT64) # define @KWIML@_INT_PRIi64 @KWIML@_INT__FMT64 "d" #endif -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(SCNi64) +#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(SCNi64) \ + && !defined(@KWIML@_INT_BROKEN_SCNi64) # define @KWIML@_INT_SCNi64 SCNi64 #elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) # define @KWIML@_INT_SCNi64 @KWIML@_INT__FMT64 "d" #endif /* 64-bit o, u, x, X */ -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIo64) +#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIo64) \ + && !defined(@KWIML@_INT_BROKEN_PRIo64) # define @KWIML@_INT_PRIo64 PRIo64 #elif defined(@KWIML@_INT__FMT64) # define @KWIML@_INT_PRIo64 @KWIML@_INT__FMT64 "o" #endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNo64) +#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNo64) \ + && !defined(@KWIML@_INT_BROKEN_SCNo64) # define @KWIML@_INT_SCNo64 SCNo64 #elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) # define @KWIML@_INT_SCNo64 @KWIML@_INT__FMT64 "o" #endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIu64) +#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIu64) \ + && !defined(@KWIML@_INT_BROKEN_PRIu64) # define @KWIML@_INT_PRIu64 PRIu64 #elif defined(@KWIML@_INT__FMT64) # define @KWIML@_INT_PRIu64 @KWIML@_INT__FMT64 "u" #endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNu64) +#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNu64) \ + && !defined(@KWIML@_INT_BROKEN_SCNu64) # define @KWIML@_INT_SCNu64 SCNu64 #elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) # define @KWIML@_INT_SCNu64 @KWIML@_INT__FMT64 "u" #endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIx64) +#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIx64) \ + && !defined(@KWIML@_INT_BROKEN_PRIx64) # define @KWIML@_INT_PRIx64 PRIx64 #elif defined(@KWIML@_INT__FMT64) # define @KWIML@_INT_PRIx64 @KWIML@_INT__FMT64 "x" #endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNx64) +#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNx64) \ + && !defined(@KWIML@_INT_BROKEN_SCNx64) # define @KWIML@_INT_SCNx64 SCNx64 #elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) # define @KWIML@_INT_SCNx64 @KWIML@_INT__FMT64 "x" #endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIX64) +#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIX64) \ + && !defined(@KWIML@_INT_BROKEN_PRIX64) # define @KWIML@_INT_PRIX64 PRIX64 #elif defined(@KWIML@_INT__FMT64) # define @KWIML@_INT_PRIX64 @KWIML@_INT__FMT64 "X" @@ -602,28 +709,32 @@ An includer may test the following macros after inclusion: # error "No type known for 'uintptr_t'." #endif -#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(PRIdPTR) +#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(PRIdPTR) \ + && !defined(@KWIML@_INT_BROKEN_PRIdPTR) # define @KWIML@_INT_PRIdPTR PRIdPTR #elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 # define @KWIML@_INT_PRIdPTR @KWIML@_INT_PRId32 #elif !defined(@KWIML@_INT_NO_UINT64_T) # define @KWIML@_INT_PRIdPTR @KWIML@_INT_PRId64 #endif -#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(SCNdPTR) +#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(SCNdPTR) \ + && !defined(@KWIML@_INT_BROKEN_SCNdPTR) # define @KWIML@_INT_SCNdPTR SCNdPTR #elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 # define @KWIML@_INT_SCNdPTR @KWIML@_INT_SCNd32 #elif !defined(@KWIML@_INT_NO_UINT64_T) # define @KWIML@_INT_SCNdPTR @KWIML@_INT_SCNd64 #endif -#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(PRIiPTR) +#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(PRIiPTR) \ + && !defined(@KWIML@_INT_BROKEN_PRIiPTR) # define @KWIML@_INT_PRIiPTR PRIiPTR #elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 # define @KWIML@_INT_PRIiPTR @KWIML@_INT_PRIi32 #elif !defined(@KWIML@_INT_NO_UINT64_T) # define @KWIML@_INT_PRIiPTR @KWIML@_INT_PRIi64 #endif -#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(SCNiPTR) +#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(SCNiPTR) \ + && !defined(@KWIML@_INT_BROKEN_SCNiPTR) # define @KWIML@_INT_SCNiPTR SCNiPTR #elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 # define @KWIML@_INT_SCNiPTR @KWIML@_INT_SCNi32 @@ -631,49 +742,56 @@ An includer may test the following macros after inclusion: # define @KWIML@_INT_SCNiPTR @KWIML@_INT_SCNi64 #endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIoPTR) +#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIoPTR) \ + && !defined(@KWIML@_INT_BROKEN_PRIoPTR) # define @KWIML@_INT_PRIoPTR PRIoPTR #elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 # define @KWIML@_INT_PRIoPTR @KWIML@_INT_PRIo32 #elif !defined(@KWIML@_INT_NO_UINT64_T) # define @KWIML@_INT_PRIoPTR @KWIML@_INT_PRIo64 #endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNoPTR) +#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNoPTR) \ + && !defined(@KWIML@_INT_BROKEN_SCNoPTR) # define @KWIML@_INT_SCNoPTR SCNoPTR #elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 # define @KWIML@_INT_SCNoPTR @KWIML@_INT_SCNo32 #elif !defined(@KWIML@_INT_NO_UINT64_T) # define @KWIML@_INT_SCNoPTR @KWIML@_INT_SCNo64 #endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIuPTR) +#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIuPTR) \ + && !defined(@KWIML@_INT_BROKEN_PRIuPTR) # define @KWIML@_INT_PRIuPTR PRIuPTR #elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 # define @KWIML@_INT_PRIuPTR @KWIML@_INT_PRIu32 #elif !defined(@KWIML@_INT_NO_UINT64_T) # define @KWIML@_INT_PRIuPTR @KWIML@_INT_PRIu64 #endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNuPTR) +#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNuPTR) \ + && !defined(@KWIML@_INT_BROKEN_SCNuPTR) # define @KWIML@_INT_SCNuPTR SCNuPTR #elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 # define @KWIML@_INT_SCNuPTR @KWIML@_INT_SCNu32 #elif !defined(@KWIML@_INT_NO_UINT64_T) # define @KWIML@_INT_SCNuPTR @KWIML@_INT_SCNu64 #endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIxPTR) +#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIxPTR) \ + && !defined(@KWIML@_INT_BROKEN_PRIxPTR) # define @KWIML@_INT_PRIxPTR PRIxPTR #elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 # define @KWIML@_INT_PRIxPTR @KWIML@_INT_PRIx32 #elif !defined(@KWIML@_INT_NO_UINT64_T) # define @KWIML@_INT_PRIxPTR @KWIML@_INT_PRIx64 #endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNxPTR) +#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNxPTR) \ + && !defined(@KWIML@_INT_BROKEN_SCNxPTR) # define @KWIML@_INT_SCNxPTR SCNxPTR #elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 # define @KWIML@_INT_SCNxPTR @KWIML@_INT_SCNx32 #elif !defined(@KWIML@_INT_NO_UINT64_T) # define @KWIML@_INT_SCNxPTR @KWIML@_INT_SCNx64 #endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIXPTR) +#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIXPTR) \ + && !defined(@KWIML@_INT_BROKEN_PRIXPTR) # define @KWIML@_INT_PRIXPTR PRIXPTR #elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 # define @KWIML@_INT_PRIXPTR @KWIML@_INT_PRIX32 diff --git a/Utilities/cmlibarchive/libarchive/archive_endian.h b/Utilities/cmlibarchive/libarchive/archive_endian.h index c3c78b3..bbf58fd 100644 --- a/Utilities/cmlibarchive/libarchive/archive_endian.h +++ b/Utilities/cmlibarchive/libarchive/archive_endian.h @@ -45,11 +45,14 @@ * - SGI MIPSpro * - Microsoft Visual C++ 6.0 (supposedly newer versions too) * - IBM VisualAge 6 (XL v6) + * - Sun WorkShop C (SunPro) before 5.9 */ #if defined(__WATCOMC__) || defined(__sgi) || defined(__hpux) || defined(__BORLANDC__) #define inline #elif defined(__IBMC__) && __IBMC__ < 700 #define inline +#elif defined(__SUNPRO_C) && __SUNPRO_C < 0x590 +#define inline #elif defined(_MSC_VER) || defined(__osf__) #define inline __inline #endif |