Clearer message for functions not supported on platform

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
Post Reply
steved
Posts: 834
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 138 times

Clearer message for functions not supported on platform

Post by steved »

chSysPolledDelayX() and other functions are not supported on the 32L0 family. The error message is 'undefined function'; took me a little while to realise it was really 'unsupported function'.
It's possible to generate clearer error messages for this scenario; the following change to chsys.h works:

Code: Select all

#if PORT_SUPPORTS_RT == TRUE
  bool chSysIsCounterWithinX(rtcnt_t cnt, rtcnt_t start, rtcnt_t end);
  void chSysPolledDelayX(rtcnt_t cycles);
#else
  #define   chSysIsCounterWithinX(a, b, c)   _Pragma("GCC error \"chSysIsCounterWithinX() not available on platform\"")
  #define   chSysPolledDelayX(a) _Pragma("GCC error \"chSysPolledDelayX() not available on platform\"")
#endif

(Documentation on _Pragma: https://gcc.gnu.org/onlinedocs/gcc-8.3. ... agmas.html)
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Clearer message for functions not supported on platform

Post by Giovanni »

Hi,

It is a good idea, is that pragma standard?

Giovanni
steved
Posts: 834
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 138 times

Re: Clearer message for functions not supported on platform

Post by steved »

Giovanni wrote:Hi,

It is a good idea, is that pragma standard?

Giovanni

Part of C99 standard, according to gcc link
Not checked the detail against the standard.
Post Reply