We're updating the issue view to help you get more done. 

ICU4C: Suppress GCC warning about std atomic visibility attribute when building with MSYS2 (Windows).

Description

Reported by Vincent Torri on the icu-support mailing list.

When building ICU4C with MSYS2 + mingw-w64 on Windows, GCC gives the following warning message:

1 2 3 4 umutex.h:49:35: warning: type attributes ignored after type is already defined [-Wattributes] template struct U_COMMON_API std::atomic<int32_t>; ^~~~~~~~~~~~~~~

In the C++ standard library headers for GCC on MinGW/MSYS2, the class std::atomic is declared as _GLIBCXX_VISIBILITY(default), which means that it is already "exported" or "visible" (similar to dllexport) if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY is true.
(And _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY is true for GCC versions greater than 4.0).

The issue that the compiler is complaining about is that the U_COMMON_API macro, which serves to export (or make visible) the class has *no effect*.

In other words it is merely complaining that the macro is redundant.

We should suppress this warning for GCC, as it leads to many noisy warnings when building under MinGW/MSYS2.

Status

Assignee

Jeff Genovy

Reporter

Jeff Genovy

Labels

None

Reviewer

None

Time Needed

None

Start date

None

Components

Fix versions

Priority

minor