zeroc-ice / ice

All-in-one solution for creating networked applications with RPC, pub/sub, server deployment, and more.
https://zeroc.com
GNU General Public License v2.0
2k stars 592 forks source link

Update Where we Apply Deprecated Attributes in C++ #2288

Closed InsertCreativityHere closed 1 week ago

InsertCreativityHere commented 3 weeks ago

This PR updates the deprecation logic of slice2cpp. Currently, on main, we ignore all [deprecated] metadata except when applied to an interface, or an operation. And deprecating an interface is just a shorthand for deprecating all it's operations...

If an operation is deprecated, we will generate [[deprecated]] on it's mapped functions, both in the generated Prx proxy class and the servant skeleton.


This PR implements the first half of #2085 by removing the [[deprecated]] from the dispatch side code.

But it also expands what [[deprecated]] can be applied to, since it's very limited in C++ (compared to Java and C# where it's supported on most things). Now we support [deprecated] on:

The logic for proxy code is unchanged. And the behavior for deprecating an interface has also changed. Previously it meant: just deprecate all it's operations, now deprecating an interface causes the compiler to deprecate the mapped proxy class.

InsertCreativityHere commented 1 week ago

I've been told to merge this as-is for now. I'll look into improving the string generation in the future.

For what it's worth, this is a general problem with our code-gen. Not specific to this PR. So it's probably better to fix it for all the places at once.