Description
On Windows with R 4.2.1, testing cpp11 throws these warnings that come from testthat:
D:/a/_temp/Library/testthat/include/testthat/testthat.h: In function 'std::ostream& Catch::cout()':
D:/a/_temp/Library/testthat/include/testthat/testthat.h:145:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
145 | }
| ^
D:/a/_temp/Library/testthat/include/testthat/testthat.h: In function 'std::ostream& Catch::cerr()':
D:/a/_temp/Library/testthat/include/testthat/testthat.h:152:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
152 | }
| ^
It is pointing to the usage of TESTTHAT_ATTRIBUTE_HIDDEN
in these two functions
testthat/inst/include/testthat/testthat.h
Lines 140 to 152 in 426eb52
Here is the definition of that macro:
testthat/inst/include/testthat/testthat.h
Lines 20 to 25 in 426eb52
And here is the original PR where it was added 5d052fc. The original problem that prompted the addition of this macro was for Linux, and wasn't a problem on Windows, so I feel like tweaking this for Windows is safe.
Apparently __attribute__ ((visibility("hidden")))
isn't supported on Windows with the version of gcc that comes with Rtools + R 4.2.1?
This doesn't happen on R 3.6, so it probably has to do with the updated Rtools and version of gcc.
It seems to be a general issue with the MinGW version of gcc, other people worked around it by just not using the attribute, so I feel like we should do that too fmtlib/fmt#1743