|
36 | 36 | #include <deemon/code.h> |
37 | 37 | #include <deemon/compiler/assembler.h> |
38 | 38 | #include <deemon/compiler/dec.h> |
| 39 | +#include <deemon/compiler/error.h> |
39 | 40 | #include <deemon/compiler/lexer.h> |
40 | 41 | #include <deemon/compiler/optimize.h> |
41 | 42 | #include <deemon/compiler/tpp.h> |
|
44 | 45 | #include <deemon/exec.h> |
45 | 46 | #include <deemon/file.h> |
46 | 47 | #include <deemon/filetypes.h> |
| 48 | +#include <deemon/format.h> |
47 | 49 | #include <deemon/gc.h> |
| 50 | +#include <deemon/int.h> |
48 | 51 | #include <deemon/list.h> |
49 | 52 | #include <deemon/module.h> |
50 | 53 | #include <deemon/none.h> |
|
57 | 60 | #include <deemon/tuple.h> |
58 | 61 |
|
59 | 62 | #include <hybrid/byteorder.h> |
| 63 | +#include <hybrid/debug-alignment.h> |
| 64 | +#include <hybrid/host.h> |
60 | 65 |
|
61 | 66 | #include "cmdline.h" |
62 | 67 | #include "runtime/runtime_error.h" |
63 | 68 |
|
| 69 | +/**/ |
| 70 | +#include <stddef.h> /* offsetof */ |
| 71 | +#include <stdint.h> /* uint8_t */ |
| 72 | + |
64 | 73 | DECL_BEGIN |
65 | 74 |
|
66 | 75 | #ifndef CONFIG_HAVE_strcmp |
@@ -287,7 +296,8 @@ PRIVATE WUNUSED NONNULL((1)) int DCALL cmd_O(char *arg) { |
287 | 296 | ASM_FPEEPHOLE | ASM_FOPTIMIZE | |
288 | 297 | ASM_FOPTIMIZE_SIZE); |
289 | 298 | } else { |
290 | | - level = atoi(arg); |
| 299 | + if (Dee_TAtoi(int, arg, strlen(arg), 0, &level)) |
| 300 | + goto err; |
291 | 301 | /* Level #4: Disable features that hinder optimization (i.e. debug info) */ |
292 | 302 | if (level >= 4) { |
293 | 303 | script_options.co_assembler |= ASM_FNODDI; |
@@ -333,6 +343,8 @@ PRIVATE WUNUSED NONNULL((1)) int DCALL cmd_O(char *arg) { |
333 | 343 | } |
334 | 344 | } |
335 | 345 | return 0; |
| 346 | +err: |
| 347 | + return -1; |
336 | 348 | } |
337 | 349 |
|
338 | 350 | PRIVATE WUNUSED int DCALL cmd_i(char *UNUSED(arg)) { |
@@ -432,8 +444,7 @@ PRIVATE WUNUSED int DCALL cmd_pp(char *UNUSED(arg)) { |
432 | 444 | } |
433 | 445 |
|
434 | 446 | PRIVATE WUNUSED NONNULL((1)) int DCALL cmd_ftabstop(char *arg) { |
435 | | - script_options.co_tabwidth = (uint16_t)atoi(arg); |
436 | | - return 0; |
| 447 | + return Dee_TAtoi(uint16_t, arg, strlen(arg), 0, &script_options.co_tabwidth); |
437 | 448 | } |
438 | 449 |
|
439 | 450 | PRIVATE WUNUSED int TPPCALL emitpp_reemit_pragma(void); |
|
0 commit comments