Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 May 2012 15:26:56 +0000 (UTC)
From:      David Chisnall <theraven@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r235786 - in stable/9: include lib/libc/stdlib lib/msun/src sys/sys
Message-ID:  <201205221526.q4MFQuUN009818@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: theraven
Date: Tue May 22 15:26:55 2012
New Revision: 235786
URL: http://svn.freebsd.org/changeset/base/235786

Log:
  Merge quick_exit and changes required for C++11 code to compile against FreeBSD headers.
  
  Merges changes from: r227472 r227475 r227475 r227476 r227476 r227490 r227490 r228322 r228323 r228329 r228330 r228528 r228529 r228529 r228901 r228918 r228918 r232971 r232971
  
  Also bump __FreeBSD_version for this and the xlocale merge.

Added:
  stable/9/lib/libc/stdlib/at_quick_exit.3
     - copied, changed from r228323, head/lib/libc/stdlib/at_quick_exit.3
  stable/9/lib/libc/stdlib/quick_exit.3
     - copied, changed from r228323, head/lib/libc/stdlib/quick_exit.3
  stable/9/lib/libc/stdlib/quick_exit.c
     - copied, changed from r228323, head/lib/libc/stdlib/quick_exit.c
Modified:
  stable/9/include/ctype.h
  stable/9/include/stdlib.h
  stable/9/include/wctype.h
  stable/9/lib/libc/stdlib/Makefile.inc
  stable/9/lib/libc/stdlib/Symbol.map
  stable/9/lib/libc/stdlib/atexit.3
  stable/9/lib/libc/stdlib/exit.3
  stable/9/lib/msun/src/math.h
  stable/9/sys/sys/_null.h
  stable/9/sys/sys/cdefs.h
  stable/9/sys/sys/param.h
  stable/9/sys/sys/stdint.h
Directory Properties:
  stable/9/include/   (props changed)
  stable/9/lib/libc/   (props changed)
  stable/9/lib/msun/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/include/ctype.h
==============================================================================
--- stable/9/include/ctype.h	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/include/ctype.h	Tue May 22 15:26:55 2012	(r235786)
@@ -84,6 +84,7 @@ int	isspecial(int);
 #endif
 __END_DECLS
 
+#ifndef __cplusplus
 #define	isalnum(c)	__sbistype((c), _CTYPE_A|_CTYPE_D)
 #define	isalpha(c)	__sbistype((c), _CTYPE_A)
 #define	iscntrl(c)	__sbistype((c), _CTYPE_C)
@@ -97,6 +98,7 @@ __END_DECLS
 #define	isxdigit(c)	__isctype((c), _CTYPE_X) /* ANSI -- locale independent */
 #define	tolower(c)	__sbtolower(c)
 #define	toupper(c)	__sbtoupper(c)
+#endif /* !__cplusplus */
 
 #if __XSI_VISIBLE
 /*
@@ -116,7 +118,7 @@ __END_DECLS
 #define	toascii(c)	((c) & 0x7F)
 #endif
 
-#if __ISO_C_VISIBLE >= 1999
+#if __ISO_C_VISIBLE >= 1999 && !defined(__cplusplus)
 #define	isblank(c)	__sbistype((c), _CTYPE_B)
 #endif
 

Modified: stable/9/include/stdlib.h
==============================================================================
--- stable/9/include/stdlib.h	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/include/stdlib.h	Tue May 22 15:26:55 2012	(r235786)
@@ -79,7 +79,7 @@ extern int __mb_cur_max;
 extern int ___mb_cur_max(void);
 #define	MB_CUR_MAX	(___mb_cur_max())
 
-void	 abort(void) __dead2;
+_Noreturn void	 abort(void);
 int	 abs(int) __pure2;
 int	 atexit(void (*)(void));
 double	 atof(const char *);
@@ -89,7 +89,7 @@ void	*bsearch(const void *, const void *
 	    size_t, int (*)(const void *, const void *));
 void	*calloc(size_t, size_t) __malloc_like;
 div_t	 div(int, int) __pure2;
-void	 exit(int) __dead2;
+_Noreturn void	 exit(int);
 void	 free(void *);
 char	*getenv(const char *);
 long	 labs(long) __pure2;
@@ -148,10 +148,18 @@ unsigned long long
 	 strtoull(const char * __restrict, char ** __restrict, int);
 #endif /* __LONG_LONG_SUPPORTED */
 
