diff options
Diffstat (limited to 'Source')
45 files changed, 2207 insertions, 1981 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index d5fe7d1..92fee8a 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -88,7 +88,7 @@ option(CMAKE_REGENERATE_YACCLEX "Regenerate YACC and LEXX files" OFF) mark_as_advanced(CMAKE_REGENERATE_YACCLEX) if(CMAKE_REGENERATE_YACCLEX) - set(parsersLexers cmDependsFortran cmCommandArgument cmExpr) + set(parsersLexers cmFortran cmCommandArgument cmExpr) find_program(YACC_EXECUTABLE NAMES yacc bison PATHS /usr/bin @@ -193,9 +193,6 @@ set(SRCS cmDependsC.h cmDependsFortran.cxx cmDependsFortran.h - cmDependsFortranLexer.cxx - cmDependsFortranParser.cxx - cmDependsFortranParser.h cmDependsJava.cxx cmDependsJava.h cmDependsJavaLexer.cxx @@ -243,6 +240,11 @@ set(SRCS cmFileLockResult.h cmFileTimeComparison.cxx cmFileTimeComparison.h + cmFortranLexer.cxx + cmFortranLexer.h + cmFortranParser.cxx + cmFortranParser.h + cmFortranParserImpl.cxx cmGeneratedFileStream.cxx cmGeneratorExpressionContext.cxx cmGeneratorExpressionContext.h diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 59656b8..612ab7e 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 3) -set(CMake_VERSION_PATCH 20150725) +set(CMake_VERSION_PATCH 20150728) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 5faf001..c8a0d27 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -176,7 +176,7 @@ bool cmCTestAddSubdirectoryCommand cmSystemTools::ChangeDirectory(cwd); std::string fname = cwd; fname += "/"; - fname += args[1]; + fname += args[0]; if ( !cmSystemTools::FileExists(fname.c_str()) ) { diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 038c411..ad6a7fb 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -36,17 +36,22 @@ if (Qt5Widgets_FOUND) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") - # We need to install Cocoa platform plugin and add qt.conf for Qt5 on Mac. + # We need to install platform plugin and add qt.conf for Qt5 on Mac and Windows. # FIXME: This should be part of Qt5 CMake scripts, but unfortunatelly - # Qt5 Mac support is missing there. - if(APPLE) + # Qt5 support is missing there. + if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32)) macro(install_qt5_plugin _qt_plugin_name _qt_plugins_var) get_target_property(_qt_plugin_path "${_qt_plugin_name}" LOCATION) if(EXISTS "${_qt_plugin_path}") get_filename_component(_qt_plugin_file "${_qt_plugin_path}" NAME) get_filename_component(_qt_plugin_type "${_qt_plugin_path}" PATH) get_filename_component(_qt_plugin_type "${_qt_plugin_type}" NAME) - set(_qt_plugin_dest "PlugIns/${_qt_plugin_type}") + if(APPLE) + set(_qt_plugin_dir "PlugIns") + elseif(WIN32) + set(_qt_plugin_dir "plugins") + endif() + set(_qt_plugin_dest "${_qt_plugin_dir}/${_qt_plugin_type}") install(FILES "${_qt_plugin_path}" DESTINATION "${_qt_plugin_dest}" ${COMPONENT}) @@ -56,12 +61,21 @@ if (Qt5Widgets_FOUND) message(FATAL_ERROR "QT plugin ${_qt_plugin_name} not found") endif() endmacro() - install_qt5_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS) - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" - "[Paths]\nPlugins = PlugIns\n") - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" - DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources" - ${COMPONENT}) + if(APPLE) + install_qt5_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" + "[Paths]\nPlugins = ${_qt_plugin_dir}\n") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" + DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources" + ${COMPONENT}) + elseif(WIN32) + install_qt5_plugin("Qt5::QWindowsIntegrationPlugin" QT_PLUGINS) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" + "[Paths]\nPlugins = ../${_qt_plugin_dir}\n") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" + DESTINATION bin + ${COMPONENT}) + endif() endif() if(WIN32 AND TARGET Qt5::Core) @@ -199,7 +213,7 @@ if(APPLE) " ${COMPONENT}) endif() -if(APPLE OR WIN32) +if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32)) # install rules for including 3rd party libs such as Qt # if a system Qt is used (e.g. installed in /usr/lib/), it will not be included in the installation set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/cmake-gui${CMAKE_EXECUTABLE_SUFFIX}") diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index f117475..bda933b 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -122,35 +122,6 @@ struct DefaultDeleter<Range, /* valueTypeIsPair = */ true> } }; -template<typename const_iterator_> -struct Range -{ - typedef const_iterator_ const_iterator; - typedef typename std::iterator_traits<const_iterator>::value_type value_type; - typedef typename std::iterator_traits<const_iterator>::difference_type - difference_type; - Range(const_iterator begin_, const_iterator end_) - : Begin(begin_), End(end_) {} - const_iterator begin() const { return Begin; } - const_iterator end() const { return End; } - bool empty() const { return std::distance(Begin, End) == 0; } - difference_type size() const { return std::distance(Begin, End); } - Range& advance(cmIML_INT_intptr_t amount) - { - std::advance(Begin, amount); - return *this; - } - - Range& retreat(cmIML_INT_intptr_t amount) - { - std::advance(End, -amount); - return *this; - } -private: - const_iterator Begin; - const_iterator End; -}; - template<typename FwdIt> FwdIt RemoveN(FwdIt i1, FwdIt i2, size_t n) { @@ -178,17 +149,52 @@ private: } +template<typename const_iterator_> +struct cmRange +{ + typedef const_iterator_ const_iterator; + typedef typename std::iterator_traits<const_iterator>::value_type value_type; + typedef typename std::iterator_traits<const_iterator>::difference_type + difference_type; + cmRange(const_iterator begin_, const_iterator end_) + : Begin(begin_), End(end_) {} + const_iterator begin() const { return Begin; } + const_iterator end() const { return End; } + bool empty() const { return std::distance(Begin, End) == 0; } + difference_type size() const { return std::distance(Begin, End); } + cmRange& advance(cmIML_INT_intptr_t amount) + { + std::advance(Begin, amount); + return *this; + } + + cmRange& retreat(cmIML_INT_intptr_t amount) + { + std::advance(End, -amount); + return *this; + } +private: + const_iterator Begin; + const_iterator End; +}; + +typedef cmRange<std::vector<std::string>::const_iterator> cmStringRange; + +class cmListFileBacktrace; +typedef +cmRange<std::vector<cmListFileBacktrace>::const_iterator> cmBacktraceRange; + template<typename Iter1, typename Iter2> -ContainerAlgorithms::Range<Iter1> cmRange(Iter1 begin, Iter2 end) +cmRange<Iter1> cmMakeRange(Iter1 begin, Iter2 end) { - return ContainerAlgorithms::Range<Iter1>(begin, end); + return cmRange<Iter1>(begin, end); } template<typename Range> -ContainerAlgorithms::Range<typename Range::const_iterator> -cmRange(Range const& range) +cmRange<typename Range::const_iterator> +cmMakeRange(Range const& range) { - return ContainerAlgorithms::Range<typename Range::const_iterator>( + return cmRange<typename Range::const_iterator>( range.begin(), range.end()); } @@ -350,11 +356,17 @@ typename Range::const_iterator cmFindNot(Range const& r, T const& t) } template<typename Range> -ContainerAlgorithms::Range<typename Range::const_reverse_iterator> +cmRange<typename Range::const_reverse_iterator> cmReverseRange(Range const& range) { - return ContainerAlgorithms::Range<typename Range::const_reverse_iterator>( + return cmRange<typename Range::const_reverse_iterator>( range.rbegin(), range.rend()); } +template <class Iter> +std::reverse_iterator<Iter> cmMakeReverseIterator(Iter it) +{ + return std::reverse_iterator<Iter>(it); +} + #endif diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index 3c878bf..3ef6d35 100644 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -93,6 +93,22 @@ bool cmCMakePolicyCommand::HandleSetMode(std::vector<std::string> const& args) this->SetError("SET failed to set policy."); return false; } + if(args[1] == "CMP0001" && + (status == cmPolicies::WARN || status == cmPolicies::OLD)) + { + if(!(this->Makefile->GetState() + ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))) + { + // Set it to 2.4 because that is the last version where the + // variable had meaning. + this->Makefile->AddCacheDefinition + ("CMAKE_BACKWARDS_COMPATIBILITY", "2.4", + "For backwards compatibility, what version of CMake " + "commands and " + "syntax should this version of CMake try to support.", + cmState::STRING); + } + } return true; } diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 61847d4..420bfdf 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -299,11 +299,11 @@ void cmConditionEvaluator::IncrementArguments(cmArgumentList &newArgs, cmArgumentList::iterator &argP1, cmArgumentList::iterator &argP2) const { - if (argP1 != newArgs.end()) + if (argP1 != newArgs.end()) { argP1++; argP2 = argP1; - if (argP1 != newArgs.end()) + if (argP1 != newArgs.end()) { argP2++; } @@ -442,35 +442,35 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList &newArgs, argP1 = arg; this->IncrementArguments(newArgs,argP1,argP2); // does a file exist - if (this->IsKeyword("EXISTS", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("EXISTS", *arg) && argP1 != newArgs.end()) { this->HandlePredicate( cmSystemTools::FileExists(argP1->c_str()), reducible, arg, newArgs, argP1, argP2); } // does a directory with this name exist - if (this->IsKeyword("IS_DIRECTORY", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("IS_DIRECTORY", *arg) && argP1 != newArgs.end()) { this->HandlePredicate( cmSystemTools::FileIsDirectory(argP1->c_str()), reducible, arg, newArgs, argP1, argP2); } // does a symlink with this name exist - if (this->IsKeyword("IS_SYMLINK", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("IS_SYMLINK", *arg) && argP1 != newArgs.end()) { this->HandlePredicate( cmSystemTools::FileIsSymlink(argP1->c_str()), reducible, arg, newArgs, argP1, argP2); } // is the given path an absolute path ? - if (this->IsKeyword("IS_ABSOLUTE", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("IS_ABSOLUTE", *arg) && argP1 != newArgs.end()) { this->HandlePredicate( cmSystemTools::FileIsFullPath(argP1->c_str()), reducible, arg, newArgs, argP1, argP2); } // does a command exist - if (this->IsKeyword("COMMAND", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("COMMAND", *arg) && argP1 != newArgs.end()) { cmCommand* command = this->Makefile.GetState()->GetCommand(argP1->c_str()); @@ -494,7 +494,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList &newArgs, reducible, arg, newArgs, argP1, argP2); } // is a variable defined - if (this->IsKeyword("DEFINED", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("DEFINED", *arg) && argP1 != newArgs.end()) { size_t argP1len = argP1->GetValue().size(); bool bdef = false; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 1b2586c..13c6409 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -16,84 +16,15 @@ #include "cmMakefile.h" #include "cmGeneratedFileStream.h" -#include "cmDependsFortranParser.h" /* Interface to parser object. */ +#include "cmFortranParser.h" /* Interface to parser object. */ #include <cmsys/FStream.hxx> #include <assert.h> -#include <stack> // TODO: Test compiler for the case of the mod file. Some always // use lower case and some always use upper case. I do not know if any // use the case from the source code. //---------------------------------------------------------------------------- -// Information about a single source file. -class cmDependsFortranSourceInfo -{ -public: - // The name of the source file. - std::string Source; - - // Set of provided and required modules. - std::set<std::string> Provides; - std::set<std::string> Requires; - - // Set of files included in the translation unit. - std::set<std::string> Includes; -}; - -//---------------------------------------------------------------------------- -// Parser methods not included in generated interface. - -// Get the current buffer processed by the lexer. -YY_BUFFER_STATE cmDependsFortranLexer_GetCurrentBuffer(yyscan_t yyscanner); - -// The parser entry point. -int cmDependsFortran_yyparse(yyscan_t); - -//---------------------------------------------------------------------------- -// Define parser object internal structure. -struct cmDependsFortranFile -{ - cmDependsFortranFile(FILE* file, YY_BUFFER_STATE buffer, - const std::string& dir): - File(file), Buffer(buffer), Directory(dir) {} - FILE* File; - YY_BUFFER_STATE Buffer; - std::string Directory; -}; - -struct cmDependsFortranParser_s -{ - cmDependsFortranParser_s(cmDependsFortran* self, - std::set<std::string>& ppDefines, - cmDependsFortranSourceInfo& info); - ~cmDependsFortranParser_s(); - - // Pointer back to the main class. - cmDependsFortran* Self; - - // Lexical scanner instance. - yyscan_t Scanner; - - // Stack of open files in the translation unit. - std::stack<cmDependsFortranFile> FileStack; - - // Buffer for string literals. - std::string TokenString; - - // Flag for whether lexer is reading from inside an interface. - bool InInterface; - - int OldStartcond; - std::set<std::string> PPDefinitions; - size_t InPPFalseBranch; - std::stack<bool> SkipToEnd; - - // Information about the parsed source. - cmDependsFortranSourceInfo& Info; -}; - -//---------------------------------------------------------------------------- class cmDependsFortranInternals { public: @@ -105,18 +36,18 @@ public: TargetRequiresMap TargetRequires; // Information about each object file. - typedef std::map<std::string, cmDependsFortranSourceInfo> ObjectInfoMap; + typedef std::map<std::string, cmFortranSourceInfo> ObjectInfoMap; ObjectInfoMap ObjectInfo; - cmDependsFortranSourceInfo& CreateObjectInfo(const char* obj, + cmFortranSourceInfo& CreateObjectInfo(const char* obj, const char* src) { - std::map<std::string, cmDependsFortranSourceInfo>::iterator i = + std::map<std::string, cmFortranSourceInfo>::iterator i = this->ObjectInfo.find(obj); if(i == this->ObjectInfo.end()) { - std::map<std::string, cmDependsFortranSourceInfo>::value_type - entry(obj, cmDependsFortranSourceInfo()); + std::map<std::string, cmFortranSourceInfo>::value_type + entry(obj, cmFortranSourceInfo()); i = this->ObjectInfo.insert(entry).first; i->second.Source = src; } @@ -126,7 +57,7 @@ public: //---------------------------------------------------------------------------- cmDependsFortran::cmDependsFortran(): - PPDefinitions(0), Internal(0) + Internal(0) { } @@ -159,7 +90,7 @@ cmDependsFortran { def = it->substr(0, assignment); } - this->PPDefinitions.push_back(def); + this->PPDefinitions.insert(def); } } @@ -192,22 +123,18 @@ bool cmDependsFortran::WriteDependencies( { const std::string& src = *it; // Get the information object for this source. - cmDependsFortranSourceInfo& info = + cmFortranSourceInfo& info = this->Internal->CreateObjectInfo(obj.c_str(), src.c_str()); - // Make a copy of the macros defined via ADD_DEFINITIONS - std::set<std::string> ppDefines(this->PPDefinitions.begin(), - this->PPDefinitions.end()); - - // Create the parser object. The constructor takes ppMacro and info per - // reference, so we may look into the resulting objects later. - cmDependsFortranParser parser(this, ppDefines, info); + // Create the parser object. The constructor takes info by reference, + // so we may look into the resulting objects later. + cmFortranParser parser(this->IncludePath, this->PPDefinitions, info); // Push on the starting file. - cmDependsFortranParser_FilePush(&parser, src.c_str()); + cmFortranParser_FilePush(&parser, src.c_str()); // Parse the translation unit. - if(cmDependsFortran_yyparse(parser.Scanner) != 0) + if(cmFortran_yyparse(parser.Scanner) != 0) { // Failed to parse the file. Report failure to write dependencies. okay = false; @@ -318,7 +245,7 @@ void cmDependsFortran::LocateModules() for(ObjectInfoMap::const_iterator infoI = objInfo.begin(); infoI != objInfo.end(); ++infoI) { - cmDependsFortranSourceInfo const& info = infoI->second; + cmFortranSourceInfo const& info = infoI->second; // Include this module in the set provided by this target. this->Internal->TargetProvides.insert(info.Provides.begin(), info.Provides.end()); @@ -428,7 +355,7 @@ void cmDependsFortran::ConsiderModule(const char* name, bool cmDependsFortran ::WriteDependenciesReal(const char *obj, - cmDependsFortranSourceInfo const& info, + cmFortranSourceInfo const& info, const char* mod_dir, const char* stamp_dir, std::ostream& makeDepends, std::ostream& internalDepends) @@ -701,7 +628,7 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args) // is later used for longer sequences it should be re-written using an // efficient string search algorithm such as Boyer-Moore. static -bool cmDependsFortranStreamContainsSequence(std::istream& ifs, +bool cmFortranStreamContainsSequence(std::istream& ifs, const char* seq, int len) { assert(len > 0); @@ -734,7 +661,7 @@ bool cmDependsFortranStreamContainsSequence(std::istream& ifs, //---------------------------------------------------------------------------- // Helper function to compare the remaining content in two streams. -static bool cmDependsFortranStreamsDiffer(std::istream& ifs1, +static bool cmFortranStreamsDiffer(std::istream& ifs1, std::istream& ifs2) { // Compare the remaining content. @@ -837,7 +764,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, const char seq[1] = {'\n'}; const int seqlen = 1; - if(!cmDependsFortranStreamContainsSequence(finModFile, seq, seqlen)) + if(!cmFortranStreamContainsSequence(finModFile, seq, seqlen)) { // The module is of unexpected format. Assume it is different. std::cerr << compilerId << " fortran module " << modFile @@ -845,7 +772,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, return true; } - if(!cmDependsFortranStreamContainsSequence(finStampFile, seq, seqlen)) + if(!cmFortranStreamContainsSequence(finStampFile, seq, seqlen)) { // The stamp must differ if the sequence is not contained. return true; @@ -857,7 +784,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, const char seq[2] = {'\n', '\0'}; const int seqlen = 2; - if(!cmDependsFortranStreamContainsSequence(finModFile, seq, seqlen)) + if(!cmFortranStreamContainsSequence(finModFile, seq, seqlen)) { // The module is of unexpected format. Assume it is different. std::cerr << compilerId << " fortran module " << modFile @@ -865,7 +792,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, return true; } - if(!cmDependsFortranStreamContainsSequence(finStampFile, seq, seqlen)) + if(!cmFortranStreamContainsSequence(finStampFile, seq, seqlen)) { // The stamp must differ if the sequence is not contained. return true; @@ -875,7 +802,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, // Compare the remaining content. If no compiler id matched above, // including the case none was given, this will compare the whole // content. - if(!cmDependsFortranStreamsDiffer(finModFile, finStampFile)) + if(!cmFortranStreamsDiffer(finModFile, finStampFile)) { return false; } @@ -883,396 +810,3 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, // The modules are different. return true; } - -//---------------------------------------------------------------------------- -bool cmDependsFortran::FindIncludeFile(const char* dir, - const char* includeName, - std::string& fileName) -{ - // If the file is a full path, include it directly. - if(cmSystemTools::FileIsFullPath(includeName)) - { - fileName = includeName; - return cmSystemTools::FileExists(fileName.c_str(), true); - } - else - { - // Check for the file in the directory containing the including - // file. - std::string fullName = dir; - fullName += "/"; - fullName += includeName; - if(cmSystemTools::FileExists(fullName.c_str(), true)) - { - fileName = fullName; - return true; - } - - // Search the include path for the file. - for(std::vector<std::string>::const_iterator i = - this->IncludePath.begin(); i != this->IncludePath.end(); ++i) - { - fullName = *i; - fullName += "/"; - fullName += includeName; - if(cmSystemTools::FileExists(fullName.c_str(), true)) - { - fileName = fullName; - return true; - } - } - } - return false; -} - -//---------------------------------------------------------------------------- -cmDependsFortranParser_s -::cmDependsFortranParser_s(cmDependsFortran* self, - std::set<std::string>& ppDefines, - cmDependsFortranSourceInfo& info): - Self(self), PPDefinitions(ppDefines), Info(info) -{ - this->InInterface = 0; - this->InPPFalseBranch = 0; - - // Initialize the lexical scanner. - cmDependsFortran_yylex_init(&this->Scanner); - cmDependsFortran_yyset_extra(this, this->Scanner); - - // Create a dummy buffer that is never read but is the fallback - // buffer when the last file is popped off the stack. - YY_BUFFER_STATE buffer = - cmDependsFortran_yy_create_buffer(0, 4, this->Scanner); - cmDependsFortran_yy_switch_to_buffer(buffer, this->Scanner); -} - -//---------------------------------------------------------------------------- -cmDependsFortranParser_s::~cmDependsFortranParser_s() -{ - cmDependsFortran_yylex_destroy(this->Scanner); -} - -//---------------------------------------------------------------------------- -bool cmDependsFortranParser_FilePush(cmDependsFortranParser* parser, - const char* fname) -{ - // Open the new file and push it onto the stack. Save the old - // buffer with it on the stack. - if(FILE* file = cmsys::SystemTools::Fopen(fname, "rb")) - { - YY_BUFFER_STATE current = - cmDependsFortranLexer_GetCurrentBuffer(parser->Scanner); - std::string dir = cmSystemTools::GetParentDirectory(fname); - cmDependsFortranFile f(file, current, dir); - YY_BUFFER_STATE buffer = - cmDependsFortran_yy_create_buffer(0, 16384, parser->Scanner); - cmDependsFortran_yy_switch_to_buffer(buffer, parser->Scanner); - parser->FileStack.push(f); - return 1; - } - else - { - return 0; - } -} - -//---------------------------------------------------------------------------- -bool cmDependsFortranParser_FilePop(cmDependsFortranParser* parser) -{ - // Pop one file off the stack and close it. Switch the lexer back - // to the next one on the stack. - if(parser->FileStack.empty()) - { - return 0; - } - else - { - cmDependsFortranFile f = parser->FileStack.top(); parser->FileStack.pop(); - fclose(f.File); - YY_BUFFER_STATE current = - cmDependsFortranLexer_GetCurrentBuffer(parser->Scanner); - cmDependsFortran_yy_delete_buffer(current, parser->Scanner); - cmDependsFortran_yy_switch_to_buffer(f.Buffer, parser->Scanner); - return 1; - } -} - -//---------------------------------------------------------------------------- -int cmDependsFortranParser_Input(cmDependsFortranParser* parser, - char* buffer, size_t bufferSize) -{ - // Read from the file on top of the stack. If the stack is empty, - // the end of the translation unit has been reached. - if(!parser->FileStack.empty()) - { - FILE* file = parser->FileStack.top().File; - return (int)fread(buffer, 1, bufferSize, file); - } - return 0; -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_StringStart(cmDependsFortranParser* parser) -{ - parser->TokenString = ""; -} - -//---------------------------------------------------------------------------- -const char* cmDependsFortranParser_StringEnd(cmDependsFortranParser* parser) -{ - return parser->TokenString.c_str(); -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_StringAppend(cmDependsFortranParser* parser, - char c) -{ - parser->TokenString += c; -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_SetInInterface(cmDependsFortranParser* parser, - bool in) -{ - if(parser->InPPFalseBranch) - { - return; - } - - parser->InInterface = in; -} - -//---------------------------------------------------------------------------- -bool cmDependsFortranParser_GetInInterface(cmDependsFortranParser* parser) -{ - return parser->InInterface; -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_SetOldStartcond(cmDependsFortranParser* parser, - int arg) -{ - parser->OldStartcond = arg; -} - -//---------------------------------------------------------------------------- -int cmDependsFortranParser_GetOldStartcond(cmDependsFortranParser* parser) -{ - return parser->OldStartcond; -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_Error(cmDependsFortranParser*, const char*) -{ - // If there is a parser error just ignore it. The source will not - // compile and the user will edit it. Then dependencies will have - // to be regenerated anyway. -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleUse(cmDependsFortranParser* parser, - const char* name) -{ - if(!parser->InPPFalseBranch) - { - parser->Info.Requires.insert(cmSystemTools::LowerCase(name) ); - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleInclude(cmDependsFortranParser* parser, - const char* name) -{ - if(parser->InPPFalseBranch) - { - return; - } - - // If processing an include statement there must be an open file. - assert(!parser->FileStack.empty()); - - // Get the directory containing the source in which the include - // statement appears. This is always the first search location for - // Fortran include files. - std::string dir = parser->FileStack.top().Directory; - - // Find the included file. If it cannot be found just ignore the - // problem because either the source will not compile or the user - // does not care about depending on this included source. - std::string fullName; - if(parser->Self->FindIncludeFile(dir.c_str(), name, fullName)) - { - // Found the included file. Save it in the set of included files. - parser->Info.Includes.insert(fullName); - - // Parse it immediately to translate the source inline. - cmDependsFortranParser_FilePush(parser, fullName.c_str()); - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleModule(cmDependsFortranParser* parser, - const char* name) -{ - if(!parser->InPPFalseBranch && !parser->InInterface) - { - parser->Info.Provides.insert(cmSystemTools::LowerCase(name)); - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleDefine(cmDependsFortranParser* parser, - const char* macro) -{ - if(!parser->InPPFalseBranch) - { - parser->PPDefinitions.insert(macro); - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleUndef(cmDependsFortranParser* parser, - const char* macro) -{ - if(!parser->InPPFalseBranch) - { - std::set<std::string>::iterator match; - match = parser->PPDefinitions.find(macro); - if(match != parser->PPDefinitions.end()) - { - parser->PPDefinitions.erase(match); - } - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleIfdef(cmDependsFortranParser* parser, - const char* macro) -{ - // A new PP branch has been opened - parser->SkipToEnd.push(false); - - if (parser->InPPFalseBranch) - { - parser->InPPFalseBranch++; - } - else if(parser->PPDefinitions.find(macro) == parser->PPDefinitions.end()) - { - parser->InPPFalseBranch=1; - } - else - { - parser->SkipToEnd.top() = true; - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleIfndef(cmDependsFortranParser* parser, - const char* macro) -{ - // A new PP branch has been opened - parser->SkipToEnd.push(false); - - if (parser->InPPFalseBranch) - { - parser->InPPFalseBranch++; - } - else if(parser->PPDefinitions.find(macro) != parser->PPDefinitions.end()) - { - parser->InPPFalseBranch = 1; - } - else - { - // ignore other branches - parser->SkipToEnd.top() = true; - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleIf(cmDependsFortranParser* parser) -{ - /* Note: The current parser is _not_ able to get statements like - * #if 0 - * #if 1 - * #if MYSMBOL - * #if defined(MYSYMBOL) - * #if defined(MYSYMBOL) && ... - * right. The same for #elif. Thus in - * #if SYMBOL_1 - * .. - * #elif SYMBOL_2 - * ... - * ... - * #elif SYMBOL_N - * .. - * #else - * .. - * #endif - * _all_ N+1 branches are considered. If you got something like this - * #if defined(MYSYMBOL) - * #if !defined(MYSYMBOL) - * use - * #ifdef MYSYMBOL - * #ifndef MYSYMBOL - * instead. - */ - - // A new PP branch has been opened - // Never skip! See note above. - parser->SkipToEnd.push(false); -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleElif(cmDependsFortranParser* parser) -{ - /* Note: There are parser limitations. See the note at - * cmDependsFortranParser_RuleIf(..) - */ - - // Always taken unless an #ifdef or #ifndef-branch has been taken - // already. If the second condition isn't meet already - // (parser->InPPFalseBranch == 0) correct it. - if(!parser->SkipToEnd.empty() && - parser->SkipToEnd.top() && !parser->InPPFalseBranch) - { - parser->InPPFalseBranch = 1; - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleElse(cmDependsFortranParser* parser) -{ - // if the parent branch is false do nothing! - if(parser->InPPFalseBranch > 1) - { - return; - } - - // parser->InPPFalseBranch is either 0 or 1. We change it depending on - // parser->SkipToEnd.top() - if(!parser->SkipToEnd.empty() && - parser->SkipToEnd.top()) - { - parser->InPPFalseBranch = 1; - } - else - { - parser->InPPFalseBranch = 0; - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleEndif(cmDependsFortranParser* parser) -{ - if(!parser->SkipToEnd.empty()) - { - parser->SkipToEnd.pop(); - } - - // #endif doesn't know if there was a "#else" in before, so it - // always decreases InPPFalseBranch - if(parser->InPPFalseBranch) - { - parser->InPPFalseBranch--; - } -} diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index cb40796..d6ec7d7 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -9,13 +9,13 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef cmDependsFortran_h -#define cmDependsFortran_h +#ifndef cmFortran_h +#define cmFortran_h #include "cmDepends.h" class cmDependsFortranInternals; -class cmDependsFortranSourceInfo; +class cmFortranSourceInfo; /** \class cmDependsFortran * \brief Dependency scanner for Fortran object files. @@ -46,12 +46,6 @@ public: static bool ModulesDiffer(const char* modFile, const char* stampFile, const char* compilerId); - /** Method to find an included file in the include path. Fortran - always searches the directory containing the including source - first. */ - bool FindIncludeFile(const char* dir, const char* includeName, - std::string& fileName); - protected: // Finalize the dependency information for the target. virtual bool Finalize(std::ostream& makeDepends, @@ -71,7 +65,7 @@ protected: // Actually write the depenencies to the streams. bool WriteDependenciesReal(const char *obj, - cmDependsFortranSourceInfo const& info, + cmFortranSourceInfo const& info, const char* mod_dir, const char* stamp_dir, std::ostream& makeDepends, std::ostream& internalDepends); @@ -79,7 +73,7 @@ protected: // The source file from which to start scanning. std::string SourceFile; - std::vector<std::string> PPDefinitions; + std::set<std::string> PPDefinitions; // Internal implementation details. cmDependsFortranInternals* Internal; diff --git a/Source/cmDependsFortranParser.h b/Source/cmDependsFortranParser.h deleted file mode 100644 index 399c3c8..0000000 --- a/Source/cmDependsFortranParser.h +++ /dev/null @@ -1,96 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef cmDependsFortranParser_h -#define cmDependsFortranParser_h - -#include <stddef.h> /* size_t */ - -/* Forward declare parser object type. */ -typedef struct cmDependsFortranParser_s cmDependsFortranParser; - -/* Functions to enter/exit #include'd files in order. */ -bool cmDependsFortranParser_FilePush(cmDependsFortranParser* parser, - const char* fname); -bool cmDependsFortranParser_FilePop(cmDependsFortranParser* parser); - -/* Callbacks for lexer. */ -int cmDependsFortranParser_Input(cmDependsFortranParser* parser, - char* buffer, size_t bufferSize); - - -void cmDependsFortranParser_StringStart(cmDependsFortranParser* parser); -const char* cmDependsFortranParser_StringEnd(cmDependsFortranParser* parser); -void cmDependsFortranParser_StringAppend(cmDependsFortranParser* parser, - char c); - -void cmDependsFortranParser_SetInInterface(cmDependsFortranParser* parser, - bool is_in); -bool cmDependsFortranParser_GetInInterface(cmDependsFortranParser* parser); - - -void cmDependsFortranParser_SetInPPFalseBranch(cmDependsFortranParser* parser, - bool is_in); -bool cmDependsFortranParser_GetInPPFalseBranch(cmDependsFortranParser* parser); - - -void cmDependsFortranParser_SetOldStartcond(cmDependsFortranParser* parser, - int arg); -int cmDependsFortranParser_GetOldStartcond(cmDependsFortranParser* parser); - -/* Callbacks for parser. */ -void cmDependsFortranParser_Error(cmDependsFortranParser* parser, - const char* message); -void cmDependsFortranParser_RuleUse(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleInclude(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleModule(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleDefine(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleUndef(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleIfdef(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleIfndef(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleIf(cmDependsFortranParser* parser); -void cmDependsFortranParser_RuleElif(cmDependsFortranParser* parser); -void cmDependsFortranParser_RuleElse(cmDependsFortranParser* parser); -void cmDependsFortranParser_RuleEndif(cmDependsFortranParser* parser); - -/* Define the parser stack element type. */ -typedef union cmDependsFortran_yystype_u cmDependsFortran_yystype; -union cmDependsFortran_yystype_u -{ - char* string; -}; - -/* Setup the proper yylex interface. */ -#define YY_EXTRA_TYPE cmDependsFortranParser* -#define YY_DECL \ -int cmDependsFortran_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) -#define YYSTYPE cmDependsFortran_yystype -#define YYSTYPE_IS_DECLARED 1 -#if !defined(cmDependsFortranLexer_cxx) -# include "cmDependsFortranLexer.h" -#endif -#if !defined(cmDependsFortranLexer_cxx) -#if !defined(cmDependsFortranParser_cxx) -# undef YY_EXTRA_TYPE -# undef YY_DECL -# undef YYSTYPE -# undef YYSTYPE_IS_DECLARED -#endif -#endif - -#endif diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 3d84f38..0daed66 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -270,7 +270,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args, this->SetError(error); return false; } - std::string message = cmJoin(cmRange(i, args.end()), std::string()); + std::string message = cmJoin(cmMakeRange(i, args.end()), std::string()); file << message; file.close(); if(mode) diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index add06a7..7959ffe 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -170,8 +170,8 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn) else { this->VariableDocumentation += "one of the "; - this->VariableDocumentation += cmJoin(cmRange(this->Names).retreat(1), - ", "); + this->VariableDocumentation += + cmJoin(cmMakeRange(this->Names).retreat(1), ", "); this->VariableDocumentation += " or " + this->Names[this->Names.size() - 1] + " libraries be found"; } diff --git a/Source/cmDependsFortranLexer.cxx b/Source/cmFortranLexer.cxx index 1eff1e4..b727f0e 100644 --- a/Source/cmDependsFortranLexer.cxx +++ b/Source/cmFortranLexer.cxx @@ -9,9 +9,9 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#line 2 "cmDependsFortranLexer.cxx" +#line 2 "cmFortranLexer.cxx" -#line 4 "cmDependsFortranLexer.cxx" +#line 4 "cmFortranLexer.cxx" #define YY_INT_ALIGNED short int @@ -164,7 +164,7 @@ typedef void* yyscan_t; #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE cmDependsFortran_yyrestart(yyin ,yyscanner ) +#define YY_NEW_FILE cmFortran_yyrestart(yyin ,yyscanner ) #define YY_END_OF_BUFFER_CHAR 0 @@ -274,7 +274,7 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via cmDependsFortran_yyrestart()), so that the user can continue scanning by + * (via cmFortran_yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -297,36 +297,36 @@ struct yy_buffer_state */ #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] -void cmDependsFortran_yyrestart (FILE *input_file ,yyscan_t yyscanner ); -void cmDependsFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmDependsFortran_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); -void cmDependsFortran_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void cmDependsFortran_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void cmDependsFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -void cmDependsFortran_yypop_buffer_state (yyscan_t yyscanner ); +void cmFortran_yyrestart (FILE *input_file ,yyscan_t yyscanner ); +void cmFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmFortran_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void cmFortran_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void cmFortran_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void cmFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void cmFortran_yypop_buffer_state (yyscan_t yyscanner ); -static void cmDependsFortran_yyensure_buffer_stack (yyscan_t yyscanner ); -static void cmDependsFortran_yy_load_buffer_state (yyscan_t yyscanner ); -static void cmDependsFortran_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); +static void cmFortran_yyensure_buffer_stack (yyscan_t yyscanner ); +static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner ); +static void cmFortran_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); -#define YY_FLUSH_BUFFER cmDependsFortran_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) +#define YY_FLUSH_BUFFER cmFortran_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) -YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmDependsFortran_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmDependsFortran_yy_scan_bytes (yyconst char *bytes,int len ,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 ); -void *cmDependsFortran_yyalloc (yy_size_t ,yyscan_t yyscanner ); -void *cmDependsFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); -void cmDependsFortran_yyfree (void * ,yyscan_t yyscanner ); +void *cmFortran_yyalloc (yy_size_t ,yyscan_t yyscanner ); +void *cmFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); +void cmFortran_yyfree (void * ,yyscan_t yyscanner ); -#define yy_new_buffer cmDependsFortran_yy_create_buffer +#define yy_new_buffer cmFortran_yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - cmDependsFortran_yyensure_buffer_stack (yyscanner); \ + cmFortran_yyensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ - cmDependsFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } @@ -334,9 +334,9 @@ void cmDependsFortran_yyfree (void * ,yyscan_t yyscanner ); #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - cmDependsFortran_yyensure_buffer_stack (yyscanner); \ + cmFortran_yyensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ - cmDependsFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } @@ -345,7 +345,7 @@ void cmDependsFortran_yyfree (void * ,yyscan_t yyscanner ); /* Begin user sect3 */ -#define cmDependsFortran_yywrap(n) 1 +#define cmFortran_yywrap(n) 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; @@ -622,8 +622,8 @@ static yyconst flex_int16_t yy_chk[547] = #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -#line 1 "cmDependsFortranLexer.in.l" -#line 2 "cmDependsFortranLexer.in.l" +#line 1 "cmFortranLexer.in.l" +#line 2 "cmFortranLexer.in.l" /*============================================================================ CMake - Cross Platform Makefile Generator Copyright 2000-2009 Kitware, Inc., Insight Software Consortium @@ -651,17 +651,17 @@ This file must be translated to C and modified to build everywhere. Run flex like this: - flex -i --prefix=cmDependsFortran_yy --header-file=cmDependsFortranLexer.h -ocmDependsFortranLexer.cxx cmDependsFortranLexer.in.l + flex -i --prefix=cmFortran_yy --header-file=cmFortranLexer.h -ocmFortranLexer.cxx cmFortranLexer.in.l -Modify cmDependsFortranLexer.cxx: +Modify cmFortranLexer.cxx: - remove TABs - remove "yyscanner" argument from these methods: - yy_fatal_error, cmDependsFortran_yyalloc, cmDependsFortran_yyrealloc, cmDependsFortran_yyfree - - remove "yyscanner = NULL" from end of cmDependsFortran_yylex_destroy + yy_fatal_error, cmFortran_yyalloc, cmFortran_yyrealloc, cmFortran_yyfree + - remove "yyscanner = NULL" from end of cmFortran_yylex_destroy - remove all YY_BREAK lines occurring right after return statements - change while ( 1 ) to for(;;) -Modify cmDependsFortranLexer.h: +Modify cmFortranLexer.h: - remove TABs - remove the yy_init_globals function - remove the block that includes unistd.h @@ -671,21 +671,21 @@ Modify cmDependsFortranLexer.h: #include "cmStandardLexer.h" -#define cmDependsFortranLexer_cxx -#include "cmDependsFortranParser.h" /* Interface to parser object. */ +#define cmFortranLexer_cxx +#include "cmFortranParser.h" /* Interface to parser object. */ /* Replace the lexer input function. */ #undef YY_INPUT #define YY_INPUT(buf, result, max_size) \ - { result = cmDependsFortranParser_Input(yyextra, buf, max_size); } + { result = cmFortranParser_Input(yyextra, buf, max_size); } /* Include the set of tokens from the parser. */ -#include "cmDependsFortranParserTokens.h" +#include "cmFortranParserTokens.h" /*--------------------------------------------------------------------------*/ -#line 678 "cmDependsFortranLexer.cxx" +#line 678 "cmFortranLexer.cxx" #define INITIAL 0 #define free_fmt 1 @@ -741,38 +741,38 @@ struct yyguts_t static int yy_init_globals (yyscan_t yyscanner ); -int cmDependsFortran_yylex_init (yyscan_t* scanner); +int cmFortran_yylex_init (yyscan_t* scanner); -int cmDependsFortran_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); +int cmFortran_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int cmDependsFortran_yylex_destroy (yyscan_t yyscanner ); +int cmFortran_yylex_destroy (yyscan_t yyscanner ); -int cmDependsFortran_yyget_debug (yyscan_t yyscanner ); +int cmFortran_yyget_debug (yyscan_t yyscanner ); -void cmDependsFortran_yyset_debug (int debug_flag ,yyscan_t yyscanner ); +void cmFortran_yyset_debug (int debug_flag ,yyscan_t yyscanner ); -YY_EXTRA_TYPE cmDependsFortran_yyget_extra (yyscan_t yyscanner ); +YY_EXTRA_TYPE cmFortran_yyget_extra (yyscan_t yyscanner ); -void cmDependsFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); +void cmFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); -FILE *cmDependsFortran_yyget_in (yyscan_t yyscanner ); +FILE *cmFortran_yyget_in (yyscan_t yyscanner ); -void cmDependsFortran_yyset_in (FILE * in_str ,yyscan_t yyscanner ); +void cmFortran_yyset_in (FILE * in_str ,yyscan_t yyscanner ); -FILE *cmDependsFortran_yyget_out (yyscan_t yyscanner ); +FILE *cmFortran_yyget_out (yyscan_t yyscanner ); -void cmDependsFortran_yyset_out (FILE * out_str ,yyscan_t yyscanner ); +void cmFortran_yyset_out (FILE * out_str ,yyscan_t yyscanner ); -int cmDependsFortran_yyget_leng (yyscan_t yyscanner ); +int cmFortran_yyget_leng (yyscan_t yyscanner ); -char *cmDependsFortran_yyget_text (yyscan_t yyscanner ); +char *cmFortran_yyget_text (yyscan_t yyscanner ); -int cmDependsFortran_yyget_lineno (yyscan_t yyscanner ); +int cmFortran_yyget_lineno (yyscan_t yyscanner ); -void cmDependsFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); +void cmFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -780,9 +780,9 @@ void cmDependsFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int cmDependsFortran_yywrap (yyscan_t yyscanner ); +extern "C" int cmFortran_yywrap (yyscan_t yyscanner ); #else -extern int cmDependsFortran_yywrap (yyscan_t yyscanner ); +extern int cmFortran_yywrap (yyscan_t yyscanner ); #endif #endif @@ -886,9 +886,9 @@ static int input (yyscan_t yyscanner ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int cmDependsFortran_yylex (yyscan_t yyscanner); +extern int cmFortran_yylex (yyscan_t yyscanner); -#define YY_DECL int cmDependsFortran_yylex (yyscan_t yyscanner) +#define YY_DECL int cmFortran_yylex (yyscan_t yyscanner) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng @@ -918,10 +918,10 @@ YY_DECL int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 71 "cmDependsFortranLexer.in.l" +#line 71 "cmFortranLexer.in.l" -#line 914 "cmDependsFortranLexer.cxx" +#line 914 "cmFortranLexer.cxx" if ( !yyg->yy_init ) { @@ -941,12 +941,12 @@ YY_DECL yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { - cmDependsFortran_yyensure_buffer_stack (yyscanner); + cmFortran_yyensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = - cmDependsFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); } - cmDependsFortran_yy_load_buffer_state(yyscanner ); + cmFortran_yy_load_buffer_state(yyscanner ); } for(;;) /* loops until end-of-file is reached */ @@ -1007,47 +1007,47 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 73 "cmDependsFortranLexer.in.l" +#line 73 "cmFortranLexer.in.l" { - cmDependsFortranParser_StringStart(yyextra); - cmDependsFortranParser_SetOldStartcond(yyextra, YY_START); + cmFortranParser_StringStart(yyextra); + cmFortranParser_SetOldStartcond(yyextra, YY_START); BEGIN(str_dq); } YY_BREAK case 2: YY_RULE_SETUP -#line 79 "cmDependsFortranLexer.in.l" +#line 79 "cmFortranLexer.in.l" { - cmDependsFortranParser_StringStart(yyextra); - cmDependsFortranParser_SetOldStartcond(yyextra, YY_START); + cmFortranParser_StringStart(yyextra); + cmFortranParser_SetOldStartcond(yyextra, YY_START); BEGIN(str_sq); } YY_BREAK case 3: -#line 86 "cmDependsFortranLexer.in.l" +#line 86 "cmFortranLexer.in.l" case 4: YY_RULE_SETUP -#line 86 "cmDependsFortranLexer.in.l" +#line 86 "cmFortranLexer.in.l" { - BEGIN(cmDependsFortranParser_GetOldStartcond(yyextra) ); - yylvalp->string = strdup(cmDependsFortranParser_StringEnd(yyextra)); + BEGIN(cmFortranParser_GetOldStartcond(yyextra) ); + yylvalp->string = strdup(cmFortranParser_StringEnd(yyextra)); return STRING; } case 5: /* rule 5 can match eol */ -#line 93 "cmDependsFortranLexer.in.l" +#line 93 "cmFortranLexer.in.l" case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 93 "cmDependsFortranLexer.in.l" +#line 93 "cmFortranLexer.in.l" /* Ignore (continued strings, free fmt) */ YY_BREAK case 7: /* rule 7 can match eol */ YY_RULE_SETUP -#line 95 "cmDependsFortranLexer.in.l" +#line 95 "cmFortranLexer.in.l" { - if (cmDependsFortranParser_GetOldStartcond(yyextra) == fixed_fmt) + if (cmFortranParser_GetOldStartcond(yyextra) == fixed_fmt) ; /* Ignore (cont. strings, fixed fmt) */ else { @@ -1058,7 +1058,7 @@ YY_RULE_SETUP case 8: /* rule 8 can match eol */ YY_RULE_SETUP -#line 105 "cmDependsFortranLexer.in.l" +#line 105 "cmFortranLexer.in.l" { unput ('\n'); BEGIN(INITIAL); @@ -1066,25 +1066,25 @@ YY_RULE_SETUP } case 9: YY_RULE_SETUP -#line 111 "cmDependsFortranLexer.in.l" +#line 111 "cmFortranLexer.in.l" { - cmDependsFortranParser_StringAppend(yyextra, yytext[0]); + cmFortranParser_StringAppend(yyextra, yytext[0]); } YY_BREAK case 10: /* rule 10 can match eol */ YY_RULE_SETUP -#line 115 "cmDependsFortranLexer.in.l" +#line 115 "cmFortranLexer.in.l" { return EOSTMT; } /* Treat comments like */ case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 116 "cmDependsFortranLexer.in.l" +#line 116 "cmFortranLexer.in.l" { return EOSTMT; } /* empty lines */ case 12: /* rule 12 can match eol */ YY_RULE_SETUP -#line 118 "cmDependsFortranLexer.in.l" +#line 118 "cmFortranLexer.in.l" { yytext[yyleng-1] = 0; yylvalp->string = strdup(strchr(yytext, '<')+1); @@ -1092,149 +1092,149 @@ YY_RULE_SETUP } case 13: YY_RULE_SETUP -#line 123 "cmDependsFortranLexer.in.l" +#line 123 "cmFortranLexer.in.l" { return CPP_INCLUDE; } case 14: YY_RULE_SETUP -#line 124 "cmDependsFortranLexer.in.l" +#line 124 "cmFortranLexer.in.l" { return F90PPR_INCLUDE; } case 15: YY_RULE_SETUP -#line 125 "cmDependsFortranLexer.in.l" +#line 125 "cmFortranLexer.in.l" { return COCO_INCLUDE; } case 16: YY_RULE_SETUP -#line 127 "cmDependsFortranLexer.in.l" +#line 127 "cmFortranLexer.in.l" { return CPP_DEFINE; } case 17: YY_RULE_SETUP -#line 128 "cmDependsFortranLexer.in.l" +#line 128 "cmFortranLexer.in.l" { return F90PPR_DEFINE; } case 18: YY_RULE_SETUP -#line 130 "cmDependsFortranLexer.in.l" +#line 130 "cmFortranLexer.in.l" { return CPP_UNDEF; } case 19: YY_RULE_SETUP -#line 131 "cmDependsFortranLexer.in.l" +#line 131 "cmFortranLexer.in.l" { return F90PPR_UNDEF; } case 20: YY_RULE_SETUP -#line 133 "cmDependsFortranLexer.in.l" +#line 133 "cmFortranLexer.in.l" { return CPP_IFDEF; } case 21: YY_RULE_SETUP -#line 134 "cmDependsFortranLexer.in.l" +#line 134 "cmFortranLexer.in.l" { return CPP_IFNDEF; } case 22: YY_RULE_SETUP -#line 135 "cmDependsFortranLexer.in.l" +#line 135 "cmFortranLexer.in.l" { return CPP_IF; } case 23: YY_RULE_SETUP -#line 136 "cmDependsFortranLexer.in.l" +#line 136 "cmFortranLexer.in.l" { return CPP_ELIF; } case 24: YY_RULE_SETUP -#line 137 "cmDependsFortranLexer.in.l" +#line 137 "cmFortranLexer.in.l" { return CPP_ELSE; } case 25: YY_RULE_SETUP -#line 138 "cmDependsFortranLexer.in.l" +#line 138 "cmFortranLexer.in.l" { return CPP_ENDIF; } case 26: YY_RULE_SETUP -#line 140 "cmDependsFortranLexer.in.l" +#line 140 "cmFortranLexer.in.l" { return F90PPR_IFDEF; } case 27: YY_RULE_SETUP -#line 141 "cmDependsFortranLexer.in.l" +#line 141 "cmFortranLexer.in.l" { return F90PPR_IFNDEF; } case 28: YY_RULE_SETUP -#line 142 "cmDependsFortranLexer.in.l" +#line 142 "cmFortranLexer.in.l" { return F90PPR_IF; } case 29: YY_RULE_SETUP -#line 143 "cmDependsFortranLexer.in.l" +#line 143 "cmFortranLexer.in.l" { return F90PPR_ELIF; } case 30: YY_RULE_SETUP -#line 144 "cmDependsFortranLexer.in.l" +#line 144 "cmFortranLexer.in.l" { return F90PPR_ELSE; } case 31: YY_RULE_SETUP -#line 145 "cmDependsFortranLexer.in.l" +#line 145 "cmFortranLexer.in.l" { return F90PPR_ENDIF; } /* Line continuations, possible involving comments. */ case 32: /* rule 32 can match eol */ YY_RULE_SETUP -#line 148 "cmDependsFortranLexer.in.l" +#line 148 "cmFortranLexer.in.l" YY_BREAK case 33: /* rule 33 can match eol */ YY_RULE_SETUP -#line 149 "cmDependsFortranLexer.in.l" +#line 149 "cmFortranLexer.in.l" YY_BREAK case 34: YY_RULE_SETUP -#line 151 "cmDependsFortranLexer.in.l" +#line 151 "cmFortranLexer.in.l" { return COMMA; } case 35: YY_RULE_SETUP -#line 153 "cmDependsFortranLexer.in.l" +#line 153 "cmFortranLexer.in.l" { return DCOLON; } case 36: /* rule 36 can match eol */ YY_RULE_SETUP -#line 155 "cmDependsFortranLexer.in.l" +#line 155 "cmFortranLexer.in.l" { return GARBAGE; } case 37: YY_RULE_SETUP -#line 157 "cmDependsFortranLexer.in.l" +#line 157 "cmFortranLexer.in.l" { return ASSIGNMENT_OP; } case 38: YY_RULE_SETUP -#line 159 "cmDependsFortranLexer.in.l" +#line 159 "cmFortranLexer.in.l" { yylvalp->string = strdup(yytext); return WORD; } case 39: YY_RULE_SETUP -#line 164 "cmDependsFortranLexer.in.l" +#line 164 "cmFortranLexer.in.l" { return GARBAGE; } case 40: /* rule 40 can match eol */ YY_RULE_SETUP -#line 166 "cmDependsFortranLexer.in.l" +#line 166 "cmFortranLexer.in.l" { return EOSTMT; } case 41: YY_RULE_SETUP -#line 169 "cmDependsFortranLexer.in.l" +#line 169 "cmFortranLexer.in.l" /* Ignore */ YY_BREAK case 42: /* rule 42 can match eol */ YY_RULE_SETUP -#line 170 "cmDependsFortranLexer.in.l" +#line 170 "cmFortranLexer.in.l" /* Ignore line-endings preceeded by \ */ YY_BREAK case 43: YY_RULE_SETUP -#line 172 "cmDependsFortranLexer.in.l" +#line 172 "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 "cmDependsFortranLexer.in.l" +#line 174 "cmFortranLexer.in.l" { - if(!cmDependsFortranParser_FilePop(yyextra) ) + if(!cmFortranParser_FilePop(yyextra) ) { return YY_NULL; } @@ -1242,10 +1242,10 @@ case YY_STATE_EOF(str_dq): YY_BREAK case 44: YY_RULE_SETUP -#line 181 "cmDependsFortranLexer.in.l" +#line 181 "cmFortranLexer.in.l" ECHO; YY_BREAK -#line 1270 "cmDependsFortranLexer.cxx" +#line 1270 "cmFortranLexer.cxx" case YY_END_OF_BUFFER: { @@ -1261,7 +1261,7 @@ ECHO; /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called - * cmDependsFortran_yylex(). If so, then we have to assure + * cmFortran_yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a @@ -1321,7 +1321,7 @@ ECHO; { yyg->yy_did_buffer_switch_on_eof = 0; - if ( cmDependsFortran_yywrap(yyscanner ) ) + if ( cmFortran_yywrap(yyscanner ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -1374,7 +1374,7 @@ ECHO; "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -} /* end of cmDependsFortran_yylex */ +} /* end of cmFortran_yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -1453,7 +1453,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - cmDependsFortran_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + cmFortran_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); } else /* Can't grow it, we don't own it. */ @@ -1485,7 +1485,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - cmDependsFortran_yyrestart(yyin ,yyscanner); + cmFortran_yyrestart(yyin ,yyscanner); } else @@ -1502,7 +1502,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cmDependsFortran_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cmFortran_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } @@ -1656,13 +1656,13 @@ static int yy_get_next_buffer (yyscan_t yyscanner) */ /* Reset buffer status. */ - cmDependsFortran_yyrestart(yyin ,yyscanner); + cmFortran_yyrestart(yyin ,yyscanner); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( cmDependsFortran_yywrap(yyscanner ) ) + if ( cmFortran_yywrap(yyscanner ) ) return EOF; if ( ! yyg->yy_did_buffer_switch_on_eof ) @@ -1696,34 +1696,34 @@ static int yy_get_next_buffer (yyscan_t yyscanner) * @param yyscanner The scanner object. * @note This function does not reset the start condition to @c INITIAL . */ - void cmDependsFortran_yyrestart (FILE * input_file , yyscan_t yyscanner) + void cmFortran_yyrestart (FILE * input_file , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! YY_CURRENT_BUFFER ){ - cmDependsFortran_yyensure_buffer_stack (yyscanner); + cmFortran_yyensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = - cmDependsFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); } - cmDependsFortran_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); - cmDependsFortran_yy_load_buffer_state(yyscanner ); + cmFortran_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + cmFortran_yy_load_buffer_state(yyscanner ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * @param yyscanner The scanner object. */ - void cmDependsFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) + void cmFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* TODO. We should be able to replace this entire function body * with - * cmDependsFortran_yypop_buffer_state(); - * cmDependsFortran_yypush_buffer_state(new_buffer); + * cmFortran_yypop_buffer_state(); + * cmFortran_yypush_buffer_state(new_buffer); */ - cmDependsFortran_yyensure_buffer_stack (yyscanner); + cmFortran_yyensure_buffer_stack (yyscanner); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -1736,17 +1736,17 @@ static int yy_get_next_buffer (yyscan_t yyscanner) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - cmDependsFortran_yy_load_buffer_state(yyscanner ); + cmFortran_yy_load_buffer_state(yyscanner ); /* We don't actually know whether we did this switch during - * EOF (cmDependsFortran_yywrap()) processing, but the only time this flag - * is looked at is after cmDependsFortran_yywrap() is called, so it's safe + * EOF (cmFortran_yywrap()) processing, but the only time this flag + * is looked at is after cmFortran_yywrap() is called, so it's safe * to go ahead and always set it. */ yyg->yy_did_buffer_switch_on_eof = 1; } -static void cmDependsFortran_yy_load_buffer_state (yyscan_t yyscanner) +static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; @@ -1761,35 +1761,35 @@ static void cmDependsFortran_yy_load_buffer_state (yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the allocated buffer state. */ - YY_BUFFER_STATE cmDependsFortran_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) + YY_BUFFER_STATE cmFortran_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) cmDependsFortran_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + b = (YY_BUFFER_STATE) cmFortran_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in cmDependsFortran_yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) cmDependsFortran_yyalloc(b->yy_buf_size + 2 ,yyscanner ); + b->yy_ch_buf = (char *) cmFortran_yyalloc(b->yy_buf_size + 2 ,yyscanner ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in cmDependsFortran_yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_create_buffer()" ); b->yy_is_our_buffer = 1; - cmDependsFortran_yy_init_buffer(b,file ,yyscanner); + cmFortran_yy_init_buffer(b,file ,yyscanner); return b; } /** Destroy the buffer. - * @param b a buffer created with cmDependsFortran_yy_create_buffer() + * @param b a buffer created with cmFortran_yy_create_buffer() * @param yyscanner The scanner object. */ - void cmDependsFortran_yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) + void cmFortran_yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -1800,9 +1800,9 @@ static void cmDependsFortran_yy_load_buffer_state (yyscan_t yyscanner) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - cmDependsFortran_yyfree((void *) b->yy_ch_buf ,yyscanner ); + cmFortran_yyfree((void *) b->yy_ch_buf ,yyscanner ); - cmDependsFortran_yyfree((void *) b ,yyscanner ); + cmFortran_yyfree((void *) b ,yyscanner ); } #ifndef __cplusplus @@ -1811,21 +1811,21 @@ extern int isatty (int ); /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, - * such as during a cmDependsFortran_yyrestart() or at EOF. + * such as during a cmFortran_yyrestart() or at EOF. */ - static void cmDependsFortran_yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + static void cmFortran_yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) { int oerrno = errno; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - cmDependsFortran_yy_flush_buffer(b ,yyscanner); + cmFortran_yy_flush_buffer(b ,yyscanner); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then cmDependsFortran_yy_init_buffer was _probably_ - * called from cmDependsFortran_yyrestart() or through yy_get_next_buffer. + /* If b is the current buffer, then cmFortran_yy_init_buffer was _probably_ + * called from cmFortran_yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ @@ -1842,7 +1842,7 @@ extern int isatty (int ); * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * @param yyscanner The scanner object. */ - void cmDependsFortran_yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) + void cmFortran_yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! b ) @@ -1863,7 +1863,7 @@ extern int isatty (int ); b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - cmDependsFortran_yy_load_buffer_state(yyscanner ); + cmFortran_yy_load_buffer_state(yyscanner ); } /** Pushes the new state onto the stack. The new state becomes @@ -1872,15 +1872,15 @@ extern int isatty (int ); * @param new_buffer The new state. * @param yyscanner The scanner object. */ -void cmDependsFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +void cmFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (new_buffer == NULL) return; - cmDependsFortran_yyensure_buffer_stack(yyscanner); + cmFortran_yyensure_buffer_stack(yyscanner); - /* This block is copied from cmDependsFortran_yy_switch_to_buffer. */ + /* This block is copied from cmFortran_yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -1894,8 +1894,8 @@ void cmDependsFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyg->yy_buffer_stack_top++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from cmDependsFortran_yy_switch_to_buffer. */ - cmDependsFortran_yy_load_buffer_state(yyscanner ); + /* copied from cmFortran_yy_switch_to_buffer. */ + cmFortran_yy_load_buffer_state(yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } @@ -1903,19 +1903,19 @@ void cmDependsFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t * The next element becomes the new top. * @param yyscanner The scanner object. */ -void cmDependsFortran_yypop_buffer_state (yyscan_t yyscanner) +void cmFortran_yypop_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!YY_CURRENT_BUFFER) return; - cmDependsFortran_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + cmFortran_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); YY_CURRENT_BUFFER_LVALUE = NULL; if (yyg->yy_buffer_stack_top > 0) --yyg->yy_buffer_stack_top; if (YY_CURRENT_BUFFER) { - cmDependsFortran_yy_load_buffer_state(yyscanner ); + cmFortran_yy_load_buffer_state(yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } } @@ -1923,7 +1923,7 @@ void cmDependsFortran_yypop_buffer_state (yyscan_t yyscanner) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void cmDependsFortran_yyensure_buffer_stack (yyscan_t yyscanner) +static void cmFortran_yyensure_buffer_stack (yyscan_t yyscanner) { int num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -1935,11 +1935,11 @@ static void cmDependsFortran_yyensure_buffer_stack (yyscan_t yyscanner) * immediate realloc on the next call. */ num_to_alloc = 1; - yyg->yy_buffer_stack = (struct yy_buffer_state**)cmDependsFortran_yyalloc + yyg->yy_buffer_stack = (struct yy_buffer_state**)cmFortran_yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); if ( ! yyg->yy_buffer_stack ) - YY_FATAL_ERROR( "out of dynamic memory in cmDependsFortran_yyensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yyensure_buffer_stack()" ); memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); @@ -1954,12 +1954,12 @@ static void cmDependsFortran_yyensure_buffer_stack (yyscan_t yyscanner) int grow_size = 8 /* arbitrary grow size */; num_to_alloc = yyg->yy_buffer_stack_max + grow_size; - yyg->yy_buffer_stack = (struct yy_buffer_state**)cmDependsFortran_yyrealloc + yyg->yy_buffer_stack = (struct yy_buffer_state**)cmFortran_yyrealloc (yyg->yy_buffer_stack, num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); if ( ! yyg->yy_buffer_stack ) - YY_FATAL_ERROR( "out of dynamic memory in cmDependsFortran_yyensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -1973,7 +1973,7 @@ static void cmDependsFortran_yyensure_buffer_stack (yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +YY_BUFFER_STATE cmFortran_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) { YY_BUFFER_STATE b; @@ -1983,9 +1983,9 @@ YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char * base, yy_size_t size , /* They forgot to leave room for the EOB's. */ return 0; - b = (YY_BUFFER_STATE) cmDependsFortran_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + b = (YY_BUFFER_STATE) cmFortran_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in cmDependsFortran_yy_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; @@ -1997,33 +1997,33 @@ YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char * base, yy_size_t size , b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - cmDependsFortran_yy_switch_to_buffer(b ,yyscanner ); + cmFortran_yy_switch_to_buffer(b ,yyscanner ); return b; } -/** Setup the input buffer state to scan a string. The next call to cmDependsFortran_yylex() will +/** Setup the input buffer state to scan a string. The next call to cmFortran_yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * @param yyscanner The scanner object. * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use - * cmDependsFortran_yy_scan_bytes() instead. + * cmFortran_yy_scan_bytes() instead. */ -YY_BUFFER_STATE cmDependsFortran_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) +YY_BUFFER_STATE cmFortran_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) { - return cmDependsFortran_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); + return cmFortran_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); } -/** Setup the input buffer state to scan the given bytes. The next call to cmDependsFortran_yylex() will +/** Setup the input buffer state to scan the given bytes. The next call to cmFortran_yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE cmDependsFortran_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; @@ -2032,18 +2032,18 @@ YY_BUFFER_STATE cmDependsFortran_yy_scan_bytes (yyconst char * yybytes, int _y /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; - buf = (char *) cmDependsFortran_yyalloc(n ,yyscanner ); + buf = (char *) cmFortran_yyalloc(n ,yyscanner ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in cmDependsFortran_yy_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = cmDependsFortran_yy_scan_buffer(buf,n ,yyscanner); + b = cmFortran_yy_scan_buffer(buf,n ,yyscanner); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in cmDependsFortran_yy_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in cmFortran_yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -2085,7 +2085,7 @@ static void yy_fatal_error (yyconst char* msg , yyscan_t) /** Get the user-defined data for this scanner. * @param yyscanner The scanner object. */ -YY_EXTRA_TYPE cmDependsFortran_yyget_extra (yyscan_t yyscanner) +YY_EXTRA_TYPE cmFortran_yyget_extra (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyextra; @@ -2094,7 +2094,7 @@ YY_EXTRA_TYPE cmDependsFortran_yyget_extra (yyscan_t yyscanner) /** Get the current line number. * @param yyscanner The scanner object. */ -int cmDependsFortran_yyget_lineno (yyscan_t yyscanner) +int cmFortran_yyget_lineno (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -2107,7 +2107,7 @@ int cmDependsFortran_yyget_lineno (yyscan_t yyscanner) /** Get the current column number. * @param yyscanner The scanner object. */ -int cmDependsFortran_yyget_column (yyscan_t yyscanner) +int cmFortran_yyget_column (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -2120,7 +2120,7 @@ int cmDependsFortran_yyget_column (yyscan_t yyscanner) /** Get the input stream. * @param yyscanner The scanner object. */ -FILE *cmDependsFortran_yyget_in (yyscan_t yyscanner) +FILE *cmFortran_yyget_in (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyin; @@ -2129,7 +2129,7 @@ FILE *cmDependsFortran_yyget_in (yyscan_t yyscanner) /** Get the output stream. * @param yyscanner The scanner object. */ -FILE *cmDependsFortran_yyget_out (yyscan_t yyscanner) +FILE *cmFortran_yyget_out (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyout; @@ -2138,7 +2138,7 @@ FILE *cmDependsFortran_yyget_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -int cmDependsFortran_yyget_leng (yyscan_t yyscanner) +int cmFortran_yyget_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; @@ -2148,7 +2148,7 @@ int cmDependsFortran_yyget_leng (yyscan_t yyscanner) * @param yyscanner The scanner object. */ -char *cmDependsFortran_yyget_text (yyscan_t yyscanner) +char *cmFortran_yyget_text (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yytext; @@ -2158,7 +2158,7 @@ char *cmDependsFortran_yyget_text (yyscan_t yyscanner) * @param user_defined The data to be associated with this scanner. * @param yyscanner The scanner object. */ -void cmDependsFortran_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +void cmFortran_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyextra = user_defined ; @@ -2168,13 +2168,13 @@ void cmDependsFortran_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscan * @param line_number The line number to set. * @param yyscanner The scanner object. */ -void cmDependsFortran_yyset_lineno (int line_number , yyscan_t yyscanner) +void cmFortran_yyset_lineno (int line_number , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* lineno is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "cmDependsFortran_yyset_lineno called with no buffer" , yyscanner); + yy_fatal_error( "cmFortran_yyset_lineno called with no buffer" , yyscanner); yylineno = line_number; } @@ -2183,13 +2183,13 @@ void cmDependsFortran_yyset_lineno (int line_number , yyscan_t yyscanner) * @param column_no The column number to set. * @param yyscanner The scanner object. */ -void cmDependsFortran_yyset_column (int column_no , yyscan_t yyscanner) +void cmFortran_yyset_column (int column_no , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* column is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "cmDependsFortran_yyset_column called with no buffer" , yyscanner); + yy_fatal_error( "cmFortran_yyset_column called with no buffer" , yyscanner); yycolumn = column_no; } @@ -2198,27 +2198,27 @@ void cmDependsFortran_yyset_column (int column_no , yyscan_t yyscanner) * input buffer. * @param in_str A readable stream. * @param yyscanner The scanner object. - * @see cmDependsFortran_yy_switch_to_buffer + * @see cmFortran_yy_switch_to_buffer */ -void cmDependsFortran_yyset_in (FILE * in_str , yyscan_t yyscanner) +void cmFortran_yyset_in (FILE * in_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyin = in_str ; } -void cmDependsFortran_yyset_out (FILE * out_str , yyscan_t yyscanner) +void cmFortran_yyset_out (FILE * out_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyout = out_str ; } -int cmDependsFortran_yyget_debug (yyscan_t yyscanner) +int cmFortran_yyget_debug (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yy_flex_debug; } -void cmDependsFortran_yyset_debug (int bdebug , yyscan_t yyscanner) +void cmFortran_yyset_debug (int bdebug , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_flex_debug = bdebug ; @@ -2228,12 +2228,12 @@ void cmDependsFortran_yyset_debug (int bdebug , yyscan_t yyscanner) /* User-visible API */ -/* cmDependsFortran_yylex_init is special because it creates the scanner itself, so it is +/* cmFortran_yylex_init is special because it creates the scanner itself, so it is * the ONLY reentrant function that doesn't take the scanner as the last argument. * That's why we explicitly handle the declaration, instead of using our macros. */ -int cmDependsFortran_yylex_init(yyscan_t* ptr_yy_globals) +int cmFortran_yylex_init(yyscan_t* ptr_yy_globals) { if (ptr_yy_globals == NULL){ @@ -2241,7 +2241,7 @@ int cmDependsFortran_yylex_init(yyscan_t* ptr_yy_globals) return 1; } - *ptr_yy_globals = (yyscan_t) cmDependsFortran_yyalloc ( sizeof( struct yyguts_t ), NULL ); + *ptr_yy_globals = (yyscan_t) cmFortran_yyalloc ( sizeof( struct yyguts_t ), NULL ); if (*ptr_yy_globals == NULL){ errno = ENOMEM; @@ -2254,27 +2254,27 @@ int cmDependsFortran_yylex_init(yyscan_t* ptr_yy_globals) return yy_init_globals ( *ptr_yy_globals ); } -/* cmDependsFortran_yylex_init_extra has the same functionality as cmDependsFortran_yylex_init, but follows the +/* cmFortran_yylex_init_extra has the same functionality as cmFortran_yylex_init, but follows the * convention of taking the scanner as the last argument. Note however, that * this is a *pointer* to a scanner, as it will be allocated by this call (and * is the reason, too, why this function also must handle its own declaration). - * The user defined value in the first argument will be available to cmDependsFortran_yyalloc in + * The user defined value in the first argument will be available to cmFortran_yyalloc in * the yyextra field. */ -int cmDependsFortran_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) +int cmFortran_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) { struct yyguts_t dummy_yyguts; - cmDependsFortran_yyset_extra (yy_user_defined, &dummy_yyguts); + cmFortran_yyset_extra (yy_user_defined, &dummy_yyguts); if (ptr_yy_globals == NULL){ errno = EINVAL; return 1; } - *ptr_yy_globals = (yyscan_t) cmDependsFortran_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + *ptr_yy_globals = (yyscan_t) cmFortran_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); if (*ptr_yy_globals == NULL){ errno = ENOMEM; @@ -2285,7 +2285,7 @@ int cmDependsFortran_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* pt yy_init_globals. Leave at 0x00 for releases. */ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); - cmDependsFortran_yyset_extra (yy_user_defined, *ptr_yy_globals); + cmFortran_yyset_extra (yy_user_defined, *ptr_yy_globals); return yy_init_globals ( *ptr_yy_globals ); } @@ -2294,7 +2294,7 @@ static int yy_init_globals (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Initialization is the same as for the non-reentrant scanner. - * This function is called from cmDependsFortran_yylex_destroy(), so don't allocate here. + * This function is called from cmFortran_yylex_destroy(), so don't allocate here. */ yyg->yy_buffer_stack = 0; @@ -2318,37 +2318,37 @@ static int yy_init_globals (yyscan_t yyscanner) #endif /* For future reference: Set errno on error, since we are called by - * cmDependsFortran_yylex_init() + * cmFortran_yylex_init() */ return 0; } -/* cmDependsFortran_yylex_destroy is for both reentrant and non-reentrant scanners. */ -int cmDependsFortran_yylex_destroy (yyscan_t yyscanner) +/* cmFortran_yylex_destroy is for both reentrant and non-reentrant scanners. */ +int cmFortran_yylex_destroy (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - cmDependsFortran_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + cmFortran_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); YY_CURRENT_BUFFER_LVALUE = NULL; - cmDependsFortran_yypop_buffer_state(yyscanner); + cmFortran_yypop_buffer_state(yyscanner); } /* Destroy the stack itself. */ - cmDependsFortran_yyfree(yyg->yy_buffer_stack ,yyscanner); + cmFortran_yyfree(yyg->yy_buffer_stack ,yyscanner); yyg->yy_buffer_stack = NULL; /* Destroy the start condition stack. */ - cmDependsFortran_yyfree(yyg->yy_start_stack ,yyscanner ); + cmFortran_yyfree(yyg->yy_start_stack ,yyscanner ); yyg->yy_start_stack = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time - * cmDependsFortran_yylex() is called, initialization will occur. */ + * cmFortran_yylex() is called, initialization will occur. */ yy_init_globals( yyscanner); /* Destroy the main struct (reentrant only). */ - cmDependsFortran_yyfree ( yyscanner , yyscanner ); + cmFortran_yyfree ( yyscanner , yyscanner ); return 0; } @@ -2376,12 +2376,12 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) } #endif -void *cmDependsFortran_yyalloc (yy_size_t size , yyscan_t) +void *cmFortran_yyalloc (yy_size_t size , yyscan_t) { return (void *) malloc( size ); } -void *cmDependsFortran_yyrealloc (void * ptr, yy_size_t size , yyscan_t) +void *cmFortran_yyrealloc (void * ptr, yy_size_t size , yyscan_t) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those @@ -2393,22 +2393,21 @@ void *cmDependsFortran_yyrealloc (void * ptr, yy_size_t size , yyscan_t) return (void *) realloc( (char *) ptr, size ); } -void cmDependsFortran_yyfree (void * ptr , yyscan_t) +void cmFortran_yyfree (void * ptr , yyscan_t) { - free( (char *) ptr ); /* see cmDependsFortran_yyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see cmFortran_yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 181 "cmDependsFortranLexer.in.l" +#line 181 "cmFortranLexer.in.l" /*--------------------------------------------------------------------------*/ -YY_BUFFER_STATE cmDependsFortranLexer_GetCurrentBuffer(yyscan_t yyscanner) +YY_BUFFER_STATE cmFortranLexer_GetCurrentBuffer(yyscan_t yyscanner) { /* Hack into the internal flex-generated scanner to get the buffer. */ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return YY_CURRENT_BUFFER; } - diff --git a/Source/cmDependsFortranLexer.h b/Source/cmFortranLexer.h index 8e24cfd..c67e332 100644 --- a/Source/cmDependsFortranLexer.h +++ b/Source/cmFortranLexer.h @@ -9,9 +9,9 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef cmDependsFortran_yyHEADER_H -#define cmDependsFortran_yyHEADER_H 1 -#define cmDependsFortran_yyIN_HEADER 1 +#ifndef cmFortran_yyHEADER_H +#define cmFortran_yyHEADER_H 1 +#define cmFortran_yyIN_HEADER 1 #define YY_INT_ALIGNED short int @@ -211,25 +211,25 @@ struct yy_buffer_state }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ -void cmDependsFortran_yyrestart (FILE *input_file ,yyscan_t yyscanner ); -void cmDependsFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmDependsFortran_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); -void cmDependsFortran_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void cmDependsFortran_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void cmDependsFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -void cmDependsFortran_yypop_buffer_state (yyscan_t yyscanner ); +void cmFortran_yyrestart (FILE *input_file ,yyscan_t yyscanner ); +void cmFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmFortran_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void cmFortran_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void cmFortran_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void cmFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void cmFortran_yypop_buffer_state (yyscan_t yyscanner ); -YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmDependsFortran_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmDependsFortran_yy_scan_bytes (yyconst char *bytes,int len ,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 ); -void *cmDependsFortran_yyalloc (yy_size_t ,yyscan_t yyscanner ); -void *cmDependsFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); -void cmDependsFortran_yyfree (void * ,yyscan_t yyscanner ); +void *cmFortran_yyalloc (yy_size_t ,yyscan_t yyscanner ); +void *cmFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); +void cmFortran_yyfree (void * ,yyscan_t yyscanner ); /* Begin user sect3 */ -#define cmDependsFortran_yywrap(n) 1 +#define cmFortran_yywrap(n) 1 #define YY_SKIP_YYWRAP #define yytext_ptr yytext_r @@ -247,38 +247,38 @@ void cmDependsFortran_yyfree (void * ,yyscan_t yyscanner ); #define YY_EXTRA_TYPE void * #endif -int cmDependsFortran_yylex_init (yyscan_t* scanner); +int cmFortran_yylex_init (yyscan_t* scanner); -int cmDependsFortran_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); +int cmFortran_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int cmDependsFortran_yylex_destroy (yyscan_t yyscanner ); +int cmFortran_yylex_destroy (yyscan_t yyscanner ); -int cmDependsFortran_yyget_debug (yyscan_t yyscanner ); +int cmFortran_yyget_debug (yyscan_t yyscanner ); -void cmDependsFortran_yyset_debug (int debug_flag ,yyscan_t yyscanner ); +void cmFortran_yyset_debug (int debug_flag ,yyscan_t yyscanner ); -YY_EXTRA_TYPE cmDependsFortran_yyget_extra (yyscan_t yyscanner ); +YY_EXTRA_TYPE cmFortran_yyget_extra (yyscan_t yyscanner ); -void cmDependsFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); +void cmFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); -FILE *cmDependsFortran_yyget_in (yyscan_t yyscanner ); +FILE *cmFortran_yyget_in (yyscan_t yyscanner ); -void cmDependsFortran_yyset_in (FILE * in_str ,yyscan_t yyscanner ); +void cmFortran_yyset_in (FILE * in_str ,yyscan_t yyscanner ); -FILE *cmDependsFortran_yyget_out (yyscan_t yyscanner ); +FILE *cmFortran_yyget_out (yyscan_t yyscanner ); -void cmDependsFortran_yyset_out (FILE * out_str ,yyscan_t yyscanner ); +void cmFortran_yyset_out (FILE * out_str ,yyscan_t yyscanner ); -int cmDependsFortran_yyget_leng (yyscan_t yyscanner ); +int cmFortran_yyget_leng (yyscan_t yyscanner ); -char *cmDependsFortran_yyget_text (yyscan_t yyscanner ); +char *cmFortran_yyget_text (yyscan_t yyscanner ); -int cmDependsFortran_yyget_lineno (yyscan_t yyscanner ); +int cmFortran_yyget_lineno (yyscan_t yyscanner ); -void cmDependsFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); +void cmFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -286,9 +286,9 @@ void cmDependsFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int cmDependsFortran_yywrap (yyscan_t yyscanner ); +extern "C" int cmFortran_yywrap (yyscan_t yyscanner ); #else -extern int cmDependsFortran_yywrap (yyscan_t yyscanner ); +extern int cmFortran_yywrap (yyscan_t yyscanner ); #endif #endif @@ -325,9 +325,9 @@ static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int cmDependsFortran_yylex (yyscan_t yyscanner); +extern int cmFortran_yylex (yyscan_t yyscanner); -#define YY_DECL int cmDependsFortran_yylex (yyscan_t yyscanner) +#define YY_DECL int cmFortran_yylex (yyscan_t yyscanner) #endif /* !YY_DECL */ /* yy_get_previous_state - get the state just before the EOB char was reached */ @@ -344,5 +344,5 @@ extern int cmDependsFortran_yylex (yyscan_t yyscanner); #undef YY_DECL #endif -#undef cmDependsFortran_yyIN_HEADER -#endif /* cmDependsFortran_yyHEADER_H */ +#undef cmFortran_yyIN_HEADER +#endif /* cmFortran_yyHEADER_H */ diff --git a/Source/cmDependsFortranLexer.in.l b/Source/cmFortranLexer.in.l index 0148802..03fa90c 100644 --- a/Source/cmDependsFortranLexer.in.l +++ b/Source/cmFortranLexer.in.l @@ -26,18 +26,18 @@ This file must be translated to C and modified to build everywhere. Run flex like this: - flex -i --prefix=cmDependsFortran_yy --header-file=cmDependsFortranLexer.h -ocmDependsFortranLexer.cxx cmDependsFortranLexer.in.l + flex -i --prefix=cmFortran_yy --header-file=cmFortranLexer.h -ocmFortranLexer.cxx cmFortranLexer.in.l -Modify cmDependsFortranLexer.cxx: +Modify cmFortranLexer.cxx: - remove TABs - remove use of the 'register' storage class specifier - remove "yyscanner" argument from these methods: - yy_fatal_error, cmDependsFortran_yyalloc, cmDependsFortran_yyrealloc, cmDependsFortran_yyfree - - remove "yyscanner = NULL" from end of cmDependsFortran_yylex_destroy + yy_fatal_error, cmFortran_yyalloc, cmFortran_yyrealloc, cmFortran_yyfree + - remove "yyscanner = NULL" from end of cmFortran_yylex_destroy - remove all YY_BREAK lines occurring right after return statements - change while ( 1 ) to for(;;) -Modify cmDependsFortranLexer.h: +Modify cmFortranLexer.h: - remove TABs - remove the yy_init_globals function - remove the block that includes unistd.h @@ -47,16 +47,16 @@ Modify cmDependsFortranLexer.h: #include "cmStandardLexer.h" -#define cmDependsFortranLexer_cxx -#include "cmDependsFortranParser.h" /* Interface to parser object. */ +#define cmFortranLexer_cxx +#include "cmFortranParser.h" /* Interface to parser object. */ /* Replace the lexer input function. */ #undef YY_INPUT #define YY_INPUT(buf, result, max_size) \ - { result = cmDependsFortranParser_Input(yyextra, buf, max_size); } + { result = cmFortranParser_Input(yyextra, buf, max_size); } /* Include the set of tokens from the parser. */ -#include "cmDependsFortranParserTokens.h" +#include "cmFortranParserTokens.h" /*--------------------------------------------------------------------------*/ %} @@ -72,21 +72,21 @@ Modify cmDependsFortranLexer.h: %% \" { - cmDependsFortranParser_StringStart(yyextra); - cmDependsFortranParser_SetOldStartcond(yyextra, YY_START); + cmFortranParser_StringStart(yyextra); + cmFortranParser_SetOldStartcond(yyextra, YY_START); BEGIN(str_dq); } ' { - cmDependsFortranParser_StringStart(yyextra); - cmDependsFortranParser_SetOldStartcond(yyextra, YY_START); + cmFortranParser_StringStart(yyextra); + cmFortranParser_SetOldStartcond(yyextra, YY_START); BEGIN(str_sq); } <str_dq>\" | <str_sq>' { - BEGIN(cmDependsFortranParser_GetOldStartcond(yyextra) ); - yylvalp->string = strdup(cmDependsFortranParser_StringEnd(yyextra)); + BEGIN(cmFortranParser_GetOldStartcond(yyextra) ); + yylvalp->string = strdup(cmFortranParser_StringEnd(yyextra)); return STRING; } @@ -94,7 +94,7 @@ Modify cmDependsFortranLexer.h: <str_dq,str_sq>&[ \t]*\n[ \t]*& /* Ignore (continued strings, free fmt) */ <fixed_fmt,str_dq,str_sq>\n[ ]{5}[^ \t\n] { - if (cmDependsFortranParser_GetOldStartcond(yyextra) == fixed_fmt) + if (cmFortranParser_GetOldStartcond(yyextra) == fixed_fmt) ; /* Ignore (cont. strings, fixed fmt) */ else { @@ -110,7 +110,7 @@ Modify cmDependsFortranLexer.h: } <str_sq,str_dq>. { - cmDependsFortranParser_StringAppend(yyextra, yytext[0]); + cmFortranParser_StringAppend(yyextra, yytext[0]); } !.*\n { return EOSTMT; } /* Treat comments like */ @@ -173,7 +173,7 @@ $[ \t]*endif { return F90PPR_ENDIF; } . { return *yytext; } <<EOF>> { - if(!cmDependsFortranParser_FilePop(yyextra) ) + if(!cmFortranParser_FilePop(yyextra) ) { return YY_NULL; } @@ -182,7 +182,7 @@ $[ \t]*endif { return F90PPR_ENDIF; } %% /*--------------------------------------------------------------------------*/ -YY_BUFFER_STATE cmDependsFortranLexer_GetCurrentBuffer(yyscan_t yyscanner) +YY_BUFFER_STATE cmFortranLexer_GetCurrentBuffer(yyscan_t yyscanner) { /* Hack into the internal flex-generated scanner to get the buffer. */ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; diff --git a/Source/cmDependsFortranParser.cxx b/Source/cmFortranParser.cxx index 9d51025..0230f02 100644 --- a/Source/cmDependsFortranParser.cxx +++ b/Source/cmFortranParser.cxx @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 3.0.2. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.5" +#define YYBISON_VERSION "3.0.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -58,23 +58,17 @@ /* Pull parsers. */ #define YYPULL 1 -/* Using locations. */ -#define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ -#define yyparse cmDependsFortran_yyparse -#define yylex cmDependsFortran_yylex -#define yyerror cmDependsFortran_yyerror -#define yylval cmDependsFortran_yylval -#define yychar cmDependsFortran_yychar -#define yydebug cmDependsFortran_yydebug -#define yynerrs cmDependsFortran_yynerrs +#define yyparse cmFortran_yyparse +#define yylex cmFortran_yylex +#define yyerror cmFortran_yyerror +#define yydebug cmFortran_yydebug +#define yynerrs cmFortran_yynerrs /* Copy the first part of user declarations. */ - -/* Line 268 of yacc.c */ -#line 1 "cmDependsFortranParser.y" +#line 1 "cmFortranParser.y" /* yacc.c:339 */ /*============================================================================ CMake - Cross Platform Makefile Generator @@ -103,41 +97,33 @@ This file must be translated to C and modified to build everywhere. Run bison like this: - bison --yacc --name-prefix=cmDependsFortran_yy - --defines=cmDependsFortranParserTokens.h - -ocmDependsFortranParser.cxx - cmDependsFortranParser.y + bison --yacc --name-prefix=cmFortran_yy + --defines=cmFortranParserTokens.h + -ocmFortranParser.cxx + cmFortranParser.y -Modify cmDependsFortranParser.cxx: - - remove TABs - - Remove the yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"] +Modify cmFortranParser.cxx: + - "#if 0" out yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"] */ /*-------------------------------------------------------------------------*/ -#define cmDependsFortranParser_cxx -#include "cmDependsFortranParser.h" /* Interface to parser object. */ -#include "cmDependsFortranParserTokens.h" /* Need YYSTYPE for YY_DECL. */ +#define cmFortranParser_cxx +#include "cmFortranParser.h" /* Interface to parser object. */ +#include "cmFortranParserTokens.h" /* Need YYSTYPE for YY_DECL. */ #include <cmsys/String.h> -/* Configure the parser to use a lexer object. */ -#define YYPARSE_PARAM yyscanner -#define YYLEX_PARAM yyscanner -#define YYERROR_VERBOSE 1 -#define cmDependsFortran_yyerror(x) \ - cmDependsFortranError(yyscanner, x) - /* Forward declare the lexer entry point. */ YY_DECL; -/* Helper function to forward error callback. */ -static void cmDependsFortranError(yyscan_t yyscanner, const char* message) +/* Helper function to forward error callback from parser. */ +static void cmFortran_yyerror(yyscan_t yyscanner, const char* message) { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_Error(parser, message); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_Error(parser, message); } -static bool cmDependsFortranParserIsKeyword(const char* word, +static bool cmFortranParserIsKeyword(const char* word, const char* keyword) { return cmsysString_strcasecmp(word, keyword) == 0; @@ -153,65 +139,71 @@ static bool cmDependsFortranParserIsKeyword(const char* word, # pragma warning (disable: 4244) /* Conversion to smaller type, data loss. */ #endif +#line 143 "cmFortranParser.cxx" /* yacc.c:339 */ -/* Line 268 of yacc.c */ -#line 165 "cmDependsFortranParser.cxx" - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else -# define YYERROR_VERBOSE 0 +# define YYERROR_VERBOSE 1 #endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 +/* In a future release of Bison, this section will be replaced + by #include "cmFortranParserTokens.h". */ +#ifndef YY_CMFORTRAN_YY_CMFORTRANPARSERTOKENS_H_INCLUDED +# define YY_CMFORTRAN_YY_CMFORTRANPARSERTOKENS_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int cmFortran_yydebug; #endif - -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - 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 - }; + enum yytokentype + { + 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 + }; #endif /* Tokens. */ #define EOSTMT 258 @@ -244,34 +236,30 @@ static bool cmDependsFortranParserIsKeyword(const char* word, #define WORD 285 #define CPP_INCLUDE_ANGLE 286 - - - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE +typedef union YYSTYPE YYSTYPE; +union YYSTYPE { - -/* Line 293 of yacc.c */ -#line 89 "cmDependsFortranParser.y" +#line 81 "cmFortranParser.y" /* yacc.c:355 */ char* string; - - -/* Line 293 of yacc.c */ -#line 269 "cmDependsFortranParser.cxx" -} YYSTYPE; +#line 249 "cmFortranParser.cxx" /* yacc.c:355 */ +}; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif -/* Copy the second part of user declarations. */ +int cmFortran_yyparse (yyscan_t yyscanner); -/* Line 343 of yacc.c */ -#line 281 "cmDependsFortranParser.cxx" +#endif /* !YY_CMFORTRAN_YY_CMFORTRANPARSERTOKENS_H_INCLUDED */ + +/* Copy the second part of user declarations. */ + +#line 263 "cmFortranParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -285,11 +273,8 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; #else -typedef short int yytype_int8; +typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -309,8 +294,7 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# elif ! defined YYSIZE_T # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -324,38 +308,67 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ -# define YY_(msgid) msgid +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) +# define YYUSE(E) ((void) (E)) #else -# define YYUSE(e) /* empty */ +# define YYUSE(E) /* empty */ #endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") #else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) -#else -static int -YYID (yyi) - int yyi; +# define YY_INITIAL_VALUE(Value) Value #endif -{ - return yyi; -} +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + #if ! defined yyoverflow || YYERROR_VERBOSE @@ -374,9 +387,9 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif @@ -386,8 +399,8 @@ YYID (yyi) # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -411,15 +424,13 @@ YYID (yyi) # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -463,26 +474,26 @@ union yyalloc yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ - while (YYID (0)) + while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from FROM to TO. The source and destination do +/* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else -# define YYCOPY(To, From, Count) \ +# define YYCOPY(Dst, Src, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ + (Dst)[yyi] = (Src)[yyi]; \ } \ - while (YYID (0)) + while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ @@ -498,17 +509,19 @@ union yyalloc #define YYNNTS 16 /* YYNRULES -- Number of rules. */ #define YYNRULES 53 -/* YYNRULES -- Number of states. */ +/* YYNSTATES -- Number of states. */ #define YYNSTATES 97 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 286 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -543,52 +556,19 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = -{ - 0, 0, 3, 4, 7, 9, 11, 16, 19, 24, - 30, 38, 43, 47, 52, 57, 62, 67, 72, 76, - 80, 84, 88, 93, 97, 99, 101, 103, 105, 107, - 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, - 129, 131, 133, 135, 137, 139, 140, 143, 145, 147, - 149, 151, 153, 155 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 33, 0, -1, -1, 33, 34, -1, 36, -1, 35, - -1, 30, 4, 46, 3, -1, 30, 3, -1, 30, - 30, 46, 3, -1, 30, 26, 30, 46, 3, -1, - 30, 25, 30, 26, 30, 46, 3, -1, 30, 29, - 46, 3, -1, 31, 46, 3, -1, 37, 29, 46, - 3, -1, 38, 30, 46, 3, -1, 39, 30, 46, - 3, -1, 40, 30, 46, 3, -1, 41, 30, 46, - 3, -1, 42, 46, 3, -1, 43, 46, 3, -1, - 44, 46, 3, -1, 45, 46, 3, -1, 30, 5, - 46, 3, -1, 5, 46, 3, -1, 3, -1, 1, - -1, 6, -1, 7, -1, 8, -1, 10, -1, 9, - -1, 12, -1, 11, -1, 13, -1, 19, -1, 14, - -1, 20, -1, 15, -1, 21, -1, 17, -1, 23, - -1, 16, -1, 22, -1, 18, -1, 24, -1, -1, - 46, 47, -1, 30, -1, 29, -1, 5, -1, 4, - -1, 26, -1, 25, -1, 28, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 111, 111, 111, 113, 113, 115, 121, 131, 161, - 172, 185, 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 + 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 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +#if YYDEBUG || YYERROR_VERBOSE || 1 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -601,13 +581,13 @@ static const char *const yytname[] = "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", 0 + "ifndef", "if", "elif", "else", "endif", "other", "misc_code", YY_NULLPTR }; #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, @@ -617,31 +597,35 @@ static const yytype_uint16 yytoknum[] = }; # endif -/* 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 -}; +#define YYPACT_NINF -29 -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-29))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = { - 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, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, - 1, 1, 1, 1 + -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 }; -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ static const yytype_uint8 yydefact[] = { 2, 0, 1, 25, 24, 45, 26, 27, 28, 30, @@ -656,41 +640,23 @@ static const yytype_uint8 yydefact[] = 15, 16, 17, 45, 9, 0, 10 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = -{ - -1, 1, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 65 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -29 -static const yytype_int16 yypact[] = + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = { - -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 + -29, -29, -29, -29, -26, -29 }; -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = { - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -26, -29 + -1, 1, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 65 }; -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { 47, 48, 84, 49, 0, 57, 58, 59, 50, 53, @@ -723,12 +689,6 @@ static const yytype_uint8 yytable[] = 0, 43, 44, 0, 0, 45, 46 }; -#define yypact_value_is_default(yystate) \ - ((yystate) == (-29)) - -#define yytable_value_is_error(yytable_value) \ - YYID (0) - static const yytype_int8 yycheck[] = { 26, 29, 26, 30, -1, 3, 4, 5, 30, 35, @@ -761,8 +721,8 @@ static const yytype_int8 yycheck[] = -1, 25, 26, -1, -1, 29, 30 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ + /* 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, @@ -777,6 +737,29 @@ static const yytype_uint8 yystos[] = 3, 3, 3, 30, 3, 46, 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 +}; + + /* 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, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, + 1, 1, 1, 1 +}; + + #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) @@ -787,84 +770,30 @@ static const yytype_uint8 yystos[] = #define YYERROR goto yyerrorlab -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ - -#define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif - #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ - if (yychar == YYEMPTY && yylen == 1) \ + if (yychar == YYEMPTY) \ { \ yychar = (Token); \ yylval = (Value); \ - YYPOPSTACK (1); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ goto yybackup; \ } \ else \ { \ - yyerror (YY_("syntax error: cannot back up")); \ + yyerror (yyscanner, YY_("syntax error: cannot back up")); \ YYERROR; \ } \ -while (YYID (0)) - +while (0) +/* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* This macro is provided for backward compatibility. */ - -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, YYLEX_PARAM) -#else -# define YYLEX yylex (&yylval) -#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -878,7 +807,13 @@ while (YYID (0)) do { \ if (yydebug) \ YYFPRINTF Args; \ -} while (YYID (0)) +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ @@ -886,42 +821,29 @@ do { \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ - Type, Value); \ + Type, Value, yyscanner); \ YYFPRINTF (stderr, "\n"); \ } \ -} while (YYID (0)) +} while (0) -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner) { + FILE *yyo = yyoutput; + YYUSE (yyo); + YYUSE (yyscanner); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); # endif - switch (yytype) - { - default: - break; - } + YYUSE (yytype); } @@ -929,24 +851,13 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) | Print this symbol on YYOUTPUT. | `--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner) { - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - yy_symbol_value_print (yyoutput, yytype, yyvaluep); + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner); YYFPRINTF (yyoutput, ")"); } @@ -955,16 +866,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -979,36 +882,29 @@ yy_stack_print (yybottom, yytop) do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, yyscan_t yyscanner) { + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], &(yyvsp[(yyi + 1) - (yynrhs)]) - ); + , yyscanner); YYFPRINTF (stderr, "\n"); } } @@ -1016,8 +912,8 @@ yy_reduce_print (yyvsp, yyrule) # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) + yy_reduce_print (yyssp, yyvsp, Rule, yyscanner); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -1054,15 +950,8 @@ int yydebug; # define yystrlen strlen # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) @@ -1078,16 +967,8 @@ yystrlen (yystr) # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif { char *yyd = yydest; const char *yys = yysrc; @@ -1160,12 +1041,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = 0; + const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1173,10 +1053,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, int yycount = 0; /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> - for details. YYERROR is fine as it does not invoke this - function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected @@ -1225,11 +1101,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, break; } yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } } } } @@ -1249,10 +1127,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, # undef YYCASE_ } - yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } if (*yymsg_alloc < yysize) { @@ -1289,81 +1169,39 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, yyscan_t yyscanner) { YYUSE (yyvaluep); - + YYUSE (yyscanner); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - switch (yytype) - { - - default: - break; - } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ /*----------. | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void) -#else int -yyparse () - -#endif -#endif +yyparse (yyscan_t yyscanner) { /* The lookahead symbol. */ int yychar; + /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Number of syntax errors so far. */ int yynerrs; @@ -1373,10 +1211,10 @@ YYSTYPE yylval; int yyerrstatus; /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. + 'yyss': related to states. + 'yyvs': related to semantic values. - Refer to the stacks thru separate pointers, to allow yyoverflow + Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ @@ -1394,7 +1232,7 @@ YYSTYPE yylval; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken; + int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; @@ -1412,9 +1250,8 @@ YYSTYPE yylval; Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1423,14 +1260,6 @@ YYSTYPE yylval; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - yyssp = yyss; - yyvsp = yyvs; - goto yysetstate; /*------------------------------------------------------------. @@ -1531,7 +1360,7 @@ yybackup: if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (&yylval, yyscanner); } if (yychar <= YYEOF) @@ -1571,7 +1400,9 @@ yybackup: yychar = YYEMPTY; yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1594,7 +1425,7 @@ yyreduce: yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1608,249 +1439,228 @@ yyreduce: switch (yyn) { case 6: - -/* Line 1806 of yacc.c */ -#line 116 "cmDependsFortranParser.y" +#line 108 "cmFortranParser.y" /* yacc.c:1646 */ { - free((yyvsp[(1) - (4)].string)); + free((yyvsp[-3].string)); } +#line 1447 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 7: - -/* Line 1806 of yacc.c */ -#line 122 "cmDependsFortranParser.y" +#line 114 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (2)].string), "interface")) + if (cmFortranParserIsKeyword((yyvsp[-1].string), "interface")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_SetInInterface(parser, true); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); } - free((yyvsp[(1) - (2)].string)); + free((yyvsp[-1].string)); } +#line 1461 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 8: - -/* Line 1806 of yacc.c */ -#line 132 "cmDependsFortranParser.y" +#line 124 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "use")) + if (cmFortranParserIsKeyword((yyvsp[-3].string), "use")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleUse(parser, (yyvsp[(2) - (4)].string)); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); } - else if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "module")) + else if (cmFortranParserIsKeyword((yyvsp[-3].string), "module")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleModule(parser, (yyvsp[(2) - (4)].string)); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleModule(parser, (yyvsp[-2].string)); } - else if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "interface")) + else if (cmFortranParserIsKeyword((yyvsp[-3].string), "interface")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_SetInInterface(parser, true); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); } - else if (cmDependsFortranParserIsKeyword((yyvsp[(2) - (4)].string), "interface") && - cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "end")) + else if (cmFortranParserIsKeyword((yyvsp[-2].string), "interface") && + cmFortranParserIsKeyword((yyvsp[-3].string), "end")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_SetInInterface(parser, false); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, false); } - free((yyvsp[(1) - (4)].string)); - free((yyvsp[(2) - (4)].string)); + free((yyvsp[-3].string)); + free((yyvsp[-2].string)); } +#line 1495 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 9: - -/* Line 1806 of yacc.c */ -#line 162 "cmDependsFortranParser.y" +#line 154 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (5)].string), "use")) + if (cmFortranParserIsKeyword((yyvsp[-4].string), "use")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleUse(parser, (yyvsp[(3) - (5)].string)); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); } - free((yyvsp[(1) - (5)].string)); - free((yyvsp[(3) - (5)].string)); + free((yyvsp[-4].string)); + free((yyvsp[-2].string)); } +#line 1510 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 10: - -/* Line 1806 of yacc.c */ -#line 173 "cmDependsFortranParser.y" +#line 165 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (7)].string), "use") && - cmDependsFortranParserIsKeyword((yyvsp[(3) - (7)].string), "non_intrinsic") ) + if (cmFortranParserIsKeyword((yyvsp[-6].string), "use") && + cmFortranParserIsKeyword((yyvsp[-4].string), "non_intrinsic") ) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleUse(parser, (yyvsp[(5) - (7)].string)); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); } - free((yyvsp[(1) - (7)].string)); - free((yyvsp[(3) - (7)].string)); - free((yyvsp[(5) - (7)].string)); + free((yyvsp[-6].string)); + free((yyvsp[-4].string)); + free((yyvsp[-2].string)); } +#line 1527 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 11: - -/* Line 1806 of yacc.c */ -#line 186 "cmDependsFortranParser.y" +#line 178 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "include")) + if (cmFortranParserIsKeyword((yyvsp[-3].string), "include")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleInclude(parser, (yyvsp[(2) - (4)].string)); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); } - free((yyvsp[(1) - (4)].string)); - free((yyvsp[(2) - (4)].string)); + free((yyvsp[-3].string)); + free((yyvsp[-2].string)); } +#line 1542 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 12: - -/* Line 1806 of yacc.c */ -#line 197 "cmDependsFortranParser.y" +#line 189 "cmFortranParser.y" /* yacc.c:1646 */ { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleInclude(parser, (yyvsp[(1) - (3)].string)); - free((yyvsp[(1) - (3)].string)); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); + free((yyvsp[-2].string)); } +#line 1553 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 13: - -/* Line 1806 of yacc.c */ -#line 204 "cmDependsFortranParser.y" +#line 196 "cmFortranParser.y" /* yacc.c:1646 */ { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleInclude(parser, (yyvsp[(2) - (4)].string)); - free((yyvsp[(2) - (4)].string)); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); + free((yyvsp[-2].string)); } +#line 1564 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 14: - -/* Line 1806 of yacc.c */ -#line 211 "cmDependsFortranParser.y" +#line 203 "cmFortranParser.y" /* yacc.c:1646 */ { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleDefine(parser, (yyvsp[(2) - (4)].string)); - free((yyvsp[(2) - (4)].string)); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleDefine(parser, (yyvsp[-2].string)); + free((yyvsp[-2].string)); } +#line 1574 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 15: - -/* Line 1806 of yacc.c */ -#line 217 "cmDependsFortranParser.y" +#line 209 "cmFortranParser.y" /* yacc.c:1646 */ { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleUndef(parser, (yyvsp[(2) - (4)].string)); - free((yyvsp[(2) - (4)].string)); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUndef(parser, (yyvsp[-2].string)); + free((yyvsp[-2].string)); } +#line 1584 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 16: - -/* Line 1806 of yacc.c */ -#line 223 "cmDependsFortranParser.y" +#line 215 "cmFortranParser.y" /* yacc.c:1646 */ { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleIfdef(parser, (yyvsp[(2) - (4)].string)); - free((yyvsp[(2) - (4)].string)); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleIfdef(parser, (yyvsp[-2].string)); + free((yyvsp[-2].string)); } +#line 1594 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 17: - -/* Line 1806 of yacc.c */ -#line 229 "cmDependsFortranParser.y" +#line 221 "cmFortranParser.y" /* yacc.c:1646 */ { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleIfndef(parser, (yyvsp[(2) - (4)].string)); - free((yyvsp[(2) - (4)].string)); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleIfndef(parser, (yyvsp[-2].string)); + free((yyvsp[-2].string)); } +#line 1604 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 18: - -/* Line 1806 of yacc.c */ -#line 235 "cmDependsFortranParser.y" +#line 227 "cmFortranParser.y" /* yacc.c:1646 */ { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleIf(parser); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleIf(parser); } +#line 1613 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 19: - -/* Line 1806 of yacc.c */ -#line 240 "cmDependsFortranParser.y" +#line 232 "cmFortranParser.y" /* yacc.c:1646 */ { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleElif(parser); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleElif(parser); } +#line 1622 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 20: - -/* Line 1806 of yacc.c */ -#line 245 "cmDependsFortranParser.y" +#line 237 "cmFortranParser.y" /* yacc.c:1646 */ { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleElse(parser); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleElse(parser); } +#line 1631 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 21: - -/* Line 1806 of yacc.c */ -#line 250 "cmDependsFortranParser.y" +#line 242 "cmFortranParser.y" /* yacc.c:1646 */ { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleEndif(parser); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleEndif(parser); } +#line 1640 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 22: - -/* Line 1806 of yacc.c */ -#line 255 "cmDependsFortranParser.y" +#line 247 "cmFortranParser.y" /* yacc.c:1646 */ { - free((yyvsp[(1) - (4)].string)); + free((yyvsp[-3].string)); } +#line 1648 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 47: - -/* Line 1806 of yacc.c */ -#line 277 "cmDependsFortranParser.y" - { free ((yyvsp[(1) - (1)].string)); } +#line 269 "cmFortranParser.y" /* yacc.c:1646 */ + { free ((yyvsp[0].string)); } +#line 1654 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 48: - -/* Line 1806 of yacc.c */ -#line 278 "cmDependsFortranParser.y" - { free ((yyvsp[(1) - (1)].string)); } +#line 270 "cmFortranParser.y" /* yacc.c:1646 */ + { free ((yyvsp[0].string)); } +#line 1660 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - -/* Line 1806 of yacc.c */ -#line 1860 "cmDependsFortranParser.cxx" +#line 1664 "cmFortranParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1872,7 +1682,7 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1887,9 +1697,9 @@ yyreduce: goto yynewstate; -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ @@ -1900,7 +1710,7 @@ yyerrlab: { ++yynerrs; #if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); + yyerror (yyscanner, YY_("syntax error")); #else # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken) @@ -1927,7 +1737,7 @@ yyerrlab: yymsgp = yymsg; } } - yyerror (yymsgp); + yyerror (yyscanner, yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } @@ -1951,7 +1761,7 @@ yyerrlab: else { yydestruct ("Error: discarding", - yytoken, &yylval); + yytoken, &yylval, yyscanner); yychar = YYEMPTY; } } @@ -1973,7 +1783,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -2009,13 +1819,15 @@ yyerrlab1: yydestruct ("Error: popping", - yystos[yystate], yyvsp); + yystos[yystate], yyvsp, yyscanner); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -2039,12 +1851,12 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: - yyerror (YY_("memory exhausted")); + yyerror (yyscanner, YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif @@ -2056,16 +1868,16 @@ yyreturn: user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); + yytoken, &yylval, yyscanner); } - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + yystos[*yyssp], yyvsp, yyscanner); YYPOPSTACK (1); } #ifndef yyoverflow @@ -2076,13 +1888,8 @@ yyreturn: if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } - - - -/* Line 2067 of yacc.c */ -#line 286 "cmDependsFortranParser.y" +#line 278 "cmFortranParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h new file mode 100644 index 0000000..156c38a --- /dev/null +++ b/Source/cmFortranParser.h @@ -0,0 +1,175 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmFortranParser_h +#define cmFortranParser_h + +#if !defined(cmFortranLexer_cxx) && !defined(cmFortranParser_cxx) +# include "cmStandardIncludes.h" +#endif + +#include <stddef.h> /* size_t */ + +/* Forward declare parser object type. */ +typedef struct cmFortranParser_s cmFortranParser; + +/* Functions to enter/exit #include'd files in order. */ +bool cmFortranParser_FilePush(cmFortranParser* parser, + const char* fname); +bool cmFortranParser_FilePop(cmFortranParser* parser); + +/* Callbacks for lexer. */ +int cmFortranParser_Input(cmFortranParser* parser, + char* buffer, size_t bufferSize); + + +void cmFortranParser_StringStart(cmFortranParser* parser); +const char* cmFortranParser_StringEnd(cmFortranParser* parser); +void cmFortranParser_StringAppend(cmFortranParser* parser, + char c); + +void cmFortranParser_SetInInterface(cmFortranParser* parser, + bool is_in); +bool cmFortranParser_GetInInterface(cmFortranParser* parser); + + +void cmFortranParser_SetInPPFalseBranch(cmFortranParser* parser, + bool is_in); +bool cmFortranParser_GetInPPFalseBranch(cmFortranParser* parser); + + +void cmFortranParser_SetOldStartcond(cmFortranParser* parser, + int arg); +int cmFortranParser_GetOldStartcond(cmFortranParser* parser); + +/* Callbacks for parser. */ +void cmFortranParser_Error(cmFortranParser* parser, + const char* message); +void cmFortranParser_RuleUse(cmFortranParser* parser, + const char* name); +void cmFortranParser_RuleInclude(cmFortranParser* parser, + const char* name); +void cmFortranParser_RuleModule(cmFortranParser* parser, + const char* name); +void cmFortranParser_RuleDefine(cmFortranParser* parser, + const char* name); +void cmFortranParser_RuleUndef(cmFortranParser* parser, + const char* name); +void cmFortranParser_RuleIfdef(cmFortranParser* parser, + const char* name); +void cmFortranParser_RuleIfndef(cmFortranParser* parser, + const char* name); +void cmFortranParser_RuleIf(cmFortranParser* parser); +void cmFortranParser_RuleElif(cmFortranParser* parser); +void cmFortranParser_RuleElse(cmFortranParser* parser); +void cmFortranParser_RuleEndif(cmFortranParser* parser); + +/* Define the parser stack element type. */ +typedef union cmFortran_yystype_u cmFortran_yystype; +union cmFortran_yystype_u +{ + char* string; +}; + +/* Setup the proper yylex interface. */ +#define YY_EXTRA_TYPE cmFortranParser* +#define YY_DECL \ +int cmFortran_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) +#define YYSTYPE cmFortran_yystype +#define YYSTYPE_IS_DECLARED 1 +#if !defined(cmFortranLexer_cxx) +# include "cmFortranLexer.h" +#endif +#if !defined(cmFortranLexer_cxx) +#if !defined(cmFortranParser_cxx) +# undef YY_EXTRA_TYPE +# undef YY_DECL +# undef YYSTYPE +# undef YYSTYPE_IS_DECLARED +#endif +#endif + +#if !defined(cmFortranLexer_cxx) && !defined(cmFortranParser_cxx) +#include <stack> + +//---------------------------------------------------------------------------- +// Information about a single source file. +class cmFortranSourceInfo +{ +public: + // The name of the source file. + std::string Source; + + // Set of provided and required modules. + std::set<std::string> Provides; + std::set<std::string> Requires; + + // Set of files included in the translation unit. + std::set<std::string> Includes; +}; + +//---------------------------------------------------------------------------- +// Parser methods not included in generated interface. + +// Get the current buffer processed by the lexer. +YY_BUFFER_STATE cmFortranLexer_GetCurrentBuffer(yyscan_t yyscanner); + +// The parser entry point. +int cmFortran_yyparse(yyscan_t); + +//---------------------------------------------------------------------------- +// Define parser object internal structure. +struct cmFortranFile +{ + cmFortranFile(FILE* file, YY_BUFFER_STATE buffer, + const std::string& dir): + File(file), Buffer(buffer), Directory(dir) {} + FILE* File; + YY_BUFFER_STATE Buffer; + std::string Directory; +}; + +struct cmFortranParser_s +{ + cmFortranParser_s(std::vector<std::string> const& includes, + std::set<std::string> const& defines, + cmFortranSourceInfo& info); + ~cmFortranParser_s(); + + bool FindIncludeFile(const char* dir, const char* includeName, + std::string& fileName); + + // The include file search path. + std::vector<std::string> IncludePath; + + // Lexical scanner instance. + yyscan_t Scanner; + + // Stack of open files in the translation unit. + std::stack<cmFortranFile> FileStack; + + // Buffer for string literals. + std::string TokenString; + + // Flag for whether lexer is reading from inside an interface. + bool InInterface; + + int OldStartcond; + std::set<std::string> PPDefinitions; + size_t InPPFalseBranch; + std::stack<bool> SkipToEnd; + + // Information about the parsed source. + cmFortranSourceInfo& Info; +}; +#endif + +#endif diff --git a/Source/cmDependsFortranParser.y b/Source/cmFortranParser.y index a987c13..996bef6 100644 --- a/Source/cmDependsFortranParser.y +++ b/Source/cmFortranParser.y @@ -26,42 +26,33 @@ This file must be translated to C and modified to build everywhere. Run bison like this: - bison --yacc --name-prefix=cmDependsFortran_yy - --defines=cmDependsFortranParserTokens.h - -ocmDependsFortranParser.cxx - cmDependsFortranParser.y + bison --yacc --name-prefix=cmFortran_yy + --defines=cmFortranParserTokens.h + -ocmFortranParser.cxx + cmFortranParser.y -Modify cmDependsFortranParser.cxx: - - remove TABs - - remove use of the 'register' storage class specifier - - Remove the yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"] +Modify cmFortranParser.cxx: + - "#if 0" out yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"] */ /*-------------------------------------------------------------------------*/ -#define cmDependsFortranParser_cxx -#include "cmDependsFortranParser.h" /* Interface to parser object. */ -#include "cmDependsFortranParserTokens.h" /* Need YYSTYPE for YY_DECL. */ +#define cmFortranParser_cxx +#include "cmFortranParser.h" /* Interface to parser object. */ +#include "cmFortranParserTokens.h" /* Need YYSTYPE for YY_DECL. */ #include <cmsys/String.h> -/* Configure the parser to use a lexer object. */ -#define YYPARSE_PARAM yyscanner -#define YYLEX_PARAM yyscanner -#define YYERROR_VERBOSE 1 -#define cmDependsFortran_yyerror(x) \ - cmDependsFortranError(yyscanner, x) - /* Forward declare the lexer entry point. */ YY_DECL; -/* Helper function to forward error callback. */ -static void cmDependsFortranError(yyscan_t yyscanner, const char* message) +/* Helper function to forward error callback from parser. */ +static void cmFortran_yyerror(yyscan_t yyscanner, const char* message) { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_Error(parser, message); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_Error(parser, message); } -static bool cmDependsFortranParserIsKeyword(const char* word, +static bool cmFortranParserIsKeyword(const char* word, const char* keyword) { return cmsysString_strcasecmp(word, keyword) == 0; @@ -79,7 +70,13 @@ static bool cmDependsFortranParserIsKeyword(const char* word, %} /* Generate a reentrant parser object. */ -%pure-parser +%define api.pure + +/* Configure the parser to use a lexer object. */ +%lex-param {yyscan_t yyscanner} +%parse-param {yyscan_t yyscanner} + +%define parse.error verbose %union { char* string; @@ -115,63 +112,63 @@ assignment_stmt: WORD ASSIGNMENT_OP other EOSTMT /* Ignore */ keyword_stmt: WORD EOSTMT { - if (cmDependsFortranParserIsKeyword($1, "interface")) + if (cmFortranParserIsKeyword($1, "interface")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_SetInInterface(parser, true); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); } free($1); } | WORD WORD other EOSTMT { - if (cmDependsFortranParserIsKeyword($1, "use")) + if (cmFortranParserIsKeyword($1, "use")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleUse(parser, $2); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, $2); } - else if (cmDependsFortranParserIsKeyword($1, "module")) + else if (cmFortranParserIsKeyword($1, "module")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleModule(parser, $2); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleModule(parser, $2); } - else if (cmDependsFortranParserIsKeyword($1, "interface")) + else if (cmFortranParserIsKeyword($1, "interface")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_SetInInterface(parser, true); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); } - else if (cmDependsFortranParserIsKeyword($2, "interface") && - cmDependsFortranParserIsKeyword($1, "end")) + else if (cmFortranParserIsKeyword($2, "interface") && + cmFortranParserIsKeyword($1, "end")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_SetInInterface(parser, false); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, false); } free($1); free($2); } | WORD DCOLON WORD other EOSTMT { - if (cmDependsFortranParserIsKeyword($1, "use")) + if (cmFortranParserIsKeyword($1, "use")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleUse(parser, $3); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, $3); } free($1); free($3); } | WORD COMMA WORD DCOLON WORD other EOSTMT { - if (cmDependsFortranParserIsKeyword($1, "use") && - cmDependsFortranParserIsKeyword($3, "non_intrinsic") ) + if (cmFortranParserIsKeyword($1, "use") && + cmFortranParserIsKeyword($3, "non_intrinsic") ) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleUse(parser, $5); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, $5); } free($1); free($3); @@ -179,72 +176,72 @@ keyword_stmt: } | WORD STRING other EOSTMT /* Ignore */ { - if (cmDependsFortranParserIsKeyword($1, "include")) + if (cmFortranParserIsKeyword($1, "include")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleInclude(parser, $2); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, $2); } free($1); free($2); } | CPP_INCLUDE_ANGLE other EOSTMT { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleInclude(parser, $1); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, $1); free($1); } | include STRING other EOSTMT { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleInclude(parser, $2); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, $2); free($2); } | define WORD other EOSTMT { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleDefine(parser, $2); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleDefine(parser, $2); free($2); } | undef WORD other EOSTMT { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleUndef(parser, $2); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUndef(parser, $2); free($2); } | ifdef WORD other EOSTMT { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleIfdef(parser, $2); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleIfdef(parser, $2); free($2); } | ifndef WORD other EOSTMT { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleIfndef(parser, $2); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleIfndef(parser, $2); free($2); } | if other EOSTMT { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleIf(parser); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleIf(parser); } | elif other EOSTMT { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleElif(parser); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleElif(parser); } | else other EOSTMT { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleElse(parser); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleElse(parser); } | endif other EOSTMT { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleEndif(parser); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleEndif(parser); } | WORD GARBAGE other EOSTMT /* Ignore */ { diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx new file mode 100644 index 0000000..a09c5459 --- /dev/null +++ b/Source/cmFortranParserImpl.cxx @@ -0,0 +1,408 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmFortranParser.h" + +#include "cmSystemTools.h" +#include <assert.h> + +//---------------------------------------------------------------------------- +bool cmFortranParser_s::FindIncludeFile(const char* dir, + const char* includeName, + std::string& fileName) +{ + // If the file is a full path, include it directly. + if(cmSystemTools::FileIsFullPath(includeName)) + { + fileName = includeName; + return cmSystemTools::FileExists(fileName.c_str(), true); + } + else + { + // Check for the file in the directory containing the including + // file. + std::string fullName = dir; + fullName += "/"; + fullName += includeName; + if(cmSystemTools::FileExists(fullName.c_str(), true)) + { + fileName = fullName; + return true; + } + + // Search the include path for the file. + for(std::vector<std::string>::const_iterator i = + this->IncludePath.begin(); i != this->IncludePath.end(); ++i) + { + fullName = *i; + fullName += "/"; + fullName += includeName; + if(cmSystemTools::FileExists(fullName.c_str(), true)) + { + fileName = fullName; + return true; + } + } + } + return false; +} + +//---------------------------------------------------------------------------- +cmFortranParser_s +::cmFortranParser_s(std::vector<std::string> const& includes, + std::set<std::string> const& defines, + cmFortranSourceInfo& info): + IncludePath(includes), PPDefinitions(defines), Info(info) +{ + this->InInterface = 0; + this->InPPFalseBranch = 0; + + // Initialize the lexical scanner. + cmFortran_yylex_init(&this->Scanner); + cmFortran_yyset_extra(this, this->Scanner); + + // Create a dummy buffer that is never read but is the fallback + // buffer when the last file is popped off the stack. + YY_BUFFER_STATE buffer = + cmFortran_yy_create_buffer(0, 4, this->Scanner); + cmFortran_yy_switch_to_buffer(buffer, this->Scanner); +} + +//---------------------------------------------------------------------------- +cmFortranParser_s::~cmFortranParser_s() +{ + cmFortran_yylex_destroy(this->Scanner); +} + +//---------------------------------------------------------------------------- +bool cmFortranParser_FilePush(cmFortranParser* parser, + const char* fname) +{ + // Open the new file and push it onto the stack. Save the old + // buffer with it on the stack. + if(FILE* file = cmsys::SystemTools::Fopen(fname, "rb")) + { + YY_BUFFER_STATE current = + cmFortranLexer_GetCurrentBuffer(parser->Scanner); + std::string dir = cmSystemTools::GetParentDirectory(fname); + cmFortranFile f(file, current, dir); + YY_BUFFER_STATE buffer = + cmFortran_yy_create_buffer(0, 16384, parser->Scanner); + cmFortran_yy_switch_to_buffer(buffer, parser->Scanner); + parser->FileStack.push(f); + return 1; + } + else + { + return 0; + } +} + +//---------------------------------------------------------------------------- +bool cmFortranParser_FilePop(cmFortranParser* parser) +{ + // Pop one file off the stack and close it. Switch the lexer back + // to the next one on the stack. + if(parser->FileStack.empty()) + { + return 0; + } + else + { + cmFortranFile f = parser->FileStack.top(); parser->FileStack.pop(); + fclose(f.File); + YY_BUFFER_STATE current = + cmFortranLexer_GetCurrentBuffer(parser->Scanner); + cmFortran_yy_delete_buffer(current, parser->Scanner); + cmFortran_yy_switch_to_buffer(f.Buffer, parser->Scanner); + return 1; + } +} + +//---------------------------------------------------------------------------- +int cmFortranParser_Input(cmFortranParser* parser, + char* buffer, size_t bufferSize) +{ + // Read from the file on top of the stack. If the stack is empty, + // the end of the translation unit has been reached. + if(!parser->FileStack.empty()) + { + FILE* file = parser->FileStack.top().File; + return (int)fread(buffer, 1, bufferSize, file); + } + return 0; +} + +//---------------------------------------------------------------------------- +void cmFortranParser_StringStart(cmFortranParser* parser) +{ + parser->TokenString = ""; +} + +//---------------------------------------------------------------------------- +const char* cmFortranParser_StringEnd(cmFortranParser* parser) +{ + return parser->TokenString.c_str(); +} + +//---------------------------------------------------------------------------- +void cmFortranParser_StringAppend(cmFortranParser* parser, + char c) +{ + parser->TokenString += c; +} + +//---------------------------------------------------------------------------- +void cmFortranParser_SetInInterface(cmFortranParser* parser, + bool in) +{ + if(parser->InPPFalseBranch) + { + return; + } + + parser->InInterface = in; +} + +//---------------------------------------------------------------------------- +bool cmFortranParser_GetInInterface(cmFortranParser* parser) +{ + return parser->InInterface; +} + +//---------------------------------------------------------------------------- +void cmFortranParser_SetOldStartcond(cmFortranParser* parser, + int arg) +{ + parser->OldStartcond = arg; +} + +//---------------------------------------------------------------------------- +int cmFortranParser_GetOldStartcond(cmFortranParser* parser) +{ + return parser->OldStartcond; +} + +//---------------------------------------------------------------------------- +void cmFortranParser_Error(cmFortranParser*, const char*) +{ + // If there is a parser error just ignore it. The source will not + // compile and the user will edit it. Then dependencies will have + // to be regenerated anyway. +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleUse(cmFortranParser* parser, + const char* name) +{ + if(!parser->InPPFalseBranch) + { + parser->Info.Requires.insert(cmSystemTools::LowerCase(name) ); + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleInclude(cmFortranParser* parser, + const char* name) +{ + if(parser->InPPFalseBranch) + { + return; + } + + // If processing an include statement there must be an open file. + assert(!parser->FileStack.empty()); + + // Get the directory containing the source in which the include + // statement appears. This is always the first search location for + // Fortran include files. + std::string dir = parser->FileStack.top().Directory; + + // Find the included file. If it cannot be found just ignore the + // problem because either the source will not compile or the user + // does not care about depending on this included source. + std::string fullName; + if(parser->FindIncludeFile(dir.c_str(), name, fullName)) + { + // Found the included file. Save it in the set of included files. + parser->Info.Includes.insert(fullName); + + // Parse it immediately to translate the source inline. + cmFortranParser_FilePush(parser, fullName.c_str()); + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleModule(cmFortranParser* parser, + const char* name) +{ + if(!parser->InPPFalseBranch && !parser->InInterface) + { + parser->Info.Provides.insert(cmSystemTools::LowerCase(name)); + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleDefine(cmFortranParser* parser, + const char* macro) +{ + if(!parser->InPPFalseBranch) + { + parser->PPDefinitions.insert(macro); + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleUndef(cmFortranParser* parser, + const char* macro) +{ + if(!parser->InPPFalseBranch) + { + std::set<std::string>::iterator match; + match = parser->PPDefinitions.find(macro); + if(match != parser->PPDefinitions.end()) + { + parser->PPDefinitions.erase(match); + } + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleIfdef(cmFortranParser* parser, + const char* macro) +{ + // A new PP branch has been opened + parser->SkipToEnd.push(false); + + if (parser->InPPFalseBranch) + { + parser->InPPFalseBranch++; + } + else if(parser->PPDefinitions.find(macro) == parser->PPDefinitions.end()) + { + parser->InPPFalseBranch=1; + } + else + { + parser->SkipToEnd.top() = true; + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleIfndef(cmFortranParser* parser, + const char* macro) +{ + // A new PP branch has been opened + parser->SkipToEnd.push(false); + + if (parser->InPPFalseBranch) + { + parser->InPPFalseBranch++; + } + else if(parser->PPDefinitions.find(macro) != parser->PPDefinitions.end()) + { + parser->InPPFalseBranch = 1; + } + else + { + // ignore other branches + parser->SkipToEnd.top() = true; + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleIf(cmFortranParser* parser) +{ + /* Note: The current parser is _not_ able to get statements like + * #if 0 + * #if 1 + * #if MYSMBOL + * #if defined(MYSYMBOL) + * #if defined(MYSYMBOL) && ... + * right. The same for #elif. Thus in + * #if SYMBOL_1 + * .. + * #elif SYMBOL_2 + * ... + * ... + * #elif SYMBOL_N + * .. + * #else + * .. + * #endif + * _all_ N+1 branches are considered. If you got something like this + * #if defined(MYSYMBOL) + * #if !defined(MYSYMBOL) + * use + * #ifdef MYSYMBOL + * #ifndef MYSYMBOL + * instead. + */ + + // A new PP branch has been opened + // Never skip! See note above. + parser->SkipToEnd.push(false); +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleElif(cmFortranParser* parser) +{ + /* Note: There are parser limitations. See the note at + * cmFortranParser_RuleIf(..) + */ + + // Always taken unless an #ifdef or #ifndef-branch has been taken + // already. If the second condition isn't meet already + // (parser->InPPFalseBranch == 0) correct it. + if(!parser->SkipToEnd.empty() && + parser->SkipToEnd.top() && !parser->InPPFalseBranch) + { + parser->InPPFalseBranch = 1; + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleElse(cmFortranParser* parser) +{ + // if the parent branch is false do nothing! + if(parser->InPPFalseBranch > 1) + { + return; + } + + // parser->InPPFalseBranch is either 0 or 1. We change it depending on + // parser->SkipToEnd.top() + if(!parser->SkipToEnd.empty() && + parser->SkipToEnd.top()) + { + parser->InPPFalseBranch = 1; + } + else + { + parser->InPPFalseBranch = 0; + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleEndif(cmFortranParser* parser) +{ + if(!parser->SkipToEnd.empty()) + { + parser->SkipToEnd.pop(); + } + + // #endif doesn't know if there was a "#else" in before, so it + // always decreases InPPFalseBranch + if(parser->InPPFalseBranch) + { + parser->InPPFalseBranch--; + } +} diff --git a/Source/cmDependsFortranParserTokens.h b/Source/cmFortranParserTokens.h index 941eda0..df1aec3 100644 --- a/Source/cmDependsFortranParserTokens.h +++ b/Source/cmFortranParserTokens.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 3.0.2. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,43 +30,51 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +#ifndef YY_CMFORTRAN_YY_CMFORTRANPARSERTOKENS_H_INCLUDED +# define YY_CMFORTRAN_YY_CMFORTRANPARSERTOKENS_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int cmFortran_yydebug; +#endif -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - 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 - }; + enum yytokentype + { + 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 + }; #endif /* Tokens. */ #define EOSTMT 258 @@ -99,24 +107,23 @@ #define WORD 285 #define CPP_INCLUDE_ANGLE 286 - - - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE +typedef union YYSTYPE YYSTYPE; +union YYSTYPE { - -/* Line 2068 of yacc.c */ -#line 89 "cmDependsFortranParser.y" +#line 81 "cmFortranParser.y" /* yacc.c:1909 */ char* string; - - -/* Line 2068 of yacc.c */ -#line 118 "cmDependsFortranParserTokens.h" -} YYSTYPE; +#line 120 "cmFortranParserTokens.h" /* yacc.c:1909 */ +}; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif + + + +int cmFortran_yyparse (yyscan_t yyscanner); + +#endif /* !YY_CMFORTRAN_YY_CMFORTRANPARSERTOKENS_H_INCLUDED */ diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 78853ce..c883ad7 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -125,7 +125,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass std::string argvDef = cmJoin(expandedArgs, ";"); std::vector<std::string>::const_iterator eit = expandedArgs.begin() + (this->Args.size()-1); - std::string argnDef = cmJoin(cmRange(eit, expandedArgs.end()), ";"); + std::string argnDef = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";"); this->Makefile->AddDefinition("ARGV", argvDef.c_str()); this->Makefile->MarkVariableAsUsed("ARGV"); this->Makefile->AddDefinition("ARGN", argnDef.c_str()); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2b7c1b2..5599854 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1437,8 +1437,10 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() { cmMakefile *mf = this->LocalGenerators[i]->GetMakefile(); - const std::vector<cmValueWithOrigin> noconfig_compile_definitions = + const cmStringRange noconfig_compile_definitions = mf->GetCompileDefinitionsEntries(); + const cmBacktraceRange noconfig_compile_definitions_bts = + mf->GetCompileDefinitionsBacktraces(); cmTargets& targets = mf->GetTargets(); for(cmTargets::iterator ti = targets.begin(); @@ -1457,11 +1459,13 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() continue; } - for (std::vector<cmValueWithOrigin>::const_iterator it + cmBacktraceRange::const_iterator btIt + = noconfig_compile_definitions_bts.begin(); + for (cmStringRange::const_iterator it = noconfig_compile_definitions.begin(); - it != noconfig_compile_definitions.end(); ++it) + it != noconfig_compile_definitions.end(); ++it, ++btIt) { - t->InsertCompileDefinition(*it); + t->InsertCompileDefinition(*it, *btIt); } cmPolicies::PolicyStatus polSt diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index f96b4a8..6041fb7 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -247,7 +247,7 @@ bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args) { listString += ";"; } - listString += cmJoin(cmRange(args).advance(2), ";"); + listString += cmJoin(cmMakeRange(args).advance(2), ";"); this->Makefile->AddDefinition(listName, listString.c_str()); return true; @@ -361,9 +361,9 @@ bool cmListCommand std::vector<std::string>::const_iterator remBegin = remove.begin(); std::vector<std::string>::const_iterator argsEnd = - cmRemoveMatching(varArgsExpanded, cmRange(remBegin, remEnd)); + cmRemoveMatching(varArgsExpanded, cmMakeRange(remBegin, remEnd)); std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin(); - std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";"); + std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";"); this->Makefile->AddDefinition(listName, value.c_str()); return true; } @@ -421,7 +421,7 @@ bool cmListCommand cmRemoveDuplicates(varArgsExpanded); std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin(); - std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";"); + std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";"); this->Makefile->AddDefinition(listName, value.c_str()); return true; @@ -509,9 +509,9 @@ bool cmListCommand::HandleRemoveAtCommand( std::vector<size_t>::const_iterator remBegin = removed.begin(); std::vector<std::string>::const_iterator argsEnd = - cmRemoveIndices(varArgsExpanded, cmRange(remBegin, remEnd)); + cmRemoveIndices(varArgsExpanded, cmMakeRange(remBegin, remEnd)); std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin(); - std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";"); + std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";"); this->Makefile->AddDefinition(listName, value.c_str()); return true; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index de86c6b..98bd0ab 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2257,7 +2257,7 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p, std::string()); std::vector<std::string>::const_iterator compStart = components.begin() + 1; - result += cmJoin(cmRange(compStart, compEnd), slash); + result += cmJoin(cmMakeRange(compStart, compEnd), slash); // Only the last component can be empty to avoid double slashes. result += slash; result += components.back(); diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index fa5a623..e4026b0 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -107,7 +107,7 @@ bool cmMacroHelperCommand::InvokeInitialPass std::vector<std::string>::const_iterator eit = expandedArgs.begin() + (this->Args.size() - 1); - std::string expandedArgn = cmJoin(cmRange(eit, expandedArgs.end()), ";"); + std::string expandedArgn = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";"); std::string expandedArgv = cmJoin(expandedArgs, ";"); std::vector<std::string> variables; variables.reserve(this->Args.size() - 1); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ae69b24..57e33df 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -273,6 +273,38 @@ void cmMakefile::IssueMessage(cmake::MessageType t, } } +cmStringRange cmMakefile::GetIncludeDirectoriesEntries() const +{ + return this->StateSnapshot.GetDirectory().GetIncludeDirectoriesEntries(); +} + +cmBacktraceRange cmMakefile::GetIncludeDirectoriesBacktraces() const +{ + return this->StateSnapshot.GetDirectory() + .GetIncludeDirectoriesEntryBacktraces(); +} + +cmStringRange cmMakefile::GetCompileOptionsEntries() const +{ + return this->StateSnapshot.GetDirectory().GetCompileOptionsEntries(); +} + +cmBacktraceRange cmMakefile::GetCompileOptionsBacktraces() const +{ + return this->StateSnapshot.GetDirectory().GetCompileOptionsEntryBacktraces(); +} + +cmStringRange cmMakefile::GetCompileDefinitionsEntries() const +{ + return this->StateSnapshot.GetDirectory().GetCompileDefinitionsEntries(); +} + +cmBacktraceRange cmMakefile::GetCompileDefinitionsBacktraces() const +{ + return this->StateSnapshot.GetDirectory() + .GetCompileDefinitionsEntryBacktraces(); +} + //---------------------------------------------------------------------------- cmListFileBacktrace cmMakefile::GetBacktrace() const { @@ -307,10 +339,21 @@ void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const std::ostringstream msg; msg << this->GetExecutionFilePath() << "(" << lff.Line << "): "; msg << lff.Name << "("; + bool expand = this->GetCMakeInstance()->GetTraceExpand(); + std::string temp; for(std::vector<cmListFileArgument>::const_iterator i = lff.Arguments.begin(); i != lff.Arguments.end(); ++i) { - msg << i->Value; + if (expand) + { + temp = i->Value; + this->ExpandVariablesInString(temp); + msg << temp; + } + else + { + msg << i->Value; + } msg << " "; } msg << ")"; @@ -1427,7 +1470,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) std::remove(defs.begin(), defs.end(), define); std::vector<std::string>::const_iterator defBegin = defs.begin(); - std::string ndefs = cmJoin(cmRange(defBegin, defEnd), ";"); + std::string ndefs = cmJoin(cmMakeRange(defBegin, defEnd), ";"); // Store the new list. this->SetProperty("COMPILE_DEFINITIONS", ndefs.c_str()); @@ -1522,29 +1565,13 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent) // Initialize definitions with the closure of the parent scope. this->Internal->InitializeDefinitions(parent); + this->StateSnapshot.InitializeFromParent(); + this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", this->GetCurrentSourceDirectory()); this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", this->GetCurrentBinaryDirectory()); - const std::vector<cmValueWithOrigin>& parentIncludes = - parent->GetIncludeDirectoriesEntries(); - this->IncludeDirectoriesEntries.insert(this->IncludeDirectoriesEntries.end(), - parentIncludes.begin(), - parentIncludes.end()); - - const std::vector<cmValueWithOrigin>& parentOptions = - parent->GetCompileOptionsEntries(); - this->CompileOptionsEntries.insert(this->CompileOptionsEntries.end(), - parentOptions.begin(), - parentOptions.end()); - - const std::vector<cmValueWithOrigin>& parentDefines = - parent->GetCompileDefinitionsEntries(); - this->CompileDefinitionsEntries.insert(this->CompileDefinitionsEntries.end(), - parentDefines.begin(), - parentDefines.end()); - this->SystemIncludeDirectories = parent->SystemIncludeDirectories; // define flags @@ -1887,20 +1914,25 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs, return; } - std::vector<cmValueWithOrigin>::iterator position = - before ? this->IncludeDirectoriesEntries.begin() - : this->IncludeDirectoriesEntries.end(); - cmListFileBacktrace lfbt = this->GetBacktrace(); - cmValueWithOrigin entry(cmJoin(incs, ";"), lfbt); - this->IncludeDirectoriesEntries.insert(position, entry); + std::string entryString = cmJoin(incs, ";"); + if (before) + { + this->StateSnapshot.GetDirectory() + .PrependIncludeDirectoriesEntry(entryString, lfbt); + } + else + { + this->StateSnapshot.GetDirectory() + .AppendIncludeDirectoriesEntry(entryString, lfbt); + } // Property on each target: for (cmTargets::iterator l = this->Targets.begin(); l != this->Targets.end(); ++l) { cmTarget &t = l->second; - t.InsertInclude(entry, before); + t.InsertInclude(entryString, lfbt, before); } } @@ -4119,37 +4151,35 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) { if (prop == "INCLUDE_DIRECTORIES") { - this->IncludeDirectoriesEntries.clear(); if (!value) { + this->StateSnapshot.GetDirectory().ClearIncludeDirectories(); return; } cmListFileBacktrace lfbt = this->GetBacktrace(); - this->IncludeDirectoriesEntries.push_back( - cmValueWithOrigin(value, lfbt)); + this->StateSnapshot.GetDirectory().SetIncludeDirectories(value, lfbt); return; } if (prop == "COMPILE_OPTIONS") { - this->CompileOptionsEntries.clear(); if (!value) { + this->StateSnapshot.GetDirectory().ClearCompileOptions(); return; } cmListFileBacktrace lfbt = this->GetBacktrace(); - this->CompileOptionsEntries.push_back(cmValueWithOrigin(value, lfbt)); + this->StateSnapshot.GetDirectory().SetCompileOptions(value, lfbt); return; } if (prop == "COMPILE_DEFINITIONS") { - this->CompileDefinitionsEntries.clear(); if (!value) { + this->StateSnapshot.GetDirectory().ClearCompileDefinitions(); return; } cmListFileBacktrace lfbt = this->GetBacktrace(); - cmValueWithOrigin entry(value, lfbt); - this->CompileDefinitionsEntries.push_back(entry); + this->StateSnapshot.GetDirectory().SetCompileDefinitions(value, lfbt); return; } @@ -4163,22 +4193,21 @@ void cmMakefile::AppendProperty(const std::string& prop, if (prop == "INCLUDE_DIRECTORIES") { cmListFileBacktrace lfbt = this->GetBacktrace(); - this->IncludeDirectoriesEntries.push_back( - cmValueWithOrigin(value, lfbt)); + this->StateSnapshot.GetDirectory().AppendIncludeDirectoriesEntry(value, + lfbt); return; } if (prop == "COMPILE_OPTIONS") { cmListFileBacktrace lfbt = this->GetBacktrace(); - this->CompileOptionsEntries.push_back( - cmValueWithOrigin(value, lfbt)); + this->StateSnapshot.GetDirectory().AppendCompileOptionsEntry(value, lfbt); return; } if (prop == "COMPILE_DEFINITIONS") { cmListFileBacktrace lfbt = this->GetBacktrace(); - this->CompileDefinitionsEntries.push_back( - cmValueWithOrigin(value, lfbt)); + this->StateSnapshot.GetDirectory().AppendCompileDefinitionsEntry(value, + lfbt); return; } @@ -4233,44 +4262,20 @@ const char *cmMakefile::GetProperty(const std::string& prop, } else if (prop == "INCLUDE_DIRECTORIES") { - std::string sep; - for (std::vector<cmValueWithOrigin>::const_iterator - it = this->IncludeDirectoriesEntries.begin(), - end = this->IncludeDirectoriesEntries.end(); - it != end; ++it) - { - output += sep; - output += it->Value; - sep = ";"; - } + output = cmJoin(this->StateSnapshot.GetDirectory() + .GetIncludeDirectoriesEntries(), ";"); return output.c_str(); } else if (prop == "COMPILE_OPTIONS") { - std::string sep; - for (std::vector<cmValueWithOrigin>::const_iterator - it = this->CompileOptionsEntries.begin(), - end = this->CompileOptionsEntries.end(); - it != end; ++it) - { - output += sep; - output += it->Value; - sep = ";"; - } + output = cmJoin(this->StateSnapshot.GetDirectory() + .GetCompileOptionsEntries(), ";"); return output.c_str(); } else if (prop == "COMPILE_DEFINITIONS") { - std::string sep; - for (std::vector<cmValueWithOrigin>::const_iterator - it = this->CompileDefinitionsEntries.begin(), - end = this->CompileDefinitionsEntries.end(); - it != end; ++it) - { - output += sep; - output += it->Value; - sep = ";"; - } + output = cmJoin(this->StateSnapshot.GetDirectory() + .GetCompileDefinitionsEntries(), ";"); return output.c_str(); } @@ -4742,53 +4747,30 @@ const char* cmMakefile::GetDefineFlagsCMP0059() const cmPolicies::PolicyStatus cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const { - // Get the current setting of the policy. - cmPolicies::PolicyStatus cur = this->GetPolicyStatusInternal(id); + cmPolicies::PolicyStatus status = cmPolicies::GetPolicyStatus(id); - // If the policy is required to be set to NEW but is not, ignore the - // current setting and tell the caller. - if(cur != cmPolicies::NEW) + if(status == cmPolicies::REQUIRED_ALWAYS || + status == cmPolicies::REQUIRED_IF_USED) { - if(cur == cmPolicies::REQUIRED_ALWAYS || - cur == cmPolicies::REQUIRED_IF_USED) - { - return cur; - } - cmPolicies::PolicyStatus def = cmPolicies::GetPolicyStatus(id); - if(def == cmPolicies::REQUIRED_ALWAYS || - def == cmPolicies::REQUIRED_IF_USED) - { - return def; - } + return status; } - // The current setting is okay. - return cur; -} - -//---------------------------------------------------------------------------- -cmPolicies::PolicyStatus -cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const -{ - // Is the policy set in our stack? - for(PolicyStackType::const_reverse_iterator psi = this->PolicyStack.rbegin(); - psi != this->PolicyStack.rend(); ++psi) + cmLocalGenerator* lg = this->LocalGenerator; + while(lg) { - if(psi->IsDefined(id)) + cmMakefile const* mf = lg->GetMakefile(); + for(PolicyStackType::const_reverse_iterator psi = + mf->PolicyStack.rbegin(); psi != mf->PolicyStack.rend(); ++psi) { - return psi->Get(id); + if(psi->IsDefined(id)) + { + status = psi->Get(id); + return status; + } } + lg = lg->GetParent(); } - - // If we have a parent directory, recurse up to it. - if(this->LocalGenerator->GetParent()) - { - cmMakefile* parent = this->LocalGenerator->GetParent()->GetMakefile(); - return parent->GetPolicyStatusInternal(id); - } - - // The policy is not set. Use the default for this CMake version. - return cmPolicies::GetPolicyStatus(id); + return status; } //---------------------------------------------------------------------------- @@ -4802,7 +4784,8 @@ bool cmMakefile::PolicyOptionalWarningEnabled(std::string const& var) return cmSystemTools::IsOn(val); } } - // Enable optional policy warnings with --debug-output or --trace. + // Enable optional policy warnings with --debug-output, --trace, + // or --trace-expand. cmake* cm = this->GetCMakeInstance(); return cm->GetDebugOutput() || cm->GetTrace(); } @@ -4845,25 +4828,6 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, previous_was_weak = psi->Weak; } - // Special hook for presenting compatibility variable as soon as - // the user requests it. - if(id == cmPolicies::CMP0001 && - (status == cmPolicies::WARN || status == cmPolicies::OLD)) - { - if(!(this->GetState() - ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))) - { - // Set it to 2.4 because that is the last version where the - // variable had meaning. - this->AddCacheDefinition - ("CMAKE_BACKWARDS_COMPATIBILITY", "2.4", - "For backwards compatibility, what version of CMake " - "commands and " - "syntax should this version of CMake try to support.", - cmState::STRING); - } - } - return true; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index f5cd74d..7938fcc 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -22,6 +22,7 @@ #include "cmExpandedCommandArgument.h" #include "cmake.h" #include "cmState.h" +#include "cmAlgorithms.h" #if defined(CMAKE_BUILD_WITH_CMAKE) #include "cmSourceGroup.h" @@ -750,18 +751,12 @@ public: /** Set whether or not to report a CMP0000 violation. */ void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; } - const std::vector<cmValueWithOrigin>& GetIncludeDirectoriesEntries() const - { - return this->IncludeDirectoriesEntries; - } - const std::vector<cmValueWithOrigin>& GetCompileOptionsEntries() const - { - return this->CompileOptionsEntries; - } - const std::vector<cmValueWithOrigin>& GetCompileDefinitionsEntries() const - { - return this->CompileDefinitionsEntries; - } + cmStringRange GetIncludeDirectoriesEntries() const; + cmBacktraceRange GetIncludeDirectoriesBacktraces() const; + cmStringRange GetCompileOptionsEntries() const; + cmBacktraceRange GetCompileOptionsBacktraces() const; + cmStringRange GetCompileDefinitionsEntries() const; + cmBacktraceRange GetCompileDefinitionsBacktraces() const; bool IsConfigured() const { return this->Configured; } void SetConfigured(){ this->Configured = true; } @@ -855,10 +850,6 @@ protected: std::vector<std::string> HeaderFileExtensions; std::string DefineFlags; - std::vector<cmValueWithOrigin> IncludeDirectoriesEntries; - std::vector<cmValueWithOrigin> CompileOptionsEntries; - std::vector<cmValueWithOrigin> CompileDefinitionsEntries; - // Track the value of the computed DEFINITIONS property. void AddDefineFlag(const char*, std::string&); void RemoveDefineFlag(const char*, std::string::size_type, std::string&); @@ -942,8 +933,6 @@ private: typedef std::vector<PolicyStackEntry> PolicyStackType; PolicyStackType PolicyStack; std::vector<PolicyStackType::size_type> PolicyBarriers; - cmPolicies::PolicyStatus - GetPolicyStatusInternal(cmPolicies::PolicyID id) const; // CMP0053 == old cmake::MessageType ExpandVariablesInStringOld( diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index 0449c50..2854a82 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -69,7 +69,7 @@ bool cmMessageCommand ++i; } - std::string message = cmJoin(cmRange(i, args.end()), std::string()); + std::string message = cmJoin(cmMakeRange(i, args.end()), std::string()); if (type != cmake::MESSAGE) { diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 1479d0b..addf292 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -546,22 +546,39 @@ cmNinjaTargetGenerator ::WriteObjectBuildStatement( cmSourceFile const* source, bool writeOrderDependsTargetForTarget) { + std::string const language = source->GetLanguage(); + std::string const sourceFileName = + language=="RC" ? source->GetFullPath() : this->GetSourceFilePath(source); + std::string const objectDir = this->Target->GetSupportDirectory(); + std::string const objectFileName = this->GetObjectFilePath(source); + std::string const objectFileDir = + cmSystemTools::GetFilenamePath(objectFileName); + + cmNinjaVars vars; + vars["FLAGS"] = this->ComputeFlagsForObject(source, language); + vars["DEFINES"] = this->ComputeDefines(source, language); + vars["INCLUDES"] = this->GetIncludes(language); + if (!this->NeedDepTypeMSVC(language)) + { + vars["DEP_FILE"] = + cmGlobalNinjaGenerator::EncodeDepfileSpace(objectFileName + ".d"); + } + + this->ExportObjectCompileCommand( + language, sourceFileName, + objectDir, objectFileName, objectFileDir, + vars["FLAGS"], vars["DEFINES"], vars["INCLUDES"] + ); + std::string comment; - const std::string language = source->GetLanguage(); std::string rule = this->LanguageCompilerRule(language); cmNinjaDeps outputs; - std::string objectFileName = this->GetObjectFilePath(source); outputs.push_back(objectFileName); // Add this object to the list of object files. this->Objects.push_back(objectFileName); cmNinjaDeps explicitDeps; - std::string sourceFileName; - if (language == "RC") - sourceFileName = source->GetFullPath(); - else - sourceFileName = this->GetSourceFilePath(source); explicitDeps.push_back(sourceFileName); cmNinjaDeps implicitDeps; @@ -596,21 +613,11 @@ cmNinjaTargetGenerator orderOnlyDeps); } - cmNinjaVars vars; - vars["FLAGS"] = this->ComputeFlagsForObject(source, language); - vars["DEFINES"] = this->ComputeDefines(source, language); - vars["INCLUDES"] = this->GetIncludes(language); - if (!this->NeedDepTypeMSVC(language)) { - vars["DEP_FILE"] = - cmGlobalNinjaGenerator::EncodeDepfileSpace(objectFileName + ".d"); - } EnsureParentDirectoryExists(objectFileName); - std::string objectDir = this->Target->GetSupportDirectory(); vars["OBJECT_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat( ConvertToNinjaPath(objectDir), cmLocalGenerator::SHELL); - std::string objectFileDir = cmSystemTools::GetFilenamePath(objectFileName); vars["OBJECT_FILE_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat( ConvertToNinjaPath(objectFileDir), cmLocalGenerator::SHELL); @@ -619,54 +626,6 @@ cmNinjaTargetGenerator this->SetMsvcTargetPdbVariable(vars); - if(this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS")) - { - cmLocalGenerator::RuleVariables compileObjectVars; - std::string lang = language; - compileObjectVars.Language = lang.c_str(); - - std::string escapedSourceFileName = sourceFileName; - - if (!cmSystemTools::FileIsFullPath(sourceFileName.c_str())) - { - escapedSourceFileName = cmSystemTools::CollapseFullPath( - escapedSourceFileName, - this->GetGlobalGenerator()->GetCMakeInstance()-> - GetHomeOutputDirectory()); - } - - escapedSourceFileName = - this->LocalGenerator->ConvertToOutputFormat( - escapedSourceFileName, cmLocalGenerator::SHELL); - - compileObjectVars.Source = escapedSourceFileName.c_str(); - compileObjectVars.Object = objectFileName.c_str(); - compileObjectVars.ObjectDir = objectDir.c_str(); - compileObjectVars.ObjectFileDir = objectFileDir.c_str(); - compileObjectVars.Flags = vars["FLAGS"].c_str(); - compileObjectVars.Defines = vars["DEFINES"].c_str(); - compileObjectVars.Includes = vars["INCLUDES"].c_str(); - - // Rule for compiling object file. - std::string compileCmdVar = "CMAKE_"; - compileCmdVar += language; - compileCmdVar += "_COMPILE_OBJECT"; - std::string compileCmd = - this->GetMakefile()->GetRequiredDefinition(compileCmdVar); - std::vector<std::string> compileCmds; - cmSystemTools::ExpandListArgument(compileCmd, compileCmds); - - for (std::vector<std::string>::iterator i = compileCmds.begin(); - i != compileCmds.end(); ++i) - this->GetLocalGenerator()->ExpandRuleVariables(*i, compileObjectVars); - - std::string cmdLine = - this->GetLocalGenerator()->BuildCommandLine(compileCmds); - - this->GetGlobalGenerator()->AddCXXCompileCommand(cmdLine, - sourceFileName); - } - this->GetGlobalGenerator()->WriteBuild(this->GetBuildFileStream(), comment, rule, @@ -690,6 +649,69 @@ cmNinjaTargetGenerator void cmNinjaTargetGenerator +::ExportObjectCompileCommand( + std::string const& language, + std::string const& sourceFileName, + std::string const& objectDir, + std::string const& objectFileName, + std::string const& objectFileDir, + std::string const& flags, + std::string const& defines, + std::string const& includes + ) +{ + if(!this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS")) + { + return; + } + + cmLocalGenerator::RuleVariables compileObjectVars; + compileObjectVars.Language = language.c_str(); + + std::string escapedSourceFileName = sourceFileName; + + if (!cmSystemTools::FileIsFullPath(sourceFileName.c_str())) + { + escapedSourceFileName = cmSystemTools::CollapseFullPath( + escapedSourceFileName, + this->GetGlobalGenerator()->GetCMakeInstance()-> + GetHomeOutputDirectory()); + } + + escapedSourceFileName = + this->LocalGenerator->ConvertToOutputFormat( + escapedSourceFileName, cmLocalGenerator::SHELL); + + compileObjectVars.Source = escapedSourceFileName.c_str(); + compileObjectVars.Object = objectFileName.c_str(); + compileObjectVars.ObjectDir = objectDir.c_str(); + compileObjectVars.ObjectFileDir = objectFileDir.c_str(); + compileObjectVars.Flags = flags.c_str(); + compileObjectVars.Defines = defines.c_str(); + compileObjectVars.Includes = includes.c_str(); + + // Rule for compiling object file. + std::string compileCmdVar = "CMAKE_"; + compileCmdVar += language; + compileCmdVar += "_COMPILE_OBJECT"; + std::string compileCmd = + this->GetMakefile()->GetRequiredDefinition(compileCmdVar); + std::vector<std::string> compileCmds; + cmSystemTools::ExpandListArgument(compileCmd, compileCmds); + + for (std::vector<std::string>::iterator i = compileCmds.begin(); + i != compileCmds.end(); ++i) + this->GetLocalGenerator()->ExpandRuleVariables(*i, compileObjectVars); + + std::string cmdLine = + this->GetLocalGenerator()->BuildCommandLine(compileCmds); + + this->GetGlobalGenerator()->AddCXXCompileCommand(cmdLine, + sourceFileName); +} + +void +cmNinjaTargetGenerator ::EnsureDirectoryExists(const std::string& path) const { if (cmSystemTools::FileIsFullPath(path.c_str())) diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 8912431..a10ceba 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -114,6 +114,17 @@ protected: void WriteObjectBuildStatement(cmSourceFile const* source, bool writeOrderDependsTargetForTarget); + void ExportObjectCompileCommand( + std::string const& language, + std::string const& sourceFileName, + std::string const& objectDir, + std::string const& objectFileName, + std::string const& objectFileDir, + std::string const& flags, + std::string const& defines, + std::string const& includes + ); + cmNinjaDeps GetObjects() const { return this->Objects; } diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 91f3c0a..7be5b3f 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -293,7 +293,7 @@ cmOutputConverter::ConvertToRelativePath(const std::vector<std::string>& local, { relative += "/"; } - relative += cmJoin(cmRange(remote).advance(common), "/"); + relative += cmJoin(cmMakeRange(remote).advance(common), "/"); // Finally return the path. return relative; diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 5026893..3eb19bb 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -255,6 +255,22 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, { return false; } + if(pid == cmPolicies::CMP0001 && + (status == cmPolicies::WARN || status == cmPolicies::OLD)) + { + if(!(mf->GetState() + ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))) + { + // Set it to 2.4 because that is the last version where the + // variable had meaning. + mf->AddCacheDefinition + ("CMAKE_BACKWARDS_COMPATIBILITY", "2.4", + "For backwards compatibility, what version of CMake " + "commands and " + "syntax should this version of CMake try to support.", + cmState::STRING); + } + } } } else @@ -356,14 +372,6 @@ cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const { status = cmPolicies::NEW; } - else if (this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS]) - { - status = cmPolicies::REQUIRED_ALWAYS; - } - else if (this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED]) - { - status = cmPolicies::REQUIRED_IF_USED; - } return status; } @@ -373,19 +381,13 @@ void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id, this->Status[(POLICY_STATUS_COUNT * id) + OLD] = (status == OLD); this->Status[(POLICY_STATUS_COUNT * id) + WARN] = (status == WARN); this->Status[(POLICY_STATUS_COUNT * id) + NEW] = (status == NEW); - this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS] = - (status == REQUIRED_ALWAYS); - this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED] = - (status == REQUIRED_IF_USED); } bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const { return this->Status[(POLICY_STATUS_COUNT * id) + OLD] || this->Status[(POLICY_STATUS_COUNT * id) + WARN] - || this->Status[(POLICY_STATUS_COUNT * id) + NEW] - || this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS] - || this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED]; + || this->Status[(POLICY_STATUS_COUNT * id) + NEW]; } bool cmPolicies::PolicyMap::IsEmpty() const diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 8a3c27d..b783701 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -12,7 +12,7 @@ #ifndef cmPolicies_h #define cmPolicies_h -#include "cmCustomCommand.h" +#include "cmStandardIncludes.h" #include <bitset> @@ -244,7 +244,6 @@ public: REQUIRED_IF_USED, REQUIRED_ALWAYS ///< Issue an error unless user sets policy status to NEW. }; -#define POLICY_STATUS_COUNT 5 /// Policy identifiers enum PolicyID @@ -288,6 +287,7 @@ public: bool IsEmpty() const; private: +#define POLICY_STATUS_COUNT 3 std::bitset<cmPolicies::CMPCOUNT * POLICY_STATUS_COUNT> Status; }; }; diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index bf9f42c..306276b 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -108,7 +108,7 @@ bool cmSetCommand } // collect any values into a single semi-colon separated value list - value = cmJoin(cmRange(args).advance(1).retreat(ignoreLastArgs), ";"); + value = cmJoin(cmMakeRange(args).advance(1).retreat(ignoreLastArgs), ";"); if (parentScope) { diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 9cbb841..d8f8306 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -28,6 +28,9 @@ struct cmState::SnapshotDataType BuildSystemDirectory; std::string EntryPointCommand; long EntryPointLine; + std::vector<std::string>::size_type IncludeDirectoryPosition; + std::vector<std::string>::size_type CompileDefinitionsPosition; + std::vector<std::string>::size_type CompileOptionsPosition; }; struct cmState::BuildsystemDirectoryStateType @@ -44,6 +47,15 @@ struct cmState::BuildsystemDirectoryStateType // safely by the build tools. std::string RelativePathTopSource; std::string RelativePathTopBinary; + + std::vector<std::string> IncludeDirectories; + std::vector<cmListFileBacktrace> IncludeDirectoryBacktraces; + + std::vector<std::string> CompileDefinitions; + std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces; + + std::vector<std::string> CompileOptions; + std::vector<cmListFileBacktrace> CompileOptionsBacktraces; }; cmState::cmState(cmake* cm) @@ -228,7 +240,16 @@ cmState::Snapshot cmState::Reset() this->GlobalProperties.clear(); this->PropertyDefinitions.clear(); - this->BuildsystemDirectory.Truncate(); + { + cmLinkedTree<BuildsystemDirectoryStateType>::iterator it = + this->BuildsystemDirectory.Truncate(); + it->IncludeDirectories.clear(); + it->IncludeDirectoryBacktraces.clear(); + it->CompileDefinitions.clear(); + it->CompileDefinitionsBacktraces.clear(); + it->CompileOptions.clear(); + it->CompileOptionsBacktraces.clear(); + } PositionType pos = this->SnapshotData.Truncate(); this->ExecutionListFiles.Truncate(); @@ -698,6 +719,9 @@ cmState::Snapshot cmState::CreateBaseSnapshot() this->BuildsystemDirectory.Extend(this->BuildsystemDirectory.Root()); pos->ExecutionListFile = this->ExecutionListFiles.Extend(this->ExecutionListFiles.Root()); + pos->IncludeDirectoryPosition = 0; + pos->CompileDefinitionsPosition = 0; + pos->CompileOptionsPosition = 0; return cmState::Snapshot(this, pos); } @@ -796,6 +820,13 @@ cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot) PositionType pos = originSnapshot.Position; PositionType prevPos = pos; ++prevPos; + prevPos->IncludeDirectoryPosition = + prevPos->BuildSystemDirectory->IncludeDirectories.size(); + prevPos->CompileDefinitionsPosition = + prevPos->BuildSystemDirectory->CompileDefinitions.size(); + prevPos->CompileOptionsPosition = + prevPos->BuildSystemDirectory->CompileOptions.size(); + if (prevPos == this->SnapshotData.Root()) { return Snapshot(this, prevPos); @@ -803,6 +834,12 @@ cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot) return Snapshot(this, originSnapshot.Position->CallStackParent); } +cmState::Snapshot::Snapshot(cmState* state) + : State(state) + , Position() +{ +} + cmState::Snapshot::Snapshot(cmState* state, PositionType position) : State(state), Position(position) @@ -943,6 +980,62 @@ cmState::Snapshot cmState::Snapshot::GetCallStackParent() const return snapshot; } +static const std::string cmPropertySentinal = std::string(); + +template<typename T, typename U, typename V> +void InitializeContentFromParent(T& parentContent, + T& thisContent, + U& parentBacktraces, + U& thisBacktraces, + V& contentEndPosition) +{ + std::vector<std::string>::const_iterator parentBegin = + parentContent.begin(); + std::vector<std::string>::const_iterator parentEnd = + parentContent.end(); + + std::vector<std::string>::const_reverse_iterator parentRbegin = + cmMakeReverseIterator(parentEnd); + std::vector<std::string>::const_reverse_iterator parentRend = + parentContent.rend(); + parentRbegin = std::find(parentRbegin, parentRend, cmPropertySentinal); + std::vector<std::string>::const_iterator parentIt = parentRbegin.base(); + + thisContent = std::vector<std::string>(parentIt, parentEnd); + + std::vector<cmListFileBacktrace>::const_iterator btIt = + parentBacktraces.begin() + std::distance(parentBegin, parentIt); + std::vector<cmListFileBacktrace>::const_iterator btEnd = + parentBacktraces.end(); + + thisBacktraces = std::vector<cmListFileBacktrace>(btIt, btEnd); + + contentEndPosition = thisContent.size(); +} + +void cmState::Snapshot::InitializeFromParent() +{ + PositionType parent = this->Position->DirectoryParent; + + InitializeContentFromParent(parent->BuildSystemDirectory->IncludeDirectories, + this->Position->BuildSystemDirectory->IncludeDirectories, + parent->BuildSystemDirectory->IncludeDirectoryBacktraces, + this->Position->BuildSystemDirectory->IncludeDirectoryBacktraces, + this->Position->IncludeDirectoryPosition); + + InitializeContentFromParent(parent->BuildSystemDirectory->CompileDefinitions, + this->Position->BuildSystemDirectory->CompileDefinitions, + parent->BuildSystemDirectory->CompileDefinitionsBacktraces, + this->Position->BuildSystemDirectory->CompileDefinitionsBacktraces, + this->Position->CompileDefinitionsPosition); + + InitializeContentFromParent(parent->BuildSystemDirectory->CompileOptions, + this->Position->BuildSystemDirectory->CompileOptions, + parent->BuildSystemDirectory->CompileOptionsBacktraces, + this->Position->BuildSystemDirectory->CompileOptionsBacktraces, + this->Position->CompileOptionsPosition); +} + cmState* cmState::Snapshot::GetState() const { return this->State; @@ -960,3 +1053,220 @@ cmState::Directory::Directory( { } + +template <typename T, typename U> +cmStringRange GetPropertyContent(T const& content, U contentEndPosition) +{ + std::vector<std::string>::const_iterator end = + content.begin() + contentEndPosition; + + std::vector<std::string>::const_reverse_iterator rbegin = + cmMakeReverseIterator(end); + rbegin = std::find(rbegin, content.rend(), cmPropertySentinal); + + return cmMakeRange(rbegin.base(), end); +} + +template <typename T, typename U, typename V> +cmBacktraceRange GetPropertyBacktraces(T const& content, + U const& backtraces, + V contentEndPosition) +{ + std::vector<std::string>::const_iterator entryEnd = + content.begin() + contentEndPosition; + + std::vector<std::string>::const_reverse_iterator rbegin = + cmMakeReverseIterator(entryEnd); + rbegin = std::find(rbegin, content.rend(), cmPropertySentinal); + + std::vector<cmListFileBacktrace>::const_iterator it = + backtraces.begin() + std::distance(content.begin(), rbegin.base()); + + std::vector<cmListFileBacktrace>::const_iterator end = backtraces.end(); + return cmMakeRange(it, end); +} + +template <typename T, typename U, typename V> +void AppendEntry(T& content, U& backtraces, V& endContentPosition, + const std::string& vec, const cmListFileBacktrace& lfbt) +{ + assert(endContentPosition == content.size()); + + content.push_back(vec); + backtraces.push_back(lfbt); + + endContentPosition = content.size(); +} + +template <typename T, typename U, typename V> +void SetContent(T& content, U& backtraces, V& endContentPosition, + const std::string& vec, const cmListFileBacktrace& lfbt) +{ + assert(endContentPosition == content.size()); + + content.resize(content.size() + 2); + backtraces.resize(backtraces.size() + 2); + + content.back() = vec; + backtraces.back() = lfbt; + + endContentPosition = content.size(); +} + +template <typename T, typename U, typename V> +void ClearContent(T& content, U& backtraces, V& endContentPosition) +{ + assert(endContentPosition == content.size()); + + content.resize(content.size() + 1); + backtraces.resize(backtraces.size() + 1); + + endContentPosition = content.size(); +} + +cmStringRange +cmState::Directory::GetIncludeDirectoriesEntries() const +{ + return GetPropertyContent(this->DirectoryState->IncludeDirectories, + this->Snapshot_.Position->IncludeDirectoryPosition); +} + +cmBacktraceRange +cmState::Directory::GetIncludeDirectoriesEntryBacktraces() const +{ + return GetPropertyBacktraces(this->DirectoryState->IncludeDirectories, + this->DirectoryState->IncludeDirectoryBacktraces, + this->Snapshot_.Position->IncludeDirectoryPosition); +} + +void cmState::Directory::AppendIncludeDirectoriesEntry( + const std::string& vec, const cmListFileBacktrace& lfbt) +{ + AppendEntry(this->DirectoryState->IncludeDirectories, + this->DirectoryState->IncludeDirectoryBacktraces, + this->Snapshot_.Position->IncludeDirectoryPosition, + vec, lfbt); +} + +void cmState::Directory::PrependIncludeDirectoriesEntry( + const std::string& vec, const cmListFileBacktrace& lfbt) +{ + std::vector<std::string>::iterator entryEnd = + this->DirectoryState->IncludeDirectories.begin() + + this->Snapshot_.Position->IncludeDirectoryPosition; + + std::vector<std::string>::const_reverse_iterator rend = + this->DirectoryState->IncludeDirectories.rend(); + std::vector<std::string>::reverse_iterator rbegin = + cmMakeReverseIterator(entryEnd); + std::vector<std::string>::const_reverse_iterator crbegin = rbegin; + crbegin = std::find(crbegin, rend, cmPropertySentinal); + + std::vector<std::string>::const_iterator entryIt = crbegin.base(); + std::vector<std::string>::const_iterator entryBegin = + this->DirectoryState->IncludeDirectories.begin(); + + std::vector<cmListFileBacktrace>::iterator btIt = + this->DirectoryState->IncludeDirectoryBacktraces.begin() + + std::distance(entryBegin, entryIt); + + this->DirectoryState->IncludeDirectories.insert(rbegin.base(), vec); + this->DirectoryState->IncludeDirectoryBacktraces.insert(btIt, lfbt); + + this->Snapshot_.Position->IncludeDirectoryPosition = + this->DirectoryState->IncludeDirectories.size(); +} + +void cmState::Directory::SetIncludeDirectories( + const std::string& vec, const cmListFileBacktrace& lfbt) +{ + SetContent(this->DirectoryState->IncludeDirectories, + this->DirectoryState->IncludeDirectoryBacktraces, + this->Snapshot_.Position->IncludeDirectoryPosition, + vec, lfbt); +} + +void cmState::Directory::ClearIncludeDirectories() +{ + ClearContent(this->DirectoryState->IncludeDirectories, + this->DirectoryState->IncludeDirectoryBacktraces, + this->Snapshot_.Position->IncludeDirectoryPosition); +} + +cmStringRange cmState::Directory::GetCompileDefinitionsEntries() const +{ + return GetPropertyContent(this->DirectoryState->CompileDefinitions, + this->Snapshot_.Position->CompileDefinitionsPosition); +} + +cmBacktraceRange +cmState::Directory::GetCompileDefinitionsEntryBacktraces() const +{ + return GetPropertyBacktraces(this->DirectoryState->CompileDefinitions, + this->DirectoryState->CompileDefinitionsBacktraces, + this->Snapshot_.Position->CompileDefinitionsPosition); +} + +void cmState::Directory::AppendCompileDefinitionsEntry(const std::string& vec, + const cmListFileBacktrace& lfbt) +{ + AppendEntry(this->DirectoryState->CompileDefinitions, + this->DirectoryState->CompileDefinitionsBacktraces, + this->Snapshot_.Position->CompileDefinitionsPosition, + vec, lfbt); +} + +void cmState::Directory::SetCompileDefinitions(const std::string& vec, + const cmListFileBacktrace& lfbt) +{ + SetContent(this->DirectoryState->CompileDefinitions, + this->DirectoryState->CompileDefinitionsBacktraces, + this->Snapshot_.Position->CompileDefinitionsPosition, + vec, lfbt); +} + +void cmState::Directory::ClearCompileDefinitions() +{ + ClearContent(this->DirectoryState->CompileDefinitions, + this->DirectoryState->CompileDefinitionsBacktraces, + this->Snapshot_.Position->CompileDefinitionsPosition); +} + +cmStringRange cmState::Directory::GetCompileOptionsEntries() const +{ + return GetPropertyContent(this->DirectoryState->CompileOptions, + this->Snapshot_.Position->CompileOptionsPosition); +} + +cmBacktraceRange cmState::Directory::GetCompileOptionsEntryBacktraces() const +{ + return GetPropertyBacktraces(this->DirectoryState->CompileOptions, + this->DirectoryState->CompileOptionsBacktraces, + this->Snapshot_.Position->CompileOptionsPosition); +} + +void +cmState::Directory::AppendCompileOptionsEntry(const std::string& vec, + const cmListFileBacktrace& lfbt) +{ + AppendEntry(this->DirectoryState->CompileOptions, + this->DirectoryState->CompileOptionsBacktraces, + this->Snapshot_.Position->CompileOptionsPosition, + vec, lfbt); +} + +void cmState::Directory::SetCompileOptions(const std::string& vec, + const cmListFileBacktrace& lfbt) +{ + SetContent(this->DirectoryState->CompileOptions, + this->DirectoryState->CompileOptionsBacktraces, + this->Snapshot_.Position->CompileOptionsPosition, + vec, lfbt); +} + +void cmState::Directory::ClearCompileOptions() +{ + ClearContent(this->DirectoryState->CompileOptions, + this->DirectoryState->CompileOptionsBacktraces, + this->Snapshot_.Position->CompileOptionsPosition); +} diff --git a/Source/cmState.h b/Source/cmState.h index acd23a5..0d5300f 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -16,6 +16,7 @@ #include "cmPropertyDefinitionMap.h" #include "cmPropertyMap.h" #include "cmLinkedTree.h" +#include "cmAlgorithms.h" class cmake; class cmCommand; @@ -43,7 +44,8 @@ public: class Snapshot { public: - Snapshot(cmState* state = 0, PositionType position = PositionType()); + Snapshot(cmState* state = 0); + Snapshot(cmState* state, PositionType position); void SetListFile(std::string const& listfile); @@ -55,6 +57,8 @@ public: Snapshot GetBuildsystemDirectoryParent() const; Snapshot GetCallStackParent() const; + void InitializeFromParent(); + cmState* GetState() const; Directory GetDirectory() const; @@ -86,6 +90,32 @@ public: void SetRelativePathTopSource(const char* dir); void SetRelativePathTopBinary(const char* dir); + cmStringRange GetIncludeDirectoriesEntries() const; + cmBacktraceRange GetIncludeDirectoriesEntryBacktraces() const; + void AppendIncludeDirectoriesEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void PrependIncludeDirectoriesEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void SetIncludeDirectories(std::string const& vec, + cmListFileBacktrace const& lfbt); + void ClearIncludeDirectories(); + + cmStringRange GetCompileDefinitionsEntries() const; + cmBacktraceRange GetCompileDefinitionsEntryBacktraces() const; + void AppendCompileDefinitionsEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void SetCompileDefinitions(std::string const& vec, + cmListFileBacktrace const& lfbt); + void ClearCompileDefinitions(); + + cmStringRange GetCompileOptionsEntries() const; + cmBacktraceRange GetCompileOptionsEntryBacktraces() const; + void AppendCompileOptionsEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void SetCompileOptions(std::string const& vec, + cmListFileBacktrace const& lfbt); + void ClearCompileOptions(); + private: void ComputeRelativePathTopSource(); void ComputeRelativePathTopBinary(); diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index efc1f16..649fb39 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -319,7 +319,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args) } // Concatenate all the last arguments together. - std::string input = cmJoin(cmRange(args).advance(4), std::string()); + std::string input = cmJoin(cmMakeRange(args).advance(4), std::string()); // Scan through the input for all matches. std::string output; @@ -365,7 +365,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args) } // Concatenate all the last arguments together. - std::string input = cmJoin(cmRange(args).advance(4), std::string()); + std::string input = cmJoin(cmMakeRange(args).advance(4), std::string()); // Scan through the input for all matches. std::string output; @@ -465,7 +465,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args) } // Concatenate all the last arguments together. - std::string input = cmJoin(cmRange(args).advance(5), std::string()); + std::string input = cmJoin(cmMakeRange(args).advance(5), std::string()); // Scan through the input for all matches. std::string output; @@ -665,7 +665,7 @@ bool cmStringCommand::HandleReplaceCommand(std::vector<std::string> const& const std::string& replaceExpression = args[2]; const std::string& variableName = args[3]; - std::string input = cmJoin(cmRange(args).advance(4), std::string()); + std::string input = cmJoin(cmMakeRange(args).advance(4), std::string()); cmsys::SystemTools::ReplaceString(input, matchExpression.c_str(), replaceExpression.c_str()); @@ -756,7 +756,7 @@ bool cmStringCommand::HandleAppendCommand(std::vector<std::string> const& args) { value = oldValue; } - value += cmJoin(cmRange(args).advance(2), std::string()); + value += cmJoin(cmMakeRange(args).advance(2), std::string()); this->Makefile->AddDefinition(variable, value.c_str()); return true; } @@ -772,7 +772,7 @@ bool cmStringCommand } std::string const& variableName = args[1]; - std::string value = cmJoin(cmRange(args).advance(2), std::string()); + std::string value = cmJoin(cmMakeRange(args).advance(2), std::string()); this->Makefile->AddDefinition(variableName, value.c_str()); return true; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 2d10d29..cf33791 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -402,13 +402,17 @@ void cmTarget::SetMakefile(cmMakefile* mf) { // Initialize the INCLUDE_DIRECTORIES property based on the current value // of the same directory property: - const std::vector<cmValueWithOrigin> parentIncludes = - this->Makefile->GetIncludeDirectoriesEntries(); + const cmStringRange parentIncludes = + this->Makefile->GetIncludeDirectoriesEntries(); + const cmBacktraceRange parentIncludesBts = + this->Makefile->GetIncludeDirectoriesBacktraces(); - for (std::vector<cmValueWithOrigin>::const_iterator it - = parentIncludes.begin(); it != parentIncludes.end(); ++it) + cmBacktraceRange::const_iterator btIt = parentIncludesBts.begin(); + for (cmStringRange::const_iterator it + = parentIncludes.begin(); + it != parentIncludes.end(); ++it, ++btIt) { - this->InsertInclude(*it); + this->InsertInclude(*it, *btIt); } const std::set<std::string> parentSystemIncludes = this->Makefile->GetSystemIncludeDirectories(); @@ -416,13 +420,17 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SystemIncludeDirectories.insert(parentSystemIncludes.begin(), parentSystemIncludes.end()); - const std::vector<cmValueWithOrigin> parentOptions = + const cmStringRange parentOptions = this->Makefile->GetCompileOptionsEntries(); + const cmBacktraceRange parentOptionsBts = + this->Makefile->GetCompileOptionsBacktraces(); - for (std::vector<cmValueWithOrigin>::const_iterator it - = parentOptions.begin(); it != parentOptions.end(); ++it) + btIt = parentOptionsBts.begin(); + for (cmStringRange::const_iterator it + = parentOptions.begin(); + it != parentOptions.end(); ++it, ++btIt) { - this->InsertCompileOption(*it); + this->InsertCompileOption(*it, *btIt); } } @@ -1926,40 +1934,43 @@ void cmTarget::AppendBuildInterfaceIncludes() } //---------------------------------------------------------------------------- -void cmTarget::InsertInclude(const cmValueWithOrigin &entry, - bool before) +void cmTarget::InsertInclude(std::string const& entry, + cmListFileBacktrace const& bt, + bool before) { - cmGeneratorExpression ge(entry.Backtrace); + cmGeneratorExpression ge(bt); std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position = before ? this->Internal->IncludeDirectoriesEntries.begin() : this->Internal->IncludeDirectoriesEntries.end(); this->Internal->IncludeDirectoriesEntries.insert(position, - new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value))); + new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry))); } //---------------------------------------------------------------------------- -void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry, - bool before) +void cmTarget::InsertCompileOption(std::string const& entry, + cmListFileBacktrace const& bt, + bool before) { - cmGeneratorExpression ge(entry.Backtrace); + cmGeneratorExpression ge(bt); std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position = before ? this->Internal->CompileOptionsEntries.begin() : this->Internal->CompileOptionsEntries.end(); this->Internal->CompileOptionsEntries.insert(position, - new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value))); + new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry))); } //---------------------------------------------------------------------------- -void cmTarget::InsertCompileDefinition(const cmValueWithOrigin &entry) +void cmTarget::InsertCompileDefinition(std::string const& entry, + cmListFileBacktrace const& bt) { - cmGeneratorExpression ge(entry.Backtrace); + cmGeneratorExpression ge(bt); this->Internal->CompileDefinitionsEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value))); + new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry))); } //---------------------------------------------------------------------------- @@ -6605,7 +6616,7 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, } std::sort(props.begin(), props.end()); - std::string propsString = cmJoin(cmRange(props).retreat(1), ", "); + std::string propsString = cmJoin(cmMakeRange(props).retreat(1), ", "); propsString += " and the " + props.back(); std::ostringstream e; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 2a26a64..f567d50 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -560,11 +560,14 @@ public: std::vector<std::string> GetIncludeDirectories( const std::string& config, const std::string& language) const; - void InsertInclude(const cmValueWithOrigin &entry, + void InsertInclude(std::string const& entry, + cmListFileBacktrace const& bt, bool before = false); - void InsertCompileOption(const cmValueWithOrigin &entry, - bool before = false); - void InsertCompileDefinition(const cmValueWithOrigin &entry); + void InsertCompileOption(std::string const& entry, + cmListFileBacktrace const& bt, + bool before = false); + void InsertCompileDefinition(std::string const& entry, + cmListFileBacktrace const& bt); void AppendBuildInterfaceIncludes(); diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx index a85153d..8e86f0f 100644 --- a/Source/cmTargetCompileOptionsCommand.cxx +++ b/Source/cmTargetCompileOptionsCommand.cxx @@ -50,7 +50,6 @@ bool cmTargetCompileOptionsCommand bool, bool) { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmValueWithOrigin entry(this->Join(content), lfbt); - tgt->InsertCompileOption(entry); + tgt->InsertCompileOption(this->Join(content), lfbt); return true; } diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx index 24500db..7824c89 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.cxx +++ b/Source/cmTargetIncludeDirectoriesCommand.cxx @@ -72,8 +72,7 @@ bool cmTargetIncludeDirectoriesCommand bool prepend, bool system) { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmValueWithOrigin entry(this->Join(content), lfbt); - tgt->InsertInclude(entry, prepend); + tgt->InsertInclude(this->Join(content), lfbt, prepend); if (system) { tgt->AddSystemIncludeDirectories(content); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index fb9f123..9d2c19e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -121,6 +121,7 @@ void cmWarnUnusedCliWarning(const std::string& variable, cmake::cmake() { this->Trace = false; + this->TraceExpand = false; this->WarnUninitialized = false; this->WarnUnused = false; this->WarnUnusedCli = true; @@ -617,10 +618,17 @@ void cmake::SetArgs(const std::vector<std::string>& args, std::cout << "Running with debug output on.\n"; this->SetDebugOutputOn(true); } + else if(arg.find("--trace-expand",0) == 0) + { + std::cout << "Running with expanded trace output on.\n"; + this->SetTrace(true); + this->SetTraceExpand(true); + } else if(arg.find("--trace",0) == 0) { std::cout << "Running with trace output on.\n"; this->SetTrace(true); + this->SetTraceExpand(false); } else if(arg.find("--warn-uninitialized",0) == 0) { diff --git a/Source/cmake.h b/Source/cmake.h index f0f9411..20e49e3 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -270,6 +270,8 @@ class cmake // Do we want trace output during the cmake run. bool GetTrace() { return this->Trace;} void SetTrace(bool b) { this->Trace = b;} + bool GetTraceExpand() { return this->TraceExpand;} + void SetTraceExpand(bool b) { this->TraceExpand = b;} bool GetWarnUninitialized() { return this->WarnUninitialized;} void SetWarnUninitialized(bool b) { this->WarnUninitialized = b;} bool GetWarnUnused() { return this->WarnUnused;} @@ -378,6 +380,7 @@ private: WorkingMode CurrentWorkingMode; bool DebugOutput; bool Trace; + bool TraceExpand; bool WarnUninitialized; bool WarnUnused; bool WarnUnusedCli; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index c94ffec..a06b26f 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -83,6 +83,7 @@ static const char * cmDocumentationOptions[][2] = "useful on one try_compile at a time."}, {"--debug-output", "Put cmake in a debug mode."}, {"--trace", "Put cmake in trace mode."}, + {"--trace-expand", "Put cmake in trace mode with variable expansion."}, {"--warn-uninitialized", "Warn about uninitialized values."}, {"--warn-unused-vars", "Warn about unused variables."}, {"--no-warn-unused-cli", "Don't warn about command line options."}, diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 63838b4..71f47f3 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -335,14 +335,14 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) // Echo string else if (args[1] == "echo" ) { - std::cout << cmJoin(cmRange(args).advance(2), " ") << std::endl; + std::cout << cmJoin(cmMakeRange(args).advance(2), " ") << std::endl; return 0; } // Echo string no new line else if (args[1] == "echo_append" ) { - std::cout << cmJoin(cmRange(args).advance(2), " "); + std::cout << cmJoin(cmMakeRange(args).advance(2), " "); return 0; } @@ -511,7 +511,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) // Clock command else if (args[1] == "time" && args.size() > 2) { - std::string command = cmJoin(cmRange(args).advance(2), " "); + std::string command = cmJoin(cmMakeRange(args).advance(2), " "); clock_t clock_start, clock_finish; time_t time_start, time_finish; @@ -572,7 +572,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) return 1; } - std::string command = cmWrap('"', cmRange(args).advance(3), '"', " "); + std::string command = + cmWrap('"', cmMakeRange(args).advance(3), '"', " "); int retval = 0; int timeout = 0; if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, 0, &retval, |