mirror of https://github.com/thesofproject/sof.git
topology: add param checks to PCM macros
Abort build if not all mandatory arguments are passed to the macros. This should help to catch invalid usage. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
This commit is contained in:
parent
a10e69d2f1
commit
322fe24e95
|
@ -71,6 +71,7 @@ define(`PCM_CAPABILITIES',
|
||||||
|
|
||||||
dnl PCM_PLAYBACK_ADD(name, pcm_id, playback)
|
dnl PCM_PLAYBACK_ADD(name, pcm_id, playback)
|
||||||
define(`PCM_PLAYBACK_ADD',
|
define(`PCM_PLAYBACK_ADD',
|
||||||
|
`ifelse(`$#', `3',
|
||||||
`SectionPCM.STR($1) {'
|
`SectionPCM.STR($1) {'
|
||||||
`'
|
`'
|
||||||
` # used for binding to the PCM'
|
` # used for binding to the PCM'
|
||||||
|
@ -84,10 +85,12 @@ define(`PCM_PLAYBACK_ADD',
|
||||||
`'
|
`'
|
||||||
` capabilities STR($3)'
|
` capabilities STR($3)'
|
||||||
` }'
|
` }'
|
||||||
`}')
|
`}', `fatal_error(`Invalid parameters ($#) to PCM_PLAYBACK_ADD')')'
|
||||||
|
)
|
||||||
|
|
||||||
dnl PCM_CAPTURE_ADD(name, pcm_id, capture)
|
dnl PCM_CAPTURE_ADD(name, pcm_id, capture)
|
||||||
define(`PCM_CAPTURE_ADD',
|
define(`PCM_CAPTURE_ADD',
|
||||||
|
`ifelse(`$#', `3',
|
||||||
`SectionPCM.STR($1) {'
|
`SectionPCM.STR($1) {'
|
||||||
`'
|
`'
|
||||||
` # used for binding to the PCM'
|
` # used for binding to the PCM'
|
||||||
|
@ -101,10 +104,12 @@ define(`PCM_CAPTURE_ADD',
|
||||||
`'
|
`'
|
||||||
` capabilities STR($3)'
|
` capabilities STR($3)'
|
||||||
` }'
|
` }'
|
||||||
`}')
|
`}', `fatal_error(`Invalid parameters ($#) to PCM_CAPTURE_ADD')')'
|
||||||
|
)
|
||||||
|
|
||||||
dnl PCM_DUPLEX_ADD(name, pcm_id, playback, capture)
|
dnl PCM_DUPLEX_ADD(name, pcm_id, playback, capture)
|
||||||
define(`PCM_DUPLEX_ADD',
|
define(`PCM_DUPLEX_ADD',
|
||||||
|
`ifelse(`$#', `4',
|
||||||
`SectionPCM.STR($1) {'
|
`SectionPCM.STR($1) {'
|
||||||
`'
|
`'
|
||||||
` # used for binding to the PCM'
|
` # used for binding to the PCM'
|
||||||
|
@ -123,6 +128,7 @@ define(`PCM_DUPLEX_ADD',
|
||||||
`'
|
`'
|
||||||
` capabilities STR($3)'
|
` capabilities STR($3)'
|
||||||
` }'
|
` }'
|
||||||
`}')
|
`}', `fatal_error(`Invalid parameters ($#) to PCM_DUPLEX_ADD')')'
|
||||||
|
)
|
||||||
|
|
||||||
divert(0)dnl
|
divert(0)dnl
|
||||||
|
|
|
@ -10,6 +10,9 @@ dnl Argument iterator.
|
||||||
define(`argn', `ifelse(`$1', 1, ``$2'',
|
define(`argn', `ifelse(`$1', 1, ``$2'',
|
||||||
`argn(decr(`$1'), shift(shift($@)))')')
|
`argn(decr(`$1'), shift(shift($@)))')')
|
||||||
|
|
||||||
|
define(`fatal_error', `errprint(`m4: '__file__: __line__`: fatal error: $*
|
||||||
|
')m4exit(1)')
|
||||||
|
|
||||||
dnl Defines a list of items from a variable number of params.
|
dnl Defines a list of items from a variable number of params.
|
||||||
dnl Use as last argument in a macro.
|
dnl Use as last argument in a macro.
|
||||||
dnl The first argument specifies the number of tabs to be added for formatting
|
dnl The first argument specifies the number of tabs to be added for formatting
|
||||||
|
|
Loading…
Reference in New Issue