Skip to content

[patch] Eliminate warnings from gcc -Wold-style-declaration

1 message · Mikko Korpela

#
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):
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>:
...
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.