On 12-05-18 18:14 , Richard Henderson wrote:
On 05/18/12 05:06, Richard Guenther wrote:
Can you locate those?  I mean, most uses look like

#define DECL_NONSHAREABLE(NODE) \
   (TREE_CHECK2 (NODE, VAR_DECL, \
                 RESULT_DECL)->decl_common.decl_nonshareable_flag)

thus they only dereference the result, not assign it anywhere.

const_tree vs tree for NODE is the difference between the
entire expression being writable, or read-only.

   DECL_NONSHARABLE (d) = true;

Right. Returning a const_tree means that you can't write to anything in the resulting value. To answer richi's original question, this produces ~9,000 syntax errors in gcc/*.o.

So, I would like to figure out what to do with this. We have a usability problem wrt deubgging that I would like to fix. The only way we have of using all the tree accessor macros from GDB is to convert the checks into functions (converting the actual accessor macros would also work, but that's a different story).

Now that we have the ability to skip functions in gdb, making tree checking into functions should not be a problem. Additionally, we can make gdb skip other common functions (like tree_code_length).

We can do this in trunk today using a variant of Lawrence's original patch (http://gcc.gnu.org/ml/gcc-patches/2011-09/msg01649.html). This uses no C++ features, though it weakens type checking by removing away constness.

In the cxx-conversion branch, we can use overloads, which will DTRT with const.

My question is, what do folks prefer?

a) The trunk patch today, using no C++ features.
b) Wait for the cxx-conversion variant?

Incidentally, making these expression statements into out-of-line functions saves about 3% in the final binary size, but increases compile time by about 10% (tested on several large .o files in bld/gcc), so we likely want to keep them as inline functions.


Diego.

Reply via email to