[Open-scap] [PATCH] Renaming the __P Macro. An __P macro is used bysome system libraries on Solaris, and redefining it breaks many things.

Marshall Miller mmiller at tresys.com
Fri Feb 25 22:04:36 UTC 2011


This is the first in a series of patches intended to add Solaris support
to the OpenSCAP library.

Sorry about the subject containing the entire commit message.  I forgot
about the git send-email quirks.



Marshall

> -----Original Message-----
> From: open-scap-list-bounces at redhat.com [mailto:open-scap-list-
> bounces at redhat.com] On Behalf Of Marshall Miller
> Sent: Friday, February 25, 2011 4:58 PM
> To: open-scap-list at redhat.com
> Subject: [Open-scap] [PATCH] Renaming the __P Macro. An __P macro is
> used bysome system libraries on Solaris,and redefining it breaks many
> things.
> 
> From: Francisco Slavin <fslavin at tresys.com>
> 
> ---
>  src/OVAL/probes/SEAP/public/sm_alloc.h |   15 +++++++--------
>  src/common/public/alloc.h              |   23 +++++++++++------------
>  2 files changed, 18 insertions(+), 20 deletions(-)
> 
> diff --git a/src/OVAL/probes/SEAP/public/sm_alloc.h
> b/src/OVAL/probes/SEAP/public/sm_alloc.h
> index 901dd2a..25eadcf 100644
> --- a/src/OVAL/probes/SEAP/public/sm_alloc.h
> +++ b/src/OVAL/probes/SEAP/public/sm_alloc.h
> @@ -30,8 +30,7 @@
>  extern "C" {
>  #endif
> 
> -#undef  __P
> -#define __P __attribute__ ((unused)) static
> +#define __ATTRIB __attribute__ ((unused)) static
> 
>  #if defined(NDEBUG)
>  void *sm_alloc (size_t s);
> @@ -42,22 +41,22 @@ int   sm_memalign (void **p, size_t a, size_t s);
>  void  sm_free (void *p);
>  #else
>  void *  __sm_alloc_dbg (size_t s, const char *f, size_t l);
> -__P void *sm_alloc     (size_t s) { return __sm_alloc_dbg (s,
> __FUNCTION__, 0); }
> +__ATTRIB void *sm_alloc     (size_t s) { return __sm_alloc_dbg (s,
> __FUNCTION__, 0); }
> 
>  void *  __sm_calloc_dbg (size_t n, size_t s, const char *f, size_t
l);
> -__P void *sm_calloc     (size_t n, size_t s) { return __sm_calloc_dbg
> (n, s, __FUNCTION__, 0); }
> +__ATTRIB void *sm_calloc     (size_t n, size_t s) { return
> __sm_calloc_dbg (n, s, __FUNCTION__, 0); }
> 
>  void *  __sm_realloc_dbg (void *p, size_t s, const char *f, size_t
l);
> -__P void *sm_realloc     (void *p, size_t s) { return
__sm_realloc_dbg
> (p, s, __FUNCTION__, 0); }
> +__ATTRIB void *sm_realloc     (void *p, size_t s) { return
> __sm_realloc_dbg (p, s, __FUNCTION__, 0); }
> 
>  void *  __sm_reallocf_dbg (void *p, size_t s, const char *f, size_t
> l);
> -__P void *sm_reallocf     (void *p, size_t s) { return
> __sm_reallocf_dbg (p, s, __FUNCTION__, 0); }
> +__ATTRIB void *sm_reallocf     (void *p, size_t s) { return
> __sm_reallocf_dbg (p, s, __FUNCTION__, 0); }
> 
>  int     __sm_memalign_dbg (void **p, size_t a, size_t s, const char
> *f, size_t l);
> -__P int __sm_memalign     (void **p, size_t a, size_t s) { return
> __sm_memalign_dbg (p, a, s, __FUNCTION__, 0); }
> +__ATTRIB int __sm_memalign     (void **p, size_t a, size_t s) {
return
> __sm_memalign_dbg (p, a, s, __FUNCTION__, 0); }
> 
>  void   __sm_free_dbg (void *p, const char *f, size_t l);
> -__P void sm_free     (void *p) { __sm_free_dbg (p, __FUNCTION__, 0);
}
> +__ATTRIB void sm_free     (void *p) { __sm_free_dbg (p, __FUNCTION__,
> 0); }
> 
>  # define sm_alloc(s)          __sm_alloc_dbg (s, __PRETTY_FUNCTION__,
> __LINE__)
>  # define sm_calloc(n, s)      __sm_calloc_dbg (n, s,
> __PRETTY_FUNCTION__, __LINE__)
> diff --git a/src/common/public/alloc.h b/src/common/public/alloc.h
> index 70ef01e..21cf52b 100644
> --- a/src/common/public/alloc.h
> +++ b/src/common/public/alloc.h
> @@ -41,38 +41,37 @@
>  #include <stdlib.h>
> 
>  /// @cond
> -#undef  __P
> -#define __P __attribute__ ((unused)) static
> +#define __ATTRIB __attribute__ ((unused)) static
>  /// @endcond
> 
>  #if defined(NDEBUG)
>  /// @cond
>  void *__oscap_alloc(size_t s);
> -__P void *oscap_alloc(size_t s)
> +__ATTRIB void *oscap_alloc(size_t s)
>  {
>  	return __oscap_alloc(s);
>  }
> 
>  void *__oscap_calloc(size_t n, size_t s);
> -__P void *oscap_calloc(size_t n, size_t s)
> +__ATTRIB void *oscap_calloc(size_t n, size_t s)
>  {
>  	return __oscap_calloc(n, s);
>  }
> 
>  void *__oscap_realloc(void *p, size_t s);
> -__P void *oscap_realloc(void *p, size_t s)
> +__ATTRIB void *oscap_realloc(void *p, size_t s)
>  {
>  	return __oscap_realloc(p, s);
>  }
> 
>  void *__oscap_reallocf(void *p, size_t s);
> -__P void *oscap_reallocf(void *p, size_t s)
> +__ATTRIB void *oscap_reallocf(void *p, size_t s)
>  {
>  	return __oscap_reallocf(p, s);
>  }
> 
>  void __oscap_free(void *p);
> -__P void oscap_free(void *p)
> +__ATTRIB void oscap_free(void *p)
>  {
>  	__oscap_free(p);
>  }
> @@ -101,31 +100,31 @@ __P void oscap_free(void *p)
> 
>  #else
>  void *__oscap_alloc_dbg(size_t s, const char *f, size_t l);
> -__P void *oscap_alloc(size_t s)
> +__ATTRIB void *oscap_alloc(size_t s)
>  {
>  	return __oscap_alloc_dbg(s, __FUNCTION__, 0);
>  }
> 
>  void *__oscap_calloc_dbg(size_t n, size_t s, const char *f, size_t
l);
> -__P void *oscap_calloc(size_t n, size_t s)
> +__ATTRIB void *oscap_calloc(size_t n, size_t s)
>  {
>  	return __oscap_calloc_dbg(n, s, __FUNCTION__, 0);
>  }
> 
>  void *__oscap_realloc_dbg(void *p, size_t s, const char *f, size_t
l);
> -__P void *oscap_realloc(void *p, size_t s)
> +__ATTRIB void *oscap_realloc(void *p, size_t s)
>  {
>  	return __oscap_realloc_dbg(p, s, __FUNCTION__, 0);
>  }
> 
>  void *__oscap_reallocf_dbg(void *p, size_t s, const char *f, size_t
> l);
> -__P void *oscap_reallocf(void *p, size_t s)
> +__ATTRIB void *oscap_reallocf(void *p, size_t s)
>  {
>  	return __oscap_reallocf_dbg(p, s, __FUNCTION__, 0);
>  }
> 
>  void __oscap_free_dbg(void **p, const char *f, size_t l);
> -__P void oscap_free(void *p)
> +__ATTRIB void oscap_free(void *p)
>  {
>  	__oscap_free_dbg(&p, __FUNCTION__, 0);
>  }
> --
> 1.6.2.5
> 
> _______________________________________________
> Open-scap-list mailing list
> Open-scap-list at redhat.com
> https://www.redhat.com/mailman/listinfo/open-scap-list




More information about the Open-scap-list mailing list