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] implement new fixed-point warning


Tested on i686-linux, committed on HEAD

If a static fixed-point expression has a value that is not a multiple
of the SMALL value of the type, then the implementation is free to
choose either surrounding multiple. GNAT always chooses the nearer
one, but it seems better practice if the user specifies which one
by assuring that the value given is indeed a multiple of SMALL. A
new warning flag -gnatwb (b for bad fixed value) enables a warning
when a static fixed-point expression has a value that is not a
multiple of the small, as shown by the following test program,
which generates the message

k.ads:3:14: warning: static fixed-point value is not a multiple of Small

when compiled with the -gnatwb switch

package K is
   type R is delta 0.125 range 0.0 .. 10.0;
   RV : R := 0.200;
end;
   
2005-03-29  Robert Dewar  <dewar@adacore.com>

	* sem_res.adb (Resolve_Real_Literal): Generate warning if static
	fixed-point expression has value that is not a multiple of the Small
	value.

	* opt.ads (Warn_On_Bad_Fixed_Value): New flag

	* s-taprop-tru64.adb (RT_Resolution): Return an integer number of
	nanoseconds.

	* ug_words: Add entry for [NO_]BAD_FIXED_VALUES for -gnatwb/-gnatwB

Attachment: difs.1
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]