This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Suggestion required for appropriate implementation


"Rahul Phalak" <rahulp1@KPITCummins.com> writes:

Please don't send e-mail to both gcc@gcc.gnu.org and
gcc-help@gcc.gnu.org.  This type of e-mail, related to the development
of gcc, is appropriate for gcc@gcc.gnu.org.

> Approach 1:
> Since these options are warning options, I intend to integrate them with
> standard '-W' options of GCC. Doing so would by default give the user
> provision of suppressing warning for a particular rule by using '-Wno'.
> 
> For e.g.:
> 1. If the user wants to analyze code for all rules, then he can do that
> by using '-Wanalyze' option.
> 2. If the user wants to analyze code for only rule 1, then he can do
> that by using '-Wanalyze-Rule1' option.
> 3. If the user wants to analyze code for all rules except rule 1, then
> he can do that by using '-Wanalyze' option followed by
> '-Wno-analyze-Rule1' option.
> 
> This approach will add command line options equal to the number of
> rules.
> Kindly suggest whether adding so many options would be appropriate.
> In order to avoid these many options, I would like to change the syntax
> to '-Wanalyze-Rule=<rule number>'. Doing so would add only 1 command
> line option but it is not possible to have similar syntax for
> suppressing warning by using '-Wno-analyze-Rule=<rule number>'. 
> Please confirm my understanding on the same.

It's a little hard to know the best approach with no idea of what
kinds of rules you are talking about.  However, given that....

Using -W options is the right approach.  I don't see any reason why
-Wno-analyze-Rule=<rule number> wouldn't work.

Probably better would be -Wanalyze-all and -Wanalyze=RULE,RULE,RULE
and -Wno-analyze=RULE,RULE,RULE where the rules have names.

While I don't speak for all the gcc maintainers, I think it's very
unlikely that we would a -Wanalyze option which took rule numbers,
unless the numbers refer to a standard reference work along the lines
of the -Weffc++ option.

> 1. If the user wants to analyze code for all rules, then he can do that
> by using 'analyze-all' option.
> 2. If the user wants to analyze code for only rule 1, then he can do
> that by using 'enable-analyze-rule=1' option.
> 3. If the user wants to analyze code for all rules except rule 1, then
> he can do that by using 'analyze-all' option followed by
> 'disable-analyze-rule=1' option.

You would need to make a very strong argument for adding a new kind of
option to gcc.  Perhaps the nature of the rules you are talking about
makes this the right approach.  However, based on what you've said so
far, these sorts of option names would be inappropriate.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]