public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Is there a way to restrict function calls (at compile time)?
@ 2005-10-23 23:48 Lars Luthman
  2005-10-24  9:26 ` Nathan Sidwell
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Luthman @ 2005-10-23 23:48 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 574 bytes --]

Is there a way, using GCC, to add 'properties' or 'flags' to C and C++
functions and generate warnings or error messages when a function with a
certain property (for example 'realtime safe') tries to call a function
that does not have that property?

I realise that this would be tricky to do for function pointers and
virtual functions, but a solution that only works for 'normal' function
calls will be very useful anyway.

-- 
Lars Luthman
PGP key:     http://www.d.kth.se/~d00-llu/pgp_key.php
Fingerprint: FCA7 C790 19B9 322D EB7A  E1B3 4371 4650 04C7 7E2E

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Is there a way to restrict function calls (at compile time)?
  2005-10-23 23:48 Is there a way to restrict function calls (at compile time)? Lars Luthman
@ 2005-10-24  9:26 ` Nathan Sidwell
  2005-10-26 22:23   ` Kai Henningsen
  0 siblings, 1 reply; 5+ messages in thread
From: Nathan Sidwell @ 2005-10-24  9:26 UTC (permalink / raw)
  To: Lars Luthman; +Cc: gcc-help

Lars Luthman wrote:
> Is there a way, using GCC, to add 'properties' or 'flags' to C and C++
> functions and generate warnings or error messages when a function with a
> certain property (for example 'realtime safe') tries to call a function
> that does not have that property?

GCC does not have such a feature.

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Is there a way to restrict function calls (at compile time)?
  2005-10-24  9:26 ` Nathan Sidwell
@ 2005-10-26 22:23   ` Kai Henningsen
  2005-10-27 12:10     ` John Love-Jensen
  2005-10-28 16:32     ` Lars Luthman
  0 siblings, 2 replies; 5+ messages in thread
From: Kai Henningsen @ 2005-10-26 22:23 UTC (permalink / raw)
  To: gcc-help

nathan@codesourcery.com (Nathan Sidwell)  wrote on 24.10.05 in <435CA8DD.20902@codesourcery.com>:

> Lars Luthman wrote:
> > Is there a way, using GCC, to add 'properties' or 'flags' to C and C++
> > functions and generate warnings or error messages when a function with a
> > certain property (for example 'realtime safe') tries to call a function
> > that does not have that property?
>
> GCC does not have such a feature.

Hmm. Can "sparse" do that? I know it can follow data structures in  
different memory spaces ...

(That's the tool Linus wrote to check Linux kernel sources.)

MfG Kai

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Is there a way to restrict function calls (at compile time)?
  2005-10-26 22:23   ` Kai Henningsen
@ 2005-10-27 12:10     ` John Love-Jensen
  2005-10-28 16:32     ` Lars Luthman
  1 sibling, 0 replies; 5+ messages in thread
From: John Love-Jensen @ 2005-10-27 12:10 UTC (permalink / raw)
  To: MSX to GCC

Hi everyone,

Kai mentioned "sparse", more info here...
http://www.linuxjournal.com/article/7272

--Eljay

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Is there a way to restrict function calls (at compile time)?
  2005-10-26 22:23   ` Kai Henningsen
  2005-10-27 12:10     ` John Love-Jensen
@ 2005-10-28 16:32     ` Lars Luthman
  1 sibling, 0 replies; 5+ messages in thread
From: Lars Luthman @ 2005-10-28 16:32 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 984 bytes --]

On Wed, 2005-10-26 at 10:38 +0200, Kai Henningsen wrote:
> nathan@codesourcery.com (Nathan Sidwell)  wrote on 24.10.05 in <435CA8DD.20902@codesourcery.com>:
> 
> > Lars Luthman wrote:
> > > Is there a way, using GCC, to add 'properties' or 'flags' to C and C++
> > > functions and generate warnings or error messages when a function with a
> > > certain property (for example 'realtime safe') tries to call a function
> > > that does not have that property?
> >
> > GCC does not have such a feature.
> 
> Hmm. Can "sparse" do that? I know it can follow data structures in  
> different memory spaces ...
> 
> (That's the tool Linus wrote to check Linux kernel sources.)

sparse looks very interesting, especially the context checking.
Unfortunately it seems to be for C only and I need something that works
for C++ as well.

-- 
Lars Luthman
PGP key:     http://www.d.kth.se/~d00-llu/pgp_key.php
Fingerprint: FCA7 C790 19B9 322D EB7A  E1B3 4371 4650 04C7 7E2E

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-10-28 16:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-23 23:48 Is there a way to restrict function calls (at compile time)? Lars Luthman
2005-10-24  9:26 ` Nathan Sidwell
2005-10-26 22:23   ` Kai Henningsen
2005-10-27 12:10     ` John Love-Jensen
2005-10-28 16:32     ` Lars Luthman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).