This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Extension: GCC warnings for pure/reentrant functions
- From: David Austin <d dot austin at computer dot org>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 30 May 2005 15:42:05 +1000
- Subject: Extension: GCC warnings for pure/reentrant functions
Hi all,
I've had an idea for additional checking that gcc could do
to help programmers - check that functions declared as
pure or reentrant are actually pure/reentrant. It appears
that the most obvious checking can be done relatively easily.
I know that there are other methods to check these types of things,
but I think that gcc can do a better job. For example, a programmer
can easily check the size of the data/bss segments with size.
However, this requires that the programmer does that and also
can't detect calling non-reentrant functions.
So, questions:
1) Do people think that this is a good idea?
2) What would be the best implementation method?
a) Mark leaves in the parse tree as pure/reentrant and
propagate up, embedded in the current process. OR
b) At the stage that we have a parse tree for a function and
are generating code, descend the tree and propagate up
pure/reentrant flags as a separate step and check results.
The advantage of b) is that it can more easily be turned off
and has no impact on speed when off. However, when on, the
speed will be lower than option a).
Eventually, I would suggest that there should be more language
support for this type of thing!
David Austin
---
d.austin@computer.org
Robotic Systems Laboratory, Hiroshima '45
Department of Systems Engineering, Chernobyl '86
RSISE, Australian National University Windows '95