Motivated by the recent R-devel list message with the title
"Registration of native routines", I modified an R package to use
registration of native routines along the lines of the example in
section 5.4.2 of R-exts (development version). Among other compiler
flags, I have '-Wextra' permanently set for installing packages. When
installing the modified package, I got the following warning (tested
with gcc 4.8.4 and 6.3.0):
init.c:10:1: warning: ‘static’ is not at beginning of declaration
[-Wold-style-declaration]
const static R_CallMethodDef R_CallDef[] = {
I believe this is a case of the compiler (with '-Wold-style-declaration'
as part of '-Wextra') adhering to the following section of the C99 (or
C11) standard, see e.g.
<http://www.open-std.org/JTC1/SC22/WG14/www/standards.html>:
6.11 Future language directions
...
6.11.5 Storage-class specifiers
The placement of a storage-class specifier other than at the beginning
of the declaration specifiers in a declaration is an obsolescent
feature.
The attached patch (against SVN revision 72220) is a suggestion of how
to eliminate the sources of such obsolescence warnings from the R source
tree, including the example in the R-exts manual. The patch was
originally made for r72218, and against that version it was tested
successfully on Ubuntu 14.04.5 LTS (gcc 4.8.4) and OS X 10.7.5 (gcc
6.3.0 installed from Homebrew). Revision 72220 failing 'make check'
("Error: testing 'utils' failed") with or without the patch must be
unrelated to the changes made in the patch. The files
"src/library/tools/src/gramLatex.y", "src/library/tools/src/gramRd.y"
and "src/main/gram.y" were processed with 'bison -l -y' (GNU Bison
version 2.7.1, erroneusly reporting the version as 2.7.12-4996) to
create the corresponding .c files.
As the warnings are only given when the user asks for "extra" warnings,
this is obviously non-critical and not urgent, but might be something to
consider.
--
Mikko Korpela
Department of Geosciences and Geography
University of Helsinki
Index: doc/manual/R-exts.texi
===================================================================
--- doc/manual/R-exts.texi (revision 72220)
+++ doc/manual/R-exts.texi (working copy)
@@ -9549,7 +9549,7 @@
#define CALLDEF(name, n) @{#name, (DL_FUNC) &name, n@}
-const static R_CallMethodDef R_CallDef[] = @{
+static const R_CallMethodDef R_CallDef[] = @{
CALLDEF(spline_basis, ?),
CALLDEF(spline_value, ?),
@{NULL, NULL, 0@}
@@ -9751,7 +9751,7 @@
#define CALLDEF(name, n) @{#name, (DL_FUNC) &name, n@}
-const static R_CallMethodDef R_CallDef[] = @{
+static const R_CallMethodDef R_CallDef[] = @{
CALLDEF(spline_basis, 4),
CALLDEF(spline_value, 5),
@{NULL, NULL, 0@}
Index: src/library/grDevices/src/cairo/cairoBM.c
===================================================================
--- src/library/grDevices/src/cairo/cairoBM.c (revision 72220)
+++ src/library/grDevices/src/cairo/cairoBM.c (working copy)
@@ -1,7 +1,7 @@
/*
* R : A Computer Language for Statistical Data Analysis
* Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka
- * Copyright (C) 1997--2015 The R Core Team
+ * Copyright (C) 1997--2017 The R Core Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -449,7 +449,7 @@
return TRUE;
}
-const static struct {
+static const struct {
const char * const name;
X_GTYPE gtype;
} devtable[] = {
Index: src/library/splines/src/splines.c
===================================================================
--- src/library/splines/src/splines.c (revision 72220)
+++ src/library/splines/src/splines.c (working copy)
@@ -234,7 +234,7 @@
#define CALLDEF(name, n) {#name, (DL_FUNC) &name, n}
-const static R_CallMethodDef R_CallDef[] = {
+static const R_CallMethodDef R_CallDef[] = {
CALLDEF(spline_basis, 4),
CALLDEF(spline_value, 5),
{NULL, NULL, 0}
Index: src/library/stats/src/fexact.c
===================================================================
--- src/library/stats/src/fexact.c (revision 72220)
+++ src/library/stats/src/fexact.c (working copy)
@@ -1,6 +1,6 @@
/*
* R : A Computer Language for Statistical Data Analysis
- * Copyright (C) 1999-2010 The R Core Team.
+ * Copyright (C) 1999-2017 The R Core Team.
*
* Based on ACM TOMS643 (1993)
*
@@ -343,7 +343,7 @@
const double amiss = -12345.;
/* TOL is chosen as the square root of the smallest relative spacing. */
- const static double tol = 3.45254e-7;
+ static const double tol = 3.45254e-7;
const char* ch_err_5 =
"The hash table key cannot be computed because the largest key\n"
Index: src/library/tools/src/gramLatex.c
===================================================================
--- src/library/tools/src/gramLatex.c (revision 72220)
+++ src/library/tools/src/gramLatex.c (working copy)
@@ -2371,11 +2371,11 @@
/* Special Symbols */
/* Section and R code headers */
-struct {
+static struct {
char *name;
int token;
}
-static keywords[] = {
+keywords[] = {
/* These sections contain Latex-like text */
{ "\\begin", BEGIN },
Index: src/library/tools/src/gramLatex.y
===================================================================
--- src/library/tools/src/gramLatex.y (revision 72220)
+++ src/library/tools/src/gramLatex.y (working copy)
@@ -562,11 +562,11 @@
/* Special Symbols */
/* Section and R code headers */
-struct {
+static struct {
char *name;
int token;
}
-static keywords[] = {
+keywords[] = {
/* These sections contain Latex-like text */
{ "\\begin", BEGIN },
Index: src/library/tools/src/gramRd.c
===================================================================
--- src/library/tools/src/gramRd.c (revision 72220)
+++ src/library/tools/src/gramRd.c (working copy)
@@ -3613,7 +3613,7 @@
/* Special Symbols */
/* Section and R code headers */
-struct {
+static struct {
char *name;
int token;
}
@@ -3621,7 +3621,7 @@
/* When adding keywords here, make sure all the handlers
are also modified: checkRd, Rd2HTML, Rd2latex, Rd2txt, any other new ones... */
-static keywords[] = {
+keywords[] = {
/* These sections contain Latex-like text */
{ "\\author", SECTIONHEADER },
Index: src/library/tools/src/gramRd.y
===================================================================
--- src/library/tools/src/gramRd.y (revision 72220)
+++ src/library/tools/src/gramRd.y (working copy)
@@ -1008,7 +1008,7 @@
/* Special Symbols */
/* Section and R code headers */
-struct {
+static struct {
char *name;
int token;
}
@@ -1016,7 +1016,7 @@
/* When adding keywords here, make sure all the handlers
are also modified: checkRd, Rd2HTML, Rd2latex, Rd2txt, any other new ones... */
-static keywords[] = {
+keywords[] = {
/* These sections contain Latex-like text */
{ "\\author", SECTIONHEADER },
Index: src/library/utils/src/windows/registry.c
===================================================================
--- src/library/utils/src/windows/registry.c (revision 72220)
+++ src/library/utils/src/windows/registry.c (working copy)
@@ -1,7 +1,7 @@
/*
* R : A Computer Language for Statistical Data Analysis
* file registry.c
- * Copyright (C) 2005--2013 The R Core Team
+ * Copyright (C) 2005--2017 The R Core Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@
#include <windows.h>
-const static struct {
+static const struct {
const char * reg;
HKEY key;
}
Index: src/main/devices.c
===================================================================
--- src/main/devices.c (revision 72220)
+++ src/main/devices.c (working copy)
@@ -46,7 +46,7 @@
return &(bss->dp);
}
-static SEXP R_INLINE getSymbolValue(SEXP symbol)
+static R_INLINE SEXP getSymbolValue(SEXP symbol)
{
if (TYPEOF(symbol) != SYMSXP)
error("argument to 'getSymbolValue' is not a symbol");
Index: src/main/eval.c
===================================================================
--- src/main/eval.c (revision 72220)
+++ src/main/eval.c (working copy)
@@ -4542,8 +4542,8 @@
/* Declare opinfo volatile to prevent gcc 6 from making a local copy
in bcEval stack frames and thus increasing stack usage
dramatically */
-volatile
-static struct { void *addr; int argc; char *instname; } opinfo[OPCOUNT];
+static volatile struct { void *addr; int argc; char *instname; }
+ opinfo[OPCOUNT];
#define OP(name,n) \
case name##_OP: opinfo[name##_OP].addr = (__extension__ &&op_##name); \
Index: src/main/gram.c
===================================================================
--- src/main/gram.c (revision 72220)
+++ src/main/gram.c (working copy)
@@ -4029,11 +4029,11 @@
/* Special Symbols */
/* Syntactic Keywords + Symbolic Constants */
-struct {
+static struct {
char *name;
int token;
}
-static keywords[] = {
+keywords[] = {
{ "NULL", NULL_CONST },
{ "NA", NUM_CONST },
{ "TRUE", NUM_CONST },
Index: src/main/gram.y
===================================================================
--- src/main/gram.y (revision 72220)
+++ src/main/gram.y (working copy)
@@ -1691,11 +1691,11 @@
/* Special Symbols */
/* Syntactic Keywords + Symbolic Constants */
-struct {
+static struct {
char *name;
int token;
}
-static keywords[] = {
+keywords[] = {
{ "NULL", NULL_CONST },
{ "NA", NUM_CONST },
{ "TRUE", NUM_CONST },
Index: src/main/platform.c
===================================================================
--- src/main/platform.c (revision 72220)
+++ src/main/platform.c (working copy)
@@ -203,7 +203,7 @@
#ifdef HAVE_LANGINFO_CODESET
/* case-insensitive string comparison (needed for locale check) */
-int static R_strieql(const char *a, const char *b)
+static int R_strieql(const char *a, const char *b)
{
while (*a && *b && toupper(*a) == toupper(*b)) { a++; b++; }
return (*a == 0 && *b == 0);
Index: src/main/util.c
===================================================================
--- src/main/util.c (revision 72220)
+++ src/main/util.c (working copy)
@@ -107,7 +107,7 @@
}
#ifdef UNUSED
-const static char type_msg[] = "invalid type passed to internal function\n";
+static const char type_msg[] = "invalid type passed to internal function\n";
void internalTypeCheck(SEXP call, SEXP s, SEXPTYPE type)
{
@@ -120,7 +120,7 @@
}
#endif
-const static char * const truenames[] = {
+static const char * const truenames[] = {
"T",
"True",
"TRUE",
@@ -128,7 +128,7 @@
(char *) NULL,
};
-const static char * const falsenames[] = {
+static const char * const falsenames[] = {
"F",
"False",
"FALSE",
@@ -191,7 +191,7 @@
}
-const static struct {
+static const struct {
const char * const str;
const int type;
}
@@ -730,7 +730,7 @@
# include <windows.h>
#endif
-SEXP static intern_getwd(void)
+static SEXP intern_getwd(void)
{
SEXP rval = R_NilValue;
char buf[4*PATH_MAX+1];
Index: src/nmath/bessel_i.c
===================================================================
--- src/nmath/bessel_i.c (revision 72220)
+++ src/nmath/bessel_i.c (working copy)
@@ -1,6 +1,6 @@
/*
* Mathlib : A C Library of Special Functions
- * Copyright (C) 1998-2014 Ross Ihaka and the R Core team.
+ * Copyright (C) 1998-2017 Ross Ihaka and the R Core team.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -226,7 +226,7 @@
/*-------------------------------------------------------------------
Mathematical constants
-------------------------------------------------------------------*/
- const static double const__ = 1.585;
+ static const double const__ = 1.585;
/* Local variables */
int nend, intx, nbmx, k, l, n, nstart;
Index: src/nmath/bessel_j.c
===================================================================
--- src/nmath/bessel_j.c (revision 72220)
+++ src/nmath/bessel_j.c (working copy)
@@ -1,6 +1,6 @@
/*
* Mathlib : A C Library of Special Functions
- * Copyright (C) 1998-2015 Ross Ihaka and the R Core team.
+ * Copyright (C) 1998-2017 Ross Ihaka and the R Core team.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -216,14 +216,14 @@
TWOPI2 = (2*PI - TWOPI1) to working precision, i.e.,
TWOPI1 + TWOPI2 = 2 * PI to extra precision.
--------------------------------------------------------------------- */
- const static double pi2 = .636619772367581343075535;
- const static double twopi1 = 6.28125;
- const static double twopi2 = .001935307179586476925286767;
+ static const double pi2 = .636619772367581343075535;
+ static const double twopi1 = 6.28125;
+ static const double twopi2 = .001935307179586476925286767;
/*---------------------------------------------------------------------
* Factorial(N)
*--------------------------------------------------------------------- */
- const static double fact[25] = { 1.,1.,2.,6.,24.,120.,720.,5040.,40320.,
+ static const double fact[25] = { 1.,1.,2.,6.,24.,120.,720.,5040.,40320.,
362880.,3628800.,39916800.,479001600.,6227020800.,87178291200.,
1.307674368e12,2.0922789888e13,3.55687428096e14,6.402373705728e15,
1.21645100408832e17,2.43290200817664e18,5.109094217170944e19,
Index: src/nmath/bessel_k.c
===================================================================
--- src/nmath/bessel_k.c (revision 72220)
+++ src/nmath/bessel_k.c (working copy)
@@ -1,6 +1,6 @@
/*
* Mathlib : A C Library of Special Functions
- * Copyright (C) 1998-2014 Ross Ihaka and the R Core team.
+ * Copyright (C) 1998-2017 Ross Ihaka and the R Core team.
* Copyright (C) 2002-3 The R Foundation
*
* This program is free software; you can redistribute it and/or modify
@@ -211,32 +211,32 @@
* A = LOG(2) - Euler's constant
* D = SQRT(2/PI)
---------------------------------------------------------------------*/
- const static double a = .11593151565841244881;
+ static const double a = .11593151565841244881;
/*---------------------------------------------------------------------
P, Q - Approximation for LOG(GAMMA(1+ALPHA))/ALPHA + Euler's constant
Coefficients converted from hex to decimal and modified
by W. J. Cody, 2/26/82 */
- const static double p[8] = { .805629875690432845,20.4045500205365151,
+ static const double p[8] = { .805629875690432845,20.4045500205365151,
157.705605106676174,536.671116469207504,900.382759291288778,
730.923886650660393,229.299301509425145,.822467033424113231 };
- const static double q[7] = { 29.4601986247850434,277.577868510221208,
+ static const double q[7] = { 29.4601986247850434,277.577868510221208,
1206.70325591027438,2762.91444159791519,3443.74050506564618,
2210.63190113378647,572.267338359892221 };
/* R, S - Approximation for (1-ALPHA*PI/SIN(ALPHA*PI))/(2.D0*ALPHA) */
- const static double r[5] = { -.48672575865218401848,13.079485869097804016,
+ static const double r[5] = { -.48672575865218401848,13.079485869097804016,
-101.96490580880537526,347.65409106507813131,
3.495898124521934782e-4 };
- const static double s[4] = { -25.579105509976461286,212.57260432226544008,
+ static const double s[4] = { -25.579105509976461286,212.57260432226544008,
-610.69018684944109624,422.69668805777760407 };
/* T - Approximation for SINH(Y)/Y */
- const static double t[6] = { 1.6125990452916363814e-10,
+ static const double t[6] = { 1.6125990452916363814e-10,
2.5051878502858255354e-8,2.7557319615147964774e-6,
1.9841269840928373686e-4,.0083333333333334751799,
.16666666666666666446 };
/*---------------------------------------------------------------------*/
- const static double estm[6] = { 52.0583,5.7607,2.7782,14.4303,185.3004, 9.3715 };
- const static double estf[7] = { 41.8341,7.1075,6.4306,42.511,1.35633,84.5096,20.};
+ static const double estm[6] = { 52.0583,5.7607,2.7782,14.4303,185.3004, 9.3715 };
+ static const double estf[7] = { 41.8341,7.1075,6.4306,42.511,1.35633,84.5096,20.};
/* Local variables */
int iend, i, j, k, m, ii, mplus1;
Index: src/nmath/bessel_y.c
===================================================================
--- src/nmath/bessel_y.c (revision 72220)
+++ src/nmath/bessel_y.c (working copy)
@@ -1,6 +1,6 @@
/*
* Mathlib : A C Library of Special Functions
- * Copyright (C) 1998-2015 Ross Ihaka and the R Core team.
+ * Copyright (C) 1998-2017 Ross Ihaka and the R Core team.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -231,14 +231,14 @@
FIVPI = 5*PI
PIM5 = 5*PI - 15
----------------------------------------------------------------------*/
- const static double fivpi = 15.707963267948966192;
- const static double pim5 = .70796326794896619231;
+ static const double fivpi = 15.707963267948966192;
+ static const double pim5 = .70796326794896619231;
/*----------------------------------------------------------------------
Coefficients for Chebyshev polynomial expansion of
1/gamma(1-x), abs(x) <= .5
----------------------------------------------------------------------*/
- const static double ch[21] = { -6.7735241822398840964e-24,
+ static const double ch[21] = { -6.7735241822398840964e-24,
-6.1455180116049879894e-23,2.9017595056104745456e-21,
1.3639417919073099464e-19,2.3826220476859635824e-18,
-9.0642907957550702534e-18,-1.4943667065169001769e-15,
Index: src/nmath/dnbeta.c
===================================================================
--- src/nmath/dnbeta.c (revision 72220)
+++ src/nmath/dnbeta.c (working copy)
@@ -1,7 +1,7 @@
/*
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998 Ross Ihaka
- * Copyright (C) 2000-12 The R Core Team
+ * Copyright (C) 2000-17 The R Core Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -54,7 +54,7 @@
double dnbeta(double x, double a, double b, double ncp, int give_log)
{
- const static double eps = 1.e-15;
+ static const double eps = 1.e-15;
int kMax;
double k, ncp2, dx2, d, D;
Index: src/nmath/dnchisq.c
===================================================================
--- src/nmath/dnchisq.c (revision 72220)
+++ src/nmath/dnchisq.c (working copy)
@@ -1,7 +1,7 @@
/*
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998 Ross Ihaka
- * Copyright (C) 2000-15 The R Core Team
+ * Copyright (C) 2000-17 The R Core Team
* Copyright (C) 2004-15 The R Foundation
*
* This program is free software; you can redistribute it and/or modify
@@ -29,7 +29,7 @@
double dnchisq(double x, double df, double ncp, int give_log)
{
- const static double eps = 5e-15;
+ static const double eps = 5e-15;
double i, ncp2, q, mid, dfmid, imax;
LDOUBLE sum, term;
Index: src/nmath/fprec.c
===================================================================
--- src/nmath/fprec.c (revision 72220)
+++ src/nmath/fprec.c (working copy)
@@ -1,7 +1,7 @@
/*
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998 Ross Ihaka
- * Copyright (C) 2000-2014 The R Core Team
+ * Copyright (C) 2000-2017 The R Core Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -71,7 +71,7 @@
double l10, pow10, sgn, p10, P10;
int e10, e2, do_round, dig;
/* Max.expon. of 10 (=308.2547) */
- const static int max10e = (int) (DBL_MAX_EXP * M_LOG10_2);
+ static const int max10e = (int) (DBL_MAX_EXP * M_LOG10_2);
if (ISNAN(x) || ISNAN(digits))
return x + digits;
Index: src/nmath/gamma.c
===================================================================
--- src/nmath/gamma.c (revision 72220)
+++ src/nmath/gamma.c (working copy)
@@ -1,7 +1,7 @@
/*
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998 Ross Ihaka
- * Copyright (C) 2000-2013 The R Core Team
+ * Copyright (C) 2000-2017 The R Core Team
* Copyright (C) 2002-2004 The R Foundation
*
* This program is free software; you can redistribute it and/or modify
@@ -44,7 +44,7 @@
double gammafn(double x)
{
- const static double gamcs[42] = {
+ static const double gamcs[42] = {
+.8571195590989331421920062399942e-2,
+.4415381324841006757191315771652e-2,
+.5685043681599363378632664588789e-1,
Index: src/nmath/gamma_cody.c
===================================================================
--- src/nmath/gamma_cody.c (revision 72220)
+++ src/nmath/gamma_cody.c (working copy)
@@ -55,7 +55,7 @@
/* ----------------------------------------------------------------------
Mathematical constants
----------------------------------------------------------------------*/
- const static double sqrtpi = .9189385332046727417803297; /* == ??? */
+ static const double sqrtpi = .9189385332046727417803297; /* == ??? */
/* *******************************************************************
@@ -108,7 +108,7 @@
*/
- const static double xbig = 171.624;
+ static const double xbig = 171.624;
/* ML_POSINF == const double xinf = 1.79e308;*/
/* DBL_EPSILON = const double eps = 2.22e-16;*/
/* DBL_MIN == const double xminin = 2.23e-308;*/
@@ -117,13 +117,13 @@
Numerator and denominator coefficients for rational minimax
approximation over (1,2).
----------------------------------------------------------------------*/
- const static double p[8] = {
+ static const double p[8] = {
-1.71618513886549492533811,
24.7656508055759199108314,-379.804256470945635097577,
629.331155312818442661052,866.966202790413211295064,
-31451.2729688483675254357,-36144.4134186911729807069,
66456.1438202405440627855 };
- const static double q[8] = {
+ static const double q[8] = {
-30.8402300119738975254353,
315.350626979604161529144,-1015.15636749021914166146,
-3107.77167157231109440444,22538.1184209801510330112,
@@ -132,7 +132,7 @@
/*----------------------------------------------------------------------
Coefficients for minimax approximation over (12, INF).
----------------------------------------------------------------------*/
- const static double c[7] = {
+ static const double c[7] = {
-.001910444077728,8.4171387781295e-4,
-5.952379913043012e-4,7.93650793500350248e-4,
-.002777777777777681622553,.08333333333333333331554247,
Index: src/nmath/lgammacor.c
===================================================================
--- src/nmath/lgammacor.c (revision 72220)
+++ src/nmath/lgammacor.c (working copy)
@@ -1,7 +1,7 @@
/*
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998 Ross Ihaka
- * Copyright (C) 2000-2001 The R Core Team
+ * Copyright (C) 2000-2017 The R Core Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@
double attribute_hidden lgammacor(double x)
{
- const static double algmcs[15] = {
+ static const double algmcs[15] = {
+.1666389480451863247205729650822e+0,
-.1384948176067563840732986059135e-4,
+.9810825646924729426157171547487e-8,
Index: src/nmath/log1p.c
===================================================================
--- src/nmath/log1p.c (revision 72220)
+++ src/nmath/log1p.c (working copy)
@@ -1,7 +1,7 @@
/*
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998 Ross Ihaka
- * Copyright (C) 2000, 2003, 2011 The R Core Team
+ * Copyright (C) 2000, 2003, 2011, 2017 The R Core Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -55,7 +55,7 @@
* significant figures required 30.93
* decimal places required 32.01
*/
- const static double alnrcs[43] = {
+ static const double alnrcs[43] = {
+.10378693562743769800686267719098e+1,
-.13364301504908918098766041553133e+0,
+.19408249135520563357926199374750e-1,
@@ -110,7 +110,7 @@
nlnrel = chebyshev_init(alnrcs, 43, DBL_EPSILON/20);/*was .1*d1mach(3)*/
#else
# define nlnrel 22
- const static double xmin = -0.999999985;
+ static const double xmin = -0.999999985;
/* 22: for IEEE double precision where DBL_EPSILON = 2.22044604925031e-16 */
#endif
Index: src/nmath/pnbeta.c
===================================================================
--- src/nmath/pnbeta.c (revision 72220)
+++ src/nmath/pnbeta.c (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2013 The R Core Team
+ * Copyright (C) 2000-2017 The R Core Team
*
* Algorithm AS 226 Appl. Statist. (1987) Vol. 36, No. 2
* by Russell V. Lenth
@@ -26,7 +26,7 @@
/* change errmax and itrmax if desired;
* original (AS 226, R84) had (errmax; itrmax) = (1e-6; 100) */
- const static double errmax = 1.0e-9;
+ static const double errmax = 1.0e-9;
const int itrmax = 10000; /* 100 is not enough for pf(ncp=200)
see PR#11277 */
Index: src/nmath/pnorm.c
===================================================================
--- src/nmath/pnorm.c (revision 72220)
+++ src/nmath/pnorm.c (working copy)
@@ -1,7 +1,7 @@
/*
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998 Ross Ihaka
- * Copyright (C) 2000-2013 The R Core Team
+ * Copyright (C) 2000-2017 The R Core Team
* Copyright (C) 2003 The R Foundation
*
* This program is free software; you can redistribute it and/or modify
@@ -94,7 +94,7 @@
if(lower) return *cum := P[X <= x]
if(upper) return *ccum := P[X > x] = 1 - P[X <= x]
*/
- const static double a[5] = {
+ static const double a[5] = {
2.2352520354606839287,
161.02823106855587881,
1067.6894854603709582,
@@ -101,13 +101,13 @@
18154.981253343561249,
0.065682337918207449113
};
- const static double b[4] = {
+ static const double b[4] = {
47.20258190468824187,
976.09855173777669322,
10260.932208618978205,
45507.789335026729956
};
- const static double c[9] = {
+ static const double c[9] = {
0.39894151208813466764,
8.8831497943883759412,
93.506656132177855979,
@@ -118,7 +118,7 @@
9842.7148383839780218,
1.0765576773720192317e-8
};
- const static double d[8] = {
+ static const double d[8] = {
22.266688044328115691,
235.38790178262499861,
1519.377599407554805,
@@ -128,7 +128,7 @@
38912.003286093271411,
19685.429676859990727
};
- const static double p[6] = {
+ static const double p[6] = {
0.21589853405795699,
0.1274011611602473639,
0.022235277870649807,
@@ -136,7 +136,7 @@
2.9112874951168792e-5,
0.02307344176494017303
};
- const static double q[5] = {
+ static const double q[5] = {
1.28426009614491121,
0.468238212480865118,
0.0659881378689285515,
Index: src/nmath/pnt.c
===================================================================
--- src/nmath/pnt.c (revision 72220)
+++ src/nmath/pnt.c (working copy)
@@ -1,6 +1,6 @@
/*
* Mathlib : A C Library of Special Functions
- * Copyright (C) 1998-2015 The R Core Team
+ * Copyright (C) 1998-2017 The R Core Team
* based on AS243 (C) 1989 Royal Statistical Society
*
* This program is free software; you can redistribute it and/or modify
@@ -59,7 +59,7 @@
/* note - itrmax and errmax may be changed to suit one's needs. */
const int itrmax = 1000;
- const static double errmax = 1.e-12;
+ static const double errmax = 1.e-12;
if (df <= 0.0) ML_ERR_return_NAN;
if(ncp == 0.0) return pt(t, df, lower_tail, log_p);
Index: src/nmath/polygamma.c
===================================================================
--- src/nmath/polygamma.c (revision 72220)
+++ src/nmath/polygamma.c (working copy)
@@ -1,7 +1,7 @@
/*
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998 Ross Ihaka
- * Copyright (C) 2000-2015 The R Core Team
+ * Copyright (C) 2000-2017 The R Core Team
* Copyright (C) 2004-2009 The R Foundation
*
* This program is free software; you can redistribute it and/or modify
@@ -148,7 +148,7 @@
/* From R, currently only used for kode = 1, m = 1 : */
void dpsifn(double x, int n, int kode, int m, double *ans, int *nz, int *ierr)
{
- const static double bvalues[] = { /* Bernoulli Numbers */
+ static const double bvalues[] = { /* Bernoulli Numbers */
1.00000000000000000e+00,
-5.00000000000000000e-01,
1.66666666666666667e-01,
Index: src/nmath/ptukey.c
===================================================================
--- src/nmath/ptukey.c (revision 72220)
+++ src/nmath/ptukey.c (working copy)
@@ -1,7 +1,7 @@
/*
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998 Ross Ihaka
- * Copyright (C) 2000--2007 The R Core Team
+ * Copyright (C) 2000--2017 The R Core Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -79,14 +79,14 @@
(see how C1-C3 are used) <MM>
*/
/* const double iMax = 1.; not used if = 1*/
- const static double C1 = -30.;
- const static double C2 = -50.;
- const static double C3 = 60.;
- const static double bb = 8.;
- const static double wlar = 3.;
- const static double wincr1 = 2.;
- const static double wincr2 = 3.;
- const static double xleg[ihalf] = {
+ static const double C1 = -30.;
+ static const double C2 = -50.;
+ static const double C3 = 60.;
+ static const double bb = 8.;
+ static const double wlar = 3.;
+ static const double wincr1 = 2.;
+ static const double wincr2 = 3.;
+ static const double xleg[ihalf] = {
0.981560634246719250690549090149,
0.904117256370474856678465866119,
0.769902674194304687036893833213,
@@ -94,7 +94,7 @@
0.367831498998180193752691536644,
0.125233408511468915472441369464
};
- const static double aleg[ihalf] = {
+ static const double aleg[ihalf] = {
0.047175336386511827194615961485,
0.106939325995318430960254718194,
0.160078328543346226334652529543,
@@ -274,17 +274,17 @@
#define ihalfq 8
/* const double eps = 1.0; not used if = 1 */
- const static double eps1 = -30.0;
- const static double eps2 = 1.0e-14;
- const static double dhaf = 100.0;
- const static double dquar = 800.0;
- const static double deigh = 5000.0;
- const static double dlarg = 25000.0;
- const static double ulen1 = 1.0;
- const static double ulen2 = 0.5;
- const static double ulen3 = 0.25;
- const static double ulen4 = 0.125;
- const static double xlegq[ihalfq] = {
+ static const double eps1 = -30.0;
+ static const double eps2 = 1.0e-14;
+ static const double dhaf = 100.0;
+ static const double dquar = 800.0;
+ static const double deigh = 5000.0;
+ static const double dlarg = 25000.0;
+ static const double ulen1 = 1.0;
+ static const double ulen2 = 0.5;
+ static const double ulen3 = 0.25;
+ static const double ulen4 = 0.125;
+ static const double xlegq[ihalfq] = {
0.989400934991649932596154173450,
0.944575023073232576077988415535,
0.865631202387831743880467897712,
@@ -294,7 +294,7 @@
0.281603550779258913230460501460,
0.950125098376374401853193354250e-1
};
- const static double alegq[ihalfq] = {
+ static const double alegq[ihalfq] = {
0.271524594117540948517805724560e-1,
0.622535239386478928628438369944e-1,
0.951585116824927848099251076022e-1,
Index: src/nmath/qgamma.c
===================================================================
--- src/nmath/qgamma.c (revision 72220)
+++ src/nmath/qgamma.c (working copy)
@@ -1,7 +1,7 @@
/*
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998 Ross Ihaka
- * Copyright (C) 2000--2015 The R Core Team
+ * Copyright (C) 2000--2017 The R Core Team
* Copyright (C) 2004--2015 The R Foundation
* based on AS 91 (C) 1979 Royal Statistical Society
*
@@ -126,7 +126,7 @@
#define pMIN 1e-100 /* was 0.000002 = 2e-6 */
#define pMAX (1-1e-14)/* was (1-1e-12) and 0.999998 = 1 - 2e-6 */
- const static double
+ static const double
i420 = 1./ 420.,
i2520 = 1./ 2520.,
i5040 = 1./ 5040;
Index: src/nmath/qnbeta.c
===================================================================
--- src/nmath/qnbeta.c (revision 72220)
+++ src/nmath/qnbeta.c (working copy)
@@ -1,6 +1,6 @@
/*
* R : A Computer Language for Statistical Data Analysis
- * Copyright (C) 2006 The R Core Team
+ * Copyright (C) 2006-2017 The R Core Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,8 +23,8 @@
double qnbeta(double p, double a, double b, double ncp,
int lower_tail, int log_p)
{
- const static double accu = 1e-15;
- const static double Eps = 1e-14; /* must be > accu */
+ static const double accu = 1e-15;
+ static const double Eps = 1e-14; /* must be > accu */
double ux, lx, nx, pp;
Index: src/nmath/qnchisq.c
===================================================================
--- src/nmath/qnchisq.c (revision 72220)
+++ src/nmath/qnchisq.c (working copy)
@@ -1,7 +1,7 @@
/*
* R : A Computer Language for Statistical Data Analysis
* Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka
- * Copyright (C) 2000-2008 The R Core Team
+ * Copyright (C) 2000-2017 The R Core Team
* Copyright (C) 2004 The R Foundation
*
* This program is free software; you can redistribute it and/or modify
@@ -24,11 +24,11 @@
double qnchisq(double p, double df, double ncp, int lower_tail, int log_p)
{
- const static double accu = 1e-13;
- const static double racc = 4*DBL_EPSILON;
+ static const double accu = 1e-13;
+ static const double racc = 4*DBL_EPSILON;
/* these two are for the "search" loops, can have less accuracy: */
- const static double Eps = 1e-11; /* must be > accu */
- const static double rEps= 1e-10; /* relative tolerance ... */
+ static const double Eps = 1e-11; /* must be > accu */
+ static const double rEps= 1e-10; /* relative tolerance ... */
double ux, lx, ux0, nx, pp;
Index: src/nmath/qnt.c
===================================================================
--- src/nmath/qnt.c (revision 72220)
+++ src/nmath/qnt.c (working copy)
@@ -1,6 +1,6 @@
/*
* R : A Computer Language for Statistical Data Analysis
- * Copyright (C) 2006-2015 The R Core Team
+ * Copyright (C) 2006-2017 The R Core Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,8 +22,8 @@
double qnt(double p, double df, double ncp, int lower_tail, int log_p)
{
- const static double accu = 1e-13;
- const static double Eps = 1e-11; /* must be > accu */
+ static const double accu = 1e-13;
+ static const double Eps = 1e-11; /* must be > accu */
double ux, lx, nx, pp;
Index: src/nmath/qt.c
===================================================================
--- src/nmath/qt.c (revision 72220)
+++ src/nmath/qt.c (working copy)
@@ -1,7 +1,7 @@
/*
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998 Ross Ihaka
- * Copyright (C) 2000-2013 The R Core Team
+ * Copyright (C) 2000-2017 The R Core Team
* Copyright (C) 2003-2013 The R Foundation
*
* This program is free software; you can redistribute it and/or modify
@@ -43,7 +43,7 @@
double qt(double p, double ndf, int lower_tail, int log_p)
{
- const static double eps = 1.e-12;
+ static const double eps = 1.e-12;
double P, q;
@@ -57,8 +57,8 @@
if (ndf <= 0) ML_ERR_return_NAN;
if (ndf < 1) { /* based on qnt */
- const static double accu = 1e-13;
- const static double Eps = 1e-11; /* must be > accu */
+ static const double accu = 1e-13;
+ static const double Eps = 1e-11; /* must be > accu */
double ux, lx, nx, pp;
Index: src/nmath/qtukey.c
===================================================================
--- src/nmath/qtukey.c (revision 72220)
+++ src/nmath/qtukey.c (working copy)
@@ -1,7 +1,7 @@
/*
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998 Ross Ihaka
- * Copyright (C) 2000--2005 The R Core Team
+ * Copyright (C) 2000--2017 The R Core Team
* based in part on AS70 (C) 1974 Royal Statistical Society
*
* This program is free software; you can redistribute it and/or modify
@@ -61,22 +61,22 @@
static double qinv(double p, double c, double v)
{
- const static double p0 = 0.322232421088;
- const static double q0 = 0.993484626060e-01;
- const static double p1 = -1.0;
- const static double q1 = 0.588581570495;
- const static double p2 = -0.342242088547;
- const static double q2 = 0.531103462366;
- const static double p3 = -0.204231210125;
- const static double q3 = 0.103537752850;
- const static double p4 = -0.453642210148e-04;
- const static double q4 = 0.38560700634e-02;
- const static double c1 = 0.8832;
- const static double c2 = 0.2368;
- const static double c3 = 1.214;
- const static double c4 = 1.208;
- const static double c5 = 1.4142;
- const static double vmax = 120.0;
+ static const double p0 = 0.322232421088;
+ static const double q0 = 0.993484626060e-01;
+ static const double p1 = -1.0;
+ static const double q1 = 0.588581570495;
+ static const double p2 = -0.342242088547;
+ static const double q2 = 0.531103462366;
+ static const double p3 = -0.204231210125;
+ static const double q3 = 0.103537752850;
+ static const double p4 = -0.453642210148e-04;
+ static const double q4 = 0.38560700634e-02;
+ static const double c1 = 0.8832;
+ static const double c2 = 0.2368;
+ static const double c3 = 1.214;
+ static const double c4 = 1.208;
+ static const double c5 = 1.4142;
+ static const double vmax = 120.0;
double ps, q, t, yi;
@@ -119,7 +119,7 @@
double qtukey(double p, double rr, double cc, double df,
int lower_tail, int log_p)
{
- const static double eps = 0.0001;
+ static const double eps = 0.0001;
const int maxiter = 50;
double ans = 0.0, valx0, valx1, x0, x1, xabs;
Index: src/nmath/rgamma.c
===================================================================
--- src/nmath/rgamma.c (revision 72220)
+++ src/nmath/rgamma.c (working copy)
@@ -1,7 +1,7 @@
/*
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998 Ross Ihaka
- * Copyright (C) 2000--2016 The R Core Team
+ * Copyright (C) 2000--2017 The R Core Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -55,28 +55,28 @@
double rgamma(double a, double scale)
{
/* Constants : */
- const static double sqrt32 = 5.656854;
- const static double exp_m1 = 0.36787944117144232159;/* exp(-1) = 1/e */
+ static const double sqrt32 = 5.656854;
+ static const double exp_m1 = 0.36787944117144232159;/* exp(-1) = 1/e */
/* Coefficients q[k] - for q0 = sum(q[k]*a^(-k))
* Coefficients a[k] - for q = q0+(t*t/2)*sum(a[k]*v^k)
* Coefficients e[k] - for exp(q)-1 = sum(e[k]*q^k)
*/
- const static double q1 = 0.04166669;
- const static double q2 = 0.02083148;
- const static double q3 = 0.00801191;
- const static double q4 = 0.00144121;
- const static double q5 = -7.388e-5;
- const static double q6 = 2.4511e-4;
- const static double q7 = 2.424e-4;
+ static const double q1 = 0.04166669;
+ static const double q2 = 0.02083148;
+ static const double q3 = 0.00801191;
+ static const double q4 = 0.00144121;
+ static const double q5 = -7.388e-5;
+ static const double q6 = 2.4511e-4;
+ static const double q7 = 2.424e-4;
- const static double a1 = 0.3333333;
- const static double a2 = -0.250003;
- const static double a3 = 0.2000062;
- const static double a4 = -0.1662921;
- const static double a5 = 0.1423657;
- const static double a6 = -0.1367177;
- const static double a7 = 0.1233795;
+ static const double a1 = 0.3333333;
+ static const double a2 = -0.250003;
+ static const double a3 = 0.2000062;
+ static const double a4 = -0.1662921;
+ static const double a5 = 0.1423657;
+ static const double a6 = -0.1367177;
+ static const double a7 = 0.1233795;
/* State variables [FIXME for threading!] :*/
static double aa = 0.;
Index: src/nmath/rhyper.c
===================================================================
--- src/nmath/rhyper.c (revision 72220)
+++ src/nmath/rhyper.c (working copy)
@@ -1,7 +1,7 @@
/*
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998 Ross Ihaka
- * Copyright (C) 2000-2015 The R Core Team
+ * Copyright (C) 2000-2017 The R Core Team
* Copyright (C) 2005-2015 The R Foundation
*
* This program is free software; you can redistribute it and/or modify
@@ -49,7 +49,7 @@
static double afc(int i)
{
// If (i > 7), use Stirling's approximation, otherwise use table lookup.
- const static double al[8] =
+ static const double al[8] =
{
0.0,/*ln(0!)=ln(1)*/
0.0,/*ln(1!)=ln(1)*/
@@ -172,8 +172,8 @@
goto L_finis; // return appropriate variate
} else if (m - minjx < 10) { // II: (Scaled) algorithm HIN (inverse transformation) ----
- const static double scale = 1e25; // scaling factor against (early) underflow
- const static double con = 57.5646273248511421;
+ static const double scale = 1e25; // scaling factor against (early) underflow
+ static const double con = 57.5646273248511421;
// 25*log(10) = log(scale) { <==> exp(con) == scale }
if (setup1 || setup2) {
double lw; // log(w); w = exp(lw) * scale = exp(lw + log(scale)) = exp(lw + con)
@@ -290,8 +290,8 @@
}
} else {
- const static double deltal = 0.0078;
- const static double deltau = 0.0034;
+ static const double deltal = 0.0078;
+ static const double deltau = 0.0034;
double e, g, r, t, y;
double de, dg, dr, ds, dt, gl, gu, nk, nm, ub;
Index: src/nmath/rpois.c
===================================================================
--- src/nmath/rpois.c (revision 72220)
+++ src/nmath/rpois.c (working copy)
@@ -1,7 +1,7 @@
/*
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998 Ross Ihaka
- * Copyright (C) 2000-2011 The R Core Team
+ * Copyright (C) 2000-2017 The R Core Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -54,7 +54,7 @@
double rpois(double mu)
{
/* Factorial Table (0:9)! */
- const static double fact[10] =
+ static const double fact[10] =
{
1., 1., 2., 6., 24., 120., 720., 5040., 40320., 362880.
};
Index: src/nmath/sexp.c
===================================================================
--- src/nmath/sexp.c (revision 72220)
+++ src/nmath/sexp.c (working copy)
@@ -1,7 +1,7 @@
/*
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998 Ross Ihaka
- * Copyright (C) 2000-2002 the R Core Team
+ * Copyright (C) 2000-2017 the R Core Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@
/* q[k-1] = sum(log(2)^k / k!) k=1,..,n, */
/* The highest n (here 16) is determined by q[n-1] = 1.0 */
/* within standard precision */
- const static double q[] =
+ static const double q[] =
{
0.6931471805599453,
0.9333736875190459,
Index: src/nmath/snorm.c
===================================================================
--- src/nmath/snorm.c (revision 72220)
+++ src/nmath/snorm.c (working copy)
@@ -1,7 +1,7 @@
/*
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998 Ross Ihaka
- * Copyright (C) 2000-9 The R Core Team
+ * Copyright (C) 2000-2017 The R Core Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -62,7 +62,7 @@
double norm_rand(void)
{
- const static double a[32] =
+ static const double a[32] =
{
0.0000000, 0.03917609, 0.07841241, 0.1177699,
0.1573107, 0.19709910, 0.23720210, 0.2776904,
@@ -74,7 +74,7 @@
1.5341210, 1.67594000, 1.86273200, 2.1538750
};
- const static double d[31] =
+ static const double d[31] =
{
0.0000000, 0.0000000, 0.0000000, 0.0000000,
0.0000000, 0.2636843, 0.2425085, 0.2255674,
@@ -86,7 +86,7 @@
0.1134023, 0.1114027, 0.1095039
};
- const static double t[31] =
+ static const double t[31] =
{
7.673828e-4, 0.002306870, 0.003860618, 0.005438454,
0.007050699, 0.008708396, 0.010423570, 0.012209530,
@@ -98,7 +98,7 @@
0.227624100, 0.330498000, 0.584703100
};
- const static double h[31] =
+ static const double h[31] =
{
0.03920617, 0.03932705, 0.03950999, 0.03975703,
0.04007093, 0.04045533, 0.04091481, 0.04145507,
@@ -123,7 +123,7 @@
#define C2 0.180025191068563
#define g(x) (C1*exp(-x*x/2.0)-C2*(A-x))
- const static double A = 2.216035867166471;
+ static const double A = 2.216035867166471;
double s, u1, w, y, u2, u3, aa, tt, theta, R;
int i;
Index: src/nmath/stirlerr.c
===================================================================
--- src/nmath/stirlerr.c (revision 72220)
+++ src/nmath/stirlerr.c (working copy)
@@ -4,7 +4,7 @@
* October 23, 2000.
*
* Merge in to R:
- * Copyright (C) 2000, The R Core Team
+ * Copyright (C) 2000, 2017, The R Core Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@
* write lgamma!)
*
* Merge in to R:
- * Copyright (C) 2000, The R Core Team
+ * Copyright (C) 2000, 2017, The R Core Team
* R has lgammafn, and lgamma is not part of ISO C
*/
@@ -55,7 +55,7 @@
/*
error for 0, 0.5, 1.0, 1.5, ..., 14.5, 15.0.
*/
- const static double sferr_halves[31] = {
+ static const double sferr_halves[31] = {
0.0, /* n=0 - wrong, place holder only */
0.1534264097200273452913848, /* 0.5 */
0.0810614667953272582196702, /* 1.0 */
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel