Connecting Tech Pros Worldwide Forums | Help | Site Map

best way to ignore a function? maybe using #pragma?

Member
 
Join Date: Jul 2008
Posts: 62
#1: Jul 29 '08
Hello - Is there a pragma directive that will make a function be ignored? I have a function that is not currently being used and it creates a warning. I would like to fix the warning by using pragma, if possible but all I have tried isn't working...

for example i tried:
#pragma function(myFunct) //didn't work

If pragma won't work - what is the best trick to have the compiler "ignore" a function that's not being used?

thanks!

JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,611
#2: Jul 29 '08

re: best way to ignore a function? maybe using #pragma?


If your function definition and declaration is out of the way, simply do this:

Expand|Select|Wrap|Line Numbers
  1. #define your_function(dummy, params, here)
  2.  
This removes all the function calls from the rest of your code.

kind regards,

Jos
Member
 
Join Date: Jul 2008
Posts: 62
#3: Jul 29 '08

re: best way to ignore a function? maybe using #pragma?


Quote:

Originally Posted by JosAH

If your function definition and declaration is out of the way, simply do this:

Expand|Select|Wrap|Line Numbers
  1. #define your_function(dummy, params, here)
  2.  
This removes all the function calls from the rest of your code.

kind regards,

Jos

Sorry, but I get an error after I try that, because one of my parameters is a pointer...here is kinda of what i have...
Expand|Select|Wrap|Line Numbers
  1. static void setCount( inst *countPtr, int loopCount) {
  2.   *countPtr = (loopCount);
  3. }
  4.  
i have also tried something called _attribute_ ((unused)) that didn't work.
please advise...thanks!
Newbie
 
Join Date: Jul 2008
Posts: 6
#4: Jul 29 '08

re: best way to ignore a function? maybe using #pragma?


Not sure if this will work for what you need, but could you comment it out?
JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,611
#5: Jul 29 '08

re: best way to ignore a function? maybe using #pragma?


Quote:

Originally Posted by dissectcode

Sorry, but I get an error after I try that, because one of my parameters is a pointer...here is kinda of what i have...

Expand|Select|Wrap|Line Numbers
  1. static void setCount( inst *countPtr, int loopCount) {
  2.   *countPtr = (loopCount);
  3. }
  4.  
i have also tried something called _attribute_ ((unused)) that didn't work.
please advise...thanks!

Didn't you read what I wrote? Get that definition out of the way then my
suggestion works fine. Simply comment out that definition as well.

kind regards,

Jos
Reply