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] Warn for failure to parenthesize unary minus


This patch gives a warning when unary minus is used in a context that
requires parentheses, and no parentheses are present, as shown by the
following test:

     1. function Test_Mod_B (N: in Integer) return Integer is
     2. begin
     3.    return N mod -10;
                        |
        >>> parentheses required for unary minus

     4. end Test_Mod_B;

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

2012-10-29  Robert Dewar  <dewar@adacore.com>

	* par-ch4.adb (P_Primary): Warn on bad use of unary minus.

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]