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

   ## Summary
   
   `tone_register()` takes a `struct oneshot_lowerhalf_s *`, but 
`include/nuttx/audio/tone.h` does not include `nuttx/timers/oneshot.h`. If a 
file includes `tone.h` first, the struct tag gets prototype scope, and a real 
oneshot pointer does not match it. This change adds the include.
   
   ## Impact
   
   Header only. Existing users include `oneshot.h` first, so they do not 
change. `tone.h` now compiles when it is the first include.
   
   ## Testing
   
   A small file includes `nuttx/audio/tone.h` first and calls `tone_register()` 
with a `struct oneshot_lowerhalf_s *`, with the include paths of a configured 
`stm32f103-minimum` tree.
   
   Before, GCC 13.2 gives a warning and GCC 15.3 gives an error (GCC 14 and 
later make `-Wincompatible-pointer-types` an error):
   
   ```
   tone_first.c:9:46: error: passing argument 4 of 'tone_register' from 
incompatible pointer type [-Wincompatible-pointer-types]
   include/nuttx/audio/tone.h:80:51: note: expected 'struct oneshot_lowerhalf_s 
*' but argument is of type 'struct oneshot_lowerhalf_s *'
   ```
   
   After, both compilers compile it with no diagnostic. 
`stm32f103-minimum:audio_tone` builds.
   
   `tools/checkpatch.sh -c -u -m -g` passes.
   


-- 
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