CMock Failed Parsing Declaration Prototype! :-O

14 views
Skip to first unread message

Dan Rittersdorf

unread,
Jun 5, 2026, 11:30:09 AM (11 days ago) Jun 5
to ThrowTheSwitch Forums
Hello Mad Scientists -- I have a workaround for this issue, but wanted it to get reported because it seems like it should be a simple fix (he naively expects...)

Subset of code (names changed to protect the guilty):
// Note: UINT8 is defined in another header to be, not surprisingly,  uint8_t]

/*******************************************************************************
* DATA TYPES
******************************************************************************/

typedef UINT8 DeviceType_t;

/*******************************************************************************
* CONSTANTS & MACROS
******************************************************************************/
#define ONE_DEVICE_VAL      (0x00)
#define ANOTHER_DEVICE_VAL  (0x01)
#define THE_LAST_DEVICE_VAL (0x02)

static const DeviceType_t ONE_DEVICE        = (DeviceType_t) ONE_DEVICE_VAL;
static const DeviceType_t ANOTHER_DEVICE    = (DeviceType_t) ANOTHER_DEVICE_VAL;
static const DeviceType_t THE_LAST_DEVICE   = (DeviceType_t) THE_LAST_DEVICE_VAL;



Error Generated:
🧨 EXCEPTION: CMock >> Failed Parsing Declaration Prototype!
  declaration: 'const DeviceType_t ONE_DEVICE =(DeviceType_t)(0x01)'
  modifier: ''
  return: {:type => '', :name => 'cmock_to_return', :str => ' cmock_to_return', :void? => false, :ptr? => false, :const? => false, :const_ptr? => false}
  function: '(DeviceType_t)'
  args: [{:ptr? => false, :const? => false, :const_ptr? => false, :name => 'cmock_arg1', :type => '0x01'}]
🌱 Ceedling could not complete operations because of errors


Workaround:
Remove the parenthesis on the #defines:

#define ONE_DEVICE_VAL      0x00
#define ANOTHER_DEVICE_VAL  0x01
#define THE_LAST_DEVICE_VAL 0x02


David Good

unread,
Jun 5, 2026, 12:20:28 PM (11 days ago) Jun 5
to throwth...@googlegroups.com
Must have run out of parenthesis tokens ;)

I'm not familiar with the internals like that , but the double quotes after modifier are very suspicious to my eyes .

--David

--
You received this message because you are subscribed to the Google Groups "ThrowTheSwitch Forums" group.
To unsubscribe from this group and stop receiving emails from it, send an email to throwtheswitc...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/throwtheswitch/49993653-81dd-4cde-98b1-65d94ed9dd71n%40googlegroups.com.

Mark Vander Voord

unread,
Jun 5, 2026, 12:59:01 PM (11 days ago) Jun 5
to throwth...@googlegroups.com
Thanks Dan!

I'll check into this one. The "things that look sorta like functions" has been an ongoing headache. This one DOES seem like it should be rather straightforward, though.

Reply all
Reply to author
Forward
0 new messages