Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: Re: [cdt-dev] Query regarding macro expansion



On Fri, Jul 30, 2010 at 12:46 AM, SANJAY GUPTA <gupta.sanjay@xxxxxxxxxxx> wrote:

Thanks for your response.

 

I want to know whether there is a way we can supress the expansion of macros (by CDT parser) or probably atleast get to know that a statement is actually the result of expanded macro, so that we may adapt our checkers not to show violations for those cases.

Yes you can find out that result come from macro expansion

 

and you were telling that 'some checkers have user configurable parameters to suppress warning in macro definitions'. How can this be achieved?

You mean in a code? Or how user can do it?
User can do it thought setting problem parameters - open Preferences for problems (Code Analysis), select a problem
and select "Configure..." button - it bring parameters dialog (try Statement Has No Effect).
In the code - just look at the code of checker that does it - it is easy to spot. For example StatementHasNoEffectChecker - using utility method CxxAstUtils.getInstance().isInMacro(_expression_)

 

Thanks and regards,
Sanjay Gupta


------- Original Message -------
Sender : Alena Laskavaia<elaskavaia.cdt@xxxxxxxxx>
Date : Jul 29, 2010 20:32 (GMT+09:00)
Title : Re: [cdt-dev] Query regarding macro expansion

No there is no way to make preprocessor not to expand macro.

However some checkers have user configurable parameters to suppress warning in macro definitions and have exception list.
What problem you refer to specifically?

On Thu, Jul 29, 2010 at 4:09 AM, SANJAY GUPTA <gupta.sanjay@xxxxxxxxxxx> wrote:

Hi All,

I am using CODAN to statically analyze a source code. I have a query that CDT parser expands all the macros in the source code if it finds their definitions. Is there any way we can configure CDT not to expand macros ?

The problem I face with the macro expansion is that, if the macro definition has certain rule violation, the CODAN raises violations at all the places in source where the macro is used.


Thanks and regards,
Sanjay Gupta



_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev





Back to the top