diff options
38 files changed, 1483 insertions, 698 deletions
diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index b6013ef..ae00653 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -183,6 +183,13 @@ if("${CPACK_GENERATOR}" STREQUAL "PackageMaker") endif() endif() +if("${CPACK_GENERATOR}" STREQUAL "DragNDrop") + set(CPACK_DMG_BACKGROUND_IMAGE + "@CMake_SOURCE_DIR@/Packaging/CMakeDMGBackground.tif") + set(CPACK_DMG_DS_STORE_SETUP_SCRIPT + "@CMake_SOURCE_DIR@/Packaging/CMakeDMGSetup.scpt") +endif() + if("${CPACK_GENERATOR}" STREQUAL "WIX") # Reset CPACK_PACKAGE_VERSION to deal with WiX restriction. # But the file names still use the full CMake_VERSION value: diff --git a/Help/release/dev/FindGTK2_GTK2_TARGETS.rst b/Help/release/dev/FindGTK2_GTK2_TARGETS.rst new file mode 100644 index 0000000..76e3657 --- /dev/null +++ b/Help/release/dev/FindGTK2_GTK2_TARGETS.rst @@ -0,0 +1,7 @@ +FindGTK2_GTK2_TARGETS +--------------------- + +* The :module:`FindGTK2` module, when ``GTK2_USE_IMPORTED_TARGETS`` is + enabled, now sets ``GTK2_LIBRARIES`` to contain the list of imported + targets instead of the paths to the libraries. Moreover it now sets + a new ``GTK2_TARGETS`` variable containing all the targets imported. diff --git a/Help/release/dev/better-looking-mac-packages.rst b/Help/release/dev/better-looking-mac-packages.rst new file mode 100644 index 0000000..ef1b8e8 --- /dev/null +++ b/Help/release/dev/better-looking-mac-packages.rst @@ -0,0 +1,8 @@ +better-looking-mac-packages +--------------------------- + +* The :module:`CPackDMG` module learned new variable to specify AppleScript + file run to customize appearance of ``DragNDrop`` installer folder, + including background image setting using supplied PNG or multi-resolution + TIFF file. See the :variable:`CPACK_DMG_DS_STORE_SETUP_SCRIPT` and + :variable:`CPACK_DMG_BACKGROUND_IMAGE` variables. diff --git a/Help/release/dev/cpack-deb-config-file-source-field.rst b/Help/release/dev/cpack-deb-config-file-source-field.rst new file mode 100644 index 0000000..bbc2aa6 --- /dev/null +++ b/Help/release/dev/cpack-deb-config-file-source-field.rst @@ -0,0 +1,6 @@ +cpack-deb-config-file-source-field +---------------------------------- + +* The :module:`CPackDeb` module learned to set optional config + file ``Source`` field - monolithic and per-component variable. + See :variable:`CPACK_DEBIAN_PACKAGE_SOURCE`. diff --git a/Help/release/dev/cpack-deb-new-component-vars.rst b/Help/release/dev/cpack-deb-new-component-vars.rst new file mode 100644 index 0000000..e30afdb --- /dev/null +++ b/Help/release/dev/cpack-deb-new-component-vars.rst @@ -0,0 +1,7 @@ +cpack-deb-new-component-vars +---------------------------- + +* The :module:`CPackDeb` module learned to set Package, Section + and Priority control fields per-component. + See :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION` + and :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_PRIORITY`. diff --git a/Help/release/dev/cpack-dmg-multilanguage-sla.rst b/Help/release/dev/cpack-dmg-multilanguage-sla.rst new file mode 100644 index 0000000..9e28fa2 --- /dev/null +++ b/Help/release/dev/cpack-dmg-multilanguage-sla.rst @@ -0,0 +1,7 @@ +cpack-dmg-multilanguage-sla +--------------------------- + +* The :module:`CPack DragNDrop generator <CPackDMG>` learned to add + multi-lingual SLAs to a DMG which is presented to the user when they try to + mount the DMG. See the :variable:`CPACK_DMG_SLA_LANGUAGES` and + :variable:`CPACK_DMG_SLA_DIR` variables for details. diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 017af91..2f7f40e 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -47,6 +47,8 @@ # define COMPILER_VERSION_PATCH HEX(__SUNPRO_F90 & 0xF) #elif defined(_CRAYFTN) PRINT *, 'INFO:compiler[Cray]' +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) #elif defined(__G95__) PRINT *, 'INFO:compiler[G95]' # define COMPILER_VERSION_MAJOR DEC(__G95__) diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake index b7a6ba5..6b5af7e 100644 --- a/Modules/CPackDMG.cmake +++ b/Modules/CPackDMG.cmake @@ -26,15 +26,38 @@ # Path to a custom DS_Store file. This .DS_Store file e.g. can be used to # specify the Finder window position/geometry and layout (such as hidden # toolbars, placement of the icons etc.). This file has to be generated by -# the Finder (either manually or through OSA-script) using a normal folder +# the Finder (either manually or through AppleScript) using a normal folder # from which the .DS_Store file can then be extracted. # +# .. variable:: CPACK_DMG_DS_STORE_SETUP_SCRIPT +# +# Path to a custom AppleScript file. This AppleScript is used to generate +# a .DS_Store file which specifies the Finder window position/geometry and +# layout (such as hidden toolbars, placement of the icons etc.). +# By specifying a custom AppleScript there is no need to use +# CPACK_DMG_DS_STORE, as the .DS_Store that is generated by the AppleScript +# will be packaged. +# # .. variable:: CPACK_DMG_BACKGROUND_IMAGE # -# Path to a background image file. This file will be used as the background -# for the Finder Window when the disk image is opened. By default no -# background image is set. The background image is applied after applying the -# custom .DS_Store file. +# Path to an image file to be used as the background. This file will be +# copied to .background/background.<ext>, where ext is the original image file +# extension. The background image is installed into the image before +# CPACK_DMG_DS_STORE_SETUP_SCRIPT is executed or CPACK_DMG_DS_STORE is +# installed. By default no background image is set. +# +# .. variable:: CPACK_DMG_SLA_DIR +# +# Directory where license and menu files for different languages are stored. +# +# .. variable:: CPACK_DMG_SLA_LANGUAGES +# +# Languages for which a license agreement is provided when mounting the +# generated DMG. +# +# For every language in this list, CPack will try to find files +# ``<language>.menu.txt`` and ``<language>.license.txt`` in the directory +# specified by the :variable:`CPACK_DMG_SLA_DIR` variable. # # .. variable:: CPACK_COMMAND_HDIUTIL # diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 60e0d1f..2aaef61 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -8,7 +8,7 @@ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # # CPackDeb may be used to create Deb package using CPack. -# CPackDeb is a CPack generator thus it uses the CPACK_XXX variables +# CPackDeb is a CPack generator thus it uses the ``CPACK_XXX`` variables # used by CPack : https://cmake.org/Wiki/CMake:CPackConfiguration. # CPackDeb generator should work on any linux host but it will produce # better deb package when Debian specific tools 'dpkg-xxx' are usable on @@ -18,7 +18,7 @@ # :code:`CPACK_DEBIAN_XXX` variables. # # :code:`CPACK_DEBIAN_<COMPONENT>_XXXX` variables may be used in order to have -# **component** specific values. Note however that <COMPONENT> refers to the +# **component** specific values. Note however that ``<COMPONENT>`` refers to the # **grouping name** written in upper case. It may be either a component name or # a component GROUP name. # @@ -27,11 +27,20 @@ # However as a handy reminder here comes the list of specific variables: # # .. variable:: CPACK_DEBIAN_PACKAGE_NAME +# CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME # -# The Debian package summary +# Set Package control field (variable is automatically transformed to lower +# case). # # * Mandatory : YES -# * Default : :variable:`CPACK_PACKAGE_NAME` (lower case) +# * Default : +# +# - :variable:`CPACK_PACKAGE_NAME` for non-component based +# installations +# - :variable:`CPACK_DEBIAN_PACKAGE_NAME` suffixed with -<COMPONENT> +# for component-based installations. +# +# See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source # # # .. variable:: CPACK_DEBIAN_PACKAGE_VERSION @@ -100,10 +109,16 @@ # # # .. variable:: CPACK_DEBIAN_PACKAGE_SECTION +# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION +# +# Set Section control field e.g. admin, devel, doc, ... # # * Mandatory : YES # * Default : 'devel' # +# See https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections +# +# # .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE # # The compression used for creating the Debian package. @@ -114,12 +129,16 @@ # # # .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY +# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PRIORITY # -# The Debian package priority +# Set Priority control field e.g. required, important, standard, optional, +# extra # # * Mandatory : YES # * Default : 'optional' # +# See https://www.debian.org/doc/debian-policy/ch-archive.html#s-priorities +# # # .. variable:: CPACK_DEBIAN_PACKAGE_HOMEPAGE # @@ -354,7 +373,28 @@ # set by Debian policy # https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners # - +# .. variable:: CPACK_DEBIAN_PACKAGE_SOURCE +# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SOURCE +# +# Sets the ``Source`` field of the binary Debian package. +# When the binary package name is not the same as the source package name +# (in particular when several components/binaries are generated from one +# source) the source from which the binary has been generated should be +# indicated with the field ``Source``. +# +# * Mandatory : NO +# * Default : +# +# - An empty string for non-component based installations +# - :variable:`CPACK_DEBIAN_PACKAGE_SOURCE` for component-based +# installations. +# +# See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source +# +# .. note:: +# +# This value is not interpreted. It is possible to pass an optional +# revision number of the referenced source package as well. #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -554,24 +594,33 @@ function(cpack_deb_prepare_package_vars) ) endif() + # Source: (optional) + # in case several packages are constructed from a unique source + # (multipackaging), the source may be indicated as well. + # The source might contain a version if the generated package + # version is different from the source version + if(NOT CPACK_DEBIAN_PACKAGE_SOURCE) + set(CPACK_DEBIAN_PACKAGE_SOURCE "") + endif() + # have a look at get_property(result GLOBAL PROPERTY ENABLED_FEATURES), # this returns the successful find_package() calls, maybe this can help # Depends: # You should set: DEBIAN_PACKAGE_DEPENDS # TODO: automate 'objdump -p | grep NEEDED' - # if per-component dependency, overrides the global CPACK_DEBIAN_PACKAGE_${dependency_type_} + # if per-component variable, overrides the global CPACK_DEBIAN_PACKAGE_${variable_type_} # automatic dependency discovery will be performed afterwards. if(CPACK_DEB_PACKAGE_COMPONENT) - foreach(dependency_type_ DEPENDS RECOMMENDS SUGGESTS PREDEPENDS ENHANCES BREAKS CONFLICTS PROVIDES REPLACES) - set(_component_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_${dependency_type_}") + foreach(value_type_ DEPENDS RECOMMENDS SUGGESTS PREDEPENDS ENHANCES BREAKS CONFLICTS PROVIDES REPLACES SOURCE SECTION PRIORITY NAME) + set(_component_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_${value_type_}") - # if set, overrides the global dependency + # if set, overrides the global variable if(DEFINED ${_component_var}) - set(CPACK_DEBIAN_PACKAGE_${dependency_type_} "${${_component_var}}") + set(CPACK_DEBIAN_PACKAGE_${value_type_} "${${_component_var}}") if(CPACK_DEBIAN_PACKAGE_DEBUG) - message("CPackDeb Debug: component '${_local_component_name}' ${dependency_type_}" - "dependencies set to '${CPACK_DEBIAN_PACKAGE_${dependency_}}'") + message("CPackDeb Debug: component '${_local_component_name}' ${value_type_} " + "value set to '${CPACK_DEBIAN_PACKAGE_${value_type_}}'") endif() endif() endforeach() @@ -664,23 +713,25 @@ function(cpack_deb_prepare_package_vars) endif() endforeach() - set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}") - string(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME) - else() - set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "") + if(CPACK_DEBIAN_${_local_component_name}_PACKAGE_NAME) + string(TOLOWER "${CPACK_DEBIAN_${_local_component_name}_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME) + else() + string(TOLOWER "${CPACK_DEBIAN_PACKAGE_NAME}-${CPACK_DEB_PACKAGE_COMPONENT}" CPACK_DEBIAN_PACKAGE_NAME) + endif() endif() # Print out some debug information if we were asked for that if(CPACK_DEBIAN_PACKAGE_DEBUG) - message("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") - message("CPackDeb:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}") - message("CPackDeb:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}") - message("CPackDeb:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}") - message("CPackDeb:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}") - message("CPackDeb:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") - message("CPackDeb:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") - message("CPackDeb:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") - message("CPackDeb:Debug: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION = ${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}") + message("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = '${CPACK_TOPLEVEL_DIRECTORY}'") + message("CPackDeb:Debug: CPACK_TOPLEVEL_TAG = '${CPACK_TOPLEVEL_TAG}'") + message("CPackDeb:Debug: CPACK_TEMPORARY_DIRECTORY = '${CPACK_TEMPORARY_DIRECTORY}'") + message("CPackDeb:Debug: CPACK_OUTPUT_FILE_NAME = '${CPACK_OUTPUT_FILE_NAME}'") + message("CPackDeb:Debug: CPACK_OUTPUT_FILE_PATH = '${CPACK_OUTPUT_FILE_PATH}'") + message("CPackDeb:Debug: CPACK_PACKAGE_FILE_NAME = '${CPACK_PACKAGE_FILE_NAME}'") + message("CPackDeb:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = '${CPACK_PACKAGE_INSTALL_DIRECTORY}'") + message("CPackDeb:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = '${CPACK_TEMPORARY_PACKAGE_FILE_NAME}'") + message("CPackDeb:Debug: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION = '${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}'") + message("CPackDeb:Debug: CPACK_DEBIAN_PACKAGE_SOURCE = '${CPACK_DEBIAN_PACKAGE_SOURCE}'") endif() # For debian source packages: @@ -719,6 +770,8 @@ function(cpack_deb_prepare_package_vars) set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA}" PARENT_SCOPE) set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION "${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}" PARENT_SCOPE) + set(GEN_CPACK_DEBIAN_PACKAGE_SOURCE + "${CPACK_DEBIAN_PACKAGE_SOURCE}" PARENT_SCOPE) set(GEN_WDIR "${WDIR}" PARENT_SCOPE) endfunction() diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index ab4ef3e..6e4a7f2 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -34,6 +34,7 @@ # GTK2_FOUND - Were all of your specified components found? # GTK2_INCLUDE_DIRS - All include directories # GTK2_LIBRARIES - All libraries +# GTK2_TARGETS - All imported targets # GTK2_DEFINITIONS - Additional compiler flags # # @@ -550,6 +551,9 @@ function(_GTK2_ADD_TARGET _var) add_library(GTK2::${_basename} UNKNOWN IMPORTED) + set(GTK2_TARGETS ${GTK2_TARGETS} GTK2::${_basename}) + set(GTK2_TARGETS ${GTK2_TARGETS} PARENT_SCOPE) + if(GTK2_${_var}_LIBRARY_RELEASE) set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK2_${_var}_LIBRARY_RELEASE}" ) @@ -602,6 +606,7 @@ endfunction() set(GTK2_FOUND) set(GTK2_INCLUDE_DIRS) set(GTK2_LIBRARIES) +set(GTK2_TARGETS) set(GTK2_DEFINITIONS) if(NOT GTK2_FIND_COMPONENTS) @@ -940,6 +945,11 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) endif() endforeach() +if(GTK2_USE_IMPORTED_TARGETS) + set(GTK2_LIBRARIES ${GTK2_TARGETS}) +endif() + + if(_GTK2_did_we_find_everything AND NOT GTK2_VERSION_CHECK_FAILED) set(GTK2_FOUND true) else() @@ -951,6 +961,7 @@ else() set(GTK2_VERSION_PATCH) set(GTK2_INCLUDE_DIRS) set(GTK2_LIBRARIES) + set(GTK2_TARGETS) set(GTK2_DEFINITIONS) endif() diff --git a/Packaging/CMakeDMGBackground.tif b/Packaging/CMakeDMGBackground.tif Binary files differnew file mode 100644 index 0000000..91c4b13 --- /dev/null +++ b/Packaging/CMakeDMGBackground.tif diff --git a/Packaging/CMakeDMGSetup.scpt b/Packaging/CMakeDMGSetup.scpt new file mode 100644 index 0000000..c7ddcfb --- /dev/null +++ b/Packaging/CMakeDMGSetup.scpt @@ -0,0 +1,42 @@ +on run argv + set image_name to item 1 of argv + + tell application "Finder" + tell disk image_name + + -- open the image the first time and save a DS_Store with just + -- background and icon setup + open + set current view of container window to icon view + set theViewOptions to the icon view options of container window + set background picture of theViewOptions to file ".background:background.tif" + set arrangement of theViewOptions to not arranged + set icon size of theViewOptions to 128 + delay 1 + close + + -- next setup the position of the app and Applications symlink + -- plus hide all the window decoration + open + update without registering applications + tell container window + set sidebar width to 0 + set statusbar visible to false + set toolbar visible to false + set the bounds to { 400, 100, 900, 465 } + set position of item "CMake.app" to { 133, 200 } + set position of item "Applications" to { 378, 200 } + end tell + update without registering applications + delay 1 + close + + -- one last open and close so you can see everything looks correct + open + delay 5 + close + + end tell + delay 1 +end tell +end run diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index fd71b0e..f23331b 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -726,6 +726,9 @@ endif() # Build CPackLib add_library(CPackLib ${CPACK_SRCS}) target_link_libraries(CPackLib CMakeLib) +if(APPLE) + target_link_libraries(CPackLib "-framework Carbon") +endif() if(APPLE) add_executable(cmakexbuild cmakexbuild.cxx) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 62142c6..d706ef4 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 4) -set(CMake_VERSION_PATCH 20151106) +set(CMake_VERSION_PATCH 20151116) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 6f25e50..d5246db 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -482,6 +482,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() featureDefinitions.BeginElement("Feature"); featureDefinitions.AddAttribute("Id", "ProductFeature"); featureDefinitions.AddAttribute("Display", "expand"); + featureDefinitions.AddAttribute("Absent", "disallow"); featureDefinitions.AddAttribute("ConfigurableDirectory", "INSTALL_ROOT"); std::string cpackPackageName; diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 04efb71..13c8d8f 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -339,6 +339,9 @@ int cmCPackDebGenerator::createDeb() this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_PROVIDES"); const char* debian_pkg_replaces = this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_REPLACES"); + const char* debian_pkg_source = + this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_SOURCE"); + { // the scope is needed for cmGeneratedFileStream cmGeneratedFileStream out(ctlfilename.c_str()); @@ -347,6 +350,10 @@ int cmCPackDebGenerator::createDeb() out << "Section: " << debian_pkg_section << "\n"; out << "Priority: " << debian_pkg_priority << "\n"; out << "Architecture: " << debian_pkg_arch << "\n"; + if(debian_pkg_source && *debian_pkg_source) + { + out << "Source: " << debian_pkg_source << "\n"; + } if(debian_pkg_dep && *debian_pkg_dep) { out << "Depends: " << debian_pkg_dep << "\n"; diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 4c400d9..7a93fc6 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -18,6 +18,24 @@ #include <cmsys/RegularExpression.hxx> #include <cmsys/FStream.hxx> +#include <iomanip> + +#include <CoreFoundation/CFBase.h> +#include <CoreFoundation/CFString.h> +#include <CoreFoundation/CFLocale.h> + +// The carbon framework is deprecated, but the Region codes it supplies are +// needed for the LPic data structure used for generating multi-lingual SLAs. +// There does not seem to be a replacement API for these region codes. +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif +#include <Carbon/Carbon.h> +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + static const char* SLAHeader = "data 'LPic' (5000) {\n" " $\"0002 0011 0003 0001 0000 0000 0002 0000\"\n" @@ -103,6 +121,69 @@ int cmCPackDragNDropGenerator::InitializeInternal() } this->SetOptionIfNotSet("CPACK_COMMAND_REZ", rez_path.c_str()); + if(this->IsSet("CPACK_DMG_SLA_DIR")) + { + slaDirectory = this->GetOption("CPACK_DMG_SLA_DIR"); + if(!slaDirectory.empty() && this->IsSet("CPACK_RESOURCE_FILE_LICENSE")) + { + std::string license_file = + this->GetOption("CPACK_RESOURCE_FILE_LICENSE"); + if(!license_file.empty() && + (license_file.find("CPack.GenericLicense.txt") == std::string::npos)) + { + cmCPackLogger(cmCPackLog::LOG_WARNING, + "Both CPACK_DMG_SLA_DIR and CPACK_RESOURCE_FILE_LICENSE specified, " + "defaulting to CPACK_DMG_SLA_DIR" + << std::endl); + } + } + if(!this->IsSet("CPACK_DMG_LANGUAGES")) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "CPACK_DMG_SLA_DIR set but no languages defined " + "(set CPACK_DMG_LANGUAGES)" + << std::endl); + return 0; + } + if(!cmSystemTools::FileExists(slaDirectory, false)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "CPACK_DMG_SLA_DIR does not exist" + << std::endl); + return 0; + } + + std::vector<std::string> languages; + cmSystemTools::ExpandListArgument(this->GetOption("CPACK_DMG_LANGUAGES"), + languages); + if(languages.empty()) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "CPACK_DMG_LANGUAGES set but empty" + << std::endl); + return 0; + } + for(size_t i = 0; i < languages.size(); ++i) + { + std::string license = slaDirectory + "/" + languages[i] + ".license.txt"; + if (!cmSystemTools::FileExists(license)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Missing license file " << languages[i] << ".license.txt" + << std::endl); + return 0; + } + std::string menu = slaDirectory + "/" + languages[i] + ".menu.txt"; + if (!cmSystemTools::FileExists(menu)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Missing menu file " << languages[i] << ".menu.txt" + << std::endl); + return 0; + } + } + } + return this->Superclass::InitializeInternal(); } @@ -190,6 +271,28 @@ bool cmCPackDragNDropGenerator::CopyFile(std::ostringstream& source, } //---------------------------------------------------------------------- +bool cmCPackDragNDropGenerator::CreateEmptyFile(std::ostringstream& target, + size_t size) +{ + cmsys::ofstream fout(target.str().c_str(), + std::ios::out | std::ios::binary); + if(!fout) + { + return false; + } + else + { + // Seek to desired size - 1 byte + fout.seekp(size - 1, std::ios_base::beg); + char byte = 0; + // Write one byte to ensure file grows + fout.write(&byte, 1); + } + + return true; +} + +//---------------------------------------------------------------------- bool cmCPackDragNDropGenerator::RunCommand(std::ostringstream& command, std::string* output) { @@ -246,12 +349,27 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, this->GetOption("CPACK_DMG_DS_STORE") ? this->GetOption("CPACK_DMG_DS_STORE") : ""; + const std::string cpack_dmg_languages = + this->GetOption("CPACK_DMG_LANGUAGES") + ? this->GetOption("CPACK_DMG_LANGUAGES") : ""; + + const std::string cpack_dmg_ds_store_setup_script = + this->GetOption("CPACK_DMG_DS_STORE_SETUP_SCRIPT") + ? this->GetOption("CPACK_DMG_DS_STORE_SETUP_SCRIPT") : ""; + // only put license on dmg if is user provided if(!cpack_license_file.empty() && cpack_license_file.find("CPack.GenericLicense.txt") != std::string::npos) - { + { + cpack_license_file = ""; + } + + // use sla_dir if both sla_dir and license_file are set + if(!cpack_license_file.empty() && + !slaDirectory.empty()) + { cpack_license_file = ""; - } + } // The staging directory contains everything that will end-up inside the // final disk image ... @@ -307,13 +425,18 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, } // Optionally add a custom background image ... + // Make sure the background file type is the same as the custom image + // and that the file is hidden so it doesn't show up. if(!cpack_dmg_background_image.empty()) { + const std::string extension = + cmSystemTools::GetFilenameLastExtension(cpack_dmg_background_image); std::ostringstream package_background_source; package_background_source << cpack_dmg_background_image; std::ostringstream package_background_destination; - package_background_destination << staging.str() << "/background.png"; + package_background_destination << staging.str() + << "/.background/background" << extension; if(!this->CopyFile(package_background_source, package_background_destination)) @@ -325,18 +448,22 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, return 0; } + } - std::ostringstream temp_background_hiding_command; - temp_background_hiding_command << this->GetOption("CPACK_COMMAND_SETFILE"); - temp_background_hiding_command << " -a V \""; - temp_background_hiding_command << package_background_destination.str(); - temp_background_hiding_command << "\""; + bool remount_image = !cpack_package_icon.empty() || + !cpack_dmg_ds_store_setup_script.empty(); - if(!this->RunCommand(temp_background_hiding_command)) + // Create 1 MB dummy padding file in staging area when we need to remount + // image, so we have enough space for storing changes ... + if(remount_image) + { + std::ostringstream dummy_padding; + dummy_padding << staging.str() << "/.dummy-padding-file"; + if(!this->CreateEmptyFile(dummy_padding, 1048576)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error setting attributes on disk volume background image." - << std::endl); + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error creating dummy padding file." + << std::endl); return 0; } @@ -365,10 +492,11 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, return 0; } - // Optionally set the custom icon flag for the image ... - if(!cpack_package_icon.empty()) + if(remount_image) { - std::ostringstream temp_mount; + // Store that we have a failure so that we always unmount the image + // before we exit. + bool had_error = false; std::ostringstream attach_command; attach_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); @@ -387,20 +515,57 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, cmsys::RegularExpression mountpoint_regex(".*(/Volumes/[^\n]+)\n.*"); mountpoint_regex.find(attach_output.c_str()); + std::ostringstream temp_mount; temp_mount << mountpoint_regex.match(1); - std::ostringstream setfile_command; - setfile_command << this->GetOption("CPACK_COMMAND_SETFILE"); - setfile_command << " -a C"; - setfile_command << " \"" << temp_mount.str() << "\""; - - if(!this->RunCommand(setfile_command)) + // Remove dummy padding file so we have enough space on RW image ... + std::ostringstream dummy_padding; + dummy_padding << temp_mount.str() << "/.dummy-padding-file"; + if(!cmSystemTools::RemoveFile(dummy_padding.str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error assigning custom icon to temporary disk image." + "Error removing dummy padding file." << std::endl); - return 0; + had_error = true; + } + + // Optionally set the custom icon flag for the image ... + if(!had_error && !cpack_package_icon.empty()) + { + std::ostringstream setfile_command; + setfile_command << this->GetOption("CPACK_COMMAND_SETFILE"); + setfile_command << " -a C"; + setfile_command << " \"" << temp_mount.str() << "\""; + + if(!this->RunCommand(setfile_command)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error assigning custom icon to temporary disk image." + << std::endl); + + had_error = true; + } + } + + // Optionally we can execute a custom apple script to generate + // the .DS_Store for the volume folder ... + if(!had_error && !cpack_dmg_ds_store_setup_script.empty()) + { + std::ostringstream setup_script_command; + setup_script_command << "osascript" + << " \"" << cpack_dmg_ds_store_setup_script << "\"" + << " \"" << cpack_dmg_volume_name << "\""; + std::string error; + if(!this->RunCommand(setup_script_command, &error)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error executing custom script on disk image." << std::endl + << error + << std::endl); + + had_error = true; + } } std::ostringstream detach_command; @@ -416,56 +581,129 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, return 0; } + + if(had_error) + { + return 0; + } } - if(!cpack_license_file.empty()) - { + if(!cpack_license_file.empty() || !slaDirectory.empty()) + { + // Use old hardcoded style if sla_dir is not set + bool oldStyle = slaDirectory.empty(); std::string sla_r = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); sla_r += "/sla.r"; - cmsys::ifstream ifs; - ifs.open(cpack_license_file.c_str()); - if(ifs.is_open()) - { - cmGeneratedFileStream osf(sla_r.c_str()); - osf << "#include <CoreServices/CoreServices.r>\n\n"; - osf << SLAHeader; - osf << "\n"; - osf << "data 'TEXT' (5002, \"English\") {\n"; - while(ifs.good()) + std::vector<std::string> languages; + if(!oldStyle) { - std::string line; - std::getline(ifs, line); - // escape quotes - std::string::size_type pos = line.find('\"'); - while(pos != std::string::npos) + cmSystemTools::ExpandListArgument(cpack_dmg_languages, languages); + } + + cmGeneratedFileStream ofs(sla_r.c_str()); + ofs << "#include <CoreServices/CoreServices.r>\n\n"; + if(oldStyle) + { + ofs << SLAHeader; + ofs << "\n"; + } + else + { + /* + * LPic Layout + * (https://github.com/pypt/dmg-add-license/blob/master/main.c) + * as far as I can tell (no official documentation seems to exist): + * struct LPic { + * uint16_t default_language; // points to a resid, defaulting to 0, + * // which is the first set language + * uint16_t length; + * struct { + * uint16_t language_code; + * uint16_t resid; + * uint16_t encoding; // Encoding from TextCommon.h, + * // forcing MacRoman (0) for now. Might need to + * // allow overwrite per license by user later + * } item[1]; + * } + */ + + // Create vector first for readability, then iterate to write to ofs + std::vector<uint16_t> header_data; + header_data.push_back(0); + header_data.push_back(languages.size()); + for(size_t i = 0; i < languages.size(); ++i) { - line.replace(pos, 1, "\\\""); - pos = line.find('\"', pos+2); + CFStringRef language_cfstring = CFStringCreateWithCString( + NULL, languages[i].c_str(), kCFStringEncodingUTF8); + CFStringRef iso_language = + CFLocaleCreateCanonicalLanguageIdentifierFromString( + NULL, language_cfstring); + if (!iso_language) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + languages[i] << " is not a recognized language" + << std::endl); + } + char *iso_language_cstr = (char *) malloc(65); + CFStringGetCString(iso_language, iso_language_cstr, 64, + kCFStringEncodingMacRoman); + LangCode lang = 0; + RegionCode region = 0; + OSStatus err = LocaleStringToLangAndRegionCodes(iso_language_cstr, + &lang, ®ion); + if (err != noErr) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "No language/region code available for " << iso_language_cstr + << std::endl); + free(iso_language_cstr); + return 0; + } + free(iso_language_cstr); + header_data.push_back(region); + header_data.push_back(i); + header_data.push_back(0); } - // break up long lines to avoid Rez errors - std::vector<std::string> lines; - const size_t max_line_length = 512; - for(size_t i=0; i<line.size(); i+= max_line_length) + ofs << "data 'LPic' (5000) {\n"; + ofs << std::hex << std::uppercase << std::setfill('0'); + + for(size_t i = 0; i < header_data.size(); ++i) + { + if(i % 8 == 0) { - int line_length = max_line_length; - if(i+max_line_length > line.size()) - line_length = line.size()-i; - lines.push_back(line.substr(i, line_length)); + ofs << " $\""; } - for(size_t i=0; i<lines.size(); i++) + ofs << std::setw(4) << header_data[i]; + + if(i % 8 == 7 || i == header_data.size() - 1) { - osf << " \"" << lines[i] << "\"\n"; + ofs << "\"\n"; } - osf << " \"\\n\"\n"; + else + { + ofs << " "; + } + } + ofs << "};\n\n"; + // Reset ofs options + ofs << std::dec << std::nouppercase << std::setfill(' '); } - osf << "};\n"; - osf << "\n"; - osf << SLASTREnglish; - ifs.close(); - osf.close(); - } + + if(oldStyle) + { + WriteLicense(ofs, 0, "", cpack_license_file); + } + else + { + for(size_t i = 0; i < languages.size(); ++i) + { + WriteLicense(ofs, i + 5000, languages[i]); + } + } + + ofs.Close(); // convert to UDCO std::string temp_udco = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); @@ -539,7 +777,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, } temp_image = temp_udco; - } + } // Create the final compressed read-only disk image ... @@ -607,3 +845,126 @@ cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix( return GetComponentPackageFileName(package_file_name, componentName, false); } + +void +cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, + int licenseNumber, std::string licenseLanguage, std::string licenseFile) +{ + if(!licenseFile.empty()) + { + licenseNumber = 5002; + licenseLanguage = "English"; + } + + // License header + outputStream << "data 'TEXT' (" << licenseNumber << ", \"" + << licenseLanguage << "\") {\n"; + // License body + std::string actual_license = !licenseFile.empty() ? licenseFile : + (slaDirectory + "/" + licenseLanguage + ".license.txt"); + cmsys::ifstream license_ifs; + license_ifs.open(actual_license.c_str()); + if(license_ifs.is_open()) + { + while(license_ifs.good()) + { + std::string line; + std::getline(license_ifs, line); + if(!line.empty()) + { + EscapeQuotes(line); + std::vector<std::string> lines; + BreakLongLine(line, lines); + for(size_t i = 0; i < lines.size(); ++i) + { + outputStream << " \"" << lines[i] << "\"\n"; + } + } + outputStream << " \"\\n\"\n"; + } + license_ifs.close(); + } + + // End of License + outputStream << "};\n\n"; + if(!licenseFile.empty()) + { + outputStream << SLASTREnglish; + } + else + { + // Menu header + outputStream << "resource 'STR#' (" << licenseNumber << ", \"" + << licenseLanguage << "\") {\n"; + outputStream << " {\n"; + + // Menu body + cmsys::ifstream menu_ifs; + menu_ifs.open((slaDirectory+"/"+licenseLanguage+".menu.txt").c_str()); + if(menu_ifs.is_open()) + { + size_t lines_written = 0; + while(menu_ifs.good()) + { + // Lines written from original file, not from broken up lines + std::string line; + std::getline(menu_ifs, line); + if(!line.empty()) + { + EscapeQuotes(line); + std::vector<std::string> lines; + BreakLongLine(line, lines); + for(size_t i = 0; i < lines.size(); ++i) + { + std::string comma; + // We need a comma after every complete string, + // but not on the very last line + if(lines_written != 8 && i == lines.size() - 1) + { + comma = ","; + } + else + { + comma = ""; + } + outputStream << " \"" << lines[i] << "\"" << comma << "\n"; + } + ++lines_written; + } + } + menu_ifs.close(); + } + + //End of menu + outputStream << " }\n"; + outputStream << "};\n"; + outputStream << "\n"; + } +} + +void +cmCPackDragNDropGenerator::BreakLongLine(const std::string& line, + std::vector<std::string>& lines) +{ + const size_t max_line_length = 512; + for(size_t i = 0; i < line.size(); i += max_line_length) + { + int line_length = max_line_length; + if(i + max_line_length > line.size()) + { + line_length = line.size() - i; + } + lines.push_back(line.substr(i, line_length)); + } +} + +void +cmCPackDragNDropGenerator::EscapeQuotes(std::string& line) +{ + std::string::size_type pos = line.find('\"'); + while(pos != std::string::npos) + { + line.replace(pos, 1, "\\\""); + pos = line.find('\"', pos + 2); + } +} diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h index 1c84d49..53d38c4 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.h +++ b/Source/CPack/cmCPackDragNDropGenerator.h @@ -15,6 +15,8 @@ #include "cmCPackGenerator.h" +class cmGeneratedFileStream; + /** \class cmCPackDragNDropGenerator * \brief A generator for OSX drag-n-drop installs */ @@ -34,6 +36,7 @@ protected: bool CopyFile(std::ostringstream& source, std::ostringstream& target); + bool CreateEmptyFile(std::ostringstream& target, size_t size); bool RunCommand(std::ostringstream& command, std::string* output = 0); std::string @@ -42,6 +45,15 @@ protected: int CreateDMG(const std::string& src_dir, const std::string& output_file); std::string InstallPrefix; + +private: + std::string slaDirectory; + + void WriteLicense(cmGeneratedFileStream& outputStream, int licenseNumber, + std::string licenseLanguage, std::string licenseFile = ""); + void BreakLongLine(const std::string& line, + std::vector<std::string>& lines); + void EscapeQuotes(std::string& line); }; #endif diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 20807c8..6027502 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -913,16 +913,33 @@ int cmCTestCoverageHandler::HandleJacocoCoverage( { cmParseJacocoCoverage cov = cmParseJacocoCoverage(*cont, this->CTest); - cmsys::Glob g; + + // Search in the source directory. + cmsys::Glob g1; std::vector<std::string> files; - g.SetRecurse(true); + g1.SetRecurse(true); std::string SourceDir = this->CTest->GetCTestConfiguration("SourceDirectory"); std::string coverageFile = SourceDir+ "/*jacoco.xml"; - g.FindFiles(coverageFile); - files=g.GetFiles(); + g1.FindFiles(coverageFile); + files = g1.GetFiles(); + + // ...and in the binary directory. + cmsys::Glob g2; + std::vector<std::string> binFiles; + g2.SetRecurse(true); + std::string binaryDir + = this->CTest->GetCTestConfiguration("BuildDirectory"); + std::string binCoverageFile = binaryDir+ "/*jacoco.xml"; + g2.FindFiles(binCoverageFile); + binFiles = g2.GetFiles(); + if (!binFiles.empty()) + { + files.insert(files.end(), binFiles.begin(), binFiles.end()); + } + if (!files.empty()) { cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, @@ -2287,7 +2304,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( { cper /= 2.0f; } - percent_coverage += cper; + percent_coverage += static_cast<double>(cper); float cmet = static_cast<float>(percentFunction + percentBranch); if(totalBranches > 0) { diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index fa3b416..a8f983f 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -579,7 +579,7 @@ int cmCTestTestHandler::ProcessHandler() } cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl - << static_cast<int>(percent + .5) << "% tests passed, " + << static_cast<int>(percent + .5f) << "% tests passed, " << failed.size() << " tests failed out of " << total << std::endl); if(this->CTest->GetLabelSummary()) diff --git a/Source/cmFortranLexer.cxx b/Source/cmFortranLexer.cxx index b727f0e..6779c1a 100644 --- a/Source/cmFortranLexer.cxx +++ b/Source/cmFortranLexer.cxx @@ -1,6 +1,6 @@ /*============================================================================ CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. @@ -20,7 +20,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_SUBMINOR_VERSION 39 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -190,11 +190,17 @@ typedef void* yyscan_t; typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -212,11 +218,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state @@ -234,7 +235,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - int yy_n_chars; + yy_size_t yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -313,7 +314,7 @@ static void cmFortran_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yys YY_BUFFER_STATE cmFortran_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE cmFortran_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); void *cmFortran_yyalloc (yy_size_t ,yyscan_t yyscanner ); void *cmFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); @@ -345,7 +346,7 @@ void cmFortran_yyfree (void * ,yyscan_t yyscanner ); /* Begin user sect3 */ -#define cmFortran_yywrap(n) 1 +#define cmFortran_yywrap(yyscanner) 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; @@ -369,8 +370,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 44 -#define YY_END_OF_BUFFER 45 +#define YY_NUM_RULES 45 +#define YY_END_OF_BUFFER 46 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -378,26 +379,27 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[165] = +static yyconst flex_int16_t yy_accept[173] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 45, 39, 41, 40, 43, 1, 39, 32, 2, 34, - 39, 40, 37, 39, 38, 39, 38, 41, 39, 40, - 39, 38, 9, 8, 9, 4, 3, 39, 0, 10, - 0, 0, 0, 0, 0, 32, 32, 33, 35, 37, - 39, 38, 0, 42, 38, 0, 0, 0, 0, 0, - 0, 0, 0, 39, 0, 11, 38, 0, 0, 5, - 0, 0, 0, 28, 0, 0, 32, 32, 32, 32, - 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, - 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, + 46, 40, 42, 41, 44, 1, 40, 33, 2, 35, + 40, 41, 38, 40, 39, 40, 39, 42, 40, 41, + 40, 39, 9, 8, 9, 4, 3, 40, 0, 10, + 0, 0, 0, 0, 0, 33, 33, 34, 36, 38, + 40, 39, 0, 43, 39, 0, 0, 0, 12, 0, + 0, 0, 0, 0, 0, 40, 0, 11, 39, 0, + 0, 5, 0, 0, 0, 29, 0, 0, 33, 33, + 33, 33, 0, 0, 12, 12, 0, 0, 0, 23, + 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 29, 30, 0, 0, 0, 0, 0, 0, - 0, 23, 24, 0, 0, 0, 0, 0, 0, 0, - 0, 31, 26, 0, 0, 19, 0, 0, 25, 20, - 0, 0, 18, 0, 0, 17, 27, 0, 0, 16, - 21, 0, 7, 36, 7, 14, 0, 13, 15, 0, - 0, 0, 12, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 30, 31, + 0, 0, 0, 0, 0, 0, 0, 24, 25, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 32, 27, + 0, 0, 20, 0, 0, 26, 21, 0, 0, 0, + 19, 0, 0, 18, 28, 0, 0, 17, 22, 0, + 7, 37, 7, 15, 0, 14, 16, 0, 0, 0, + 13, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -441,178 +443,186 @@ static yyconst flex_int32_t yy_meta[42] = 7 } ; -static yyconst flex_int16_t yy_base[174] = +static yyconst flex_int16_t yy_base[182] = { 0, - 0, 40, 0, 41, 188, 48, 44, 54, 56, 65, - 186, 0, 505, 505, 171, 505, 81, 74, 505, 505, - 158, 505, 151, 137, 0, 85, 122, 87, 153, 145, - 194, 226, 505, 143, 91, 505, 505, 0, 142, 505, - 266, 34, 70, 74, 34, 122, 141, 505, 0, 505, - 112, 0, 98, 505, 0, 154, 306, 0, 43, 133, - 139, 46, 130, 347, 130, 505, 0, 121, 163, 179, - 104, 156, 129, 176, 147, 178, 214, 267, 273, 292, - 279, 179, 249, 280, 257, 265, 288, 289, 116, 107, - 317, 505, 287, 289, 291, 302, 307, 310, 307, 311, - - 316, 326, 329, 333, 332, 336, 347, 345, 349, 101, - 86, 346, 505, 505, 350, 351, 353, 350, 357, 362, - 362, 505, 505, 367, 369, 371, 366, 372, 56, 47, - 374, 505, 505, 374, 379, 505, 374, 387, 505, 505, - 387, 391, 505, 117, 0, 505, 505, 392, 394, 505, - 505, 394, 505, 505, 505, 505, 395, 419, 505, 429, - 0, 25, 505, 505, 446, 453, 459, 462, 469, 476, - 483, 490, 497 + 0, 40, 0, 41, 220, 48, 44, 54, 56, 65, + 220, 0, 535, 535, 216, 535, 81, 74, 535, 535, + 186, 535, 153, 145, 0, 85, 122, 87, 154, 155, + 195, 227, 535, 147, 91, 535, 535, 0, 147, 535, + 267, 34, 70, 74, 34, 122, 141, 535, 0, 535, + 112, 0, 98, 535, 0, 156, 307, 0, 143, 43, + 155, 151, 48, 101, 130, 348, 130, 535, 0, 121, + 197, 165, 172, 244, 182, 183, 191, 248, 273, 293, + 308, 314, 321, 246, 275, 216, 269, 299, 304, 327, + 307, 304, 312, 116, 107, 367, 535, 327, 334, 347, + + 347, 350, 352, 349, 354, 359, 357, 363, 366, 365, + 369, 372, 369, 373, 374, 101, 86, 372, 535, 535, + 378, 380, 386, 382, 388, 388, 389, 535, 535, 393, + 394, 396, 392, 430, 400, 56, 47, 403, 535, 535, + 409, 414, 535, 409, 416, 535, 535, 416, 419, 441, + 535, 117, 0, 535, 535, 423, 426, 535, 535, 430, + 535, 535, 535, 535, 432, 457, 535, 459, 0, 25, + 535, 535, 476, 483, 489, 492, 499, 506, 513, 520, + 527 } ; -static yyconst flex_int16_t yy_def[174] = +static yyconst flex_int16_t yy_def[182] = { 0, - 164, 1, 1, 1, 1, 1, 165, 165, 165, 165, - 164, 166, 164, 164, 167, 164, 166, 164, 164, 164, - 166, 164, 164, 166, 168, 166, 168, 164, 166, 164, - 169, 164, 164, 164, 164, 164, 164, 166, 167, 164, - 164, 164, 164, 164, 164, 164, 170, 164, 166, 164, - 166, 168, 164, 164, 27, 164, 164, 57, 164, 164, - 164, 164, 164, 169, 169, 164, 32, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 170, 170, 170, 170, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 171, 172, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 173, 173, 164, 0, 164, 164, 164, 164, 164, 164, - 164, 164, 164 + 172, 1, 1, 1, 1, 1, 173, 173, 173, 173, + 172, 174, 172, 172, 175, 172, 174, 172, 172, 172, + 174, 172, 172, 174, 176, 174, 176, 172, 172, 172, + 177, 172, 172, 172, 172, 172, 172, 174, 175, 172, + 172, 172, 172, 172, 172, 172, 178, 172, 174, 172, + 174, 176, 172, 172, 27, 172, 172, 57, 174, 172, + 172, 172, 172, 172, 172, 177, 177, 172, 32, 172, + 172, 172, 172, 172, 172, 172, 172, 172, 178, 178, + 178, 178, 172, 172, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, + + 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, + 172, 179, 180, 172, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 172, 172, 172, 181, 181, + 172, 0, 172, 172, 172, 172, 172, 172, 172, 172, + 172 } ; -static yyconst flex_int16_t yy_nxt[547] = +static yyconst flex_int16_t yy_nxt[577] = { 0, 12, 13, 14, 13, 13, 15, 16, 12, 17, 18, 19, 12, 20, 12, 21, 22, 12, 23, 12, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 27, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 28, 28, 163, 28, 28, 34, 29, 29, 28, - 30, 145, 28, 35, 36, 29, 34, 71, 34, 31, - 144, 76, 37, 35, 36, 35, 83, 34, 71, 32, - 32, 37, 76, 88, 35, 46, 46, 83, 46, 47, - 32, 32, 41, 48, 88, 41, 53, 54, 56, 53, - 130, 56, 69, 70, 57, 69, 72, 73, 74, 53, - - 54, 75, 53, 42, 43, 129, 44, 72, 73, 74, - 45, 111, 75, 81, 42, 43, 81, 44, 154, 154, - 110, 45, 38, 46, 46, 90, 46, 47, 93, 38, - 38, 48, 66, 38, 89, 55, 38, 82, 38, 93, - 38, 38, 78, 46, 40, 78, 79, 68, 82, 63, - 80, 96, 38, 55, 58, 56, 51, 58, 56, 84, - 85, 57, 96, 86, 69, 70, 87, 69, 99, 50, - 84, 85, 49, 40, 86, 59, 60, 87, 61, 99, - 91, 94, 62, 91, 95, 164, 59, 60, 92, 61, - 30, 164, 94, 62, 64, 95, 66, 164, 97, 164, - - 100, 64, 64, 98, 164, 64, 101, 64, 64, 97, - 64, 100, 64, 64, 98, 78, 46, 101, 78, 79, - 164, 164, 164, 80, 64, 64, 65, 65, 66, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 67, - 65, 65, 65, 65, 65, 65, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 65, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 41, 78, 46, - 41, 78, 79, 102, 78, 46, 80, 78, 79, 105, - 81, 164, 80, 81, 102, 164, 164, 106, 42, 43, - 105, 44, 107, 78, 46, 45, 78, 79, 106, 42, - - 43, 80, 44, 107, 82, 103, 45, 58, 104, 108, - 58, 109, 112, 113, 114, 82, 103, 164, 91, 104, - 108, 91, 109, 112, 113, 114, 92, 115, 59, 60, - 116, 61, 117, 118, 119, 62, 164, 120, 115, 59, - 60, 116, 61, 117, 118, 119, 62, 64, 120, 66, - 164, 121, 164, 122, 64, 64, 123, 124, 64, 125, - 64, 64, 121, 64, 122, 64, 64, 123, 124, 126, - 125, 127, 128, 131, 132, 133, 134, 64, 64, 135, - 126, 136, 127, 128, 131, 132, 133, 134, 137, 138, - 135, 139, 136, 140, 141, 142, 143, 146, 147, 137, - - 138, 148, 139, 149, 140, 141, 142, 143, 146, 147, - 150, 151, 148, 152, 149, 156, 157, 158, 159, 164, - 160, 150, 151, 160, 152, 164, 156, 157, 158, 159, - 160, 164, 164, 160, 164, 161, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 161, 33, 33, 33, 33, - 33, 33, 33, 38, 164, 164, 164, 38, 38, 39, - 39, 39, 39, 39, 39, 39, 52, 164, 52, 65, - 65, 65, 65, 65, 65, 65, 77, 77, 77, 77, - 77, 77, 77, 153, 153, 153, 164, 153, 153, 153, - 155, 164, 155, 164, 155, 155, 155, 162, 162, 162, - - 162, 162, 164, 162, 11, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164 + 25, 28, 28, 171, 28, 28, 34, 29, 29, 28, + 30, 153, 28, 35, 36, 29, 34, 73, 34, 31, + 152, 78, 37, 35, 36, 35, 87, 34, 73, 32, + 32, 37, 78, 92, 35, 46, 46, 87, 46, 47, + 32, 32, 41, 48, 92, 41, 53, 54, 56, 53, + 137, 56, 71, 72, 57, 71, 74, 75, 76, 53, + + 54, 77, 53, 42, 43, 136, 44, 74, 75, 76, + 45, 117, 77, 83, 42, 43, 83, 44, 162, 162, + 116, 45, 38, 46, 46, 95, 46, 47, 93, 38, + 38, 48, 68, 38, 94, 55, 38, 84, 38, 93, + 38, 38, 80, 46, 86, 80, 81, 86, 84, 40, + 82, 70, 38, 55, 38, 58, 59, 56, 58, 65, + 56, 38, 38, 57, 51, 38, 96, 59, 38, 96, + 38, 50, 38, 38, 97, 90, 60, 61, 91, 62, + 63, 88, 89, 64, 38, 38, 90, 60, 61, 91, + 62, 63, 88, 89, 64, 66, 98, 68, 71, 72, + + 49, 71, 66, 66, 101, 102, 66, 98, 66, 66, + 103, 66, 104, 66, 66, 101, 102, 86, 40, 172, + 86, 103, 30, 104, 172, 66, 66, 67, 67, 68, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 69, 67, 67, 67, 67, 67, 67, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 67, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 41, 99, + 105, 41, 100, 106, 80, 46, 86, 80, 81, 86, + 99, 105, 82, 100, 106, 172, 172, 172, 85, 42, + 43, 172, 44, 107, 80, 46, 45, 80, 81, 172, + + 42, 43, 82, 44, 107, 172, 172, 45, 58, 80, + 46, 58, 80, 81, 172, 80, 46, 82, 80, 81, + 85, 172, 83, 82, 108, 83, 110, 109, 113, 60, + 61, 114, 62, 63, 115, 108, 64, 110, 109, 113, + 60, 61, 114, 62, 63, 115, 84, 64, 66, 111, + 68, 172, 118, 172, 112, 66, 66, 84, 119, 66, + 111, 66, 66, 118, 66, 112, 66, 66, 96, 119, + 120, 96, 121, 122, 123, 124, 97, 125, 66, 66, + 126, 120, 127, 121, 122, 123, 124, 128, 125, 129, + 130, 126, 131, 127, 132, 133, 134, 135, 128, 138, + + 129, 130, 139, 131, 140, 132, 133, 134, 135, 141, + 138, 142, 143, 139, 144, 140, 145, 146, 147, 148, + 141, 149, 142, 143, 151, 144, 154, 145, 146, 147, + 148, 150, 149, 155, 150, 151, 156, 154, 157, 158, + 159, 160, 150, 85, 155, 150, 164, 156, 165, 157, + 158, 159, 160, 166, 85, 167, 172, 164, 168, 165, + 168, 168, 172, 168, 166, 172, 167, 172, 172, 172, + 172, 172, 172, 169, 172, 169, 33, 33, 33, 33, + 33, 33, 33, 38, 172, 172, 172, 38, 38, 39, + 39, 39, 39, 39, 39, 39, 52, 172, 52, 67, + + 67, 67, 67, 67, 67, 67, 79, 79, 79, 79, + 79, 79, 79, 161, 161, 161, 172, 161, 161, 161, + 163, 172, 163, 172, 163, 163, 163, 170, 170, 170, + 170, 170, 172, 170, 11, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 172 } ; -static yyconst flex_int16_t yy_chk[547] = +static yyconst flex_int16_t yy_chk[577] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 4, 162, 2, 4, 7, 2, 4, 6, - 6, 130, 6, 7, 7, 6, 8, 42, 9, 6, - 129, 45, 9, 8, 8, 9, 59, 10, 42, 6, - 6, 10, 45, 62, 10, 18, 18, 59, 18, 18, - 6, 6, 17, 18, 62, 17, 26, 26, 28, 26, - 111, 28, 35, 35, 28, 35, 43, 43, 44, 53, - - 53, 44, 53, 17, 17, 110, 17, 43, 43, 44, - 17, 90, 44, 51, 17, 17, 51, 17, 144, 144, - 89, 17, 27, 46, 46, 68, 46, 46, 71, 27, - 27, 46, 65, 27, 63, 27, 27, 51, 27, 71, - 27, 27, 47, 47, 39, 47, 47, 34, 51, 30, - 47, 73, 27, 27, 29, 56, 24, 29, 56, 60, - 60, 56, 73, 61, 69, 69, 61, 69, 75, 23, - 60, 60, 21, 15, 61, 29, 29, 61, 29, 75, - 70, 72, 29, 70, 72, 11, 29, 29, 70, 29, - 5, 0, 72, 29, 31, 72, 31, 0, 74, 0, - - 76, 31, 31, 74, 0, 31, 82, 31, 31, 74, - 31, 76, 31, 31, 74, 77, 77, 82, 77, 77, - 0, 0, 0, 77, 31, 31, 32, 32, 32, 32, + 1, 2, 4, 170, 2, 4, 7, 2, 4, 6, + 6, 137, 6, 7, 7, 6, 8, 42, 9, 6, + 136, 45, 9, 8, 8, 9, 60, 10, 42, 6, + 6, 10, 45, 63, 10, 18, 18, 60, 18, 18, + 6, 6, 17, 18, 63, 17, 26, 26, 28, 26, + 117, 28, 35, 35, 28, 35, 43, 43, 44, 53, + + 53, 44, 53, 17, 17, 116, 17, 43, 43, 44, + 17, 95, 44, 51, 17, 17, 51, 17, 152, 152, + 94, 17, 27, 46, 46, 70, 46, 46, 64, 27, + 27, 46, 67, 27, 65, 27, 27, 51, 27, 64, + 27, 27, 47, 47, 59, 47, 47, 59, 51, 39, + 47, 34, 27, 27, 29, 29, 59, 56, 29, 30, + 56, 29, 29, 56, 24, 29, 72, 29, 29, 72, + 29, 23, 29, 29, 72, 62, 29, 29, 62, 29, + 29, 61, 61, 29, 29, 29, 62, 29, 29, 62, + 29, 29, 61, 61, 29, 31, 73, 31, 71, 71, + + 21, 71, 31, 31, 75, 76, 31, 73, 31, 31, + 76, 31, 77, 31, 31, 75, 76, 86, 15, 11, + 86, 76, 5, 77, 0, 31, 31, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 41, 78, 78, - 41, 78, 78, 83, 79, 79, 78, 79, 79, 85, - 81, 0, 79, 81, 83, 0, 0, 86, 41, 41, - 85, 41, 86, 80, 80, 41, 80, 80, 86, 41, - - 41, 80, 41, 86, 81, 84, 41, 57, 84, 87, - 57, 88, 93, 94, 95, 81, 84, 0, 91, 84, - 87, 91, 88, 93, 94, 95, 91, 96, 57, 57, - 97, 57, 98, 99, 100, 57, 0, 101, 96, 57, - 57, 97, 57, 98, 99, 100, 57, 64, 101, 64, - 0, 102, 0, 103, 64, 64, 104, 105, 64, 106, - 64, 64, 102, 64, 103, 64, 64, 104, 105, 107, - 106, 108, 109, 112, 115, 116, 117, 64, 64, 118, - 107, 119, 108, 109, 112, 115, 116, 117, 120, 121, - 118, 124, 119, 125, 126, 127, 128, 131, 134, 120, - - 121, 135, 124, 137, 125, 126, 127, 128, 131, 134, - 138, 141, 135, 142, 137, 148, 149, 152, 157, 0, - 158, 138, 141, 158, 142, 0, 148, 149, 152, 157, - 160, 0, 0, 160, 0, 158, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 160, 165, 165, 165, 165, - 165, 165, 165, 166, 0, 0, 0, 166, 166, 167, - 167, 167, 167, 167, 167, 167, 168, 0, 168, 169, - 169, 169, 169, 169, 169, 169, 170, 170, 170, 170, - 170, 170, 170, 171, 171, 171, 0, 171, 171, 171, - 172, 0, 172, 0, 172, 172, 172, 173, 173, 173, - - 173, 173, 0, 173, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164 + 32, 32, 32, 32, 32, 32, 32, 32, 41, 74, + 78, 41, 74, 84, 79, 79, 85, 79, 79, 85, + 74, 78, 79, 74, 84, 0, 0, 0, 85, 41, + 41, 0, 41, 87, 80, 80, 41, 80, 80, 0, + + 41, 41, 80, 41, 87, 0, 0, 41, 57, 81, + 81, 57, 81, 81, 0, 82, 82, 81, 82, 82, + 57, 0, 83, 82, 88, 83, 89, 88, 91, 57, + 57, 92, 57, 57, 93, 88, 57, 89, 88, 91, + 57, 57, 92, 57, 57, 93, 83, 57, 66, 90, + 66, 0, 98, 0, 90, 66, 66, 83, 99, 66, + 90, 66, 66, 98, 66, 90, 66, 66, 96, 99, + 100, 96, 101, 102, 103, 104, 96, 105, 66, 66, + 106, 100, 107, 101, 102, 103, 104, 108, 105, 109, + 110, 106, 111, 107, 112, 113, 114, 115, 108, 118, + + 109, 110, 121, 111, 122, 112, 113, 114, 115, 123, + 118, 124, 125, 121, 126, 122, 127, 130, 131, 132, + 123, 133, 124, 125, 135, 126, 138, 127, 130, 131, + 132, 134, 133, 141, 134, 135, 142, 138, 144, 145, + 148, 149, 150, 134, 141, 150, 156, 142, 157, 144, + 145, 148, 149, 160, 150, 165, 0, 156, 166, 157, + 168, 166, 0, 168, 160, 0, 165, 0, 0, 0, + 0, 0, 0, 166, 0, 168, 173, 173, 173, 173, + 173, 173, 173, 174, 0, 0, 0, 174, 174, 175, + 175, 175, 175, 175, 175, 175, 176, 0, 176, 177, + + 177, 177, 177, 177, 177, 177, 178, 178, 178, 178, + 178, 178, 178, 179, 179, 179, 0, 179, 179, 179, + 180, 0, 180, 0, 180, 180, 180, 181, 181, 181, + 181, 181, 0, 181, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 172 } ; /* The intent behind this definition is that it'll catch @@ -655,6 +665,7 @@ Run flex like this: Modify cmFortranLexer.cxx: - remove TABs + - remove use of the 'register' storage class specifier - remove "yyscanner" argument from these methods: yy_fatal_error, cmFortran_yyalloc, cmFortran_yyrealloc, cmFortran_yyfree - remove "yyscanner = NULL" from end of cmFortran_yylex_destroy @@ -685,7 +696,7 @@ Modify cmFortranLexer.h: /*--------------------------------------------------------------------------*/ -#line 678 "cmFortranLexer.cxx" +#line 689 "cmFortranLexer.cxx" #define INITIAL 0 #define free_fmt 1 @@ -718,8 +729,8 @@ struct yyguts_t size_t yy_buffer_stack_max; /**< capacity of stack. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; - int yy_n_chars; - int yyleng_r; + yy_size_t yy_n_chars; + yy_size_t yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -766,7 +777,7 @@ FILE *cmFortran_yyget_out (yyscan_t yyscanner ); void cmFortran_yyset_out (FILE * out_str ,yyscan_t yyscanner ); -int cmFortran_yyget_leng (yyscan_t yyscanner ); +yy_size_t cmFortran_yyget_leng (yyscan_t yyscanner ); char *cmFortran_yyget_text (yyscan_t yyscanner ); @@ -774,6 +785,10 @@ int cmFortran_yyget_lineno (yyscan_t yyscanner ); void cmFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); +int cmFortran_yyget_column (yyscan_t yyscanner ); + +void cmFortran_yyset_column (int column_no ,yyscan_t yyscanner ); + /* Macros after this point can all be overridden by user definitions in * section 1. */ @@ -918,11 +933,6 @@ YY_DECL int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 71 "cmFortranLexer.in.l" - - -#line 914 "cmFortranLexer.cxx" - if ( !yyg->yy_init ) { yyg->yy_init = 1; @@ -949,6 +959,12 @@ YY_DECL cmFortran_yy_load_buffer_state(yyscanner ); } + { +#line 72 "cmFortranLexer.in.l" + + +#line 956 "cmFortranLexer.cxx" + for(;;) /* loops until end-of-file is reached */ { yy_cp = yyg->yy_c_buf_p; @@ -966,7 +982,7 @@ YY_DECL yy_match: do { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -975,13 +991,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 165 ) + if ( yy_current_state >= 173 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 505 ); + while ( yy_base[yy_current_state] != 535 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1007,7 +1023,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 73 "cmFortranLexer.in.l" +#line 74 "cmFortranLexer.in.l" { cmFortranParser_StringStart(yyextra); cmFortranParser_SetOldStartcond(yyextra, YY_START); @@ -1016,7 +1032,7 @@ YY_RULE_SETUP YY_BREAK case 2: YY_RULE_SETUP -#line 79 "cmFortranLexer.in.l" +#line 80 "cmFortranLexer.in.l" { cmFortranParser_StringStart(yyextra); cmFortranParser_SetOldStartcond(yyextra, YY_START); @@ -1024,10 +1040,10 @@ YY_RULE_SETUP } YY_BREAK case 3: -#line 86 "cmFortranLexer.in.l" +#line 87 "cmFortranLexer.in.l" case 4: YY_RULE_SETUP -#line 86 "cmFortranLexer.in.l" +#line 87 "cmFortranLexer.in.l" { BEGIN(cmFortranParser_GetOldStartcond(yyextra) ); yylvalp->string = strdup(cmFortranParser_StringEnd(yyextra)); @@ -1035,17 +1051,17 @@ YY_RULE_SETUP } case 5: /* rule 5 can match eol */ -#line 93 "cmFortranLexer.in.l" +#line 94 "cmFortranLexer.in.l" case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 93 "cmFortranLexer.in.l" +#line 94 "cmFortranLexer.in.l" /* Ignore (continued strings, free fmt) */ YY_BREAK case 7: /* rule 7 can match eol */ YY_RULE_SETUP -#line 95 "cmFortranLexer.in.l" +#line 96 "cmFortranLexer.in.l" { if (cmFortranParser_GetOldStartcond(yyextra) == fixed_fmt) ; /* Ignore (cont. strings, fixed fmt) */ @@ -1058,7 +1074,7 @@ YY_RULE_SETUP case 8: /* rule 8 can match eol */ YY_RULE_SETUP -#line 105 "cmFortranLexer.in.l" +#line 106 "cmFortranLexer.in.l" { unput ('\n'); BEGIN(INITIAL); @@ -1066,7 +1082,7 @@ YY_RULE_SETUP } case 9: YY_RULE_SETUP -#line 111 "cmFortranLexer.in.l" +#line 112 "cmFortranLexer.in.l" { cmFortranParser_StringAppend(yyextra, yytext[0]); } @@ -1074,165 +1090,169 @@ YY_RULE_SETUP case 10: /* rule 10 can match eol */ YY_RULE_SETUP -#line 115 "cmFortranLexer.in.l" +#line 116 "cmFortranLexer.in.l" { return EOSTMT; } /* Treat comments like */ case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 116 "cmFortranLexer.in.l" +#line 117 "cmFortranLexer.in.l" { return EOSTMT; } /* empty lines */ case 12: -/* rule 12 can match eol */ YY_RULE_SETUP -#line 118 "cmFortranLexer.in.l" +#line 119 "cmFortranLexer.in.l" +{ return CPP_LINE_DIRECTIVE; } +case 13: +/* rule 13 can match eol */ +YY_RULE_SETUP +#line 120 "cmFortranLexer.in.l" { yytext[yyleng-1] = 0; yylvalp->string = strdup(strchr(yytext, '<')+1); return CPP_INCLUDE_ANGLE; } -case 13: -YY_RULE_SETUP -#line 123 "cmFortranLexer.in.l" -{ return CPP_INCLUDE; } case 14: YY_RULE_SETUP -#line 124 "cmFortranLexer.in.l" -{ return F90PPR_INCLUDE; } +#line 125 "cmFortranLexer.in.l" +{ return CPP_INCLUDE; } case 15: YY_RULE_SETUP -#line 125 "cmFortranLexer.in.l" -{ return COCO_INCLUDE; } +#line 126 "cmFortranLexer.in.l" +{ return F90PPR_INCLUDE; } case 16: YY_RULE_SETUP #line 127 "cmFortranLexer.in.l" -{ return CPP_DEFINE; } +{ return COCO_INCLUDE; } case 17: YY_RULE_SETUP -#line 128 "cmFortranLexer.in.l" -{ return F90PPR_DEFINE; } +#line 129 "cmFortranLexer.in.l" +{ return CPP_DEFINE; } case 18: YY_RULE_SETUP #line 130 "cmFortranLexer.in.l" -{ return CPP_UNDEF; } +{ return F90PPR_DEFINE; } case 19: YY_RULE_SETUP -#line 131 "cmFortranLexer.in.l" -{ return F90PPR_UNDEF; } +#line 132 "cmFortranLexer.in.l" +{ return CPP_UNDEF; } case 20: YY_RULE_SETUP #line 133 "cmFortranLexer.in.l" -{ return CPP_IFDEF; } +{ return F90PPR_UNDEF; } case 21: YY_RULE_SETUP -#line 134 "cmFortranLexer.in.l" -{ return CPP_IFNDEF; } +#line 135 "cmFortranLexer.in.l" +{ return CPP_IFDEF; } case 22: YY_RULE_SETUP -#line 135 "cmFortranLexer.in.l" -{ return CPP_IF; } +#line 136 "cmFortranLexer.in.l" +{ return CPP_IFNDEF; } case 23: YY_RULE_SETUP -#line 136 "cmFortranLexer.in.l" -{ return CPP_ELIF; } +#line 137 "cmFortranLexer.in.l" +{ return CPP_IF; } case 24: YY_RULE_SETUP -#line 137 "cmFortranLexer.in.l" -{ return CPP_ELSE; } +#line 138 "cmFortranLexer.in.l" +{ return CPP_ELIF; } case 25: YY_RULE_SETUP -#line 138 "cmFortranLexer.in.l" -{ return CPP_ENDIF; } +#line 139 "cmFortranLexer.in.l" +{ return CPP_ELSE; } case 26: YY_RULE_SETUP #line 140 "cmFortranLexer.in.l" -{ return F90PPR_IFDEF; } +{ return CPP_ENDIF; } case 27: YY_RULE_SETUP -#line 141 "cmFortranLexer.in.l" -{ return F90PPR_IFNDEF; } +#line 142 "cmFortranLexer.in.l" +{ return F90PPR_IFDEF; } case 28: YY_RULE_SETUP -#line 142 "cmFortranLexer.in.l" -{ return F90PPR_IF; } +#line 143 "cmFortranLexer.in.l" +{ return F90PPR_IFNDEF; } case 29: YY_RULE_SETUP -#line 143 "cmFortranLexer.in.l" -{ return F90PPR_ELIF; } +#line 144 "cmFortranLexer.in.l" +{ return F90PPR_IF; } case 30: YY_RULE_SETUP -#line 144 "cmFortranLexer.in.l" -{ return F90PPR_ELSE; } +#line 145 "cmFortranLexer.in.l" +{ return F90PPR_ELIF; } case 31: YY_RULE_SETUP -#line 145 "cmFortranLexer.in.l" -{ return F90PPR_ENDIF; } -/* Line continuations, possible involving comments. */ +#line 146 "cmFortranLexer.in.l" +{ return F90PPR_ELSE; } case 32: -/* rule 32 can match eol */ YY_RULE_SETUP -#line 148 "cmFortranLexer.in.l" - - YY_BREAK +#line 147 "cmFortranLexer.in.l" +{ return F90PPR_ENDIF; } +/* Line continuations, possible involving comments. */ case 33: /* rule 33 can match eol */ YY_RULE_SETUP -#line 149 "cmFortranLexer.in.l" +#line 150 "cmFortranLexer.in.l" YY_BREAK case 34: +/* rule 34 can match eol */ YY_RULE_SETUP #line 151 "cmFortranLexer.in.l" -{ return COMMA; } + + YY_BREAK case 35: YY_RULE_SETUP #line 153 "cmFortranLexer.in.l" -{ return DCOLON; } +{ return COMMA; } case 36: -/* rule 36 can match eol */ YY_RULE_SETUP #line 155 "cmFortranLexer.in.l" -{ return GARBAGE; } +{ return DCOLON; } case 37: +/* rule 37 can match eol */ YY_RULE_SETUP #line 157 "cmFortranLexer.in.l" -{ return ASSIGNMENT_OP; } +{ return GARBAGE; } case 38: YY_RULE_SETUP #line 159 "cmFortranLexer.in.l" +{ return ASSIGNMENT_OP; } +case 39: +YY_RULE_SETUP +#line 161 "cmFortranLexer.in.l" { yylvalp->string = strdup(yytext); return WORD; } -case 39: -YY_RULE_SETUP -#line 164 "cmFortranLexer.in.l" -{ return GARBAGE; } case 40: -/* rule 40 can match eol */ YY_RULE_SETUP #line 166 "cmFortranLexer.in.l" -{ return EOSTMT; } +{ return GARBAGE; } case 41: +/* rule 41 can match eol */ YY_RULE_SETUP -#line 169 "cmFortranLexer.in.l" -/* Ignore */ - YY_BREAK +#line 168 "cmFortranLexer.in.l" +{ return EOSTMT; } case 42: -/* rule 42 can match eol */ YY_RULE_SETUP -#line 170 "cmFortranLexer.in.l" -/* Ignore line-endings preceeded by \ */ +#line 171 "cmFortranLexer.in.l" +/* Ignore */ YY_BREAK case 43: +/* rule 43 can match eol */ YY_RULE_SETUP #line 172 "cmFortranLexer.in.l" +/* Ignore line-endings preceeded by \ */ + YY_BREAK +case 44: +YY_RULE_SETUP +#line 174 "cmFortranLexer.in.l" { return *yytext; } case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(free_fmt): case YY_STATE_EOF(fixed_fmt): case YY_STATE_EOF(str_sq): case YY_STATE_EOF(str_dq): -#line 174 "cmFortranLexer.in.l" +#line 176 "cmFortranLexer.in.l" { if(!cmFortranParser_FilePop(yyextra) ) { @@ -1240,12 +1260,12 @@ case YY_STATE_EOF(str_dq): } } YY_BREAK -case 44: +case 45: YY_RULE_SETUP -#line 181 "cmFortranLexer.in.l" +#line 183 "cmFortranLexer.in.l" ECHO; YY_BREAK -#line 1270 "cmFortranLexer.cxx" +#line 1291 "cmFortranLexer.cxx" case YY_END_OF_BUFFER: { @@ -1374,6 +1394,7 @@ ECHO; "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of cmFortran_yylex */ /* yy_get_next_buffer - try to read in a new buffer @@ -1430,21 +1451,21 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { - int num_to_read = + yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) (yyg->yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { - int new_size = b->yy_buf_size * 2; + yy_size_t new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1475,7 +1496,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, (size_t) num_to_read ); + yyg->yy_n_chars, num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } @@ -1538,7 +1559,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 165 ) + if ( yy_current_state >= 173 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1567,12 +1588,13 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 165 ) + if ( yy_current_state >= 173 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 164); + yy_is_jam = (yy_current_state == 172); + (void)yyg; return yy_is_jam ? 0 : yy_current_state; } @@ -1589,7 +1611,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - int number_to_move = yyg->yy_n_chars + 2; + yy_size_t number_to_move = yyg->yy_n_chars + 2; char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; char *source = @@ -1639,7 +1661,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -1805,10 +1827,6 @@ static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner) cmFortran_yyfree((void *) b ,yyscanner ); } -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a cmFortran_yyrestart() or at EOF. @@ -1925,7 +1943,7 @@ void cmFortran_yypop_buffer_state (yyscan_t yyscanner) */ static void cmFortran_yyensure_buffer_stack (yyscan_t yyscanner) { - int num_to_alloc; + yy_size_t num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!yyg->yy_buffer_stack) { @@ -2023,12 +2041,12 @@ YY_BUFFER_STATE cmFortran_yy_scan_string (yyconst char * yystr , yyscan_t yyscan * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; yy_size_t n; - int i; + yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -2138,7 +2156,7 @@ FILE *cmFortran_yyget_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -int cmFortran_yyget_leng (yyscan_t yyscanner) +yy_size_t cmFortran_yyget_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; @@ -2174,7 +2192,7 @@ void cmFortran_yyset_lineno (int line_number , yyscan_t yyscanner) /* lineno is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "cmFortran_yyset_lineno called with no buffer" , yyscanner); + YY_FATAL_ERROR( "cmFortran_yyset_lineno called with no buffer" ); yylineno = line_number; } @@ -2189,7 +2207,7 @@ void cmFortran_yyset_column (int column_no , yyscan_t yyscanner) /* column is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "cmFortran_yyset_column called with no buffer" , yyscanner); + YY_FATAL_ERROR( "cmFortran_yyset_column called with no buffer" ); yycolumn = column_no; } @@ -2400,7 +2418,7 @@ void cmFortran_yyfree (void * ptr , yyscan_t) #define YYTABLES_NAME "yytables" -#line 181 "cmFortranLexer.in.l" +#line 182 "cmFortranLexer.in.l" diff --git a/Source/cmFortranLexer.h b/Source/cmFortranLexer.h index c67e332..b9ff0dc 100644 --- a/Source/cmFortranLexer.h +++ b/Source/cmFortranLexer.h @@ -1,6 +1,6 @@ /*============================================================================ CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. @@ -20,7 +20,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_SUBMINOR_VERSION 39 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -177,7 +177,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - int yy_n_chars; + yy_size_t yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -221,7 +221,7 @@ void cmFortran_yypop_buffer_state (yyscan_t yyscanner ); YY_BUFFER_STATE cmFortran_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE cmFortran_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); void *cmFortran_yyalloc (yy_size_t ,yyscan_t yyscanner ); void *cmFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); @@ -229,7 +229,7 @@ void cmFortran_yyfree (void * ,yyscan_t yyscanner ); /* Begin user sect3 */ -#define cmFortran_yywrap(n) 1 +#define cmFortran_yywrap(yyscanner) 1 #define YY_SKIP_YYWRAP #define yytext_ptr yytext_r @@ -272,7 +272,7 @@ FILE *cmFortran_yyget_out (yyscan_t yyscanner ); void cmFortran_yyset_out (FILE * out_str ,yyscan_t yyscanner ); -int cmFortran_yyget_leng (yyscan_t yyscanner ); +yy_size_t cmFortran_yyget_leng (yyscan_t yyscanner ); char *cmFortran_yyget_text (yyscan_t yyscanner ); @@ -280,6 +280,10 @@ int cmFortran_yyget_lineno (yyscan_t yyscanner ); void cmFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); +int cmFortran_yyget_column (yyscan_t yyscanner ); + +void cmFortran_yyset_column (int column_no ,yyscan_t yyscanner ); + /* Macros after this point can all be overridden by user definitions in * section 1. */ diff --git a/Source/cmFortranLexer.in.l b/Source/cmFortranLexer.in.l index 03fa90c..53984bb 100644 --- a/Source/cmFortranLexer.in.l +++ b/Source/cmFortranLexer.in.l @@ -1,7 +1,7 @@ %{ /*============================================================================ CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. @@ -116,6 +116,7 @@ Modify cmFortranLexer.h: !.*\n { return EOSTMT; } /* Treat comments like */ <fixed_fmt>^[cC*dD].*\n { return EOSTMT; } /* empty lines */ +^[ \t]*#([ \t]*line)?[ \t]*[0-9]+[ \t]* { return CPP_LINE_DIRECTIVE; } ^[ \t]*#[ \t]*include[ \t]*<[^>]+> { yytext[yyleng-1] = 0; yylvalp->string = strdup(strchr(yytext, '<')+1); diff --git a/Source/cmFortranParser.cxx b/Source/cmFortranParser.cxx index 0230f02..21a6443 100644 --- a/Source/cmFortranParser.cxx +++ b/Source/cmFortranParser.cxx @@ -72,7 +72,7 @@ /*============================================================================ CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. @@ -177,64 +177,66 @@ extern int cmFortran_yydebug; EOSTMT = 258, ASSIGNMENT_OP = 259, GARBAGE = 260, - CPP_INCLUDE = 261, - F90PPR_INCLUDE = 262, - COCO_INCLUDE = 263, - F90PPR_DEFINE = 264, - CPP_DEFINE = 265, - F90PPR_UNDEF = 266, - CPP_UNDEF = 267, - CPP_IFDEF = 268, - CPP_IFNDEF = 269, - CPP_IF = 270, - CPP_ELSE = 271, - CPP_ELIF = 272, - CPP_ENDIF = 273, - F90PPR_IFDEF = 274, - F90PPR_IFNDEF = 275, - F90PPR_IF = 276, - F90PPR_ELSE = 277, - F90PPR_ELIF = 278, - F90PPR_ENDIF = 279, - COMMA = 280, - DCOLON = 281, - CPP_TOENDL = 282, - UNTERMINATED_STRING = 283, - STRING = 284, - WORD = 285, - CPP_INCLUDE_ANGLE = 286 + CPP_LINE_DIRECTIVE = 261, + CPP_INCLUDE = 262, + F90PPR_INCLUDE = 263, + COCO_INCLUDE = 264, + F90PPR_DEFINE = 265, + CPP_DEFINE = 266, + F90PPR_UNDEF = 267, + CPP_UNDEF = 268, + CPP_IFDEF = 269, + CPP_IFNDEF = 270, + CPP_IF = 271, + CPP_ELSE = 272, + CPP_ELIF = 273, + CPP_ENDIF = 274, + F90PPR_IFDEF = 275, + F90PPR_IFNDEF = 276, + F90PPR_IF = 277, + F90PPR_ELSE = 278, + F90PPR_ELIF = 279, + F90PPR_ENDIF = 280, + COMMA = 281, + DCOLON = 282, + CPP_TOENDL = 283, + UNTERMINATED_STRING = 284, + STRING = 285, + WORD = 286, + CPP_INCLUDE_ANGLE = 287 }; #endif /* Tokens. */ #define EOSTMT 258 #define ASSIGNMENT_OP 259 #define GARBAGE 260 -#define CPP_INCLUDE 261 -#define F90PPR_INCLUDE 262 -#define COCO_INCLUDE 263 -#define F90PPR_DEFINE 264 -#define CPP_DEFINE 265 -#define F90PPR_UNDEF 266 -#define CPP_UNDEF 267 -#define CPP_IFDEF 268 -#define CPP_IFNDEF 269 -#define CPP_IF 270 -#define CPP_ELSE 271 -#define CPP_ELIF 272 -#define CPP_ENDIF 273 -#define F90PPR_IFDEF 274 -#define F90PPR_IFNDEF 275 -#define F90PPR_IF 276 -#define F90PPR_ELSE 277 -#define F90PPR_ELIF 278 -#define F90PPR_ENDIF 279 -#define COMMA 280 -#define DCOLON 281 -#define CPP_TOENDL 282 -#define UNTERMINATED_STRING 283 -#define STRING 284 -#define WORD 285 -#define CPP_INCLUDE_ANGLE 286 +#define CPP_LINE_DIRECTIVE 261 +#define CPP_INCLUDE 262 +#define F90PPR_INCLUDE 263 +#define COCO_INCLUDE 264 +#define F90PPR_DEFINE 265 +#define CPP_DEFINE 266 +#define F90PPR_UNDEF 267 +#define CPP_UNDEF 268 +#define CPP_IFDEF 269 +#define CPP_IFNDEF 270 +#define CPP_IF 271 +#define CPP_ELSE 272 +#define CPP_ELIF 273 +#define CPP_ENDIF 274 +#define F90PPR_IFDEF 275 +#define F90PPR_IFNDEF 276 +#define F90PPR_IF 277 +#define F90PPR_ELSE 278 +#define F90PPR_ELIF 279 +#define F90PPR_ENDIF 280 +#define COMMA 281 +#define DCOLON 282 +#define CPP_TOENDL 283 +#define UNTERMINATED_STRING 284 +#define STRING 285 +#define WORD 286 +#define CPP_INCLUDE_ANGLE 287 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED @@ -245,7 +247,7 @@ union YYSTYPE char* string; -#line 249 "cmFortranParser.cxx" /* yacc.c:355 */ +#line 251 "cmFortranParser.cxx" /* yacc.c:355 */ }; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 @@ -259,7 +261,7 @@ int cmFortran_yyparse (yyscan_t yyscanner); /* Copy the second part of user declarations. */ -#line 263 "cmFortranParser.cxx" /* yacc.c:358 */ +#line 265 "cmFortranParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -501,21 +503,21 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 276 +#define YYLAST 290 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 32 +#define YYNTOKENS 33 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 16 /* YYNRULES -- Number of rules. */ -#define YYNRULES 53 +#define YYNRULES 54 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 97 +#define YYNSTATES 101 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 286 +#define YYMAXUTOK 287 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -552,19 +554,19 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31 + 25, 26, 27, 28, 29, 30, 31, 32 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 103, 103, 103, 105, 105, 107, 113, 123, 153, - 164, 177, 188, 195, 202, 208, 214, 220, 226, 231, - 236, 241, 246, 250, 251, 252, 257, 257, 257, 258, - 258, 259, 259, 260, 260, 261, 261, 262, 262, 263, - 263, 264, 264, 265, 265, 266, 266, 269, 270, 271, - 272, 273, 274, 275 + 0, 104, 104, 104, 106, 106, 108, 114, 124, 154, + 165, 178, 189, 196, 203, 210, 216, 222, 228, 234, + 239, 244, 249, 254, 258, 259, 260, 265, 265, 265, + 266, 266, 267, 267, 268, 268, 269, 269, 270, 270, + 271, 271, 272, 272, 273, 273, 274, 274, 277, 278, + 279, 280, 281, 282, 283 }; #endif @@ -574,14 +576,15 @@ static const yytype_uint16 yyrline[] = static const char *const yytname[] = { "$end", "error", "$undefined", "EOSTMT", "ASSIGNMENT_OP", "GARBAGE", - "CPP_INCLUDE", "F90PPR_INCLUDE", "COCO_INCLUDE", "F90PPR_DEFINE", - "CPP_DEFINE", "F90PPR_UNDEF", "CPP_UNDEF", "CPP_IFDEF", "CPP_IFNDEF", - "CPP_IF", "CPP_ELSE", "CPP_ELIF", "CPP_ENDIF", "F90PPR_IFDEF", - "F90PPR_IFNDEF", "F90PPR_IF", "F90PPR_ELSE", "F90PPR_ELIF", - "F90PPR_ENDIF", "COMMA", "DCOLON", "CPP_TOENDL", "UNTERMINATED_STRING", - "STRING", "WORD", "CPP_INCLUDE_ANGLE", "$accept", "code", "stmt", - "assignment_stmt", "keyword_stmt", "include", "define", "undef", "ifdef", - "ifndef", "if", "elif", "else", "endif", "other", "misc_code", YY_NULLPTR + "CPP_LINE_DIRECTIVE", "CPP_INCLUDE", "F90PPR_INCLUDE", "COCO_INCLUDE", + "F90PPR_DEFINE", "CPP_DEFINE", "F90PPR_UNDEF", "CPP_UNDEF", "CPP_IFDEF", + "CPP_IFNDEF", "CPP_IF", "CPP_ELSE", "CPP_ELIF", "CPP_ENDIF", + "F90PPR_IFDEF", "F90PPR_IFNDEF", "F90PPR_IF", "F90PPR_ELSE", + "F90PPR_ELIF", "F90PPR_ENDIF", "COMMA", "DCOLON", "CPP_TOENDL", + "UNTERMINATED_STRING", "STRING", "WORD", "CPP_INCLUDE_ANGLE", "$accept", + "code", "stmt", "assignment_stmt", "keyword_stmt", "include", "define", + "undef", "ifdef", "ifndef", "if", "elif", "else", "endif", "other", + "misc_code", YY_NULLPTR }; #endif @@ -593,14 +596,14 @@ static const yytype_uint16 yytoknum[] = 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286 + 285, 286, 287 }; # endif -#define YYPACT_NINF -29 +#define YYPACT_NINF -30 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-29))) + (!!((Yystate) == (-30))) #define YYTABLE_NINF -1 @@ -611,16 +614,17 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - -29, 39, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, 246, -29, -29, -29, -29, - -28, -27, -22, -17, -16, -29, -29, -29, -29, 2, - -29, -29, -29, -13, -12, -29, -29, 61, -29, -29, - -29, -29, -29, 68, 74, 80, 108, -29, -29, -29, - -29, -29, -29, -29, -29, -29, 114, 120, -24, -29, - 126, 154, -29, 160, 166, 172, 200, 206, -29, -29, - -29, -29, -29, -29, -9, 212, -29, -29, -29, -29, - -29, -29, -29, -29, -29, 218, -29 + -30, 41, -30, -30, -30, -30, -29, -30, -30, -30, + -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, + -30, -30, -30, -30, -30, -30, 259, -30, -30, -30, + -30, -28, -23, -18, -16, -13, -30, -30, -30, -30, + 2, -30, -30, -30, -30, -12, -9, -30, -30, 64, + -30, -30, -30, -30, -30, 71, 77, 83, 112, -30, + -30, -30, -30, -30, -30, -30, -30, -30, 118, 124, + 130, -24, -30, 159, 165, -30, 171, 177, 206, 212, + 218, -30, -30, -30, -30, -30, -30, -30, -1, 224, + -30, -30, -30, -30, -30, -30, -30, -30, -30, 253, + -30 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -628,30 +632,31 @@ static const yytype_int16 yypact[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 2, 0, 1, 25, 24, 45, 26, 27, 28, 30, - 29, 32, 31, 33, 35, 37, 41, 39, 43, 34, - 36, 38, 42, 40, 44, 0, 45, 3, 5, 4, - 0, 0, 0, 0, 0, 45, 45, 45, 45, 0, - 7, 45, 45, 0, 0, 45, 45, 0, 45, 45, - 45, 45, 45, 0, 0, 0, 0, 23, 50, 49, - 52, 51, 53, 48, 47, 46, 0, 0, 0, 45, - 0, 0, 12, 0, 0, 0, 0, 0, 18, 19, - 20, 21, 6, 22, 0, 0, 11, 8, 13, 14, - 15, 16, 17, 45, 9, 0, 10 + 2, 0, 1, 26, 25, 46, 0, 27, 28, 29, + 31, 30, 33, 32, 34, 36, 38, 42, 40, 44, + 35, 37, 39, 43, 41, 45, 0, 46, 3, 5, + 4, 0, 0, 0, 0, 0, 46, 46, 46, 46, + 0, 46, 7, 46, 46, 0, 0, 46, 46, 0, + 46, 46, 46, 46, 46, 0, 0, 0, 0, 24, + 51, 50, 53, 52, 54, 49, 48, 47, 0, 0, + 0, 0, 46, 0, 0, 13, 0, 0, 0, 0, + 0, 19, 20, 21, 22, 12, 6, 23, 0, 0, + 11, 8, 14, 15, 16, 17, 18, 46, 9, 0, + 10 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -26, -29 + -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, + -30, -30, -30, -30, -27, -30 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 1, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 65 + -1, 1, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 67 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -659,104 +664,109 @@ static const yytype_int8 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { - 47, 48, 84, 49, 0, 57, 58, 59, 50, 53, - 54, 55, 56, 51, 52, 66, 67, 68, 69, 70, - 71, 93, 73, 74, 75, 76, 77, 60, 61, 0, - 62, 63, 64, 0, 0, 0, 0, 0, 0, 2, - 3, 0, 4, 85, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 72, 58, 59, 95, 0, 25, - 26, 78, 58, 59, 0, 0, 0, 79, 58, 59, - 0, 0, 0, 80, 58, 59, 60, 61, 0, 62, - 63, 64, 0, 60, 61, 0, 62, 63, 64, 60, - 61, 0, 62, 63, 64, 60, 61, 0, 62, 63, - 64, 81, 58, 59, 0, 0, 0, 82, 58, 59, - 0, 0, 0, 83, 58, 59, 0, 0, 0, 86, - 58, 59, 0, 60, 61, 0, 62, 63, 64, 60, - 61, 0, 62, 63, 64, 60, 61, 0, 62, 63, - 64, 60, 61, 0, 62, 63, 64, 87, 58, 59, - 0, 0, 0, 88, 58, 59, 0, 0, 0, 89, - 58, 59, 0, 0, 0, 90, 58, 59, 0, 60, - 61, 0, 62, 63, 64, 60, 61, 0, 62, 63, - 64, 60, 61, 0, 62, 63, 64, 60, 61, 0, - 62, 63, 64, 91, 58, 59, 0, 0, 0, 92, - 58, 59, 0, 0, 0, 94, 58, 59, 0, 0, - 0, 96, 58, 59, 0, 60, 61, 0, 62, 63, - 64, 60, 61, 0, 62, 63, 64, 60, 61, 0, - 62, 63, 64, 60, 61, 0, 62, 63, 64, 40, - 41, 42, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 43, 44, 0, 0, 45, 46 + 49, 41, 50, 88, 0, 59, 60, 61, 51, 55, + 56, 57, 58, 52, 68, 53, 69, 70, 54, 71, + 73, 74, 72, 76, 77, 78, 79, 80, 62, 63, + 97, 64, 65, 66, 0, 0, 0, 0, 0, 0, + 0, 2, 3, 0, 4, 89, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 75, 60, 61, + 99, 0, 26, 27, 81, 60, 61, 0, 0, 0, + 82, 60, 61, 0, 0, 0, 83, 60, 61, 0, + 62, 63, 0, 64, 65, 66, 0, 62, 63, 0, + 64, 65, 66, 62, 63, 0, 64, 65, 66, 62, + 63, 0, 64, 65, 66, 84, 60, 61, 0, 0, + 0, 85, 60, 61, 0, 0, 0, 86, 60, 61, + 0, 0, 0, 87, 60, 61, 0, 0, 62, 63, + 0, 64, 65, 66, 62, 63, 0, 64, 65, 66, + 62, 63, 0, 64, 65, 66, 62, 63, 0, 64, + 65, 66, 90, 60, 61, 0, 0, 0, 91, 60, + 61, 0, 0, 0, 92, 60, 61, 0, 0, 0, + 93, 60, 61, 0, 0, 62, 63, 0, 64, 65, + 66, 62, 63, 0, 64, 65, 66, 62, 63, 0, + 64, 65, 66, 62, 63, 0, 64, 65, 66, 94, + 60, 61, 0, 0, 0, 95, 60, 61, 0, 0, + 0, 96, 60, 61, 0, 0, 0, 98, 60, 61, + 0, 0, 62, 63, 0, 64, 65, 66, 62, 63, + 0, 64, 65, 66, 62, 63, 0, 64, 65, 66, + 62, 63, 0, 64, 65, 66, 100, 60, 61, 0, + 0, 0, 42, 43, 44, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, + 63, 0, 64, 65, 66, 45, 46, 0, 0, 47, + 48 }; static const yytype_int8 yycheck[] = { - 26, 29, 26, 30, -1, 3, 4, 5, 30, 35, - 36, 37, 38, 30, 30, 41, 42, 30, 30, 45, - 46, 30, 48, 49, 50, 51, 52, 25, 26, -1, - 28, 29, 30, -1, -1, -1, -1, -1, -1, 0, - 1, -1, 3, 69, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 3, 4, 5, 93, -1, 30, - 31, 3, 4, 5, -1, -1, -1, 3, 4, 5, - -1, -1, -1, 3, 4, 5, 25, 26, -1, 28, - 29, 30, -1, 25, 26, -1, 28, 29, 30, 25, - 26, -1, 28, 29, 30, 25, 26, -1, 28, 29, - 30, 3, 4, 5, -1, -1, -1, 3, 4, 5, - -1, -1, -1, 3, 4, 5, -1, -1, -1, 3, - 4, 5, -1, 25, 26, -1, 28, 29, 30, 25, - 26, -1, 28, 29, 30, 25, 26, -1, 28, 29, - 30, 25, 26, -1, 28, 29, 30, 3, 4, 5, - -1, -1, -1, 3, 4, 5, -1, -1, -1, 3, - 4, 5, -1, -1, -1, 3, 4, 5, -1, 25, - 26, -1, 28, 29, 30, 25, 26, -1, 28, 29, - 30, 25, 26, -1, 28, 29, 30, 25, 26, -1, - 28, 29, 30, 3, 4, 5, -1, -1, -1, 3, + 27, 30, 30, 27, -1, 3, 4, 5, 31, 36, + 37, 38, 39, 31, 41, 31, 43, 44, 31, 31, + 47, 48, 31, 50, 51, 52, 53, 54, 26, 27, + 31, 29, 30, 31, -1, -1, -1, -1, -1, -1, + -1, 0, 1, -1, 3, 72, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 3, 4, 5, + 97, -1, 31, 32, 3, 4, 5, -1, -1, -1, + 3, 4, 5, -1, -1, -1, 3, 4, 5, -1, + 26, 27, -1, 29, 30, 31, -1, 26, 27, -1, + 29, 30, 31, 26, 27, -1, 29, 30, 31, 26, + 27, -1, 29, 30, 31, 3, 4, 5, -1, -1, + -1, 3, 4, 5, -1, -1, -1, 3, 4, 5, + -1, -1, -1, 3, 4, 5, -1, -1, 26, 27, + -1, 29, 30, 31, 26, 27, -1, 29, 30, 31, + 26, 27, -1, 29, 30, 31, 26, 27, -1, 29, + 30, 31, 3, 4, 5, -1, -1, -1, 3, 4, + 5, -1, -1, -1, 3, 4, 5, -1, -1, -1, + 3, 4, 5, -1, -1, 26, 27, -1, 29, 30, + 31, 26, 27, -1, 29, 30, 31, 26, 27, -1, + 29, 30, 31, 26, 27, -1, 29, 30, 31, 3, 4, 5, -1, -1, -1, 3, 4, 5, -1, -1, - -1, 3, 4, 5, -1, 25, 26, -1, 28, 29, - 30, 25, 26, -1, 28, 29, 30, 25, 26, -1, - 28, 29, 30, 25, 26, -1, 28, 29, 30, 3, - 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 25, 26, -1, -1, 29, 30 + -1, 3, 4, 5, -1, -1, -1, 3, 4, 5, + -1, -1, 26, 27, -1, 29, 30, 31, 26, 27, + -1, 29, 30, 31, 26, 27, -1, 29, 30, 31, + 26, 27, -1, 29, 30, 31, 3, 4, 5, -1, + -1, -1, 3, 4, 5, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 26, + 27, -1, 29, 30, 31, 26, 27, -1, -1, 30, + 31 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 33, 0, 1, 3, 5, 6, 7, 8, 9, + 0, 34, 0, 1, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 30, 31, 34, 35, 36, + 20, 21, 22, 23, 24, 25, 31, 32, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 3, 4, 5, 25, 26, 29, 30, 46, 29, 30, - 30, 30, 30, 46, 46, 46, 46, 3, 4, 5, - 25, 26, 28, 29, 30, 47, 46, 46, 30, 30, - 46, 46, 3, 46, 46, 46, 46, 46, 3, 3, - 3, 3, 3, 3, 26, 46, 3, 3, 3, 3, - 3, 3, 3, 30, 3, 46, 3 + 47, 30, 3, 4, 5, 26, 27, 30, 31, 47, + 30, 31, 31, 31, 31, 47, 47, 47, 47, 3, + 4, 5, 26, 27, 29, 30, 31, 48, 47, 47, + 47, 31, 31, 47, 47, 3, 47, 47, 47, 47, + 47, 3, 3, 3, 3, 3, 3, 3, 27, 47, + 3, 3, 3, 3, 3, 3, 3, 31, 3, 47, + 3 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 32, 33, 33, 34, 34, 35, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 37, 37, 37, 38, - 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, - 43, 44, 44, 45, 45, 46, 46, 47, 47, 47, - 47, 47, 47, 47 + 0, 33, 34, 34, 35, 35, 36, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 38, 38, 38, + 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, + 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, + 48, 48, 48, 48, 48 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 2, 1, 1, 4, 2, 4, 5, - 7, 4, 3, 4, 4, 4, 4, 4, 3, 3, - 3, 3, 4, 3, 1, 1, 1, 1, 1, 1, + 7, 4, 4, 3, 4, 4, 4, 4, 4, 3, + 3, 3, 3, 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, - 1, 1, 1, 1 + 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, + 1, 1, 1, 1, 1 }; @@ -1439,15 +1449,15 @@ yyreduce: switch (yyn) { case 6: -#line 108 "cmFortranParser.y" /* yacc.c:1646 */ +#line 109 "cmFortranParser.y" /* yacc.c:1646 */ { free((yyvsp[-3].string)); } -#line 1447 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1457 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 114 "cmFortranParser.y" /* yacc.c:1646 */ +#line 115 "cmFortranParser.y" /* yacc.c:1646 */ { if (cmFortranParserIsKeyword((yyvsp[-1].string), "interface")) { @@ -1457,11 +1467,11 @@ yyreduce: } free((yyvsp[-1].string)); } -#line 1461 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1471 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 8: -#line 124 "cmFortranParser.y" /* yacc.c:1646 */ +#line 125 "cmFortranParser.y" /* yacc.c:1646 */ { if (cmFortranParserIsKeyword((yyvsp[-3].string), "use")) { @@ -1491,11 +1501,11 @@ yyreduce: free((yyvsp[-3].string)); free((yyvsp[-2].string)); } -#line 1495 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1505 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 9: -#line 154 "cmFortranParser.y" /* yacc.c:1646 */ +#line 155 "cmFortranParser.y" /* yacc.c:1646 */ { if (cmFortranParserIsKeyword((yyvsp[-4].string), "use")) { @@ -1506,11 +1516,11 @@ yyreduce: free((yyvsp[-4].string)); free((yyvsp[-2].string)); } -#line 1510 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1520 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 10: -#line 165 "cmFortranParser.y" /* yacc.c:1646 */ +#line 166 "cmFortranParser.y" /* yacc.c:1646 */ { if (cmFortranParserIsKeyword((yyvsp[-6].string), "use") && cmFortranParserIsKeyword((yyvsp[-4].string), "non_intrinsic") ) @@ -1523,11 +1533,11 @@ yyreduce: free((yyvsp[-4].string)); free((yyvsp[-2].string)); } -#line 1527 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1537 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 11: -#line 178 "cmFortranParser.y" /* yacc.c:1646 */ +#line 179 "cmFortranParser.y" /* yacc.c:1646 */ { if (cmFortranParserIsKeyword((yyvsp[-3].string), "include")) { @@ -1538,129 +1548,140 @@ yyreduce: free((yyvsp[-3].string)); free((yyvsp[-2].string)); } -#line 1542 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1552 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 12: -#line 189 "cmFortranParser.y" /* yacc.c:1646 */ +#line 190 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); + cmFortranParser_RuleLineDirective(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1553 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1563 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 13: -#line 196 "cmFortranParser.y" /* yacc.c:1646 */ +#line 197 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1564 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1574 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 14: -#line 203 "cmFortranParser.y" /* yacc.c:1646 */ +#line 204 "cmFortranParser.y" /* yacc.c:1646 */ + { + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); + free((yyvsp[-2].string)); + } +#line 1585 "cmFortranParser.cxx" /* yacc.c:1646 */ + break; + + case 15: +#line 211 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleDefine(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1574 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1595 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 15: -#line 209 "cmFortranParser.y" /* yacc.c:1646 */ + case 16: +#line 217 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUndef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1584 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1605 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 16: -#line 215 "cmFortranParser.y" /* yacc.c:1646 */ + case 17: +#line 223 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIfdef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1594 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1615 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 17: -#line 221 "cmFortranParser.y" /* yacc.c:1646 */ + case 18: +#line 229 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIfndef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1604 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1625 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 18: -#line 227 "cmFortranParser.y" /* yacc.c:1646 */ + case 19: +#line 235 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIf(parser); } -#line 1613 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1634 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 19: -#line 232 "cmFortranParser.y" /* yacc.c:1646 */ + case 20: +#line 240 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElif(parser); } -#line 1622 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1643 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 20: -#line 237 "cmFortranParser.y" /* yacc.c:1646 */ + case 21: +#line 245 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElse(parser); } -#line 1631 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1652 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 21: -#line 242 "cmFortranParser.y" /* yacc.c:1646 */ + case 22: +#line 250 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleEndif(parser); } -#line 1640 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1661 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 22: -#line 247 "cmFortranParser.y" /* yacc.c:1646 */ + case 23: +#line 255 "cmFortranParser.y" /* yacc.c:1646 */ { free((yyvsp[-3].string)); } -#line 1648 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1669 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 47: -#line 269 "cmFortranParser.y" /* yacc.c:1646 */ + case 48: +#line 277 "cmFortranParser.y" /* yacc.c:1646 */ { free ((yyvsp[0].string)); } -#line 1654 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1675 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 48: -#line 270 "cmFortranParser.y" /* yacc.c:1646 */ + case 49: +#line 278 "cmFortranParser.y" /* yacc.c:1646 */ { free ((yyvsp[0].string)); } -#line 1660 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1681 "cmFortranParser.cxx" /* yacc.c:1646 */ break; -#line 1664 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1685 "cmFortranParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1890,6 +1911,6 @@ yyreturn: #endif return yyresult; } -#line 278 "cmFortranParser.y" /* yacc.c:1906 */ +#line 286 "cmFortranParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h index 156c38a..cdaf46b 100644 --- a/Source/cmFortranParser.h +++ b/Source/cmFortranParser.h @@ -55,6 +55,8 @@ void cmFortranParser_Error(cmFortranParser* parser, const char* message); void cmFortranParser_RuleUse(cmFortranParser* parser, const char* name); +void cmFortranParser_RuleLineDirective(cmFortranParser* parser, + const char* filename); void cmFortranParser_RuleInclude(cmFortranParser* parser, const char* name); void cmFortranParser_RuleModule(cmFortranParser* parser, diff --git a/Source/cmFortranParser.y b/Source/cmFortranParser.y index 996bef6..83f441a 100644 --- a/Source/cmFortranParser.y +++ b/Source/cmFortranParser.y @@ -1,7 +1,7 @@ %{ /*============================================================================ CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. @@ -85,6 +85,7 @@ static bool cmFortranParserIsKeyword(const char* word, /*-------------------------------------------------------------------------*/ /* Tokens */ %token EOSTMT ASSIGNMENT_OP GARBAGE +%token CPP_LINE_DIRECTIVE %token CPP_INCLUDE F90PPR_INCLUDE COCO_INCLUDE %token F90PPR_DEFINE CPP_DEFINE F90PPR_UNDEF CPP_UNDEF %token CPP_IFDEF CPP_IFNDEF CPP_IF CPP_ELSE CPP_ELIF CPP_ENDIF @@ -185,6 +186,13 @@ keyword_stmt: free($1); free($2); } +| CPP_LINE_DIRECTIVE STRING other EOSTMT + { + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleLineDirective(parser, $2); + free($2); + } | CPP_INCLUDE_ANGLE other EOSTMT { cmFortranParser* parser = diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx index a09c5459..c175e62 100644 --- a/Source/cmFortranParserImpl.cxx +++ b/Source/cmFortranParserImpl.cxx @@ -210,6 +210,32 @@ void cmFortranParser_RuleUse(cmFortranParser* parser, } //---------------------------------------------------------------------------- +void cmFortranParser_RuleLineDirective(cmFortranParser* parser, + const char* filename) +{ + // This is a #line directive naming a file encountered during preprocessing. + std::string included = filename; + + // Skip #line directives referencing non-files like + // "<built-in>" or "<command-line>". + if (included.empty() || included[0] == '<') + { + return; + } + + // Fix windows file path separators since our lexer does not + // process escape sequences in string literals. + cmSystemTools::ReplaceString(included, "\\\\", "\\"); + cmSystemTools::ConvertToUnixSlashes(included); + + // Save the named file as included in the source. + if (cmSystemTools::FileExists(included)) + { + parser->Info.Includes.insert(included); + } +} + +//---------------------------------------------------------------------------- void cmFortranParser_RuleInclude(cmFortranParser* parser, const char* name) { diff --git a/Source/cmFortranParserTokens.h b/Source/cmFortranParserTokens.h index df1aec3..ac49840 100644 --- a/Source/cmFortranParserTokens.h +++ b/Source/cmFortranParserTokens.h @@ -48,64 +48,66 @@ extern int cmFortran_yydebug; EOSTMT = 258, ASSIGNMENT_OP = 259, GARBAGE = 260, - CPP_INCLUDE = 261, - F90PPR_INCLUDE = 262, - COCO_INCLUDE = 263, - F90PPR_DEFINE = 264, - CPP_DEFINE = 265, - F90PPR_UNDEF = 266, - CPP_UNDEF = 267, - CPP_IFDEF = 268, - CPP_IFNDEF = 269, - CPP_IF = 270, - CPP_ELSE = 271, - CPP_ELIF = 272, - CPP_ENDIF = 273, - F90PPR_IFDEF = 274, - F90PPR_IFNDEF = 275, - F90PPR_IF = 276, - F90PPR_ELSE = 277, - F90PPR_ELIF = 278, - F90PPR_ENDIF = 279, - COMMA = 280, - DCOLON = 281, - CPP_TOENDL = 282, - UNTERMINATED_STRING = 283, - STRING = 284, - WORD = 285, - CPP_INCLUDE_ANGLE = 286 + CPP_LINE_DIRECTIVE = 261, + CPP_INCLUDE = 262, + F90PPR_INCLUDE = 263, + COCO_INCLUDE = 264, + F90PPR_DEFINE = 265, + CPP_DEFINE = 266, + F90PPR_UNDEF = 267, + CPP_UNDEF = 268, + CPP_IFDEF = 269, + CPP_IFNDEF = 270, + CPP_IF = 271, + CPP_ELSE = 272, + CPP_ELIF = 273, + CPP_ENDIF = 274, + F90PPR_IFDEF = 275, + F90PPR_IFNDEF = 276, + F90PPR_IF = 277, + F90PPR_ELSE = 278, + F90PPR_ELIF = 279, + F90PPR_ENDIF = 280, + COMMA = 281, + DCOLON = 282, + CPP_TOENDL = 283, + UNTERMINATED_STRING = 284, + STRING = 285, + WORD = 286, + CPP_INCLUDE_ANGLE = 287 }; #endif /* Tokens. */ #define EOSTMT 258 #define ASSIGNMENT_OP 259 #define GARBAGE 260 -#define CPP_INCLUDE 261 -#define F90PPR_INCLUDE 262 -#define COCO_INCLUDE 263 -#define F90PPR_DEFINE 264 -#define CPP_DEFINE 265 -#define F90PPR_UNDEF 266 -#define CPP_UNDEF 267 -#define CPP_IFDEF 268 -#define CPP_IFNDEF 269 -#define CPP_IF 270 -#define CPP_ELSE 271 -#define CPP_ELIF 272 -#define CPP_ENDIF 273 -#define F90PPR_IFDEF 274 -#define F90PPR_IFNDEF 275 -#define F90PPR_IF 276 -#define F90PPR_ELSE 277 -#define F90PPR_ELIF 278 -#define F90PPR_ENDIF 279 -#define COMMA 280 -#define DCOLON 281 -#define CPP_TOENDL 282 -#define UNTERMINATED_STRING 283 -#define STRING 284 -#define WORD 285 -#define CPP_INCLUDE_ANGLE 286 +#define CPP_LINE_DIRECTIVE 261 +#define CPP_INCLUDE 262 +#define F90PPR_INCLUDE 263 +#define COCO_INCLUDE 264 +#define F90PPR_DEFINE 265 +#define CPP_DEFINE 266 +#define F90PPR_UNDEF 267 +#define CPP_UNDEF 268 +#define CPP_IFDEF 269 +#define CPP_IFNDEF 270 +#define CPP_IF 271 +#define CPP_ELSE 272 +#define CPP_ELIF 273 +#define CPP_ENDIF 274 +#define F90PPR_IFDEF 275 +#define F90PPR_IFNDEF 276 +#define F90PPR_IF 277 +#define F90PPR_ELSE 278 +#define F90PPR_ELIF 279 +#define F90PPR_ENDIF 280 +#define COMMA 281 +#define DCOLON 282 +#define CPP_TOENDL 283 +#define UNTERMINATED_STRING 284 +#define STRING 285 +#define WORD 286 +#define CPP_INCLUDE_ANGLE 287 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED @@ -116,7 +118,7 @@ union YYSTYPE char* string; -#line 120 "cmFortranParserTokens.h" /* yacc.c:1909 */ +#line 122 "cmFortranParserTokens.h" /* yacc.c:1909 */ }; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 3d2db42..2126c71 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2274,6 +2274,12 @@ cmGlobalGenerator::FindTarget(const std::string& name, cmGeneratorTarget* cmGlobalGenerator::FindGeneratorTarget(const std::string& name) const { + std::map<std::string, std::string>::const_iterator ai = + this->AliasTargets.find(name); + if (ai != this->AliasTargets.end()) + { + return this->FindGeneratorTargetImpl(ai->second); + } if (cmGeneratorTarget* tgt = this->FindGeneratorTargetImpl(name)) { return tgt; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 8498e39..a8a307c 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -548,11 +548,11 @@ void cmGlobalNinjaGenerator::Generate() { // Check minimum Ninja version. if (cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, - CurrentNinjaVersion().c_str(), + this->NinjaVersion.c_str(), RequiredNinjaVersion().c_str())) { std::ostringstream msg; - msg << "The detected version of Ninja (" << this->CurrentNinjaVersion(); + msg << "The detected version of Ninja (" << this->NinjaVersion; msg << ") is less than the version of Ninja required by CMake ("; msg << this->RequiredNinjaVersion() << ")."; this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, msg.str()); @@ -585,6 +585,23 @@ void cmGlobalNinjaGenerator::Generate() this->CloseBuildFileStream(); } +void cmGlobalNinjaGenerator::FindMakeProgram(cmMakefile* mf) +{ + this->cmGlobalGenerator::FindMakeProgram(mf); + if (const char* ninjaCommand = mf->GetDefinition("CMAKE_MAKE_PROGRAM")) + { + this->NinjaCommand = ninjaCommand; + std::vector<std::string> command; + command.push_back(this->NinjaCommand); + command.push_back("--version"); + std::string version; + cmSystemTools::RunSingleCommand(command, + &version, 0, 0, 0, + cmSystemTools::OUTPUT_NONE); + this->NinjaVersion = cmSystemTools::TrimWhitespace(version); + } +} + void cmGlobalNinjaGenerator ::EnableLanguage(std::vector<std::string>const& langs, cmMakefile* mf, @@ -1260,28 +1277,16 @@ std::string cmGlobalNinjaGenerator::ninjaCmd() const { cmLocalGenerator* lgen = this->LocalGenerators[0]; if (lgen) { - return lgen->ConvertToOutputFormat( - lgen->GetMakefile()->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"), - cmLocalGenerator::SHELL); + return lgen->ConvertToOutputFormat(this->NinjaCommand, + cmLocalGenerator::SHELL); } return "ninja"; } -std::string cmGlobalNinjaGenerator::CurrentNinjaVersion() const -{ - std::string version; - std::string command = ninjaCmd() + " --version"; - cmSystemTools::RunSingleCommand(command.c_str(), - &version, 0, 0, 0, - cmSystemTools::OUTPUT_NONE); - - return cmSystemTools::TrimWhitespace(version); -} - bool cmGlobalNinjaGenerator::SupportsConsolePool() const { return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, - CurrentNinjaVersion().c_str(), + this->NinjaVersion.c_str(), RequiredNinjaVersionForConsolePool().c_str()) == false; } diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 7547f16..46bd588 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -305,7 +305,6 @@ public: virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; - std::string CurrentNinjaVersion() const; // Ninja generator uses 'deps' and 'msvc_deps_prefix' introduced in 1.3 static std::string RequiredNinjaVersion() { return "1.3"; } static std::string RequiredNinjaVersionForConsolePool() { return "1.5"; } @@ -320,7 +319,7 @@ protected: private: virtual std::string GetEditCacheCommand() const; - + virtual void FindMakeProgram(cmMakefile* mf); void OpenBuildFileStream(); void CloseBuildFileStream(); @@ -392,6 +391,9 @@ private: typedef std::map<std::string, cmGeneratorTarget*> TargetAliasMap; TargetAliasMap TargetAliases; + + std::string NinjaCommand; + std::string NinjaVersion; }; #endif // ! cmGlobalNinjaGenerator_h diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 6b06fce..15a83ee 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -27,6 +27,7 @@ static cmInstallTargetGenerator* CreateInstallTargetGenerator(cmTarget& target, { cmInstallGenerator::MessageLevel message = cmInstallGenerator::SelectMessageLevel(target.GetMakefile()); + target.SetHaveInstallRule(true); return new cmInstallTargetGenerator(target.GetName(), args.GetDestination().c_str(), impLib, args.GetPermissions().c_str(), @@ -753,12 +754,6 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) installsPublicHeader = installsPublicHeader || publicHeaderGenerator != 0; installsResource = installsResource || resourceGenerator; - if (installsArchive || installsRuntime || installsFramework - || installsLibrary || installsBundle) - { - target.SetHaveInstallRule(true); - } - this->Makefile->AddInstallGenerator(archiveGenerator); this->Makefile->AddInstallGenerator(libraryGenerator); this->Makefile->AddInstallGenerator(runtimeGenerator); diff --git a/Tests/AliasTarget/CMakeLists.txt b/Tests/AliasTarget/CMakeLists.txt index c50b4e6..e1d8966 100644 --- a/Tests/AliasTarget/CMakeLists.txt +++ b/Tests/AliasTarget/CMakeLists.txt @@ -37,7 +37,9 @@ target_include_directories(bat PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") add_executable(targetgenerator targetgenerator.cpp) add_executable(Generator::Target ALIAS targetgenerator) -add_custom_target(usealias Generator::Target) +add_subdirectory(subdir) + +add_custom_target(usealias Generator::Target $<TARGET_FILE:Sub::tgt>) add_dependencies(bat usealias) if (NOT TARGET Another::Alias) diff --git a/Tests/AliasTarget/subdir/CMakeLists.txt b/Tests/AliasTarget/subdir/CMakeLists.txt new file mode 100644 index 0000000..8c84aea --- /dev/null +++ b/Tests/AliasTarget/subdir/CMakeLists.txt @@ -0,0 +1,3 @@ + +add_library(tgt STATIC empty.cpp) +add_library(Sub::tgt ALIAS tgt) diff --git a/Tests/AliasTarget/subdir/empty.cpp b/Tests/AliasTarget/subdir/empty.cpp new file mode 100644 index 0000000..b19427a --- /dev/null +++ b/Tests/AliasTarget/subdir/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int main(void) +{ + return 0; +} diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index e13dc79..f381758 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1033,6 +1033,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(DEB_CONFIGURATIONS_TO_TEST "components-lintian-dpkgdeb-checks" "components-description1" "components-description2" + "components-source" "components-shlibdeps1" "components-depend1" "components-depend2" diff --git a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-source.cmake.in b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-source.cmake.in new file mode 100644 index 0000000..352f10b --- /dev/null +++ b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-source.cmake.in @@ -0,0 +1,33 @@ +# +# Activate component packaging +# + +if(CPACK_GENERATOR MATCHES "DEB") + set(CPACK_DEB_COMPONENT_INSTALL "ON") +endif() + +# +# Choose grouping way +# +set(CPACK_COMPONENTS_IGNORE_GROUPS 1) + +# setting dependencies +set(CPACK_DEBIAN_PACKAGE_DEPENDS "depend-default") +set(CPACK_DEBIAN_HEADERS_PACKAGE_DEPENDS "depend-headers") + +# this time we set shlibdeps to on +set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) +set(CPACK_DEBIAN_HEADERS_PACKAGE_SHLIBDEPS OFF) +set(CPACK_DEBIAN_LIBRARIES_PACKAGE_SHLIBDEPS OFF) + +# we also set the dependencies of APPLICATION component to empty, and let +# shlibdeps do the job for this component. Otherwise the default will +# override +set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_DEPENDS "") + +# this sets the generated packages source to the desired one, in case +# several packages are generated from a unique source (the case with +# multicomponents packaging). + +set(CPACK_DEBIAN_PACKAGE_SOURCE "test-source") +set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_SOURCE "test-other-source") diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake new file mode 100644 index 0000000..51fa3ad --- /dev/null +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake @@ -0,0 +1,75 @@ +if(NOT CPackComponentsDEB_SOURCE_DIR) + message(FATAL_ERROR "CPackComponentsDEB_SOURCE_DIR not set") +endif() + +include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake) + + +# expected results +set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/MyLib-*.deb") +set(expected_count 3) + +set(config_verbose -V) +set(actual_output) +run_cpack(actual_output + CPack_output + CPack_error + EXPECTED_FILE_MASK "${expected_file_mask}" + CONFIG_ARGS ${config_args} + CONFIG_VERBOSE ${config_verbose}) + + +if(NOT actual_output) + message(STATUS "expected_count='${expected_count}'") + message(STATUS "expected_file_mask='${expected_file_mask}'") + message(STATUS "actual_output_files='${actual_output}'") + message(FATAL_ERROR "error: expected_files do not exist: CPackComponentsDEB test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error}") +endif() + +list(LENGTH actual_output actual_count) +if(NOT actual_count EQUAL expected_count) + message(STATUS "actual_count='${actual_count}'") + message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error})") +endif() + + +# dpkg-deb checks for the summary of the packages +find_program(DPKGDEB_EXECUTABLE dpkg-deb) +if(DPKGDEB_EXECUTABLE) + set(dpkgdeb_output_errors_all "") + foreach(_f IN LISTS actual_output) + + # extracts the metadata from the package + run_dpkgdeb(dpkg_output + FILENAME "${_f}" + ) + + dpkgdeb_return_specific_metaentry(dpkg_package_name + DPKGDEB_OUTPUT "${dpkg_output}" + METAENTRY "Package:") + + dpkgdeb_return_specific_metaentry(dpkg_package_source + DPKGDEB_OUTPUT "${dpkg_output}" + METAENTRY "Source:") + + message(STATUS "package='${_f}', source='${dpkg_package_source}'") + + if(NOT ("${dpkg_package_name}" STREQUAL "mylib-applications")) + if(NOT ("${dpkg_package_source}" STREQUAL "test-source")) + set(dpkgdeb_output_errors_all "${dpkgdeb_output_errors_all}" + "dpkg-deb: ${_f}: Incorrect source for package '${dpkg_package_name}': '${dpkg_package_source}' instead of 'test-source'\n") + endif() + else() + if(NOT ("${dpkg_package_source}" STREQUAL "test-other-source")) + set(dpkgdeb_output_errors_all "${dpkgdeb_output_errors_all}" + "dpkg-deb: ${_f}: Incorrect source for package '${dpkg_package_name}': '${dpkg_package_source}' instead of 'test-other-source'\n") + endif() + endif() + endforeach() + + if(NOT "${dpkgdeb_output_errors_all}" STREQUAL "") + message(FATAL_ERROR "dpkg-deb checks failed:\n${dpkgdeb_output_errors_all}") + endif() +else() + message("dpkg-deb executable not found - skipping dpkg-deb test") +endif() |