Skip to content

Commit fc2d9da

Browse files
eamonnmcmanuscopybara-github
authored andcommitted
Wrap C++ headers in #ifdef __cplusplus.
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
1 parent d98722b commit fc2d9da

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

upb/base/status.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#ifndef UPB_BASE_STATUS_HPP_
99
#define UPB_BASE_STATUS_HPP_
1010

11+
#ifdef __cplusplus
12+
1113
#include "upb/base/status.h"
1214

1315
namespace upb {
@@ -47,4 +49,6 @@ class Status final {
4749

4850
} // namespace upb
4951

52+
#endif // __cplusplus
53+
5054
#endif // UPB_BASE_STATUS_HPP_

upb/mem/arena.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#ifndef UPB_MEM_ARENA_HPP_
99
#define UPB_MEM_ARENA_HPP_
1010

11+
#ifdef __cplusplus
12+
1113
#include <memory>
1214

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

5254
} // namespace upb
5355

56+
#endif // __cplusplus
57+
5458
#endif // UPB_MEM_ARENA_HPP_

0 commit comments

Comments
 (0)