Mercurial > ecos
changeset 2020:6d5deacbe8fd
* include/cyg_type.h: Added CYGBLD_ATTRIB_USED so that we can
indicate to gcc 3.4.4 or above not to throw away a variable or
function even when it appears to be not references.
| author | asl |
|---|---|
| date | Fri, 22 Jul 2005 09:20:44 +0000 |
| parents | ec659f224fe7 |
| children | e767f9bd75b8 |
| files | packages/infra/current/ChangeLog packages/infra/current/include/cyg_type.h |
| diffstat | 2 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/infra/current/ChangeLog +++ b/packages/infra/current/ChangeLog @@ -1,3 +1,9 @@ +2005-06-27 Andrew Lunn <andrew.lunn@ascom.ch> + + * include/cyg_type.h: Added CYGBLD_ATTRIB_USED so that we can + indicate to gcc 3.4.4 or above not to throw away a variable or + function even when it appears to be not references. + 2005-03-27 Andrew Lunn <andrew.lunn@ascom.ch> * include/diag.h: Added CYGBLD_ATTRIB_PRINTF_FORMAT where
--- a/packages/infra/current/include/cyg_type.h +++ b/packages/infra/current/include/cyg_type.h @@ -313,6 +313,15 @@ typedef cyg_haladdrword CYG_ADDRWORD; // COMPILER-SPECIFIC STUFF #ifdef __GNUC__ +#if defined(__GNU_PATCHLEVEL__) +# define __GNUC_VERSION__ (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) +#else +# define __GNUC_VERSION__ (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100) +#endif + // Force a 'C' routine to be called like a 'C++' contructor # if !defined(CYGBLD_ATTRIB_CONSTRUCTOR) # define CYGBLD_ATTRIB_CONSTRUCTOR __attribute__((constructor)) @@ -383,6 +392,16 @@ typedef cyg_haladdrword CYG_ADDRWORD; # define CYGBLD_ATTRIB_STRFTIME_FORMAT(__format__, __args__) \ __attribute__((format (strftime, __format__, __args__))) +// Tell the compiler not to throw away a variable or function. Only +// available on 3.3.4 or above. Old version's didn't throw them away, +// but using the unused attribute should stop warnings. +# if !defined(CYGBLD_ATTRIB_USED) +# if __GNUC_VERSION__ >= 30404 +# define CYGBLD_ATTRIB_USED __attribute__((used)) +# else +# define CYGBLD_ATTRIB_USED __attribute__((unused)) +# endif +# endif #else // non-GNU # define CYGBLD_ATTRIB_CONSTRUCTOR
