tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Attributes for __user


From: Fabrice Bellard
Subject: [Tinycc-devel] Attributes for __user
Date: Thu, 24 Apr 2003 17:43:00 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020828


I have seen that the keyword __user was added recently in the Linux kernel to indicate "user data" so that compile time checks can be done with appropriate tools.

__user is defined as (in linux/compile.h):

#ifdef __CHECKER__
  #define __user        __attribute__((noderef, address_space(1)))
  #define __kernel      /* default address space */
#else
  #define __user
  #define __kernel
#endif

It seems that gcc does not support it yet (am it right ?), but adding support for 'noderef' and 'address_space(N)' attributes would be easy in TinyCC. It would allow to do interesting checks of the Linux kernel.

The semantics could be the following:

1) Dereferencing a pointer pointing to data with the 'noderef' attribute causes a warning.

2) A pointer to an 'address_space(N)' data is only type-compatible with a pointer to the same address_space. It causes a warning if it is not.

At the same time, support for 'volatile' and 'const' typing could be added.

Any comments ?

Fabrice.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]