Skip to content

Commit

Permalink
[ext] Update eyalroz/printf to v6.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
salkinium committed Oct 5, 2024
1 parent 655b2a6 commit 9646a14
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
9 changes: 7 additions & 2 deletions ext/eyalroz/module.lb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ def build(env):

env.copy("printf/src/printf/printf.h", "printf.h")
files = env.copy("printf/src/printf/printf.c", "printf.c")
env.collect(":build:ccflags", "-Wno-double-promotion", "-Wno-overflow", operations=files)
env.collect(":build:ccflags", "-Wno-overflow", operations=files)

is_hosted = env[":target"].identifier.platform == "hosted"
with_long_long = "avr" not in env[":target"].identifier.platform
with_double = "fd" in env[":target"].get_driver("core")["type"] or is_hosted
if not with_double:
env.collect(":build:ccflags", "-Wno-double-promotion", operations=files)
env.substitutions = {
"with_double": with_double,
"with_long_long": env.get(":io:with_long_long", with_long_long),
"is_hosted": env[":target"].identifier.platform == "hosted",
"is_hosted": is_hosted,
}
env.template("printf_config.h.in")
2 changes: 1 addition & 1 deletion ext/eyalroz/printf
10 changes: 4 additions & 6 deletions ext/eyalroz/printf_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,17 @@
#endif

#ifndef PRINTF_DEFAULT_FLOAT_PRECISION
#define PRINTF_DEFAULT_FLOAT_PRECISION 5
#define PRINTF_DEFAULT_FLOAT_PRECISION 5
#endif

#ifndef PRINTF_ALIAS_STANDARD_FUNCTION_NAMES
#define PRINTF_ALIAS_STANDARD_FUNCTION_NAMES {{ 0 if is_hosted else 1 }}
#ifndef PRINTF_USE_DOUBLE_INTERNALLY
#define PRINTF_USE_DOUBLE_INTERNALLY {{ 1 if with_double else 0 }}
#endif

#ifndef PRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD
#define PRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD 0
#define PRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD {{ 0 if is_hosted else 1 }}
#endif

#ifndef PRINTF_ALIAS_STANDARD_FUNCTION_NAMES_SOFT
#define PRINTF_ALIAS_STANDARD_FUNCTION_NAMES_SOFT 0
#endif


0 comments on commit 9646a14

Please sign in to comment.