Commit f59e987
committed
fix(scanner): address -Wswitch-outside-range warnings when char is unsigned
C doesn't define the sign of the `char` type, so some architectures
(x86) use `signed char` where as others use `unsigned char`.
On architectures where unsigned char is used or if compiled with
"-funsigned-char", we see the below warnings:
src/scanner.c: In function ‘scn_dir_tag_pfx’:
src/scanner.c:470:13: warning: case label value is less than minimum value for type [-Wswitch-outside-range]
470 | case SCN_FAIL:
| ^~~~
src/scanner.c: In function ‘scn_tag’:
src/scanner.c:512:17: warning: case label value is less than minimum value for type [-Wswitch-outside-range]
512 | case SCN_FAIL:
| ^~~~
src/scanner.c:526:17: warning: case label value is less than minimum value for type [-Wswitch-outside-range]
526 | case SCN_FAIL:
| ^~~~
Define a new `ScanStatus` enum to use instead of independent `#define`s,
and update all the functions which previously returned `char` to instead
return `ScanStatus`.1 parent 4463985 commit f59e987
1 file changed
+9
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
| |||
326 | 328 | | |
327 | 329 | | |
328 | 330 | | |
329 | | - | |
| 331 | + | |
330 | 332 | | |
331 | 333 | | |
332 | 334 | | |
| |||
343 | 345 | | |
344 | 346 | | |
345 | 347 | | |
346 | | - | |
| 348 | + | |
347 | 349 | | |
348 | 350 | | |
349 | 351 | | |
350 | 352 | | |
351 | 353 | | |
352 | 354 | | |
353 | 355 | | |
354 | | - | |
| 356 | + | |
355 | 357 | | |
356 | 358 | | |
357 | 359 | | |
| |||
778 | 780 | | |
779 | 781 | | |
780 | 782 | | |
781 | | - | |
| 783 | + | |
782 | 784 | | |
783 | 785 | | |
784 | 786 | | |
| |||
0 commit comments