Push/pop `noreturn` when it is a macro.

This is coming from C's stdnoreturn.h which seems to be unguarded for C++ in
some toolchains.

PiperOrigin-RevId: 583165958
pull/14768/head
Protobuf Team Bot 1 year ago committed by Copybara-Service
parent 1a5cdb9378
commit 838d9b7c7f
  1. 7
      src/google/protobuf/port_def.inc
  2. 5
      src/google/protobuf/port_undef.inc

@ -790,6 +790,13 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
// ThreadSafeArenaz is turned off completely in opensource builds.
// noreturn is defined as a macro in C's stdnoreturn.h
#ifdef noreturn
#define PROTOBUF_DID_UNDEF_noreturn
#pragma push_macro("noreturn")
#undef noreturn
#endif
// autoheader defines this in some circumstances
#ifdef PACKAGE
#define PROTOBUF_DID_UNDEF_PACKAGE

@ -92,6 +92,11 @@
// Restore macros that may have been #undef'd in port_def.inc.
#ifdef PROTOBUF_DID_UNDEF_noreturn
#pragma pop_macro("noreturn")
#undef PROTOBUF_DID_UNDEF_noreturn
#endif
#ifdef PROTOBUF_DID_UNDEF_PACKAGE
#pragma pop_macro("PACKAGE")
#undef PROTOBUF_DID_UNDEF_PACKAGE

Loading…
Cancel
Save