types.h: gcc before 4.5 has a no-argument form of deprecated.

device.h: use LIBCIO_DEPRECATED macro rather than assume gcc.
This commit is contained in:
R. Bernstein
2012-02-24 05:10:24 -05:00
parent 998567ef2d
commit 1a7366c674
2 changed files with 24 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
/*
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2012
Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
@@ -158,8 +158,8 @@ typedef uint8_t ubyte;
# define PRAGMA_END_PACKED
#endif
/*
* user directed static branch prediction gcc 2.96+
/**
* user-directed static branch prediction gcc 2.96+
*/
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
# define GNUC_LIKELY(x) __builtin_expect((x),true)
@@ -172,8 +172,22 @@ typedef uint8_t ubyte;
#ifndef NULL
# define NULL ((void*) 0)
#endif
/* our own offsetof()-like macro */
/** Provide a notice for deprecated elements. Before gcc 4.5 'deprecated'
takes no arguments. */
#if defined(__GNUC__)
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5)
# define LIBCDIO_DEPRECATED(object, notice) object __attribute__ ((deprecated(notice)))
# else
# define LIBCDIO_DEPRECATED(object, notice) object __attribute__ ((deprecated))
# endif
#elif defined(_MSC_VER)
#define LIBCDIO_DEPRECATED(object, notice) __declspec(deprecated(notice)) object
#else
#define LIBCDIO_DEPRECATED(object, notice)
#endif
/** our own offsetof()-like macro */
#define __cd_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
/*!