octave-maintainers
[Top][All Lists]
Advanced

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

Re: safer way to use gnulib


From: John W. Eaton
Subject: Re: safer way to use gnulib
Date: Mon, 22 Mar 2010 19:14:54 -0400

On 20-Mar-2010, Michael Goffioul wrote:

| Some additional info. When scanning the object files, I could
| determine that the following files contained redefined "accept"
| symbol: defaults.cc, dirfns.cc, file-io.cc, help.cc, input.cc, lex.ll,
| oct-hist.cc, oct-procbuf.cc, sighandlers.cc, syscalls, cc, sysdep.cc,
| toplev.cc, txt-eng-ft.cc and utils.cc.

OK, I now see that the gnulib unistd.h header includes the lines

  #if 1
  /* Get all possible declarations of gethostname().  */
  # if 0
  #  include <winsock2.h>
  #  if !defined _GL_SYS_SOCKET_H
  #   undef socket
  #   define socket               socket_used_without_including_sys_socket_h
  #   undef connect
  #   define connect              connect_used_without_including_sys_socket_h
  #   undef accept
  #   define accept               accept_used_without_including_sys_socket_h
  #   undef bind
  #   define bind                 bind_used_without_including_sys_socket_h
  #   undef getpeername
  #   define getpeername          
getpeername_used_without_including_sys_socket_h
  #   undef getsockname
  #   define getsockname          
getsockname_used_without_including_sys_socket_h
  #   undef getsockopt
  #   define getsockopt           getsockopt_used_without_including_sys_socket_h
  #   undef listen
  #   define listen               listen_used_without_including_sys_socket_h
  #   undef recv
  #   define recv                 recv_used_without_including_sys_socket_h
  #   undef send
  #   define send                 send_used_without_including_sys_socket_h
  #   undef recvfrom
  #   define recvfrom             recvfrom_used_without_including_sys_socket_h
  #   undef sendto
  #   define sendto               sendto_used_without_including_sys_socket_h
  #   undef setsockopt
  #   define setsockopt           setsockopt_used_without_including_sys_socket_h
  #   undef shutdown
  #   define shutdown             shutdown_used_without_including_sys_socket_h
  #  endif
  #  if !defined _GL_SYS_SELECT_H
  #   undef select
  #   define select               select_used_without_including_sys_select_h
  #  endif
  # endif
  #endif

and these unconditional #defines can easily cause trouble for C++
programs if they are enabled.  I'll bring this issue up on the gnulib
maintainers list.  Maybe I'm missing something here, but it seems to
me that these definitions could also cause some trouble for C programs
that use these names as variables.

jwe


reply via email to

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