Skip to content

Commit

Permalink
5625 __GNU_UNUSED macro should have different definitions for compilers
Browse files Browse the repository at this point in the history
Reviewed by: Andy Stormont <[email protected]>
Reviewed by: Gary Mills <[email protected]>
Approved by: Gordon Ross <[email protected]>
  • Loading branch information
ikozhukhov authored and gwr committed Apr 3, 2015
1 parent 95ae728 commit 05c2421
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion usr/src/uts/common/sys/ccompile.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright 2015 EveryCity Ltd. All rights reserved.
*/

#ifndef _SYS_CCOMPILE_H
#define _SYS_CCOMPILE_H
Expand Down Expand Up @@ -117,6 +120,16 @@ extern "C" {
*/
#define __sun_attr___packed__ __attribute__((__packed__))

/*
* This attribute, attached to a variable, means that the variable is meant to
* be possibly unused. GCC will not produce a warning for this variable.
*/
#if __GNUC_VERSION >= 20700
#define __sun_attr___unused__ __attribute__((__unused__))
#else
#define __sun_attr___unused__
#endif

#define ___sun_attr_inner(__a) __sun_attr_##__a
#define __sun_attr__(__a) ___sun_attr_inner __a

Expand All @@ -139,7 +152,7 @@ extern "C" {
#define __RETURNS_TWICE __sun_attr__((__returns_twice__))
#define __CONST __sun_attr__((__const__))
#define __PURE __sun_attr__((__pure__))
#define __GNU_UNUSED __attribute__((__unused__))
#define __GNU_UNUSED __sun_attr__((__unused__))

#ifdef __cplusplus
}
Expand Down

0 comments on commit 05c2421

Please sign in to comment.