-void	 _Exit(int) __dead2;
+_Noreturn void	 _Exit(int);
 #endif /* __ISO_C_VISIBLE >= 1999 */
 
 /*
+ * If we're in a mode greater than C99, expose C1x functions.
+ */
+#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
+_Noreturn void
+	quick_exit(int);
+int	at_quick_exit(void (*)(void));
+#endif /* __ISO_C_VISIBLE >= 2011 */
+/*
  * Extensions made by POSIX relative to C.  We don't know yet which edition
  * of POSIX made these extensions, so assume they've always been there until
  * research can be done.

Modified: stable/9/include/wctype.h
==============================================================================
--- stable/9/include/wctype.h	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/include/wctype.h	Tue May 22 15:26:55 2012	(r235786)
@@ -94,6 +94,7 @@ wint_t	nextwctype(wint_t, wctype_t);
 #endif /* __POSIX_VISIBLE >= 200809 */
 __END_DECLS
 
+#ifndef __cplusplus
 #define	iswalnum(wc)		__istype((wc), _CTYPE_A|_CTYPE_D)
 #define	iswalpha(wc)		__istype((wc), _CTYPE_A)
 #define	iswblank(wc)		__istype((wc), _CTYPE_B)
@@ -118,6 +119,7 @@ __END_DECLS
 #define	iswphonogram(wc)	__istype((wc), _CTYPE_Q)
 #define	iswrune(wc)		__istype((wc), 0xFFFFFF00L)
 #define	iswspecial(wc)		__istype((wc), _CTYPE_T)
-#endif
+#endif /* __BSD_VISIBLE */
+#endif /* __cplusplus */
 
 #endif		/* _WCTYPE_H_ */

Modified: stable/9/lib/libc/stdlib/Makefile.inc
==============================================================================
--- stable/9/lib/libc/stdlib/Makefile.inc	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/lib/libc/stdlib/Makefile.inc	Tue May 22 15:26:55 2012	(r235786)
@@ -8,8 +8,8 @@ MISRCS+=_Exit.c a64l.c abort.c abs.c ate
 	bsearch.c div.c exit.c getenv.c getopt.c getopt_long.c \
 	getsubopt.c hcreate.c heapsort.c imaxabs.c imaxdiv.c \
 	insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c malloc.c \
-	merge.c ptsname.c qsort.c qsort_r.c radixsort.c rand.c random.c \
-	reallocf.c realpath.c remque.c strfmon.c strtoimax.c \
+	merge.c ptsname.c qsort.c qsort_r.c quick_exit.c radixsort.c rand.c \
+	random.c reallocf.c realpath.c remque.c strfmon.c strtoimax.c \
 	strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \
         strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c
 
@@ -18,10 +18,12 @@ SYM_MAPS+= ${.CURDIR}/stdlib/Symbol.map
 # machine-dependent stdlib sources
 .sinclude "${.CURDIR}/${LIBC_ARCH}/stdlib/Makefile.inc"
 
-MAN+=	a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 bsearch.3 \
+MAN+=	a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 \
+	at_quick_exit.3 bsearch.3 \
 	div.3 exit.3 getenv.3 getopt.3 getopt_long.3 getsubopt.3 \
 	hcreate.3 imaxabs.3 imaxdiv.3 insque.3 labs.3 ldiv.3 llabs.3 lldiv.3 \
 	lsearch.3 malloc.3 memory.3 posix_memalign.3 ptsname.3 qsort.3 \
+	quick_exit.3 \
 	radixsort.3 rand.3 random.3 \
 	realpath.3 strfmon.3 strtod.3 strtol.3 strtonum.3 strtoul.3 system.3 \
 	tsearch.3

Modified: stable/9/lib/libc/stdlib/Symbol.map
==============================================================================
--- stable/9/lib/libc/stdlib/Symbol.map	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/lib/libc/stdlib/Symbol.map	Tue May 22 15:26:55 2012	(r235786)
@@ -97,6 +97,8 @@ FBSD_1.3 {
 	atoi_l;
 	atol_l;
 	atoll_l;
+	at_quick_exit;
+	quick_exit;
 	strtod_l;
 	strtol_l;
 	strtoll_l;

Copied and modified: stable/9/lib/libc/stdlib/at_quick_exit.3 (from r228323, head/lib/libc/stdlib/at_quick_exit.3)
==============================================================================
--- head/lib/libc/stdlib/at_quick_exit.3	Wed Dec  7 16:12:54 2011	(r228323, copy source)
+++ stable/9/lib/libc/stdlib/at_quick_exit.3	Tue May 22 15:26:55 2012	(r235786)
@@ -23,13 +23,13 @@
 .\"  SUCH DAMAGE.
 .\" 
 .\"  $FreeBSD$
-.\" /
-.Dd December 7, 2011o.Dt ATEXIT 3
+.\"
+.Dd December 7, 2011
 .Dt AT_QUICK_EXIT 3
 .Os
 .Sh NAME
 .Nm at_quick_exit
-.Nd Registers a cleanup function to run on quick exit.
+.Nd registers a cleanup function to run on quick exit
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
@@ -48,10 +48,13 @@ the program exits by calling 
 .Xr _Exit 3 ,
 or
 .Xr abort 3 .
-.El
+.Sh RETURN VALUES
+The 
+.Fn at_quick_exit
+function returns the value 0 if successful and a non-zero value on failure.
 .Sh SEE ALSO
 .Xr exit 3 ,
-.Xr at_quick_exit 3
+.Xr quick_exit 3
 .Sh STANDARDS
 The
 .Fn at_quick_exit

Modified: stable/9/lib/libc/stdlib/atexit.3
==============================================================================
--- stable/9/lib/libc/stdlib/atexit.3	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/lib/libc/stdlib/atexit.3	Tue May 22 15:26:55 2012	(r235786)
@@ -79,6 +79,7 @@ No memory was available to add the funct
 The existing list of functions is unmodified.
 .El
 .Sh SEE ALSO
+.Xr at_quick_exit 3
 .Xr exit 3
 .Sh STANDARDS
 The

Modified: stable/9/lib/libc/stdlib/exit.3
==============================================================================
--- stable/9/lib/libc/stdlib/exit.3	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/lib/libc/stdlib/exit.3	Tue May 22 15:26:55 2012	(r235786)
@@ -118,7 +118,9 @@ never return.
 .Xr _exit 2 ,
 .Xr wait 2 ,
 .Xr atexit 3 ,
+.Xr at_quick_exit 3 ,
 .Xr intro 3 ,
+.Xr quick_exit 3 ,
 .Xr sysexits 3 ,
 .Xr tmpfile 3
 .Sh STANDARDS

Copied and modified: stable/9/lib/libc/stdlib/quick_exit.3 (from r228323, head/lib/libc/stdlib/quick_exit.3)
==============================================================================
--- head/lib/libc/stdlib/quick_exit.3	Wed Dec  7 16:12:54 2011	(r228323, copy source)
+++ stable/9/lib/libc/stdlib/quick_exit.3	Tue May 22 15:26:55 2012	(r235786)
@@ -23,13 +23,13 @@
 .\"  SUCH DAMAGE.
 .\" 
 .\"  $FreeBSD$
-.\" /
-.Dd December 7, 2011o.Dt ATEXIT 3
+.\"
+.Dd December 7, 2011
 .Dt QUICK_EXIT 3
 .Os
 .Sh NAME
 .Nm quick_exit
-.Nd Exits a program quickly, running minimal cleanup
+.Nd exits a program quickly, running minimal cleanup
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
@@ -44,12 +44,14 @@ with
 .Xr at_quick_exit 3
 but not any C++ destructors or cleanup code registered with
 .Xr atexit 3 .
-.El
+.Sh RETURN VALUES
+The
+.Fn quick_exit
+function does not return.
 .Sh SEE ALSO
-.Xr exit 3 ,
-.Xr at_quick_exit 3
+.Xr at_quick_exit 3 ,
+.Xr exit 3
 .Sh STANDARDS
 The
 .Fn quick_exit
 function conforms to the C1x draft specification.
-

Copied and modified: stable/9/lib/libc/stdlib/quick_exit.c (from r228323, head/lib/libc/stdlib/quick_exit.c)
==============================================================================
--- head/lib/libc/stdlib/quick_exit.c	Wed Dec  7 16:12:54 2011	(r228323, copy source)
+++ stable/9/lib/libc/stdlib/quick_exit.c	Tue May 22 15:26:55 2012	(r235786)
@@ -51,10 +51,12 @@ static struct quick_exit_handler *handle
 int
 at_quick_exit(void (*func)(void))
 {
-	struct quick_exit_handler *h = malloc(sizeof(struct quick_exit_handler));
+	struct quick_exit_handler *h;
+	
+	h = malloc(sizeof(*h));
 
 	if (NULL == h)
-		return 1;
+		return (1);
 	h->cleanup = func;
 	pthread_mutex_lock(&atexit_mutex);
 	h->next = handlers;

Modified: stable/9/lib/msun/src/math.h
==============================================================================
--- stable/9/lib/msun/src/math.h	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/lib/msun/src/math.h	Tue May 22 15:26:55 2012	(r235786)
@@ -398,32 +398,32 @@ float	significandf(float);
  * long double versions of ISO/POSIX math functions
  */
 #if __ISO_C_VISIBLE >= 1999
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	acoshl(long double);
 #endif
 long double	acosl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	asinhl(long double);
 #endif
 long double	asinl(long double);
 long double	atan2l(long double, long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	atanhl(long double);
 #endif
 long double	atanl(long double);
 long double	cbrtl(long double);
 long double	ceill(long double);
 long double	copysignl(long double, long double) __pure2;
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	coshl(long double);
 #endif
 long double	cosl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	erfcl(long double);
 long double	erfl(long double);
 #endif
 long double	exp2l(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	expl(long double);
 long double	expm1l(long double);
 #endif
@@ -438,18 +438,18 @@ long double	frexpl(long double value, in
 long double	hypotl(long double, long double);
 int		ilogbl(long double) __pure2;
 long double	ldexpl(long double, int);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	lgammal(long double);
 #endif
 long long	llrintl(long double);
 long long	llroundl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	log10l(long double);
 long double	log1pl(long double);
 long double	log2l(long double);
 #endif
 long double	logbl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	logl(long double);
 #endif
 long		lrintl(long double);
@@ -461,7 +461,7 @@ long double	nextafterl(long double, long
 double		nexttoward(double, long double);
 float		nexttowardf(float, long double);
 long double	nexttowardl(long double, long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	powl(long double, long double);
 #endif
 long double	remainderl(long double, long double);
@@ -470,16 +470,16 @@ long double	rintl(long double);
 long double	roundl(long double);
 long double	scalblnl(long double, long);
 long double	scalbnl(long double, int);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	sinhl(long double);
 #endif
 long double	sinl(long double);
 long double	sqrtl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	tanhl(long double);
 #endif
 long double	tanl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long double	tgammal(long double);
 #endif
 long double	truncl(long double);

Modified: stable/9/sys/sys/_null.h
==============================================================================
--- stable/9/sys/sys/_null.h	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/sys/sys/_null.h	Tue May 22 15:26:55 2012	(r235786)
@@ -31,7 +31,9 @@
 #if !defined(__cplusplus)
 #define	NULL	((void *)0)
 #else
-#if defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4
+#if __cplusplus >= 201103L
+#define	NULL	nullptr
+#elif defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4
 #define	NULL	__null
 #else
 #if defined(__LP64__)

Modified: stable/9/sys/sys/cdefs.h
==============================================================================
--- stable/9/sys/sys/cdefs.h	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/sys/sys/cdefs.h	Tue May 22 15:26:55 2012	(r235786)
@@ -308,6 +308,17 @@
 #define	__LONG_LONG_SUPPORTED
 #endif
 
+/* C++11 exposes a load of C99 stuff */
+#if __cplusplus >= 201103L
+#	define	__LONG_LONG_SUPPORTED
+#	ifndef __STDC_LIMIT_MACROS
+#		define __STDC_LIMIT_MACROS
+#	endif
+#	ifndef __STDC_CONSTANT_MACROS
+#		define __STDC_CONSTANT_MACROS
+#	endif
+#endif
+
 /*
  * GCC 2.95 provides `__restrict' as an extension to C90 to support the
  * C99-specific `restrict' type qualifier.  We happen to use `__restrict' as

Modified: stable/9/sys/sys/param.h
==============================================================================
--- stable/9/sys/sys/param.h	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/sys/sys/param.h	Tue May 22 15:26:55 2012	(r235786)
@@ -58,7 +58,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 900505	/* Master, propagated to newvers */
+#define __FreeBSD_version 900506	/* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,

Modified: stable/9/sys/sys/stdint.h
==============================================================================
--- stable/9/sys/sys/stdint.h	Tue May 22 14:40:39 2012	(r235785)
+++ stable/9/sys/sys/stdint.h	Tue May 22 15:26:55 2012	(r235786)
@@ -64,4 +64,11 @@ typedef	__uintmax_t		uintmax_t;
 #define	_UINTMAX_T_DECLARED
 #endif
 
+/* GNU and Darwin define this and people seem to think it's portable */
+#if defined(UINTPTR_MAX) && defined(UINT64_MAX) && (UINTPTR_MAX == UINT64_MAX)
+#define	__WORDSIZE		64
+#else
+#define	__WORDSIZE		32
+#endif
+
 #endif /* !_SYS_STDINT_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205221526.q4MFQuUN009818>