GNOME Bugzilla – Bug 632557
[macros] Define restrict keyword if not available
Last modified: 2010-12-03 19:48:33 UTC
See attached patch.
Created attachment 172723 [details] [review] macros: Define restrict keyword if not available This change always defines the restrict keyword if a non-C99 C compiler is used. In the case of GCC >= 4 it will be defined to __restrict__, in all other cases to nothing. This allows to use the restrict keyword unconditionally.
good idea. please push after freeze :)
commit a797b9f22bf548ff5caa70d670d26aaaade6540e Author: Sebastian Dröge <sebastian.droege@collabora.co.uk> Date: Tue Oct 19 15:52:30 2010 +0200 macros: Define restrict keyword if not available This change always defines the restrict keyword if a non-C99 C compiler is used. In the case of GCC >= 4 it will be defined to __restrict__, in all other cases to nothing. This allows to use the restrict keyword unconditionally.
Do we really want to do this in the global namespace? If we want to use this in headers, we should define GST_RESTRICT.
What problems do you see here? It's the same as for "inline", which is defined by GLib headers if it isn't available
Good point. I suppose the only error is if some theoretical non-gcc compiler supports restrict, but not c99. In that case, any 'restrict' in user code gets defined away, which *might* cause a minor performance loss. We can deal with that if it happens.