close
Skip to content

Commit 78dc67e

Browse files
Workaround for attribute handling bug in gcc < 13
Fixes #27045 PiperOrigin-RevId: 904480120
1 parent b20539c commit 78dc67e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎src/google/protobuf/port_def.inc‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,13 @@
139139
#endif
140140

141141
#define PROTOBUF_FUTURE_ADD_EARLY_NODISCARD [[nodiscard]]
142+
#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ < 13
143+
// GCC < 13 doesn't support mixing [[]] attributes with __attribute__, and this
144+
// is used with PROTOBUF_EXPORT for shared library visibility.
145+
#define PROTOBUF_FUTURE_ADD_EARLY_WARN_UNUSED __attribute__((warn_unused))
146+
#else
142147
#define PROTOBUF_FUTURE_ADD_EARLY_WARN_UNUSED ABSL_ATTRIBUTE_WARN_UNUSED
148+
#endif
143149

144150
#ifdef PROTOBUF_ALWAYS_INLINE
145151
#error PROTOBUF_ALWAYS_INLINE was previously defined

0 commit comments

Comments
 (0)