bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnulib and C++


From: Bruno Haible
Subject: Re: gnulib and C++
Date: Fri, 19 Feb 2010 00:28:08 +0100
User-agent: KMail/1.9.9

The idiom for declaring the 'open' override can be simplified as follows,
through the definition of three new macros _GL_DECL_NAMESPACE_C,
_GL_ALIAS_RPL, _GL_ALIAS_STD.

*** lib/fcntl.in.h.orig Fri Feb 19 00:25:00 2010
--- lib/fcntl.in.h      Fri Feb 19 00:14:03 2010
***************
*** 79,87 ****
  
  #if @GNULIB_OPEN@
  # if @REPLACE_OPEN@
! #  undef open
! #  define open rpl_open
! extern int open (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1));
  # endif
  #elif defined GNULIB_POSIXCHECK
  # undef open
--- 75,88 ----
  
  #if @GNULIB_OPEN@
  # if @REPLACE_OPEN@
! #  ifndef __cplusplus
! #   undef open
! #   define open rpl_open
! #  endif
! _GL_DECL_NAMESPACE_C (open, int, (const char *filename, int flags, ...) 
_GL_ARG_NONNULL ((1)));
! _GL_ALIAS_RPL (open, int, (const char *filename, int flags, ...))
! # else
! _GL_ALIAS_STD (open, int, (const char *filename, int flags, ...))
  # endif
  #elif defined GNULIB_POSIXCHECK
  # undef open

It is tempting to merge _GL_DECL_NAMESPACE_C and _GL_ALIAS_RPL into a single
macro, so that the parameter list needs to be mentioned only 2 x instead of 3 x,
but that does not work because of a g++ bug. [1]

Bruno


[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43116




reply via email to

[Prev in Thread] Current Thread [Next in Thread]