Skip to content

Commit c145971

Browse files
author
ripley
committed
make STRICT_R_HEADERS the default
git-svn-id: https://svn.r-project.org/R/trunk@87312 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent f8cf131 commit c145971

File tree

12 files changed

+22
-48
lines changed

12 files changed

+22
-48
lines changed

doc/NEWS.Rd

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,13 @@
241241
string. This is one step for \PR{18297}; from \I{Henrik Bengtsson}.
242242

243243
\item Header \file{R_ext/Constants.h} (included by \file{R.h}) now
244-
includes header \file{float.h} or \file{cfloat} for constants such
245-
as \code{DBL_MAX} even if \file{STRICT_R_HEADERS} is defined.
246-
247-
\item It is intended that \file{STRICT_R_HEADERS} will become the
248-
default prior to release. This will remove the legacy definitions
249-
of \code{PI}, \code{Calloc}, \code{Realloc} and \code{Free}: use
250-
\code{M_PI}, \code{R_Calloc}, \code{R_Realloc} or \code{R_Free}
251-
instead.
244+
always includes header \file{float.h} or \file{cfloat} for
245+
constants such as \code{DBL_MAX}
246+
247+
\item Defining \file{STRICT_R_HEADERS} is now the default. This
248+
removes the legacy definitions of \code{PI}, \code{Calloc},
249+
\code{Realloc} and \code{Free}: use \code{M_PI}, \code{R_Calloc},
250+
\code{R_Realloc} or \code{R_Free} instead.
252251

253252
\item The deprecated S-compatibility macros \code{F77_COM} and
254253
\code{F77_COMDECL} have been removed from header \file{R_ext/RS.h}.

doc/manual/R-exts.texi

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14999,9 +14999,7 @@ Memory obtained by these macros should be aligned in the same way as
1499914999
@apifun Free
1500015000
@c The R_ forms were introduced in 2016-09, hence for R 3.4.0
1500115001
Historically the macros @code{Calloc}, @code{Free} and @code{Realloc}
15002-
were used, and these remain available unless @code{STRICT_R_HEADERS}
15003-
was defined prior to the inclusion of the header, but these are likely to
15004-
be removed in the near future.
15002+
were used but have been removed in \R 4.5.0.
1500515003

1500615004
@code{R_Calloc}, @code{R_Realloc}, and @code{R_Free} are currently
1500715005
implemented as macros expanding to calls to @code{R_chk_calloc},
@@ -16131,11 +16129,11 @@ natural logarithm (@code{log(x)} in @R{}).
1613116129
@end quotation
1613216130

1613316131
@apihdr R_ext/Constants.h
16134-
For compatibility with @Sl{} this file defines the constant @code{PI}
16135-
(unless @code{STRICT_R_HEADERS} is defined): this is deprecated and
16136-
should be replaced by @code{M_PI}. Header @file{Constants.h} includes
16137-
either C header @file{float.h} or C++ header @file{cfloat}, which
16138-
provide constants such as @code{DBL_MAX}.
16132+
For compatibility with @Sl{} this file used to define the constant
16133+
@code{PI} this is defunct and should be replaced by @code{M_PI}.
16134+
Header @file{Constants.h} includes either C header @file{float.h} or
16135+
C++ header @file{cfloat}, which provide constants such as
16136+
@code{DBL_MAX}.
1613916137

1614016138
@apivar TRUE
1614116139
@apivar FALSE

src/include/R.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* R : A Computer Language for Statistical Data Analysis
3-
* Copyright (C) 2000-2022 The R Core Team.
3+
* Copyright (C) 2000-2024 The R Core Team.
44
*
55
* This header file is free software; you can redistribute it and/or modify
66
* it under the terms of the GNU Lesser General Public License as published by
@@ -69,7 +69,7 @@
6969
#include <R_ext/Arith.h> /* R_FINITE, ISNAN, ... */
7070
#include <R_ext/Boolean.h> /* Rboolean type */
7171
#include <R_ext/Complex.h> /* Rcomplex type */
72-
#include <R_ext/Constants.h> /* M_PI; DOUBLE_EPS, etc unless STRICT_R_HEADERS */
72+
#include <R_ext/Constants.h> /* M_PI; DOUBLE_EPS, etc */
7373
#include <R_ext/Error.h> /* error and warning */
7474
#include <R_ext/Memory.h> /* R_alloc and S_alloc */
7575
#include <R_ext/Print.h> /* Rprintf etc */

src/include/R_ext/Constants.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@
4343
# include <float.h> /* Defines the RHSs, C99 and later */
4444
#endif
4545

