Mikhail
Mikhail

Reputation: 8028

Is there a gcc pragma that can ignore a function?

I want a command that will completely ignore a function. Somebody once showed me the command, but I can't find it in the manual.

void a()
{
return;
}
#pragma gcc_disable
void a ()
{
return q09w8uifsdf
}
#include <stdio.h>
int main ()
{
  a();
}

Upvotes: 1

Views: 553

Answers (3)

Raghu Srikanth Reddy
Raghu Srikanth Reddy

Reputation: 2711

you do not have any pragma directives for ignoring a function from executing.. you can just ignore them using conditional preprocessor directives..

#if and #ifdef can be used to ignore a function..

#ifdef checks whether a MACRO is defined or not.. and #if 0 can be used to directly ignore a function from executing..

Upvotes: 0

QuentinUK
QuentinUK

Reputation: 3077

For one liners just comment it out

#define MAYBE /##/

MAYBE int a (){ return 0;}

to keep it

#define MAYBE

MAYBE int a (){ return 0;}

Upvotes: 0

Nicholas Wilson
Nicholas Wilson

Reputation: 9685

Umm... you mean this?

void a()
{
return;
}
#if 0
void a ()
{
return q09w8uifsdf
}
#endif
#include <stdio.h>
int main ()
{
  a();
}

Upvotes: 6

Related Questions