mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 08:32:11 +01:00
Avoid empty C structs
This commit is contained in:
1 parent
a07aa0a683
commit
6670445122
17 files changed
+322
-1
No files matched your search
@@ -56,11 +56,31 @@ extern "C" {
|
||||
// struct. In C, if a function f returns void, you can't say "x = f()", but in
|
||||
// Wuffs, if a function g returns empty, you can say "y = g()".
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__empty_struct;
|
||||
|
||||
// wuffs_base__utility is a placeholder receiver type. It enables what Java
|
||||
// calls static methods, as opposed to regular methods.
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__utility;
|
||||
|
||||
// --------
|
||||
|
||||
@@ -19,7 +19,8 @@ package cgen
|
||||
const basePublicH = "" +
|
||||
"#ifndef WUFFS_INCLUDE_GUARD__BASE_PUBLIC\n#define WUFFS_INCLUDE_GUARD__BASE_PUBLIC\n\n// Copyright 2017 The Wuffs Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// https://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include <stdbool.h>\n#include <stdint.h>\n#include <string.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// Wuffs assumes that:\n// - converting a uint32_t to a size_t will never overflow.\n// - converting a size_t to a uint64_t will never overflow.\n#ifdef __WORDSIZE\n#if (__WORDSIZE != 32) && (__WORDSIZE != 64)\n#error \"Wuffs requires a word size " +
|
||||
"of either 32 or 64 bits\"\n#endif\n#endif\n\n// WUFFS_VERSION is the major.minor.patch version, as per https://semver.org/,\n// as a uint64_t. The major number is the high 32 bits. The minor number is the\n// middle 16 bits. The patch number is the low 16 bits. The version extension\n// (such as \"\", \"beta\" or \"rc.1\") is part of the string representation (such as\n// \"1.2.3-beta\") but not the uint64_t representation.\n//\n// All three of major, minor and patch being zero means that this is a\n// work-in-progress version, not a release version, and has no backwards or\n// forwards compatibility guarantees.\n//\n// !! Some code generation programs can override WUFFS_VERSION.\n#define WUFFS_VERSION ((uint64_t)0)\n#define WUFFS_VERSION_MAJOR ((uint64_t)0)\n#define WUFFS_VERSION_MINOR ((uint64_t)0)\n#define WUFFS_VERSION_PATCH ((uint64_t)0)\n#define WUFFS_VERSION_EXTENSION \"\"\n#define WUFFS_VERSION_STRING \"0.0.0\"\n\n// wuffs_base__empty_struct is used when a Wuffs function returns an empty\n// struct. In C, if a function f returns void, y" +
|
||||
"ou can't say \"x = f()\", but in\n// Wuffs, if a function g returns empty, you can say \"y = g()\".\ntypedef struct {\n} wuffs_base__empty_struct;\n\n// wuffs_base__utility is a placeholder receiver type. It enables what Java\n// calls static methods, as opposed to regular methods.\ntypedef struct {\n} wuffs_base__utility;\n\n" +
|
||||
"ou can't say \"x = f()\", but in\n// Wuffs, if a function g returns empty, you can say \"y = g()\".\ntypedef struct {\n // private_impl is a placeholder field. It isn't explicitly used, except that\n // without it, the sizeof a struct with no fields can differ across C/C++\n // compilers, and it is undefined behavior in C99. For example, gcc says that\n // the sizeof an empty struct is 0, and g++ says that it is 1. This leads to\n // ABI incompatibility if a Wuffs .c file is processed by one compiler and\n // its .h file with another compiler.\n //\n // Instead, we explicitly insert an otherwise unused field, so that the\n // sizeof this struct is always 1.\n uint8_t private_impl;\n} wuffs_base__empty_struct;\n\n// wuffs_base__utility is a placeholder receiver type. It enables what Java\n// calls static methods, as opposed to regular methods.\ntypedef struct {\n // private_impl is a placeholder field. It isn't explicitly used, except that\n // without it, the sizeof a struct with no fields can differ across C/C++\n // c" +
|
||||
"ompilers, and it is undefined behavior in C99. For example, gcc says that\n // the sizeof an empty struct is 0, and g++ says that it is 1. This leads to\n // ABI incompatibility if a Wuffs .c file is processed by one compiler and\n // its .h file with another compiler.\n //\n // Instead, we explicitly insert an otherwise unused field, so that the\n // sizeof this struct is always 1.\n uint8_t private_impl;\n} wuffs_base__utility;\n\n" +
|
||||
"" +
|
||||
"// --------\n\n// A status code is either zero (OK), positive (a recoverable suspension or\n// pause in processing) or negative (a non-recoverable error). Its bits:\n// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.\n// - bits 30 .. 24 are a package-namespaced numeric code\n// - bits 23 .. 21 are reserved.\n// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.\n//\n// Do not manipulate these bits directly; they are private implementation\n// details. Use methods such as wuffs_base__status__is_error instead.\ntypedef int32_t wuffs_base__status;\n\n// !! INSERT wuffs_base__status names.\n\nstatic inline bool wuffs_base__status__is_error(wuffs_base__status s) {\n return s < 0;\n}\n\nstatic inline bool wuffs_base__status__is_ok(wuffs_base__status s) {\n return s == 0;\n}\n\nstatic inline bool wuffs_base__status__is_suspension(wuffs_base__status s) {\n return s > 0;\n}\n\nconst char* wuffs_base__status__string(wuffs_base__status s);\n\n" +
|
||||
"" +
|
||||
|
||||
@@ -70,11 +70,31 @@ extern "C" {
|
||||
// struct. In C, if a function f returns void, you can't say "x = f()", but in
|
||||
// Wuffs, if a function g returns empty, you can say "y = g()".
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__empty_struct;
|
||||
|
||||
// wuffs_base__utility is a placeholder receiver type. It enables what Java
|
||||
// calls static methods, as opposed to regular methods.
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__utility;
|
||||
|
||||
// --------
|
||||
|
||||
@@ -59,11 +59,31 @@ extern "C" {
|
||||
// struct. In C, if a function f returns void, you can't say "x = f()", but in
|
||||
// Wuffs, if a function g returns empty, you can say "y = g()".
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__empty_struct;
|
||||
|
||||
// wuffs_base__utility is a placeholder receiver type. It enables what Java
|
||||
// calls static methods, as opposed to regular methods.
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__utility;
|
||||
|
||||
// --------
|
||||
|
||||
@@ -59,11 +59,31 @@ extern "C" {
|
||||
// struct. In C, if a function f returns void, you can't say "x = f()", but in
|
||||
// Wuffs, if a function g returns empty, you can say "y = g()".
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__empty_struct;
|
||||
|
||||
// wuffs_base__utility is a placeholder receiver type. It enables what Java
|
||||
// calls static methods, as opposed to regular methods.
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__utility;
|
||||
|
||||
// --------
|
||||
|
||||
@@ -59,11 +59,31 @@ extern "C" {
|
||||
// struct. In C, if a function f returns void, you can't say "x = f()", but in
|
||||
// Wuffs, if a function g returns empty, you can say "y = g()".
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__empty_struct;
|
||||
|
||||
// wuffs_base__utility is a placeholder receiver type. It enables what Java
|
||||
// calls static methods, as opposed to regular methods.
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__utility;
|
||||
|
||||
// --------
|
||||
|
||||
@@ -59,11 +59,31 @@ extern "C" {
|
||||
// struct. In C, if a function f returns void, you can't say "x = f()", but in
|
||||
// Wuffs, if a function g returns empty, you can say "y = g()".
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__empty_struct;
|
||||
|
||||
// wuffs_base__utility is a placeholder receiver type. It enables what Java
|
||||
// calls static methods, as opposed to regular methods.
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__utility;
|
||||
|
||||
// --------
|
||||
|
||||
@@ -59,11 +59,31 @@ extern "C" {
|
||||
// struct. In C, if a function f returns void, you can't say "x = f()", but in
|
||||
// Wuffs, if a function g returns empty, you can say "y = g()".
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__empty_struct;
|
||||
|
||||
// wuffs_base__utility is a placeholder receiver type. It enables what Java
|
||||
// calls static methods, as opposed to regular methods.
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__utility;
|
||||
|
||||
// --------
|
||||
|
||||
@@ -59,11 +59,31 @@ extern "C" {
|
||||
// struct. In C, if a function f returns void, you can't say "x = f()", but in
|
||||
// Wuffs, if a function g returns empty, you can say "y = g()".
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__empty_struct;
|
||||
|
||||
// wuffs_base__utility is a placeholder receiver type. It enables what Java
|
||||
// calls static methods, as opposed to regular methods.
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__utility;
|
||||
|
||||
// --------
|
||||
|
||||
@@ -59,11 +59,31 @@ extern "C" {
|
||||
// struct. In C, if a function f returns void, you can't say "x = f()", but in
|
||||
// Wuffs, if a function g returns empty, you can say "y = g()".
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__empty_struct;
|
||||
|
||||
// wuffs_base__utility is a placeholder receiver type. It enables what Java
|
||||
// calls static methods, as opposed to regular methods.
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__utility;
|
||||
|
||||
// --------
|
||||
|
||||
@@ -59,11 +59,31 @@ extern "C" {
|
||||
// struct. In C, if a function f returns void, you can't say "x = f()", but in
|
||||
// Wuffs, if a function g returns empty, you can say "y = g()".
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__empty_struct;
|
||||
|
||||
// wuffs_base__utility is a placeholder receiver type. It enables what Java
|
||||
// calls static methods, as opposed to regular methods.
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__utility;
|
||||
|
||||
// --------
|
||||
|
||||
@@ -59,11 +59,31 @@ extern "C" {
|
||||
// struct. In C, if a function f returns void, you can't say "x = f()", but in
|
||||
// Wuffs, if a function g returns empty, you can say "y = g()".
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__empty_struct;
|
||||
|
||||
// wuffs_base__utility is a placeholder receiver type. It enables what Java
|
||||
// calls static methods, as opposed to regular methods.
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__utility;
|
||||
|
||||
// --------
|
||||
|
||||
@@ -59,11 +59,31 @@ extern "C" {
|
||||
// struct. In C, if a function f returns void, you can't say "x = f()", but in
|
||||
// Wuffs, if a function g returns empty, you can say "y = g()".
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__empty_struct;
|
||||
|
||||
// wuffs_base__utility is a placeholder receiver type. It enables what Java
|
||||
// calls static methods, as opposed to regular methods.
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__utility;
|
||||
|
||||
// --------
|
||||
|
||||
@@ -59,11 +59,31 @@ extern "C" {
|
||||
// struct. In C, if a function f returns void, you can't say "x = f()", but in
|
||||
// Wuffs, if a function g returns empty, you can say "y = g()".
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__empty_struct;
|
||||
|
||||
// wuffs_base__utility is a placeholder receiver type. It enables what Java
|
||||
// calls static methods, as opposed to regular methods.
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__utility;
|
||||
|
||||
// --------
|
||||
|
||||
@@ -59,11 +59,31 @@ extern "C" {
|
||||
// struct. In C, if a function f returns void, you can't say "x = f()", but in
|
||||
// Wuffs, if a function g returns empty, you can say "y = g()".
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__empty_struct;
|
||||
|
||||
// wuffs_base__utility is a placeholder receiver type. It enables what Java
|
||||
// calls static methods, as opposed to regular methods.
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__utility;
|
||||
|
||||
// --------
|
||||
|
||||
@@ -59,11 +59,31 @@ extern "C" {
|
||||
// struct. In C, if a function f returns void, you can't say "x = f()", but in
|
||||
// Wuffs, if a function g returns empty, you can say "y = g()".
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__empty_struct;
|
||||
|
||||
// wuffs_base__utility is a placeholder receiver type. It enables what Java
|
||||
// calls static methods, as opposed to regular methods.
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__utility;
|
||||
|
||||
// --------
|
||||
|
||||
@@ -59,11 +59,31 @@ extern "C" {
|
||||
// struct. In C, if a function f returns void, you can't say "x = f()", but in
|
||||
// Wuffs, if a function g returns empty, you can say "y = g()".
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__empty_struct;
|
||||
|
||||
// wuffs_base__utility is a placeholder receiver type. It enables what Java
|
||||
// calls static methods, as opposed to regular methods.
|
||||
typedef struct {
|
||||
// private_impl is a placeholder field. It isn't explicitly used, except that
|
||||
// without it, the sizeof a struct with no fields can differ across C/C++
|
||||
// compilers, and it is undefined behavior in C99. For example, gcc says that
|
||||
// the sizeof an empty struct is 0, and g++ says that it is 1. This leads to
|
||||
// ABI incompatibility if a Wuffs .c file is processed by one compiler and
|
||||
// its .h file with another compiler.
|
||||
//
|
||||
// Instead, we explicitly insert an otherwise unused field, so that the
|
||||
// sizeof this struct is always 1.
|
||||
uint8_t private_impl;
|
||||
} wuffs_base__utility;
|
||||
|
||||
// --------
|
||||
|
||||
Reference in new issue
Block a user