Skip to content

Commit

Permalink
Wrap C++ headers in #ifdef __cplusplus.
Browse files Browse the repository at this point in the history
The upb libraries can also be accessed from Kotlin Native code, which
understands only C headers, not C++. By adding these `#ifdef` directives, the
C++ headers will appear to be empty in that case.

PiperOrigin-RevId: 599593286
  • Loading branch information
eamonnmcmanus authored and copybara-github committed Jan 18, 2024
1 parent d98722b commit fc2d9da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions upb/base/status.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#ifndef UPB_BASE_STATUS_HPP_
#define UPB_BASE_STATUS_HPP_

#ifdef __cplusplus

#include "upb/base/status.h"

namespace upb {
Expand Down Expand Up @@ -47,4 +49,6 @@ class Status final {

} // namespace upb

#endif // __cplusplus

#endif // UPB_BASE_STATUS_HPP_
4 changes: 4 additions & 0 deletions upb/mem/arena.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#ifndef UPB_MEM_ARENA_HPP_
#define UPB_MEM_ARENA_HPP_

#ifdef __cplusplus

#include <memory>

#include "upb/mem/arena.h"
Expand Down Expand Up @@ -51,4 +53,6 @@ class InlinedArena : public Arena {

} // namespace upb

#endif // __cplusplus

#endif // UPB_MEM_ARENA_HPP_

0 comments on commit fc2d9da

Please # to comment.