> Compiling LinuxCNC at the moment gives an awful lot of warnings. > > Many of them relate to packing (potentially) too many characters in to > HAL pin names with snprintf. > > Example: > > hal/user_comps/mb2hal/mb2hal_hal.c:38:5: note: ‘snprintf’ output 13 or > more bytes (assuming 60) into a destination of size 47 > > snprintf(hal_pin_name, HAL_NAME_LEN, "%s.%s.num_errors", > gbl.hal_mod_name, mb_tx->hal_tx_name); > > It isn't wrong, > https://github.com/LinuxCNC/linuxcnc/blob/master/src/hal/hal.h#L139 > #define HAL_NAME_LEN 47 /* length for pin, signal, etc, names */
Think the easiest is to increase HAL_NAME_LEN until there is no warnings. It feels a little bit ugly but expect it will work without problems. I could see HAL_NAME_LEN is used locally within fuction to declare a char array with a fixed length. In C it is not with a variable for array size, it should be possible with stack like memory allocation instead of heap and think it is allowed in ADA the used for local variables within function if I remember correct. To use malloc(...) function instead may add memory leaks. I conclude a warning in case number is to small might be the best solution available. Regards Nicklas Karlsson _______________________________________________ Emc-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-developers
