[R-pkg-devel] R CMD check warning about .inc files.

Gábor Csárdi csardi.gabor at gmail.com
Thu Mar 16 22:31:26 CET 2017


I different extension is fine I think. I use .pmt (poor man's
templates) for something very similar.

Gabor

On Thu, Mar 16, 2017 at 9:11 PM, Pavel Krivitsky <pavel at uow.edu.au> wrote:
> Dear All,
>
> Since some C header files in a package I maintain have identical macro
> definitions (which have a different meanings, since other macro
> definitions differ), I tried to reduce code duplication to split the
> common macros into their own files, which don't get #included directly
> by any C files. To give a minimal example, in the following two header
> files,
>
> BEGIN foo1.h
>
> #define BAR 1
> #define BAZ(x) ((x)+BAR)
>
> END foo1.h
>
> BEGIN foo2.h
>
> #define BAR 2
> #define BAZ(x) ((x)+BAR)
>
> END foo2.h
>
> BAZ() macro has redundant definition. I'd like to get rid of the code
> duplication with the following three files:
>
> BEGIN foo1.h
>
> #define BAR 1
> #include "foo_common.inc"
>
> END foo1.h
>
> BEGIN foo2.h
>
> #define BAR 2
> #include "foo_common.inc"
>
> END foo2.h
>
> BEGIN foo_common.inc
>
> #define BAZ(x) ((x)+BAR)
>
> END foo_common.inc
>
> However, I get an R CMD check warning of the form
>
> Subdirectory ‘src’ contains:
>   foo_common.inc
>
> Is there a way to tell R CMD check that .inc files are OK? Or, should I
> use a different extension? I don't want to use .c, because those files
> only contain macros and not anything that compiles to object code, and
> I don't want to use .h, because these are not meant to be included as
> header files by any C code.
>
>                                         Thank you in advance,
>                                         Pavel
>
> --
> Pavel Krivitsky
> Lecturer in Statistics
> National Institute of Applied Statistics Research Australia (NIASRA)
> School of Mathematics and Applied Statistics | Building 39C Room 154
> University of Wollongong NSW 2522 Australia
> T +61 2 4221 3713
> Web (NIASRA): http://niasra.uow.edu.au/index.html
> Web (Personal): http://www.krivitsky.net/research
> ORCID: 0000-0002-9101-3362
>
> NOTICE: This email is intended for the addressee named and may contain
> confidential information. If you are not the intended recipient, please
> delete it and notify the sender. Please consider the environment before
> printing this email.
> ______________________________________________
> R-package-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list