#213 Sunpro Forte compiler can't set warning level to default

closed-fixed
David Haney
cpptasks (103)
5
2007-08-22
2007-08-16
Anonymous
No

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

Discussion

  • David Haney
    David Haney
    2007-08-17

    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.

     
  • David Haney
    David Haney
    2007-08-22

    • assigned_to: carnold --> darius42
    • status: open --> closed-fixed
     
  • David Haney
    David Haney
    2007-08-22

    Logged In: YES
    user_id=1140024
    Originator: NO

    Committed patch 1776490 in revision 140.