hth313 / Calypsi-tool-chains

Overview of the Calypsi tool chain and open source support packages
16 stars 0 forks source link

Feature request: __attribute__((cleanup(cleanup_function))) #21

Open KyleCardoza opened 1 year ago

KyleCardoza commented 1 year ago

From the GCC manual:

The cleanup attribute runs a function when the variable goes out of scope. This attribute can only be applied to auto function scope variables; it may not be applied to parameters or variables with static storage duration. The function must take one parameter, a pointer to a type compatible with the variable. The return value of the function (if any) is ignored.

I personally think this is a really useful thing to have, I use it all the time, and it would be wonderful to have in Calypsi, if it's not too much work.

hth313 commented 1 year ago

I had some hope this would be trivial, but it turns out that I only get an attribute from the front end and have to deal with it on my own. It is hard to say how much work it will be, not trivial, but hopefully not too bad. I have put it on the list of things to look at during the coming weeks.

KyleCardoza commented 1 year ago

No worries, it's more a "would be nice to have" than a "must absolutely have".