I have created a custom sorted linked-list class which I use in my kernel for keeping track of various things and have just tried to use that same class in my boot loader. The kernel is optimised for speed, and the bootloader is optimised for size (-Os). I am using the standard 32 bit wiki GCC Cross-Compiler (GCC 4.3.0).
The problem is that this template class uses private member functions for some tasks. Let me give you a summarised example. The linked list class uses the concept of a node (with a pointer to the next node) to create the linked list of type T:
Code: Select all
template <class T>
class SList
{
public:
T *Add(T *x)
{
/* Add data (x) to a new Node and add that new node to the linked list.*/
...
InsertBefore(NodeToInsertBefore, NewNode);
...
}
private:
Node *InsertBefore(Node *PrevNode, Node *NewNode)
{
...
}
}
Now - the problem is that I get the following compile-time error:
Code: Select all
error: inlining failed in call to '...::InsertBefore(Node*, Node*)...' : optimizing for size and code size would grow.
It also surprises me that this is an error rather than a warning (and yes, I do always use -Werror and am not happy letting warnigns through the net).
Thanks in advance for any advice,
Cheers,
Adam