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 -------------- next part -------------- A non-text attachment was scrubbed... Name: Wold2.diff Type: text/x-patch Size: 45059 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20170220/c6aada4f/attachment.bin>