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] |
This patch fixes a number of problems that arose from the handling of assertions (more generally checks from pragma Checks). In particular if a check was explicitly disabled with Check_Policy then the argument was not analyzed leading to junk warnings. The following should compile quietly with -gnatwa: 1. pragma Check_Policy (Assertion, Disable); 2. procedure Supcheck (X : Integer) is 3. Y : constant Integer := 32; 4. begin 5. pragma Assert (X > Y); 6. null; 7. end; Previously there were warnings about X and Y not being referenced In addition the following test: 1. procedure BadconcA (I : Integer; S1 : String; S2 : String) is 2. begin 3. pragma Assert (I > 0, S1 & S2); 4. null; 5. end; generates the following expanded code: procedure badconca (i : integer; s1 : string; s2 : string) is subtype badconca__S2b is string (s2'first(1) .. s2'last(1)); subtype badconca__S1b is string (s1'first(1) .. s1'last(1)); begin null; return; end badconca; A previous attempt at fixing this by messing with Expand_Concatenate has been reversed (it caused difficulties and also was not 100% successful, since it left around a junk with of System__Concat_2. Tested on x86_64-pc-linux-gnu, committed on trunk 2013-04-11 Robert Dewar <dewar@adacore.com> * exp_ch4.adb (Expand_Concatenate): Remove wrapping in expression-with-actions node. No longer needed given fix to sem_prag and caused loss of some useful warnings. * sem.ads: Minor reformatting. * sem_prag.adb (Check_Disabled): Removed, to be replaced by not Check_Enabled. These two routines were curiously incompatible causing confusion. (Analyze_Pragma, case Check): Make sure we do not expand the string argument if the check is disabled. Avoid use of Check_Disabled, which resulted in missing analysis in some cases. * sem_prag.ads (Check_Disabled): Removed, to be replaced by not Check_Enabled. These two routines were curiously incompatible causing confusion.
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] |