bshell.runtime: add a compiler option for disabling floating-point usage

This commit is contained in:
2026-05-31 17:30:53 +01:00
parent 1a311b3796
commit ee6fdfbc48
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -24,5 +24,6 @@ endif ()
target_include_directories(bshell.runtime PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_compile_definitions(bshell.runtime PUBLIC
BSHELL_VERSION="${bshell_version}"
BSHELL_ENABLE_FLOATING_POINT=${bshell_enable_floating_point}
BSHELL_INTERACTIVE=${bshell_interactive}
BSHELL_VERBOSE=${bshell_verbose})
+2
View File
@@ -653,6 +653,7 @@ bool string_is_valid_number(
}
char *ep = NULL;
#if BSHELL_ENABLE_FLOATING_POINT == 1
double dvalue = strtod(s, &ep);
if (string_could_be_double(s) && *ep == '\0') {
if (out) {
@@ -665,6 +666,7 @@ bool string_is_valid_number(
return true;
}
#endif
int base = get_int_base_by_prefix(&s);