Skip to content

Commit

Permalink
Conditionally depend on stdio.h
Browse files Browse the repository at this point in the history
The header `stdio.h` is only needed to get access to `fprintf` used in
code ifdef guarded by `USE_EXTERNAL_DEFAULT_CALLBACKS`, we can therefore
guard the include statement in the same manner.

The reason for doing this as that wasm builds in downstream user code
have to patch in an empty `stdio.h` file in order to build because of
this unconditional include.

ref:
https://github.com/rust-bitcoin/rust-secp256k1/blob/master/secp256k1-sys/depend/secp256k1.c.patch

Fix: bitcoin-core#1095
  • Loading branch information
tcharding committed Nov 2, 2022
1 parent a43e982 commit d185a6f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@

#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <limits.h>

#ifndef USE_EXTERNAL_DEFAULT_CALLBACKS
#include <stdio.h> /* for fprintf */
#endif

#define STR_(x) #x
#define STR(x) STR_(x)
#define DEBUG_CONFIG_MSG(x) "DEBUG_CONFIG: " x
Expand Down

0 comments on commit d185a6f

Please sign in to comment.