Paul H. Hargrove, le Sun 19 Feb 2012 21:37:50 +0100, a écrit : > On 2/19/2012 10:54 AM, Samuel Thibault wrote: > [snip] > >Does it still complain if using the following? > >>static __hwloc_inline const char * > >> hwloc_obj_get_info_by_name(hwloc_obj_t obj, const char *name) > >> __hwloc_attribute_pure > >That'd be safer to make sure that the attribute is applied to the > >function, not something else. > [snip] > > I should have mentioned that I had tried Samuel's suggested form first. > Yes, it complains but worse considers this form to by a syntax error rather > than just warning about it: > > CC topology.lo > >"/users/phh1/hwloc-trunk/include/hwloc.h", line 1247.1: 1506-277 (S) > >Syntax error: possible missing ';' or ','? > >make[1]: *** [topology.lo] Error 1
Ah, right, it's an inline, so we need to declare it first with the attribute, and then define it: static __hwloc_inline const char * hwloc_obj_get_info_by_name(hwloc_obj_t obj, const char *name) __hwloc_attribute_pure; static __hwloc_inline const char * hwloc_obj_get_info_by_name(hwloc_obj_t obj, const char *name) { ... } does it work that way? Samuel