Make NAN a compile time constant (with help from the compiler). Suggested

by krister. Fixes PR 40695.
Make references to the old construct (which we can't remove for binary
compatibility reasons) emit a linker warning.
This commit is contained in:
martin 2009-02-22 01:34:01 +00:00
parent 07e886c39c
commit c79c3eed1d
13 changed files with 53 additions and 25 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: math.h,v 1.47 2008/04/25 21:20:57 christos Exp $ */
/* $NetBSD: math.h,v 1.48 2009/02/22 01:34:01 martin Exp $ */
/*
* ====================================================
@ -87,8 +87,12 @@ extern const union __long_double_u __infinityl;
/* 7.12#5 NAN: a quiet NaN, if supported */
#ifdef __HAVE_NANF
#if __GNUC_PREREQ__(3,3)
#define NAN __builtin_nanf("")
#else
extern const union __float_u __nanf;
#define NAN __nanf.__val
#endif
#endif /* __HAVE_NANF */
/* 7.12#6 number classification macros */

View File

@ -1,8 +1,8 @@
/* $NetBSD: nanf.c,v 1.4 2005/04/15 22:39:10 kleink Exp $ */
/* $NetBSD: nanf.c,v 1.5 2009/02/22 01:34:01 martin Exp $ */
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: nanf.c,v 1.4 2005/04/15 22:39:10 kleink Exp $");
__RCSID("$NetBSD: nanf.c,v 1.5 2009/02/22 01:34:01 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include <math.h>
@ -11,3 +11,5 @@ __RCSID("$NetBSD: nanf.c,v 1.4 2005/04/15 22:39:10 kleink Exp $");
/* bytes for quiet NaN (IEEE single precision) */
const union __float_u __nanf =
{ { 0, 0, 0xc0, 0x7f } };
__warn_references(__nanf, "warning: <math.h> defines NAN incorrectly for your compiler.")

View File

@ -1,8 +1,8 @@
/* $NetBSD: nanf.c,v 1.3 2005/04/15 22:39:10 kleink Exp $ */
/* $NetBSD: nanf.c,v 1.4 2009/02/22 01:34:01 martin Exp $ */
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: nanf.c,v 1.3 2005/04/15 22:39:10 kleink Exp $");
__RCSID("$NetBSD: nanf.c,v 1.4 2009/02/22 01:34:01 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include <math.h>
@ -15,3 +15,5 @@ const union __float_u __nanf =
#else
{ { 0, 0, 0xc0, 0x7f } };
#endif
__warn_references(__nanf, "warning: <math.h> defines NAN incorrectly for your compiler.")

View File

@ -1,8 +1,8 @@
/* $NetBSD: nanf.c,v 1.1 2005/04/15 22:39:10 kleink Exp $ */
/* $NetBSD: nanf.c,v 1.2 2009/02/22 01:34:01 martin Exp $ */
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: nanf.c,v 1.1 2005/04/15 22:39:10 kleink Exp $");
__RCSID("$NetBSD: nanf.c,v 1.2 2009/02/22 01:34:01 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include <math.h>
@ -11,3 +11,5 @@ __RCSID("$NetBSD: nanf.c,v 1.1 2005/04/15 22:39:10 kleink Exp $");
/* bytes for quiet NaN (IEEE single precision) */
const union __float_u __nanf =
{ { 0x7f, 0xa0, 0, 0 } };
__warn_references(__nanf, "warning: <math.h> defines NAN incorrectly for your compiler.")

View File

@ -1,8 +1,8 @@
/* $NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $ */
/* $NetBSD: nanf.c,v 1.4 2009/02/22 01:34:01 martin Exp $ */
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $");
__RCSID("$NetBSD: nanf.c,v 1.4 2009/02/22 01:34:01 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include <math.h>
@ -11,3 +11,5 @@ __RCSID("$NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $");
/* bytes for quiet NaN (IEEE single precision) */
const union __float_u __nanf =
{ { 0, 0, 0xc0, 0x7f } };
__warn_references(__nanf, "warning: <math.h> defines NAN incorrectly for your compiler.")

View File

@ -1,8 +1,8 @@
/* $NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $ */
/* $NetBSD: nanf.c,v 1.4 2009/02/22 01:34:01 martin Exp $ */
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $");
__RCSID("$NetBSD: nanf.c,v 1.4 2009/02/22 01:34:01 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include <math.h>
@ -11,3 +11,5 @@ __RCSID("$NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $");
/* bytes for quiet NaN (IEEE single precision) */
const union __float_u __nanf =
{ { 0x7f, 0xc0, 0, 0 } };
__warn_references(__nanf, "warning: <math.h> defines NAN incorrectly for your compiler.")

View File

@ -1,8 +1,8 @@
/* $NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $ */
/* $NetBSD: nanf.c,v 1.4 2009/02/22 01:34:02 martin Exp $ */
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $");
__RCSID("$NetBSD: nanf.c,v 1.4 2009/02/22 01:34:02 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include <math.h>
@ -15,3 +15,5 @@ const union __float_u __nanf =
#else
{ { 0, 0, 0xa0, 0x7f } };
#endif
__warn_references(__nanf, "warning: <math.h> defines NAN incorrectly for your compiler.")

View File

@ -1,8 +1,8 @@
/* $NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $ */
/* $NetBSD: nanf.c,v 1.4 2009/02/22 01:34:02 martin Exp $ */
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $");
__RCSID("$NetBSD: nanf.c,v 1.4 2009/02/22 01:34:02 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include <math.h>
@ -11,3 +11,5 @@ __RCSID("$NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $");
/* bytes for quiet NaN (IEEE single precision) */
const union __float_u __nanf =
{ { 0x7f, 0xc0, 0, 0 } };
__warn_references(__nanf, "warning: <math.h> defines NAN incorrectly for your compiler.")

View File

@ -1,8 +1,8 @@
/* $NetBSD: nanf.c,v 1.1 2006/07/01 16:37:20 ross Exp $ */
/* $NetBSD: nanf.c,v 1.2 2009/02/22 01:34:02 martin Exp $ */
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: nanf.c,v 1.1 2006/07/01 16:37:20 ross Exp $");
__RCSID("$NetBSD: nanf.c,v 1.2 2009/02/22 01:34:02 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include <math.h>
@ -11,3 +11,5 @@ __RCSID("$NetBSD: nanf.c,v 1.1 2006/07/01 16:37:20 ross Exp $");
/* bytes for quiet NaN (IEEE single precision) */
const union __float_u __nanf =
{ { 0x7f, 0xc0, 0, 0 } };
__warn_references(__nanf, "warning: <math.h> defines NAN incorrectly for your compiler.")

View File

@ -1,8 +1,8 @@
/* $NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $ */
/* $NetBSD: nanf.c,v 1.4 2009/02/22 01:34:02 martin Exp $ */
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $");
__RCSID("$NetBSD: nanf.c,v 1.4 2009/02/22 01:34:02 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include <math.h>
@ -15,3 +15,5 @@ const union __float_u __nanf =
#else
{ { 0, 0, 0xa0, 0x7f } };
#endif
__warn_references(__nanf, "warning: <math.h> defines NAN incorrectly for your compiler.")

View File

@ -1,8 +1,8 @@
/* $NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $ */
/* $NetBSD: nanf.c,v 1.4 2009/02/22 01:34:02 martin Exp $ */
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $");
__RCSID("$NetBSD: nanf.c,v 1.4 2009/02/22 01:34:02 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include <math.h>
@ -11,3 +11,5 @@ __RCSID("$NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $");
/* bytes for quiet NaN (IEEE single precision) */
const union __float_u __nanf =
{ { 0x7f, 0xc0, 0, 0 } };
__warn_references(__nanf, "warning: <math.h> defines NAN incorrectly for your compiler.")

View File

@ -1,8 +1,8 @@
/* $NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $ */
/* $NetBSD: nanf.c,v 1.4 2009/02/22 01:34:02 martin Exp $ */
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $");
__RCSID("$NetBSD: nanf.c,v 1.4 2009/02/22 01:34:02 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include <math.h>
@ -11,3 +11,5 @@ __RCSID("$NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $");
/* bytes for quiet NaN (IEEE single precision) */
const union __float_u __nanf =
{ { 0x7f, 0xc0, 0, 0 } };
__warn_references(__nanf, "warning: <math.h> defines NAN incorrectly for your compiler.")

View File

@ -1,8 +1,8 @@
/* $NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $ */
/* $NetBSD: nanf.c,v 1.4 2009/02/22 01:34:02 martin Exp $ */
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $");
__RCSID("$NetBSD: nanf.c,v 1.4 2009/02/22 01:34:02 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include <math.h>
@ -11,3 +11,5 @@ __RCSID("$NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $");
/* bytes for quiet NaN (IEEE single precision) */
const union __float_u __nanf =
{ { 0, 0, 0xc0, 0x7f } };
__warn_references(__nanf, "warning: <math.h> defines NAN incorrectly for your compiler.")