Jump to content

Recommended Posts

Hi,

I have been receiving this warning message from the BoostC compiler: Warning unreferenced functions removed. The functions consist of most of my source code, the code is not commented out and the functions are referenced, ie called , several times in source code. The project compiles successfully both with and without optimization but is only a few hundred bytes whereas it should be about 10K. I can't find any documentation on this warning or help as to why this happening. Can anyone help??

 

Warren :(

Link to post
Share on other sites

The compiler usually has good reason for letting out this warning message.

 

Have you looked at the call tree to see if the function that calls your missing functions is there ?

 

Do you have any 'if' statements that always evaluate to false ? i.e. if (1 == 2) comparing constant with constant.

 

Do you have any '#if' directives that always evaluate to false ?

 

Do you have any code that is unreachable from your main() function and descendents or interrupts.

 

There will be a simple solution somewhere in your code I have no doubt.

 

Regards

 

Reynard

 

Another idea: Do you have any infinite loops with code after them. i.e. for (;:( {...} while(1) {...} these are loop forevers therefore any code below them cannot be reached. Unless they have a 'break' inside them that is.

Edited by Reynard
Link to post
Share on other sites
Hi,

I have been receiving this warning message from the BoostC compiler: Warning unreferenced functions removed. The functions consist of most of my source code, the code is not commented out and the functions are referenced, ie called , several times in source code. The project compiles successfully both with and without optimization but is only a few hundred bytes whereas it should be about 10K. I can't find any documentation on this warning or help as to why this happening. Can anyone help??

 

Warren :(

 

Hi Reynard,

Thanks, I found the problem be enabling the compiler to report all errors/warnings. As you mentioned, there was an "if" that allways evaluated false. removing it cured the problem.

However, it also revealed another problem, how to code a leap year with Boostc compiler. the usual leap_year = year%4 doesent seem to work as only literal values seem to work. Onyone any ideas??

 

Warren :ph34r:

Link to post
Share on other sites

I don't quite know what your are saying about the leap year problem. Can you expand a little.

 

int leapyear;
int year;
unsigned char four;

four = 4;
year = 2002;
leapyear = year % four;

 

This code comes up with a leapyear = 2 as expected.

 

Cheers

 

Reynard

Link to post
Share on other sites
I don't quite know what your are saying about the leap year problem. Can you expand a little.

 

int leapyear;
int year;
unsigned char four;

four = 4;
year = 2002;
leapyear = year % four;

 

This code comes up with a leapyear = 2 as expected.

 

Cheers

 

Reynard

 

 

Hi Reynard,

I have the same problem with your version as my own, but i think I know the where the problem is. I use the MPLAB IDE and while the compiler compiles this code the linker gives the following error:-

 

optimisation level:1

Error: Unresolved external function:'__rem_16_16(unsigned short,unsigned short)'

Error: Unresolved external function:'__rem_16_16(unsigned short,unsigned short)'

Error: Unresolved external function:'__rem_16_16(unsigned short,unsigned short)'

Error: Unresolved external function:'__rem_16_16(unsigned short,unsigned short)'

Error: Unresolved external function:'__rem_16_16(unsigned short,unsigned short)'

Error: Unresolved external function:'__rem_16_16(unsigned short,unsigned short)'

Error: Unresolved external function:'__rem_16_16(unsigned short,unsigned short)'

Error: Unresolved external function:'__rem_16_16(unsigned short,unsigned short)'

Error: Unresolved external function:'__rem_16_16(unsigned short,unsigned short)'

Error: Unresolved external function:'__rem_16_16(unsigned short,unsigned short)'

Error: Unresolved external function:'__rem_16_16(unsigned short,unsigned short)'

Error: Unresolved external symbol, function:__rem_16_16

 

 

failure

 

All compiles and links OK in the sourceboost IDE, should I report this as a bug?

 

Warren :(

Link to post
Share on other sites
Warren,

 

Have you added in the BoostC library file into your project as described on page 20 of the manual.

 

Cheers

 

Reynard

 

 

Hi Reynard,

Adding the linker scrpt file libc.pic18.lib to the project cleared the problem. Mmm, i thought just adding the boostlink linker was all that was required, I shall have to spend some time reading this section of the manual....... Thanks for the all the help, it would have taken me some time to sort out all the nuances of Sourceboost.

 

Best regards

Warren :(

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...