Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions c/include/libsbp/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
#ifndef LIBSBP_COMMON_H
#define LIBSBP_COMMON_H

#ifndef _RUSTC_BINDGEN_
#include <stdint.h>
#include <stdbool.h>
#include <inttypes.h>
#endif

/* Should match guard in libswiftnav/common.h */
#ifndef COMMON_INT_TYPES
Expand All @@ -28,6 +30,7 @@
* `int` which can lead to portability issues between different platforms.
* \{ */

#ifndef _RUSTC_BINDGEN_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does bindgen define it's own s8 etc types? Do we actually need to not include the stdlib headers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I manually defined equivalent types to avoid the other includes that this generates. The lack of includes here is to limit the what bindgen tries to generate. Bindgen will attempt to generate bindings for everything it the .h-- so we want to avoid trying to generate bindings for everything in the c stdlib.

/** Signed 8-bit integer. */
typedef int8_t s8;
/** Signed 16-bit integer. */
Expand All @@ -44,6 +47,7 @@ typedef uint16_t u16;
typedef uint32_t u32;
/** Unsigned 64-bit integer. */
typedef uint64_t u64;
#endif

#endif

Expand Down