It is required for any CPU architecture that has asymmetry in code and data space addresses.
It is a bad idea to remove it. There is no benefit to remonving it and there is most certainly a downside. On Wed, Jan 26, 2022 at 7:06 AM Petro Karashchenko < petro.karashche...@gmail.com> wrote: > Hello team, > > Recently I noticed that some structures in common code use CODE > keyword for pointers to functions and some do not, so I have the > question: is CODE keyword still supported? > Here are few examples: > struct automount_lower_s > { > ... > CODE int (*attach)(FAR const struct automount_lower_s *lower, > automount_handler_t isr, FAR void *arg); > CODE void (*enable)(FAR const struct automount_lower_s *lower, > bool enable); > CODE bool (*inserted)(FAR const struct automount_lower_s *lower); > }; > vs > struct file_operations > { > int (*open)(FAR struct file *filep); > int (*close)(FAR struct file *filep); > ssize_t (*read)(FAR struct file *filep, FAR char *buffer, size_t buflen); > ssize_t (*write)(FAR struct file *filep, FAR const char *buffer, > size_t buflen); > off_t (*seek)(FAR struct file *filep, off_t offset, int whence); > int (*ioctl)(FAR struct file *filep, int cmd, unsigned long arg); > > /* The two structures need not be common after this point */ > > int (*poll)(FAR struct file *filep, struct pollfd *fds, bool setup); > #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS > int (*unlink)(FAR struct inode *inode); > #endif > }; > > Will appreciate your feedback. > > Best regards, > Petro >