This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC]: patch to detect invalid and missing ATTRIBUTE const/pure
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: john at feith dot com
- Cc: dann at ics dot uci dot edu, gcc-patches at gcc dot gnu dot org, jh at suse dot cz, mark at codesourcery dot com, rth at redhat dot com
- Date: Fri, 22 Mar 2002 10:03:27 -0500 (EST)
- Subject: Re: [RFC]: patch to detect invalid and missing ATTRIBUTE const/pure
> From: John Wehle <john@feith.com>
>
> With your change mark_constant_function will attempt to mark
> non-static functions which can cause problems due to potentially
> differing implementations of a routine present in a shared library.
> -- John
I don't quite understand how that arises. Here's my understanding:
Supposing mark_constant_function is examining an extern function foo,
let's say it decides to mark foo as pure. That marking only takes
effect for the rest of that module since the extern prototype of foo()
seen by other files still doesn't have the attribute automatically
added to it.
Now any calls to foo() inside the original module would resovle to the
definition inside the file, regardless of whether we eventually link
with a shared lib having another copy of foo, right? In that case,
we can't have the "differing implementations" problem AFAICT.
Can you help me understand where this reasoning is flawed? (Or if its
already been discussed, just point me at the URL.)
Thanks,
--Kaveh
--
Kaveh R. Ghazi Director of Systems Architecture
ghazi@caip.rutgers.edu Qwest Global Services