This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new e0b03614fdf drivers/audio: Make tone.h self-contained.
e0b03614fdf is described below
commit e0b03614fdf76d7bd96d809b36173ed61439a251
Author: Marco Casaroli <[email protected]>
AuthorDate: Fri Jul 31 09:59:38 2026 +0200
drivers/audio: Make tone.h self-contained.
tone_register() takes a struct oneshot_lowerhalf_s *, and the header does
not
include the one that defines it. Including tone.h first therefore creates
the
tag in prototype scope, and passing a real oneshot to it fails with the
memorable diagnostic "expected 'struct oneshot_lowerhalf_s *' but argument
is
of type 'struct oneshot_lowerhalf_s *'".
Every existing user happens to include nuttx/timers/oneshot.h first, which
is
why this has not bitten before.
Tested with a small file that includes nuttx/audio/tone.h first and calls
tone_register(). Before the change, GCC 13.2 gives the warning above and
GCC 15.3 stops with an error. After the change, both compile it without a
diagnostic. stm32f103-minimum:audio_tone builds.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
---
include/nuttx/audio/tone.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/nuttx/audio/tone.h b/include/nuttx/audio/tone.h
index e5ec71cce35..fe7153c2040 100644
--- a/include/nuttx/audio/tone.h
+++ b/include/nuttx/audio/tone.h
@@ -32,6 +32,7 @@
#include <fixedmath.h>
+#include <nuttx/timers/oneshot.h>
#include <nuttx/timers/pwm.h>
#include <nuttx/fs/ioctl.h>