Stop including <uchar.h>, and instead map Rust char to uint32_t.

This is technically a breaking change for C++, unfortunately.

Fixes #423.
This commit is contained in:
Emilio Cobos Álvarez 2019-12-03 22:50:18 +01:00
parent 913b08d404
commit 9b5dd80d84
442 changed files with 23 additions and 455 deletions

View File

@ -167,8 +167,6 @@ impl Bindings {
out.new_line();
out.write("#include <stdlib.h>");
out.new_line();
out.write("#include <uchar.h>");
out.new_line();
} else {
out.write("#include <cstdarg>");
out.new_line();

View File

@ -132,7 +132,15 @@ impl PrimitiveType {
PrimitiveType::Char => "char",
PrimitiveType::SChar => "signed char",
PrimitiveType::UChar => "unsigned char",
PrimitiveType::Char32 => "char32_t",
// NOTE: It'd be nice to use a char32_t, but:
//
// * uchar.h is not present on mac (see #423).
//
// * char32_t isn't required to be compatible with Rust's char, as
// the C++ spec only requires it to be the same size as
// uint_least32_t, which is _not_ guaranteed to be 4-bytes.
//
PrimitiveType::Char32 => "uint32_t",
PrimitiveType::Short => "short",
PrimitiveType::Int => "int",
PrimitiveType::Long => "long",

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
enum Status {
Ok,

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
enum Status
#ifdef __cplusplus

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
enum C {
X = 2,

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
enum C
#ifdef __cplusplus

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef enum {
A,

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef enum {
A,

View File

@ -5,7 +5,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct I I;

View File

@ -5,7 +5,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct I I;

View File

@ -2,6 +2,5 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#define Foo_FOO 42

View File

@ -2,6 +2,5 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#define Foo_FOO 42

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
/**
* Constants shared by multiple CSS Box Alignment properties

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
/**
* Constants shared by multiple CSS Box Alignment properties

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
/**
* Constants shared by multiple CSS Box Alignment properties

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
/**
* Constants shared by multiple CSS Box Alignment properties

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef enum {
Foo1,

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef enum {
Foo1,

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
enum Status {
Ok,

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
enum Status
#ifdef __cplusplus

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
enum C {
X = 2,

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
enum C
#ifdef __cplusplus

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef enum Foo_Tag {
A,

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef enum Foo_Tag {
A,

View File

@ -5,7 +5,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct I I;

View File

@ -5,7 +5,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct I I;

View File

@ -2,6 +2,5 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#define Foo_FOO 42

View File

@ -2,6 +2,5 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#define Foo_FOO 42

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Foo {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Foo {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
/**
* Constants shared by multiple CSS Box Alignment properties

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
/**
* Constants shared by multiple CSS Box Alignment properties

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
/**
* Constants shared by multiple CSS Box Alignment properties

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
/**
* Constants shared by multiple CSS Box Alignment properties

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef enum MyCLikeEnum {
Foo1,

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef enum MyCLikeEnum {
Foo1,

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef void (*A)();

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef void (*A)();

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#if defined(NOT_DEFINED)
#define DEFAULT_X 8

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#if defined(NOT_DEFINED)
#define DEFAULT_X 8

View File

@ -2,4 +2,3 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>

View File

@ -2,4 +2,3 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#if (defined(PLATFORM_WIN) || defined(M_32))
enum BarType {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#if (defined(PLATFORM_WIN) || defined(M_32))
enum BarType

View File

@ -2,10 +2,9 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Foo {
char32_t a;
uint32_t a;
} Foo;
void root(Foo a);

View File

@ -2,10 +2,9 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Foo {
char32_t a;
uint32_t a;
} Foo;
#ifdef __cplusplus

View File

@ -2,6 +2,5 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#define Foo_FOO 42

View File

@ -2,6 +2,5 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#define Foo_FOO 42

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef uint8_t Transparent;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef uint8_t Transparent;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#define DELIMITER ':'

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#define DELIMITER ':'

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Foo {
bool a;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Foo {
bool a;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
enum FillRule {
A,

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
enum FillRule
#ifdef __cplusplus

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Rect {
float x;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Rect {
float x;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
/**
* The root of all evil.

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#ifdef __cplusplus
extern "C" {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
// The root of all evil.
void root(void);

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#ifdef __cplusplus
extern "C" {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
/**
* The root of all evil.

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#ifdef __cplusplus
extern "C" {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
/**
* The root of all evil.

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#ifdef __cplusplus
extern "C" {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
enum A {
a1 = 0,

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
enum A
#ifdef __cplusplus

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct TypedLength_f32__UnknownUnit {
float _0;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct TypedLength_f32__UnknownUnit {
float _0;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Foo {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Foo {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Foo {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Foo {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct dep_struct {
uint32_t x;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct dep_struct {
uint32_t x;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Foo {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Foo {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Foo {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Foo {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
void first(void);

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#ifdef __cplusplus
extern "C" {

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Normal {
int32_t x;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Normal {
int32_t x;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct ExtType {
uint32_t data;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct ExtType {
uint32_t data;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Fns {
void (*noArgs)();

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Fns {
void (*noArgs)();

View File

@ -2,4 +2,3 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>

View File

@ -2,4 +2,3 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>

View File

@ -2,5 +2,4 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#include <math.h>

View File

@ -2,5 +2,4 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#include <math.h>

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct A {
int32_t x;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct A {
int32_t x;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Foo {
float x;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
typedef struct Foo {
float x;

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
enum OnlyThisShouldBeGenerated {
Foo,

View File

@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
enum OnlyThisShouldBeGenerated
#ifdef __cplusplus

Some files were not shown because too many files have changed in this diff Show More