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_ATTRIBUTE_HIDDEN |
|
inline std::ostream& cout() |
|
{ |
|
static testthat::r_ostream instance; |
|
return instance; |
|
} |
|
|
|
TESTTHAT_ATTRIBUTE_HIDDEN |
|
inline std::ostream& cerr() |
|
{ |
|
static testthat::r_ostream instance; |
|
return instance; |
|
} |
Here is the definition of that macro:
|
#if defined(__GNUC__) || defined(__clang__) |
|
# define TESTTHAT_ENABLED |
|
# define TESTTHAT_ATTRIBUTE_HIDDEN __attribute__ ((visibility("hidden"))) |
|
#else |
|
# define TESTTHAT_ATTRIBUTE_HIDDEN |
|
#endif |
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
On Windows with R 4.2.1, testing cpp11 throws these warnings that come from testthat:
It is pointing to the usage of
TESTTHAT_ATTRIBUTE_HIDDENin these two functionstestthat/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