-
Notifications
You must be signed in to change notification settings - Fork 16.1k
Open
Description
protobuf 34.0 fails to build with GCC ≤12 when building shared libraries (-DBUILD_SHARED_LIBS=ON). GCC 13+ and static builds work fine.
10af44b added PROTOBUF_FUTURE_ADD_EARLY_WARN_UNUSED (→ ABSL_ATTRIBUTE_WARN_UNUSED → [[gnu::warn_unused]]). In shared builds, PROTOBUF_EXPORT expands to __attribute__((visibility("default"))), producing declarations like:
class __attribute__((visibility("default"))) [[gnu::warn_unused]] CodedInputStream {GCC ≤12 cannot parse mixed GNU and C++11 attributes in this position (GCC#69585, fixed in GCC 13).
The same class of bug was previously fixed for alignas in baeab50, and reported in #19447 (auto-closed) and #16867.
port_def.inc:158:47: error: expected identifier before '[' token
158 | #define PROTOBUF_FUTURE_ADD_EARLY_WARN_UNUSED ABSL_ATTRIBUTE_WARN_UNUSED
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
coded_stream.h:151:23: note: in expansion of macro 'PROTOBUF_FUTURE_ADD_EARLY_WARN_UNUSED'
151 | class PROTOBUF_EXPORT PROTOBUF_FUTURE_ADD_EARLY_WARN_UNUSED CodedInputStream {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tested with GCC 11.5, 12.4 (both fail), and 13.3 (passes), all with abseil-cpp 20240722.0 and -std=c++17.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels