changeset 17320:2c4826afb7aa

unistd: avoid namespace pollution on non-glibc systems * lib/unistd.in.h: #define __need_getopt before including <getopt.h>. This avoids namespace pollution on non-glibc systems, by causing gnulib unistd.h to behave more like glibc unistd.h. I also hope that this fixes a bug on FreeBSD, reported by Mats Erik Andersson in <http://lists.gnu.org/archive/html/bug-gnulib/2013-02/msg00027.html>.
author Paul Eggert <eggert@cs.ucla.edu>
date Wed, 06 Feb 2013 16:11:07 -0800
parents f6f7069a0d8e
children 896204e6fbfc
files ChangeLog lib/unistd.in.h
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-02-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+	unistd: avoid namespace pollution on non-glibc systems
+	* lib/unistd.in.h: #define __need_getopt before including <getopt.h>.
+	This avoids namespace pollution on non-glibc systems, by causing
+	gnulib unistd.h to behave more like glibc unistd.h.  I also hope
+	that this fixes a bug on FreeBSD, reported by Mats Erik Andersson in
+	<http://lists.gnu.org/archive/html/bug-gnulib/2013-02/msg00027.html>.
+
 2013-02-04  Paul Eggert  <eggert@cs.ucla.edu>
 
 	tmpdir: use secure_getenv
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -110,6 +110,7 @@
 /* Get getopt(), optarg, optind, opterr, optopt.
    But avoid namespace pollution on glibc systems.  */
 #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
+# define __need_getopt
 # include <getopt.h>
 #endif