casaroli opened a new pull request, #3906:
URL: https://github.com/apache/nuttx-apps/pull/3906

   ## Summary
   
   The `TIME` function of bas (`fn_timei()` in `interpreters/bas/bas_global.c`) 
divides `clock()` by `CLK_TCK`. `CLK_TCK` is the system tick rate, but 
`clock()` counts in `CLOCKS_PER_SEC` units. In NuttX both are the tick rate 
today, so the result is correct, but the code uses the wrong constant. This PR 
divides by `CLOCKS_PER_SEC`.
   
   This is the bas part of the `CLOCKS_PER_SEC` series of the dev@ thread 
"[DISCUSS] Breaking change: make CLOCKS_PER_SEC 1000000" 
(https://lists.apache.org/thread/bqxry570g9t63j63zmk4c5l82lybtx4s). 
apache/nuttx-apps#3904 (step 1, the other apps) and apache/nuttx#20923 (step 2) 
are merged. This PR does not need either of them.
   
   ## Impact
   
   None today. The object code does not change (see Testing). The result stays 
correct if `CLOCKS_PER_SEC` changes. Not a breaking change.
   
   ## Testing
   
   `qemu-armv8a:nsh` with `CONFIG_INTERPRETERS_BAS=y`, built with apps master 
and with this PR. `bas_global.o` compared with `objdump -dr` (code and 
relocations) and `objdump -s` (all sections except debug information): the only 
difference is the line number of three `assert()` calls after the change, 
because the new line break adds one line. `fn_timei()` and all data are the 
same. (The build needs `-Wno-error` on master too: `bas_statement.c` has older 
`-Werror=array-bounds` errors with GCC 14.)
   
   Style check: `tools/checkpatch.sh -c -u -m -g` checks the whole of 
`bas_global.c` and reports 1045 errors, the same number as on master. 1020 of 
them are mixed-case identifiers of the third-party bas code (for example 
`Value_new_INTEGER()`), which a whitespace commit cannot fix; the others are 
older alignment and brace errors. The changed lines add no error.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to