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] Add switch to control warning on suspicious modulus


This patch implements the switches -gnatw.m/w.M to turn
the warning for suspicious modulus (cf previous patch) values on and off.
Given the test program:

package badmod2 is
   type r is mod 32;
end;

If compiled with -gnatw.m or no switches, the following
warning is generated:

badmod2.ads:2:18: warning: 2 ** 32 may have been intended here

If compiled with -gnatw.M, no warning is generated

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

2009-07-13  Robert Dewar  <dewar@adacore.com>

	* freeze.adb (Freeze_Entity): Implement Warn_On_Suspicious_Modulus_Value

	* gnat_ugn.texi: Add documentation for -gnatw.m/.M

	* opt.ads (Warn_On_Suspicious_Modulus_Value): New flag

	* sem_warn.adb (Set_Dot_Warning_Flag): Set/reset
	Warn_On_Suspicious_Modulus_Value.

	* ug_words: Add entries for -gnatw.m/-gnatw.M.

	* usage.adb: Add lines for -gnatw.m/.M switches.

	* vms_data.ads: Add [NO]SUSPICIOUS_MODULUS for -gnatw.m/w.M

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]