From cd619a1eec451f440c109122cd41790e0a3f70ee Mon Sep 17 00:00:00 2001 From: Holger Lubitz Date: Thu, 2 Aug 2007 00:27:54 +0200 Subject: define __pure and __const --- src/include/compiler.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/include/compiler.h') diff --git a/src/include/compiler.h b/src/include/compiler.h index b130f28fd..e79f9fb2d 100644 --- a/src/include/compiler.h +++ b/src/include/compiler.h @@ -279,6 +279,18 @@ extern void dbg_hex_dump_da ( unsigned long dispaddr, /** Apply standard C calling conventions */ #define __cdecl __attribute__ (( cdecl , regparm(0) )) +/** + * Declare a function as pure - i.e. without side effects + */ +#define __pure __attribute__ (( pure )) + +/** + * Declare a function as const - i.e. it does not access global memory + * (including dereferencing pointers passed to it) at all. + * Must also not call any non-const functions. + */ +#define __const __attribute__ (( const )) + /** * Declare a function as used. * -- cgit v1.2.3-55-g7522 From e3d10ac6734833e94d329c517c868223d530a955 Mon Sep 17 00:00:00 2001 From: Holger Lubitz Date: Thu, 2 Aug 2007 01:01:01 +0200 Subject: define __nonnull --- src/include/compiler.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/include/compiler.h') diff --git a/src/include/compiler.h b/src/include/compiler.h index e79f9fb2d..32416a561 100644 --- a/src/include/compiler.h +++ b/src/include/compiler.h @@ -291,6 +291,13 @@ extern void dbg_hex_dump_da ( unsigned long dispaddr, */ #define __const __attribute__ (( const )) +/** + * Declare a function's pointer parameters as non-null - i.e. force + * compiler to check pointers at compile time and enable possible + * optimizations based on that fact + */ +#define __nonnull __attribute__ (( nonnull )) + /** * Declare a function as used. * -- cgit v1.2.3-55-g7522 From 2220e1a676fd46286f48aa193d70fe5197629f49 Mon Sep 17 00:00:00 2001 From: Holger Lubitz Date: Mon, 20 Aug 2007 20:28:11 +0200 Subject: define malloc attribute --- src/include/compiler.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/include/compiler.h') diff --git a/src/include/compiler.h b/src/include/compiler.h index 32416a561..15efb709e 100644 --- a/src/include/compiler.h +++ b/src/include/compiler.h @@ -298,6 +298,12 @@ extern void dbg_hex_dump_da ( unsigned long dispaddr, */ #define __nonnull __attribute__ (( nonnull )) +/** + * Declare a pointer returned by a function as a unique memory address + * as returned by malloc-type functions. + */ +#define __malloc __attribute__ (( malloc )) + /** * Declare a function as used. * -- cgit v1.2.3-55-g7522