mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-17 16:32:11 +01:00
Add the printf prototype to generated C files.
This commit is contained in:
1 parent
bfbcae4365
commit
3b5e858fea
4 files changed
+10
-1
No files matched your search
@@ -25,6 +25,9 @@
|
||||
#if defined(__GNUC__)
|
||||
#define PUFFS_LIKELY(expr) (__builtin_expect(!!(expr), 1))
|
||||
#define PUFFS_UNLIKELY(expr) (__builtin_expect(!!(expr), 0))
|
||||
// Declare the printf prototype. The generated code shouldn't need this at all,
|
||||
// but it's useful for manual printf debugging.
|
||||
extern int printf(const char* __restrict __format, ...);
|
||||
#else
|
||||
#define PUFFS_LIKELY(expr) (expr)
|
||||
#define PUFFS_UNLIKELY(expr) (expr)
|
||||
|
||||
@@ -13,5 +13,5 @@ const baseHeader = "" +
|
||||
|
||||
const baseImpl = "" +
|
||||
"#ifndef PUFFS_BASE_IMPL_H\n#define PUFFS_BASE_IMPL_H\n\n// Use of this source code is governed by a BSD-style license that can be found\n// in the LICENSE file.\n\n// TODO: look for (ifdef) the x86 architecture and cast the pointer? Only do so\n// if a benchmark justifies the additional code path.\n#define PUFFS_U32LE(p) \\\n (((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | \\\n ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24))\n\n// Use switch cases for coroutine suspension points, similar to the technique\n// in https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html\n//\n// We use a trivial macro instead of an explicit assignment and case statement\n// so that clang-format doesn't get confused by the unusual \"case\"s.\n#define PUFFS_COROUTINE_SUSPENSION_POINT(n) \\\n coro_susp_point = n; \\\n case n:\n\n// Clang also defines \"__GNUC__\".\n#if defined(__GNUC__)\n#define PUFFS_LIKELY(expr) (__builtin_expect(!!(expr), 1))\n#define PUFFS_UNLIKELY(expr) (__builtin_expect(" +
|
||||
"!!(expr), 0))\n#else\n#define PUFFS_LIKELY(expr) (expr)\n#define PUFFS_UNLIKELY(expr) (expr)\n#endif\n\n#endif // PUFFS_BASE_IMPL_H\n" +
|
||||
"!!(expr), 0))\n// Declare the printf prototype. The generated code shouldn't need this at all,\n// but it's useful for manual printf debugging.\nextern int printf(const char* __restrict __format, ...);\n#else\n#define PUFFS_LIKELY(expr) (expr)\n#define PUFFS_UNLIKELY(expr) (expr)\n#endif\n\n#endif // PUFFS_BASE_IMPL_H\n" +
|
||||
""
|
||||
@@ -261,6 +261,9 @@ puffs_flate_status puffs_flate_decoder_decode(puffs_flate_decoder* self,
|
||||
#if defined(__GNUC__)
|
||||
#define PUFFS_LIKELY(expr) (__builtin_expect(!!(expr), 1))
|
||||
#define PUFFS_UNLIKELY(expr) (__builtin_expect(!!(expr), 0))
|
||||
// Declare the printf prototype. The generated code shouldn't need this at all,
|
||||
// but it's useful for manual printf debugging.
|
||||
extern int printf(const char* __restrict __format, ...);
|
||||
#else
|
||||
#define PUFFS_LIKELY(expr) (expr)
|
||||
#define PUFFS_UNLIKELY(expr) (expr)
|
||||
|
||||
@@ -275,6 +275,9 @@ puffs_gif_status puffs_gif_lzw_decoder_decode(puffs_gif_lzw_decoder* self,
|
||||
#if defined(__GNUC__)
|
||||
#define PUFFS_LIKELY(expr) (__builtin_expect(!!(expr), 1))
|
||||
#define PUFFS_UNLIKELY(expr) (__builtin_expect(!!(expr), 0))
|
||||
// Declare the printf prototype. The generated code shouldn't need this at all,
|
||||
// but it's useful for manual printf debugging.
|
||||
extern int printf(const char* __restrict __format, ...);
|
||||
#else
|
||||
#define PUFFS_LIKELY(expr) (expr)
|
||||
#define PUFFS_UNLIKELY(expr) (expr)
|
||||
|
||||
Reference in new issue
Block a user