[R-pkg-devel] Ignoring a compiler warning?

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Mon Feb 27 21:34:11 CET 2023


On 27 February 2023 at 14:32, Duncan Murdoch wrote:
| I am in the process of updating rgl to use the glad loader 
| (https://github.com/Dav1dde/glad).  This replaces system standard gl.h 
| and glext.h files with new ones that include function pointers to be 
| filled in at run-time, so that rgl can use OpenGL features supported by 
| updated drivers if they are present.
| 
| However, I'm getting a NOTE from checking:
| 
| File which contains pragma(s) suppressing diagnostics:
|    ‘src/ext/glad/include/glad/gl.h’
| 
| It is correct:  that file contains this:
| 
| #ifdef __clang__
| #pragma clang diagnostic push
| #pragma clang diagnostic ignored "-Wreserved-id-macro"
| #endif
| #ifdef __gl_h_
|    #error OpenGL (gl.h) header already included (API: gl), remove 
| previous include!
| #endif
| #define __gl_h_ 1
| 
| ... more like this ...
| 
| 
| The compiler would issue a warning for defining "__gl_h_" because of the 
| two leading underscores.
| 
| Is that an ignorable NOTE, or if not, is there some acceptable way to 
| suppress it?

There is not (AFAIK), and package BH has edited out such pragmas for many
years (as have other packages, I think it bites me in at least one other
package). In essence I recursively search for '#pragma clang diagnostic
ignored' and ditto for gcc and precede the line with //. The BH repo has the
diffs in a subdirectory. And not that it matters because I do not get to make
the rules, but I also consider this wrong as it makes builds _much_ more
'noisy' leading to the real possibiity of missing more meaningful message.

Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-package-devel mailing list