forked from GitHub/gf-core
remove the dependency on the HAVE_STATEMENT_EXPRESSIONS flag. This reduces the dependency on the ./configure script
This commit is contained in:
@@ -37,7 +37,6 @@ fi]
|
|||||||
|
|
||||||
AC_C_ALIGNOF
|
AC_C_ALIGNOF
|
||||||
AC_C_FAM_IN_MEM
|
AC_C_FAM_IN_MEM
|
||||||
AC_C_STATEMENT_EXPRESSIONS
|
|
||||||
AC_C_ASCII
|
AC_C_ASCII
|
||||||
|
|
||||||
case "$target_cpu" in
|
case "$target_cpu" in
|
||||||
|
|||||||
@@ -5,13 +5,14 @@
|
|||||||
GuExn*
|
GuExn*
|
||||||
gu_new_exn(GuExn* parent, GuKind* catch, GuPool* pool)
|
gu_new_exn(GuExn* parent, GuKind* catch, GuPool* pool)
|
||||||
{
|
{
|
||||||
return gu_new_s(pool, GuExn,
|
GuExn* exn = gu_new(GuExn, pool);
|
||||||
.state = GU_EXN_OK,
|
exn->state = GU_EXN_OK;
|
||||||
.parent = parent,
|
exn->parent = parent;
|
||||||
.catch = catch,
|
exn->catch = catch;
|
||||||
.caught = NULL,
|
exn->caught = NULL;
|
||||||
.data.pool = pool,
|
exn->data.pool = pool;
|
||||||
.data.data = NULL);
|
exn->data.data = NULL;
|
||||||
|
return exn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -74,4 +75,15 @@ gu_exn_caught(GuExn* err)
|
|||||||
return err->caught;
|
return err->caught;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gu_raise_errno(GuExn* err)
|
||||||
|
{
|
||||||
|
GuExnData* err_data = gu_raise(err, GuErrno);
|
||||||
|
if (err_data) {
|
||||||
|
GuErrno* gu_errno = gu_new(GuErrno, err_data->pool);
|
||||||
|
*gu_errno = errno;
|
||||||
|
err_data->data = gu_errno;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GU_DEFINE_TYPE(GuErrno, signed, _);
|
GU_DEFINE_TYPE(GuErrno, signed, _);
|
||||||
|
|||||||
@@ -38,10 +38,10 @@ struct GuExnData
|
|||||||
{
|
{
|
||||||
|
|
||||||
/// The pool that the exception value should be allocated from.
|
/// The pool that the exception value should be allocated from.
|
||||||
GuPool* const pool;
|
GuPool* pool;
|
||||||
|
|
||||||
/// The exception value.
|
/// The exception value.
|
||||||
const void* data;
|
void* data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GuExn {
|
struct GuExn {
|
||||||
@@ -146,10 +146,6 @@ gu_exn_raise_debug_(GuExn* err, GuType* type,
|
|||||||
} \
|
} \
|
||||||
GU_END
|
GU_END
|
||||||
|
|
||||||
#define gu_raise_i(error_, t_, ...) \
|
|
||||||
gu_raise_new(error_, t_, gu_raise_pool_, gu_new_i(gu_raise_pool_, t_, __VA_ARGS__))
|
|
||||||
|
|
||||||
|
|
||||||
/// Check the status of the current exception frame
|
/// Check the status of the current exception frame
|
||||||
static inline bool
|
static inline bool
|
||||||
gu_ok(GuExn* exn) {
|
gu_ok(GuExn* exn) {
|
||||||
@@ -177,21 +173,8 @@ typedef int GuErrno;
|
|||||||
|
|
||||||
extern GU_DECLARE_TYPE(GuErrno, signed);
|
extern GU_DECLARE_TYPE(GuErrno, signed);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define gu_raise_errno(error_) \
|
|
||||||
gu_raise_i(error_, GuErrno, errno)
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
typedef void (*GuExnPrintFn)(GuFn* clo, void* err, FILE* out);
|
|
||||||
|
|
||||||
extern GuTypeTable gu_exn_default_printer;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gu_exn_print(GuExn* err, FILE* out, GuTypeMap printer_map);
|
gu_raise_errno(GuExn* err);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|||||||
@@ -34,10 +34,12 @@ gu_file_flush(GuOutStream* stream, GuExn* err)
|
|||||||
GuOut*
|
GuOut*
|
||||||
gu_file_out(FILE* file, GuPool* pool)
|
gu_file_out(FILE* file, GuPool* pool)
|
||||||
{
|
{
|
||||||
GuFileOutStream* fos = gu_new_i(pool, GuFileOutStream,
|
GuFileOutStream* fos = gu_new(GuFileOutStream, pool);
|
||||||
.stream.output = gu_file_output,
|
fos->stream.begin_buf = NULL;
|
||||||
.stream.flush = gu_file_flush,
|
fos->stream.end_buf = NULL;
|
||||||
.file = file);
|
fos->stream.output = gu_file_output;
|
||||||
|
fos->stream.flush = gu_file_flush;
|
||||||
|
fos->file = file;
|
||||||
return gu_new_out(&fos->stream, pool);
|
return gu_new_out(&fos->stream, pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,8 +68,10 @@ gu_file_input(GuInStream* stream, uint8_t* buf, size_t sz, GuExn* err)
|
|||||||
GuIn*
|
GuIn*
|
||||||
gu_file_in(FILE* file, GuPool* pool)
|
gu_file_in(FILE* file, GuPool* pool)
|
||||||
{
|
{
|
||||||
GuFileInStream* fis = gu_new_s(pool, GuFileInStream,
|
GuFileInStream* fis = gu_new(GuFileInStream, pool);
|
||||||
.stream.input = gu_file_input,
|
fis->stream.begin_buffer = NULL;
|
||||||
.file = file);
|
fis->stream.end_buffer = NULL;
|
||||||
|
fis->stream.input = gu_file_input;
|
||||||
|
fis->file = file;
|
||||||
return gu_new_in(&fis->stream, pool);
|
return gu_new_in(&fis->stream, pool);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -307,12 +307,12 @@ gu_proxy_in_input(GuInStream* self, uint8_t* dst, size_t sz, GuExn* err)
|
|||||||
GuInStream*
|
GuInStream*
|
||||||
gu_in_proxy_stream(GuIn* in, GuPool* pool)
|
gu_in_proxy_stream(GuIn* in, GuPool* pool)
|
||||||
{
|
{
|
||||||
return &gu_new_s(
|
GuProxyInStream* ins = gu_new(GuProxyInStream, pool);
|
||||||
pool, GuProxyInStream,
|
ins->stream.begin_buffer = gu_proxy_in_begin_buffer;
|
||||||
.stream.begin_buffer = gu_proxy_in_begin_buffer,
|
ins->stream.end_buffer = gu_proxy_in_end_buffer;
|
||||||
.stream.end_buffer = gu_proxy_in_end_buffer,
|
ins->stream.input = gu_proxy_in_input;
|
||||||
.stream.input = gu_proxy_in_input,
|
ins->real_in = in;
|
||||||
.real_in = in)->stream;
|
return &ins->stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -401,10 +401,12 @@ gu_data_in_begin_buffer(GuInStream* self, size_t* sz_out, GuExn* err)
|
|||||||
GuIn*
|
GuIn*
|
||||||
gu_data_in(const uint8_t* data, size_t sz, GuPool* pool)
|
gu_data_in(const uint8_t* data, size_t sz, GuPool* pool)
|
||||||
{
|
{
|
||||||
GuDataIn* di = gu_new_s(pool, GuDataIn,
|
GuDataIn* di = gu_new(GuDataIn, pool);
|
||||||
.stream.begin_buffer = gu_data_in_begin_buffer,
|
di->stream.begin_buffer = gu_data_in_begin_buffer;
|
||||||
.data = data,
|
di->stream.end_buffer = NULL;
|
||||||
.sz = sz);
|
di->stream.input = NULL;
|
||||||
|
di->data = data;
|
||||||
|
di->sz = sz;
|
||||||
return gu_new_in(&di->stream, pool);
|
return gu_new_in(&di->stream, pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ struct GuMapData {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct GuMap {
|
struct GuMap {
|
||||||
GuMapKind const kind;
|
GuMapKind kind;
|
||||||
GuHasher* const hasher;
|
GuHasher* hasher;
|
||||||
size_t const key_size;
|
size_t key_size;
|
||||||
size_t const value_size;
|
size_t value_size;
|
||||||
const void* default_value;
|
const void* default_value;
|
||||||
GuMapData data;
|
GuMapData data;
|
||||||
|
|
||||||
@@ -380,16 +380,14 @@ gu_make_map(size_t key_size, GuHasher* hasher,
|
|||||||
.values = value_size ? NULL : (uint8_t*) gu_map_no_values,
|
.values = value_size ? NULL : (uint8_t*) gu_map_no_values,
|
||||||
.zero_idx = SIZE_MAX
|
.zero_idx = SIZE_MAX
|
||||||
};
|
};
|
||||||
GuMap* map = gu_new_i(
|
GuMap* map = gu_new(GuMap, pool);
|
||||||
pool, GuMap,
|
map->default_value = default_value;
|
||||||
.default_value = default_value,
|
map->hasher = hasher;
|
||||||
.hasher = hasher,
|
map->data = data;
|
||||||
.data = data,
|
map->key_size = key_size;
|
||||||
.key_size = key_size,
|
map->value_size = value_size;
|
||||||
.value_size = value_size,
|
map->fin.fn = gu_map_finalize;
|
||||||
.fin.fn = gu_map_finalize,
|
map->kind = kind;
|
||||||
.kind = kind
|
|
||||||
);
|
|
||||||
gu_pool_finally(pool, &map->fin);
|
gu_pool_finally(pool, &map->fin);
|
||||||
gu_map_resize(map);
|
gu_map_resize(map);
|
||||||
return map;
|
return map;
|
||||||
|
|||||||
@@ -339,8 +339,3 @@ gu_pool_free(GuPool* pool)
|
|||||||
|
|
||||||
|
|
||||||
extern inline void* gu_malloc(GuPool* pool, size_t size);
|
extern inline void* gu_malloc(GuPool* pool, size_t size);
|
||||||
|
|
||||||
extern inline void*
|
|
||||||
gu_malloc_init_aligned(GuPool* pool, size_t size, size_t alignment,
|
|
||||||
const void* init);
|
|
||||||
|
|
||||||
|
|||||||
@@ -112,24 +112,6 @@ gu_malloc(GuPool* pool, size_t size) {
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
//@private
|
|
||||||
static inline void*
|
|
||||||
gu_malloc_init_aligned(GuPool* pool, size_t size, size_t alignment,
|
|
||||||
const void* init)
|
|
||||||
{
|
|
||||||
void* p = gu_malloc_aligned(pool, size, alignment);
|
|
||||||
memcpy(p, init, size);
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
//@private
|
|
||||||
static inline void*
|
|
||||||
gu_malloc_init(GuPool* pool, size_t size, const void* init)
|
|
||||||
{
|
|
||||||
return gu_malloc_init_aligned(pool, size, 0, init);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Allocate memory to store an array of objects of a given type. */
|
/** Allocate memory to store an array of objects of a given type. */
|
||||||
|
|
||||||
#define gu_new_n(type, n, pool) \
|
#define gu_new_n(type, n, pool) \
|
||||||
@@ -167,38 +149,6 @@ gu_malloc_init(GuPool* pool, size_t size, const void* init)
|
|||||||
gu_alignof(pre_type), sizeof(pre_type), \
|
gu_alignof(pre_type), sizeof(pre_type), \
|
||||||
gu_alignof(type), sizeof(type))))
|
gu_alignof(type), sizeof(type))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_STATEMENT_EXPRESSIONS
|
|
||||||
#define gu_new_i(pool, type, ...) \
|
|
||||||
({ \
|
|
||||||
type *gu_new_p_ = gu_new(type, pool); \
|
|
||||||
memcpy((void*) gu_new_p_, &(type){ __VA_ARGS__ }, \
|
|
||||||
sizeof(type)); \
|
|
||||||
gu_new_p_; \
|
|
||||||
})
|
|
||||||
#else // HAVE_STATEMENT_EXPRESSIONS
|
|
||||||
#define gu_new_i(pool, type, ...) \
|
|
||||||
((type*)gu_malloc_init_aligned((pool), sizeof(type), \
|
|
||||||
gu_alignof(type), \
|
|
||||||
&(type){ __VA_ARGS__ }))
|
|
||||||
#endif // HAVE_STATEMENT_EXPRESSIONS
|
|
||||||
|
|
||||||
/** @def gu_new_i(pool, type, ...)
|
|
||||||
*
|
|
||||||
* Allocate and initialize an object.
|
|
||||||
*
|
|
||||||
* @param pool The pool to allocate from.
|
|
||||||
*
|
|
||||||
* @param type The C type of the object to allocate.
|
|
||||||
*
|
|
||||||
* @param ... An initializer list for the object to allocate.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define gu_new_s gu_new_i
|
|
||||||
|
|
||||||
// Alas, there's no portable way to get the alignment of flex structs.
|
// Alas, there's no portable way to get the alignment of flex structs.
|
||||||
#define gu_new_flex(pool_, type_, flex_member_, n_elems_) \
|
#define gu_new_flex(pool_, type_, flex_member_, n_elems_) \
|
||||||
((type_ *)gu_malloc_aligned( \
|
((type_ *)gu_malloc_aligned( \
|
||||||
|
|||||||
@@ -236,12 +236,13 @@ gu_proxy_out_flush(GuOutStream* self, GuExn* err)
|
|||||||
GuOutStream*
|
GuOutStream*
|
||||||
gu_out_proxy_stream(GuOut* out, GuPool* pool)
|
gu_out_proxy_stream(GuOut* out, GuPool* pool)
|
||||||
{
|
{
|
||||||
return &gu_new_s(pool, GuProxyOutStream,
|
GuProxyOutStream* pos = gu_new(GuProxyOutStream, pool);
|
||||||
.stream.begin_buf = gu_proxy_out_buf_begin,
|
pos->stream.begin_buf = gu_proxy_out_buf_begin;
|
||||||
.stream.end_buf = gu_proxy_out_buf_end,
|
pos->stream.end_buf = gu_proxy_out_buf_end;
|
||||||
.stream.output = gu_proxy_out_output,
|
pos->stream.output = gu_proxy_out_output;
|
||||||
.stream.flush = gu_proxy_out_flush,
|
pos->stream.flush = gu_proxy_out_flush;
|
||||||
.real_out = out)->stream;
|
pos->real_out = out;
|
||||||
|
return &pos->stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,9 +20,10 @@ gu_string_buf(GuPool* pool)
|
|||||||
GuBuf* buf = gu_new_buf(uint8_t, pool);
|
GuBuf* buf = gu_new_buf(uint8_t, pool);
|
||||||
GuOut* out = gu_buf_out(buf, pool);
|
GuOut* out = gu_buf_out(buf, pool);
|
||||||
GuWriter* wtr = gu_new_utf8_writer(out, pool);
|
GuWriter* wtr = gu_new_utf8_writer(out, pool);
|
||||||
return gu_new_s(pool, GuStringBuf,
|
GuStringBuf* sbuf = gu_new(GuStringBuf, pool);
|
||||||
.bbuf = buf,
|
sbuf->bbuf = buf;
|
||||||
.wtr = wtr);
|
sbuf->wtr = wtr;
|
||||||
|
return sbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuWriter*
|
GuWriter*
|
||||||
|
|||||||
@@ -98,9 +98,8 @@ gu_type_map_init(GuTypeMap* tmap, GuTypeTable* table)
|
|||||||
GuTypeMap*
|
GuTypeMap*
|
||||||
gu_new_type_map(GuTypeTable* table, GuPool* pool)
|
gu_new_type_map(GuTypeTable* table, GuPool* pool)
|
||||||
{
|
{
|
||||||
GuTypeMap* tmap =
|
GuTypeMap* tmap = gu_new(GuTypeMap, pool);
|
||||||
gu_new_i(pool, GuTypeMap,
|
tmap->map = gu_new_map(GuKind, NULL, void*, &gu_null, pool);
|
||||||
.map = gu_new_map(GuKind, NULL, void*, &gu_null, pool));
|
|
||||||
gu_type_map_init(tmap, table);
|
gu_type_map_init(tmap, table);
|
||||||
return tmap;
|
return tmap;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,127 +36,6 @@ gu_new_utf8_writer(GuOut* utf8_out, GuPool* pool)
|
|||||||
return wtr;
|
return wtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
#ifdef GU_UCS_WCHAR
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <wchar.h>
|
|
||||||
static const mbstate_t gu_init_mbstate; // implicitly initialized to zero
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct GuLocaleWriter GuLocaleWriter;
|
|
||||||
|
|
||||||
struct GuLocaleWriter {
|
|
||||||
GuOutWriter owtr;
|
|
||||||
#ifdef GU_UCS_WCHAR
|
|
||||||
mbstate_t ps;
|
|
||||||
size_t mb_cur_max;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
size_t
|
|
||||||
gu_locale_writer_write(GuWriter* wtr, const uint8_t* utf8_src, size_t sz,
|
|
||||||
GuExn* err)
|
|
||||||
{
|
|
||||||
GuLocaleWriter* lwtr = (GuLocaleWriter*) wtr;
|
|
||||||
size_t done = 0;
|
|
||||||
static const size_t bufsize = 256;
|
|
||||||
#ifdef GU_UCS_WCHAR
|
|
||||||
size_t margin = lwtr->mb_cur_max;
|
|
||||||
#else
|
|
||||||
size_t margin = 1;
|
|
||||||
#endif
|
|
||||||
GuOut* out = lwtr->owtr.out;
|
|
||||||
if (gu_out_is_buffered(out)) {
|
|
||||||
while (done < sz) {
|
|
||||||
size_t dst_sz;
|
|
||||||
uint8_t* dst = gu_out_begin_span(out, &dst_sz);
|
|
||||||
if (!dst) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (dst_sz <= margin) {
|
|
||||||
gu_out_end_span(out, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
size_t end = dst_sz - margin;
|
|
||||||
const uint8_t*
|
|
||||||
size_t n = done;
|
|
||||||
while (n < sz && dst_i <= end) {
|
|
||||||
#ifdef GU_UCS_WCHAR
|
|
||||||
GuUCS ucs = gu_
|
|
||||||
wchar_t wc = src[n];
|
|
||||||
size_t nb = wcrtomb((char*) p, wc, &lwtr->ps);
|
|
||||||
#else
|
|
||||||
*p = (uint8_t) gu_ucs_char(buf[n], err);
|
|
||||||
size_t nb = 1;
|
|
||||||
if (!gu_ok(err)) {
|
|
||||||
gu_exn_clear(err);
|
|
||||||
nb = (size_t) -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (nb == (size_t) -1) {
|
|
||||||
*p++ = (uint8_t) '?';
|
|
||||||
} else {
|
|
||||||
p += nb;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
for (
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t cbuf[256];
|
|
||||||
while (done < size && gu_ok(err)) {
|
|
||||||
uint8_t* p = cbuf;
|
|
||||||
uint8_t* edge = &cbuf[bufsize - margin];
|
|
||||||
size_t n;
|
|
||||||
for (n = done; p <= edge && n < size; n++) {
|
|
||||||
#ifdef GU_UCS_WCHAR
|
|
||||||
wchar_t wc = buf[n];
|
|
||||||
size_t nb = wcrtomb((char*) p, wc, &lwtr->ps);
|
|
||||||
#else
|
|
||||||
*p = (uint8_t) gu_ucs_char(buf[n], err);
|
|
||||||
size_t nb = 1;
|
|
||||||
if (!gu_ok(err)) {
|
|
||||||
gu_exn_clear(err);
|
|
||||||
nb = (size_t) -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (nb == (size_t) -1) {
|
|
||||||
*p++ = (uint8_t) '?';
|
|
||||||
} else {
|
|
||||||
p += nb;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gu_out_bytes(lwtr->owtr.out, cbuf, p - cbuf, err);
|
|
||||||
if (gu_ok(err)) {
|
|
||||||
done = n;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return done;
|
|
||||||
}
|
|
||||||
|
|
||||||
GuWriter*
|
|
||||||
gu_locale_writer(GuOut* out, GuPool* pool)
|
|
||||||
{
|
|
||||||
GuLocaleWriter* lwtr = gu_new_s(
|
|
||||||
pool, GuLocaleWriter,
|
|
||||||
.wtr.out.output = gu_locale_writer_output,
|
|
||||||
.wtr.out.flush = gu_locale_writer_flush,
|
|
||||||
.out = out);
|
|
||||||
#ifdef GU_UCS_WCHAR
|
|
||||||
lwtr->ps = gu_init_mbstate;
|
|
||||||
lwtr->mb_cur_max = MB_CUR_MAX;
|
|
||||||
#endif
|
|
||||||
return (GuWriter*) lwtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern inline void
|
extern inline void
|
||||||
gu_ucs_write(GuUCS ucs, GuWriter* wtr, GuExn* err);
|
gu_ucs_write(GuUCS ucs, GuWriter* wtr, GuExn* err);
|
||||||
|
|
||||||
|
|||||||
@@ -41,22 +41,6 @@ AC_DEFUN([AC_C_FAM_IN_MEM],
|
|||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
## AC_C_STATEMENT_EXPRESSIONS
|
|
||||||
AC_DEFUN([AC_C_STATEMENT_EXPRESSIONS],
|
|
||||||
[
|
|
||||||
AC_CACHE_CHECK([for statement expressions],
|
|
||||||
ac_cv_c_statement_expressions,
|
|
||||||
[AC_COMPILE_IFELSE(
|
|
||||||
[AC_LANG_PROGRAM([], [int x = ({ int a = 42; a = a + 1; a; })])],
|
|
||||||
[ac_cv_c_statement_expressions=yes],
|
|
||||||
[ac_cv_c_statement_expressions=no])])
|
|
||||||
if test $ac_cv_c_statement_expressions = yes; then
|
|
||||||
AC_DEFINE([HAVE_STATEMENT_EXPRESSIONS], 1,
|
|
||||||
[Define to 1 if statement expressions are supported.])
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
## AC_C_ASCII
|
## AC_C_ASCII
|
||||||
AC_DEFUN([AC_C_ASCII],
|
AC_DEFUN([AC_C_ASCII],
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -2195,12 +2195,10 @@ pgf_parse_result(PgfParseState* state)
|
|||||||
pgf_parsing_print_counts(state->ps);
|
pgf_parsing_print_counts(state->ps);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PgfExprEnum* en =
|
PgfParseResult* res = gu_new(PgfParseResult, state->ps->pool);
|
||||||
&gu_new_i(state->ps->pool, PgfParseResult,
|
res->state = state;
|
||||||
.state = state,
|
res->en.next = pgf_parse_result_enum_next;
|
||||||
.en.next = pgf_parse_result_enum_next)->en;
|
return &res->en;
|
||||||
|
|
||||||
return en;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -76,8 +76,14 @@ pgf_read_len(PgfReader* rdr)
|
|||||||
// immediately.
|
// immediately.
|
||||||
gu_return_on_exn(rdr->err, 0);
|
gu_return_on_exn(rdr->err, 0);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
gu_raise_i(rdr->err, PgfReadTagExn,
|
GuExnData* err_data = gu_raise(rdr->err, PgfReadTagExn);
|
||||||
.type = gu_type(GuLength), .tag = len);
|
if (err_data) {
|
||||||
|
PgfReadTagExn* rtag = gu_new(PgfReadTagExn, err_data->pool);
|
||||||
|
rtag->type = gu_type(GuLength);
|
||||||
|
rtag->tag = len;
|
||||||
|
err_data->data = rtag;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (GuLength) len;
|
return (GuLength) len;
|
||||||
|
|||||||
Reference in New Issue
Block a user