46-
#ifndef STRICT_R_HEADERS
46+
/* #ifndef STRICT_R_HEADERS
4747
# define PI M_PI
4848
#endif
49+
*/
4950

5051
/* The DOUBLE_* defines were deprecated in R 4.2.0 and removed in 4.3.0.
5152
#define DOUBLE_DIGITS DBL_MANT_DIG

src/include/R_ext/Error.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void R_ShowMessage(const char *s);
7272
*/
7373
#ifdef HAVE_F77_UNDERSCORE
7474
/* F77_NAME is in RS.h, but better not include it here (e.g. due to
75-
* name conflicts involving symbols defined with !STRICT_R_HEADERS) .
75+
* previous name conflicts involving symbols defined with !STRICT_R_HEADERS) .
7676
* However, using a trailing underline is not universal, and print.c
7777
* uses F77_SUB.
7878
*/

src/include/R_ext/RS.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,6 @@ extern void R_chk_free(void *);
5151
extern void *R_chk_memcpy(void *, const void *, R_SIZE_T);
5252
extern void *R_chk_memset(void *, int, R_SIZE_T);
5353

54-
#ifndef STRICT_R_HEADERS
55-
/* S-PLUS 3.x but not 5.x NULLed the pointer in Free.
56-
Not API.
57-
*/
58-
#define Calloc(n, t) (t *) R_chk_calloc( (R_SIZE_T) (n), sizeof(t) )
59-
#define Realloc(p,n,t) (t *) R_chk_realloc( (void *)(p), (R_SIZE_T)((n) * sizeof(t)) )
60-
#define Free(p) (R_chk_free( (void *)(p) ), (p) = NULL)
61-
#endif
62-
6354
/* API */
6455
#define R_Calloc(n, t) (t *) R_chk_calloc( (R_SIZE_T) (n), sizeof(t) )
6556
#define R_Realloc(p,n,t) (t *) R_chk_realloc( (void *)(p), (R_SIZE_T)((n) * sizeof(t)) )

src/library/tools/src/gramLatex.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
/*
7272
* R : A Computer Language for Statistical Data Analysis
7373
* Copyright (C) 1995, 1996, 1997 Robert Gentleman and Ross Ihaka
74-
* Copyright (C) 1997--2022 The R Core Team
74+
* Copyright (C) 1997--2024 The R Core Team
7575
* Copyright (C) 2010 Duncan Murdoch
7676
*
7777
* This program is free software; you can redistribute it and/or modify
@@ -96,9 +96,6 @@
9696
#define R_USE_SIGNALS 1
9797
#include <Defn.h>
9898
#include <Parse.h>
99-
#ifndef STRICT_R_HEADERS
100-
# define STRICT_R_HEADERS
101-
#endif
10299
#include <R_ext/RS.h> /* for R_chk_* allocation */
103100
#include <ctype.h>
104101
#include <R_ext/Print.h>

src/library/tools/src/gramLatex.y

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
* R : A Computer Language for Statistical Data Analysis
55
* Copyright (C) 1995, 1996, 1997 Robert Gentleman and Ross Ihaka
6-
* Copyright (C) 1997--2022 The R Core Team
6+
* Copyright (C) 1997--2024 The R Core Team
77
* Copyright (C) 2010 Duncan Murdoch
88
*
99
* This program is free software; you can redistribute it and/or modify
@@ -28,9 +28,6 @@
2828
#define R_USE_SIGNALS 1
2929
#include <Defn.h>
3030
#include <Parse.h>
31-
#ifndef STRICT_R_HEADERS
32-
# define STRICT_R_HEADERS
33-
#endif
3431
#include <R_ext/RS.h> /* for R_chk_* allocation */
3532
#include <ctype.h>
3633
#include <R_ext/Print.h>

src/library/tools/src/gramRd.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@
9595
#define R_USE_SIGNALS 1
9696
#include <Defn.h>
9797
#include <Parse.h>
98-
#ifndef STRICT_R_HEADERS
99-
# define STRICT_R_HEADERS
100-
#endif
10198
#include <R_ext/RS.h> /* for R_chk_* allocation */
10299
#include <ctype.h>
103100
#include <Rmath.h> /* for imax2(.),..*/

src/library/tools/src/gramRd.y

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
#define R_USE_SIGNALS 1
2828
#include <Defn.h>
2929
#include <Parse.h>
30-
#ifndef STRICT_R_HEADERS
31-
# define STRICT_R_HEADERS
32-
#endif
3330
#include <R_ext/RS.h> /* for R_chk_* allocation */
3431
#include <ctype.h>
3532
#include <Rmath.h> /* for imax2(.),..*/

0 commit comments

Comments
 (0)