This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Mark explicit decls as implicit when we've seen a prototype
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: <gcc-patches at gcc dot gnu dot org>, <jason at redhat dot com>
- Date: Thu, 4 Dec 2014 15:44:53 +0000
- Subject: Re: [PATCH] Mark explicit decls as implicit when we've seen a prototype
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1412041144520 dot 8254 at zhemvz dot fhfr dot qr> <alpine dot DEB dot 2 dot 10 dot 1412041430430 dot 23422 at digraph dot polyomino dot org dot uk> <alpine dot LSU dot 2 dot 11 dot 1412041603120 dot 8254 at zhemvz dot fhfr dot qr> <alpine dot DEB dot 2 dot 10 dot 1412041520420 dot 23422 at digraph dot polyomino dot org dot uk> <alpine dot LSU dot 2 dot 11 dot 1412041619040 dot 8254 at zhemvz dot fhfr dot qr>
On Thu, 4 Dec 2014, Richard Biener wrote:
> OTOH this also means the user cannot provide a conforming
> implementation on his own and get that used by GCC without editing
> system headers or including a header with -isystem or similar
> tricks.
Well - you could have a pragma / attribute for that purpose (declaring
"this program is providing a version of function X that has the semantics
GCC expects for function X", so GCC can both generate and optimize calls).
Such a pragma / attribute could also override targetm.libc_has_function
(for the case of the user providing their own definition of something
missing from their system's standard libraries). A related case would be
declaring somehow "I will be linking in libm, even though this translation
unit doesn't appear to be using libm functions, so calls to libm functions
can be implicitly generated", if GCC were made to avoid introducing uses
of libm. (Again, this would be a matter of providing a cleaner interface
rather than something that currently can't be expressed at all - the
proposed definition of what it means to use libm explicitly implies that
"if (0) (void) sqrt (0);" says that libm is being used.)
--
Joseph S. Myers
joseph@codesourcery.com