Re: Inlining function pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



yavuz yetim <yavuzyetim@xxxxxxxxxxx> writes:

> I am using GTree in GLib and the g_tree_foreach() -shown below- function takes a function pointer to call a function (say comp()) for each node while traversing the tree. 
> If I declare the function to be inlined and compile it, gcc comlains with following message:
> /var/folders/eh/ehsWlP8bFe8W4KcsmZuVyk+++TI/-Tmp-//ccXexCH9.s:2592:non-relocatable subtraction expression, "_str_print" minus "L00000000006$pb"
> /var/folders/eh/ehsWlP8bFe8W4KcsmZuVyk+++TI/-Tmp-//ccXexCH9.s:2592:symbol: "_str_print" can't be undefined in a subtraction expression
>
>
>
> somewhere in main:: g_tree_foreach(my_tree, comp, NULL);
> functions::
> inline gboolean comp(/*arguments*/) { /*do stuff*/ return FALSE;}
> /*g_tree_foreach From GLib source*/void g_tree_foreach (GTree *tree, GTraverseFunc  func, gpointer user_data){    GTreeNode *node;
>   g_return_if_fail (tree != NULL);      if (!tree->root)        return;
>   node = g_tree_first_node (tree);      while (node)    {          if ((*func) (node->key, node->value, user_data))	       break;                node = g_tree_node_next (node);      }}

This looks like a compiler bug but it's hard to be certain.  I don't see
anything named _str_print in your code sample.  Please give us a
complete small test case.  Please also tell us what version of gcc you
are using, and what target you are compiling for.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux