[ ant-contrib-Bugs-1775873 ] Sunpro Forte compiler can't set warning level to default

"SourceForge.net" <[email protected]> Wed, 22 Aug 2007 16:51:36 -0700
Newsgroups gmane.comp.java.ant-contrib.devel
Message-ID <[email protected]>
Bugs item #1775873, was opened at 2007-08-16 20:12
Message generated for change (Comment added) made by darius42
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=416920&aid=1775873&group_id=36177

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: cpptasks
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: David Haney (darius42)
Summary: Sunpro Forte compiler can't set warning level to default

Initial Comment:
>From Michael Micucci: micucci at roguewave dot com:

In the Sunpro Forte-specific code:

public void addWarningSwitch(Vector args, int level) {
  switch (level) {
    case 0 :
      args.addElement("-w");
      break;
    case 1 :
    case 2 :
      args.addElement("+w");
      break;
    case 3 :
    case 4 :
    case 5 :
      args.addElement("+w2");
      break;
  }
}

This means there is no way to have a compile line without either +w, +w2, or -w.  For the CC compiler, the default setting is not to specify any of these.  This will print out regular warnings.  To specify +w will result in more warnings than the default level, however the 'default' level in cc-task (which is level '2') adds the +w flag, which is incorrect.  I also cannot workaround this since I can only use "compilerarg" to ADD compiler arguments, not remove them.

I propose the following code instead:

public void addWarningSwitch(Vector args, int level) {
  switch (level) {
    case 0 :
      args.addElement("-w");
      break;
    case 1 :
    case 2 :
      break;
    case 3 :
      args.addElement("+w");
      break;
    case 4 :
    case 5 :
      args.addElement("+w2");
      break;
  }
}

This will allow 'severe' and 'default' warnings levels to use the default warning levels for the compiler, while the 'production' level will use "+w" which is one level higher than default and 'debug' and 'aserror' level can still use "+w2" which will result in a large number of warning conditions.  I can also see having 'production' (case 3) result in no arguments and 'debug' (case 4) resulting in +w, with only 'aserror' (case 5) using the +w2 flag.

Thanks!

-- Michael Micucci - micucci at roguewave dot com
-- Senior Software Developer, Roguewave Software


----------------------------------------------------------------------

>Comment By: David Haney (darius42)
Date: 2007-08-22 23:51

Message:
Logged In: YES 
user_id=1140024
Originator: NO

Committed patch 1776490 in revision 140.

----------------------------------------------------------------------

Comment By: David Haney (darius42)
Date: 2007-08-17 18:02

Message:
Logged In: YES 
user_id=1140024
Originator: NO

I submitted a patch for this issue under the Patches tracker option:
1776490.

I modified the warning levels slightly from those Mike recommended.  In
particular, I modified case 4 to use "+w2", and case 5 to use "+w2" and
"-xwe".  The latter will convert all warning messages to errors, which
appears to be consistent with other compilers and with the description of
warning level 5.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=416920&aid=1775873&group_id=36177

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/