[PATCH INSTALLED]: delete some const shadow functions
Gabriel Dos Reis
gdr@cs.tamu.edu
Sat Sep 1 22:07:00 GMT 2007
On Sat, 1 Sep 2007, Richard Guenther wrote:
| Well, it's certainly all fixable. The case that doesn't have a nice
| workable C++ counterpart is where we do enum "inheritance" like
| for enum c_tree_code which extends enum tree_code and we
| happily pass c_tree_codes to tree_code prototyped functions for
| example. Of course not too many functions are affected and the
| least intrusive way would be to add overloads for the c_tree_code
| variant if we build with C++. (Or of course, add casts at the places
| where there are mismatches) I just didn't see a nicely designed
| way to do this kind of "enum inheritance" ;)
As, this case. I solved it with macros -- but they could be inline
functions if that is what we want.
#define as_c_code(C) ((enum c_tree_code) (C))
#define as_cxx_code(C) ((enum cp_tree_code) (C))
And you're exactly right that not many functions are actually
involved.
[There are well written C/C++ compilers out there that compile
cleanly with both C and C++ compilers. They use similar constructs. ]
The cases that gave me some headache were the ones in the RTL stuff --
partly because I'm not an RTL expert, and partly because I had to make
sure that the other backends are not broken.
-- Gaby
More information about the Gcc-patches
mailing list