diff options
author | Bernard Normier <bernard@zeroc.com> | 2006-07-27 20:48:26 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2006-07-27 20:48:26 +0000 |
commit | 62f5c50a7fe4d7d083082b13d59d1098ce33019d (patch) | |
tree | dfa6b2270e3a6563ee32bf03d1b9c6331aaaf613 /cpp/src | |
parent | enabled oldevictor test (diff) | |
download | ice-62f5c50a7fe4d7d083082b13d59d1098ce33019d.tar.bz2 ice-62f5c50a7fe4d7d083082b13d59d1098ce33019d.tar.xz ice-62f5c50a7fe4d7d083082b13d59d1098ce33019d.zip |
Deprecated nonmutating in Parser; replaced throughout with idempotent +
metadata
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/IceGrid/Internal.ice | 28 | ||||
-rw-r--r-- | cpp/src/Slice/Grammar.y | 14 | ||||
-rw-r--r-- | cpp/src/Slice/Parser.cpp | 17 |
3 files changed, 37 insertions, 22 deletions
diff --git a/cpp/src/IceGrid/Internal.ice b/cpp/src/IceGrid/Internal.ice index 662c7a7c8e2..eec9ea2afc5 100644 --- a/cpp/src/IceGrid/Internal.ice +++ b/cpp/src/IceGrid/Internal.ice @@ -61,7 +61,7 @@ interface Adapter * endpoints if the adapter is already active. * **/ - ["ami"] nonmutating Object* getDirectProxy() + ["ami", "nonmutating", "cpp:const"] idempotent Object* getDirectProxy() throws AdapterNotActiveException; /** @@ -129,7 +129,7 @@ interface Server * Check if the server is enabled. * **/ - nonmutating bool isEnabled(); + ["nonmutating", "cpp:const"] idempotent bool isEnabled(); /** * @@ -155,7 +155,7 @@ interface Server * @see ServerState * **/ - nonmutating ServerState getState(); + ["nonmutating", "cpp:const"] idempotent ServerState getState(); /** * @@ -165,7 +165,7 @@ interface Server * integer. * **/ - nonmutating int getPid(); + ["nonmutating", "cpp:const"] idempotent int getPid(); /** * @@ -241,28 +241,28 @@ interface Node * Get the node name. * **/ - nonmutating string getName(); + ["nonmutating", "cpp:const"] idempotent string getName(); /** * * Get the node hostname. * **/ - nonmutating string getHostname(); + ["nonmutating", "cpp:const"] idempotent string getHostname(); /** * * Get the node load. * **/ - nonmutating LoadInfo getLoad(); + ["nonmutating", "cpp:const"] idempotent LoadInfo getLoad(); /** * * Shutdown the node. * **/ - nonmutating void shutdown(); + ["nonmutating", "cpp:const"] idempotent void shutdown(); }; sequence<Node*> NodePrxSeq; @@ -291,21 +291,21 @@ interface NodeSession * Return the node session timeout. * **/ - nonmutating int getTimeout(); + ["nonmutating", "cpp:const"] idempotent int getTimeout(); /** * * Return the registry observer. * **/ - nonmutating NodeObserver* getObserver(); + ["nonmutating", "cpp:const"] idempotent NodeObserver* getObserver(); /** * * Get the name of the servers deployed on the node. * **/ - nonmutating Ice::StringSeq getServers(); + ["nonmutating", "cpp:const"] idempotent Ice::StringSeq getServers(); /** * @@ -339,7 +339,7 @@ interface ReplicaSession * Return the replica session timeout. * **/ - nonmutating int getTimeout(); + ["nonmutating", "cpp:const"] idempotent int getTimeout(); /** * @@ -386,8 +386,8 @@ interface InternalRegistry void registerWithReplica(InternalRegistry* prx); - nonmutating NodePrxSeq getNodes(); - nonmutating InternalRegistryPrxSeq getReplicas(); + ["nonmutating", "cpp:const"] idempotent NodePrxSeq getNodes(); + ["nonmutating", "cpp:const"] idempotent InternalRegistryPrxSeq getReplicas(); }; diff --git a/cpp/src/Slice/Grammar.y b/cpp/src/Slice/Grammar.y index 4ef4c2f7948..e3c3526a05f 100644 --- a/cpp/src/Slice/Grammar.y +++ b/cpp/src/Slice/Grammar.y @@ -726,6 +726,20 @@ operation_preamble { cl->checkIntroduced(name, op); unit->pushContainer(op); + static bool firstWarning = true; + + string msg = "the keyword 'nonmutating' is deprecated"; + if(firstWarning) + { + msg += ";\n"; + msg += "You should replace it with 'idempotent' plus Freeze metadata\n"; + msg += "(if you use a Freeze evictor) and/or [\"cpp:const\"] (if you\n"; + msg += "want a const member function on the generated C++ servant\n"; + msg += "base class)."; + firstWarning = false; + } + + unit->warning(msg); $$ = op; } else diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 8bf98da1995..75710f0c86a 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -4269,7 +4269,14 @@ Slice::Operation::mode() const Operation::Mode Slice::Operation::sendMode() const { - return _sendMode; + if(_mode == Operation::Idempotent && hasMetaData("nonmutating")) + { + return Operation::Nonmutating; + } + else + { + return _mode; + } } ParamDeclPtr @@ -4569,14 +4576,8 @@ Slice::Operation::Operation(const ContainerPtr& container, Contained(container, name), Container(container->unit()), _returnType(returnType), - _mode(mode), - _sendMode(mode) + _mode(mode) { - if(_sendMode == Operation::Idempotent && hasMetaData("nonmutating")) - { - _sendMode = Operation::Nonmutating; - } - if(_unit->profile() == IceE) { ClassDefPtr cl = ClassDefPtr::dynamicCast(this->container()); |