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]

[Ada] Check redundant parens for conditional expressions


The style option -gnatyx checks for extra parentheses for
conditional expressions in IF and WHILE statements, but did
not apply to conditions in conditional expressions. This
patch makes it apply to this case as well:

The following should be compiled with -gnatyx

     1. pragma Ada_2012;
     2. package Condexx is
     3.    x : integer := (if (1 = 2) then 1 else 2);
                              |
        >>> warning: redundant parentheses

     4. end Condexx;

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-09-10  Robert Dewar  <dewar@adacore.com>

	* par-ch4.adb (P_Conditional_Expression): Use P_Condition for condition
	* par-ch5.adb (P_Condition): Move from body to spec
	* par.adb (Ch5.P_Condition): Move from body to spec

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]