Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] New Codan checker + questions about ASTRewrite

Hello,

I made my first changes to Eclipse CDT, but I still have a few questions.

1. The FAQ said to nag if there were no responses on a contribution, so I was hoping someone could review my patch for bug 354087.
The checker detects external header guards of the form:
#ifndef SOMEHEADER_HH
#include "someheader.hh"
#endif

2. I am currently writing a quickfix that removes external header guards (when detected with the above mentioned checker). I bumped into an exception when removing the '#ifndef' and #endif' statements using ASTRewrite.
java.lang.IllegalArgumentException: Rewriting preprocessor statements is not yet supported at
org.eclipse.cdt.core.dom.rewrite.ASTRewrite.checkSupportedNode(ASTRewrite.java:233)


at org.eclipse.cdt.core.dom.rewrite.ASTRewrite.remove(ASTRewrite.java:124)
at org.eclipse.cdt.codan.internal.checkers.ui.quickfix.QuickFixUnneededHeaderguard.modifyAST(QuickFixUnneededHeaderguard.java:71)

If I remove the throwing of the exception, the quickfix seems to work just fine. However, I have a feeling the exception is there for a reason.
In addition, ASTRewrite seems to come with a fairly strong warning to ask for more information, so: could I remove the exception, in the case of a 'remove operation' on a preprocessor statement?

Greetings,
Mathias

Back to the top