diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2015-01-30 09:29:42 -0330 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2015-01-30 09:29:42 -0330 |
commit | 0a2a4d818fb5c276e6ba008c29b591683d5025bd (patch) | |
tree | bef463540bcd1ba853b75c8f265845251e819fd6 /cpp | |
parent | Fixed (ICE-6276) - Add support for JavaScript source maps (diff) | |
download | ice-0a2a4d818fb5c276e6ba008c29b591683d5025bd.tar.bz2 ice-0a2a4d818fb5c276e6ba008c29b591683d5025bd.tar.xz ice-0a2a4d818fb5c276e6ba008c29b591683d5025bd.zip |
ICE-5814 allow demos to be built with /W4 on Windows
Diffstat (limited to 'cpp')
74 files changed, 1750 insertions, 1625 deletions
diff --git a/cpp/config/Make.rules.mak b/cpp/config/Make.rules.mak index 88f4640802a..c5e07d7ad86 100755 --- a/cpp/config/Make.rules.mak +++ b/cpp/config/Make.rules.mak @@ -110,6 +110,10 @@ includedir = $(top_srcdir)\include includedir = $(ice_dir)\include !endif +!if exist ($(top_srcdir)\..\.gitignore) +ice_git_dist = 1 +!endif + install_bindir = $(prefix)\bin$(x64suffix) install_libdir = $(prefix)\lib$(x64suffix) install_includedir = $(prefix)\include diff --git a/cpp/config/Make.rules.msvc b/cpp/config/Make.rules.msvc index 187f3e347b9..ca5edd868fa 100755 --- a/cpp/config/Make.rules.msvc +++ b/cpp/config/Make.rules.msvc @@ -27,9 +27,9 @@ PRELIBPATH = /LIBPATH: GENERATE_PDB = yes !endif -CPPFLAGS = $(CPPFLAGS) -nologo -GR -EHsc +CPPFLAGS = $(CPPFLAGS) -nologo -GR -EHsc -WX !if "$(MAXWARN)" != "yes" -CPPFLAGS = $(CPPFLAGS) -W3 -WX -wd4250 -wd4251 +CPPFLAGS = $(CPPFLAGS) -W3 -wd4250 -wd4251 !else CPPFLAGS = $(CPPFLAGS) -W4 !endif diff --git a/cpp/demo/Freeze/backup/Client.cpp b/cpp/demo/Freeze/backup/Client.cpp index 86bf0e6f579..8e2502dffe8 100644 --- a/cpp/demo/Freeze/backup/Client.cpp +++ b/cpp/demo/Freeze/backup/Client.cpp @@ -39,11 +39,11 @@ main(int argc, char* argv[]) Freeze::ConnectionPtr connection = Freeze::createConnection(communicator, "backup"); IntLongMap m(connection, "IntLongMap", true); - + const int size = 10000; if(m.size() == 0) - { + { cout << "********* Creating new map ***********" << endl; Freeze::TransactionHolder txHolder(connection); @@ -56,7 +56,7 @@ main(int argc, char* argv[]) } txHolder.commit(); } - + cout << "Updating map" << endl; for(;;) @@ -76,23 +76,26 @@ main(int argc, char* argv[]) cerr << "old time (ms) == " << oldMs << endl; cerr << "current current (ms) == " << p->second << endl; } - + test(p->second == oldMs); p.set(ms); count++; } while(++p != m.end()); - cout << "Read " << IceUtil::Time::milliSeconds(oldMs).toDateTime() << " in all records;" + cout << "Read " << IceUtil::Time::milliSeconds(oldMs).toDateTime() << " in all records;" << " updating with " << time.toDateTime() << " ... " << flush; - + txHolder.commit(); cout << "done" << endl; test(count == size); } - connection->close(); - - communicator->destroy(); + // + // Since above loop never exits this code is unreachable and causes + // warnings with some compilers. + // + //connection->close(); + //communicator->destroy(); return EXIT_SUCCESS; } diff --git a/cpp/demo/Freeze/bench/Client.cpp b/cpp/demo/Freeze/bench/Client.cpp index 9834f50e504..19aac50557b 100644 --- a/cpp/demo/Freeze/bench/Client.cpp +++ b/cpp/demo/Freeze/bench/Client.cpp @@ -96,6 +96,9 @@ public: private: + // Required to prevent compiler warnings with MSVC++ + RandomGenerator& operator=(const RandomGenerator&); + const int _max; }; @@ -132,6 +135,9 @@ public: private: + // Required to prevent compiler warnings with MSVC++ + SequentialGenerator& operator=(const SequentialGenerator&); + const int _min; const int _max; int _current; @@ -140,38 +146,38 @@ private: class TestApp : public Ice::Application { public: - + TestApp(const string&); virtual int run(int, char*[]); private: - void IntIntMapIndexTest(IntIntMap&) + void IntIntMapIndexTest(IntIntMap&) {} - + void IntIntMapIndexTest(IndexedIntIntMap&); - template<class T> void IntIntMapTest(const string&, T* = 0); - + template<class T> void IntIntMapTest(const string&, T* = 0); + void generatedReadWithIndex(IntIntMap&, int, const GeneratorPtr&) {} void generatedReadWithIndex(IndexedIntIntMap&, int, const GeneratorPtr&); - template<class T> void generatedRead(T&, int, const GeneratorPtr&); - void Struct1Struct2MapIndexTest(Struct1Struct2Map&) + template<class T> void generatedRead(T&, int, const GeneratorPtr&); + void Struct1Struct2MapIndexTest(Struct1Struct2Map&) {} void Struct1Struct2MapIndexTest(IndexedStruct1Struct2Map&); template<class T> void Struct1Struct2MapTest(const string& mapName, T* = 0); - - void Struct1Class1MapIndexTest(Struct1Class1Map&) + + void Struct1Class1MapIndexTest(Struct1Class1Map&) {} void Struct1Class1MapIndexTest(IndexedStruct1Class1Map&); template<class T> void Struct1Class1MapTest(const string& mapName, T* = 0); - + void IntIntMapReadIndexTest(IntIntMap&) {} void IntIntMapReadIndexTest(IndexedIntIntMap&); template<class T> void IntIntMapReadTest(const string& mapName, T* = 0); - + void Struct1ObjectMapTest(); const string _envName; @@ -208,10 +214,10 @@ TestApp::IntIntMapIndexTest(IndexedIntIntMap& m) cout << "\ttime per reverse read: " << perRecord * 1000 << "ms" << endl; } -template<class T> void +template<class T> void TestApp::IntIntMapTest(const string& mapName, T*) { - T m(_connection, mapName); + T m(_connection, mapName); // // Populate the database. // @@ -230,7 +236,7 @@ TestApp::IntIntMapTest(const string& mapName, T*) cout << "\ttime for " << _repetitions << " writes: " << total * 1000 << "ms" << endl; cout << "\ttime per write: " << perRecord * 1000 << "ms" << endl; - + // // Read each record. // @@ -243,15 +249,15 @@ TestApp::IntIntMapTest(const string& mapName, T*) } total = _watch.stop(); perRecord = total / _repetitions; - + cout << "\ttime for " << _repetitions << " reads: " << total * 1000 << "ms" << endl; cout << "\ttime per read: " << perRecord * 1000 << "ms" << endl; - + // // Optional index sub-test // IntIntMapIndexTest(m); - + // // Remove each record. // @@ -266,7 +272,7 @@ TestApp::IntIntMapTest(const string& mapName, T*) } total = _watch.stop(); perRecord = total / _repetitions; - + cout << "\ttime for " << _repetitions << " removes: " << total * 1000 << "ms" << endl; cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl; } @@ -290,7 +296,7 @@ TestApp::generatedReadWithIndex(IndexedIntIntMap& m, int reads, const GeneratorP cout << "\ttime per reverse read: " << perRecord * 1000 << "ms" << endl; } -template<class T> void +template<class T> void TestApp::generatedRead(T& m, int reads , const GeneratorPtr& gen) { _watch.start(); @@ -303,11 +309,11 @@ TestApp::generatedRead(T& m, int reads , const GeneratorPtr& gen) } IceUtil::Time total = _watch.stop(); IceUtil::Time perRecord = total / reads; - + cout << "\ttime for " << reads << " reads of " << gen->toString() << " records: " << total * 1000 << "ms" << endl; cout << "\ttime per read: " << perRecord * 1000 << "ms" << endl; - + generatedReadWithIndex(m, reads, gen); } void @@ -325,7 +331,7 @@ TestApp::Struct1Struct2MapIndexTest(IndexedStruct1Struct2Map& m) test(p->first.l == i); test(p->second.s1.l == i); } - + for(i = 0; i < _repetitions; ++i) { Struct1 s1; @@ -343,11 +349,11 @@ TestApp::Struct1Struct2MapIndexTest(IndexedStruct1Struct2Map& m) cout << "\ttime per indexed read: " << perRecord * 1000 << "ms" << endl; } -template<class T> void +template<class T> void TestApp::Struct1Struct2MapTest(const string& mapName, T*) { T m(_connection, mapName); - + // // Populate the database. // @@ -370,10 +376,10 @@ TestApp::Struct1Struct2MapTest(const string& mapName, T*) } IceUtil::Time total = _watch.stop(); IceUtil::Time perRecord = total / _repetitions; - + cout << "\ttime for " << _repetitions << " writes: " << total * 1000 << "ms" << endl; cout << "\ttime per write: " << perRecord * 1000 << "ms" << endl; - + // // Read each record. // @@ -389,15 +395,15 @@ TestApp::Struct1Struct2MapTest(const string& mapName, T*) } total = _watch.stop(); perRecord = total / _repetitions; - + cout << "\ttime for " << _repetitions << " reads: " << total * 1000 << "ms" << endl; cout << "\ttime per read: " << perRecord * 1000 << "ms" << endl; - + // // Optional index test // Struct1Struct2MapIndexTest(m); - + // // Remove each record. // @@ -413,7 +419,7 @@ TestApp::Struct1Struct2MapTest(const string& mapName, T*) } total = _watch.stop(); perRecord = total / _repetitions; - + cout << "\ttime for " << _repetitions << " removes: " << total * 1000 << "ms" << endl; cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl; } @@ -441,11 +447,11 @@ TestApp::Struct1Class1MapIndexTest(IndexedStruct1Class1Map& m) cout << "\ttime per indexed read: " << perRecord * 1000 << "ms" << endl; } -template<class T> void +template<class T> void TestApp::Struct1Class1MapTest(const string& mapName, T*) { T m(_connection, mapName); - + // // Populate the database. // @@ -467,10 +473,10 @@ TestApp::Struct1Class1MapTest(const string& mapName, T*) } IceUtil::Time total = _watch.stop(); IceUtil::Time perRecord = total / _repetitions; - + cout << "\ttime for " << _repetitions << " writes: " << total * 1000 << "ms" << endl; cout << "\ttime per write: " << perRecord * 1000 << "ms" << endl; - + // // Read each record. // @@ -486,16 +492,16 @@ TestApp::Struct1Class1MapTest(const string& mapName, T*) } total = _watch.stop(); perRecord = total / _repetitions; - + cout << "\ttime for " << _repetitions << " reads: " << total * 1000 << "ms" << endl; cout << "\ttime per read: " << perRecord * 1000 << "ms" << endl; - + // // Optional index test // - + Struct1Class1MapIndexTest(m); - + // // Remove each record. // @@ -511,7 +517,7 @@ TestApp::Struct1Class1MapTest(const string& mapName, T*) } total = _watch.stop(); perRecord = total / _repetitions; - + cout << "\ttime for " << _repetitions << " removes: " << total * 1000 << "ms" << endl; cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl; } @@ -613,11 +619,11 @@ TestApp::Struct1ObjectMapTest() cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl; } -template<class T> void +template<class T> void TestApp::IntIntMapReadTest(const string& mapName, T*) { T m(_connection, mapName); - + // // Populate the database. // @@ -633,10 +639,10 @@ TestApp::IntIntMapReadTest(const string& mapName, T*) } IceUtil::Time total = _watch.stop(); IceUtil::Time perRecord = total / _repetitions; - + cout << "\ttime for " << _repetitions << " writes: " << total * 1000 << "ms" << endl; cout << "\ttime per write: " << perRecord * 1000 << "ms" << endl; - + // // Do some read tests. // @@ -644,12 +650,12 @@ TestApp::IntIntMapReadTest(const string& mapName, T*) generatedRead(m, _repetitions, new SequentialGenerator(2000, 2009)); generatedRead(m, _repetitions, new SequentialGenerator(3000, 3099)); generatedRead(m, _repetitions, new SequentialGenerator(4000, 4999)); - + // // Do a random read test. // generatedRead(m, _repetitions, new RandomGenerator(0, 10000)); - + // // Remove each record. // @@ -664,7 +670,7 @@ TestApp::IntIntMapReadTest(const string& mapName, T*) } total = _watch.stop(); perRecord = total / _repetitions; - + cout << "\ttime for " << _repetitions << " removes: " << total * 1000 << "ms" << endl; cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl; */ @@ -687,7 +693,7 @@ public: } return 0; } - + void destroy() { @@ -708,7 +714,7 @@ TestApp::run(int argc, char*[]) cout << "IntIntMap" << endl; IntIntMapTest<IntIntMap>("IntIntMap"); - + cout << "IntIntMap with index" << endl; IntIntMapTest<IndexedIntIntMap>("IndexedIntIntMap"); @@ -734,9 +740,9 @@ TestApp::run(int argc, char*[]) cout <<"IntIntMap with index (read test)" << endl; IntIntMapReadTest<IndexedIntIntMap>("IndexedIntIntMap"); - + _connection->close(); - + return EXIT_SUCCESS; } diff --git a/cpp/demo/Freeze/casino/BetResolver.cpp b/cpp/demo/Freeze/casino/BetResolver.cpp index d46200d071a..04c31e70f53 100644 --- a/cpp/demo/Freeze/casino/BetResolver.cpp +++ b/cpp/demo/Freeze/casino/BetResolver.cpp @@ -62,6 +62,9 @@ BetResolver::add(const CasinoStore::PersistentBetPrx& bet, Ice::Long closeTime) } private: + + Task& operator=(const Task&) { return *this; } + BetResolver& _resolver; CasinoStore::PersistentBetPrx _bet; diff --git a/cpp/demo/Freeze/casino/Server.cpp b/cpp/demo/Freeze/casino/Server.cpp index 8b09026b23f..1ab3ca8d288 100644 --- a/cpp/demo/Freeze/casino/Server.cpp +++ b/cpp/demo/Freeze/casino/Server.cpp @@ -124,6 +124,9 @@ CasinoServer::run(int argc, char*[]) } private: + + BankInitializer& operator=(const BankInitializer&) { return *this; } + CasinoServer& _server; }; @@ -165,6 +168,9 @@ CasinoServer::run(int argc, char*[]) } private: + + PlayerInitializer& operator=(const PlayerInitializer&) { return *this; } + CasinoServer& _server; }; @@ -203,6 +209,9 @@ CasinoServer::run(int argc, char*[]) } private: + + BetInitializer& operator=(const BetInitializer&) { return *this; } + CasinoServer& _server; }; @@ -257,7 +266,7 @@ CasinoServer::run(int argc, char*[]) Freeze::ConnectionPtr connection = Freeze::createConnection(communicator(), _envName); Freeze::TransactionPtr tx = connection->beginTransaction(); - + _playerEvictor->setCurrentTransaction(tx); for(size_t i = 0; i < 12; ++i) diff --git a/cpp/demo/Freeze/customEvictor/Evictor.h b/cpp/demo/Freeze/customEvictor/Evictor.h index dfed092b742..f9de85347cd 100644 --- a/cpp/demo/Freeze/customEvictor/Evictor.h +++ b/cpp/demo/Freeze/customEvictor/Evictor.h @@ -47,12 +47,15 @@ struct EvictorEntry : public Ice::LocalObject { EvictorEntry(const ItemIPtr&); + // Required to prevent compiler warnings with MSVC++ + EvictorEntry& operator=(const EvictorEntry&); + // // Immutable after initialization / insertion into the Cache map. // const Ice::ObjectPtr servant; EvictorCache::Position cachePosition; - + // // Protected by the Evictor mutex. // @@ -64,13 +67,13 @@ struct EvictorEntry : public Ice::LocalObject class Evictor : public Ice::ServantLocator { public: - + Evictor(CurrentDatabase&, int); - + virtual Ice::ObjectPtr locate(const Ice::Current&, Ice::LocalObjectPtr&); virtual void finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr&); virtual void deactivate(const std::string&); - + private: void evict(); diff --git a/cpp/demo/Freeze/library/Grammar.cpp b/cpp/demo/Freeze/library/Grammar.cpp index 7129b95e97b..ba7ab4fb741 100644 --- a/cpp/demo/Freeze/library/Grammar.cpp +++ b/cpp/demo/Freeze/library/Grammar.cpp @@ -1,23 +1,24 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify + + 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - + the Free Software Foundation; either version 2, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -28,7 +29,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -46,7 +47,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -54,20 +55,51 @@ /* Pure parsers. */ #define YYPURE 1 -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - /* Using locations. */ #define YYLSP_NEEDED 0 -/* Copy the first part of user declarations. */ +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + TOK_HELP = 258, + TOK_EXIT = 259, + TOK_ADD_BOOK = 260, + TOK_FIND_ISBN = 261, + TOK_FIND_AUTHORS = 262, + TOK_NEXT_FOUND_BOOK = 263, + TOK_PRINT_CURRENT = 264, + TOK_RENT_BOOK = 265, + TOK_RETURN_BOOK = 266, + TOK_REMOVE_CURRENT = 267, + TOK_SET_EVICTOR_SIZE = 268, + TOK_SHUTDOWN = 269, + TOK_STRING = 270 + }; +#endif +/* Tokens. */ +#define TOK_HELP 258 +#define TOK_EXIT 259 +#define TOK_ADD_BOOK 260 +#define TOK_FIND_ISBN 261 +#define TOK_FIND_AUTHORS 262 +#define TOK_NEXT_FOUND_BOOK 263 +#define TOK_PRINT_CURRENT 264 +#define TOK_RENT_BOOK 265 +#define TOK_RETURN_BOOK 266 +#define TOK_REMOVE_CURRENT 267 +#define TOK_SET_EVICTOR_SIZE 268 +#define TOK_SHUTDOWN 269 +#define TOK_STRING 270 + + -/* Line 189 of yacc.c */ + +/* Copy the first part of user declarations. */ #line 1 "Grammar.y" @@ -88,6 +120,12 @@ # pragma warning( disable : 4102 ) // warning C4065: switch statement contains 'default' but no 'case' labels # pragma warning( disable : 4065 ) +// warning C4127: conditional expression is constant +# pragma warning( disable : 4127 ) +// warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data +# pragma warning( disable : 4244 ) +// warning C4702: unreachable code +# pragma warning( disable : 4702 ) #endif using namespace std; @@ -100,9 +138,6 @@ yyerror(const char* s) -/* Line 189 of yacc.c */ -#line 105 "Grammar.tab.c" - /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -121,44 +156,20 @@ yyerror(const char* s) # define YYTOKEN_TABLE 0 #endif - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_HELP = 258, - TOK_EXIT = 259, - TOK_ADD_BOOK = 260, - TOK_FIND_ISBN = 261, - TOK_FIND_AUTHORS = 262, - TOK_NEXT_FOUND_BOOK = 263, - TOK_PRINT_CURRENT = 264, - TOK_RENT_BOOK = 265, - TOK_RETURN_BOOK = 266, - TOK_REMOVE_CURRENT = 267, - TOK_SET_EVICTOR_SIZE = 268, - TOK_SHUTDOWN = 269, - TOK_STRING = 270 - }; -#endif - - - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif + /* Copy the second part of user declarations. */ -/* Line 264 of yacc.c */ -#line 162 "Grammar.tab.c" +/* Line 216 of yacc.c. */ +#line 173 "Grammar.tab.c" #ifdef short # undef short @@ -233,14 +244,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int yyi) +YYID (int i) #else static int -YYID (yyi) - int yyi; +YYID (i) + int i; #endif { - return yyi; + return i; } #endif @@ -321,9 +332,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; + yytype_int16 yyss; + YYSTYPE yyvs; + }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -357,12 +368,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ +# define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -449,9 +460,9 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 53, 53, 57, 64, 67, 75, 79, 83, 87, - 91, 95, 99, 103, 107, 111, 115, 119, 123, 127, - 135, 140 + 0, 59, 59, 63, 70, 73, 81, 85, 89, 93, + 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, + 141, 146 }; #endif @@ -746,20 +757,17 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } @@ -793,11 +801,11 @@ yy_reduce_print (yyvsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - YYFPRINTF (stderr, " $%d = ", yyi + 1); + fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - YYFPRINTF (stderr, "\n"); + fprintf (stderr, "\n"); } } @@ -1077,8 +1085,10 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } + /* Prevent warnings from -Wmissing-prototypes. */ + #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1097,9 +1107,10 @@ int yyparse (); -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ + +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1123,46 +1134,22 @@ yyparse () #endif #endif { -/* The lookahead symbol. */ + /* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; - /* Number of syntax errors so far. */ - int yynerrs; - - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; +/* Number of syntax errors so far. */ +int yynerrs; + int yystate; int yyn; int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; @@ -1170,28 +1157,51 @@ YYSTYPE yylval; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; - yystacksize = YYINITDEPTH; - YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + 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; @@ -1221,6 +1231,7 @@ YYSTYPE yylval; YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; + /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -1228,6 +1239,7 @@ YYSTYPE yylval; yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); yyss = yyss1; @@ -1250,8 +1262,9 @@ YYSTYPE yylval; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1262,6 +1275,7 @@ YYSTYPE yylval; yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; + YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1271,9 +1285,6 @@ YYSTYPE yylval; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - if (yystate == YYFINAL) - YYACCEPT; - goto yybackup; /*-----------. @@ -1282,16 +1293,16 @@ YYSTYPE yylval; yybackup: /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ + look-ahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1323,16 +1334,20 @@ yybackup: goto yyreduce; } + if (yyn == YYFINAL) + YYACCEPT; + /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the lookahead token. */ + /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token. */ - yychar = YYEMPTY; + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1372,166 +1387,128 @@ yyreduce: switch (yyn) { case 2: - -/* Line 1455 of yacc.c */ -#line 54 "Grammar.y" +#line 60 "Grammar.y" { ;} break; case 3: - -/* Line 1455 of yacc.c */ -#line 57 "Grammar.y" +#line 63 "Grammar.y" { ;} break; case 4: - -/* Line 1455 of yacc.c */ -#line 65 "Grammar.y" +#line 71 "Grammar.y" { ;} break; case 5: - -/* Line 1455 of yacc.c */ -#line 68 "Grammar.y" +#line 74 "Grammar.y" { ;} break; case 6: - -/* Line 1455 of yacc.c */ -#line 76 "Grammar.y" +#line 82 "Grammar.y" { parser->usage(); ;} break; case 7: - -/* Line 1455 of yacc.c */ -#line 80 "Grammar.y" +#line 86 "Grammar.y" { return 0; ;} break; case 8: - -/* Line 1455 of yacc.c */ -#line 84 "Grammar.y" +#line 90 "Grammar.y" { parser->addBook((yyvsp[(2) - (3)])); ;} break; case 9: - -/* Line 1455 of yacc.c */ -#line 88 "Grammar.y" +#line 94 "Grammar.y" { parser->findIsbn((yyvsp[(2) - (3)])); ;} break; case 10: - -/* Line 1455 of yacc.c */ -#line 92 "Grammar.y" +#line 98 "Grammar.y" { parser->findAuthors((yyvsp[(2) - (3)])); ;} break; case 11: - -/* Line 1455 of yacc.c */ -#line 96 "Grammar.y" +#line 102 "Grammar.y" { parser->nextFoundBook(); ;} break; case 12: - -/* Line 1455 of yacc.c */ -#line 100 "Grammar.y" +#line 106 "Grammar.y" { parser->printCurrent(); ;} break; case 13: - -/* Line 1455 of yacc.c */ -#line 104 "Grammar.y" +#line 110 "Grammar.y" { parser->rentCurrent((yyvsp[(2) - (3)])); ;} break; case 14: - -/* Line 1455 of yacc.c */ -#line 108 "Grammar.y" +#line 114 "Grammar.y" { parser->returnCurrent(); ;} break; case 15: - -/* Line 1455 of yacc.c */ -#line 112 "Grammar.y" +#line 118 "Grammar.y" { parser->removeCurrent(); ;} break; case 16: - -/* Line 1455 of yacc.c */ -#line 116 "Grammar.y" +#line 122 "Grammar.y" { parser->setEvictorSize((yyvsp[(2) - (3)])); ;} break; case 17: - -/* Line 1455 of yacc.c */ -#line 120 "Grammar.y" +#line 126 "Grammar.y" { parser->shutdown(); ;} break; case 18: - -/* Line 1455 of yacc.c */ -#line 124 "Grammar.y" +#line 130 "Grammar.y" { yyerrok; ;} break; case 19: - -/* Line 1455 of yacc.c */ -#line 128 "Grammar.y" +#line 134 "Grammar.y" { ;} break; case 20: - -/* Line 1455 of yacc.c */ -#line 136 "Grammar.y" +#line 142 "Grammar.y" { (yyval) = (yyvsp[(2) - (2)]); (yyval).push_front((yyvsp[(1) - (2)]).front()); @@ -1539,18 +1516,15 @@ yyreduce: break; case 21: - -/* Line 1455 of yacc.c */ -#line 141 "Grammar.y" +#line 147 "Grammar.y" { (yyval) = (yyvsp[(1) - (1)]); ;} break; - -/* Line 1455 of yacc.c */ -#line 1554 "Grammar.tab.c" +/* Line 1267 of yacc.c. */ +#line 1528 "Grammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1561,6 +1535,7 @@ yyreduce: *++yyvsp = yyval; + /* 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. */ @@ -1625,7 +1600,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1642,7 +1617,7 @@ yyerrlab: } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; @@ -1699,6 +1674,9 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } + if (yyn == YYFINAL) + YYACCEPT; + *++yyvsp = yylval; @@ -1723,7 +1701,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1734,7 +1712,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEMPTY) + if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered @@ -1760,8 +1738,6 @@ yyreturn: } - -/* Line 1675 of yacc.c */ -#line 146 "Grammar.y" +#line 152 "Grammar.y" diff --git a/cpp/demo/Freeze/library/Grammar.h b/cpp/demo/Freeze/library/Grammar.h index 06c71695747..f956ecdbf3a 100644 --- a/cpp/demo/Freeze/library/Grammar.h +++ b/cpp/demo/Freeze/library/Grammar.h @@ -1,23 +1,24 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify + + 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - + the Free Software Foundation; either version 2, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -28,11 +29,10 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ - /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -54,16 +54,30 @@ TOK_STRING = 270 }; #endif +/* Tokens. */ +#define TOK_HELP 258 +#define TOK_EXIT 259 +#define TOK_ADD_BOOK 260 +#define TOK_FIND_ISBN 261 +#define TOK_FIND_AUTHORS 262 +#define TOK_NEXT_FOUND_BOOK 263 +#define TOK_PRINT_CURRENT 264 +#define TOK_RENT_BOOK 265 +#define TOK_RETURN_BOOK 266 +#define TOK_REMOVE_CURRENT 267 +#define TOK_SET_EVICTOR_SIZE 268 +#define TOK_SHUTDOWN 269 +#define TOK_STRING 270 + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif - diff --git a/cpp/demo/Freeze/library/Grammar.y b/cpp/demo/Freeze/library/Grammar.y index 96d16d89bce..a7d88e1dce6 100644 --- a/cpp/demo/Freeze/library/Grammar.y +++ b/cpp/demo/Freeze/library/Grammar.y @@ -17,6 +17,12 @@ # pragma warning( disable : 4102 ) // warning C4065: switch statement contains 'default' but no 'case' labels # pragma warning( disable : 4065 ) +// warning C4127: conditional expression is constant +# pragma warning( disable : 4127 ) +// warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data +# pragma warning( disable : 4244 ) +// warning C4702: unreachable code +# pragma warning( disable : 4702 ) #endif using namespace std; diff --git a/cpp/demo/Freeze/library/LibraryI.cpp b/cpp/demo/Freeze/library/LibraryI.cpp index e10cddb31da..dba787134f5 100644 --- a/cpp/demo/Freeze/library/LibraryI.cpp +++ b/cpp/demo/Freeze/library/LibraryI.cpp @@ -138,10 +138,13 @@ public: private: + // Required to prevent compiler warnings with MSVC++ + IsbnToBook& operator=(const IsbnToBook&); + const Ice::ObjectAdapterPtr _adapter; }; -LibraryI::LibraryI(const Ice::CommunicatorPtr& communicator, +LibraryI::LibraryI(const Ice::CommunicatorPtr& communicator, const string& envName, const string& dbName, const Freeze::EvictorPtr& evictor) : _evictor(evictor), @@ -266,7 +269,7 @@ void LibraryI::remove(const BookDescription& description) { IceUtil::Mutex::Lock lock(*this); - + // // Note: no need to catch and retry on deadlock since all access to // _authors is serialized. @@ -275,7 +278,7 @@ LibraryI::remove(const BookDescription& description) try { StringIsbnSeqDict::iterator p = _authors.find(description.authors); - + assert(p != _authors.end()); // @@ -284,7 +287,7 @@ LibraryI::remove(const BookDescription& description) Ice::StringSeq isbnSeq = p->second; isbnSeq.erase(remove_if(isbnSeq.begin(), isbnSeq.end(), bind2nd(equal_to<string>(), description.isbn)), isbnSeq.end()); - + if(isbnSeq.empty()) { // diff --git a/cpp/demo/Freeze/library/Parser.cpp b/cpp/demo/Freeze/library/Parser.cpp index a12b4b696c5..3900778125e 100644 --- a/cpp/demo/Freeze/library/Parser.cpp +++ b/cpp/demo/Freeze/library/Parser.cpp @@ -350,7 +350,7 @@ Parser::shutdown() } // -// With older flex version <= 2.5.35 YY_INPUT second +// With older flex version <= 2.5.35 YY_INPUT second // paramenter is of type int&, in newer versions it // changes to size_t& // @@ -379,7 +379,7 @@ Parser::getInput(char* buf, size_t& result, size_t maxSize) { add_history(line); } - + result = strlen(line) + 1; if(result > maxSize) { @@ -394,31 +394,28 @@ Parser::getInput(char* buf, size_t& result, size_t maxSize) free(line); } } - + #else cout << parser->getPrompt() << flush; string line; - while(true) + char c; + do { - char c = static_cast<char>(getc(yyin)); + c = static_cast<char>(getc(yyin)); if(c == EOF) { if(line.size()) { line += '\n'; } - break; } - - line += c; - - if(c == '\n') + else { - break; + line += c; } - } + } while(c != EOF && c != '\n'); result = static_cast<int>(line.length()); if(result > maxSize) diff --git a/cpp/demo/Freeze/library/Parser.h b/cpp/demo/Freeze/library/Parser.h index 872841e0992..37babc4cc08 100644 --- a/cpp/demo/Freeze/library/Parser.h +++ b/cpp/demo/Freeze/library/Parser.h @@ -63,10 +63,10 @@ public: void shutdown(); // - // With older flex version <= 2.5.35 YY_INPUT second + // With older flex version <= 2.5.35 YY_INPUT second // paramenter is of type int&, in newer versions it // changes to size_t& - // + // void getInput(char*, int&, size_t); void getInput(char*, size_t&, size_t); void continueLine(); @@ -82,6 +82,8 @@ public: private: + Parser& operator=(const Parser&); + Demo::BookPrxSeq _foundBooks; Demo::BookPrxSeq::iterator _current; diff --git a/cpp/demo/Freeze/library/Scanner.cpp b/cpp/demo/Freeze/library/Scanner.cpp index 95dd5848dd5..7f3ceb08ad0 100644 --- a/cpp/demo/Freeze/library/Scanner.cpp +++ b/cpp/demo/Freeze/library/Scanner.cpp @@ -512,17 +512,23 @@ char *yytext; #include <Parser.h> #include <Grammar.h> -#if defined(_MSC_VER) && defined(ICE_64) +#if defined(_MSC_VER) +#if defined(ICE_64) // // '=' : conversion from 'size_t' to 'int', possible loss of data // The result of fread() is a size_t and gets inserted into an int // -# pragma warning( 4 : 4267 ) +# pragma warning( disable : 4267) // // 'initializing' : conversion from '__int64' to 'int', possible loss of data // Puts a pointer-difference into an int // -# pragma warning( 4 : 4244 ) +# pragma warning( disable : 4244) +#endif +// +// conditional expression is constant +// +# pragma warning( disable : 4127) #endif using namespace std; @@ -547,7 +553,7 @@ using namespace std; #define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize) -#line 550 "lex.yy.c" +#line 556 "lex.yy.c" #define INITIAL 0 @@ -636,7 +642,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -647,7 +653,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - unsigned n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -729,10 +735,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 58 "Scanner.l" +#line 64 "Scanner.l" -#line 735 "lex.yy.c" +#line 741 "lex.yy.c" if ( !(yy_init) ) { @@ -817,7 +823,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 60 "Scanner.l" +#line 66 "Scanner.l" { // C++-style comment int c; @@ -830,7 +836,7 @@ YY_RULE_SETUP YY_BREAK case 2: YY_RULE_SETUP -#line 70 "Scanner.l" +#line 76 "Scanner.l" { // C-style comment while(true) @@ -858,84 +864,84 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -#line 95 "Scanner.l" +#line 101 "Scanner.l" { return TOK_HELP; } YY_BREAK case 4: YY_RULE_SETUP -#line 99 "Scanner.l" +#line 105 "Scanner.l" { return TOK_EXIT; } YY_BREAK case 5: YY_RULE_SETUP -#line 103 "Scanner.l" +#line 109 "Scanner.l" { return TOK_ADD_BOOK; } YY_BREAK case 6: YY_RULE_SETUP -#line 107 "Scanner.l" +#line 113 "Scanner.l" { return TOK_FIND_ISBN; } YY_BREAK case 7: YY_RULE_SETUP -#line 111 "Scanner.l" +#line 117 "Scanner.l" { return TOK_FIND_AUTHORS; } YY_BREAK case 8: YY_RULE_SETUP -#line 115 "Scanner.l" +#line 121 "Scanner.l" { return TOK_NEXT_FOUND_BOOK; } YY_BREAK case 9: YY_RULE_SETUP -#line 119 "Scanner.l" +#line 125 "Scanner.l" { return TOK_PRINT_CURRENT; } YY_BREAK case 10: YY_RULE_SETUP -#line 123 "Scanner.l" +#line 129 "Scanner.l" { return TOK_RENT_BOOK; } YY_BREAK case 11: YY_RULE_SETUP -#line 127 "Scanner.l" +#line 133 "Scanner.l" { return TOK_RETURN_BOOK; } YY_BREAK case 12: YY_RULE_SETUP -#line 131 "Scanner.l" +#line 137 "Scanner.l" { return TOK_REMOVE_CURRENT; } YY_BREAK case 13: YY_RULE_SETUP -#line 135 "Scanner.l" +#line 141 "Scanner.l" { return TOK_SET_EVICTOR_SIZE; } YY_BREAK case 14: YY_RULE_SETUP -#line 139 "Scanner.l" +#line 145 "Scanner.l" { return TOK_SHUTDOWN; } @@ -943,7 +949,7 @@ YY_RULE_SETUP case 15: /* rule 15 can match eol */ YY_RULE_SETUP -#line 143 "Scanner.l" +#line 149 "Scanner.l" { size_t len = strlen(yytext); for(size_t i = 0; i < len; ++i) @@ -958,14 +964,14 @@ YY_RULE_SETUP case 16: /* rule 16 can match eol */ YY_RULE_SETUP -#line 154 "Scanner.l" +#line 160 "Scanner.l" { return ';'; } YY_BREAK case 17: YY_RULE_SETUP -#line 158 "Scanner.l" +#line 164 "Scanner.l" { // "..."-type strings string s; @@ -992,13 +998,13 @@ YY_RULE_SETUP s += next; break; } - + case 'n': { s += '\n'; break; } - + case 'r': { s += '\r'; @@ -1010,19 +1016,19 @@ YY_RULE_SETUP s += '\t'; break; } - + case 'v': { s += '\v'; break; } - + case 'f': { s += '\f'; break; } - + default: { s += c; @@ -1042,7 +1048,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 232 "Scanner.l" +#line 238 "Scanner.l" { // '...'-type strings string s; @@ -1070,7 +1076,7 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 257 "Scanner.l" +#line 263 "Scanner.l" { // Simple strings string s; @@ -1087,7 +1093,7 @@ YY_RULE_SETUP unput(c); break; } - + s += c; } yylvalp->clear(); @@ -1097,10 +1103,10 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP -#line 281 "Scanner.l" +#line 287 "Scanner.l" ECHO; YY_BREAK -#line 1103 "lex.yy.c" +#line 1109 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2094,7 +2100,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 281 "Scanner.l" +#line 287 "Scanner.l" diff --git a/cpp/demo/Freeze/library/Scanner.l b/cpp/demo/Freeze/library/Scanner.l index 73042df8a9f..0b59c2f2341 100644 --- a/cpp/demo/Freeze/library/Scanner.l +++ b/cpp/demo/Freeze/library/Scanner.l @@ -12,17 +12,23 @@ #include <Parser.h> #include <Grammar.h> -#if defined(_MSC_VER) && defined(ICE_64) +#if defined(_MSC_VER) +#if defined(ICE_64) // // '=' : conversion from 'size_t' to 'int', possible loss of data // The result of fread() is a size_t and gets inserted into an int // -# pragma warning( 4 : 4267 ) +# pragma warning( disable : 4267) // // 'initializing' : conversion from '__int64' to 'int', possible loss of data // Puts a pointer-difference into an int // -# pragma warning( 4 : 4244 ) +# pragma warning( disable : 4244) +#endif +// +// conditional expression is constant +// +# pragma warning( disable : 4127) #endif using namespace std; @@ -181,13 +187,13 @@ NL [\n] s += next; break; } - + case 'n': { s += '\n'; break; } - + case 'r': { s += '\r'; @@ -199,19 +205,19 @@ NL [\n] s += '\t'; break; } - + case 'v': { s += '\v'; break; } - + case 'f': { s += '\f'; break; } - + default: { s += c; @@ -270,7 +276,7 @@ NL [\n] unput(c); break; } - + s += c; } yylvalp->clear(); diff --git a/cpp/demo/Freeze/phonebook/Grammar.cpp b/cpp/demo/Freeze/phonebook/Grammar.cpp index 9365f55b50d..fd892c9c2b3 100644 --- a/cpp/demo/Freeze/phonebook/Grammar.cpp +++ b/cpp/demo/Freeze/phonebook/Grammar.cpp @@ -1,23 +1,24 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify + + 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - + the Free Software Foundation; either version 2, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -28,7 +29,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -46,7 +47,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -54,20 +55,51 @@ /* Pure parsers. */ #define YYPURE 1 -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - /* Using locations. */ #define YYLSP_NEEDED 0 -/* Copy the first part of user declarations. */ +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + TOK_HELP = 258, + TOK_EXIT = 259, + TOK_ADD_CONTACTS = 260, + TOK_FIND_CONTACTS = 261, + TOK_NEXT_FOUND_CONTACT = 262, + TOK_PRINT_CURRENT = 263, + TOK_SET_CURRENT_NAME = 264, + TOK_SET_CURRENT_ADDRESS = 265, + TOK_SET_CURRENT_PHONE = 266, + TOK_REMOVE_CURRENT = 267, + TOK_SET_EVICTOR_SIZE = 268, + TOK_SHUTDOWN = 269, + TOK_STRING = 270 + }; +#endif +/* Tokens. */ +#define TOK_HELP 258 +#define TOK_EXIT 259 +#define TOK_ADD_CONTACTS 260 +#define TOK_FIND_CONTACTS 261 +#define TOK_NEXT_FOUND_CONTACT 262 +#define TOK_PRINT_CURRENT 263 +#define TOK_SET_CURRENT_NAME 264 +#define TOK_SET_CURRENT_ADDRESS 265 +#define TOK_SET_CURRENT_PHONE 266 +#define TOK_REMOVE_CURRENT 267 +#define TOK_SET_EVICTOR_SIZE 268 +#define TOK_SHUTDOWN 269 +#define TOK_STRING 270 + + -/* Line 189 of yacc.c */ + +/* Copy the first part of user declarations. */ #line 1 "Grammar.y" @@ -88,6 +120,12 @@ # pragma warning( disable : 4102 ) // warning C4065: switch statement contains 'default' but no 'case' labels # pragma warning( disable : 4065 ) +// warning C4127: conditional expression is constant +# pragma warning( disable : 4127 ) +// warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data +# pragma warning( disable : 4244 ) +// warning C4702: unreachable code +# pragma warning( disable : 4702 ) #endif using namespace std; @@ -101,9 +139,6 @@ yyerror(const char* s) -/* Line 189 of yacc.c */ -#line 106 "Grammar.tab.c" - /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -122,44 +157,20 @@ yyerror(const char* s) # define YYTOKEN_TABLE 0 #endif - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_HELP = 258, - TOK_EXIT = 259, - TOK_ADD_CONTACTS = 260, - TOK_FIND_CONTACTS = 261, - TOK_NEXT_FOUND_CONTACT = 262, - TOK_PRINT_CURRENT = 263, - TOK_SET_CURRENT_NAME = 264, - TOK_SET_CURRENT_ADDRESS = 265, - TOK_SET_CURRENT_PHONE = 266, - TOK_REMOVE_CURRENT = 267, - TOK_SET_EVICTOR_SIZE = 268, - TOK_SHUTDOWN = 269, - TOK_STRING = 270 - }; -#endif - - - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif + /* Copy the second part of user declarations. */ -/* Line 264 of yacc.c */ -#line 163 "Grammar.tab.c" +/* Line 216 of yacc.c. */ +#line 174 "Grammar.tab.c" #ifdef short # undef short @@ -234,14 +245,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int yyi) +YYID (int i) #else static int -YYID (yyi) - int yyi; +YYID (i) + int i; #endif { - return yyi; + return i; } #endif @@ -322,9 +333,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; + yytype_int16 yyss; + YYSTYPE yyvs; + }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -358,12 +369,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ +# define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -450,9 +461,9 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 54, 54, 58, 65, 68, 76, 80, 84, 88, - 92, 96, 100, 104, 108, 112, 116, 120, 124, 128, - 136, 141 + 0, 60, 60, 64, 71, 74, 82, 86, 90, 94, + 98, 102, 106, 110, 114, 118, 122, 126, 130, 134, + 142, 147 }; #endif @@ -750,20 +761,17 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } @@ -797,11 +805,11 @@ yy_reduce_print (yyvsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - YYFPRINTF (stderr, " $%d = ", yyi + 1); + fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - YYFPRINTF (stderr, "\n"); + fprintf (stderr, "\n"); } } @@ -1081,8 +1089,10 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } + /* Prevent warnings from -Wmissing-prototypes. */ + #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1101,9 +1111,10 @@ int yyparse (); -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ + +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1127,46 +1138,22 @@ yyparse () #endif #endif { -/* The lookahead symbol. */ + /* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; - /* Number of syntax errors so far. */ - int yynerrs; - - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; +/* Number of syntax errors so far. */ +int yynerrs; + int yystate; int yyn; int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; @@ -1174,28 +1161,51 @@ YYSTYPE yylval; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; - yystacksize = YYINITDEPTH; - YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + 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; @@ -1225,6 +1235,7 @@ YYSTYPE yylval; YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; + /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -1232,6 +1243,7 @@ YYSTYPE yylval; yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); yyss = yyss1; @@ -1254,8 +1266,9 @@ YYSTYPE yylval; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1266,6 +1279,7 @@ YYSTYPE yylval; yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; + YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1275,9 +1289,6 @@ YYSTYPE yylval; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - if (yystate == YYFINAL) - YYACCEPT; - goto yybackup; /*-----------. @@ -1286,16 +1297,16 @@ YYSTYPE yylval; yybackup: /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ + look-ahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1327,16 +1338,20 @@ yybackup: goto yyreduce; } + if (yyn == YYFINAL) + YYACCEPT; + /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the lookahead token. */ + /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token. */ - yychar = YYEMPTY; + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1376,166 +1391,128 @@ yyreduce: switch (yyn) { case 2: - -/* Line 1455 of yacc.c */ -#line 55 "Grammar.y" +#line 61 "Grammar.y" { ;} break; case 3: - -/* Line 1455 of yacc.c */ -#line 58 "Grammar.y" +#line 64 "Grammar.y" { ;} break; case 4: - -/* Line 1455 of yacc.c */ -#line 66 "Grammar.y" +#line 72 "Grammar.y" { ;} break; case 5: - -/* Line 1455 of yacc.c */ -#line 69 "Grammar.y" +#line 75 "Grammar.y" { ;} break; case 6: - -/* Line 1455 of yacc.c */ -#line 77 "Grammar.y" +#line 83 "Grammar.y" { parser->usage(); ;} break; case 7: - -/* Line 1455 of yacc.c */ -#line 81 "Grammar.y" +#line 87 "Grammar.y" { return 0; ;} break; case 8: - -/* Line 1455 of yacc.c */ -#line 85 "Grammar.y" +#line 91 "Grammar.y" { parser->addContacts((yyvsp[(2) - (3)])); ;} break; case 9: - -/* Line 1455 of yacc.c */ -#line 89 "Grammar.y" +#line 95 "Grammar.y" { parser->findContacts((yyvsp[(2) - (3)])); ;} break; case 10: - -/* Line 1455 of yacc.c */ -#line 93 "Grammar.y" +#line 99 "Grammar.y" { parser->nextFoundContact(); ;} break; case 11: - -/* Line 1455 of yacc.c */ -#line 97 "Grammar.y" +#line 103 "Grammar.y" { parser->printCurrent(); ;} break; case 12: - -/* Line 1455 of yacc.c */ -#line 101 "Grammar.y" +#line 107 "Grammar.y" { parser->setCurrentName((yyvsp[(2) - (3)])); ;} break; case 13: - -/* Line 1455 of yacc.c */ -#line 105 "Grammar.y" +#line 111 "Grammar.y" { parser->setCurrentAddress((yyvsp[(2) - (3)])); ;} break; case 14: - -/* Line 1455 of yacc.c */ -#line 109 "Grammar.y" +#line 115 "Grammar.y" { parser->setCurrentPhone((yyvsp[(2) - (3)])); ;} break; case 15: - -/* Line 1455 of yacc.c */ -#line 113 "Grammar.y" +#line 119 "Grammar.y" { parser->removeCurrent(); ;} break; case 16: - -/* Line 1455 of yacc.c */ -#line 117 "Grammar.y" +#line 123 "Grammar.y" { parser->setEvictorSize((yyvsp[(2) - (3)])); ;} break; case 17: - -/* Line 1455 of yacc.c */ -#line 121 "Grammar.y" +#line 127 "Grammar.y" { parser->shutdown(); ;} break; case 18: - -/* Line 1455 of yacc.c */ -#line 125 "Grammar.y" +#line 131 "Grammar.y" { yyerrok; ;} break; case 19: - -/* Line 1455 of yacc.c */ -#line 129 "Grammar.y" +#line 135 "Grammar.y" { ;} break; case 20: - -/* Line 1455 of yacc.c */ -#line 137 "Grammar.y" +#line 143 "Grammar.y" { (yyval) = (yyvsp[(2) - (2)]); (yyval).push_front((yyvsp[(1) - (2)]).front()); @@ -1543,18 +1520,15 @@ yyreduce: break; case 21: - -/* Line 1455 of yacc.c */ -#line 142 "Grammar.y" +#line 148 "Grammar.y" { (yyval) = (yyvsp[(1) - (1)]); ;} break; - -/* Line 1455 of yacc.c */ -#line 1558 "Grammar.tab.c" +/* Line 1267 of yacc.c. */ +#line 1532 "Grammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1565,6 +1539,7 @@ yyreduce: *++yyvsp = yyval; + /* 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. */ @@ -1629,7 +1604,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1646,7 +1621,7 @@ yyerrlab: } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; @@ -1703,6 +1678,9 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } + if (yyn == YYFINAL) + YYACCEPT; + *++yyvsp = yylval; @@ -1727,7 +1705,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1738,7 +1716,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEMPTY) + if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered @@ -1764,8 +1742,6 @@ yyreturn: } - -/* Line 1675 of yacc.c */ -#line 147 "Grammar.y" +#line 153 "Grammar.y" diff --git a/cpp/demo/Freeze/phonebook/Grammar.h b/cpp/demo/Freeze/phonebook/Grammar.h index fb5de6918c2..759d1869ca2 100644 --- a/cpp/demo/Freeze/phonebook/Grammar.h +++ b/cpp/demo/Freeze/phonebook/Grammar.h @@ -1,23 +1,24 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify + + 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - + the Free Software Foundation; either version 2, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -28,11 +29,10 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ - /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -54,16 +54,30 @@ TOK_STRING = 270 }; #endif +/* Tokens. */ +#define TOK_HELP 258 +#define TOK_EXIT 259 +#define TOK_ADD_CONTACTS 260 +#define TOK_FIND_CONTACTS 261 +#define TOK_NEXT_FOUND_CONTACT 262 +#define TOK_PRINT_CURRENT 263 +#define TOK_SET_CURRENT_NAME 264 +#define TOK_SET_CURRENT_ADDRESS 265 +#define TOK_SET_CURRENT_PHONE 266 +#define TOK_REMOVE_CURRENT 267 +#define TOK_SET_EVICTOR_SIZE 268 +#define TOK_SHUTDOWN 269 +#define TOK_STRING 270 + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif - diff --git a/cpp/demo/Freeze/phonebook/Grammar.y b/cpp/demo/Freeze/phonebook/Grammar.y index 4bc4da8463e..ddcdc66c414 100644 --- a/cpp/demo/Freeze/phonebook/Grammar.y +++ b/cpp/demo/Freeze/phonebook/Grammar.y @@ -17,6 +17,12 @@ # pragma warning( disable : 4102 ) // warning C4065: switch statement contains 'default' but no 'case' labels # pragma warning( disable : 4065 ) +// warning C4127: conditional expression is constant +# pragma warning( disable : 4127 ) +// warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data +# pragma warning( disable : 4244 ) +// warning C4702: unreachable code +# pragma warning( disable : 4702 ) #endif using namespace std; diff --git a/cpp/demo/Freeze/phonebook/Parser.cpp b/cpp/demo/Freeze/phonebook/Parser.cpp index 8d1897470a3..b73a5a465c0 100644 --- a/cpp/demo/Freeze/phonebook/Parser.cpp +++ b/cpp/demo/Freeze/phonebook/Parser.cpp @@ -329,7 +329,7 @@ Parser::shutdown() } // -// With older flex version <= 2.5.35 YY_INPUT second +// With older flex version <= 2.5.35 YY_INPUT second // paramenter is of type int&, in newer versions it // changes to size_t& // @@ -379,25 +379,22 @@ Parser::getInput(char* buf, size_t& result, size_t maxSize) cout << parser->getPrompt() << flush; string line; - while(true) + char c; + do { - char c = static_cast<char>(getc(yyin)); + c = static_cast<char>(getc(yyin)); if(c == EOF) { if(line.size()) { line += '\n'; } - break; } - - line += c; - - if(c == '\n') + else { - break; + line += c; } - } + } while(c != EOF && c != '\n'); result = line.length(); if(result > maxSize) diff --git a/cpp/demo/Freeze/phonebook/Parser.h b/cpp/demo/Freeze/phonebook/Parser.h index de5abd5562b..d4cea2d369b 100644 --- a/cpp/demo/Freeze/phonebook/Parser.h +++ b/cpp/demo/Freeze/phonebook/Parser.h @@ -63,10 +63,10 @@ public: void shutdown(); // - // With older flex version <= 2.5.35 YY_INPUT second + // With older flex version <= 2.5.35 YY_INPUT second // paramenter is of type int&, in newer versions it // changes to size_t& - // + // void getInput(char*, int&, size_t); void getInput(char*, size_t&, size_t); void continueLine(); @@ -82,6 +82,8 @@ public: private: + // Required to prevent compiler warnings with MSVC++ + Parser& operator=(const Parser&); Demo::Contacts _foundContacts; Demo::Contacts::iterator _current; diff --git a/cpp/demo/Freeze/phonebook/PhoneBookI.cpp b/cpp/demo/Freeze/phonebook/PhoneBookI.cpp index 47c56239b5e..9034ea94bc5 100644 --- a/cpp/demo/Freeze/phonebook/PhoneBookI.cpp +++ b/cpp/demo/Freeze/phonebook/PhoneBookI.cpp @@ -99,6 +99,9 @@ public: private: + // Required to prevent compiler warnings with MSVC++ + IdentityToContact& operator=(const IdentityToContact&); + const Ice::ObjectAdapterPtr _adapter; }; @@ -116,14 +119,14 @@ PhoneBookI::createContact(const Ice::Current& c) // Create a new Contact Servant. // ContactIPtr contact = new ContactI(_contactFactory); - + // // Create a new Ice Object in the evictor, using the new identity // and the new Servant. // _evictor->add(contact, ident); - + // // Turn the identity into a Proxy and return the Proxy to the // caller. @@ -137,7 +140,7 @@ PhoneBookI::findContacts(const string& name, const Ice::Current& c) const try { vector<Ice::Identity> identities = _index->find(name); - + Contacts contacts; contacts.reserve(identities.size()); transform(identities.begin(), identities.end(), back_inserter(contacts), IdentityToContact(c.adapter)); diff --git a/cpp/demo/Freeze/phonebook/PhoneBookI.h b/cpp/demo/Freeze/phonebook/PhoneBookI.h index 761d11c9b66..70af62f1576 100644 --- a/cpp/demo/Freeze/phonebook/PhoneBookI.h +++ b/cpp/demo/Freeze/phonebook/PhoneBookI.h @@ -46,6 +46,9 @@ public: private: + // Required to prevent compiler warnings with MSVC++ + ContactI& operator=(const ContactI&); + const ContactFactoryPtr _factory; }; @@ -55,7 +58,7 @@ private: class PhoneBookI : public Demo::PhoneBook { -public: +public: PhoneBookI(const Freeze::EvictorPtr& evictor, const ContactFactoryPtr& factory, const NameIndexPtr& index); @@ -66,6 +69,9 @@ public: private: + // Required to prevent compiler warnings with MSVC++ + PhoneBookI& operator=(const PhoneBookI&); + const Freeze::EvictorPtr _evictor; const ContactFactoryPtr _contactFactory; NameIndexPtr _index; diff --git a/cpp/demo/Freeze/phonebook/Scanner.cpp b/cpp/demo/Freeze/phonebook/Scanner.cpp index a669cecfadf..308b2a505ae 100644 --- a/cpp/demo/Freeze/phonebook/Scanner.cpp +++ b/cpp/demo/Freeze/phonebook/Scanner.cpp @@ -512,17 +512,23 @@ char *yytext; #include <Parser.h> #include <Grammar.h> -#if defined(_MSC_VER) && defined(ICE_64) +#if defined(_MSC_VER) +#if defined(ICE_64) // // '=' : conversion from 'size_t' to 'int', possible loss of data // The result of fread() is a size_t and gets inserted into an int // -# pragma warning( 4 : 4267 ) +# pragma warning( disable : 4267) // // 'initializing' : conversion from '__int64' to 'int', possible loss of data // Puts a pointer-difference into an int // -# pragma warning( 4 : 4244 ) +# pragma warning( disable : 4244) +#endif +// +// conditional expression is constant +// +# pragma warning( disable : 4127) #endif using namespace std; @@ -547,7 +553,7 @@ using namespace std; #define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize) -#line 550 "lex.yy.c" +#line 556 "lex.yy.c" #define INITIAL 0 @@ -636,7 +642,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -647,7 +653,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - unsigned n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -729,10 +735,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 58 "Scanner.l" +#line 64 "Scanner.l" -#line 735 "lex.yy.c" +#line 741 "lex.yy.c" if ( !(yy_init) ) { @@ -817,7 +823,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 60 "Scanner.l" +#line 66 "Scanner.l" { // C++-style comment int c; @@ -830,7 +836,7 @@ YY_RULE_SETUP YY_BREAK case 2: YY_RULE_SETUP -#line 70 "Scanner.l" +#line 76 "Scanner.l" { // C-style comment while(true) @@ -858,84 +864,84 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -#line 95 "Scanner.l" +#line 101 "Scanner.l" { return TOK_HELP; } YY_BREAK case 4: YY_RULE_SETUP -#line 99 "Scanner.l" +#line 105 "Scanner.l" { return TOK_EXIT; } YY_BREAK case 5: YY_RULE_SETUP -#line 103 "Scanner.l" +#line 109 "Scanner.l" { return TOK_ADD_CONTACTS; } YY_BREAK case 6: YY_RULE_SETUP -#line 107 "Scanner.l" +#line 113 "Scanner.l" { return TOK_FIND_CONTACTS; } YY_BREAK case 7: YY_RULE_SETUP -#line 111 "Scanner.l" +#line 117 "Scanner.l" { return TOK_NEXT_FOUND_CONTACT; } YY_BREAK case 8: YY_RULE_SETUP -#line 115 "Scanner.l" +#line 121 "Scanner.l" { return TOK_PRINT_CURRENT; } YY_BREAK case 9: YY_RULE_SETUP -#line 119 "Scanner.l" +#line 125 "Scanner.l" { return TOK_SET_CURRENT_NAME; } YY_BREAK case 10: YY_RULE_SETUP -#line 123 "Scanner.l" +#line 129 "Scanner.l" { return TOK_SET_CURRENT_ADDRESS; } YY_BREAK case 11: YY_RULE_SETUP -#line 127 "Scanner.l" +#line 133 "Scanner.l" { return TOK_SET_CURRENT_PHONE; } YY_BREAK case 12: YY_RULE_SETUP -#line 131 "Scanner.l" +#line 137 "Scanner.l" { return TOK_REMOVE_CURRENT; } YY_BREAK case 13: YY_RULE_SETUP -#line 135 "Scanner.l" +#line 141 "Scanner.l" { return TOK_SET_EVICTOR_SIZE; } YY_BREAK case 14: YY_RULE_SETUP -#line 139 "Scanner.l" +#line 145 "Scanner.l" { return TOK_SHUTDOWN; } @@ -943,7 +949,7 @@ YY_RULE_SETUP case 15: /* rule 15 can match eol */ YY_RULE_SETUP -#line 143 "Scanner.l" +#line 149 "Scanner.l" { size_t len = strlen(yytext); for(size_t i = 0; i < len; ++i) @@ -958,14 +964,14 @@ YY_RULE_SETUP case 16: /* rule 16 can match eol */ YY_RULE_SETUP -#line 154 "Scanner.l" +#line 160 "Scanner.l" { return ';'; } YY_BREAK case 17: YY_RULE_SETUP -#line 158 "Scanner.l" +#line 164 "Scanner.l" { // "..."-type strings string s; @@ -992,13 +998,13 @@ YY_RULE_SETUP s += next; break; } - + case 'n': { s += '\n'; break; } - + case 'r': { s += '\r'; @@ -1010,19 +1016,19 @@ YY_RULE_SETUP s += '\t'; break; } - + case 'v': { s += '\v'; break; } - + case 'f': { s += '\f'; break; } - + default: { s += c; @@ -1042,7 +1048,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 232 "Scanner.l" +#line 238 "Scanner.l" { // '...'-type strings string s; @@ -1070,7 +1076,7 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 257 "Scanner.l" +#line 263 "Scanner.l" { // Simple strings string s; @@ -1087,7 +1093,7 @@ YY_RULE_SETUP unput(c); break; } - + s += c; } yylvalp->clear(); @@ -1097,10 +1103,10 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP -#line 281 "Scanner.l" +#line 287 "Scanner.l" ECHO; YY_BREAK -#line 1103 "lex.yy.c" +#line 1109 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2094,7 +2100,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 281 "Scanner.l" +#line 287 "Scanner.l" diff --git a/cpp/demo/Freeze/phonebook/Scanner.l b/cpp/demo/Freeze/phonebook/Scanner.l index d1f52633d65..810fddd819a 100644 --- a/cpp/demo/Freeze/phonebook/Scanner.l +++ b/cpp/demo/Freeze/phonebook/Scanner.l @@ -12,17 +12,23 @@ #include <Parser.h> #include <Grammar.h> -#if defined(_MSC_VER) && defined(ICE_64) +#if defined(_MSC_VER) +#if defined(ICE_64) // // '=' : conversion from 'size_t' to 'int', possible loss of data // The result of fread() is a size_t and gets inserted into an int // -# pragma warning( 4 : 4267 ) +# pragma warning( disable : 4267) // // 'initializing' : conversion from '__int64' to 'int', possible loss of data // Puts a pointer-difference into an int // -# pragma warning( 4 : 4244 ) +# pragma warning( disable : 4244) +#endif +// +// conditional expression is constant +// +# pragma warning( disable : 4127) #endif using namespace std; @@ -181,13 +187,13 @@ NL [\n] s += next; break; } - + case 'n': { s += '\n'; break; } - + case 'r': { s += '\r'; @@ -199,19 +205,19 @@ NL [\n] s += '\t'; break; } - + case 'v': { s += '\v'; break; } - + case 'f': { s += '\f'; break; } - + default: { s += c; @@ -270,7 +276,7 @@ NL [\n] unput(c); break; } - + s += c; } yylvalp->clear(); diff --git a/cpp/demo/Glacier2/callback/Client.cpp b/cpp/demo/Glacier2/callback/Client.cpp index 6424cd06553..bf8b39e504f 100644 --- a/cpp/demo/Glacier2/callback/Client.cpp +++ b/cpp/demo/Glacier2/callback/Client.cpp @@ -63,7 +63,7 @@ Glacier2::SessionPrx CallbackClient::createSession() { Glacier2::SessionPrx session; - while(true) + while(!session) { cout << "This demo accepts any user-id / password combination.\n"; diff --git a/cpp/demo/Glacier2/chat/Client.cpp b/cpp/demo/Glacier2/chat/Client.cpp index 74b92fd7c5f..91e65fbe6df 100644 --- a/cpp/demo/Glacier2/chat/Client.cpp +++ b/cpp/demo/Glacier2/chat/Client.cpp @@ -50,25 +50,25 @@ public: Glacier2::Application(Ice::NoSignalHandling) { } - + virtual Glacier2::SessionPrx createSession() { ChatSessionPrx session; - while(true) + while(!session) { cout << "This demo accepts any user-id / password combination.\n"; - + string id; cout << "user id: " << flush; getline(cin, id); id = trim(id); - + string pw; cout << "password: " << flush; getline(cin, pw); pw = trim(pw); - + try { session = ChatSessionPrx::uncheckedCast(router()->createSession(id, pw)); @@ -96,7 +96,7 @@ public: } Ice::Identity callbackReceiverIdent = createCallbackIdentity("callbackReceiver"); - + ChatCallbackPtr cb = new ChatCallbackI; ChatCallbackPrx callback = ChatCallbackPrx::uncheckedCast(objectAdapter()->add(cb, callbackReceiverIdent)); diff --git a/cpp/demo/Ice/bidir/CallbackI.cpp b/cpp/demo/Ice/bidir/CallbackI.cpp index 35ba0bc3641..eaaf0046f18 100644 --- a/cpp/demo/Ice/bidir/CallbackI.cpp +++ b/cpp/demo/Ice/bidir/CallbackI.cpp @@ -24,10 +24,10 @@ CallbackSenderI::destroy() { { IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this); - + cout << "destroying callback sender" << endl; _destroy = true; - + notify(); } @@ -49,7 +49,8 @@ void CallbackSenderI::run() { int num = 0; - while(true) + bool destroy = false; + while(!destroy) { std::set<Demo::CallbackReceiverPrx> clients; { @@ -58,7 +59,8 @@ CallbackSenderI::run() if(_destroy) { - break; + destroy = true; + continue; } clients = _clients; diff --git a/cpp/demo/Ice/callback/Client.cpp b/cpp/demo/Ice/callback/Client.cpp index 4914daab11d..17fe9be71b8 100644 --- a/cpp/demo/Ice/callback/Client.cpp +++ b/cpp/demo/Ice/callback/Client.cpp @@ -78,7 +78,7 @@ CallbackClient::run(int argc, char*[]) cerr << appName() << ": invalid proxy" << endl; return EXIT_FAILURE; } - + Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Callback.Client"); CallbackReceiverPtr cr = new CallbackReceiverI; adapter->add(cr, communicator()->stringToIdentity("callbackReceiver")); @@ -89,7 +89,7 @@ CallbackClient::run(int argc, char*[]) menu(); - char c; + char c = 'x'; do { try diff --git a/cpp/demo/Ice/multicast/Server.cpp b/cpp/demo/Ice/multicast/Server.cpp index da2567a27ec..8d21e45bf31 100644 --- a/cpp/demo/Ice/multicast/Server.cpp +++ b/cpp/demo/Ice/multicast/Server.cpp @@ -50,6 +50,9 @@ public: private: + // Required to prevent compiler warnings with MSVC++ + DiscoverI& operator=(const DiscoverI&); + const Ice::ObjectPrx _obj; }; diff --git a/cpp/demo/Ice/nested/NestedI.h b/cpp/demo/Ice/nested/NestedI.h index 1e66bb54008..ea95a5658df 100644 --- a/cpp/demo/Ice/nested/NestedI.h +++ b/cpp/demo/Ice/nested/NestedI.h @@ -21,6 +21,9 @@ public: private: + // Required to prevent compiler warnings with MSVC++ + NestedI& operator=(const NestedI&); + const Demo::NestedPrx _self; }; diff --git a/cpp/demo/Ice/session/Client.cpp b/cpp/demo/Ice/session/Client.cpp index d91eadcf234..78ed5e25539 100644 --- a/cpp/demo/Ice/session/Client.cpp +++ b/cpp/demo/Ice/session/Client.cpp @@ -46,6 +46,9 @@ public: private: + // Required to prevent compiler warnings with MSVC++ + RefreshTask& operator=(const RefreshTask&); + const Ice::LoggerPtr _logger; const SessionPrx _session; }; @@ -115,7 +118,7 @@ SessionClient::run(int argc, char* argv[]) { IceUtil::Mutex::Lock sync(_mutex); _session = factory->create(name); - + _timer = new IceUtil::Timer(); _timer->scheduleRepeated(new RefreshTask(communicator()->getLogger(), _session), IceUtil::Time::seconds(5)); } @@ -128,60 +131,59 @@ SessionClient::run(int argc, char* argv[]) { bool destroy = true; bool shutdown = false; - while(true) + do { cout << "==> "; char c; cin >> c; - if(!cin.good()) - { - break; - } - if(isdigit(c)) + if(cin.good()) { - string s; - s += c; - vector<HelloPrx>::size_type index = atoi(s.c_str()); - if(index < hellos.size()) + if(isdigit(c)) + { + string s; + s += c; + vector<HelloPrx>::size_type index = atoi(s.c_str()); + if(index < hellos.size()) + { + hellos[index]->sayHello(); + } + else + { + cout << "Index is too high. " << hellos.size() << " hello objects exist so far.\n" + << "Use `c' to create a new hello object." << endl; + } + } + else if(c == 'c') + { + hellos.push_back(_session->createHello()); + cout << "Created hello object " << hellos.size() - 1 << endl; + } + else if(c == 's') + { + destroy = false; + shutdown = true; + break; + } + else if(c == 'x') + { + break; + } + else if(c == 't') + { + destroy = false; + break; + } + else if(c == '?') { - hellos[index]->sayHello(); + menu(); } else { - cout << "Index is too high. " << hellos.size() << " hello objects exist so far.\n" - << "Use `c' to create a new hello object." << endl; + cout << "Unknown command `" << c << "'." << endl; + menu(); } } - else if(c == 'c') - { - hellos.push_back(_session->createHello()); - cout << "Created hello object " << hellos.size() - 1 << endl; - } - else if(c == 's') - { - destroy = false; - shutdown = true; - break; - } - else if(c == 'x') - { - break; - } - else if(c == 't') - { - destroy = false; - break; - } - else if(c == '?') - { - menu(); - } - else - { - cout << "Unknown command `" << c << "'." << endl; - menu(); - } - } + } while(cin.good()); cleanup(destroy); if(shutdown) @@ -220,7 +222,7 @@ SessionClient::cleanup(bool destroy) _timer->destroy(); _timer = 0; } - + if(destroy && _session) { _session->destroy(); diff --git a/cpp/demo/Ice/session/ReapTask.h b/cpp/demo/Ice/session/ReapTask.h index e21c4989ca9..ed5af848719 100644 --- a/cpp/demo/Ice/session/ReapTask.h +++ b/cpp/demo/Ice/session/ReapTask.h @@ -31,6 +31,10 @@ private: { SessionProxyPair(const Demo::SessionPrx& p, const SessionIPtr& s) : proxy(p), session(s) { } + + // Required to prevent compiler warnings with MSVC++ + SessionProxyPair& operator=(const SessionProxyPair&); + const Demo::SessionPrx proxy; const SessionIPtr session; }; diff --git a/cpp/demo/Ice/session/SessionFactoryI.h b/cpp/demo/Ice/session/SessionFactoryI.h index d3e17a7b170..17bd5a399e2 100644 --- a/cpp/demo/Ice/session/SessionFactoryI.h +++ b/cpp/demo/Ice/session/SessionFactoryI.h @@ -23,6 +23,9 @@ public: virtual Demo::SessionPrx create(const std::string&, const Ice::Current&); virtual void shutdown(const Ice::Current&); + + SessionFactoryI& operator=(const SessionFactoryI&) { return *this; } + private: const ReapTaskPtr _reaper; diff --git a/cpp/demo/Ice/session/SessionI.cpp b/cpp/demo/Ice/session/SessionI.cpp index 8eb4cd96575..d5eb97e6ce7 100644 --- a/cpp/demo/Ice/session/SessionI.cpp +++ b/cpp/demo/Ice/session/SessionI.cpp @@ -36,6 +36,9 @@ public: private: + // Required to prevent compiler warnings with MSVC++ + HelloI& operator=(const HelloI&); + const string _name; const int _id; }; diff --git a/cpp/demo/Ice/value/ValueI.h b/cpp/demo/Ice/value/ValueI.h index 6fe146bf868..d97f08f2df5 100644 --- a/cpp/demo/Ice/value/ValueI.h +++ b/cpp/demo/Ice/value/ValueI.h @@ -27,6 +27,9 @@ public: private: + // Required to prevent compiler warnings with MSVC++ + InitialI& operator=(const InitialI&); + const Demo::SimplePtr _simple; const Demo::PrinterPtr _printer; const Demo::PrinterPrx _printerProxy; diff --git a/cpp/demo/IceBox/hello/Client.cpp b/cpp/demo/IceBox/hello/Client.cpp index 437fb90db3c..a827c9f270f 100644 --- a/cpp/demo/IceBox/hello/Client.cpp +++ b/cpp/demo/IceBox/hello/Client.cpp @@ -67,7 +67,7 @@ HelloClient::run(int argc, char* argv[]) menu(); - char c; + char c = 'x'; do { try @@ -115,13 +115,13 @@ HelloClient::run(int argc, char* argv[]) else if(c == 'S') { secure = !secure; - + twoway = HelloPrx::uncheckedCast(twoway->ice_secure(secure)); oneway = HelloPrx::uncheckedCast(oneway->ice_secure(secure)); batchOneway = HelloPrx::uncheckedCast(batchOneway->ice_secure(secure)); datagram = HelloPrx::uncheckedCast(datagram->ice_secure(secure)); batchDatagram = HelloPrx::uncheckedCast(batchDatagram->ice_secure(secure)); - + if(secure) { cout << "secure mode is now on" << endl; diff --git a/cpp/demo/IceDiscovery/replication/HelloI.h b/cpp/demo/IceDiscovery/replication/HelloI.h index 69c4ff1cdf6..f32fdb60f94 100644 --- a/cpp/demo/IceDiscovery/replication/HelloI.h +++ b/cpp/demo/IceDiscovery/replication/HelloI.h @@ -22,7 +22,10 @@ public: virtual void shutdown(const Ice::Current&); private: - + + // Required to prevent compiler warnings with MSVC++ + HelloI& operator=(const HelloI&); + const std::string _name; }; diff --git a/cpp/demo/IceGrid/allocate/Client.cpp b/cpp/demo/IceGrid/allocate/Client.cpp index d7ab8270ae7..5afe84517d0 100644 --- a/cpp/demo/IceGrid/allocate/Client.cpp +++ b/cpp/demo/IceGrid/allocate/Client.cpp @@ -65,8 +65,7 @@ HelloClient::run(int argc, char* argv[]) } IceGrid::SessionPrx session; - - while(true) + while(!session) { cout << "This demo accepts any user-id / password combination.\n"; @@ -114,10 +113,10 @@ HelloClient::run(int argc, char* argv[]) { hello = HelloPrx::checkedCast(session->allocateObjectByType("::Demo::Hello")); } - + menu(); - - char c; + + char c = 'x'; do { try @@ -165,7 +164,7 @@ HelloClient::run(int argc, char* argv[]) } session->destroy(); - + return status; } diff --git a/cpp/demo/IceGrid/allocate/HelloI.h b/cpp/demo/IceGrid/allocate/HelloI.h index 2a7a8e6fcfe..83be0debf12 100644 --- a/cpp/demo/IceGrid/allocate/HelloI.h +++ b/cpp/demo/IceGrid/allocate/HelloI.h @@ -22,7 +22,10 @@ public: virtual void shutdown(const Ice::Current&); private: - + + // Required to prevent compiler warnings with MSVC++ + HelloI& operator=(const HelloI&); + const std::string _name; }; diff --git a/cpp/demo/IceGrid/customLoadBalancing/PricingI.h b/cpp/demo/IceGrid/customLoadBalancing/PricingI.h index 617e59ee609..2f74982086a 100644 --- a/cpp/demo/IceGrid/customLoadBalancing/PricingI.h +++ b/cpp/demo/IceGrid/customLoadBalancing/PricingI.h @@ -21,7 +21,10 @@ public: virtual Ice::StringSeq getPreferredCurrencies(const Ice::Current&); private: - + + // Required to prevent compiler warnings with MSVC++ + PricingI& operator=(const PricingI&); + const Ice::StringSeq _currencies; }; diff --git a/cpp/demo/IceGrid/customLoadBalancing/RegistryPlugin.cpp b/cpp/demo/IceGrid/customLoadBalancing/RegistryPlugin.cpp index 1aae8935f40..9dc5e7557af 100644 --- a/cpp/demo/IceGrid/customLoadBalancing/RegistryPlugin.cpp +++ b/cpp/demo/IceGrid/customLoadBalancing/RegistryPlugin.cpp @@ -21,12 +21,15 @@ class RegistryPluginI : public Ice::Plugin public: RegistryPluginI(const Ice::CommunicatorPtr&); - + virtual void initialize(); virtual void destroy(); private: + // Required to prevent compiler warnings with MSVC++ + RegistryPluginI& operator=(const RegistryPluginI&); + const Ice::CommunicatorPtr _communicator; }; @@ -81,9 +84,9 @@ ReplicaGroupFilterI::ReplicaGroupFilterI(const IceGrid::RegistryPluginFacadePtr& } Ice::StringSeq -ReplicaGroupFilterI::filter(const string& /* replicaGroupId */, - const Ice::StringSeq& adapters, - const Ice::ConnectionPtr&, +ReplicaGroupFilterI::filter(const string& /* replicaGroupId */, + const Ice::StringSeq& adapters, + const Ice::ConnectionPtr&, const Ice::Context& ctx) { Ice::Context::const_iterator p = ctx.find("currency"); diff --git a/cpp/demo/IceGrid/icebox/HelloI.h b/cpp/demo/IceGrid/icebox/HelloI.h index 4cba16b71a7..13feab4e198 100644 --- a/cpp/demo/IceGrid/icebox/HelloI.h +++ b/cpp/demo/IceGrid/icebox/HelloI.h @@ -21,6 +21,10 @@ public: virtual void sayHello(const Ice::Current&); private: + + // Required to prevent compiler warnings with MSVC++ + HelloI& operator=(const HelloI&); + const std::string _serviceName; }; diff --git a/cpp/demo/IceGrid/replication/HelloI.h b/cpp/demo/IceGrid/replication/HelloI.h index 69c4ff1cdf6..f32fdb60f94 100644 --- a/cpp/demo/IceGrid/replication/HelloI.h +++ b/cpp/demo/IceGrid/replication/HelloI.h @@ -22,7 +22,10 @@ public: virtual void shutdown(const Ice::Current&); private: - + + // Required to prevent compiler warnings with MSVC++ + HelloI& operator=(const HelloI&); + const std::string _name; }; diff --git a/cpp/demo/IceGrid/secure/Client.cpp b/cpp/demo/IceGrid/secure/Client.cpp index 196100eb5a0..a3ef397705c 100644 --- a/cpp/demo/IceGrid/secure/Client.cpp +++ b/cpp/demo/IceGrid/secure/Client.cpp @@ -53,7 +53,7 @@ HelloClient::run(int argc, char* argv[]) // // First we try to connect to the object with the `hello' - // identity. If it's not registered with the registry, we + // identity. If it's not registered with the registry, we // search for an object with the ::Demo::Hello type. // HelloPrx hello; @@ -71,10 +71,10 @@ HelloClient::run(int argc, char* argv[]) cerr << argv[0] << ": couldn't find a `::Demo::Hello' object." << endl; return EXIT_FAILURE; } - + menu(); - char c; + char c = 'x'; do { try diff --git a/cpp/demo/IceGrid/secure/HelloI.h b/cpp/demo/IceGrid/secure/HelloI.h index 2a7a8e6fcfe..83be0debf12 100644 --- a/cpp/demo/IceGrid/secure/HelloI.h +++ b/cpp/demo/IceGrid/secure/HelloI.h @@ -22,7 +22,10 @@ public: virtual void shutdown(const Ice::Current&); private: - + + // Required to prevent compiler warnings with MSVC++ + HelloI& operator=(const HelloI&); + const std::string _name; }; diff --git a/cpp/demo/IceGrid/sessionActivation/Client.cpp b/cpp/demo/IceGrid/sessionActivation/Client.cpp index fce8b1d382d..d7ca3028dd9 100644 --- a/cpp/demo/IceGrid/sessionActivation/Client.cpp +++ b/cpp/demo/IceGrid/sessionActivation/Client.cpp @@ -56,7 +56,7 @@ HelloClient::run(int argc, char* argv[]) int status = EXIT_SUCCESS; - IceGrid::RegistryPrx registry = + IceGrid::RegistryPrx registry = IceGrid::RegistryPrx::checkedCast(communicator()->stringToProxy("DemoIceGrid/Registry")); if(!registry) { @@ -65,7 +65,7 @@ HelloClient::run(int argc, char* argv[]) } IceGrid::SessionPrx session; - while(true) + while(!session) { cout << "This demo accepts any user-id / password combination.\n"; @@ -80,7 +80,7 @@ HelloClient::run(int argc, char* argv[]) password = trim(password); try - { + { session = registry->createSession(id, password); break; } @@ -102,7 +102,7 @@ HelloClient::run(int argc, char* argv[]) menu(); - char c; + char c = 'x'; do { try diff --git a/cpp/demo/IceGrid/sessionActivation/HelloI.h b/cpp/demo/IceGrid/sessionActivation/HelloI.h index 340620167c5..9939918a94b 100644 --- a/cpp/demo/IceGrid/sessionActivation/HelloI.h +++ b/cpp/demo/IceGrid/sessionActivation/HelloI.h @@ -21,7 +21,10 @@ public: virtual void sayHello(const Ice::Current&); private: - + + // Required to prevent compiler warnings with MSVC++ + HelloI& operator=(const HelloI&); + const std::string _name; }; diff --git a/cpp/demo/IceGrid/simple/Client.cpp b/cpp/demo/IceGrid/simple/Client.cpp index 196100eb5a0..a3ef397705c 100644 --- a/cpp/demo/IceGrid/simple/Client.cpp +++ b/cpp/demo/IceGrid/simple/Client.cpp @@ -53,7 +53,7 @@ HelloClient::run(int argc, char* argv[]) // // First we try to connect to the object with the `hello' - // identity. If it's not registered with the registry, we + // identity. If it's not registered with the registry, we // search for an object with the ::Demo::Hello type. // HelloPrx hello; @@ -71,10 +71,10 @@ HelloClient::run(int argc, char* argv[]) cerr << argv[0] << ": couldn't find a `::Demo::Hello' object." << endl; return EXIT_FAILURE; } - + menu(); - char c; + char c = 'x'; do { try diff --git a/cpp/demo/IceGrid/simple/HelloI.h b/cpp/demo/IceGrid/simple/HelloI.h index 2a7a8e6fcfe..83be0debf12 100644 --- a/cpp/demo/IceGrid/simple/HelloI.h +++ b/cpp/demo/IceGrid/simple/HelloI.h @@ -22,7 +22,10 @@ public: virtual void shutdown(const Ice::Current&); private: - + + // Required to prevent compiler warnings with MSVC++ + HelloI& operator=(const HelloI&); + const std::string _name; }; diff --git a/cpp/demo/IceStorm/clock/Publisher.cpp b/cpp/demo/IceStorm/clock/Publisher.cpp index ce0df4ab6f4..0586cabab56 100644 --- a/cpp/demo/IceStorm/clock/Publisher.cpp +++ b/cpp/demo/IceStorm/clock/Publisher.cpp @@ -130,13 +130,14 @@ Publisher::run(int argc, char* argv[]) { publisher = publisher->ice_oneway(); } - + ClockPrx clock = ClockPrx::uncheckedCast(publisher); cout << "publishing tick events. Press ^C to terminate the application." << endl; try { - while(true) + bool stop = false; + while(!stop) { clock->tick(IceUtil::Time::now().toDateTime()); IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(1)); diff --git a/cpp/demo/IceStorm/counter/Client.cpp b/cpp/demo/IceStorm/counter/Client.cpp index 56c297a73e9..653ecf9d307 100644 --- a/cpp/demo/IceStorm/counter/Client.cpp +++ b/cpp/demo/IceStorm/counter/Client.cpp @@ -8,7 +8,7 @@ // ********************************************************************** #include <Ice/Ice.h> - + #include <CounterObserverI.h> using namespace std; @@ -60,7 +60,7 @@ Client::run(int argc, char*[]) MTPrinterPtr printer = new MTPrinter(); Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints("Observer", "tcp"); - CounterObserverPrx observer = + CounterObserverPrx observer = CounterObserverPrx::uncheckedCast(adapter->addWithUUID(new CounterObserverI(printer))); adapter->activate(); @@ -68,7 +68,7 @@ Client::run(int argc, char*[]) menu(printer); - char c; + char c = 'x'; do { try diff --git a/cpp/demo/IceStorm/replicated/Publisher.cpp b/cpp/demo/IceStorm/replicated/Publisher.cpp index ce0df4ab6f4..0586cabab56 100644 --- a/cpp/demo/IceStorm/replicated/Publisher.cpp +++ b/cpp/demo/IceStorm/replicated/Publisher.cpp @@ -130,13 +130,14 @@ Publisher::run(int argc, char* argv[]) { publisher = publisher->ice_oneway(); } - + ClockPrx clock = ClockPrx::uncheckedCast(publisher); cout << "publishing tick events. Press ^C to terminate the application." << endl; try { - while(true) + bool stop = false; + while(!stop) { clock->tick(IceUtil::Time::now().toDateTime()); IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(1)); diff --git a/cpp/demo/IceStorm/replicated2/Publisher.cpp b/cpp/demo/IceStorm/replicated2/Publisher.cpp index ce0df4ab6f4..0586cabab56 100644 --- a/cpp/demo/IceStorm/replicated2/Publisher.cpp +++ b/cpp/demo/IceStorm/replicated2/Publisher.cpp @@ -130,13 +130,14 @@ Publisher::run(int argc, char* argv[]) { publisher = publisher->ice_oneway(); } - + ClockPrx clock = ClockPrx::uncheckedCast(publisher); cout << "publishing tick events. Press ^C to terminate the application." << endl; try { - while(true) + bool stop = false; + while(!stop) { clock->tick(IceUtil::Time::now().toDateTime()); IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(1)); diff --git a/cpp/demo/Makefile.mak b/cpp/demo/Makefile.mak index 47ff46b22e9..8876894bfa9 100644 --- a/cpp/demo/Makefile.mak +++ b/cpp/demo/Makefile.mak @@ -26,7 +26,11 @@ SUBDIRS = $(SUBDIRS) \ IcePatch2 !endif +!if "$(ice_git_dist)" != "" +MAXWARN = MAXWARN=yes +!endif + $(EVERYTHING):: @for %i in ( $(SUBDIRS) ) do \ @echo "making $@ in %i" && \ - cmd /c "cd %i && $(MAKE) -nologo -f Makefile.mak $@" || exit 1 + cmd /c "cd %i && $(MAKE) $(MAXWARN) -nologo -f Makefile.mak $@" || exit 1 diff --git a/cpp/demo/Manual/evictor_filesystem/Grammar.cpp b/cpp/demo/Manual/evictor_filesystem/Grammar.cpp index d5d94a3c064..b65090aaa38 100644 --- a/cpp/demo/Manual/evictor_filesystem/Grammar.cpp +++ b/cpp/demo/Manual/evictor_filesystem/Grammar.cpp @@ -1,23 +1,24 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify + + 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - + the Free Software Foundation; either version 2, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -28,7 +29,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -46,7 +47,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -54,20 +55,49 @@ /* Pure parsers. */ #define YYPURE 1 -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - /* Using locations. */ #define YYLSP_NEEDED 0 -/* Copy the first part of user declarations. */ +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + TOK_HELP = 258, + TOK_EXIT = 259, + TOK_STRING = 260, + TOK_LIST = 261, + TOK_LIST_RECURSIVE = 262, + TOK_CREATE_FILE = 263, + TOK_CREATE_DIR = 264, + TOK_PWD = 265, + TOK_CD = 266, + TOK_CAT = 267, + TOK_WRITE = 268, + TOK_RM = 269 + }; +#endif +/* Tokens. */ +#define TOK_HELP 258 +#define TOK_EXIT 259 +#define TOK_STRING 260 +#define TOK_LIST 261 +#define TOK_LIST_RECURSIVE 262 +#define TOK_CREATE_FILE 263 +#define TOK_CREATE_DIR 264 +#define TOK_PWD 265 +#define TOK_CD 266 +#define TOK_CAT 267 +#define TOK_WRITE 268 +#define TOK_RM 269 + + -/* Line 189 of yacc.c */ + +/* Copy the first part of user declarations. */ #line 1 "Grammar.y" @@ -88,6 +118,12 @@ # pragma warning( disable : 4102 ) // warning C4065: switch statement contains 'default' but no 'case' labels # pragma warning( disable : 4065 ) +// warning C4127: conditional expression is constant +# pragma warning( disable : 4127 ) +// warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data +# pragma warning( disable : 4244 ) +// warning C4702: unreachable code +# pragma warning( disable : 4702 ) #endif using namespace std; @@ -100,9 +136,6 @@ yyerror(const char* s) -/* Line 189 of yacc.c */ -#line 105 "Grammar.tab.c" - /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -121,43 +154,20 @@ yyerror(const char* s) # define YYTOKEN_TABLE 0 #endif - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_HELP = 258, - TOK_EXIT = 259, - TOK_STRING = 260, - TOK_LIST = 261, - TOK_LIST_RECURSIVE = 262, - TOK_CREATE_FILE = 263, - TOK_CREATE_DIR = 264, - TOK_PWD = 265, - TOK_CD = 266, - TOK_CAT = 267, - TOK_WRITE = 268, - TOK_RM = 269 - }; -#endif - - - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif + /* Copy the second part of user declarations. */ -/* Line 264 of yacc.c */ -#line 161 "Grammar.tab.c" +/* Line 216 of yacc.c. */ +#line 171 "Grammar.tab.c" #ifdef short # undef short @@ -232,14 +242,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int yyi) +YYID (int i) #else static int -YYID (yyi) - int yyi; +YYID (i) + int i; #endif { - return yyi; + return i; } #endif @@ -320,9 +330,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; + yytype_int16 yyss; + YYSTYPE yyvs; + }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -356,12 +366,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ +# define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -446,9 +456,9 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 52, 52, 56, 63, 66, 74, 78, 82, 86, - 90, 94, 98, 102, 106, 110, 114, 118, 122, 127, - 135, 140 + 0, 58, 58, 62, 69, 72, 80, 84, 88, 92, + 96, 100, 104, 108, 112, 116, 120, 124, 128, 133, + 141, 146 }; #endif @@ -736,20 +746,17 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } @@ -783,11 +790,11 @@ yy_reduce_print (yyvsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - YYFPRINTF (stderr, " $%d = ", yyi + 1); + fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - YYFPRINTF (stderr, "\n"); + fprintf (stderr, "\n"); } } @@ -1067,8 +1074,10 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } + /* Prevent warnings from -Wmissing-prototypes. */ + #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1087,9 +1096,10 @@ int yyparse (); -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ + +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1113,46 +1123,22 @@ yyparse () #endif #endif { -/* The lookahead symbol. */ + /* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; - /* Number of syntax errors so far. */ - int yynerrs; - - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; +/* Number of syntax errors so far. */ +int yynerrs; + int yystate; int yyn; int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; @@ -1160,28 +1146,51 @@ YYSTYPE yylval; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; - yystacksize = YYINITDEPTH; - YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + 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; @@ -1211,6 +1220,7 @@ YYSTYPE yylval; YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; + /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -1218,6 +1228,7 @@ YYSTYPE yylval; yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); yyss = yyss1; @@ -1240,8 +1251,9 @@ YYSTYPE yylval; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1252,6 +1264,7 @@ YYSTYPE yylval; yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; + YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1261,9 +1274,6 @@ YYSTYPE yylval; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - if (yystate == YYFINAL) - YYACCEPT; - goto yybackup; /*-----------. @@ -1272,16 +1282,16 @@ YYSTYPE yylval; yybackup: /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ + look-ahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1313,16 +1323,20 @@ yybackup: goto yyreduce; } + if (yyn == YYFINAL) + YYACCEPT; + /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the lookahead token. */ + /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token. */ - yychar = YYEMPTY; + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1362,149 +1376,115 @@ yyreduce: switch (yyn) { case 2: - -/* Line 1455 of yacc.c */ -#line 53 "Grammar.y" +#line 59 "Grammar.y" { ;} break; case 3: - -/* Line 1455 of yacc.c */ -#line 56 "Grammar.y" +#line 62 "Grammar.y" { ;} break; case 4: - -/* Line 1455 of yacc.c */ -#line 64 "Grammar.y" +#line 70 "Grammar.y" { ;} break; case 5: - -/* Line 1455 of yacc.c */ -#line 67 "Grammar.y" +#line 73 "Grammar.y" { ;} break; case 6: - -/* Line 1455 of yacc.c */ -#line 75 "Grammar.y" +#line 81 "Grammar.y" { parser->usage(); ;} break; case 7: - -/* Line 1455 of yacc.c */ -#line 79 "Grammar.y" +#line 85 "Grammar.y" { return 0; ;} break; case 8: - -/* Line 1455 of yacc.c */ -#line 83 "Grammar.y" +#line 89 "Grammar.y" { parser->list(false); ;} break; case 9: - -/* Line 1455 of yacc.c */ -#line 87 "Grammar.y" +#line 93 "Grammar.y" { parser->list(true); ;} break; case 10: - -/* Line 1455 of yacc.c */ -#line 91 "Grammar.y" +#line 97 "Grammar.y" { parser->createFile((yyvsp[(2) - (2)])); ;} break; case 11: - -/* Line 1455 of yacc.c */ -#line 95 "Grammar.y" +#line 101 "Grammar.y" { parser->createDir((yyvsp[(2) - (2)])); ;} break; case 12: - -/* Line 1455 of yacc.c */ -#line 99 "Grammar.y" +#line 105 "Grammar.y" { parser->pwd(); ;} break; case 13: - -/* Line 1455 of yacc.c */ -#line 103 "Grammar.y" +#line 109 "Grammar.y" { parser->cd("/"); ;} break; case 14: - -/* Line 1455 of yacc.c */ -#line 107 "Grammar.y" +#line 113 "Grammar.y" { parser->cd((yyvsp[(2) - (2)]).front()); ;} break; case 15: - -/* Line 1455 of yacc.c */ -#line 111 "Grammar.y" +#line 117 "Grammar.y" { parser->cat((yyvsp[(2) - (2)]).front()); ;} break; case 16: - -/* Line 1455 of yacc.c */ -#line 115 "Grammar.y" +#line 121 "Grammar.y" { parser->write((yyvsp[(2) - (2)])); ;} break; case 17: - -/* Line 1455 of yacc.c */ -#line 119 "Grammar.y" +#line 125 "Grammar.y" { parser->destroy((yyvsp[(2) - (2)])); ;} break; case 18: - -/* Line 1455 of yacc.c */ -#line 123 "Grammar.y" +#line 129 "Grammar.y" { parser->usage(); yyerrok; @@ -1512,17 +1492,13 @@ yyreduce: break; case 19: - -/* Line 1455 of yacc.c */ -#line 128 "Grammar.y" +#line 134 "Grammar.y" { ;} break; case 20: - -/* Line 1455 of yacc.c */ -#line 136 "Grammar.y" +#line 142 "Grammar.y" { (yyval) = (yyvsp[(2) - (2)]); (yyval).push_front((yyvsp[(1) - (2)]).front()); @@ -1530,18 +1506,15 @@ yyreduce: break; case 21: - -/* Line 1455 of yacc.c */ -#line 141 "Grammar.y" +#line 147 "Grammar.y" { (yyval) = (yyvsp[(1) - (1)]); ;} break; - -/* Line 1455 of yacc.c */ -#line 1545 "Grammar.tab.c" +/* Line 1267 of yacc.c. */ +#line 1518 "Grammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1552,6 +1525,7 @@ yyreduce: *++yyvsp = yyval; + /* 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. */ @@ -1616,7 +1590,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1633,7 +1607,7 @@ yyerrlab: } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; @@ -1690,6 +1664,9 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } + if (yyn == YYFINAL) + YYACCEPT; + *++yyvsp = yylval; @@ -1714,7 +1691,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1725,7 +1702,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEMPTY) + if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered @@ -1751,8 +1728,6 @@ yyreturn: } - -/* Line 1675 of yacc.c */ -#line 146 "Grammar.y" +#line 152 "Grammar.y" diff --git a/cpp/demo/Manual/evictor_filesystem/Grammar.h b/cpp/demo/Manual/evictor_filesystem/Grammar.h index ca5a99150f6..b5b8e41ade4 100644 --- a/cpp/demo/Manual/evictor_filesystem/Grammar.h +++ b/cpp/demo/Manual/evictor_filesystem/Grammar.h @@ -1,23 +1,24 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify + + 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - + the Free Software Foundation; either version 2, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -28,11 +29,10 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ - /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -53,16 +53,29 @@ TOK_RM = 269 }; #endif +/* Tokens. */ +#define TOK_HELP 258 +#define TOK_EXIT 259 +#define TOK_STRING 260 +#define TOK_LIST 261 +#define TOK_LIST_RECURSIVE 262 +#define TOK_CREATE_FILE 263 +#define TOK_CREATE_DIR 264 +#define TOK_PWD 265 +#define TOK_CD 266 +#define TOK_CAT 267 +#define TOK_WRITE 268 +#define TOK_RM 269 + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif - diff --git a/cpp/demo/Manual/evictor_filesystem/Grammar.y b/cpp/demo/Manual/evictor_filesystem/Grammar.y index 2104865c94b..7c3cb792f11 100644 --- a/cpp/demo/Manual/evictor_filesystem/Grammar.y +++ b/cpp/demo/Manual/evictor_filesystem/Grammar.y @@ -17,6 +17,12 @@ # pragma warning( disable : 4102 ) // warning C4065: switch statement contains 'default' but no 'case' labels # pragma warning( disable : 4065 ) +// warning C4127: conditional expression is constant +# pragma warning( disable : 4127 ) +// warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data +# pragma warning( disable : 4244 ) +// warning C4702: unreachable code +# pragma warning( disable : 4702 ) #endif using namespace std; diff --git a/cpp/demo/Manual/evictor_filesystem/Parser.cpp b/cpp/demo/Manual/evictor_filesystem/Parser.cpp index 00d7955a833..eeecee3e55a 100644 --- a/cpp/demo/Manual/evictor_filesystem/Parser.cpp +++ b/cpp/demo/Manual/evictor_filesystem/Parser.cpp @@ -44,7 +44,7 @@ Parser::usage() } // Print the contents of directory "dir". If recursive is true, -// print in tree fashion. +// print in tree fashion. // For files, show the contents of each file. The "depth" // parameter is the current nesting level (for indentation). @@ -339,25 +339,22 @@ Parser::getInput(char* buf, size_t& result, size_t maxSize) cout << parser->getPrompt() << flush; string line; - while(true) + char c; + do { - char c = static_cast<char>(getc(yyin)); + c = static_cast<char>(getc(yyin)); if(c == EOF) { if(line.size()) { line += '\n'; } - break; } - - line += c; - - if(c == '\n') + else { - break; + line += c; } - } + } while(c != EOF && c != '\n'); result = line.length(); if(result > maxSize) diff --git a/cpp/demo/Manual/evictor_filesystem/Scanner.cpp b/cpp/demo/Manual/evictor_filesystem/Scanner.cpp index bf3f8d1f56d..dd7b3732602 100644 --- a/cpp/demo/Manual/evictor_filesystem/Scanner.cpp +++ b/cpp/demo/Manual/evictor_filesystem/Scanner.cpp @@ -500,17 +500,23 @@ char *yytext; #include <Parser.h> #include <Grammar.h> -#if defined(_MSC_VER) && defined(ICE_64) +#if defined(_MSC_VER) +#if defined(ICE_64) // // '=' : conversion from 'size_t' to 'int', possible loss of data // The result of fread() is a size_t and gets inserted into an int // -# pragma warning( 4 : 4267 ) +# pragma warning( disable : 4267) // // 'initializing' : conversion from '__int64' to 'int', possible loss of data // Puts a pointer-difference into an int // -# pragma warning( 4 : 4244 ) +# pragma warning( disable : 4244) +#endif +// +// conditional expression is constant +// +# pragma warning( disable : 4127) #endif using namespace std; @@ -535,7 +541,7 @@ using namespace std; #define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize) -#line 538 "lex.yy.c" +#line 544 "lex.yy.c" #define INITIAL 0 @@ -624,7 +630,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -635,7 +641,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - unsigned n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -717,10 +723,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 58 "Scanner.l" +#line 64 "Scanner.l" -#line 723 "lex.yy.c" +#line 729 "lex.yy.c" if ( !(yy_init) ) { @@ -805,7 +811,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 60 "Scanner.l" +#line 66 "Scanner.l" { // C++-style comment int c; @@ -818,7 +824,7 @@ YY_RULE_SETUP YY_BREAK case 2: YY_RULE_SETUP -#line 70 "Scanner.l" +#line 76 "Scanner.l" { // C-style comment while(true) @@ -846,77 +852,77 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -#line 95 "Scanner.l" +#line 101 "Scanner.l" { return TOK_HELP; } YY_BREAK case 4: YY_RULE_SETUP -#line 99 "Scanner.l" +#line 105 "Scanner.l" { return TOK_EXIT; } YY_BREAK case 5: YY_RULE_SETUP -#line 103 "Scanner.l" +#line 109 "Scanner.l" { return TOK_LIST; } YY_BREAK case 6: YY_RULE_SETUP -#line 107 "Scanner.l" +#line 113 "Scanner.l" { return TOK_LIST_RECURSIVE; } YY_BREAK case 7: YY_RULE_SETUP -#line 111 "Scanner.l" +#line 117 "Scanner.l" { return TOK_CREATE_FILE; } YY_BREAK case 8: YY_RULE_SETUP -#line 115 "Scanner.l" +#line 121 "Scanner.l" { return TOK_CREATE_DIR; } YY_BREAK case 9: YY_RULE_SETUP -#line 119 "Scanner.l" +#line 125 "Scanner.l" { return TOK_PWD; } YY_BREAK case 10: YY_RULE_SETUP -#line 123 "Scanner.l" +#line 129 "Scanner.l" { return TOK_CD; } YY_BREAK case 11: YY_RULE_SETUP -#line 127 "Scanner.l" +#line 133 "Scanner.l" { return TOK_CAT; } YY_BREAK case 12: YY_RULE_SETUP -#line 131 "Scanner.l" +#line 137 "Scanner.l" { return TOK_WRITE; } YY_BREAK case 13: YY_RULE_SETUP -#line 135 "Scanner.l" +#line 141 "Scanner.l" { return TOK_RM; } @@ -924,7 +930,7 @@ YY_RULE_SETUP case 14: /* rule 14 can match eol */ YY_RULE_SETUP -#line 139 "Scanner.l" +#line 145 "Scanner.l" { size_t len = strlen(yytext); for(size_t i = 0; i < len; ++i) @@ -939,14 +945,14 @@ YY_RULE_SETUP case 15: /* rule 15 can match eol */ YY_RULE_SETUP -#line 150 "Scanner.l" +#line 156 "Scanner.l" { return ';'; } YY_BREAK case 16: YY_RULE_SETUP -#line 154 "Scanner.l" +#line 160 "Scanner.l" { // "..."-type strings string s; @@ -973,13 +979,13 @@ YY_RULE_SETUP s += next; break; } - + case 'n': { s += '\n'; break; } - + case 'r': { s += '\r'; @@ -991,19 +997,19 @@ YY_RULE_SETUP s += '\t'; break; } - + case 'v': { s += '\v'; break; } - + case 'f': { s += '\f'; break; } - + default: { s += c; @@ -1023,7 +1029,7 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -#line 228 "Scanner.l" +#line 234 "Scanner.l" { // '...'-type strings string s; @@ -1051,7 +1057,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 253 "Scanner.l" +#line 259 "Scanner.l" { // Simple strings string s; @@ -1068,7 +1074,7 @@ YY_RULE_SETUP unput(c); break; } - + s += c; } yylvalp->clear(); @@ -1078,10 +1084,10 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 277 "Scanner.l" +#line 283 "Scanner.l" ECHO; YY_BREAK -#line 1084 "lex.yy.c" +#line 1090 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2075,7 +2081,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 277 "Scanner.l" +#line 283 "Scanner.l" diff --git a/cpp/demo/Manual/evictor_filesystem/Scanner.l b/cpp/demo/Manual/evictor_filesystem/Scanner.l index 11918ef88d8..c2e42f0eb65 100644 --- a/cpp/demo/Manual/evictor_filesystem/Scanner.l +++ b/cpp/demo/Manual/evictor_filesystem/Scanner.l @@ -12,17 +12,23 @@ #include <Parser.h> #include <Grammar.h> -#if defined(_MSC_VER) && defined(ICE_64) +#if defined(_MSC_VER) +#if defined(ICE_64) // // '=' : conversion from 'size_t' to 'int', possible loss of data // The result of fread() is a size_t and gets inserted into an int // -# pragma warning( 4 : 4267 ) +# pragma warning( disable : 4267) // // 'initializing' : conversion from '__int64' to 'int', possible loss of data // Puts a pointer-difference into an int // -# pragma warning( 4 : 4244 ) +# pragma warning( disable : 4244) +#endif +// +// conditional expression is constant +// +# pragma warning( disable : 4127) #endif using namespace std; @@ -177,13 +183,13 @@ NL [\n] s += next; break; } - + case 'n': { s += '\n'; break; } - + case 'r': { s += '\r'; @@ -195,19 +201,19 @@ NL [\n] s += '\t'; break; } - + case 'v': { s += '\v'; break; } - + case 'f': { s += '\f'; break; } - + default: { s += c; @@ -266,7 +272,7 @@ NL [\n] unput(c); break; } - + s += c; } yylvalp->clear(); diff --git a/cpp/demo/Manual/lifecycle/Grammar.cpp b/cpp/demo/Manual/lifecycle/Grammar.cpp index d5d94a3c064..b65090aaa38 100644 --- a/cpp/demo/Manual/lifecycle/Grammar.cpp +++ b/cpp/demo/Manual/lifecycle/Grammar.cpp @@ -1,23 +1,24 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify + + 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - + the Free Software Foundation; either version 2, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -28,7 +29,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -46,7 +47,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -54,20 +55,49 @@ /* Pure parsers. */ #define YYPURE 1 -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - /* Using locations. */ #define YYLSP_NEEDED 0 -/* Copy the first part of user declarations. */ +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + TOK_HELP = 258, + TOK_EXIT = 259, + TOK_STRING = 260, + TOK_LIST = 261, + TOK_LIST_RECURSIVE = 262, + TOK_CREATE_FILE = 263, + TOK_CREATE_DIR = 264, + TOK_PWD = 265, + TOK_CD = 266, + TOK_CAT = 267, + TOK_WRITE = 268, + TOK_RM = 269 + }; +#endif +/* Tokens. */ +#define TOK_HELP 258 +#define TOK_EXIT 259 +#define TOK_STRING 260 +#define TOK_LIST 261 +#define TOK_LIST_RECURSIVE 262 +#define TOK_CREATE_FILE 263 +#define TOK_CREATE_DIR 264 +#define TOK_PWD 265 +#define TOK_CD 266 +#define TOK_CAT 267 +#define TOK_WRITE 268 +#define TOK_RM 269 + + -/* Line 189 of yacc.c */ + +/* Copy the first part of user declarations. */ #line 1 "Grammar.y" @@ -88,6 +118,12 @@ # pragma warning( disable : 4102 ) // warning C4065: switch statement contains 'default' but no 'case' labels # pragma warning( disable : 4065 ) +// warning C4127: conditional expression is constant +# pragma warning( disable : 4127 ) +// warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data +# pragma warning( disable : 4244 ) +// warning C4702: unreachable code +# pragma warning( disable : 4702 ) #endif using namespace std; @@ -100,9 +136,6 @@ yyerror(const char* s) -/* Line 189 of yacc.c */ -#line 105 "Grammar.tab.c" - /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -121,43 +154,20 @@ yyerror(const char* s) # define YYTOKEN_TABLE 0 #endif - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_HELP = 258, - TOK_EXIT = 259, - TOK_STRING = 260, - TOK_LIST = 261, - TOK_LIST_RECURSIVE = 262, - TOK_CREATE_FILE = 263, - TOK_CREATE_DIR = 264, - TOK_PWD = 265, - TOK_CD = 266, - TOK_CAT = 267, - TOK_WRITE = 268, - TOK_RM = 269 - }; -#endif - - - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif + /* Copy the second part of user declarations. */ -/* Line 264 of yacc.c */ -#line 161 "Grammar.tab.c" +/* Line 216 of yacc.c. */ +#line 171 "Grammar.tab.c" #ifdef short # undef short @@ -232,14 +242,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int yyi) +YYID (int i) #else static int -YYID (yyi) - int yyi; +YYID (i) + int i; #endif { - return yyi; + return i; } #endif @@ -320,9 +330,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; + yytype_int16 yyss; + YYSTYPE yyvs; + }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -356,12 +366,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ +# define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -446,9 +456,9 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 52, 52, 56, 63, 66, 74, 78, 82, 86, - 90, 94, 98, 102, 106, 110, 114, 118, 122, 127, - 135, 140 + 0, 58, 58, 62, 69, 72, 80, 84, 88, 92, + 96, 100, 104, 108, 112, 116, 120, 124, 128, 133, + 141, 146 }; #endif @@ -736,20 +746,17 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } @@ -783,11 +790,11 @@ yy_reduce_print (yyvsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - YYFPRINTF (stderr, " $%d = ", yyi + 1); + fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - YYFPRINTF (stderr, "\n"); + fprintf (stderr, "\n"); } } @@ -1067,8 +1074,10 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } + /* Prevent warnings from -Wmissing-prototypes. */ + #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1087,9 +1096,10 @@ int yyparse (); -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ + +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1113,46 +1123,22 @@ yyparse () #endif #endif { -/* The lookahead symbol. */ + /* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; - /* Number of syntax errors so far. */ - int yynerrs; - - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; +/* Number of syntax errors so far. */ +int yynerrs; + int yystate; int yyn; int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; @@ -1160,28 +1146,51 @@ YYSTYPE yylval; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; - yystacksize = YYINITDEPTH; - YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + 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; @@ -1211,6 +1220,7 @@ YYSTYPE yylval; YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; + /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -1218,6 +1228,7 @@ YYSTYPE yylval; yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); yyss = yyss1; @@ -1240,8 +1251,9 @@ YYSTYPE yylval; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1252,6 +1264,7 @@ YYSTYPE yylval; yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; + YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1261,9 +1274,6 @@ YYSTYPE yylval; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - if (yystate == YYFINAL) - YYACCEPT; - goto yybackup; /*-----------. @@ -1272,16 +1282,16 @@ YYSTYPE yylval; yybackup: /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ + look-ahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1313,16 +1323,20 @@ yybackup: goto yyreduce; } + if (yyn == YYFINAL) + YYACCEPT; + /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the lookahead token. */ + /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token. */ - yychar = YYEMPTY; + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1362,149 +1376,115 @@ yyreduce: switch (yyn) { case 2: - -/* Line 1455 of yacc.c */ -#line 53 "Grammar.y" +#line 59 "Grammar.y" { ;} break; case 3: - -/* Line 1455 of yacc.c */ -#line 56 "Grammar.y" +#line 62 "Grammar.y" { ;} break; case 4: - -/* Line 1455 of yacc.c */ -#line 64 "Grammar.y" +#line 70 "Grammar.y" { ;} break; case 5: - -/* Line 1455 of yacc.c */ -#line 67 "Grammar.y" +#line 73 "Grammar.y" { ;} break; case 6: - -/* Line 1455 of yacc.c */ -#line 75 "Grammar.y" +#line 81 "Grammar.y" { parser->usage(); ;} break; case 7: - -/* Line 1455 of yacc.c */ -#line 79 "Grammar.y" +#line 85 "Grammar.y" { return 0; ;} break; case 8: - -/* Line 1455 of yacc.c */ -#line 83 "Grammar.y" +#line 89 "Grammar.y" { parser->list(false); ;} break; case 9: - -/* Line 1455 of yacc.c */ -#line 87 "Grammar.y" +#line 93 "Grammar.y" { parser->list(true); ;} break; case 10: - -/* Line 1455 of yacc.c */ -#line 91 "Grammar.y" +#line 97 "Grammar.y" { parser->createFile((yyvsp[(2) - (2)])); ;} break; case 11: - -/* Line 1455 of yacc.c */ -#line 95 "Grammar.y" +#line 101 "Grammar.y" { parser->createDir((yyvsp[(2) - (2)])); ;} break; case 12: - -/* Line 1455 of yacc.c */ -#line 99 "Grammar.y" +#line 105 "Grammar.y" { parser->pwd(); ;} break; case 13: - -/* Line 1455 of yacc.c */ -#line 103 "Grammar.y" +#line 109 "Grammar.y" { parser->cd("/"); ;} break; case 14: - -/* Line 1455 of yacc.c */ -#line 107 "Grammar.y" +#line 113 "Grammar.y" { parser->cd((yyvsp[(2) - (2)]).front()); ;} break; case 15: - -/* Line 1455 of yacc.c */ -#line 111 "Grammar.y" +#line 117 "Grammar.y" { parser->cat((yyvsp[(2) - (2)]).front()); ;} break; case 16: - -/* Line 1455 of yacc.c */ -#line 115 "Grammar.y" +#line 121 "Grammar.y" { parser->write((yyvsp[(2) - (2)])); ;} break; case 17: - -/* Line 1455 of yacc.c */ -#line 119 "Grammar.y" +#line 125 "Grammar.y" { parser->destroy((yyvsp[(2) - (2)])); ;} break; case 18: - -/* Line 1455 of yacc.c */ -#line 123 "Grammar.y" +#line 129 "Grammar.y" { parser->usage(); yyerrok; @@ -1512,17 +1492,13 @@ yyreduce: break; case 19: - -/* Line 1455 of yacc.c */ -#line 128 "Grammar.y" +#line 134 "Grammar.y" { ;} break; case 20: - -/* Line 1455 of yacc.c */ -#line 136 "Grammar.y" +#line 142 "Grammar.y" { (yyval) = (yyvsp[(2) - (2)]); (yyval).push_front((yyvsp[(1) - (2)]).front()); @@ -1530,18 +1506,15 @@ yyreduce: break; case 21: - -/* Line 1455 of yacc.c */ -#line 141 "Grammar.y" +#line 147 "Grammar.y" { (yyval) = (yyvsp[(1) - (1)]); ;} break; - -/* Line 1455 of yacc.c */ -#line 1545 "Grammar.tab.c" +/* Line 1267 of yacc.c. */ +#line 1518 "Grammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1552,6 +1525,7 @@ yyreduce: *++yyvsp = yyval; + /* 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. */ @@ -1616,7 +1590,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1633,7 +1607,7 @@ yyerrlab: } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; @@ -1690,6 +1664,9 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } + if (yyn == YYFINAL) + YYACCEPT; + *++yyvsp = yylval; @@ -1714,7 +1691,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1725,7 +1702,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEMPTY) + if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered @@ -1751,8 +1728,6 @@ yyreturn: } - -/* Line 1675 of yacc.c */ -#line 146 "Grammar.y" +#line 152 "Grammar.y" diff --git a/cpp/demo/Manual/lifecycle/Grammar.h b/cpp/demo/Manual/lifecycle/Grammar.h index ca5a99150f6..b5b8e41ade4 100644 --- a/cpp/demo/Manual/lifecycle/Grammar.h +++ b/cpp/demo/Manual/lifecycle/Grammar.h @@ -1,23 +1,24 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify + + 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - + the Free Software Foundation; either version 2, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -28,11 +29,10 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ - /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -53,16 +53,29 @@ TOK_RM = 269 }; #endif +/* Tokens. */ +#define TOK_HELP 258 +#define TOK_EXIT 259 +#define TOK_STRING 260 +#define TOK_LIST 261 +#define TOK_LIST_RECURSIVE 262 +#define TOK_CREATE_FILE 263 +#define TOK_CREATE_DIR 264 +#define TOK_PWD 265 +#define TOK_CD 266 +#define TOK_CAT 267 +#define TOK_WRITE 268 +#define TOK_RM 269 + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif - diff --git a/cpp/demo/Manual/lifecycle/Grammar.y b/cpp/demo/Manual/lifecycle/Grammar.y index 2104865c94b..7c3cb792f11 100644 --- a/cpp/demo/Manual/lifecycle/Grammar.y +++ b/cpp/demo/Manual/lifecycle/Grammar.y @@ -17,6 +17,12 @@ # pragma warning( disable : 4102 ) // warning C4065: switch statement contains 'default' but no 'case' labels # pragma warning( disable : 4065 ) +// warning C4127: conditional expression is constant +# pragma warning( disable : 4127 ) +// warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data +# pragma warning( disable : 4244 ) +// warning C4702: unreachable code +# pragma warning( disable : 4702 ) #endif using namespace std; diff --git a/cpp/demo/Manual/lifecycle/Parser.cpp b/cpp/demo/Manual/lifecycle/Parser.cpp index 8f8644234b1..6bd3c139efe 100644 --- a/cpp/demo/Manual/lifecycle/Parser.cpp +++ b/cpp/demo/Manual/lifecycle/Parser.cpp @@ -44,7 +44,7 @@ Parser::usage() } // Print the contents of directory "dir". If recursive is true, -// print in tree fashion. +// print in tree fashion. // For files, show the contents of each file. The "depth" // parameter is the current nesting level (for indentation). @@ -294,7 +294,7 @@ Parser::destroy(const std::list<string>& names) } // -// With older flex version <= 2.5.35 YY_INPUT second +// With older flex version <= 2.5.35 YY_INPUT second // paramenter is of type int&, in newer versions it // changes to size_t& // @@ -344,25 +344,22 @@ Parser::getInput(char* buf, size_t& result, size_t maxSize) cout << parser->getPrompt() << flush; string line; - while(true) + char c; + do { - char c = static_cast<char>(getc(yyin)); + c = static_cast<char>(getc(yyin)); if(c == EOF) { if(line.size()) { line += '\n'; } - break; } - - line += c; - - if(c == '\n') + else { - break; + line += c; } - } + } while(c != EOF && c != '\n'); result = line.length(); if(result > maxSize) diff --git a/cpp/demo/Manual/lifecycle/Scanner.cpp b/cpp/demo/Manual/lifecycle/Scanner.cpp index bf3f8d1f56d..dd7b3732602 100644 --- a/cpp/demo/Manual/lifecycle/Scanner.cpp +++ b/cpp/demo/Manual/lifecycle/Scanner.cpp @@ -500,17 +500,23 @@ char *yytext; #include <Parser.h> #include <Grammar.h> -#if defined(_MSC_VER) && defined(ICE_64) +#if defined(_MSC_VER) +#if defined(ICE_64) // // '=' : conversion from 'size_t' to 'int', possible loss of data // The result of fread() is a size_t and gets inserted into an int // -# pragma warning( 4 : 4267 ) +# pragma warning( disable : 4267) // // 'initializing' : conversion from '__int64' to 'int', possible loss of data // Puts a pointer-difference into an int // -# pragma warning( 4 : 4244 ) +# pragma warning( disable : 4244) +#endif +// +// conditional expression is constant +// +# pragma warning( disable : 4127) #endif using namespace std; @@ -535,7 +541,7 @@ using namespace std; #define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize) -#line 538 "lex.yy.c" +#line 544 "lex.yy.c" #define INITIAL 0 @@ -624,7 +630,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -635,7 +641,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - unsigned n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -717,10 +723,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 58 "Scanner.l" +#line 64 "Scanner.l" -#line 723 "lex.yy.c" +#line 729 "lex.yy.c" if ( !(yy_init) ) { @@ -805,7 +811,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 60 "Scanner.l" +#line 66 "Scanner.l" { // C++-style comment int c; @@ -818,7 +824,7 @@ YY_RULE_SETUP YY_BREAK case 2: YY_RULE_SETUP -#line 70 "Scanner.l" +#line 76 "Scanner.l" { // C-style comment while(true) @@ -846,77 +852,77 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -#line 95 "Scanner.l" +#line 101 "Scanner.l" { return TOK_HELP; } YY_BREAK case 4: YY_RULE_SETUP -#line 99 "Scanner.l" +#line 105 "Scanner.l" { return TOK_EXIT; } YY_BREAK case 5: YY_RULE_SETUP -#line 103 "Scanner.l" +#line 109 "Scanner.l" { return TOK_LIST; } YY_BREAK case 6: YY_RULE_SETUP -#line 107 "Scanner.l" +#line 113 "Scanner.l" { return TOK_LIST_RECURSIVE; } YY_BREAK case 7: YY_RULE_SETUP -#line 111 "Scanner.l" +#line 117 "Scanner.l" { return TOK_CREATE_FILE; } YY_BREAK case 8: YY_RULE_SETUP -#line 115 "Scanner.l" +#line 121 "Scanner.l" { return TOK_CREATE_DIR; } YY_BREAK case 9: YY_RULE_SETUP -#line 119 "Scanner.l" +#line 125 "Scanner.l" { return TOK_PWD; } YY_BREAK case 10: YY_RULE_SETUP -#line 123 "Scanner.l" +#line 129 "Scanner.l" { return TOK_CD; } YY_BREAK case 11: YY_RULE_SETUP -#line 127 "Scanner.l" +#line 133 "Scanner.l" { return TOK_CAT; } YY_BREAK case 12: YY_RULE_SETUP -#line 131 "Scanner.l" +#line 137 "Scanner.l" { return TOK_WRITE; } YY_BREAK case 13: YY_RULE_SETUP -#line 135 "Scanner.l" +#line 141 "Scanner.l" { return TOK_RM; } @@ -924,7 +930,7 @@ YY_RULE_SETUP case 14: /* rule 14 can match eol */ YY_RULE_SETUP -#line 139 "Scanner.l" +#line 145 "Scanner.l" { size_t len = strlen(yytext); for(size_t i = 0; i < len; ++i) @@ -939,14 +945,14 @@ YY_RULE_SETUP case 15: /* rule 15 can match eol */ YY_RULE_SETUP -#line 150 "Scanner.l" +#line 156 "Scanner.l" { return ';'; } YY_BREAK case 16: YY_RULE_SETUP -#line 154 "Scanner.l" +#line 160 "Scanner.l" { // "..."-type strings string s; @@ -973,13 +979,13 @@ YY_RULE_SETUP s += next; break; } - + case 'n': { s += '\n'; break; } - + case 'r': { s += '\r'; @@ -991,19 +997,19 @@ YY_RULE_SETUP s += '\t'; break; } - + case 'v': { s += '\v'; break; } - + case 'f': { s += '\f'; break; } - + default: { s += c; @@ -1023,7 +1029,7 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -#line 228 "Scanner.l" +#line 234 "Scanner.l" { // '...'-type strings string s; @@ -1051,7 +1057,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 253 "Scanner.l" +#line 259 "Scanner.l" { // Simple strings string s; @@ -1068,7 +1074,7 @@ YY_RULE_SETUP unput(c); break; } - + s += c; } yylvalp->clear(); @@ -1078,10 +1084,10 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 277 "Scanner.l" +#line 283 "Scanner.l" ECHO; YY_BREAK -#line 1084 "lex.yy.c" +#line 1090 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2075,7 +2081,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 277 "Scanner.l" +#line 283 "Scanner.l" diff --git a/cpp/demo/Manual/lifecycle/Scanner.l b/cpp/demo/Manual/lifecycle/Scanner.l index 11918ef88d8..c2e42f0eb65 100644 --- a/cpp/demo/Manual/lifecycle/Scanner.l +++ b/cpp/demo/Manual/lifecycle/Scanner.l @@ -12,17 +12,23 @@ #include <Parser.h> #include <Grammar.h> -#if defined(_MSC_VER) && defined(ICE_64) +#if defined(_MSC_VER) +#if defined(ICE_64) // // '=' : conversion from 'size_t' to 'int', possible loss of data // The result of fread() is a size_t and gets inserted into an int // -# pragma warning( 4 : 4267 ) +# pragma warning( disable : 4267) // // 'initializing' : conversion from '__int64' to 'int', possible loss of data // Puts a pointer-difference into an int // -# pragma warning( 4 : 4244 ) +# pragma warning( disable : 4244) +#endif +// +// conditional expression is constant +// +# pragma warning( disable : 4127) #endif using namespace std; @@ -177,13 +183,13 @@ NL [\n] s += next; break; } - + case 'n': { s += '\n'; break; } - + case 'r': { s += '\r'; @@ -195,19 +201,19 @@ NL [\n] s += '\t'; break; } - + case 'v': { s += '\v'; break; } - + case 'f': { s += '\f'; break; } - + default: { s += c; @@ -266,7 +272,7 @@ NL [\n] unput(c); break; } - + s += c; } yylvalp->clear(); diff --git a/cpp/demo/Manual/map_filesystem/FilesystemI.h b/cpp/demo/Manual/map_filesystem/FilesystemI.h index 1d8b471d541..d788ea70775 100644 --- a/cpp/demo/Manual/map_filesystem/FilesystemI.h +++ b/cpp/demo/Manual/map_filesystem/FilesystemI.h @@ -31,6 +31,9 @@ public: private: + // Required to prevent compiler warnings with MSVC++ + FileI& operator=(const FileI&); + void halt(const Freeze::DatabaseException&) const; const Ice::CommunicatorPtr _communicator; @@ -54,6 +57,9 @@ public: private: + // Required to prevent compiler warnings with MSVC++ + DirectoryI& operator=(const DirectoryI&); + void halt(const Freeze::DatabaseException&) const; const Ice::CommunicatorPtr _communicator; diff --git a/cpp/demo/Manual/map_filesystem/Grammar.cpp b/cpp/demo/Manual/map_filesystem/Grammar.cpp index d5d94a3c064..b65090aaa38 100644 --- a/cpp/demo/Manual/map_filesystem/Grammar.cpp +++ b/cpp/demo/Manual/map_filesystem/Grammar.cpp @@ -1,23 +1,24 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify + + 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - + the Free Software Foundation; either version 2, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -28,7 +29,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -46,7 +47,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -54,20 +55,49 @@ /* Pure parsers. */ #define YYPURE 1 -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - /* Using locations. */ #define YYLSP_NEEDED 0 -/* Copy the first part of user declarations. */ +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + TOK_HELP = 258, + TOK_EXIT = 259, + TOK_STRING = 260, + TOK_LIST = 261, + TOK_LIST_RECURSIVE = 262, + TOK_CREATE_FILE = 263, + TOK_CREATE_DIR = 264, + TOK_PWD = 265, + TOK_CD = 266, + TOK_CAT = 267, + TOK_WRITE = 268, + TOK_RM = 269 + }; +#endif +/* Tokens. */ +#define TOK_HELP 258 +#define TOK_EXIT 259 +#define TOK_STRING 260 +#define TOK_LIST 261 +#define TOK_LIST_RECURSIVE 262 +#define TOK_CREATE_FILE 263 +#define TOK_CREATE_DIR 264 +#define TOK_PWD 265 +#define TOK_CD 266 +#define TOK_CAT 267 +#define TOK_WRITE 268 +#define TOK_RM 269 + + -/* Line 189 of yacc.c */ + +/* Copy the first part of user declarations. */ #line 1 "Grammar.y" @@ -88,6 +118,12 @@ # pragma warning( disable : 4102 ) // warning C4065: switch statement contains 'default' but no 'case' labels # pragma warning( disable : 4065 ) +// warning C4127: conditional expression is constant +# pragma warning( disable : 4127 ) +// warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data +# pragma warning( disable : 4244 ) +// warning C4702: unreachable code +# pragma warning( disable : 4702 ) #endif using namespace std; @@ -100,9 +136,6 @@ yyerror(const char* s) -/* Line 189 of yacc.c */ -#line 105 "Grammar.tab.c" - /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -121,43 +154,20 @@ yyerror(const char* s) # define YYTOKEN_TABLE 0 #endif - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_HELP = 258, - TOK_EXIT = 259, - TOK_STRING = 260, - TOK_LIST = 261, - TOK_LIST_RECURSIVE = 262, - TOK_CREATE_FILE = 263, - TOK_CREATE_DIR = 264, - TOK_PWD = 265, - TOK_CD = 266, - TOK_CAT = 267, - TOK_WRITE = 268, - TOK_RM = 269 - }; -#endif - - - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif + /* Copy the second part of user declarations. */ -/* Line 264 of yacc.c */ -#line 161 "Grammar.tab.c" +/* Line 216 of yacc.c. */ +#line 171 "Grammar.tab.c" #ifdef short # undef short @@ -232,14 +242,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int yyi) +YYID (int i) #else static int -YYID (yyi) - int yyi; +YYID (i) + int i; #endif { - return yyi; + return i; } #endif @@ -320,9 +330,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; + yytype_int16 yyss; + YYSTYPE yyvs; + }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -356,12 +366,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ +# define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -446,9 +456,9 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 52, 52, 56, 63, 66, 74, 78, 82, 86, - 90, 94, 98, 102, 106, 110, 114, 118, 122, 127, - 135, 140 + 0, 58, 58, 62, 69, 72, 80, 84, 88, 92, + 96, 100, 104, 108, 112, 116, 120, 124, 128, 133, + 141, 146 }; #endif @@ -736,20 +746,17 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } @@ -783,11 +790,11 @@ yy_reduce_print (yyvsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - YYFPRINTF (stderr, " $%d = ", yyi + 1); + fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - YYFPRINTF (stderr, "\n"); + fprintf (stderr, "\n"); } } @@ -1067,8 +1074,10 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } + /* Prevent warnings from -Wmissing-prototypes. */ + #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1087,9 +1096,10 @@ int yyparse (); -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ + +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1113,46 +1123,22 @@ yyparse () #endif #endif { -/* The lookahead symbol. */ + /* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; - /* Number of syntax errors so far. */ - int yynerrs; - - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; +/* Number of syntax errors so far. */ +int yynerrs; + int yystate; int yyn; int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; @@ -1160,28 +1146,51 @@ YYSTYPE yylval; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; - yystacksize = YYINITDEPTH; - YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + 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; @@ -1211,6 +1220,7 @@ YYSTYPE yylval; YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; + /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -1218,6 +1228,7 @@ YYSTYPE yylval; yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); yyss = yyss1; @@ -1240,8 +1251,9 @@ YYSTYPE yylval; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1252,6 +1264,7 @@ YYSTYPE yylval; yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; + YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1261,9 +1274,6 @@ YYSTYPE yylval; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - if (yystate == YYFINAL) - YYACCEPT; - goto yybackup; /*-----------. @@ -1272,16 +1282,16 @@ YYSTYPE yylval; yybackup: /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ + look-ahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1313,16 +1323,20 @@ yybackup: goto yyreduce; } + if (yyn == YYFINAL) + YYACCEPT; + /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the lookahead token. */ + /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token. */ - yychar = YYEMPTY; + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1362,149 +1376,115 @@ yyreduce: switch (yyn) { case 2: - -/* Line 1455 of yacc.c */ -#line 53 "Grammar.y" +#line 59 "Grammar.y" { ;} break; case 3: - -/* Line 1455 of yacc.c */ -#line 56 "Grammar.y" +#line 62 "Grammar.y" { ;} break; case 4: - -/* Line 1455 of yacc.c */ -#line 64 "Grammar.y" +#line 70 "Grammar.y" { ;} break; case 5: - -/* Line 1455 of yacc.c */ -#line 67 "Grammar.y" +#line 73 "Grammar.y" { ;} break; case 6: - -/* Line 1455 of yacc.c */ -#line 75 "Grammar.y" +#line 81 "Grammar.y" { parser->usage(); ;} break; case 7: - -/* Line 1455 of yacc.c */ -#line 79 "Grammar.y" +#line 85 "Grammar.y" { return 0; ;} break; case 8: - -/* Line 1455 of yacc.c */ -#line 83 "Grammar.y" +#line 89 "Grammar.y" { parser->list(false); ;} break; case 9: - -/* Line 1455 of yacc.c */ -#line 87 "Grammar.y" +#line 93 "Grammar.y" { parser->list(true); ;} break; case 10: - -/* Line 1455 of yacc.c */ -#line 91 "Grammar.y" +#line 97 "Grammar.y" { parser->createFile((yyvsp[(2) - (2)])); ;} break; case 11: - -/* Line 1455 of yacc.c */ -#line 95 "Grammar.y" +#line 101 "Grammar.y" { parser->createDir((yyvsp[(2) - (2)])); ;} break; case 12: - -/* Line 1455 of yacc.c */ -#line 99 "Grammar.y" +#line 105 "Grammar.y" { parser->pwd(); ;} break; case 13: - -/* Line 1455 of yacc.c */ -#line 103 "Grammar.y" +#line 109 "Grammar.y" { parser->cd("/"); ;} break; case 14: - -/* Line 1455 of yacc.c */ -#line 107 "Grammar.y" +#line 113 "Grammar.y" { parser->cd((yyvsp[(2) - (2)]).front()); ;} break; case 15: - -/* Line 1455 of yacc.c */ -#line 111 "Grammar.y" +#line 117 "Grammar.y" { parser->cat((yyvsp[(2) - (2)]).front()); ;} break; case 16: - -/* Line 1455 of yacc.c */ -#line 115 "Grammar.y" +#line 121 "Grammar.y" { parser->write((yyvsp[(2) - (2)])); ;} break; case 17: - -/* Line 1455 of yacc.c */ -#line 119 "Grammar.y" +#line 125 "Grammar.y" { parser->destroy((yyvsp[(2) - (2)])); ;} break; case 18: - -/* Line 1455 of yacc.c */ -#line 123 "Grammar.y" +#line 129 "Grammar.y" { parser->usage(); yyerrok; @@ -1512,17 +1492,13 @@ yyreduce: break; case 19: - -/* Line 1455 of yacc.c */ -#line 128 "Grammar.y" +#line 134 "Grammar.y" { ;} break; case 20: - -/* Line 1455 of yacc.c */ -#line 136 "Grammar.y" +#line 142 "Grammar.y" { (yyval) = (yyvsp[(2) - (2)]); (yyval).push_front((yyvsp[(1) - (2)]).front()); @@ -1530,18 +1506,15 @@ yyreduce: break; case 21: - -/* Line 1455 of yacc.c */ -#line 141 "Grammar.y" +#line 147 "Grammar.y" { (yyval) = (yyvsp[(1) - (1)]); ;} break; - -/* Line 1455 of yacc.c */ -#line 1545 "Grammar.tab.c" +/* Line 1267 of yacc.c. */ +#line 1518 "Grammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1552,6 +1525,7 @@ yyreduce: *++yyvsp = yyval; + /* 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. */ @@ -1616,7 +1590,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1633,7 +1607,7 @@ yyerrlab: } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; @@ -1690,6 +1664,9 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } + if (yyn == YYFINAL) + YYACCEPT; + *++yyvsp = yylval; @@ -1714,7 +1691,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1725,7 +1702,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEMPTY) + if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered @@ -1751,8 +1728,6 @@ yyreturn: } - -/* Line 1675 of yacc.c */ -#line 146 "Grammar.y" +#line 152 "Grammar.y" diff --git a/cpp/demo/Manual/map_filesystem/Grammar.h b/cpp/demo/Manual/map_filesystem/Grammar.h index ca5a99150f6..b5b8e41ade4 100644 --- a/cpp/demo/Manual/map_filesystem/Grammar.h +++ b/cpp/demo/Manual/map_filesystem/Grammar.h @@ -1,23 +1,24 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify + + 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - + the Free Software Foundation; either version 2, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -28,11 +29,10 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ - /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -53,16 +53,29 @@ TOK_RM = 269 }; #endif +/* Tokens. */ +#define TOK_HELP 258 +#define TOK_EXIT 259 +#define TOK_STRING 260 +#define TOK_LIST 261 +#define TOK_LIST_RECURSIVE 262 +#define TOK_CREATE_FILE 263 +#define TOK_CREATE_DIR 264 +#define TOK_PWD 265 +#define TOK_CD 266 +#define TOK_CAT 267 +#define TOK_WRITE 268 +#define TOK_RM 269 + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif - diff --git a/cpp/demo/Manual/map_filesystem/Grammar.y b/cpp/demo/Manual/map_filesystem/Grammar.y index 2104865c94b..7c3cb792f11 100644 --- a/cpp/demo/Manual/map_filesystem/Grammar.y +++ b/cpp/demo/Manual/map_filesystem/Grammar.y @@ -17,6 +17,12 @@ # pragma warning( disable : 4102 ) // warning C4065: switch statement contains 'default' but no 'case' labels # pragma warning( disable : 4065 ) +// warning C4127: conditional expression is constant +# pragma warning( disable : 4127 ) +// warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data +# pragma warning( disable : 4244 ) +// warning C4702: unreachable code +# pragma warning( disable : 4702 ) #endif using namespace std; diff --git a/cpp/demo/Manual/map_filesystem/Parser.cpp b/cpp/demo/Manual/map_filesystem/Parser.cpp index 8f8644234b1..6bd3c139efe 100644 --- a/cpp/demo/Manual/map_filesystem/Parser.cpp +++ b/cpp/demo/Manual/map_filesystem/Parser.cpp @@ -44,7 +44,7 @@ Parser::usage() } // Print the contents of directory "dir". If recursive is true, -// print in tree fashion. +// print in tree fashion. // For files, show the contents of each file. The "depth" // parameter is the current nesting level (for indentation). @@ -294,7 +294,7 @@ Parser::destroy(const std::list<string>& names) } // -// With older flex version <= 2.5.35 YY_INPUT second +// With older flex version <= 2.5.35 YY_INPUT second // paramenter is of type int&, in newer versions it // changes to size_t& // @@ -344,25 +344,22 @@ Parser::getInput(char* buf, size_t& result, size_t maxSize) cout << parser->getPrompt() << flush; string line; - while(true) + char c; + do { - char c = static_cast<char>(getc(yyin)); + c = static_cast<char>(getc(yyin)); if(c == EOF) { if(line.size()) { line += '\n'; } - break; } - - line += c; - - if(c == '\n') + else { - break; + line += c; } - } + } while(c != EOF && c != '\n'); result = line.length(); if(result > maxSize) diff --git a/cpp/demo/Manual/map_filesystem/Scanner.cpp b/cpp/demo/Manual/map_filesystem/Scanner.cpp index bf3f8d1f56d..dd7b3732602 100644 --- a/cpp/demo/Manual/map_filesystem/Scanner.cpp +++ b/cpp/demo/Manual/map_filesystem/Scanner.cpp @@ -500,17 +500,23 @@ char *yytext; #include <Parser.h> #include <Grammar.h> -#if defined(_MSC_VER) && defined(ICE_64) +#if defined(_MSC_VER) +#if defined(ICE_64) // // '=' : conversion from 'size_t' to 'int', possible loss of data // The result of fread() is a size_t and gets inserted into an int // -# pragma warning( 4 : 4267 ) +# pragma warning( disable : 4267) // // 'initializing' : conversion from '__int64' to 'int', possible loss of data // Puts a pointer-difference into an int // -# pragma warning( 4 : 4244 ) +# pragma warning( disable : 4244) +#endif +// +// conditional expression is constant +// +# pragma warning( disable : 4127) #endif using namespace std; @@ -535,7 +541,7 @@ using namespace std; #define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize) -#line 538 "lex.yy.c" +#line 544 "lex.yy.c" #define INITIAL 0 @@ -624,7 +630,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -635,7 +641,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - unsigned n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -717,10 +723,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 58 "Scanner.l" +#line 64 "Scanner.l" -#line 723 "lex.yy.c" +#line 729 "lex.yy.c" if ( !(yy_init) ) { @@ -805,7 +811,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 60 "Scanner.l" +#line 66 "Scanner.l" { // C++-style comment int c; @@ -818,7 +824,7 @@ YY_RULE_SETUP YY_BREAK case 2: YY_RULE_SETUP -#line 70 "Scanner.l" +#line 76 "Scanner.l" { // C-style comment while(true) @@ -846,77 +852,77 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -#line 95 "Scanner.l" +#line 101 "Scanner.l" { return TOK_HELP; } YY_BREAK case 4: YY_RULE_SETUP -#line 99 "Scanner.l" +#line 105 "Scanner.l" { return TOK_EXIT; } YY_BREAK case 5: YY_RULE_SETUP -#line 103 "Scanner.l" +#line 109 "Scanner.l" { return TOK_LIST; } YY_BREAK case 6: YY_RULE_SETUP -#line 107 "Scanner.l" +#line 113 "Scanner.l" { return TOK_LIST_RECURSIVE; } YY_BREAK case 7: YY_RULE_SETUP -#line 111 "Scanner.l" +#line 117 "Scanner.l" { return TOK_CREATE_FILE; } YY_BREAK case 8: YY_RULE_SETUP -#line 115 "Scanner.l" +#line 121 "Scanner.l" { return TOK_CREATE_DIR; } YY_BREAK case 9: YY_RULE_SETUP -#line 119 "Scanner.l" +#line 125 "Scanner.l" { return TOK_PWD; } YY_BREAK case 10: YY_RULE_SETUP -#line 123 "Scanner.l" +#line 129 "Scanner.l" { return TOK_CD; } YY_BREAK case 11: YY_RULE_SETUP -#line 127 "Scanner.l" +#line 133 "Scanner.l" { return TOK_CAT; } YY_BREAK case 12: YY_RULE_SETUP -#line 131 "Scanner.l" +#line 137 "Scanner.l" { return TOK_WRITE; } YY_BREAK case 13: YY_RULE_SETUP -#line 135 "Scanner.l" +#line 141 "Scanner.l" { return TOK_RM; } @@ -924,7 +930,7 @@ YY_RULE_SETUP case 14: /* rule 14 can match eol */ YY_RULE_SETUP -#line 139 "Scanner.l" +#line 145 "Scanner.l" { size_t len = strlen(yytext); for(size_t i = 0; i < len; ++i) @@ -939,14 +945,14 @@ YY_RULE_SETUP case 15: /* rule 15 can match eol */ YY_RULE_SETUP -#line 150 "Scanner.l" +#line 156 "Scanner.l" { return ';'; } YY_BREAK case 16: YY_RULE_SETUP -#line 154 "Scanner.l" +#line 160 "Scanner.l" { // "..."-type strings string s; @@ -973,13 +979,13 @@ YY_RULE_SETUP s += next; break; } - + case 'n': { s += '\n'; break; } - + case 'r': { s += '\r'; @@ -991,19 +997,19 @@ YY_RULE_SETUP s += '\t'; break; } - + case 'v': { s += '\v'; break; } - + case 'f': { s += '\f'; break; } - + default: { s += c; @@ -1023,7 +1029,7 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -#line 228 "Scanner.l" +#line 234 "Scanner.l" { // '...'-type strings string s; @@ -1051,7 +1057,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 253 "Scanner.l" +#line 259 "Scanner.l" { // Simple strings string s; @@ -1068,7 +1074,7 @@ YY_RULE_SETUP unput(c); break; } - + s += c; } yylvalp->clear(); @@ -1078,10 +1084,10 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 277 "Scanner.l" +#line 283 "Scanner.l" ECHO; YY_BREAK -#line 1084 "lex.yy.c" +#line 1090 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2075,7 +2081,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 277 "Scanner.l" +#line 283 "Scanner.l" diff --git a/cpp/demo/Manual/map_filesystem/Scanner.l b/cpp/demo/Manual/map_filesystem/Scanner.l index 11918ef88d8..c2e42f0eb65 100644 --- a/cpp/demo/Manual/map_filesystem/Scanner.l +++ b/cpp/demo/Manual/map_filesystem/Scanner.l @@ -12,17 +12,23 @@ #include <Parser.h> #include <Grammar.h> -#if defined(_MSC_VER) && defined(ICE_64) +#if defined(_MSC_VER) +#if defined(ICE_64) // // '=' : conversion from 'size_t' to 'int', possible loss of data // The result of fread() is a size_t and gets inserted into an int // -# pragma warning( 4 : 4267 ) +# pragma warning( disable : 4267) // // 'initializing' : conversion from '__int64' to 'int', possible loss of data // Puts a pointer-difference into an int // -# pragma warning( 4 : 4244 ) +# pragma warning( disable : 4244) +#endif +// +// conditional expression is constant +// +# pragma warning( disable : 4127) #endif using namespace std; @@ -177,13 +183,13 @@ NL [\n] s += next; break; } - + case 'n': { s += '\n'; break; } - + case 'r': { s += '\r'; @@ -195,19 +201,19 @@ NL [\n] s += '\t'; break; } - + case 'v': { s += '\v'; break; } - + case 'f': { s += '\f'; break; } - + default: { s += c; @@ -266,7 +272,7 @@ NL [\n] unput(c); break; } - + s += c; } yylvalp->clear(); diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index c87ca562fd6..13407ba5bb8 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -147,9 +147,9 @@ writeMarshalUnmarshalDataMemberInHolder(IceUtilInternal::Output& C, const string } void -writeMarshalUnmarshalDataMembers(IceUtilInternal::Output& C, - const DataMemberList& dataMembers, - const DataMemberList& optionalDataMembers, +writeMarshalUnmarshalDataMembers(IceUtilInternal::Output& C, + const DataMemberList& dataMembers, + const DataMemberList& optionalDataMembers, bool marshal) { for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) @@ -410,20 +410,20 @@ Slice::Gen::generate(const UnitPtr& p) { C << "\n#include <Ice/BasicStream.h>"; } - + if(_stream || p->hasNonLocalClassDefs() || p->hasNonLocalExceptions()) { if(!p->hasNonLocalClassDefs()) { C << "\n#include <Ice/LocalException.h>"; } - + H << "\n#include <Ice/StreamF.h>"; if(_stream) { C << "\n#include <Ice/Stream.h>"; - } + } } if(p->hasContentsWithMetaData("preserve-slice")) @@ -731,11 +731,11 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p) H << nl << "virtual ~" << name << "() throw();"; H << sp; - + if(!p->isLocal()) { string initName = p->flattenedScope() + p->name() + "_init"; - + C << sp << nl << "namespace"; C << nl << "{"; @@ -744,7 +744,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p) C << sp << nl << "}"; } - + if(p->isLocal()) { C << sp << nl << scoped.substr(2) << "::" << name << spar << "const char* __file" << "int __line" << epar @@ -904,14 +904,14 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) H << nl << "using " << baseName << "::__read;"; } } - + H.dec(); H << sp << nl << "protected:"; H.inc(); - + H << nl << "virtual void __writeImpl(::IceInternal::BasicStream*) const;"; H << nl << "virtual void __readImpl(::IceInternal::BasicStream*);"; - + if(_stream) { H << nl << "virtual void __writeImpl(const ::Ice::OutputStreamPtr&) const;"; @@ -926,9 +926,9 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) if(preserved && !basePreserved) { - + H << sp << nl << "::Ice::SlicedDataPtr __slicedData;"; - + C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::BasicStream* __os) const"; C << sb; C << nl << "__os->startWriteException(__slicedData);"; @@ -943,7 +943,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) C << nl << "__slicedData = __is->endReadException(true);"; C << eb; } - + C << sp << nl << "void" << nl << scoped.substr(2) << "::__writeImpl(::IceInternal::BasicStream* __os) const"; C << sb; C << nl << "__os->startWriteSlice(\"" << p->scoped() << "\", -1, " << (!base ? "true" : "false") << ");"; @@ -985,7 +985,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) C << eb; } - C << sp << nl << "void" << nl << scoped.substr(2) + C << sp << nl << "void" << nl << scoped.substr(2) << "::__writeImpl(const ::Ice::OutputStreamPtr& __os) const"; C << sb; C << nl << "__os->startSlice(\"" << p->scoped() << "\", -1, " << (!base ? "true" : "false") << ");"; @@ -1140,7 +1140,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) { params.push_back(fixKwd((*q)->name())); } - + bool containsSequence = false; if((Dictionary::legalKeyType(p, containsSequence) && !containsSequence) || p->hasMetaData("cpp:comparable")) { @@ -1178,7 +1178,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) } H << nl << "return false;"; H << eb; - + H << sp << nl << "bool operator!=(const " << name << "& __rhs) const"; H << sb; H << nl << "return !operator==(__rhs);"; @@ -1254,7 +1254,7 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) ks.insert(0, " "); } string vs = typeToString(valueType, p->valueMetaData(), _useWstring); - + H << sp << nl << "typedef ::std::map<" << ks << ", " << vs << "> " << name << ';'; } else @@ -1374,7 +1374,7 @@ Slice::Gen::ProxyDeclVisitor::visitClassDecl(const ClassDeclPtr& p) string scoped = fixKwd(p->scoped()); H << sp << nl << "class " << name << ';'; - H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, ::IceInternal::ProxyHandle< ::IceProxy" + H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, ::IceInternal::ProxyHandle< ::IceProxy" << scoped << ">&);"; H << nl << _dllExport << "::IceProxy::Ice::Object* upCast(::IceProxy" << scoped << "*);"; } @@ -1664,7 +1664,7 @@ usePrivateEnd(const OperationPtr& p) bool retIsOpt = p->returnIsOptional(); string retSEnd = returnTypeToString(ret, retIsOpt, p->getMetaData(), TypeContextAMIEnd); string retSPrivateEnd = returnTypeToString(ret, retIsOpt, p->getMetaData(), TypeContextAMIPrivateEnd); - + ParamDeclList outParams; vector<string> outDeclsEnd; vector<string> outDeclsPrivateEnd; @@ -1674,13 +1674,13 @@ usePrivateEnd(const OperationPtr& p) { if((*q)->isOutParam()) { - outDeclsEnd.push_back(outputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), + outDeclsEnd.push_back(outputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), TypeContextAMIEnd)); outDeclsPrivateEnd.push_back(outputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), TypeContextAMIPrivateEnd)); } } - + return retSEnd != retSPrivateEnd || outDeclsEnd != outDeclsPrivateEnd; } @@ -1720,14 +1720,14 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) vector<string> outParamsDeclAMI; vector<string> outParamsDeclEndAMI; vector<string> outDecls; - + ParamDeclList paramList = p->parameters(); ParamDeclList inParams; ParamDeclList outParams; - - + + vector<string> outEndArgs; - + for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) { string paramName = fixKwd((*q)->name()); @@ -1772,17 +1772,17 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) // // Check if we need to generate a private ___end_ method. This is the case if the // when using certain mapping features such as cpp:array or cpp:range:array. While - // the regular end_ method can't return pair<const TYPE*, const TYPE*> because the + // the regular end_ method can't return pair<const TYPE*, const TYPE*> because the // pointers would be invalid once end_ returns, we still want to allow using this // alternate mapping with AMI response callbacks (to allow zero-copy for instance). - // For this purpose, we generate a special ___end method which is used by the - // completed implementation of the generated Callback_Inft_opName operation + // For this purpose, we generate a special ___end method which is used by the + // completed implementation of the generated Callback_Inft_opName operation // delegate. // bool generatePrivateEnd = retS != retSEndAMI || outParamsDeclAMI != outParamsDeclEndAMI; if(ret && generatePrivateEnd) { - string typeStringEndAMI = outputTypeToString(ret, p->returnIsOptional(), p->getMetaData(), + string typeStringEndAMI = outputTypeToString(ret, p->returnIsOptional(), p->getMetaData(), _useWstring | TypeContextAMIPrivateEnd); outParamsDeclEndAMI.push_back(typeStringEndAMI + ' ' + "__ret"); } @@ -1809,7 +1809,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) } H << fixKwd(name) << spar << args << "&__ctx" << epar << ';'; H << eb; - + H.zeroIndent(); H << nl << "#ifdef ICE_CPP11"; H.restoreIndent(); @@ -1850,9 +1850,9 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) } else { - H << nl << "return begin_" << name << spar << argsAMI + H << nl << "return begin_" << name << spar << argsAMI << "0, new ::IceInternal::Cpp11FnOnewayCallbackNC(__response, __exception, __sent)" << epar << ";"; - + } H << eb; @@ -1866,16 +1866,16 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) H << nl << "#endif"; H.restoreIndent(); } - + H << nl << "::Ice::AsyncResultPtr"; - H << nl << "begin_" << name << spar << paramsDeclAMI + H << nl << "begin_" << name << spar << paramsDeclAMI << "const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& __completed" << "const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& __sent = " "::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>()" << epar; H << sb; H << nl << "return begin_" << name << spar << argsAMI << "0, ::Ice::newCallback(__completed, __sent), 0" << epar << ";"; H << eb; - + // // COMPILERFIX VC compilers up to VC110 don't support more than 10 parameters with std::function due to // lack of variadic templates. @@ -1902,7 +1902,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) << "const ::IceInternal::Function<void (const ::Ice::Exception&)>& __exception = " "::IceInternal::Function<void (const ::Ice::Exception&)>(), " << "const ::IceInternal::Function<void (bool)>& __sent = ::IceInternal::Function<void (bool)>()" << epar; - + H << sb; if(p->returnsData()) { @@ -1914,7 +1914,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) << "&__ctx, new ::IceInternal::Cpp11FnOnewayCallbackNC(__response, __exception, __sent), 0" << epar << ";"; } H << eb; - + // // COMPILERFIX VC compilers up to VC110 don't support more than 10 parameters with std::function due to // lack of variadic templates. @@ -1925,9 +1925,9 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) H << nl << "#endif"; H.restoreIndent(); } - + H << nl << "::Ice::AsyncResultPtr"; - H << nl << "begin_" << name << spar << paramsDeclAMI + H << nl << "begin_" << name << spar << paramsDeclAMI << "const ::Ice::Context& __ctx" << "const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& __completed" << "const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& __sent = " @@ -1935,7 +1935,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) H << sb; H << nl << "return begin_" << name << spar << argsAMI << "&__ctx, ::Ice::newCallback(__completed, __sent)" << epar << ";"; H << eb; - + if(p->returnsData()) { // @@ -1957,11 +1957,11 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) H.dec(); H << nl << "private:"; H.inc(); - - + + H << sp << nl << "::Ice::AsyncResultPtr __begin_" << name << spar << paramsDeclAMI << "const ::Ice::Context* __ctx" << "const ::IceInternal::Function<void " << spar; - + if(!retInS.empty()) { @@ -1988,14 +1988,14 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) H.restoreIndent(); } } - + H.zeroIndent(); H << nl << "#endif"; H.restoreIndent(); H << sp << nl << "::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI << epar; H << sb; - H << nl << "return begin_" << name << spar << argsAMI << "0" << "::IceInternal::__dummyCallback" << "0" + H << nl << "return begin_" << name << spar << argsAMI << "0" << "::IceInternal::__dummyCallback" << "0" << epar << ';'; H << eb; @@ -2027,7 +2027,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) H << sb; H << nl << "return begin_" << name << spar << argsAMI << "0" << "__del" << "__cookie" << epar << ';'; H << eb; - + H << sp << nl << "::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI << "const ::Ice::Context& __ctx" << "const " + delNameScoped + "Ptr& __del" @@ -2057,14 +2057,14 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) H.dec(); H << nl << "public:"; H.inc(); - + C << sp << nl << retS << nl << "IceProxy" << scoped << spar << paramsDecl << "const ::Ice::Context* __ctx" << epar; C << sb; if(p->returnsData()) { C << nl << "__checkTwowayOnly(" << flatName << ");"; } - C << nl << "::IceInternal::Outgoing __og(this, " << flatName << ", " << operationModeToString(p->sendMode()) + C << nl << "::IceInternal::Outgoing __og(this, " << flatName << ", " << operationModeToString(p->sendMode()) << ", __ctx);"; if(inParams.empty()) { @@ -2100,7 +2100,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << sb; C << nl << "__og.throwUserException();"; C << eb; - + // // Generate a catch block for each legal user exception. This is necessary // to prevent an "impossible" user exception to be thrown if client and @@ -2186,7 +2186,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) { C << nl << "__result->writeEmptyParams();"; } - else + else { C << nl << "::IceInternal::BasicStream* __os = __result->startWriteParams(" << opFormatTypeToString(p) <<");"; writeMarshalCode(C, inParams, 0, TypeContextInParam); @@ -2215,29 +2215,29 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) // if(outDecls.size() > 10 || (outDecls.size() > 9 && !retInS.empty())) { - + C << nl << "#if !defined(_MSC_VER) || _MSC_VER > 1700"; - + C << nl << "//"; C << nl << "// COMPILERFIX VC compilers up to VC110 don't support more than 10 parameters with"; C << nl << "// std::function due to lack of variadic templates."; C << nl << "//"; } - - C << sp << nl << "::Ice::AsyncResultPtr" << nl + + C << sp << nl << "::Ice::AsyncResultPtr" << nl << "IceProxy" << scope << "__begin_" << name << spar << paramsDeclAMI << "const ::Ice::Context* __ctx" << "const ::IceInternal::Function<void " << spar; - + if(!retInS.empty()) { C << retInS; } C << outDecls; - + C << epar << ">& __response, " << "const ::IceInternal::Function<void (const ::Ice::Exception&)>& __exception, " << "const ::IceInternal::Function<void (bool)>& __sent" << epar; - + C << sb; C << nl << "class Cpp11CB : public ::IceInternal::Cpp11FnCallbackNC"; C << sb; @@ -2260,13 +2260,13 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << sb; C << nl << "CallbackBase::checkCallback(true, responseFunc || exceptionFunc != nullptr);"; C << eb; - + // // completed. // C << sp << nl << "virtual void completed(const ::Ice::AsyncResultPtr& __result) const"; C << sb; - C << nl << clScope << clName << "Prx __proxy = " << clScope << clName + C << nl << clScope << clName << "Prx __proxy = " << clScope << clName << "Prx::uncheckedCast(__result->getProxy());"; writeAllocateCode(C, outParams, p, _useWstring | TypeContextInParam | TypeContextAMICallPrivateEnd); C << nl << "try"; @@ -2307,24 +2307,24 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << epar << ';'; C << eb; C << eb; - + C.dec(); C << nl << nl << "private:"; C.inc(); C << nl; C << nl << "::std::function<void " << spar; - + if(!retInS.empty()) { C << retInS; } C << outDecls; - + C << epar << "> _response;"; - + C << eb << ';'; - - C << nl << "return begin_" << name << spar << argsAMI << "__ctx" + + C << nl << "return begin_" << name << spar << argsAMI << "__ctx" << "new Cpp11CB(__response, __exception, __sent)" << epar << ';'; C << eb; @@ -2347,9 +2347,9 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << nl << "::Ice::AsyncResult::__check(__result, this, " << flatName << ");"; // - // COMPILERFIX: It's necessary to generate the allocate code here before + // COMPILERFIX: It's necessary to generate the allocate code here before // this if(!__result->wait()). If generated after this if block, we get - // access violations errors with the test/Ice/slicing/objects test on VC9 + // access violations errors with the test/Ice/slicing/objects test on VC9 // and Windows 64 bits when compiled with optimization (see bug 4400). // writeAllocateCode(C, ParamDeclList(), p, _useWstring | TypeContextAMIEnd); @@ -2708,7 +2708,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) emitOneShotConstructor(p); H << sp; - + /* * Strong guarantee @@ -2794,13 +2794,13 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) // // It would make sense to provide a covariant ice_clone(); unfortunately many compilers - // (including VS2010) generate bad code for covariant types that use virtual inheritance + // (including VS2010) generate bad code for covariant types that use virtual inheritance // if(!p->isInterface()) { H << nl << "virtual ::Ice::ObjectPtr ice_clone() const;"; - + C << nl << "::Ice::ObjectPtr"; C << nl << scoped.substr(2) << "::ice_clone() const"; C << sb; @@ -2815,7 +2815,6 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) // We need this ice_clone for abstract classes derived from concrete classes // C << nl << "throw ::Ice::CloneNotImplementedException(__FILE__, __LINE__);"; - C << nl << "return 0; // to avoid a warning with some compilers"; } C << eb; } @@ -2850,7 +2849,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) << "(const ::Ice::Current& = ::Ice::Current()) const;"; H << nl << "virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::Current()) const;"; H << nl << "static const ::std::string& ice_staticId();"; - + if(!dataMembers.empty()) { H << sp; @@ -3059,7 +3058,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) C << eb << ';'; C << sp << nl << "}"; - + C << sp; C << nl << "::Ice::Int" << nl << scoped.substr(2) @@ -3083,13 +3082,13 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) { H << sp << nl << "static ::Ice::ObjectFactoryPtr ice_factory();"; } - + if(preserved && !basePreserved) { H << sp; H << nl << "virtual void __write(::IceInternal::BasicStream*) const;"; H << nl << "virtual void __read(::IceInternal::BasicStream*);"; - + if(_stream) { H << nl << "virtual void __write(const ::Ice::OutputStreamPtr&) const;"; @@ -3214,7 +3213,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) { C << sp << nl << "namespace"; C << nl << "{"; - + if(!p->isAbstract()) { string initName = p->flattenedScope() + p->name() + "_init"; @@ -3225,8 +3224,8 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) { string initName = p->flattenedScope() + p->name() + "_compactIdInit"; C << sp << nl << "const ::IceInternal::CompactIdInit " - << initName << "(\"" << p->scoped() << "\", " << p->compactId() << ");"; - } + << initName << "(\"" << p->scoped() << "\", " << p->compactId() << ");"; + } C << nl << "}"; if(!p->isAbstract()) @@ -3637,7 +3636,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) string typeString; if((*r)->isOutParam()) { - typeString = outputTypeToString((*r)->type(), (*r)->optional(), metaData, + typeString = outputTypeToString((*r)->type(), (*r)->optional(), metaData, _useWstring | TypeContextAMIEnd); } else @@ -3654,11 +3653,11 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) outParamsDeclAMI.push_back(typeString + ' ' + paramName); } } - + H << nl << "// Only supported with C++ 11 support enabled"; H << nl << "virtual ::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI << "const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception" - << "const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>()" + << "const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>()" << epar << " = 0;"; H << sp << nl << "virtual ::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI << epar << " = 0;"; @@ -3682,7 +3681,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) void Slice::Gen::ObjectVisitor::emitDataMember(const DataMemberPtr& p) -{ +{ string name = fixKwd(p->name()); H << sp << nl << typeToString(p->type(), p->optional(), p->getMetaData(), _useWstring) << ' ' << name << ';'; } @@ -4064,13 +4063,13 @@ Slice::Gen::AsyncCallbackTemplateVisitor::generateOperation(const OperationPtr& TypePtr ret = p->returnType(); string retS = inputTypeToString(ret, p->returnIsOptional(), p->getMetaData(), _useWstring); string retEndArg = getEndArg(ret, p->getMetaData(), "__ret"); - + ParamDeclList outParams; vector<string> outArgs; vector<string> outDecls; vector<string> outDeclsEnd; vector<string> outEndArgs; - + ParamDeclList paramList = p->parameters(); for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) { @@ -4226,11 +4225,11 @@ Slice::Gen::AsyncCallbackTemplateVisitor::generateOperation(const OperationPtr& { cookieT = "const CT&"; comCookieT = ", const CT&"; - H << sp << nl << "template<class T, typename CT> " << delName << "Ptr"; + H << sp << nl << "template<class T, typename CT> " << delName << "Ptr"; } else { - H << sp << nl << "template<class T> " << delName << "Ptr"; + H << sp << nl << "template<class T> " << delName << "Ptr"; } H << nl << "new" << delName << "(" << callbackT << " instance, "; @@ -4269,11 +4268,11 @@ Slice::Gen::AsyncCallbackTemplateVisitor::generateOperation(const OperationPtr& { if(withCookie) { - H << sp << nl << "template<class T, typename CT> " << delName << "Ptr"; + H << sp << nl << "template<class T, typename CT> " << delName << "Ptr"; } else { - H << sp << nl << "template<class T> " << delName << "Ptr"; + H << sp << nl << "template<class T> " << delName << "Ptr"; } H << nl << "new" << delName << "(" << callbackT << " instance, "; H << "void (T::*excb)(" << "const ::Ice::Exception&" << comCookieT << "), "; @@ -4464,7 +4463,7 @@ Slice::Gen::ImplVisitor::visitModuleStart(const ModulePtr& p) { H << nl << "#include <" << *it << "I.h>"; } - + string name = fixKwd(p->name()); H << sp << nl << "namespace " << name << nl << '{'; @@ -4536,12 +4535,12 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) H.useCurrentPosAsIndent(); H << "const " << classScopedAMD << '_' << opName << "Ptr&"; ParamDeclList paramList = op->parameters(); - + for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) { if(!(*q)->isOutParam()) { - H << ',' << nl << inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), + H << ',' << nl << inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring); } } @@ -4559,7 +4558,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) { if(!(*q)->isOutParam()) { - C << ',' << nl << inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), + C << ',' << nl << inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring) << ' ' << fixKwd((*q)->name()); } } @@ -5120,13 +5119,13 @@ Slice::Gen::StreamVisitor::visitStructStart(const StructPtr& p) { bool classMetaData = findMetaData(p->getMetaData(), false) == "%class"; string scoped = p->scoped(); - + string fullStructName = classMetaData ? fixKwd(scoped + "Ptr") : fixKwd(scoped); - + H << nl << "template<>"; - + H << nl << "struct StreamableTraits< " << fullStructName << ">"; - + H << sb; if(classMetaData) { @@ -5148,7 +5147,7 @@ Slice::Gen::StreamVisitor::visitStructStart(const StructPtr& p) H << eb << ";" << nl; DataMemberList dataMembers = p->dataMembers(); - + string holder = classMetaData ? "v->" : "v."; H << nl << "template<class S>"; @@ -5364,7 +5363,7 @@ Slice::Gen::MetaDataVisitor::visitOperation(const OperationPtr& p) { for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); ++q) { - if(q->find("cpp:type:", 0) == 0 || q->find("cpp:view-type:", 0) == 0 + if(q->find("cpp:type:", 0) == 0 || q->find("cpp:view-type:", 0) == 0 || (*q) == "cpp:array" || q->find("cpp:range", 0) == 0) { emitWarning(p->file(), p->line(), "ignoring invalid metadata `" + *q + @@ -5455,7 +5454,7 @@ Slice::Gen::MetaDataVisitor::validate(const SyntaxTreeBasePtr& cont, const Strin continue; } } - if(DictionaryPtr::dynamicCast(cont) && (ss.find("type:") == 0 || ss.find("view-type:") == 0)) + if(DictionaryPtr::dynamicCast(cont) && (ss.find("type:") == 0 || ss.find("view-type:") == 0)) { continue; } |