This is the mail archive of the gcc-patches@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] |
Tested on i686-linux, committed on trunk This patch introduces the new style switch -gnatyS It is generally a bad idea to put statements on the same line (and following) THEN and ELSE keywords, since it undermines coverage analysis (can't tell whether the test is executed and false, or executed and true). The new style switch -gnatyS forbids statements following a THEN or ELSE keyword (unless part of OR ELSE, AND THEN). The patch involves the obvious additions to stylesw and styleg as well as the call in scng. In addition a whole lot of units are edited to obey the new rules. For now, this is not added to -gnatg, but it will be later on when we have checked that various modules other than gnat itself compile OK with this switch in place. Here is a test program compiled with -gnatyS 1. procedure b (x,y,g : in out integer) is 2. begin 3. if x > 3 then y := 4; | >>> (style) no statements may follow "then" on same line 4. else g := g + 1; | >>> (style) no statements may follow "else" on same line 5. end if; 6. g := x+y+g; 7. end; 2007-08-14 Robert Dewar <dewar@adacore.com> * uintp.adb, a-ztedit.adb, s-wchcon.adb, xnmake.adb, s-wchcon.adb, par-ch5.adb, par-ch10.adb, get_targ.adb, a-wtedit.adb, a-teioed.adb, s-osinte-solaris.adb, s-osinte-solaris.ads, s-osinte-freebsd.ads, s-osinte-freebsd.adb: Minor reformatting. * styleg.adb, styleg.ads, stylesw.adb, stylesw.ads: implement style switch -gnatyS. Enable -gnatyS in GNAT style check mode
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |